summaryrefslogtreecommitdiff
path: root/community/freerdp/ffmpeg2.0.patch
blob: bc9022da478da15ba3ff4630dea9870aa587a856 (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
75
76
diff -rupN a/channels/drdynvc/tsmf/ffmpeg/tsmf_ffmpeg.c b/channels/drdynvc/tsmf/ffmpeg/tsmf_ffmpeg.c
--- a/channels/drdynvc/tsmf/ffmpeg/tsmf_ffmpeg.c	2013-01-02 22:46:59.000000000 +0100
+++ b/channels/drdynvc/tsmf/ffmpeg/tsmf_ffmpeg.c	2013-07-22 18:12:18.001576713 +0200
@@ -28,6 +28,8 @@
 #include "tsmf_constants.h"
 #include "tsmf_decoder.h"
 
+#define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000
+
 /* Compatibility with older FFmpeg */
 #if LIBAVUTIL_VERSION_MAJOR < 50
 #define AVMEDIA_TYPE_VIDEO 0
@@ -39,7 +41,7 @@ typedef struct _TSMFFFmpegDecoder
 	ITSMFDecoder iface;
 
 	int media_type;
-	enum CodecID codec_id;
+	enum AVCodecID codec_id;
 	AVCodecContext* codec_context;
 	AVCodec* codec;
 	AVFrame* frame;
@@ -54,7 +56,7 @@ static boolean tsmf_ffmpeg_init_context(
 {
 	TSMFFFmpegDecoder* mdecoder = (TSMFFFmpegDecoder*) decoder;
 
-	mdecoder->codec_context = avcodec_alloc_context();
+	mdecoder->codec_context = avcodec_alloc_context3(NULL);
 	if (!mdecoder->codec_context)
 	{
 		DEBUG_WARN("avcodec_alloc_context failed.");
@@ -88,16 +90,6 @@ static boolean tsmf_ffmpeg_init_audio_st
 	mdecoder->codec_context->channels = media_type->Channels;
 	mdecoder->codec_context->block_align = media_type->BlockAlign;
 
-#ifdef AV_CPU_FLAG_SSE2
-	mdecoder->codec_context->dsp_mask = AV_CPU_FLAG_SSE2 | AV_CPU_FLAG_MMX2;
-#else
-#if LIBAVCODEC_VERSION_MAJOR < 53
-	mdecoder->codec_context->dsp_mask = FF_MM_SSE2 | FF_MM_MMXEXT;
-#else
-	mdecoder->codec_context->dsp_mask = FF_MM_SSE2 | FF_MM_MMX2;
-#endif
-#endif
-
 	return true;
 }
 
@@ -174,7 +166,7 @@ static boolean tsmf_ffmpeg_prepare(ITSMF
 {
 	TSMFFFmpegDecoder* mdecoder = (TSMFFFmpegDecoder*) decoder;
 
-	if (avcodec_open(mdecoder->codec_context, mdecoder->codec) < 0)
+	if (avcodec_open2(mdecoder->codec_context, mdecoder->codec, NULL) < 0)
 	{
 		DEBUG_WARN("avcodec_open failed.");
 		return false;
@@ -372,8 +364,9 @@ static boolean tsmf_ffmpeg_decode_audio(
 			av_init_packet(&pkt);
 			pkt.data = (uint8*) src;
 			pkt.size = src_size;
-			len = avcodec_decode_audio3(mdecoder->codec_context,
-				(int16_t*) dst, &frame_size, &pkt);
+			AVFrame * frame = avcodec_alloc_frame (); 
+			len = avcodec_decode_audio4(mdecoder->codec_context,
+				frame, &frame_size, &pkt);
 		}
 #endif
 		if (len <= 0 || frame_size <= 0)
@@ -499,7 +492,6 @@ TSMFDecoderEntry(void)
 
 	if (!initialized)
 	{
-		avcodec_init();
 		avcodec_register_all();
 		initialized = true;
 	}