summaryrefslogtreecommitdiff
path: root/package/freerdp/0004-ffmpeg30.patch
blob: a7998b7894a458648cbb3598cde228f84e818347 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
From b7b66968f93f6ce75dd06d12638e14029bf3717b Mon Sep 17 00:00:00 2001
From: Alexis Ballier <aballier@gentoo.org>
Date: Thu, 17 Sep 2015 10:36:44 +0200
Subject: [PATCH] channels/tsmf/client/ffmpeg: Fix build with ffmpeg git
 master.

Replace old, deprecated and now removed, APIs with their new equivalent while retaining backward compatibility with old ffmpeg versions.

Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
[Downloaded from upstream commit:
 https://github.com/FreeRDP/FreeRDP/commit/f8ceb3f6061583c650bd4f6cddc10bc0471f2076]
---
 channels/tsmf/client/ffmpeg/tsmf_ffmpeg.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/channels/tsmf/client/ffmpeg/tsmf_ffmpeg.c b/channels/tsmf/client/ffmpeg/tsmf_ffmpeg.c
index d0880e7..e1b9f83 100644
--- a/channels/tsmf/client/ffmpeg/tsmf_ffmpeg.c
+++ b/channels/tsmf/client/ffmpeg/tsmf_ffmpeg.c
@@ -61,6 +61,9 @@
 #define AV_CODEC_ID_AC3 CODEC_ID_AC3
 #endif
 
+#if LIBAVUTIL_VERSION_MAJOR < 52
+#define AV_PIX_FMT_YUV420P PIX_FMT_YUV420P
+#endif
 
 typedef struct _TSMFFFmpegDecoder
 {
@@ -102,7 +105,11 @@ static BOOL tsmf_ffmpeg_init_video_stream(ITSMFDecoder* decoder, const TS_AM_MED
 	mdecoder->codec_context->bit_rate = media_type->BitRate;
 	mdecoder->codec_context->time_base.den = media_type->SamplesPerSecond.Numerator;
 	mdecoder->codec_context->time_base.num = media_type->SamplesPerSecond.Denominator;
+#if LIBAVCODEC_VERSION_MAJOR < 55
 	mdecoder->frame = avcodec_alloc_frame();
+#else
+	mdecoder->frame = av_frame_alloc();
+#endif
 	return TRUE;
 }
 
@@ -328,7 +335,11 @@ static BOOL tsmf_ffmpeg_decode_video(ITSMFDecoder* decoder, const BYTE *data, UI
 		if (!mdecoder->decoded_data)
 			return FALSE;
 
+#if LIBAVCODEC_VERSION_MAJOR < 55
 		frame = avcodec_alloc_frame();
+#else
+		frame = av_frame_alloc();
+#endif
 		avpicture_fill((AVPicture*) frame, mdecoder->decoded_data,
 					   mdecoder->codec_context->pix_fmt,
 					   mdecoder->codec_context->width, mdecoder->codec_context->height);
@@ -400,7 +411,11 @@ static BOOL tsmf_ffmpeg_decode_audio(ITSMFDecoder* decoder, const BYTE *data, UI
 									(int16_t *) dst, &frame_size, src, src_size);
 #else
 		{
+#if LIBAVCODEC_VERSION_MAJOR < 55
 			AVFrame *decoded_frame = avcodec_alloc_frame();
+#else
+			AVFrame *decoded_frame = av_frame_alloc();
+#endif
 			int got_frame = 0;
 			AVPacket pkt;
 			av_init_packet(&pkt);
@@ -480,7 +495,7 @@ static UINT32 tsmf_ffmpeg_get_decoded_format(ITSMFDecoder* decoder)
 
 	switch (mdecoder->codec_context->pix_fmt)
 	{
-		case PIX_FMT_YUV420P:
+		case AV_PIX_FMT_YUV420P:
 			return RDP_PIXFMT_I420;
 		default:
 			WLog_ERR(TAG, "unsupported pixel format %u",