]>
Commit | Line | Data |
---|---|---|
082279ef JB |
1 | diff -ur freerdp-1.0.2/channels/drdynvc/tsmf/ffmpeg/tsmf_ffmpeg.c freerdp-1.0.2.ffmpeg/channels/drdynvc/tsmf/ffmpeg/tsmf_ffmpeg.c |
2 | --- freerdp-1.0.2/channels/drdynvc/tsmf/ffmpeg/tsmf_ffmpeg.c 2016-04-04 21:17:22.515023232 +0900 | |
3 | +++ freerdp-1.0.2.ffmpeg/channels/drdynvc/tsmf/ffmpeg/tsmf_ffmpeg.c 2016-04-04 21:16:59.521188035 +0900 | |
4 | @@ -193,28 +193,28 @@ | |
5 | switch (media_type->SubType) | |
6 | { | |
7 | case TSMF_SUB_TYPE_WVC1: | |
8 | - mdecoder->codec_id = CODEC_ID_VC1; | |
9 | + mdecoder->codec_id = AV_CODEC_ID_VC1; | |
10 | break; | |
11 | case TSMF_SUB_TYPE_WMA2: | |
12 | - mdecoder->codec_id = CODEC_ID_WMAV2; | |
13 | + mdecoder->codec_id = AV_CODEC_ID_WMAV2; | |
14 | break; | |
15 | case TSMF_SUB_TYPE_WMA9: | |
16 | - mdecoder->codec_id = CODEC_ID_WMAPRO; | |
17 | + mdecoder->codec_id = AV_CODEC_ID_WMAPRO; | |
18 | break; | |
19 | case TSMF_SUB_TYPE_MP3: | |
20 | - mdecoder->codec_id = CODEC_ID_MP3; | |
21 | + mdecoder->codec_id = AV_CODEC_ID_MP3; | |
22 | break; | |
23 | case TSMF_SUB_TYPE_MP2A: | |
24 | - mdecoder->codec_id = CODEC_ID_MP2; | |
25 | + mdecoder->codec_id = AV_CODEC_ID_MP2; | |
26 | break; | |
27 | case TSMF_SUB_TYPE_MP2V: | |
28 | - mdecoder->codec_id = CODEC_ID_MPEG2VIDEO; | |
29 | + mdecoder->codec_id = AV_CODEC_ID_MPEG2VIDEO; | |
30 | break; | |
31 | case TSMF_SUB_TYPE_WMV3: | |
32 | - mdecoder->codec_id = CODEC_ID_WMV3; | |
33 | + mdecoder->codec_id = AV_CODEC_ID_WMV3; | |
34 | break; | |
35 | case TSMF_SUB_TYPE_AAC: | |
36 | - mdecoder->codec_id = CODEC_ID_AAC; | |
37 | + mdecoder->codec_id = AV_CODEC_ID_AAC; | |
38 | /* For AAC the pFormat is a HEAACWAVEINFO struct, and the codec data | |
39 | is at the end of it. See | |
40 | http://msdn.microsoft.com/en-us/library/dd757806.aspx */ | |
41 | @@ -226,10 +226,10 @@ | |
42 | break; | |
43 | case TSMF_SUB_TYPE_H264: | |
44 | case TSMF_SUB_TYPE_AVC1: | |
45 | - mdecoder->codec_id = CODEC_ID_H264; | |
46 | + mdecoder->codec_id = AV_CODEC_ID_H264; | |
47 | break; | |
48 | case TSMF_SUB_TYPE_AC3: | |
49 | - mdecoder->codec_id = CODEC_ID_AC3; | |
50 | + mdecoder->codec_id = AV_CODEC_ID_AC3; | |
51 | break; | |
52 | default: | |
53 | return false; | |
54 | @@ -351,19 +351,29 @@ | |
55 | } | |
56 | dst += mdecoder->decoded_size; | |
57 | } | |
58 | + | |
59 | frame_size = mdecoder->decoded_size_max - mdecoder->decoded_size; | |
60 | #if LIBAVCODEC_VERSION_MAJOR < 52 || (LIBAVCODEC_VERSION_MAJOR == 52 && LIBAVCODEC_VERSION_MINOR <= 20) | |
61 | len = avcodec_decode_audio2(mdecoder->codec_context, | |
62 | - (int16_t*) dst, &frame_size, | |
63 | - src, src_size); | |
64 | + (int16_t*) dst, &frame_size, src, src_size); | |
65 | #else | |
66 | { | |
67 | + AVFrame* decoded_frame = avcodec_alloc_frame(); | |
68 | + int got_frame = 0; | |
69 | AVPacket pkt; | |
70 | av_init_packet(&pkt); | |
71 | pkt.data = (uint8*) src; | |
72 | pkt.size = src_size; | |
73 | - len = avcodec_decode_audio3(mdecoder->codec_context, | |
74 | - (int16_t*) dst, &frame_size, &pkt); | |
75 | + len = avcodec_decode_audio4(mdecoder->codec_context, decoded_frame, &got_frame, &pkt); | |
76 | + | |
77 | + if (len >= 0 && got_frame) | |
78 | + { | |
79 | + frame_size = av_samples_get_buffer_size(NULL, mdecoder->codec_context->channels, | |
80 | + decoded_frame->nb_samples, mdecoder->codec_context->sample_fmt, 1); | |
81 | + memcpy(dst, decoded_frame->data[0], frame_size); | |
82 | + } | |
83 | + | |
84 | + av_free(decoded_frame); | |
85 | } | |
86 | #endif | |
87 | if (len <= 0 || frame_size <= 0) | |
88 | @@ -435,7 +445,7 @@ | |
89 | ||
90 | switch (mdecoder->codec_context->pix_fmt) | |
91 | { | |
92 | - case PIX_FMT_YUV420P: | |
93 | + case AV_PIX_FMT_YUV420P: | |
94 | return RDP_PIXFMT_I420; | |
95 | ||
96 | default: |