diff mpegaudio_parser.c @ 8641:54e2916c25a5 libavcodec

Avoid allocating MPADecodeContext on stack. Instead move relevant fields into MPADecodeHeader and use it where appropriate.
author andoma
date Fri, 23 Jan 2009 12:09:32 +0000
parents 04423b2f6e0b
children 043574c5c153
line wrap: on
line diff
--- a/mpegaudio_parser.c	Fri Jan 23 06:33:04 2009 +0000
+++ b/mpegaudio_parser.c	Fri Jan 23 12:09:32 2009 +0000
@@ -46,8 +46,7 @@
    header, otherwise the coded frame size in bytes */
 int ff_mpa_decode_header(AVCodecContext *avctx, uint32_t head, int *sample_rate, int *channels, int *frame_size, int *bit_rate)
 {
-    MPADecodeContext s1, *s = &s1;
-    s1.avctx = avctx;
+    MPADecodeHeader s1, *s = &s1;
 
     if (ff_mpa_check_header(head) != 0)
         return -1;
@@ -145,7 +144,7 @@
 
 #if 0
                     /* free format: prepare to compute frame size */
-                    if (ff_mpegaudio_decode_header(s, header) == 1) {
+                    if (ff_mpegaudio_decode_header((MPADecodeHeader *)s, header) == 1) {
                         s->frame_size = -1;
                     }
 #endif
@@ -200,7 +199,7 @@
                             s->free_format_frame_size -= padding;
                         dprintf(avctx, "free frame size=%d padding=%d\n",
                                 s->free_format_frame_size, padding);
-                        ff_mpegaudio_decode_header(s, header1);
+                        ff_mpegaudio_decode_header((MPADecodeHeader *)s, header1);
                         goto next_data;
                     }
                     p++;