From: Jaroslav Kysela Date: Tue, 12 Sep 2017 07:09:57 +0000 (+0200) Subject: trancode: a blind shot to make functional rpi mmal decoders, issue #4572 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3391e1d99d2d9832fa165f01cdd5b0c44444319e;p=thirdparty%2Ftvheadend.git trancode: a blind shot to make functional rpi mmal decoders, issue #4572 --- diff --git a/Makefile.ffmpeg b/Makefile.ffmpeg index 8ae182966..6d4d2ada7 100644 --- a/Makefile.ffmpeg +++ b/Makefile.ffmpeg @@ -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 # diff --git a/configure b/configure index 0262b1be2..645ec494f 100755 --- 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 diff --git a/src/transcoding/transcode/stream.c b/src/transcoding/transcode/stream.c index 9d68dce3e..fbf957576 100644 --- a/src/transcoding/transcode/stream.c +++ b/src/transcoding/transcode/stream.c @@ -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;