summaryrefslogtreecommitdiff
path: root/libavcodec/ac3_parser.c
diff options
context:
space:
mode:
authorBartlomiej Wolowiec <bartek.wolowiec@gmail.com>2008-04-24 22:27:13 +0000
committerBartlomiej Wolowiec <bartek.wolowiec@gmail.com>2008-04-24 22:27:13 +0000
commit0c79b1402a48a99f32435a0f5ad2364c58c6fcf3 (patch)
treeca01b356127f279bfe3d6b54cebf040d1f4ed539 /libavcodec/ac3_parser.c
parent81d5ae6decfaa5d8fbf40f0f448de81b644c7002 (diff)
add a ff_ac3_parse_header_full() which calls ff_ac3_parse_header()
and then reads the channel_map stuff Originally committed as revision 12944 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/ac3_parser.c')
-rw-r--r--libavcodec/ac3_parser.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/libavcodec/ac3_parser.c b/libavcodec/ac3_parser.c
index 471fb4f6e2..a6b9b740e0 100644
--- a/libavcodec/ac3_parser.c
+++ b/libavcodec/ac3_parser.c
@@ -136,6 +136,35 @@ int ff_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr)
return 0;
}
+int ff_ac3_parse_header_full(GetBitContext *gbc, AC3HeaderInfo *hdr){
+ int ret, i;
+ ret = ff_ac3_parse_header(gbc, hdr);
+ if(!ret){
+ if(hdr->bitstream_id>10){
+ /* Enhanced AC-3 */
+ skip_bits(gbc, 5); // skip bitstream id
+
+ /* skip dialog normalization and compression gain */
+ for (i = 0; i < (hdr->channel_mode ? 1 : 2); i++) {
+ skip_bits(gbc, 5); // skip dialog normalization
+ if (get_bits1(gbc)) {
+ skip_bits(gbc, 8); //skip Compression gain word
+ }
+ }
+ /* dependent stream channel map */
+ if (hdr->frame_type == EAC3_FRAME_TYPE_DEPENDENT && get_bits1(gbc)) {
+ hdr->channel_map = get_bits(gbc, 16); //custom channel map
+ return 0;
+ }
+ }
+ //default channel map based on acmod and lfeon
+ hdr->channel_map = ff_eac3_default_chmap[hdr->channel_mode];
+ if(hdr->lfe_on)
+ hdr->channel_map |= AC3_CHMAP_LFE;
+ }
+ return ret;
+}
+
static int ac3_sync(uint64_t state, AACAC3ParseContext *hdr_info,
int *need_next_header, int *new_frame_start)
{