Mercurial > libavformat.hg
diff dvenc.c @ 4669:d6eb19c43e99 libavformat
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.
author | michael |
---|---|
date | Sun, 08 Mar 2009 14:16:55 +0000 |
parents | 77e0c7511d41 |
children | 15f34b5059ed |
line wrap: on
line diff
--- a/dvenc.c Sat Mar 07 22:42:09 2009 +0000 +++ b/dvenc.c Sun Mar 08 14:16:55 2009 +0000 @@ -38,7 +38,7 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ { 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