diff aac_ac3_parser.c @ 6527:32b984487899 libavcodec

Pass AACAC3ParseContext to sync() instead of individual arguments. Patch by Bartlomiej Wolowiec (bartek wolowiec gmail com)
author jbr
date Sun, 23 Mar 2008 15:43:29 +0000
parents 49d225414a3f
children 04763b6fd4f0
line wrap: on
line diff
--- a/aac_ac3_parser.c	Sat Mar 22 17:34:29 2008 +0000
+++ b/aac_ac3_parser.c	Sun Mar 23 15:43:29 2008 +0000
@@ -30,7 +30,7 @@
 {
     AACAC3ParseContext *s = s1->priv_data;
     const uint8_t *buf_ptr;
-    int len, sample_rate, bit_rate, channels, samples;
+    int len;
 
     *poutbuf = NULL;
     *poutbuf_size = 0;
@@ -50,8 +50,7 @@
 
         if (s->frame_size == 0) {
             if ((s->inbuf_ptr - s->inbuf) == s->header_size) {
-                len = s->sync(s->inbuf, &channels, &sample_rate, &bit_rate,
-                              &samples);
+                len = s->sync(s);
                 if (len == 0) {
                     /* no sync found : move by one byte (inefficient, but simple!) */
                     memmove(s->inbuf, s->inbuf + 1, s->header_size - 1);
@@ -59,19 +58,19 @@
                 } else {
                     s->frame_size = len;
                     /* update codec info */
-                    avctx->sample_rate = sample_rate;
+                    avctx->sample_rate = s->sample_rate;
                     /* allow downmixing to stereo (or mono for AC3) */
                     if(avctx->request_channels > 0 &&
-                            avctx->request_channels < channels &&
+                            avctx->request_channels < s->channels &&
                             (avctx->request_channels <= 2 ||
                             (avctx->request_channels == 1 &&
                             avctx->codec_id == CODEC_ID_AC3))) {
                         avctx->channels = avctx->request_channels;
                     } else {
-                        avctx->channels = channels;
+                        avctx->channels = s->channels;
                     }
-                    avctx->bit_rate = bit_rate;
-                    avctx->frame_size = samples;
+                    avctx->bit_rate = s->bit_rate;
+                    avctx->frame_size = s->samples;
                 }
             }
         } else {