]>
Commit | Line | Data |
---|---|---|
b86efe20 JB |
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 @@ | |
7f78b8b0 AM |
4 | DirectStream *stream; |
5 | ||
b86efe20 JB |
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 | } | |
7f78b8b0 | 15 | |
b86efe20 JB |
16 | + if (data->pb) { |
17 | + av_free( data->pb ); | |
18 | + data->pb = NULL; | |
19 | + } | |
7f78b8b0 | 20 | + |
b86efe20 JB |
21 | /* release output buffer */ |
22 | if (data->buf) { | |
23 | D_FREE( data->buf ); | |
24 | @@ -1247,16 +1252,26 @@ | |
0b315e2d JB |
25 | return D_OOM(); |
26 | } | |
b86efe20 JB |
27 | |
28 | - if (init_put_byte( &data->pb, data->iobuf, 4096, 0, | |
29 | + if ((data->pb = avio_alloc_context( data->iobuf, 4096, 0, | |
0b315e2d | 30 | (void*)data, av_read_callback, NULL, |
b86efe20 | 31 | - direct_stream_seekable( stream ) ? av_seek_callback : NULL ) < 0) { |
0b315e2d | 32 | - D_ERROR( "IFusionSoundMusicProvider_FFmpeg: init_put_byte() failed!\n" ); |
b86efe20 JB |
33 | + direct_stream_seekable( stream ) ? av_seek_callback : NULL )) == NULL) { |
34 | + D_ERROR( "IFusionSoundMusicProvider_FFmpeg: avio_alloc_context() failed!\n" ); | |
0b315e2d JB |
35 | IFusionSoundMusicProvider_FFmpeg_Destruct( thiz ); |
36 | return DR_INIT; | |
37 | } | |
b86efe20 | 38 | |
0b315e2d JB |
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" ); | |
b86efe20 JB |
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; | |
0b315e2d JB |
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 | } |