|
|
|
@ -620,12 +620,18 @@ static int mov_read_esds(MOVContext *c, AVIOContext *pb, MOVAtom atom) |
|
|
|
|
static int mov_read_dac3(MOVContext *c, AVIOContext *pb, MOVAtom atom) |
|
|
|
|
{ |
|
|
|
|
AVStream *st; |
|
|
|
|
enum AVAudioServiceType *ast; |
|
|
|
|
int ac3info, acmod, lfeon, bsmod; |
|
|
|
|
|
|
|
|
|
if (c->fc->nb_streams < 1) |
|
|
|
|
return 0; |
|
|
|
|
st = c->fc->streams[c->fc->nb_streams-1]; |
|
|
|
|
|
|
|
|
|
ast = (enum AVAudioServiceType*)ff_stream_new_side_data(st, AV_PKT_DATA_AUDIO_SERVICE_TYPE, |
|
|
|
|
sizeof(*ast)); |
|
|
|
|
if (!ast) |
|
|
|
|
return AVERROR(ENOMEM); |
|
|
|
|
|
|
|
|
|
ac3info = avio_rb24(pb); |
|
|
|
|
bsmod = (ac3info >> 14) & 0x7; |
|
|
|
|
acmod = (ac3info >> 11) & 0x7; |
|
|
|
@ -634,9 +640,11 @@ static int mov_read_dac3(MOVContext *c, AVIOContext *pb, MOVAtom atom) |
|
|
|
|
st->codec->channel_layout = avpriv_ac3_channel_layout_tab[acmod]; |
|
|
|
|
if (lfeon) |
|
|
|
|
st->codec->channel_layout |= AV_CH_LOW_FREQUENCY; |
|
|
|
|
st->codec->audio_service_type = bsmod; |
|
|
|
|
*ast = bsmod; |
|
|
|
|
if (st->codec->channels > 1 && bsmod == 0x7) |
|
|
|
|
st->codec->audio_service_type = AV_AUDIO_SERVICE_TYPE_KARAOKE; |
|
|
|
|
*ast = AV_AUDIO_SERVICE_TYPE_KARAOKE; |
|
|
|
|
|
|
|
|
|
st->codec->audio_service_type = *ast; |
|
|
|
|
|
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
@ -644,12 +652,18 @@ static int mov_read_dac3(MOVContext *c, AVIOContext *pb, MOVAtom atom) |
|
|
|
|
static int mov_read_dec3(MOVContext *c, AVIOContext *pb, MOVAtom atom) |
|
|
|
|
{ |
|
|
|
|
AVStream *st; |
|
|
|
|
enum AVAudioServiceType *ast; |
|
|
|
|
int eac3info, acmod, lfeon, bsmod; |
|
|
|
|
|
|
|
|
|
if (c->fc->nb_streams < 1) |
|
|
|
|
return 0; |
|
|
|
|
st = c->fc->streams[c->fc->nb_streams-1]; |
|
|
|
|
|
|
|
|
|
ast = (enum AVAudioServiceType*)ff_stream_new_side_data(st, AV_PKT_DATA_AUDIO_SERVICE_TYPE, |
|
|
|
|
sizeof(*ast)); |
|
|
|
|
if (!ast) |
|
|
|
|
return AVERROR(ENOMEM); |
|
|
|
|
|
|
|
|
|
/* No need to parse fields for additional independent substreams and its
|
|
|
|
|
* associated dependent substreams since libavcodec's E-AC-3 decoder |
|
|
|
|
* does not support them yet. */ |
|
|
|
@ -662,9 +676,11 @@ static int mov_read_dec3(MOVContext *c, AVIOContext *pb, MOVAtom atom) |
|
|
|
|
if (lfeon) |
|
|
|
|
st->codec->channel_layout |= AV_CH_LOW_FREQUENCY; |
|
|
|
|
st->codec->channels = av_get_channel_layout_nb_channels(st->codec->channel_layout); |
|
|
|
|
st->codec->audio_service_type = bsmod; |
|
|
|
|
*ast = bsmod; |
|
|
|
|
if (st->codec->channels > 1 && bsmod == 0x7) |
|
|
|
|
st->codec->audio_service_type = AV_AUDIO_SERVICE_TYPE_KARAOKE; |
|
|
|
|
*ast = AV_AUDIO_SERVICE_TYPE_KARAOKE; |
|
|
|
|
|
|
|
|
|
st->codec->audio_service_type = *ast; |
|
|
|
|
|
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|