summaryrefslogtreecommitdiff
path: root/libavcodec/ac3_parser.c
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2011-03-24 12:10:38 -0400
committerJustin Ruggles <justin.ruggles@gmail.com>2011-03-25 16:59:00 -0400
commitbe18738801b1723cc6aee126dfea466584012793 (patch)
tree5b2592d11b45a5c90dc9792695bdb9db41b90984 /libavcodec/ac3_parser.c
parentc70a6a41ddb759a5c6e8e810ebd603e39c36a315 (diff)
Get audio_service_type for AC-3 based on bitstream mode in the AC-3 parser
and decoder, and vice-versa for the AC-3 encoder.
Diffstat (limited to 'libavcodec/ac3_parser.c')
-rw-r--r--libavcodec/ac3_parser.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavcodec/ac3_parser.c b/libavcodec/ac3_parser.c
index 16cffe822b..82eeda3e61 100644
--- a/libavcodec/ac3_parser.c
+++ b/libavcodec/ac3_parser.c
@@ -69,7 +69,7 @@ int ff_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr)
skip_bits(gbc, 5); // skip bsid, already got it
- skip_bits(gbc, 3); // skip bitstream mode
+ hdr->bitstream_mode = get_bits(gbc, 3);
hdr->channel_mode = get_bits(gbc, 3);
if(hdr->channel_mode == AC3_CHMODE_STEREO) {
@@ -151,6 +151,9 @@ static int ac3_sync(uint64_t state, AACAC3ParseContext *hdr_info,
hdr_info->channels = hdr.channels;
hdr_info->channel_layout = hdr.channel_layout;
hdr_info->samples = hdr.num_blocks * 256;
+ hdr_info->service_type = hdr.bitstream_mode;
+ if (hdr.bitstream_mode == 0x7 && hdr.channels > 1)
+ hdr_info->service_type = AV_AUDIO_SERVICE_TYPE_KARAOKE;
if(hdr.bitstream_id>10)
hdr_info->codec_id = CODEC_ID_EAC3;
else if (hdr_info->codec_id == CODEC_ID_NONE)