diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2009-03-08 14:16:55 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2009-03-08 14:16:55 +0000 |
commit | 41dd680dd80d93626e133c02b92e31cabb756eeb (patch) | |
tree | e21e3fdda1fab791bf322d167be5e02c414e4384 /libavformat/audiointerleave.c | |
parent | 48d58e592aa258494beed72954fff74b5827acca (diff) | |
download | ffmpeg-41dd680dd80d93626e133c02b92e31cabb756eeb.tar.gz |
Allocate AVFifoBuffer through the fifo API to reduce future API/ABI issues.
Yes this breaks ABI/API but ive already broken it and will bump avutil major
soon.
Originally committed as revision 17869 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/audiointerleave.c')
-rw-r--r-- | libavformat/audiointerleave.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/libavformat/audiointerleave.c b/libavformat/audiointerleave.c index d811f21357..a4396f5bfa 100644 --- a/libavformat/audiointerleave.c +++ b/libavformat/audiointerleave.c @@ -33,7 +33,7 @@ void ff_audio_interleave_close(AVFormatContext *s) AudioInterleaveContext *aic = st->priv_data; if (st->codec->codec_type == CODEC_TYPE_AUDIO) - av_fifo_free(&aic->fifo); + av_fifo_free(aic->fifo); } } @@ -62,7 +62,7 @@ int ff_audio_interleave_init(AVFormatContext *s, aic->time_base = time_base; aic->fifo_size = 100* *aic->samples; - av_fifo_init(&aic->fifo, 100 * *aic->samples); + aic->fifo= av_fifo_alloc(100 * *aic->samples); } } @@ -75,12 +75,12 @@ static int ff_interleave_new_audio_packet(AVFormatContext *s, AVPacket *pkt, AVStream *st = s->streams[stream_index]; AudioInterleaveContext *aic = st->priv_data; - int size = FFMIN(av_fifo_size(&aic->fifo), *aic->samples * aic->sample_size); - if (!size || (!flush && size == av_fifo_size(&aic->fifo))) + int size = FFMIN(av_fifo_size(aic->fifo), *aic->samples * aic->sample_size); + if (!size || (!flush && size == av_fifo_size(aic->fifo))) return 0; av_new_packet(pkt, size); - av_fifo_read(&aic->fifo, pkt->data, size); + av_fifo_read(aic->fifo, pkt->data, size); pkt->dts = pkt->pts = aic->dts; pkt->duration = av_rescale_q(*aic->samples, st->time_base, aic->time_base); @@ -104,13 +104,13 @@ int ff_audio_rechunk_interleave(AVFormatContext *s, AVPacket *out, AVPacket *pkt AVStream *st = s->streams[pkt->stream_index]; AudioInterleaveContext *aic = st->priv_data; if (st->codec->codec_type == CODEC_TYPE_AUDIO) { - unsigned new_size = av_fifo_size(&aic->fifo) + pkt->size; + unsigned new_size = av_fifo_size(aic->fifo) + pkt->size; if (new_size > aic->fifo_size) { - if (av_fifo_realloc2(&aic->fifo, new_size) < 0) + if (av_fifo_realloc2(aic->fifo, new_size) < 0) return -1; aic->fifo_size = new_size; } - av_fifo_generic_write(&aic->fifo, pkt->data, pkt->size, NULL); + av_fifo_generic_write(aic->fifo, pkt->data, pkt->size, NULL); } else { // rewrite pts and dts to be decoded time line position pkt->pts = pkt->dts = aic->dts; |