]>
Commit | Line | Data |
---|---|---|
1 | --- FusionSound-1.6.2/interfaces/IFusionSoundMusicProvider/ifusionsoundmusicprovider_ffmpeg.c.orig 2012-09-20 18:01:15.000000000 +0200 | |
2 | +++ FusionSound-1.6.2/interfaces/IFusionSoundMusicProvider/ifusionsoundmusicprovider_ffmpeg.c 2012-10-05 20:04:42.281925937 +0200 | |
3 | @@ -77,7 +77,7 @@ | |
4 | DirectStream *stream; | |
5 | ||
6 | #if (LIBAVFORMAT_VERSION_MAJOR >= 53) | |
7 | - AVIOContext pb; | |
8 | + AVIOContext *pb; | |
9 | #else | |
10 | ByteIOContext pb; | |
11 | #endif | |
12 | @@ -410,6 +410,11 @@ | |
13 | data->dest.buffer = NULL; | |
14 | } | |
15 | ||
16 | + if (data->pb) { | |
17 | + av_free( data->pb ); | |
18 | + data->pb = NULL; | |
19 | + } | |
20 | + | |
21 | /* release output buffer */ | |
22 | if (data->buf) { | |
23 | D_FREE( data->buf ); | |
24 | @@ -1247,16 +1252,26 @@ | |
25 | return D_OOM(); | |
26 | } | |
27 | ||
28 | - if (init_put_byte( &data->pb, data->iobuf, 4096, 0, | |
29 | + if ((data->pb = avio_alloc_context( data->iobuf, 4096, 0, | |
30 | (void*)data, av_read_callback, NULL, | |
31 | - direct_stream_seekable( stream ) ? av_seek_callback : NULL ) < 0) { | |
32 | - D_ERROR( "IFusionSoundMusicProvider_FFmpeg: init_put_byte() failed!\n" ); | |
33 | + direct_stream_seekable( stream ) ? av_seek_callback : NULL )) == NULL) { | |
34 | + D_ERROR( "IFusionSoundMusicProvider_FFmpeg: avio_alloc_context() failed!\n" ); | |
35 | IFusionSoundMusicProvider_FFmpeg_Destruct( thiz ); | |
36 | return DR_INIT; | |
37 | } | |
38 | ||
39 | - if (av_open_input_stream( &data->ctx, &data->pb, filename, fmt, NULL ) < 0) { | |
40 | - D_ERROR( "IFusionSoundMusicProvider_FFmpeg: av_open_input_stream() failed!\n" ); | |
41 | + if(data->ctx == NULL) { | |
42 | + data->ctx = avformat_alloc_context(); | |
43 | + if (data->ctx == NULL) { | |
44 | + D_ERROR( "IFusionSoundMusicProvider_FFmpeg: avformat_alloc_context() failed!\n" ); | |
45 | + IFusionSoundMusicProvider_FFmpeg_Destruct( thiz ); | |
46 | + return DR_FAILURE; | |
47 | + } | |
48 | + } | |
49 | + | |
50 | + data->ctx->pb = data->pb; | |
51 | + if (avformat_open_input( &data->ctx, filename, fmt, NULL ) < 0) { | |
52 | + D_ERROR( "IFusionSoundMusicProvider_FFmpeg: avformat_open_input() failed!\n" ); | |
53 | IFusionSoundMusicProvider_FFmpeg_Destruct( thiz ); | |
54 | return DR_FAILURE; | |
55 | } |