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

Side by Side Diff: media/formats/mp4/mp4_stream_parser.cc

Issue 2472823002: DO NOT LAND - Hacked MSE mp3 support, assuming addSourceBuffer /mp4; codecs="mp4a.40.2" (Closed)
Patch Set: Created 4 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « media/filters/source_buffer_state.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/formats/mp4/mp4_stream_parser.h" 5 #include "media/formats/mp4/mp4_stream_parser.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <limits> 9 #include <limits>
10 #include <memory> 10 #include <memory>
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 238
239 #if BUILDFLAG(ENABLE_AC3_EAC3_AUDIO_DEMUXING) 239 #if BUILDFLAG(ENABLE_AC3_EAC3_AUDIO_DEMUXING)
240 if (audio_format != FOURCC_MP4A && audio_format != FOURCC_AC3 && 240 if (audio_format != FOURCC_MP4A && audio_format != FOURCC_AC3 &&
241 audio_format != FOURCC_EAC3) { 241 audio_format != FOURCC_EAC3) {
242 #else 242 #else
243 if (audio_format != FOURCC_MP4A) { 243 if (audio_format != FOURCC_MP4A) {
244 #endif 244 #endif
245 MEDIA_LOG(ERROR, media_log_) << "Unsupported audio format 0x" 245 MEDIA_LOG(ERROR, media_log_) << "Unsupported audio format 0x"
246 << std::hex << entry.format 246 << std::hex << entry.format
247 << " in stsd box."; 247 << " in stsd box.";
248 return false; 248 // BIG TODO remove comment
249 // return false;
249 } 250 }
250 251
251 uint8_t audio_type = entry.esds.object_type; 252 uint8_t audio_type = entry.esds.object_type;
252 #if BUILDFLAG(ENABLE_AC3_EAC3_AUDIO_DEMUXING) 253 #if BUILDFLAG(ENABLE_AC3_EAC3_AUDIO_DEMUXING)
253 if (audio_type == kForbidden) { 254 if (audio_type == kForbidden) {
254 if (audio_format == FOURCC_AC3) 255 if (audio_format == FOURCC_AC3)
255 audio_type = kAC3; 256 audio_type = kAC3;
256 if (audio_format == FOURCC_EAC3) 257 if (audio_format == FOURCC_EAC3)
257 audio_type = kEAC3; 258 audio_type = kEAC3;
258 } 259 }
259 #endif 260 #endif
260 DVLOG(1) << "audio_type 0x" << std::hex << static_cast<int>(audio_type); 261 DVLOG(1) << "audio_type 0x" << std::hex << static_cast<int>(audio_type);
261 if (audio_object_types_.find(audio_type) == audio_object_types_.end()) { 262 if (audio_object_types_.find(audio_type) == audio_object_types_.end()) {
262 MEDIA_LOG(ERROR, media_log_) 263 MEDIA_LOG(ERROR, media_log_)
263 << "audio object type 0x" << std::hex 264 << "audio object type 0x" << std::hex
264 << static_cast<int>(audio_type) 265 << static_cast<int>(audio_type)
265 << " does not match what is specified in the mimetype."; 266 << " does not match what is specified in the mimetype.";
266 return false; 267 // BIG TODO remove comment
268 // return false;
267 } 269 }
268 270
269 AudioCodec codec = kUnknownAudioCodec; 271 AudioCodec codec = kUnknownAudioCodec;
270 ChannelLayout channel_layout = CHANNEL_LAYOUT_NONE; 272 ChannelLayout channel_layout = CHANNEL_LAYOUT_NONE;
271 int sample_per_second = 0; 273 int sample_per_second = 0;
272 std::vector<uint8_t> extra_data; 274 std::vector<uint8_t> extra_data;
273 // Check if it is MPEG4 AAC defined in ISO 14496 Part 3 or 275 // Check if it is MPEG4 AAC defined in ISO 14496 Part 3 or
274 // supported MPEG2 AAC varients. 276 // supported MPEG2 AAC varients.
275 if (ESDescriptor::IsAAC(audio_type)) { 277 if (ESDescriptor::IsAAC(audio_type)) {
276 codec = kCodecAAC; 278 codec = kCodecAAC;
277 channel_layout = aac.GetChannelLayout(has_sbr_); 279 channel_layout = aac.GetChannelLayout(has_sbr_);
278 sample_per_second = aac.GetOutputSamplesPerSecond(has_sbr_); 280 sample_per_second = aac.GetOutputSamplesPerSecond(has_sbr_);
279 #if defined(OS_ANDROID) 281 #if defined(OS_ANDROID)
280 extra_data = aac.codec_specific_data(); 282 extra_data = aac.codec_specific_data();
281 #endif 283 #endif
282 #if BUILDFLAG(ENABLE_AC3_EAC3_AUDIO_DEMUXING) 284 #if BUILDFLAG(ENABLE_AC3_EAC3_AUDIO_DEMUXING)
283 } else if (audio_type == kAC3) { 285 } else if (audio_type == kAC3) {
284 codec = kCodecAC3; 286 codec = kCodecAC3;
285 channel_layout = GuessChannelLayout(entry.channelcount); 287 channel_layout = GuessChannelLayout(entry.channelcount);
286 sample_per_second = entry.samplerate; 288 sample_per_second = entry.samplerate;
287 } else if (audio_type == kEAC3) { 289 } else if (audio_type == kEAC3) {
288 codec = kCodecEAC3; 290 codec = kCodecEAC3;
289 channel_layout = GuessChannelLayout(entry.channelcount); 291 channel_layout = GuessChannelLayout(entry.channelcount);
290 sample_per_second = entry.samplerate; 292 sample_per_second = entry.samplerate;
291 #endif 293 #endif
292 } else { 294 } else {
293 MEDIA_LOG(ERROR, media_log_) << "Unsupported audio object type 0x" 295 MEDIA_LOG(ERROR, media_log_) << "Unsupported audio object type 0x"
294 << std::hex << static_cast<int>(audio_type) 296 << std::hex << static_cast<int>(audio_type)
295 << " in esds."; 297 << " in esds.";
296 return false; 298 // BIG TODO undo this...
299 codec = kCodecMP3;
300 channel_layout = GuessChannelLayout(entry.channelcount);
301 sample_per_second = entry.samplerate;
302
303 // return false;
297 } 304 }
298 305
299 SampleFormat sample_format; 306 SampleFormat sample_format;
300 if (entry.samplesize == 8) { 307 if (entry.samplesize == 8) {
301 sample_format = kSampleFormatU8; 308 sample_format = kSampleFormatU8;
302 } else if (entry.samplesize == 16) { 309 } else if (entry.samplesize == 16) {
303 sample_format = kSampleFormatS16; 310 sample_format = kSampleFormatS16;
304 } else if (entry.samplesize == 32) { 311 } else if (entry.samplesize == 32) {
305 sample_format = kSampleFormatS32; 312 sample_format = kSampleFormatS32;
306 } else { 313 } else {
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 runs.AdvanceSample(); 738 runs.AdvanceSample();
732 } 739 }
733 runs.AdvanceRun(); 740 runs.AdvanceRun();
734 } 741 }
735 742
736 return true; 743 return true;
737 } 744 }
738 745
739 } // namespace mp4 746 } // namespace mp4
740 } // namespace media 747 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/source_buffer_state.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698