From aa805b9632ac370c9394940a28167061d0e4ec43 Mon Sep 17 00:00:00 2001 From: Bei Li Date: Tue, 8 Dec 2015 16:57:35 -0800 Subject: [PATCH] Support DTS audio in MP4 - Part 2 Issue #52 Change-Id: Ib71077c5063aced23f9d060b35facbf8e6eb0a3a --- packager/media/formats/mp4/mp4_muxer.cc | 44 ++++++++++++++++++------- 1 file changed, 33 insertions(+), 11 deletions(-) diff --git a/packager/media/formats/mp4/mp4_muxer.cc b/packager/media/formats/mp4/mp4_muxer.cc index 762bc69a28..6c7e0c1674 100644 --- a/packager/media/formats/mp4/mp4_muxer.cc +++ b/packager/media/formats/mp4/mp4_muxer.cc @@ -225,20 +225,42 @@ void MP4Muxer::GenerateAudioTrak(const AudioStreamInfo* audio_info, trak->media.handler.type = kAudio; AudioSampleEntry audio; - audio.format = FOURCC_MP4A; + switch(audio_info->codec()){ + case kCodecAAC: + audio.format = FOURCC_MP4A; + audio.esds.es_descriptor.set_object_type(kISO_14496_3); // MPEG4 AAC. + audio.esds.es_descriptor.set_esid(track_id); + audio.esds.es_descriptor.set_decoder_specific_info( + audio_info->extra_data()); + break; + case kCodecDTSC: + audio.format = FOURCC_DTSC; + audio.ddts.data = audio_info->extra_data(); + break; + case kCodecDTSH: + audio.format = FOURCC_DTSH; + audio.ddts.data = audio_info->extra_data(); + break; + case kCodecDTSL: + audio.format = FOURCC_DTSL; + audio.ddts.data = audio_info->extra_data(); + break; + case kCodecDTSE: + audio.format = FOURCC_DTSE; + audio.ddts.data = audio_info->extra_data(); + break; + case kCodecDTSM: + audio.format = FOURCC_DTSM; + audio.ddts.data = audio_info->extra_data(); + break; + default: + NOTIMPLEMENTED(); + break; + } + audio.channelcount = audio_info->num_channels(); audio.samplesize = audio_info->sample_bits(); audio.samplerate = audio_info->sampling_frequency(); - - if (kCodecAAC) { - audio.esds.es_descriptor.set_object_type(kISO_14496_3); // MPEG4 AAC. - } else { - // Do we need to support other types? - NOTIMPLEMENTED(); - } - audio.esds.es_descriptor.set_esid(track_id); - audio.esds.es_descriptor.set_decoder_specific_info(audio_info->extra_data()); - SampleDescription& sample_description = trak->media.information.sample_table.description; sample_description.type = kAudio;