1 diff -ru freerdp-1.0.2.orig/channels/drdynvc/tsmf/ffmpeg/tsmf_ffmpeg.c freerdp-1.0.2/channels/drdynvc/tsmf/ffmpeg/tsmf_ffmpeg.c
2 --- freerdp-1.0.2.orig/channels/drdynvc/tsmf/ffmpeg/tsmf_ffmpeg.c 2013-01-03 06:46:59.000000000 +0900
3 +++ freerdp-1.0.2/channels/drdynvc/tsmf/ffmpeg/tsmf_ffmpeg.c 2017-05-02 14:47:47.897325525 +0900
4 @@ -34,12 +34,39 @@
5 #define AVMEDIA_TYPE_AUDIO 1
6 #endif
7
8 +#if LIBAVCODEC_VERSION_MAJOR < 54
9 +#define MAX_AUDIO_FRAME_SIZE AVCODEC_MAX_AUDIO_FRAME_SIZE
10 +#else
11 +#define MAX_AUDIO_FRAME_SIZE 192000
12 +#endif
13 +
14 +#if LIBAVCODEC_VERSION_MAJOR < 55
15 +#define AV_CODEC_ID_VC1 CODEC_ID_VC1
16 +#define AV_CODEC_ID_WMAV2 CODEC_ID_WMAV2
17 +#define AV_CODEC_ID_WMAPRO CODEC_ID_WMAPRO
18 +#define AV_CODEC_ID_MP3 CODEC_ID_MP3
19 +#define AV_CODEC_ID_MP2 CODEC_ID_MP2
20 +#define AV_CODEC_ID_MPEG2VIDEO CODEC_ID_MPEG2VIDEO
21 +#define AV_CODEC_ID_WMV3 CODEC_ID_WMV3
22 +#define AV_CODEC_ID_AAC CODEC_ID_AAC
23 +#define AV_CODEC_ID_H264 CODEC_ID_H264
24 +#define AV_CODEC_ID_AC3 CODEC_ID_AC3
25 +#endif
26 +
27 +#if LIBAVUTIL_VERSION_MAJOR < 52
28 +#define AV_PIX_FMT_YUV420P PIX_FMT_YUV420P
29 +#endif
30 +
31 typedef struct _TSMFFFmpegDecoder
32 {
33 ITSMFDecoder iface;
34
35 int media_type;
36 +#if LIBAVCODEC_VERSION_MAJOR < 55
37 enum CodecID codec_id;
38 +#else
39 + enum AVCodecID codec_id;
40 +#endif
41 AVCodecContext* codec_context;
42 AVCodec* codec;
43 AVFrame* frame;
44 @@ -54,7 +81,7 @@
45 {
46 TSMFFFmpegDecoder* mdecoder = (TSMFFFmpegDecoder*) decoder;
47
48 - mdecoder->codec_context = avcodec_alloc_context();
49 + mdecoder->codec_context = avcodec_alloc_context3(NULL);
50 if (!mdecoder->codec_context)
51 {
52 DEBUG_WARN("avcodec_alloc_context failed.");
53 @@ -73,8 +100,11 @@
54 mdecoder->codec_context->bit_rate = media_type->BitRate;
55 mdecoder->codec_context->time_base.den = media_type->SamplesPerSecond.Numerator;
56 mdecoder->codec_context->time_base.num = media_type->SamplesPerSecond.Denominator;
57 -
58 +#if LIBAVCODEC_VERSION_MAJOR < 55
59 mdecoder->frame = avcodec_alloc_frame();
60 +#else
61 + mdecoder->frame = av_frame_alloc();
62 +#endif
63
64 return true;
65 }
66 @@ -88,6 +118,7 @@
67 mdecoder->codec_context->channels = media_type->Channels;
68 mdecoder->codec_context->block_align = media_type->BlockAlign;
69
70 +#if LIBAVCODEC_VERSION_MAJOR < 55
71 #ifdef AV_CPU_FLAG_SSE2
72 mdecoder->codec_context->dsp_mask = AV_CPU_FLAG_SSE2 | AV_CPU_FLAG_MMX2;
73 #else
74 @@ -97,6 +128,13 @@
75 mdecoder->codec_context->dsp_mask = FF_MM_SSE2 | FF_MM_MMX2;
76 #endif
77 #endif
78 +#else /* LIBAVCODEC_VERSION_MAJOR < 55 */
79 +#ifdef AV_CPU_FLAG_SSE2
80 + av_set_cpu_flags_mask(AV_CPU_FLAG_SSE2 | AV_CPU_FLAG_MMXEXT);
81 +#else
82 + av_set_cpu_flags_mask(FF_MM_SSE2 | FF_MM_MMX2);
83 +#endif
84 +#endif /* LIBAVCODEC_VERSION_MAJOR < 55 */
85
86 return true;
87 }
88 @@ -203,28 +241,28 @@
89 switch (media_type->SubType)
90 {
91 case TSMF_SUB_TYPE_WVC1:
92 - mdecoder->codec_id = CODEC_ID_VC1;
93 + mdecoder->codec_id = AV_CODEC_ID_VC1;
94 break;
95 case TSMF_SUB_TYPE_WMA2:
96 - mdecoder->codec_id = CODEC_ID_WMAV2;
97 + mdecoder->codec_id = AV_CODEC_ID_WMAV2;
98 break;
99 case TSMF_SUB_TYPE_WMA9:
100 - mdecoder->codec_id = CODEC_ID_WMAPRO;
101 + mdecoder->codec_id = AV_CODEC_ID_WMAPRO;
102 break;
103 case TSMF_SUB_TYPE_MP3:
104 - mdecoder->codec_id = CODEC_ID_MP3;
105 + mdecoder->codec_id = AV_CODEC_ID_MP3;
106 break;
107 case TSMF_SUB_TYPE_MP2A:
108 - mdecoder->codec_id = CODEC_ID_MP2;
109 + mdecoder->codec_id = AV_CODEC_ID_MP2;
110 break;
111 case TSMF_SUB_TYPE_MP2V:
112 - mdecoder->codec_id = CODEC_ID_MPEG2VIDEO;
113 + mdecoder->codec_id = AV_CODEC_ID_MPEG2VIDEO;
114 break;
115 case TSMF_SUB_TYPE_WMV3:
116 - mdecoder->codec_id = CODEC_ID_WMV3;
117 + mdecoder->codec_id = AV_CODEC_ID_WMV3;
118 break;
119 case TSMF_SUB_TYPE_AAC:
120 - mdecoder->codec_id = CODEC_ID_AAC;
121 + mdecoder->codec_id = AV_CODEC_ID_AAC;
122 /* For AAC the pFormat is a HEAACWAVEINFO struct, and the codec data
123 is at the end of it. See
124 http://msdn.microsoft.com/en-us/library/dd757806.aspx */
125 @@ -236,10 +274,10 @@
126 break;
127 case TSMF_SUB_TYPE_H264:
128 case TSMF_SUB_TYPE_AVC1:
129 - mdecoder->codec_id = CODEC_ID_H264;
130 + mdecoder->codec_id = AV_CODEC_ID_H264;
131 break;
132 case TSMF_SUB_TYPE_AC3:
133 - mdecoder->codec_id = CODEC_ID_AC3;
134 + mdecoder->codec_id = AV_CODEC_ID_AC3;
135 break;
136 default:
137 return false;
138 @@ -299,7 +337,12 @@
139 mdecoder->decoded_size = avpicture_get_size(mdecoder->codec_context->pix_fmt,
140 mdecoder->codec_context->width, mdecoder->codec_context->height);
141 mdecoder->decoded_data = xzalloc(mdecoder->decoded_size);
142 +
143 +#if LIBAVCODEC_VERSION_MAJOR < 55
144 frame = avcodec_alloc_frame();
145 +#else
146 + frame = av_frame_alloc();
147 +#endif
148 avpicture_fill((AVPicture *) frame, mdecoder->decoded_data,
149 mdecoder->codec_context->pix_fmt,
150 mdecoder->codec_context->width, mdecoder->codec_context->height);
151 @@ -337,7 +380,7 @@
152 #endif
153
154 if (mdecoder->decoded_size_max == 0)
155 - mdecoder->decoded_size_max = AVCODEC_MAX_AUDIO_FRAME_SIZE + 16;
156 + mdecoder->decoded_size_max = MAX_AUDIO_FRAME_SIZE + 16;
157 mdecoder->decoded_data = xzalloc(mdecoder->decoded_size_max);
158 /* align the memory for SSE2 needs */
159 dst = (uint8*) (((uintptr_t)mdecoder->decoded_data + 15) & ~ 0x0F);
160 @@ -348,7 +391,7 @@
161 while (src_size > 0)
162 {
163 /* Ensure enough space for decoding */
164 - if (mdecoder->decoded_size_max - mdecoder->decoded_size < AVCODEC_MAX_AUDIO_FRAME_SIZE)
165 + if (mdecoder->decoded_size_max - mdecoder->decoded_size < MAX_AUDIO_FRAME_SIZE)
166 {
167 mdecoder->decoded_size_max = mdecoder->decoded_size_max * 2 + 16;
168 mdecoder->decoded_data = xrealloc(mdecoder->decoded_data, mdecoder->decoded_size_max);
169 @@ -445,7 +488,7 @@
170
171 switch (mdecoder->codec_context->pix_fmt)
172 {
173 - case PIX_FMT_YUV420P:
174 + case AV_PIX_FMT_YUV420P:
175 return RDP_PIXFMT_I420;
176
177 default:
|