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

Side by Side Diff: media/filters/stream_parser_factory.cc

Issue 1539983004: Convert enable_mpeg2ts into a new-style buildflag (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Buildfix Created 4 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 unified diff | Download patch
OLDNEW
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 "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/strings/pattern.h" 9 #include "base/strings/pattern.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
11 #include "base/strings/string_split.h" 11 #include "base/strings/string_split.h"
12 #include "base/strings/string_util.h" 12 #include "base/strings/string_util.h"
13 #include "media/base/media_switches.h" 13 #include "media/base/media_switches.h"
14 #include "media/formats/mpeg/adts_stream_parser.h" 14 #include "media/formats/mpeg/adts_stream_parser.h"
15 #include "media/formats/mpeg/mpeg1_audio_stream_parser.h" 15 #include "media/formats/mpeg/mpeg1_audio_stream_parser.h"
16 #include "media/formats/webm/webm_stream_parser.h" 16 #include "media/formats/webm/webm_stream_parser.h"
17 #include "media/media_features.h"
17 18
18 #if defined(OS_ANDROID) 19 #if defined(OS_ANDROID)
19 #include "base/android/build_info.h" 20 #include "base/android/build_info.h"
20 #endif 21 #endif
21 22
22 #if defined(USE_PROPRIETARY_CODECS) 23 #if defined(USE_PROPRIETARY_CODECS)
23 #if defined(ENABLE_MPEG2TS_STREAM_PARSER) 24 #if BUILDFLAG(ENABLE_MSE_MPEG2TS_STREAM_PARSER)
24 #include "media/formats/mp2t/mp2t_stream_parser.h" 25 #include "media/formats/mp2t/mp2t_stream_parser.h"
25 #endif 26 #endif
26 #include "media/formats/mp4/es_descriptor.h" 27 #include "media/formats/mp4/es_descriptor.h"
27 #include "media/formats/mp4/mp4_stream_parser.h" 28 #include "media/formats/mp4/mp4_stream_parser.h"
28 #endif 29 #endif
29 30
30 namespace media { 31 namespace media {
31 32
32 typedef bool (*CodecIDValidatorFunction)( 33 typedef bool (*CodecIDValidatorFunction)(
33 const std::string& codecs_id, 34 const std::string& codecs_id,
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 static const CodecInfo* kAudioADTSCodecs[] = { 225 static const CodecInfo* kAudioADTSCodecs[] = {
225 &kADTSCodecInfo, 226 &kADTSCodecInfo,
226 NULL 227 NULL
227 }; 228 };
228 229
229 static StreamParser* BuildADTSParser(const std::vector<std::string>& codecs, 230 static StreamParser* BuildADTSParser(const std::vector<std::string>& codecs,
230 const scoped_refptr<MediaLog>& media_log) { 231 const scoped_refptr<MediaLog>& media_log) {
231 return new ADTSStreamParser(); 232 return new ADTSStreamParser();
232 } 233 }
233 234
234 #if defined(ENABLE_MPEG2TS_STREAM_PARSER) 235 #if BUILDFLAG(ENABLE_MSE_MPEG2TS_STREAM_PARSER)
235 static const CodecInfo* kVideoMP2TCodecs[] = { 236 static const CodecInfo* kVideoMP2TCodecs[] = {
236 &kH264AVC1CodecInfo, 237 &kH264AVC1CodecInfo,
237 &kH264AVC3CodecInfo, 238 &kH264AVC3CodecInfo,
238 &kMPEG4AACCodecInfo, 239 &kMPEG4AACCodecInfo,
239 &kMPEG2AACLCCodecInfo, 240 &kMPEG2AACLCCodecInfo,
240 NULL 241 NULL
241 }; 242 };
242 243
243 static StreamParser* BuildMP2TParser(const std::vector<std::string>& codecs, 244 static StreamParser* BuildMP2TParser(const std::vector<std::string>& codecs,
244 const scoped_refptr<MediaLog>& media_log) { 245 const scoped_refptr<MediaLog>& media_log) {
245 bool has_sbr = false; 246 bool has_sbr = false;
246 for (size_t i = 0; i < codecs.size(); ++i) { 247 for (size_t i = 0; i < codecs.size(); ++i) {
247 std::string codec_id = codecs[i]; 248 std::string codec_id = codecs[i];
248 if (base::MatchPattern(codec_id, kMPEG4AACCodecInfo.pattern)) { 249 if (base::MatchPattern(codec_id, kMPEG4AACCodecInfo.pattern)) {
249 int audio_object_type = GetMP4AudioObjectType(codec_id, media_log); 250 int audio_object_type = GetMP4AudioObjectType(codec_id, media_log);
250 if (audio_object_type == kAACSBRObjectType || 251 if (audio_object_type == kAACSBRObjectType ||
251 audio_object_type == kAACPSObjectType) { 252 audio_object_type == kAACPSObjectType) {
252 has_sbr = true; 253 has_sbr = true;
253 } 254 }
254 } 255 }
255 } 256 }
256 257
257 return new media::mp2t::Mp2tStreamParser(has_sbr); 258 return new media::mp2t::Mp2tStreamParser(has_sbr);
258 } 259 }
259 #endif 260 #endif
260 #endif 261 #endif
261 262
262
263 static const SupportedTypeInfo kSupportedTypeInfo[] = { 263 static const SupportedTypeInfo kSupportedTypeInfo[] = {
264 { "video/webm", &BuildWebMParser, kVideoWebMCodecs }, 264 {"video/webm", &BuildWebMParser, kVideoWebMCodecs},
265 { "audio/webm", &BuildWebMParser, kAudioWebMCodecs }, 265 {"audio/webm", &BuildWebMParser, kAudioWebMCodecs},
266 #if defined(USE_PROPRIETARY_CODECS) 266 #if defined(USE_PROPRIETARY_CODECS)
267 { "audio/aac", &BuildADTSParser, kAudioADTSCodecs }, 267 {"audio/aac", &BuildADTSParser, kAudioADTSCodecs},
268 { "audio/mpeg", &BuildMP3Parser, kAudioMP3Codecs }, 268 {"audio/mpeg", &BuildMP3Parser, kAudioMP3Codecs},
269 { "video/mp4", &BuildMP4Parser, kVideoMP4Codecs }, 269 {"video/mp4", &BuildMP4Parser, kVideoMP4Codecs},
270 { "audio/mp4", &BuildMP4Parser, kAudioMP4Codecs }, 270 {"audio/mp4", &BuildMP4Parser, kAudioMP4Codecs},
271 #if defined(ENABLE_MPEG2TS_STREAM_PARSER) 271 #if BUILDFLAG(ENABLE_MSE_MPEG2TS_STREAM_PARSER)
272 { "video/mp2t", &BuildMP2TParser, kVideoMP2TCodecs }, 272 {"video/mp2t", &BuildMP2TParser, kVideoMP2TCodecs},
273 #endif 273 #endif
274 #endif 274 #endif
275 }; 275 };
276 276
277 // Verify that |codec_info| is supported on this platform. 277 // Verify that |codec_info| is supported on this platform.
278 // 278 //
279 // Returns true if |codec_info| is a valid audio/video codec and is allowed. 279 // Returns true if |codec_info| is a valid audio/video codec and is allowed.
280 // |audio_codecs| has |codec_info|.tag added to its list if |codec_info| is an 280 // |audio_codecs| has |codec_info|.tag added to its list if |codec_info| is an
281 // audio codec. |audio_codecs| may be NULL, in which case it is not updated. 281 // audio codec. |audio_codecs| may be NULL, in which case it is not updated.
282 // |video_codecs| has |codec_info|.tag added to its list if |codec_info| is a 282 // |video_codecs| has |codec_info|.tag added to its list if |codec_info| is a
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 CodecInfo::HISTOGRAM_MAX + 1); 428 CodecInfo::HISTOGRAM_MAX + 1);
429 } 429 }
430 430
431 stream_parser.reset(factory_function(codecs, media_log)); 431 stream_parser.reset(factory_function(codecs, media_log));
432 } 432 }
433 433
434 return stream_parser.Pass(); 434 return stream_parser.Pass();
435 } 435 }
436 436
437 } // namespace media 437 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/chunk_demuxer_unittest.cc ('k') | media/media.gyp » ('j') | media/media.gyp » ('J')

Powered by Google App Engine
This is Rietveld 408576698