Browse code

Reorder arguments for av_fifo_generic_read to be more logical and consistent with av_fifo_generic_write.

Originally committed as revision 17914 to svn://svn.ffmpeg.org/ffmpeg/trunk

Reimar Döffinger authored on 2009/03/10 02:47:47
Showing 7 changed files
... ...
@@ -15,6 +15,8 @@ API changes, most recent first:
15 15
 20090308 - r17869 - lavu 50.0.0  - AVFifoBuffer
16 16
   av_fifo_init, av_fifo_read, av_fifo_write and av_fifo_realloc were dropped and replaced
17 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 20
   The AVFifoBuffer/struct AVFifoBuffer may only be used in an opaque way by applications,
19 21
   they may not use sizeof() or directly access members.
20 22
 
... ...
@@ -672,7 +672,7 @@ static void do_audio_out(AVFormatContext *s,
672 672
             AVPacket pkt;
673 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 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,
1452 1452
                             if(fifo_bytes > 0 && enc->codec->capabilities & CODEC_CAP_SMALL_LAST_FRAME) {
1453 1453
                                 int fs_tmp = enc->frame_size;
1454 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 1456
                                     ret = avcodec_encode_audio(enc, bit_buffer, bit_buffer_size, samples);
1457 1457
                                 enc->frame_size = fs_tmp;
1458 1458
                             }
... ...
@@ -80,7 +80,7 @@ static int ff_interleave_new_audio_packet(AVFormatContext *s, AVPacket *pkt,
80 80
         return 0;
81 81
 
82 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 85
     pkt->dts = pkt->pts = aic->dts;
86 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,
914 914
 
915 915
         /* output data */
916 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 918
         stream->bytes_to_iframe -= payload_size - stuffing_size;
919 919
     }else{
920 920
         payload_size=
... ...
@@ -419,7 +419,7 @@ static int swf_write_video(AVFormatContext *s,
419 419
         put_swf_tag(s, TAG_STREAMBLOCK | TAG_LONG);
420 420
         put_le16(pb, swf->sound_samples);
421 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 423
         put_swf_end_tag(s);
424 424
 
425 425
         /* update FIFO */
... ...
@@ -63,7 +63,7 @@ int av_fifo_realloc2(AVFifoBuffer *f, unsigned int new_size) {
63 63
 
64 64
         if (!f2)
65 65
             return -1;
66
-        av_fifo_generic_read(f, len, NULL, f2->buffer);
66
+        av_fifo_generic_read(f, f2->buffer, len, NULL);
67 67
         f2->wptr += len;
68 68
         f2->wndx += len;
69 69
         av_free(f->buffer);
... ...
@@ -96,7 +96,7 @@ int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size, int (*func)(void
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 101
 // Read memory barrier needed for SMP here in theory
102 102
     do {
... ...
@@ -68,7 +68,7 @@ int av_fifo_size(AVFifoBuffer *f);
68 68
  * @param *func generic read function
69 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 74
  * Feeds data from a user-supplied callback to an AVFifoBuffer.