Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(168)

Unified Diff: media/mp4/mp4_stream_parser.cc

Issue 14641006: Support EAC3 (Dolby Digital Plus) codec (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed Aaron's comments Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/mp4/fourccs.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/mp4/mp4_stream_parser.cc
diff --git a/media/mp4/mp4_stream_parser.cc b/media/mp4/mp4_stream_parser.cc
index 19096006b06acffc10654a4829baed3b9f65e81d..da3bb1928e9af6b895d5e388f055e017a43fca2d 100644
--- a/media/mp4/mp4_stream_parser.cc
+++ b/media/mp4/mp4_stream_parser.cc
@@ -197,7 +197,7 @@ bool MP4StreamParser::ParseMoov(BoxReader* reader) {
const AudioSampleEntry& entry = samp_descr.audio_entries[desc_idx];
const AAC& aac = entry.esds.aac;
- if (!(entry.format == FOURCC_MP4A ||
+ if (!(entry.format == FOURCC_MP4A || entry.format == FOURCC_EAC3 ||
(entry.format == FOURCC_ENCA &&
entry.sinf.format.format == FOURCC_MP4A))) {
MEDIA_LOG(log_cb_) << "Unsupported audio format 0x"
@@ -205,8 +205,12 @@ bool MP4StreamParser::ParseMoov(BoxReader* reader) {
return false;
}
- int audio_type = entry.esds.object_type;
+ uint8 audio_type = entry.esds.object_type;
DVLOG(1) << "audio_type " << std::hex << audio_type;
+ if (audio_type == kForbidden &&
+ audio_object_types_.find(kEAC3) != audio_object_types_.end()) {
acolwell GONE FROM CHROMIUM 2013/05/01 00:31:00 nit: Replace 'audio_object_types_.find(kEAC3) != a
ycheo (away) 2013/05/01 06:01:10 Done.
+ audio_type = kEAC3;
+ }
if (audio_object_types_.find(audio_type) == audio_object_types_.end()) {
MEDIA_LOG(log_cb_) << "audio object type 0x" << std::hex << audio_type
<< " does not match what is specified in the"
@@ -214,9 +218,20 @@ bool MP4StreamParser::ParseMoov(BoxReader* reader) {
return false;
}
+ AudioCodec codec = kUnknownAudioCodec;
+ ChannelLayout channel_layout = CHANNEL_LAYOUT_NONE;
+ int sample_per_second = 0;
// Check if it is MPEG4 AAC defined in ISO 14496 Part 3 or
// supported MPEG2 AAC varients.
- if (audio_type != kISO_14496_3 && audio_type != kISO_13818_7_AAC_LC) {
+ if (ESDescriptor::IsAAC(audio_type)) {
+ codec = kCodecAAC;
+ channel_layout = aac.GetChannelLayout(has_sbr_);
+ sample_per_second = aac.GetOutputSamplesPerSecond(has_sbr_);
+ } else if (audio_type == kEAC3) {
+ codec = kCodecEAC3;
+ channel_layout = GuessChannelLayout(entry.channelcount);
+ sample_per_second = entry.samplerate;
+ } else {
MEDIA_LOG(log_cb_) << "Unsupported audio object type 0x" << std::hex
<< audio_type << " in esds.";
return false;
@@ -236,9 +251,9 @@ bool MP4StreamParser::ParseMoov(BoxReader* reader) {
is_audio_track_encrypted_ = entry.sinf.info.track_encryption.is_encrypted;
DVLOG(1) << "is_audio_track_encrypted_: " << is_audio_track_encrypted_;
- audio_config.Initialize(kCodecAAC, sample_format,
- aac.GetChannelLayout(has_sbr_),
- aac.GetOutputSamplesPerSecond(has_sbr_),
+ audio_config.Initialize(codec, sample_format,
+ channel_layout,
+ sample_per_second,
NULL, 0, is_audio_track_encrypted_, false);
has_audio_ = true;
audio_track_id_ = track->header.track_id;
@@ -455,7 +470,8 @@ bool MP4StreamParser::EnqueueSample(BufferQueue* audio_buffers,
}
if (audio) {
- if (!PrepareAACBuffer(runs_->audio_description().esds.aac,
+ if (ESDescriptor::IsAAC(runs_->audio_description().esds.object_type) &&
+ !PrepareAACBuffer(runs_->audio_description().esds.aac,
&frame_buf, &subsamples)) {
MEDIA_LOG(log_cb_) << "Failed to prepare AAC sample for decode";
*err = true;
« no previous file with comments | « media/mp4/fourccs.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698