From 4f4f560e40ba0b760cf688eb024be3cc734ca347 Mon Sep 17 00:00:00 2001
From: Mladen Milinkovic <maxrd2@smoothware.net>
Date: Tue, 25 Jan 2022 14:01:56 +0100
Subject: [PATCH] Fix compilation with ffmpeg5 #63

---
 src/streamprocessor/streamprocessor.cpp   | 2 +-
 src/videoplayer/backend/decoder.h         | 1 +
 src/videoplayer/backend/framequeue.h      | 1 +
 src/videoplayer/backend/streamdemuxer.cpp | 2 +-
 4 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/streamprocessor/streamprocessor.cpp b/src/streamprocessor/streamprocessor.cpp
index b86795e..8faf8a2 100644
--- a/src/streamprocessor/streamprocessor.cpp
+++ b/src/streamprocessor/streamprocessor.cpp
@@ -195,7 +195,7 @@ StreamProcessor::findStream(int streamType, int streamIndex, bool imageSub)
 		int ret;
 		char errorText[1024];
 
-		AVCodec *dec = avcodec_find_decoder(m_avStream->codecpar->codec_id);
+		const AVCodec *dec = avcodec_find_decoder(m_avStream->codecpar->codec_id);
 		if(!dec) {
 			qWarning() << "Failed to find decoder for stream" << i;
 			return false;
diff --git a/src/videoplayer/backend/decoder.h b/src/videoplayer/backend/decoder.h
index 4ab95b2..fb6840d 100644
--- a/src/videoplayer/backend/decoder.h
+++ b/src/videoplayer/backend/decoder.h
@@ -11,6 +11,7 @@
 #include <QThread>
 
 extern "C" {
+#include "libavcodec/avcodec.h"
 #include "libavformat/avformat.h"
 }
 
diff --git a/src/videoplayer/backend/framequeue.h b/src/videoplayer/backend/framequeue.h
index dc9b2fa..ece1166 100644
--- a/src/videoplayer/backend/framequeue.h
+++ b/src/videoplayer/backend/framequeue.h
@@ -9,6 +9,7 @@
 #define FRAMEQUEUE_H
 
 extern "C" {
+#include "libavcodec/avcodec.h"
 #include "libavformat/avformat.h"
 }
 
diff --git a/src/videoplayer/backend/streamdemuxer.cpp b/src/videoplayer/backend/streamdemuxer.cpp
index 1e339b3..e8320ea 100644
--- a/src/videoplayer/backend/streamdemuxer.cpp
+++ b/src/videoplayer/backend/streamdemuxer.cpp
@@ -230,7 +230,7 @@ StreamDemuxer::componentOpen(int streamIndex)
 {
 	AVFormatContext *ic = m_vs->fmtContext;
 	AVCodecContext *avCtx;
-	AVCodec *codec;
+	const AVCodec *codec;
 	AVDictionary *opts = nullptr;
 	AVDictionaryEntry *t = nullptr;
 	int sampleRate, nbChannels;
-- 
GitLab

