Originally committed as revision 17914 to svn://svn.ffmpeg.org/ffmpeg/trunk
Unified · Split
| @@ -15,6 +15,8 @@ API changes, most recent first: · 14 unmodified lines | |||
| 15 | 20090308 - r17869 - lavu 50.0.0 - AVFifoBuffer | 15 | 20090308 - r17869 - lavu 50.0.0 - AVFifoBuffer |
| 16 | av_fifo_init, av_fifo_read, av_fifo_write and av_fifo_realloc were dropped and replaced | 16 | av_fifo_init, av_fifo_read, av_fifo_write and av_fifo_realloc were dropped and replaced |
| 17 | by av_fifo_alloc, av_fifo_generic_read, av_fifo_generic_write and av_fifo_realloc2. | 17 | by av_fifo_alloc, av_fifo_generic_read, av_fifo_generic_write and av_fifo_realloc2. |
| 18 | In addition, the order of the function arguments of av_fifo_generic_read were changed | ||
| 19 | to match av_fifo_generic_write. | ||
| 18 | The AVFifoBuffer/struct AVFifoBuffer may only be used in an opaque way by applications, | 20 | The AVFifoBuffer/struct AVFifoBuffer may only be used in an opaque way by applications, |
| 19 | they may not use sizeof() or directly access members. | 21 | they may not use sizeof() or directly access members. |
| 20 | 22 | ||
| @@ -672,7 +672,7 @@ static void do_audio_out(AVFormatContext *s, · 671 unmodified lines | |||
| 672 | AVPacket pkt; | 672 | AVPacket pkt; |
| 673 | av_init_packet(&pkt); | 673 | av_init_packet(&pkt); |
| 674 | 674 | ||
| 675 | av_fifo_generic_read(ost->fifo, frame_bytes, NULL, audio_buf); | 675 | av_fifo_generic_read(ost->fifo, audio_buf, frame_bytes, NULL); |
| 676 | 676 | ||
| 677 | //FIXME pass ost->sync_opts as AVFrame.pts in avcodec_encode_audio() | 677 | //FIXME pass ost->sync_opts as AVFrame.pts in avcodec_encode_audio() |
| 678 | 678 | ||
| @@ -1452,7 +1452,7 @@ static int output_packet(AVInputStream *ist, int ist_index, · 773 unmodified lines | |||
| 1452 | if(fifo_bytes > 0 && enc->codec->capabilities & CODEC_CAP_SMALL_LAST_FRAME) { | 1452 | if(fifo_bytes > 0 && enc->codec->capabilities & CODEC_CAP_SMALL_LAST_FRAME) { |
| 1453 | int fs_tmp = enc->frame_size; | 1453 | int fs_tmp = enc->frame_size; |
| 1454 | enc->frame_size = fifo_bytes / (2 * enc->channels); | 1454 | enc->frame_size = fifo_bytes / (2 * enc->channels); |
| 1455 | av_fifo_generic_read(ost->fifo, fifo_bytes, NULL, samples); | 1455 | av_fifo_generic_read(ost->fifo, samples, fifo_bytes, NULL); |
| 1456 | ret = avcodec_encode_audio(enc, bit_buffer, bit_buffer_size, samples); | 1456 | ret = avcodec_encode_audio(enc, bit_buffer, bit_buffer_size, samples); |
| 1457 | enc->frame_size = fs_tmp; | 1457 | enc->frame_size = fs_tmp; |
| 1458 | } | 1458 | } |
| @@ -80,7 +80,7 @@ static int ff_interleave_new_audio_packet(AVFormatContext *s, AVPacket *pkt, · 79 unmodified lines | |||
| 80 | return 0; | 80 | return 0; |
| 81 | 81 | ||
| 82 | av_new_packet(pkt, size); | 82 | av_new_packet(pkt, size); |
| 83 | av_fifo_generic_read(aic->fifo, size, NULL, pkt->data); | 83 | av_fifo_generic_read(aic->fifo, pkt->data, size, NULL); |
| 84 | 84 | ||
| 85 | pkt->dts = pkt->pts = aic->dts; | 85 | pkt->dts = pkt->pts = aic->dts; |
| 86 | pkt->duration = av_rescale_q(*aic->samples, st->time_base, aic->time_base); | 86 | pkt->duration = av_rescale_q(*aic->samples, st->time_base, aic->time_base); |
| @@ -914,7 +914,7 @@ static int flush_packet(AVFormatContext *ctx, int stream_index, · 913 unmodified lines | |||
| 914 | 914 | ||
| 915 | /* output data */ | 915 | /* output data */ |
| 916 | assert(payload_size - stuffing_size <= av_fifo_size(stream->fifo)); | 916 | assert(payload_size - stuffing_size <= av_fifo_size(stream->fifo)); |
| 917 | av_fifo_generic_read(stream->fifo, payload_size - stuffing_size, &put_buffer, ctx->pb); | 917 | av_fifo_generic_read(stream->fifo, ctx->pb, payload_size - stuffing_size, &put_buffer); |
| 918 | stream->bytes_to_iframe -= payload_size - stuffing_size; | 918 | stream->bytes_to_iframe -= payload_size - stuffing_size; |
| 919 | }else{ | 919 | }else{ |
| 920 | payload_size= | 920 | payload_size= |
| @@ -419,7 +419,7 @@ static int swf_write_video(AVFormatContext *s, · 418 unmodified lines | |||
| 419 | put_swf_tag(s, TAG_STREAMBLOCK | TAG_LONG); | 419 | put_swf_tag(s, TAG_STREAMBLOCK | TAG_LONG); |
| 420 | put_le16(pb, swf->sound_samples); | 420 | put_le16(pb, swf->sound_samples); |
| 421 | put_le16(pb, 0); // seek samples | 421 | put_le16(pb, 0); // seek samples |
| 422 | av_fifo_generic_read(swf->audio_fifo, frame_size, &put_buffer, pb); | 422 | av_fifo_generic_read(swf->audio_fifo, pb, frame_size, &put_buffer); |
| 423 | put_swf_end_tag(s); | 423 | put_swf_end_tag(s); |
| 424 | 424 | ||
| 425 | /* update FIFO */ | 425 | /* update FIFO */ |
| @@ -63,7 +63,7 @@ int av_fifo_realloc2(AVFifoBuffer *f, unsigned int new_size) { · 62 unmodified lines | |||
| 63 | 63 | ||
| 64 | if (!f2) | 64 | if (!f2) |
| 65 | return -1; | 65 | return -1; |
| 66 | av_fifo_generic_read(f, len, NULL, f2->buffer); | 66 | av_fifo_generic_read(f, f2->buffer, len, NULL); |
| 67 | f2->wptr += len; | 67 | f2->wptr += len; |
| 68 | f2->wndx += len; | 68 | f2->wndx += len; |
| 69 | av_free(f->buffer); | 69 | av_free(f->buffer); |
| @@ -96,7 +96,7 @@ int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size, int (*func)(void · 26 unmodified lines | |||
| 96 | } | 96 | } |
| 97 | 97 | ||
| 98 | 98 | ||
| 99 | int av_fifo_generic_read(AVFifoBuffer *f, int buf_size, void (*func)(void*, void*, int), void* dest) | 99 | int av_fifo_generic_read(AVFifoBuffer *f, void *dest, int buf_size, void (*func)(void*, void*, int)) |
| 100 | { | 100 | { |
| 101 | // Read memory barrier needed for SMP here in theory | 101 | // Read memory barrier needed for SMP here in theory |
| 102 | do { | 102 | do { |
| @@ -68,7 +68,7 @@ int av_fifo_size(AVFifoBuffer *f); · 67 unmodified lines | |||
| 68 | * @param *func generic read function | 68 | * @param *func generic read function |
| 69 | * @param *dest data destination | 69 | * @param *dest data destination |
| 70 | */ | 70 | */ |
| 71 | int av_fifo_generic_read(AVFifoBuffer *f, int buf_size, void (*func)(void*, void*, int), void* dest); | 71 | int av_fifo_generic_read(AVFifoBuffer *f, void *dest, int buf_size, void (*func)(void*, void*, int)); |
| 72 | 72 | ||
| 73 | /** | 73 | /** |
| 74 | * Feeds data from a user-supplied callback to an AVFifoBuffer. | 74 | * Feeds data from a user-supplied callback to an AVFifoBuffer. |