]> git.pld-linux.org Git - packages/gpac.git/blame - gpac-ffmpeg2.patch
- ffmpeg2 fixes from upstream svn
[packages/gpac.git] / gpac-ffmpeg2.patch
CommitLineData
3504b5e1 1Index: modules/ffmpeg_in/ffmpeg_in.h
a6953b4a 2===================================================================
3504b5e1
JR
3--- modules/ffmpeg_in/ffmpeg_in.h (revision 4282)
4+++ modules/ffmpeg_in/ffmpeg_in.h (revision 4451)
5@@ -120,7 +120,7 @@
6
7 /*for audio packed frames*/
8 u32 frame_start;
9- char audio_buf[AVCODEC_MAX_AUDIO_FRAME_SIZE];
10+ char audio_buf[192000];
11 Bool check_h264_isma;
12
13 u32 base_ES_ID;
14Index: modules/ffmpeg_in/ffmpeg_load.c
15===================================================================
16--- modules/ffmpeg_in/ffmpeg_load.c (revision 4282)
17+++ modules/ffmpeg_in/ffmpeg_load.c (revision 4451)
18@@ -44,7 +44,7 @@
a6953b4a
JR
19 #endif
20
21
3504b5e1
JR
22-GF_EXPORT
23+GPAC_MODULE_EXPORT
24 const u32 *QueryInterfaces()
25 {
26 static u32 si [] = {
27@@ -57,7 +57,7 @@
28 return si;
29 }
30
31-GF_EXPORT
32+GPAC_MODULE_EXPORT
33 GF_BaseInterface *LoadInterface(u32 InterfaceType)
34 {
35 if (InterfaceType == GF_MEDIA_DECODER_INTERFACE) return FFDEC_Load();
36@@ -67,7 +67,7 @@
37 return NULL;
38 }
39
40-GF_EXPORT
41+GPAC_MODULE_EXPORT
42 void ShutdownInterface(GF_BaseInterface *ifce)
43 {
44 switch (ifce->InterfaceType) {
45@@ -81,3 +81,6 @@
46 #endif
47 }
48 }
49+
50+
51+GPAC_MODULE_STATIC_DELARATION( ffmpeg )
52Index: modules/ffmpeg_in/ffmpeg_demux.c
53===================================================================
54--- modules/ffmpeg_in/ffmpeg_demux.c (revision 4282)
55+++ modules/ffmpeg_in/ffmpeg_demux.c (revision 4451)
56@@ -53,6 +53,18 @@
57 #define AVERROR_NOFMT AVERROR(EINVAL)
58 #endif /* AVERROR_NOFMT */
59
60+
61+#if (LIBAVFORMAT_VERSION_MAJOR >= 54) && (LIBAVFORMAT_VERSION_MINOR >= 20)
62+
63+#define av_find_stream_info(__c) avformat_find_stream_info(__c, NULL)
64+#ifndef FF_API_FORMAT_PARAMETERS
65+#define FF_API_FORMAT_PARAMETERS 1
66+#endif
67+
a6953b4a
JR
68+#endif
69+
3504b5e1
JR
70+
71+
72 static u32 FFDemux_Run(void *par)
73 {
74 AVPacket pkt;
75@@ -76,7 +88,7 @@
76 seek_to = (s64) (AV_TIME_BASE*ffd->seek_time);
77 map_video_time = !ffd->seekable;
78
79- video_init = (seek_to && ffd->video_ch) ? 0 : 1;
80+ video_init = (seek_to && ffd->video_ch) ? GF_FALSE : GF_TRUE;
81 seek_audio = seek_video = 0;
82 if (ffd->seekable && (ffd->audio_st>=0)) seek_audio = (u64) (s64) (ffd->seek_time*ffd->audio_tscale.den);
83 if (ffd->seekable && (ffd->video_st>=0)) seek_video = (u64) (s64) (ffd->seek_time*ffd->video_tscale.den);
84Index: modules/ffmpeg_in/ffmpeg_decode.c
85===================================================================
86--- modules/ffmpeg_in/ffmpeg_decode.c (revision 4282)
87+++ modules/ffmpeg_in/ffmpeg_decode.c (revision 4451)
88@@ -38,8 +38,14 @@
89 #undef USE_AVCODEC2
90 #endif
91
92+#if (LIBAVCODEC_VERSION_MAJOR >= 55)
93+#define USE_AVCTX3
94+#elif (LIBAVCODEC_VERSION_MAJOR >= 54) && (LIBAVCODEC_VERSION_MINOR >= 35)
95+#define USE_AVCTX3
96+#endif
97
98
99+
100 /**
101 * Allocates data for FFMPEG decoding
102 * \param oldBuffer The oldBuffer (freed if not NULL)
103@@ -170,7 +176,12 @@
104 frame = &ffd->base_frame;
105 }
106 if (!(*ctx)){
107+
108+#ifdef USE_AVCTX3
109+ *ctx = avcodec_alloc_context3(NULL);
110+#else
111 *ctx = avcodec_alloc_context();
112+#endif
113 }
114
115 /*private FFMPEG DSI*/
116@@ -318,7 +329,11 @@
117 (*ctx)->pix_fmt = ffd->raw_pix_fmt;
118 if ((*ctx)->extradata && strstr((*ctx)->extradata, "BottomUp")) ffd->flipped = 1;
119 } else {
120+#ifdef USE_AVCTX3
121+ if (avcodec_open2((*ctx), (*codec), NULL )<0) return GF_NON_COMPLIANT_BITSTREAM;
122+#else
123 if (avcodec_open((*ctx), (*codec) )<0) return GF_NON_COMPLIANT_BITSTREAM;
124+#endif
125 }
126
127 /*setup audio streams*/
128@@ -612,10 +627,11 @@
129 if (ffd->frame_start>inBufferLength) ffd->frame_start = 0;
130
131 redecode:
132- gotpic = AVCODEC_MAX_AUDIO_FRAME_SIZE;
133 #ifdef USE_AVCODEC2
134+ gotpic = 0;
135 len = avcodec_decode_audio3(ctx, (short *)ffd->audio_buf, &gotpic, &pkt);
136 #else
137+ gotpic = AVCODEC_MAX_AUDIO_FRAME_SIZE;
138 len = avcodec_decode_audio2(ctx, (short *)ffd->audio_buf, &gotpic, inBuffer + ffd->frame_start, inBufferLength - ffd->frame_start);
139 #endif
140 if (len<0) { ffd->frame_start = 0; return GF_NON_COMPLIANT_BITSTREAM; }
141@@ -755,7 +771,13 @@
142 here this means the DSI was broken, so no big deal*/
143 avcodec_close(ctx);
144 *codec = avcodec_find_decoder(CODEC_ID_H263);
145+
146+#ifdef USE_AVCTX3
147+ if (! (*codec) || (avcodec_open2(ctx, *codec, NULL)<0)) return GF_NON_COMPLIANT_BITSTREAM;
148+#else
149 if (! (*codec) || (avcodec_open(ctx, *codec)<0)) return GF_NON_COMPLIANT_BITSTREAM;
150+#endif
151+
152 #if USE_AVCODEC2
153 if (avcodec_decode_video2(ctx, frame, &gotpic, &pkt) < 0) {
154 #else
155@@ -765,7 +787,11 @@
156 avcodec_close(ctx);
157 *codec = avcodec_find_decoder(old_codec);
158 assert(*codec);
159+#ifdef USE_AVCTX3
160+ avcodec_open2(ctx, *codec, NULL);
161+#else
162 avcodec_open(ctx, *codec);
163+#endif
164 return GF_NON_COMPLIANT_BITSTREAM;
165 }
166 }
167@@ -979,7 +1005,7 @@
168 else if (StreamType==GF_STREAM_VISUAL) {
a6953b4a 169
3504b5e1
JR
170 /*fixme - we should use some priority rather than declare ffmpeg can't handle svc*/
171- if (esd->decoderConfig->objectTypeIndication == GPAC_OTI_VIDEO_AVC) {
172+ if (esd->decoderConfig->objectTypeIndication == GPAC_OTI_VIDEO_AVC){
173 if (esd->decoderConfig->decoderSpecificInfo && esd->decoderConfig->decoderSpecificInfo->data) {
174 Bool is_svc = 0;
175 u32 i, count;
176@@ -1003,7 +1029,7 @@
177 gf_odf_avc_cfg_del(cfg);
178 return (is_svc || esd->decoderConfig->rvc_config || esd->decoderConfig->predefined_rvc_config) ? GF_CODEC_MAYBE_SUPPORTED : GF_CODEC_SUPPORTED;
179 }
180- if (esd->decoderConfig->rvc_config || esd->decoderConfig->predefined_rvc_config) return GF_CODEC_MAYBE_SUPPORTED;
181+ if (esd->decoderConfig->rvc_config || esd->decoderConfig->predefined_rvc_config || esd->has_ref_base) return GF_CODEC_MAYBE_SUPPORTED;
182 return GF_CODEC_SUPPORTED;
183 }
a6953b4a 184
3504b5e1
JR
185@@ -1011,7 +1037,8 @@
186 /*MPEG-4 v1 simple profile*/
187 case GPAC_OTI_VIDEO_MPEG4_PART2: codec_id = CODEC_ID_MPEG4; break;
188 /*H264 (not std OTI, just the way we use it internally)*/
189- case GPAC_OTI_VIDEO_AVC: codec_id = CODEC_ID_H264; break;
190+ case GPAC_OTI_VIDEO_AVC:
191+ codec_id = CODEC_ID_H264; break;
192 /*MPEG1 video*/
193 case GPAC_OTI_VIDEO_MPEG1:
194 /*MPEG2 video*/
This page took 0.082584 seconds and 4 git commands to generate.