]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/ac3_parser.c
VP8: always_inline some things to force gcc to do the right thing
[ffmpeg] / libavcodec / ac3_parser.c
index e78deb20eb27d6aee86f33add918bff320955652..b844ec36c3d7cba971c6bcd8177979588f79d6fa 100644 (file)
@@ -23,7 +23,7 @@
 #include "parser.h"
 #include "ac3_parser.h"
 #include "aac_ac3_parser.h"
-#include "bitstream.h"
+#include "get_bits.h"
 
 
 #define AC3_HEADER_SIZE 7
@@ -121,6 +121,9 @@ int ff_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr)
                         (hdr->num_blocks * 256.0));
         hdr->channels = ff_ac3_channels_tab[hdr->channel_mode] + hdr->lfe_on;
     }
+    hdr->channel_layout = ff_ac3_channel_layout_tab[hdr->channel_mode];
+    if (hdr->lfe_on)
+        hdr->channel_layout |= CH_LOW_FREQUENCY;
 
     return 0;
 }
@@ -161,7 +164,7 @@ static int ac3_sync(uint64_t state, AACAC3ParseContext *hdr_info,
     union {
         uint64_t u64;
         uint8_t  u8[8];
-    } tmp = { be2me_64(state) };
+    } tmp = { av_be2ne64(state) };
     AC3HeaderInfo hdr;
     GetBitContext gbc;
 
@@ -174,10 +177,11 @@ static int ac3_sync(uint64_t state, AACAC3ParseContext *hdr_info,
     hdr_info->sample_rate = hdr.sample_rate;
     hdr_info->bit_rate = hdr.bit_rate;
     hdr_info->channels = hdr.channels;
-    hdr_info->samples = AC3_FRAME_SIZE;
+    hdr_info->channel_layout = hdr.channel_layout;
+    hdr_info->samples = hdr.num_blocks * 256;
     if(hdr.bitstream_id>10)
         hdr_info->codec_id = CODEC_ID_EAC3;
-    else
+    else if (hdr_info->codec_id == CODEC_ID_NONE)
         hdr_info->codec_id = CODEC_ID_AC3;
 
     *need_next_header = (hdr.frame_type != EAC3_FRAME_TYPE_AC3_CONVERT);