diff audiointerleave.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 cb5bcf4bfe15
children b1feed18d106
line wrap: on
line diff
--- a/audiointerleave.c	Sat Mar 07 22:42:09 2009 +0000
+++ b/audiointerleave.c	Sun Mar 08 14:16:55 2009 +0000
@@ -33,7 +33,7 @@
         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 @@
             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 @@
     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 @@
         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;