From bfabd54d2b47f7a23cd132ce39481865ca18df03 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Sun, 29 Aug 2021 17:10:24 +0200 Subject: [PATCH] build with ffmpeg version > 59.0.100 Origin commit data ------------------ Branch: master Commit: https://github.com/neutrino-images/ni-libstb-hal/commit/6898f3599df1aec2773a822a3b3f32ffac18b7b1 Author: Jacek Jendrzej Date: 2021-08-29 (Sun, 29 Aug 2021) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- libarmbox/video.cpp | 10 +++++++++- libeplayer3/container/container_ffmpeg.c | 2 ++ libeplayer3/container/mpeg4p2_ffmpeg.c | 1 + libeplayer3/container/wrapped_ffmpeg.c | 2 ++ libgeneric-pc/audio.cpp | 10 ++++++++-- libgeneric-pc/video.cpp | 10 ++++++++-- 6 files changed, 30 insertions(+), 5 deletions(-) diff --git a/libarmbox/video.cpp b/libarmbox/video.cpp index 24c7351..f5589a5 100644 --- a/libarmbox/video.cpp +++ b/libarmbox/video.cpp @@ -242,7 +242,11 @@ void write_frame(AVFrame *in_frame, int fd) return; static const unsigned char pes_header[] = {0x0, 0x0, 0x1, 0xe0, 0x00, 0x00, 0x80, 0x80, 0x5, 0x21, 0x0, 0x1, 0x0, 0x1}; +#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(59,0,100) AVCodec *codec = avcodec_find_encoder(AV_CODEC_ID_MPEG2VIDEO); +#else + const AVCodec *codec = avcodec_find_encoder(AV_CODEC_ID_MPEG2VIDEO); +#endif if (codec) { AVCodecContext *codec_context = avcodec_alloc_context3(codec); @@ -354,7 +358,11 @@ int decode_frame(AVCodecContext *codecContext, AVPacket &packet, int fd) AVCodecContext *open_codec(AVMediaType mediaType, AVFormatContext *formatContext) { +#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(59,0,100) AVCodec *codec = NULL; +#else + const AVCodec *codec = NULL; +#endif AVCodecContext *codecContext = NULL; int stream_index; #if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(57,25,101) @@ -1475,4 +1483,4 @@ int cVideo::GetAudioDestination() void cVideo::SetAudioDestination(int audio_dest) { hdmi_cec::getInstance()->SetAudioDestination(audio_dest); -} \ No newline at end of file +} diff --git a/libeplayer3/container/container_ffmpeg.c b/libeplayer3/container/container_ffmpeg.c index 4f447e7..f80fb4a 100644 --- a/libeplayer3/container/container_ffmpeg.c +++ b/libeplayer3/container/container_ffmpeg.c @@ -1829,7 +1829,9 @@ int32_t container_ffmpeg_init_av_context(Context_t *context, char *filename, uin } if (avContextTab[AVIdx] != NULL) { +#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(59,0,100) avContextTab[AVIdx]->iformat->flags |= AVFMT_SEEK_TO_PTS; +#endif avContextTab[AVIdx]->flags = AVFMT_FLAG_GENPTS; } printf("minimal Probe: %d\n", context->playback->noprobe); diff --git a/libeplayer3/container/mpeg4p2_ffmpeg.c b/libeplayer3/container/mpeg4p2_ffmpeg.c index 68674fd..993857e 100755 --- a/libeplayer3/container/mpeg4p2_ffmpeg.c +++ b/libeplayer3/container/mpeg4p2_ffmpeg.c @@ -2,6 +2,7 @@ // mpeg4-part2 in mipsel receivers // http://forums.openpli.org/topic/39326-gstreamer10-and-mpeg4-part2/?hl=%2Bmpeg4+%2Bpart2 // +#include // mpeg4_unpack_bframes typedef struct diff --git a/libeplayer3/container/wrapped_ffmpeg.c b/libeplayer3/container/wrapped_ffmpeg.c index a6ed9b8..79ddc2c 100644 --- a/libeplayer3/container/wrapped_ffmpeg.c +++ b/libeplayer3/container/wrapped_ffmpeg.c @@ -3,6 +3,8 @@ * allows to compile and use exteplayer3 * with old ffmpeg libs */ +#include + static void wrapped_frame_free(void *param) { #if (LIBAVCODEC_VERSION_MAJOR >= 55) diff --git a/libgeneric-pc/audio.cpp b/libgeneric-pc/audio.cpp index 0fd5e9f..264b9d3 100644 --- a/libgeneric-pc/audio.cpp +++ b/libgeneric-pc/audio.cpp @@ -36,6 +36,7 @@ extern "C" { #include #include #include +#include #include } /* ffmpeg buf 2k */ @@ -351,9 +352,14 @@ void cAudio::run() av_register_all(); #endif - AVCodec *codec; - AVFormatContext *avfc = NULL; +#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(59,0,100) AVInputFormat *inp; + AVCodec *codec; +#else + const AVInputFormat *inp; + const AVCodec *codec; +#endif + AVFormatContext *avfc = NULL; AVFrame *frame; uint8_t *inbuf = (uint8_t *)av_malloc(INBUF_SIZE); AVPacket avpkt; diff --git a/libgeneric-pc/video.cpp b/libgeneric-pc/video.cpp index db9af04..666586d 100644 --- a/libgeneric-pc/video.cpp +++ b/libgeneric-pc/video.cpp @@ -33,6 +33,7 @@ extern "C" { #include #include #include +#include } /* ffmpeg buf 32k */ @@ -259,7 +260,7 @@ bool cVideo::ShowPicture(const char *fname) AVFormatContext *avfc = NULL; AVCodecContext *c = NULL; AVCodecParameters *p = NULL; - AVCodec *codec; + const AVCodec *codec; AVFrame *frame, *rgbframe; AVPacket avpkt; @@ -495,11 +496,16 @@ static int my_read(void *, uint8_t *buf, int buf_size) void cVideo::run(void) { hal_info("====================== start decoder thread ================================\n"); +#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(59,0,100) + AVInputFormat *inp; AVCodec *codec; +#else + const AVInputFormat *inp; + const AVCodec *codec; +#endif AVCodecParameters *p = NULL; AVCodecContext *c = NULL; AVFormatContext *avfc = NULL; - AVInputFormat *inp; AVFrame *frame, *rgbframe; uint8_t *inbuf = (uint8_t *)av_malloc(INBUF_SIZE); AVPacket avpkt;