From dfd4df2dac651e12fab7873d27aa46113698021f Mon Sep 17 00:00:00 2001
From: Andrew Randrianasulu <randrianasulu@gmail.com>
Date: Mon, 4 Apr 2022 02:48:04 +0300
Subject: [PATCH 66/71] Even more ffmpeg versioning in ffmpeg.C

---
 cinelerra-5.1/cinelerra/ffmpeg.C | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/cinelerra-5.1/cinelerra/ffmpeg.C b/cinelerra-5.1/cinelerra/ffmpeg.C
index d4f63ebf..4ed25453 100644
--- a/cinelerra-5.1/cinelerra/ffmpeg.C
+++ b/cinelerra-5.1/cinelerra/ffmpeg.C
@@ -3032,12 +3032,11 @@ int FFMPEG::open_encoder(const char *type, const char *spec)
 		}
 		if( ret >= 0 ) {
 _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
-			//ret = avcodec_copy_context(st->codec, ctx);
-			//AVCodecContext *codec_ctx = avcodec_alloc_context3(ctx);
+#if LIBAVCODEC_VERSION_INT <= AV_VERSION_INT(58,134,100)
+			ret = avcodec_copy_context(st->codec, ctx);
+#else
 			ret = avcodec_parameters_to_context(ctx, st->codecpar);
-			// if (ret < 0)
-			//	fprintf(stderr, "could not copy codecpar to tmp codec_ctx\n");
-			//ret = avcodec_parameters_from_context(codec_ctx, 
+#endif
 _Pragma("GCC diagnostic warning \"-Wdeprecated-declarations\"")
 			if( ret < 0 )
 				fprintf(stderr, "Could not copy the stream context\n");
@@ -3682,7 +3681,11 @@ Preferences *FFMPEG::ff_prefs()
 
 double FFVideoStream::get_rotation_angle()
 {
+#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(59,16,100)
 	size_t size = 0;
+#else
+	int size = 0;
+#endif
 	int *matrix = (int*)av_stream_get_side_data(st, AV_PKT_DATA_DISPLAYMATRIX, &size);
 	int len = size/sizeof(*matrix);
 	if( !matrix || len < 5 ) return 0;
-- 
2.35.1

