| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/filters/stream_parser_factory.h" | 5 #include "media/filters/stream_parser_factory.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/metrics/histogram_macros.h" | 11 #include "base/metrics/histogram_macros.h" |
| 12 #include "base/strings/pattern.h" | 12 #include "base/strings/pattern.h" |
| 13 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
| 14 #include "base/strings/string_split.h" | 14 #include "base/strings/string_split.h" |
| 15 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
| 16 #include "build/build_config.h" | 16 #include "build/build_config.h" |
| 17 #include "media/base/media.h" | 17 #include "media/base/media.h" |
| 18 #include "media/base/media_switches.h" | 18 #include "media/base/media_switches.h" |
| 19 #include "media/formats/mpeg/adts_stream_parser.h" | 19 #include "media/formats/mpeg/adts_stream_parser.h" |
| 20 #include "media/formats/mpeg/mpeg1_audio_stream_parser.h" | 20 #include "media/formats/mpeg/mpeg1_audio_stream_parser.h" |
| 21 #include "media/formats/webm/webm_stream_parser.h" | 21 #include "media/formats/webm/webm_stream_parser.h" |
| 22 #include "media/media_features.h" | 22 #include "media/media_features.h" |
| 23 | 23 |
| 24 #if defined(OS_ANDROID) | 24 #if defined(OS_ANDROID) |
| 25 #include "media/base/android/media_codec_util.h" | 25 #include "media/base/android/media_codec_util.h" |
| 26 #endif | 26 #endif |
| 27 | 27 |
| 28 #if defined(USE_PROPRIETARY_CODECS) | 28 #if BUILDFLAG(USE_PROPRIETARY_CODECS) |
| 29 #if BUILDFLAG(ENABLE_MSE_MPEG2TS_STREAM_PARSER) | 29 #if BUILDFLAG(ENABLE_MSE_MPEG2TS_STREAM_PARSER) |
| 30 #include "media/formats/mp2t/mp2t_stream_parser.h" | 30 #include "media/formats/mp2t/mp2t_stream_parser.h" |
| 31 #endif | 31 #endif |
| 32 #include "media/formats/mp4/es_descriptor.h" | 32 #include "media/formats/mp4/es_descriptor.h" |
| 33 #include "media/formats/mp4/mp4_stream_parser.h" | 33 #include "media/formats/mp4/mp4_stream_parser.h" |
| 34 #endif | 34 #endif |
| 35 | 35 |
| 36 namespace media { | 36 namespace media { |
| 37 | 37 |
| 38 typedef bool (*CodecIDValidatorFunction)( | 38 typedef bool (*CodecIDValidatorFunction)( |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 &kVorbisCodecInfo, | 100 &kVorbisCodecInfo, |
| 101 &kOpusCodecInfo, | 101 &kOpusCodecInfo, |
| 102 NULL | 102 NULL |
| 103 }; | 103 }; |
| 104 | 104 |
| 105 static StreamParser* BuildWebMParser(const std::vector<std::string>& codecs, | 105 static StreamParser* BuildWebMParser(const std::vector<std::string>& codecs, |
| 106 const scoped_refptr<MediaLog>& media_log) { | 106 const scoped_refptr<MediaLog>& media_log) { |
| 107 return new WebMStreamParser(); | 107 return new WebMStreamParser(); |
| 108 } | 108 } |
| 109 | 109 |
| 110 #if defined(USE_PROPRIETARY_CODECS) | 110 #if BUILDFLAG(USE_PROPRIETARY_CODECS) |
| 111 bool CheckIfMp4Vp9DemuxingEnabled(const std::string& codec_id, | 111 bool CheckIfMp4Vp9DemuxingEnabled(const std::string& codec_id, |
| 112 const scoped_refptr<MediaLog>& media_log) { | 112 const scoped_refptr<MediaLog>& media_log) { |
| 113 return base::CommandLine::ForCurrentProcess()->HasSwitch( | 113 return base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 114 switches::kEnableVp9InMp4); | 114 switches::kEnableVp9InMp4); |
| 115 } | 115 } |
| 116 | 116 |
| 117 // AAC Object Type IDs that Chrome supports. | 117 // AAC Object Type IDs that Chrome supports. |
| 118 static const int kAACLCObjectType = 2; | 118 static const int kAACLCObjectType = 2; |
| 119 static const int kAACSBRObjectType = 5; | 119 static const int kAACSBRObjectType = 5; |
| 120 static const int kAACPSObjectType = 29; | 120 static const int kAACPSObjectType = 29; |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 } | 303 } |
| 304 | 304 |
| 305 return new media::mp2t::Mp2tStreamParser(has_sbr); | 305 return new media::mp2t::Mp2tStreamParser(has_sbr); |
| 306 } | 306 } |
| 307 #endif | 307 #endif |
| 308 #endif | 308 #endif |
| 309 | 309 |
| 310 static const SupportedTypeInfo kSupportedTypeInfo[] = { | 310 static const SupportedTypeInfo kSupportedTypeInfo[] = { |
| 311 {"video/webm", &BuildWebMParser, kVideoWebMCodecs}, | 311 {"video/webm", &BuildWebMParser, kVideoWebMCodecs}, |
| 312 {"audio/webm", &BuildWebMParser, kAudioWebMCodecs}, | 312 {"audio/webm", &BuildWebMParser, kAudioWebMCodecs}, |
| 313 #if defined(USE_PROPRIETARY_CODECS) | 313 #if BUILDFLAG(USE_PROPRIETARY_CODECS) |
| 314 {"audio/aac", &BuildADTSParser, kAudioADTSCodecs}, | 314 {"audio/aac", &BuildADTSParser, kAudioADTSCodecs}, |
| 315 {"audio/mpeg", &BuildMP3Parser, kAudioMP3Codecs}, | 315 {"audio/mpeg", &BuildMP3Parser, kAudioMP3Codecs}, |
| 316 {"video/mp4", &BuildMP4Parser, kVideoMP4Codecs}, | 316 {"video/mp4", &BuildMP4Parser, kVideoMP4Codecs}, |
| 317 {"audio/mp4", &BuildMP4Parser, kAudioMP4Codecs}, | 317 {"audio/mp4", &BuildMP4Parser, kAudioMP4Codecs}, |
| 318 #if BUILDFLAG(ENABLE_MSE_MPEG2TS_STREAM_PARSER) | 318 #if BUILDFLAG(ENABLE_MSE_MPEG2TS_STREAM_PARSER) |
| 319 {"video/mp2t", &BuildMP2TParser, kVideoMP2TCodecs}, | 319 {"video/mp2t", &BuildMP2TParser, kVideoMP2TCodecs}, |
| 320 #endif | 320 #endif |
| 321 #endif | 321 #endif |
| 322 }; | 322 }; |
| 323 | 323 |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 CodecInfo::HISTOGRAM_MAX + 1); | 464 CodecInfo::HISTOGRAM_MAX + 1); |
| 465 } | 465 } |
| 466 | 466 |
| 467 stream_parser.reset(factory_function(codecs, media_log)); | 467 stream_parser.reset(factory_function(codecs, media_log)); |
| 468 } | 468 } |
| 469 | 469 |
| 470 return stream_parser; | 470 return stream_parser; |
| 471 } | 471 } |
| 472 | 472 |
| 473 } // namespace media | 473 } // namespace media |
| OLD | NEW |