]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
trancode: a blind shot to make functional rpi mmal decoders, issue #4572
authorJaroslav Kysela <perex@perex.cz>
Tue, 12 Sep 2017 07:09:57 +0000 (09:09 +0200)
committerJaroslav Kysela <perex@perex.cz>
Tue, 12 Sep 2017 07:09:57 +0000 (09:09 +0200)
Makefile.ffmpeg
configure
src/transcoding/transcode/stream.c

index 8ae182966cec4f53776c96cc458c020af011f130..6d4d2ada792ba949eefbe05fdba4274baba663c8 100644 (file)
@@ -562,6 +562,19 @@ FFMPEG_DIFFS += ffmpeg.vaapi_encode.diff
 endif
 
 
+# ##############################################################################
+# MMAL
+#
+
+ifeq (yes,$(CONFIG_MMAL))
+
+EXTLIBS  += mmal
+HWACCELS += h264_mmal mpeg2_mmal
+DECODERS += h264_mmal
+
+endif
+
+
 # ##############################################################################
 # OMX
 #
index 0262b1be22881b67d3c0eec51364577854da2f01..645ec494f0ead68bdc670b0a187d2b51ed3fb2c7 100755 (executable)
--- a/configure
+++ b/configure
@@ -54,6 +54,7 @@ OPTIONS=(
   "libopus_static:yes"
   "nvenc:no"
   "vaapi:auto"
+  "mmal:no"
   "omx:no"
   "inotify:auto"
   "epoll:auto"
@@ -552,6 +553,7 @@ if enabled ffmpeg_static; then
     check_cc_header "bcm_host" omx_rpi
     if enabled omx_rpi; then
       CFLAGS="-I/opt/vc/include/IL $OLDCFLAGS"
+      enable mmal
     else
       CFLAGS=$OLDCFLAGS
     fi
index 9d68dce3e0ded32d1825504a7c97e87a02f2ef4b..fbf957576510f760f3a997ed75014d3949847546 100644 (file)
@@ -19,6 +19,7 @@
 
 
 #include "internals.h"
+#include "../codec/internals.h"
 
 
 /* TVHStream ================================================================ */
@@ -65,7 +66,19 @@ tvh_stream_setup(TVHStream *self, TVHCodecProfile *profile, tvh_ssc_t *ssc)
                        streaming_component_type2txt(ssc->ssc_type));
         return -1;
     }
-    if (!(icodec = avcodec_find_decoder(icodec_id))) {
+#if ENABLE_MMAL
+    if (idnode_is_instance(&profile->idnode,
+                           (idclass_t *)&codec_profile_video_class)) {
+      if (tvh_codec_profile_video_get_hwaccel(profile) > 0) {
+        if (icodec_id == AV_CODEC_ID_H264) {
+            icodec = avcodec_find_decoder_by_id("h264_mmal");
+        } else if (icodec_id == AV_CODEC_ID_MPEG2VIDEO) {
+            icodec = avcodec_find_decoder_by_id("mpeg2_mmal");
+        }
+      }
+    }
+#endif
+    if (!icodec && !(icodec = avcodec_find_decoder(icodec_id))) {
         tvh_stream_log(self, LOG_ERR, "failed to find decoder for '%s'",
                        streaming_component_type2txt(ssc->ssc_type));
         return -1;