From f696dcaec3b65ba98eabf5bb0724379ebb5f15f7 Mon Sep 17 00:00:00 2001 From: Frankenstone Date: Wed, 27 Feb 2019 14:14:19 +0100 Subject: [PATCH] fix ffmpeg compiler warnings, thx DboxOldie Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/48882de906b2aa8530a2ca0d7bef294ce1a9e3a9 Author: Frankenstone Date: 2019-02-27 (Wed, 27 Feb 2019) --- lib/libdvbsub/dvbsubtitle.cpp | 2 ++ src/driver/audiodec/ffmpegdec.cpp | 6 +++++- src/driver/record.cpp | 6 +++++- src/driver/streamts.cpp | 6 +++++- src/gui/streaminfo2.cpp | 3 ++- 5 files changed, 19 insertions(+), 4 deletions(-) diff --git a/lib/libdvbsub/dvbsubtitle.cpp b/lib/libdvbsub/dvbsubtitle.cpp index 2b9d2c521..91aaa1df2 100644 --- a/lib/libdvbsub/dvbsubtitle.cpp +++ b/lib/libdvbsub/dvbsubtitle.cpp @@ -171,7 +171,9 @@ cDvbSubtitleConverter::cDvbSubtitleConverter(void) avctx = NULL; avcodec = NULL; +#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 9, 100) avcodec_register_all(); +#endif avcodec = avcodec_find_decoder(CODEC_DVB_SUB);//CODEC_ID_DVB_SUBTITLE or AV_CODEC_ID_DVB_SUBTITLE from 57.1.100 if (!avcodec) { dbgconverter("cDvbSubtitleConverter: unable to get dvb subtitle codec!\n"); diff --git a/src/driver/audiodec/ffmpegdec.cpp b/src/driver/audiodec/ffmpegdec.cpp index 24fd40af6..d61566845 100644 --- a/src/driver/audiodec/ffmpegdec.cpp +++ b/src/driver/audiodec/ffmpegdec.cpp @@ -52,7 +52,9 @@ extern "C" { #define av_frame_free avcodec_free_frame #endif -#if (LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 57, 8, 0 )) +#if (LIBAVCODEC_VERSION_MAJOR > 55) +#define av_free_packet av_packet_unref +#else #define av_packet_unref av_free_packet #endif @@ -85,8 +87,10 @@ CFfmpegDec::CFfmpegDec(void) buffer_size = 0x1000; buffer = NULL; avc = NULL; +#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 9, 100) avcodec_register_all(); av_register_all(); +#endif } CFfmpegDec::~CFfmpegDec(void) diff --git a/src/driver/record.cpp b/src/driver/record.cpp index dd0c6e2ee..2e3342b4a 100644 --- a/src/driver/record.cpp +++ b/src/driver/record.cpp @@ -68,7 +68,9 @@ extern "C" { #include } -#if (LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 57, 8, 0 )) +#if (LIBAVCODEC_VERSION_MAJOR > 55) +#define av_free_packet av_packet_unref +#else #define av_packet_unref av_free_packet #endif @@ -2259,8 +2261,10 @@ bool CStreamRec::Open(CZapitChannel * channel) } //av_log_set_level(AV_LOG_VERBOSE); +#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 9, 100) av_register_all(); avcodec_register_all(); +#endif avformat_network_init(); printf("%s: Open input [%s]....\n", __FUNCTION__, url.c_str()); diff --git a/src/driver/streamts.cpp b/src/driver/streamts.cpp index eb10cda04..59e1366aa 100644 --- a/src/driver/streamts.cpp +++ b/src/driver/streamts.cpp @@ -60,7 +60,9 @@ #include #include -#if (LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 57, 8, 0 )) +#if (LIBAVCODEC_VERSION_MAJOR > 55) +#define av_free_packet av_packet_unref +#else #define av_packet_unref av_free_packet #endif @@ -798,8 +800,10 @@ bool CStreamStream::Open() } //av_log_set_level(AV_LOG_VERBOSE); +#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 9, 100) av_register_all(); avcodec_register_all(); +#endif avformat_network_init(); printf("%s: Open input [%s]....\n", __FUNCTION__, url.c_str()); diff --git a/src/gui/streaminfo2.cpp b/src/gui/streaminfo2.cpp index 59d944ffe..395696fb7 100644 --- a/src/gui/streaminfo2.cpp +++ b/src/gui/streaminfo2.cpp @@ -307,9 +307,10 @@ void CStreamInfo2::probeStreams() #ifdef ENABLE_FFMPEG_LOGGING av_log_set_callback(log_callback); #endif +#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58, 9, 100) avcodec_register_all(); av_register_all(); - +#endif AVIOContext *avioc = NULL; int buffer_size = 188 * 128; unsigned char *buffer = (unsigned char *) av_malloc(buffer_size);