1 --- DirectFB-1.7.0/interfaces/IFusionSoundMusicProvider/ifusionsoundmusicprovider_ffmpeg.c.orig 2013-01-12 06:06:23.000000000 +0100
2 +++ DirectFB-1.7.0/interfaces/IFusionSoundMusicProvider/ifusionsoundmusicprovider_ffmpeg.c 2013-07-19 17:15:41.004724901 +0200
5 #include <libavutil/avutil.h>
7 +#ifndef AVCODEC_MAX_AUDIO_FRAME_SIZE
8 +# define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000
12 Probe( IFusionSoundMusicProvider_ProbeContext *ctx );
16 #if (LIBAVFORMAT_VERSION_MAJOR >= 53)
23 data->dest.buffer = NULL;
27 + av_free( data->pb );
31 /* release output buffer */
34 @@ -1279,16 +1287,26 @@
38 - if (init_put_byte( &data->pb, data->iobuf, 4096, 0,
39 + if ((data->pb = avio_alloc_context( data->iobuf, 4096, 0,
40 (void*)data, av_read_callback, NULL,
41 - direct_stream_seekable( stream ) ? av_seek_callback : NULL ) < 0) {
42 - D_ERROR( "IFusionSoundMusicProvider_FFmpeg: init_put_byte() failed!\n" );
43 + direct_stream_seekable( stream ) ? av_seek_callback : NULL )) == NULL) {
44 + D_ERROR( "IFusionSoundMusicProvider_FFmpeg: avio_alloc_context() failed!\n" );
45 IFusionSoundMusicProvider_FFmpeg_Destruct( thiz );
49 - if (av_open_input_stream( &data->ctx, &data->pb, filename, fmt, NULL ) < 0) {
50 - D_ERROR( "IFusionSoundMusicProvider_FFmpeg: av_open_input_stream() failed!\n" );
51 + if(data->ctx == NULL) {
52 + data->ctx = avformat_alloc_context();
53 + if (data->ctx == NULL) {
54 + D_ERROR( "IFusionSoundMusicProvider_FFmpeg: avformat_alloc_context() failed!\n" );
55 + IFusionSoundMusicProvider_FFmpeg_Destruct( thiz );
60 + data->ctx->pb = data->pb;
61 + if (avformat_open_input( &data->ctx, filename, fmt, NULL ) < 0) {
62 + D_ERROR( "IFusionSoundMusicProvider_FFmpeg: avformat_open_input() failed!\n" );
63 IFusionSoundMusicProvider_FFmpeg_Destruct( thiz );
68 data->codec = data->st->codec;
69 c = avcodec_find_decoder( data->codec->codec_id );
70 - if (!c || avcodec_open( data->codec, c ) < 0) {
71 + if (!c || avcodec_open2( data->codec, c, NULL ) < 0) {
72 D_ERROR( "IFusionSoundMusicProvider_FFmpeg: couldn't find audio decoder!\n" );
73 IFusionSoundMusicProvider_FFmpeg_Destruct( thiz );
75 --- DirectFB-1.7.0/interfaces/IDirectFBVideoProvider/idirectfbvideoprovider_ffmpeg.c.orig 2013-01-12 06:06:23.000000000 +0100
76 +++ DirectFB-1.7.0/interfaces/IDirectFBVideoProvider/idirectfbvideoprovider_ffmpeg.c 2013-07-19 16:38:03.281486315 +0200
80 #if (LIBAVFORMAT_VERSION_MAJOR >= 53)
88 IDirectFBVideoProvider_FFmpeg_data *data = arg;
90 - if (url_is_streamed( data->context->pb )) {
91 + if (!data->context->pb->seekable) {
92 data->input.buffering = true;
93 pthread_mutex_lock( &data->video.queue.lock );
94 pthread_mutex_lock( &data->audio.queue.lock );
96 flush_packets( &data->audio.queue );
98 if (!data->input.buffering &&
99 - url_is_streamed( data->context->pb )) {
100 + !data->context->pb->seekable) {
101 data->input.buffering = true;
102 pthread_mutex_lock( &data->video.queue.lock );
103 pthread_mutex_lock( &data->audio.queue.lock );
105 else if (data->video.queue.size == 0 ||
106 data->audio.queue.size == 0) {
107 if (!data->input.buffering &&
108 - url_is_streamed( data->context->pb )) {
109 + !data->context->pb->seekable) {
110 data->input.buffering = true;
111 pthread_mutex_lock( &data->video.queue.lock );
112 pthread_mutex_lock( &data->audio.queue.lock );
113 @@ -798,14 +798,14 @@
114 IDirectFBVideoProvider_FFmpeg_data *data = arg;
116 AVStream *st = data->audio.st;
117 - u8 buf[AVCODEC_MAX_AUDIO_FRAME_SIZE];
118 + u8 buf[192000 /* AVCODEC_MAX_AUDIO_FRAME_SIZE */];
120 while (data->status != DVSTATE_STOP) {
125 - int len = AVCODEC_MAX_AUDIO_FRAME_SIZE;
126 + int len = 192000 /* AVCODEC_MAX_AUDIO_FRAME_SIZE */;
129 direct_thread_testcancel( self );
135 + av_free( data->pb );
140 data->buffer->Release( data->buffer );
142 @@ -1778,23 +1783,32 @@
146 - if (init_put_byte( &data->pb, data->iobuf, IO_BUFFER_SIZE * 1024, 0,
147 + if ((data->pb = avio_alloc_context( data->iobuf, IO_BUFFER_SIZE * 1024, 0,
148 (void*)data, av_read_callback, NULL,
149 - data->seekable ? av_seek_callback : NULL ) < 0) {
150 + data->seekable ? av_seek_callback : NULL )) == NULL) {
151 D_ERROR( "IDirectFBVideoProvider_FFmpeg: "
152 - "init_put_byte() failed!\n" );
153 + "avio_alloc_context() failed!\n" );
154 IDirectFBVideoProvider_FFmpeg_Destruct( thiz );
158 - data->pb.is_streamed = (!data->seekable ||
159 + data->pb->seekable = !(!data->seekable ||
160 !strncmp( pd.filename, "http://", 7 ) ||
161 !strncmp( pd.filename, "unsv://", 7 ) ||
162 !strncmp( pd.filename, "ftp://", 6 ) ||
163 !strncmp( pd.filename, "rtsp://", 7 ));
165 - if (av_open_input_stream( &data->context,
166 - &data->pb, pd.filename, fmt, NULL ) < 0) {
167 + if (data->context == NULL) {
168 + if ((data->ctx = avformat_alloc_context()) == NULL) {
169 + D_ERROR( "IDirectFBVideoProvider_FFmpeg: avformat_alloc_context() failed!\n" );
170 + IDirectFBVideoProvider_FFmpeg_Destruct( thiz );
171 + return DFB_FAILURE;
175 + data->context->pb = data->pb;
176 + if (avformat_open_input( &data->context,
177 + pd.filename, fmt, NULL ) < 0) {
178 D_ERROR( "IDirectFBVideoProvider_FFmpeg: "
179 "av_open_input_stream() failed!\n" );
180 IDirectFBVideoProvider_FFmpeg_Destruct( thiz );
181 @@ -1845,7 +1859,7 @@
182 data->video.ctx = data->video.st->codec;
183 data->video.codec = avcodec_find_decoder( data->video.ctx->codec_id );
184 if (!data->video.codec ||
185 - avcodec_open( data->video.ctx, data->video.codec ) < 0)
186 + avcodec_open2( data->video.ctx, data->video.codec, NULL ) < 0)
188 D_ERROR( "IDirectFBVideoProvider_FFmpeg: "
189 "error opening video codec!\n" );
190 @@ -1870,7 +1884,7 @@
191 data->audio.ctx = data->audio.st->codec;
192 data->audio.codec = avcodec_find_decoder( data->audio.ctx->codec_id );
193 if (!data->audio.codec ||
194 - avcodec_open( data->audio.ctx, data->audio.codec ) < 0) {
195 + avcodec_open2( data->audio.ctx, data->audio.codec, NULL ) < 0) {
196 data->audio.st = NULL;
197 data->audio.ctx = NULL;
198 data->audio.codec = NULL;
199 --- DirectFB-1.7.6/interfaces/IDirectFBVideoProvider/idirectfbvideoprovider_ffmpeg.c.org 2014-10-07 22:09:44.408929059 +0200
200 +++ DirectFB-1.7.6/interfaces/IDirectFBVideoProvider/idirectfbvideoprovider_ffmpeg.c 2014-10-07 22:13:49.765446586 +0200
201 @@ -931,11 +931,19 @@
202 /* Ugly hack to fix a bug (segfault) in url_fclose() */
203 if (!(iformat->flags & AVFMT_NOFILE)) {
204 iformat->flags |= AVFMT_NOFILE;
206 av_close_input_file( data->context );
208 + avformat_close_input( &data->context);
210 iformat->flags ^= AVFMT_NOFILE;
214 av_close_input_file( data->context );
216 + avformat_close_input( &data->context);
221 @@ -1815,7 +1823,7 @@
225 - if (av_find_stream_info( data->context ) < 0) {
226 + if (avformat_find_stream_info( data->context, NULL ) < 0) {
227 D_ERROR( "IDirectFBVideoProvider_FFmpeg: "
228 "couldn't find stream info!\n" );
229 IDirectFBVideoProvider_FFmpeg_Destruct( thiz );
230 @@ -1867,8 +1875,12 @@
231 IDirectFBVideoProvider_FFmpeg_Destruct( thiz );
237 data->video.src_frame = avcodec_alloc_frame();
239 + data->video.src_frame = av_frame_alloc();
241 if (!data->video.src_frame) {
242 IDirectFBVideoProvider_FFmpeg_Destruct( thiz );
244 --- DirectFB-1.7.6/interfaces/IFusionSoundMusicProvider/ifusionsoundmusicprovider_ffmpeg.c.org 2014-10-07 22:40:52.350475804 +0200
245 +++ DirectFB-1.7.6/interfaces/IFusionSoundMusicProvider/ifusionsoundmusicprovider_ffmpeg.c 2014-10-07 22:42:19.896406741 +0200
246 @@ -444,11 +444,11 @@
247 /* Ugly hack to fix a bug (segfault) in url_fclose() */
248 if (!(iformat->flags & AVFMT_NOFILE)) {
249 iformat->flags |= AVFMT_NOFILE;
250 - av_close_input_file( data->ctx );
251 + avformat_close_input( &data->ctx );
252 iformat->flags ^= AVFMT_NOFILE;
255 - av_close_input_file( data->ctx );
256 + avformat_close_input( &data->ctx );
260 @@ -1311,7 +1311,7 @@
264 - if (av_find_stream_info( data->ctx ) < 0) {
265 + if (avformat_find_stream_info( data->ctx, NULL ) < 0) {
266 D_ERROR( "IFusionSoundMusicProvider_FFmpeg: couldn't find stream info!\n" );
267 IFusionSoundMusicProvider_FFmpeg_Destruct( thiz );