1 From b7b66968f93f6ce75dd06d12638e14029bf3717b Mon Sep 17 00:00:00 2001
2 From: Alexis Ballier <aballier@gentoo.org>
3 Date: Thu, 17 Sep 2015 10:36:44 +0200
4 Subject: [PATCH] channels/tsmf/client/ffmpeg: Fix build with ffmpeg git
7 Replace old, deprecated and now removed, APIs with their new equivalent while retaining backward compatibility with old ffmpeg versions.
9 Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
10 [Downloaded from upstream commit:
11 https://github.com/FreeRDP/FreeRDP/commit/f8ceb3f6061583c650bd4f6cddc10bc0471f2076]
13 channels/tsmf/client/ffmpeg/tsmf_ffmpeg.c | 17 ++++++++++++++++-
14 1 file changed, 16 insertions(+), 1 deletion(-)
16 diff --git a/channels/tsmf/client/ffmpeg/tsmf_ffmpeg.c b/channels/tsmf/client/ffmpeg/tsmf_ffmpeg.c
17 index d0880e7..e1b9f83 100644
18 --- a/channels/tsmf/client/ffmpeg/tsmf_ffmpeg.c
19 +++ b/channels/tsmf/client/ffmpeg/tsmf_ffmpeg.c
21 #define AV_CODEC_ID_AC3 CODEC_ID_AC3
24 +#if LIBAVUTIL_VERSION_MAJOR < 52
25 +#define AV_PIX_FMT_YUV420P PIX_FMT_YUV420P
28 typedef struct _TSMFFFmpegDecoder
30 @@ -102,7 +105,11 @@ static BOOL tsmf_ffmpeg_init_video_stream(ITSMFDecoder* decoder, const TS_AM_MED
31 mdecoder->codec_context->bit_rate = media_type->BitRate;
32 mdecoder->codec_context->time_base.den = media_type->SamplesPerSecond.Numerator;
33 mdecoder->codec_context->time_base.num = media_type->SamplesPerSecond.Denominator;
34 +#if LIBAVCODEC_VERSION_MAJOR < 55
35 mdecoder->frame = avcodec_alloc_frame();
37 + mdecoder->frame = av_frame_alloc();
42 @@ -328,7 +335,11 @@ static BOOL tsmf_ffmpeg_decode_video(ITSMFDecoder* decoder, const BYTE *data, UI
43 if (!mdecoder->decoded_data)
46 +#if LIBAVCODEC_VERSION_MAJOR < 55
47 frame = avcodec_alloc_frame();
49 + frame = av_frame_alloc();
51 avpicture_fill((AVPicture*) frame, mdecoder->decoded_data,
52 mdecoder->codec_context->pix_fmt,
53 mdecoder->codec_context->width, mdecoder->codec_context->height);
54 @@ -400,7 +411,11 @@ static BOOL tsmf_ffmpeg_decode_audio(ITSMFDecoder* decoder, const BYTE *data, UI
55 (int16_t *) dst, &frame_size, src, src_size);
58 +#if LIBAVCODEC_VERSION_MAJOR < 55
59 AVFrame *decoded_frame = avcodec_alloc_frame();
61 + AVFrame *decoded_frame = av_frame_alloc();
66 @@ -480,7 +495,7 @@ static UINT32 tsmf_ffmpeg_get_decoded_format(ITSMFDecoder* decoder)
68 switch (mdecoder->codec_context->pix_fmt)
70 - case PIX_FMT_YUV420P:
71 + case AV_PIX_FMT_YUV420P:
72 return RDP_PIXFMT_I420;
74 WLog_ERR(TAG, "unsupported pixel format %u",