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

Unified Diff: media/formats/mp4/mp4_stream_parser.cc

Issue 812643005: Re-add AC3/EAC3 audio demuxing support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Code cleanup Created 5 years, 11 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
Index: media/formats/mp4/mp4_stream_parser.cc
diff --git a/media/formats/mp4/mp4_stream_parser.cc b/media/formats/mp4/mp4_stream_parser.cc
index d4f63cbd3b76b4d01c8144e564a7bee685791409..65cc3ad1ad9de5530095c1f6468f2507514922a6 100644
--- a/media/formats/mp4/mp4_stream_parser.cc
+++ b/media/formats/mp4/mp4_stream_parser.cc
@@ -215,6 +215,13 @@ bool MP4StreamParser::ParseMoov(BoxReader* reader) {
const AAC& aac = entry.esds.aac;
if (!(entry.format == FOURCC_MP4A ||
+#if defined(ENABLE_AC3_EAC3_AUDIO_DEMUXING)
+ entry.format == FOURCC_A52 ||
+ entry.format == FOURCC_A52b ||
+ entry.format == FOURCC_AC3 ||
+ entry.format == FOURCC_AC_3 ||
+ entry.format == FOURCC_EAC3 ||
+#endif
(entry.format == FOURCC_ENCA &&
entry.sinf.format.format == FOURCC_MP4A))) {
MEDIA_LOG(log_cb_) << "Unsupported audio format 0x"
@@ -223,6 +230,17 @@ bool MP4StreamParser::ParseMoov(BoxReader* reader) {
}
uint8 audio_type = entry.esds.object_type;
+#if defined(ENABLE_AC3_EAC3_AUDIO_DEMUXING)
+ if (audio_type == kForbidden &&
+ (entry.format == FOURCC_EAC3 || entry.format == FOURCC_A52b)) {
+ audio_type = kEAC3;
+ }
+ if (audio_type == kForbidden &&
+ (entry.format == FOURCC_A52 || entry.format == FOURCC_AC3 ||
+ entry.format == FOURCC_AC_3)) {
+ audio_type = kAC3;
+ }
+#endif
DVLOG(1) << "audio_type " << std::hex << static_cast<int>(audio_type);
if (audio_object_types_.find(audio_type) == audio_object_types_.end()) {
MEDIA_LOG(log_cb_) << "audio object type 0x" << std::hex << audio_type
@@ -244,6 +262,16 @@ bool MP4StreamParser::ParseMoov(BoxReader* reader) {
#if defined(OS_ANDROID)
extra_data = aac.codec_specific_data();
#endif
+#if defined(ENABLE_AC3_EAC3_AUDIO_DEMUXING)
+ } else if (audio_type == kAC3) {
+ codec = kCodecAC3;
+ channel_layout = GuessChannelLayout(entry.channelcount);
+ sample_per_second = entry.samplerate;
+ } else if (audio_type == kEAC3) {
+ codec = kCodecEAC3;
+ channel_layout = GuessChannelLayout(entry.channelcount);
+ sample_per_second = entry.samplerate;
+#endif
} else {
MEDIA_LOG(log_cb_) << "Unsupported audio object type 0x" << std::hex
<< audio_type << " in esds.";

Powered by Google App Engine
This is Rietveld 408576698