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/dvenc.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/dvenc.c')
-rw-r--r-- | libavformat/dvenc.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/libavformat/dvenc.c b/libavformat/dvenc.c index 4551cd516f..c87697dd13 100644 --- a/libavformat/dvenc.c +++ b/libavformat/dvenc.c @@ -38,7 +38,7 @@ struct DVMuxContext { const DVprofile* sys; /* current DV profile, e.g.: 525/60, 625/50 */ int n_ast; /* number of stereo audio streams (up to 2) */ AVStream *ast[2]; /* stereo audio streams */ - AVFifoBuffer audio_data[2]; /* FIFO for storing excessive amounts of PCM */ + AVFifoBuffer *audio_data[2]; /* FIFO for storing excessive amounts of PCM */ int frames; /* current frame number */ time_t start_time; /* recording start time */ int has_audio; /* frame under contruction has audio */ @@ -189,8 +189,8 @@ static void dv_inject_audio(DVMuxContext *c, int channel, uint8_t* frame_ptr) if (of*2 >= size) continue; - frame_ptr[d] = av_fifo_peek(&c->audio_data[channel], of*2+1); // FIXME: maybe we have to admit - frame_ptr[d+1] = av_fifo_peek(&c->audio_data[channel], of*2); // that DV is a big-endian PCM + frame_ptr[d] = av_fifo_peek(c->audio_data[channel], of*2+1); // FIXME: maybe we have to admit + frame_ptr[d+1] = av_fifo_peek(c->audio_data[channel], of*2); // that DV is a big-endian PCM } frame_ptr += 16 * 80; /* 15 Video DIFs + 1 Audio DIF */ } @@ -251,12 +251,12 @@ int dv_assemble_frame(DVMuxContext *c, AVStream* st, for (i = 0; i < c->n_ast && st != c->ast[i]; i++); /* FIXME: we have to have more sensible approach than this one */ - if (av_fifo_size(&c->audio_data[i]) + data_size >= 100*AVCODEC_MAX_AUDIO_FRAME_SIZE) + if (av_fifo_size(c->audio_data[i]) + data_size >= 100*AVCODEC_MAX_AUDIO_FRAME_SIZE) av_log(st->codec, AV_LOG_ERROR, "Can't process DV frame #%d. Insufficient video data or severe sync problem.\n", c->frames); - av_fifo_generic_write(&c->audio_data[i], data, data_size, NULL); + av_fifo_generic_write(c->audio_data[i], data, data_size, NULL); /* Let us see if we've got enough audio for one DV frame. */ - c->has_audio |= ((reqasize <= av_fifo_size(&c->audio_data[i])) << i); + c->has_audio |= ((reqasize <= av_fifo_size(c->audio_data[i])) << i); break; default: @@ -269,8 +269,8 @@ int dv_assemble_frame(DVMuxContext *c, AVStream* st, c->has_audio = 0; for (i=0; i < c->n_ast; i++) { dv_inject_audio(c, i, *frame); - av_fifo_drain(&c->audio_data[i], reqasize); - c->has_audio |= ((reqasize <= av_fifo_size(&c->audio_data[i])) << i); + av_fifo_drain(c->audio_data[i], reqasize); + c->has_audio |= ((reqasize <= av_fifo_size(c->audio_data[i])) << i); } c->has_video = 0; @@ -337,10 +337,10 @@ DVMuxContext* dv_init_mux(AVFormatContext* s) c->start_time = (time_t)s->timestamp; for (i=0; i < c->n_ast; i++) { - if (c->ast[i] && av_fifo_init(&c->audio_data[i], 100*AVCODEC_MAX_AUDIO_FRAME_SIZE) < 0) { + if (c->ast[i] && !(c->audio_data[i]=av_fifo_alloc(100*AVCODEC_MAX_AUDIO_FRAME_SIZE))) { while (i > 0) { i--; - av_fifo_free(&c->audio_data[i]); + av_fifo_free(c->audio_data[i]); } goto bail_out; } @@ -356,7 +356,7 @@ void dv_delete_mux(DVMuxContext *c) { int i; for (i=0; i < c->n_ast; i++) - av_fifo_free(&c->audio_data[i]); + av_fifo_free(c->audio_data[i]); } #if CONFIG_DV_MUXER |