From 77876dc4119ae99f47ccba95c2ecdb8d8c1d3038 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bernhard=20Rosenkr=C3=A4nzer?= Date: Sun, 16 Jan 2022 01:45:36 +0100 Subject: [PATCH] Fix build with ffmpeg 5.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Bernhard Rosenkränzer --- app/src/decoder.h | 2 +- app/src/icon.c | 2 +- app/src/stream.c | 3 ++- app/src/stream.h | 4 ++-- app/src/v4l2_sink.c | 2 ++ app/src/v4l2_sink.h | 2 +- 6 files changed, 9 insertions(+), 6 deletions(-) diff --git a/app/src/decoder.h b/app/src/decoder.h index 257f751a..dd54b78a 100644 --- a/app/src/decoder.h +++ b/app/src/decoder.h @@ -16,7 +16,7 @@ struct decoder { struct sc_frame_sink *sinks[DECODER_MAX_SINKS]; unsigned sink_count; - AVCodecContext *codec_ctx; + struct AVCodecContext *codec_ctx; AVFrame *frame; }; diff --git a/app/src/icon.c b/app/src/icon.c index 1d670242..8b181120 100644 --- a/app/src/icon.c +++ b/app/src/icon.c @@ -91,7 +91,7 @@ decode_image(const char *path) { goto close_input; } - AVCodecContext *codec_ctx = avcodec_alloc_context3(codec); + struct AVCodecContext *codec_ctx = avcodec_alloc_context3(codec); if (!codec_ctx) { LOG_OOM(); goto close_input; diff --git a/app/src/stream.c b/app/src/stream.c index 3ac0f5e1..027c63a3 100644 --- a/app/src/stream.c +++ b/app/src/stream.c @@ -2,6 +2,7 @@ #include #include +#include #include #include @@ -192,7 +193,7 @@ static int run_stream(void *data) { struct stream *stream = data; - AVCodec *codec = avcodec_find_decoder(AV_CODEC_ID_H264); + const AVCodec *codec = avcodec_find_decoder(AV_CODEC_ID_H264); if (!codec) { LOGE("H.264 decoder not found"); goto end; diff --git a/app/src/stream.h b/app/src/stream.h index 362bc4a7..5029620e 100644 --- a/app/src/stream.h +++ b/app/src/stream.h @@ -20,8 +20,8 @@ struct stream { struct sc_packet_sink *sinks[STREAM_MAX_SINKS]; unsigned sink_count; - AVCodecContext *codec_ctx; - AVCodecParserContext *parser; + struct AVCodecContext *codec_ctx; + struct AVCodecParserContext *parser; // successive packets may need to be concatenated, until a non-config // packet is available AVPacket *pending; diff --git a/app/src/v4l2_sink.c b/app/src/v4l2_sink.c index dce11ce1..982c0a92 100644 --- a/app/src/v4l2_sink.c +++ b/app/src/v4l2_sink.c @@ -5,6 +5,8 @@ #include "util/log.h" #include "util/str.h" +#include + /** Downcast frame_sink to sc_v4l2_sink */ #define DOWNCAST(SINK) container_of(SINK, struct sc_v4l2_sink, frame_sink) diff --git a/app/src/v4l2_sink.h b/app/src/v4l2_sink.h index 8737a607..89f882f8 100644 --- a/app/src/v4l2_sink.h +++ b/app/src/v4l2_sink.h @@ -15,7 +15,7 @@ struct sc_v4l2_sink { struct sc_video_buffer vb; AVFormatContext *format_ctx; - AVCodecContext *encoder_ctx; + struct AVCodecContext *encoder_ctx; char *device_name; struct sc_size frame_size;