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" |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
291 &kADTSCodecInfo, | 291 &kADTSCodecInfo, |
292 NULL | 292 NULL |
293 }; | 293 }; |
294 | 294 |
295 static StreamParser* BuildADTSParser(const std::vector<std::string>& codecs, | 295 static StreamParser* BuildADTSParser(const std::vector<std::string>& codecs, |
296 const scoped_refptr<MediaLog>& media_log) { | 296 const scoped_refptr<MediaLog>& media_log) { |
297 return new ADTSStreamParser(); | 297 return new ADTSStreamParser(); |
298 } | 298 } |
299 | 299 |
300 #if BUILDFLAG(ENABLE_MSE_MPEG2TS_STREAM_PARSER) | 300 #if BUILDFLAG(ENABLE_MSE_MPEG2TS_STREAM_PARSER) |
301 static const CodecInfo kMPEG2TS_MP3CodecInfo = {"mp3", CodecInfo::AUDIO, NULL, | |
wolenetz
2017/03/23 20:17:39
NOT LGTM until resolved:
Is "mp3" standardized as
servolk
2017/03/23 23:24:59
Ah, ok, as we've discussed offline, you are right
| |
302 CodecInfo::HISTOGRAM_MP3}; | |
303 | |
301 static const CodecInfo* kVideoMP2TCodecs[] = { | 304 static const CodecInfo* kVideoMP2TCodecs[] = { |
302 &kH264AVC1CodecInfo, | 305 &kH264AVC1CodecInfo, &kH264AVC3CodecInfo, &kMPEG2TS_MP3CodecInfo, |
303 &kH264AVC3CodecInfo, | 306 &kMPEG4AACCodecInfo, &kMPEG2AACLCCodecInfo, NULL}; |
304 &kMPEG4AACCodecInfo, | |
305 &kMPEG2AACLCCodecInfo, | |
306 NULL | |
307 }; | |
308 | 307 |
309 static StreamParser* BuildMP2TParser(const std::vector<std::string>& codecs, | 308 static StreamParser* BuildMP2TParser(const std::vector<std::string>& codecs, |
310 const scoped_refptr<MediaLog>& media_log) { | 309 const scoped_refptr<MediaLog>& media_log) { |
311 bool has_sbr = false; | 310 bool has_sbr = false; |
312 for (size_t i = 0; i < codecs.size(); ++i) { | 311 for (size_t i = 0; i < codecs.size(); ++i) { |
313 std::string codec_id = codecs[i]; | 312 std::string codec_id = codecs[i]; |
314 if (base::MatchPattern(codec_id, kMPEG4AACCodecInfo.pattern)) { | 313 if (base::MatchPattern(codec_id, kMPEG4AACCodecInfo.pattern)) { |
315 int audio_object_type = GetMP4AudioObjectType(codec_id, media_log); | 314 int audio_object_type = GetMP4AudioObjectType(codec_id, media_log); |
316 if (audio_object_type == kAACSBRObjectType || | 315 if (audio_object_type == kAACSBRObjectType || |
317 audio_object_type == kAACPSObjectType) { | 316 audio_object_type == kAACPSObjectType) { |
318 has_sbr = true; | 317 has_sbr = true; |
319 } | 318 } |
320 } | 319 } |
321 } | 320 } |
322 | 321 |
323 return new media::mp2t::Mp2tStreamParser(has_sbr); | 322 return new media::mp2t::Mp2tStreamParser(has_sbr); |
324 } | 323 } |
325 #endif | 324 #endif |
326 #endif | 325 #endif |
327 | 326 |
328 static const SupportedTypeInfo kSupportedTypeInfo[] = { | 327 static const SupportedTypeInfo kSupportedTypeInfo[] = { |
329 {"video/webm", &BuildWebMParser, kVideoWebMCodecs}, | 328 {"video/webm", &BuildWebMParser, kVideoWebMCodecs}, |
330 {"audio/webm", &BuildWebMParser, kAudioWebMCodecs}, | 329 {"audio/webm", &BuildWebMParser, kAudioWebMCodecs}, |
331 #if BUILDFLAG(USE_PROPRIETARY_CODECS) | 330 #if BUILDFLAG(USE_PROPRIETARY_CODECS) |
332 {"audio/aac", &BuildADTSParser, kAudioADTSCodecs}, | 331 {"audio/aac", &BuildADTSParser, kAudioADTSCodecs}, |
333 {"audio/mpeg", &BuildMP3Parser, kAudioMP3Codecs}, | 332 {"audio/mpeg", &BuildMP3Parser, kAudioMP3Codecs}, |
334 {"video/mp4", &BuildMP4Parser, kVideoMP4Codecs}, | 333 {"video/mp4", &BuildMP4Parser, kVideoMP4Codecs}, |
335 {"audio/mp4", &BuildMP4Parser, kAudioMP4Codecs}, | 334 {"audio/mp4", &BuildMP4Parser, kAudioMP4Codecs}, |
336 #if BUILDFLAG(ENABLE_MSE_MPEG2TS_STREAM_PARSER) | 335 #if BUILDFLAG(ENABLE_MSE_MPEG2TS_STREAM_PARSER) |
337 {"video/mp2t", &BuildMP2TParser, kVideoMP2TCodecs}, | 336 {"video/mp2t", &BuildMP2TParser, kVideoMP2TCodecs}, |
wolenetz
2017/03/23 21:35:52
also nit/aside query: why no audio/mp2t?
servolk
2017/03/23 23:24:59
TBH, I don't know, that code was added by damienv@
wolenetz
2017/03/24 17:34:25
I was just curious. Since this is Chromecast speci
servolk
2017/03/27 20:10:39
Acknowledged.
| |
338 #endif | 337 #endif |
339 #endif | 338 #endif |
340 }; | 339 }; |
341 | 340 |
342 // Verify that |codec_info| is supported on this platform. | 341 // Verify that |codec_info| is supported on this platform. |
343 // | 342 // |
344 // Returns true if |codec_info| is a valid audio/video codec and is allowed. | 343 // Returns true if |codec_info| is a valid audio/video codec and is allowed. |
345 // |audio_codecs| has |codec_info|.tag added to its list if |codec_info| is an | 344 // |audio_codecs| has |codec_info|.tag added to its list if |codec_info| is an |
346 // audio codec. |audio_codecs| may be NULL, in which case it is not updated. | 345 // audio codec. |audio_codecs| may be NULL, in which case it is not updated. |
347 // |video_codecs| has |codec_info|.tag added to its list if |codec_info| is a | 346 // |video_codecs| has |codec_info|.tag added to its list if |codec_info| is a |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
482 CodecInfo::HISTOGRAM_MAX + 1); | 481 CodecInfo::HISTOGRAM_MAX + 1); |
483 } | 482 } |
484 | 483 |
485 stream_parser.reset(factory_function(codecs, media_log)); | 484 stream_parser.reset(factory_function(codecs, media_log)); |
486 } | 485 } |
487 | 486 |
488 return stream_parser; | 487 return stream_parser; |
489 } | 488 } |
490 | 489 |
491 } // namespace media | 490 } // namespace media |
OLD | NEW |