Revision be187388
libavcodec/aac_ac3_parser.c | ||
---|---|---|
94 | 94 |
avctx->channel_layout = s->channel_layout; |
95 | 95 |
} |
96 | 96 |
avctx->frame_size = s->samples; |
97 |
avctx->audio_service_type = s->service_type; |
|
97 | 98 |
} |
98 | 99 |
|
99 | 100 |
avctx->bit_rate = s->bit_rate; |
libavcodec/aac_ac3_parser.h | ||
---|---|---|
49 | 49 |
int bit_rate; |
50 | 50 |
int samples; |
51 | 51 |
int64_t channel_layout; |
52 |
int service_type; |
|
52 | 53 |
|
53 | 54 |
int remaining_size; |
54 | 55 |
uint64_t state; |
libavcodec/ac3.h | ||
---|---|---|
87 | 87 |
uint16_t crc1; |
88 | 88 |
uint8_t sr_code; |
89 | 89 |
uint8_t bitstream_id; |
90 |
uint8_t bitstream_mode; |
|
90 | 91 |
uint8_t channel_mode; |
91 | 92 |
uint8_t lfe_on; |
92 | 93 |
uint8_t frame_type; |
libavcodec/ac3_parser.c | ||
---|---|---|
69 | 69 |
|
70 | 70 |
skip_bits(gbc, 5); // skip bsid, already got it |
71 | 71 |
|
72 |
skip_bits(gbc, 3); // skip bitstream mode
|
|
72 |
hdr->bitstream_mode = get_bits(gbc, 3);
|
|
73 | 73 |
hdr->channel_mode = get_bits(gbc, 3); |
74 | 74 |
|
75 | 75 |
if(hdr->channel_mode == AC3_CHMODE_STEREO) { |
... | ... | |
151 | 151 |
hdr_info->channels = hdr.channels; |
152 | 152 |
hdr_info->channel_layout = hdr.channel_layout; |
153 | 153 |
hdr_info->samples = hdr.num_blocks * 256; |
154 |
hdr_info->service_type = hdr.bitstream_mode; |
|
155 |
if (hdr.bitstream_mode == 0x7 && hdr.channels > 1) |
|
156 |
hdr_info->service_type = AV_AUDIO_SERVICE_TYPE_KARAOKE; |
|
154 | 157 |
if(hdr.bitstream_id>10) |
155 | 158 |
hdr_info->codec_id = CODEC_ID_EAC3; |
156 | 159 |
else if (hdr_info->codec_id == CODEC_ID_NONE) |
libavcodec/ac3dec.c | ||
---|---|---|
273 | 273 |
|
274 | 274 |
/* get decoding parameters from header info */ |
275 | 275 |
s->bit_alloc_params.sr_code = hdr.sr_code; |
276 |
s->bitstream_mode = hdr.bitstream_mode; |
|
276 | 277 |
s->channel_mode = hdr.channel_mode; |
277 | 278 |
s->channel_layout = hdr.channel_layout; |
278 | 279 |
s->lfe_on = hdr.lfe_on; |
... | ... | |
1399 | 1400 |
if(s->out_channels < s->channels) |
1400 | 1401 |
s->output_mode = s->out_channels == 1 ? AC3_CHMODE_MONO : AC3_CHMODE_STEREO; |
1401 | 1402 |
} |
1403 |
/* set audio service type based on bitstream mode for AC-3 */ |
|
1404 |
avctx->audio_service_type = s->bitstream_mode; |
|
1405 |
if (s->bitstream_mode == 0x7 && s->channels > 1) |
|
1406 |
avctx->audio_service_type = AV_AUDIO_SERVICE_TYPE_KARAOKE; |
|
1402 | 1407 |
|
1403 | 1408 |
/* decode the audio blocks */ |
1404 | 1409 |
channel_map = ff_ac3_dec_channel_map[s->output_mode & ~AC3_OUTPUT_LFEON][s->lfe_on]; |
libavcodec/ac3dec.h | ||
---|---|---|
79 | 79 |
int bit_rate; ///< stream bit rate, in bits-per-second |
80 | 80 |
int sample_rate; ///< sample frequency, in Hz |
81 | 81 |
int num_blocks; ///< number of audio blocks |
82 |
int bitstream_mode; ///< bitstream mode (bsmod) |
|
82 | 83 |
int channel_mode; ///< channel mode (acmod) |
83 | 84 |
int channel_layout; ///< channel layout |
84 | 85 |
int lfe_on; ///< lfe channel in use |
libavcodec/ac3enc.c | ||
---|---|---|
1657 | 1657 |
if (s->cutoff > (s->sample_rate >> 1)) |
1658 | 1658 |
s->cutoff = s->sample_rate >> 1; |
1659 | 1659 |
|
1660 |
/* validate audio service type / channels combination */ |
|
1661 |
if ((avctx->audio_service_type == AV_AUDIO_SERVICE_TYPE_KARAOKE && |
|
1662 |
avctx->channels == 1) || |
|
1663 |
((avctx->audio_service_type == AV_AUDIO_SERVICE_TYPE_COMMENTARY || |
|
1664 |
avctx->audio_service_type == AV_AUDIO_SERVICE_TYPE_EMERGENCY || |
|
1665 |
avctx->audio_service_type == AV_AUDIO_SERVICE_TYPE_VOICE_OVER) |
|
1666 |
&& avctx->channels > 1)) { |
|
1667 |
av_log(avctx, AV_LOG_ERROR, "invalid audio service type for the " |
|
1668 |
"specified number of channels\n"); |
|
1669 |
return AVERROR(EINVAL); |
|
1670 |
} |
|
1671 |
|
|
1660 | 1672 |
return 0; |
1661 | 1673 |
} |
1662 | 1674 |
|
... | ... | |
1799 | 1811 |
return ret; |
1800 | 1812 |
|
1801 | 1813 |
s->bitstream_id = 8 + s->bit_alloc.sr_shift; |
1802 |
s->bitstream_mode = 0; /* complete main audio service */ |
|
1814 |
s->bitstream_mode = avctx->audio_service_type; |
|
1815 |
if (s->bitstream_mode == AV_AUDIO_SERVICE_TYPE_KARAOKE) |
|
1816 |
s->bitstream_mode = 0x7; |
|
1803 | 1817 |
|
1804 | 1818 |
s->frame_size_min = 2 * ff_ac3_frame_size_tab[s->frame_size_code][s->bit_alloc.sr_code]; |
1805 | 1819 |
s->bits_written = 0; |
libavcodec/eac3dec.c | ||
---|---|---|
410 | 410 |
|
411 | 411 |
/* informational metadata */ |
412 | 412 |
if (get_bits1(gbc)) { |
413 |
skip_bits(gbc, 3); // skip bit stream mode
|
|
413 |
s->bitstream_mode = get_bits(gbc, 3);
|
|
414 | 414 |
skip_bits(gbc, 2); // skip copyright bit and original bitstream bit |
415 | 415 |
if (s->channel_mode == AC3_CHMODE_STEREO) { |
416 | 416 |
skip_bits(gbc, 4); // skip Dolby surround and headphone mode |
Also available in: Unified diff