]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/mpegaudio_parser.c
fix dynamic loading of libfaad 2.6
[ffmpeg] / libavcodec / mpegaudio_parser.c
index 714857623b5d82271e2d96487f412030369341b7..e7cb7439e506d29b1ea9c7f0066a266f00e1f12e 100644 (file)
@@ -44,7 +44,7 @@ typedef struct MpegAudioParseContext {
 
 /* useful helper to get mpeg audio stream infos. Return -1 if error in
    header, otherwise the coded frame size in bytes */
-int mpa_decode_header(AVCodecContext *avctx, uint32_t head, int *sample_rate)
+int ff_mpa_decode_header(AVCodecContext *avctx, uint32_t head, int *sample_rate)
 {
     MPADecodeContext s1, *s = &s1;
     s1.avctx = avctx;
@@ -52,7 +52,7 @@ int mpa_decode_header(AVCodecContext *avctx, uint32_t head, int *sample_rate)
     if (ff_mpa_check_header(head) != 0)
         return -1;
 
-    if (decode_header(s, head) != 0) {
+    if (ff_mpegaudio_decode_header(s, head) != 0) {
         return -1;
     }
 
@@ -105,10 +105,7 @@ static int mpegaudio_parse(AVCodecParserContext *s1,
             /* special case for next header for first frame in free
                format case (XXX: find a simpler method) */
             if (s->free_format_next_header != 0) {
-                s->inbuf[0] = s->free_format_next_header >> 24;
-                s->inbuf[1] = s->free_format_next_header >> 16;
-                s->inbuf[2] = s->free_format_next_header >> 8;
-                s->inbuf[3] = s->free_format_next_header;
+                AV_WB32(s->inbuf, s->free_format_next_header);
                 s->inbuf_ptr = s->inbuf + 4;
                 s->free_format_next_header = 0;
                 goto got_header;
@@ -124,10 +121,9 @@ static int mpegaudio_parse(AVCodecParserContext *s1,
             }
             if ((s->inbuf_ptr - s->inbuf) >= MPA_HEADER_SIZE) {
             got_header:
-                header = (s->inbuf[0] << 24) | (s->inbuf[1] << 16) |
-                    (s->inbuf[2] << 8) | s->inbuf[3];
+                header = AV_RB32(s->inbuf);
 
-                ret = mpa_decode_header(avctx, header, &sr);
+                ret = ff_mpa_decode_header(avctx, header, &sr);
                 if (ret < 0) {
                     s->header_count= -2;
                     /* no sync found : move by one byte (inefficient, but simple!) */
@@ -146,13 +142,13 @@ static int mpegaudio_parse(AVCodecParserContext *s1,
 
 #if 0
                     /* free format: prepare to compute frame size */
-                    if (decode_header(s, header) == 1) {
+                    if (ff_mpegaudio_decode_header(s, header) == 1) {
                         s->frame_size = -1;
                     }
 #endif
+                    if(s->header_count > 1)
+                        avctx->sample_rate= sr;
                 }
-                if(s->header_count > 1)
-                    avctx->sample_rate= sr;
             }
         } else
 #if 0
@@ -176,10 +172,8 @@ static int mpegaudio_parse(AVCodecParserContext *s1,
                 p = s->inbuf_ptr - 3;
                 pend = s->inbuf_ptr + len - 4;
                 while (p <= pend) {
-                    header = (p[0] << 24) | (p[1] << 16) |
-                        (p[2] << 8) | p[3];
-                    header1 = (s->inbuf[0] << 24) | (s->inbuf[1] << 16) |
-                        (s->inbuf[2] << 8) | s->inbuf[3];
+                    header = AV_RB32(p);
+                    header1 = AV_RB32(s->inbuf);
                     /* check with high probability that we have a
                        valid header */
                     if ((header & SAME_HEADER_MASK) ==
@@ -199,7 +193,7 @@ static int mpegaudio_parse(AVCodecParserContext *s1,
                             s->free_format_frame_size -= padding;
                         dprintf(avctx, "free frame size=%d padding=%d\n",
                                 s->free_format_frame_size, padding);
-                        decode_header(s, header1);
+                        ff_mpegaudio_decode_header(s, header1);
                         goto next_data;
                     }
                     p++;