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 "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/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
43 HISTOGRAM_UNKNOWN, | 43 HISTOGRAM_UNKNOWN, |
44 HISTOGRAM_VP8, | 44 HISTOGRAM_VP8, |
45 HISTOGRAM_VP9, | 45 HISTOGRAM_VP9, |
46 HISTOGRAM_VORBIS, | 46 HISTOGRAM_VORBIS, |
47 HISTOGRAM_H264, | 47 HISTOGRAM_H264, |
48 HISTOGRAM_MPEG2AAC, | 48 HISTOGRAM_MPEG2AAC, |
49 HISTOGRAM_MPEG4AAC, | 49 HISTOGRAM_MPEG4AAC, |
50 HISTOGRAM_EAC3, | 50 HISTOGRAM_EAC3, |
51 HISTOGRAM_MP3, | 51 HISTOGRAM_MP3, |
52 HISTOGRAM_OPUS, | 52 HISTOGRAM_OPUS, |
53 HISTOGRAM_MAX = HISTOGRAM_OPUS // Must be equal to largest logged entry. | 53 HISTOGRAM_HEVC, |
54 HISTOGRAM_MAX = HISTOGRAM_HEVC // Must be equal to largest logged entry. | |
54 }; | 55 }; |
55 | 56 |
56 const char* pattern; | 57 const char* pattern; |
57 Type type; | 58 Type type; |
58 CodecIDValidatorFunction validator; | 59 CodecIDValidatorFunction validator; |
59 HistogramTag tag; | 60 HistogramTag tag; |
60 }; | 61 }; |
61 | 62 |
62 typedef StreamParser* (*ParserFactoryFunction)( | 63 typedef StreamParser* (*ParserFactoryFunction)( |
63 const std::vector<std::string>& codecs, | 64 const std::vector<std::string>& codecs, |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
137 | 138 |
138 MEDIA_LOG(log_cb) << "Unsupported audio object type " << audio_object_type | 139 MEDIA_LOG(log_cb) << "Unsupported audio object type " << audio_object_type |
139 << " in codec '" << codec_id << "'"; | 140 << " in codec '" << codec_id << "'"; |
140 return false; | 141 return false; |
141 } | 142 } |
142 | 143 |
143 static const CodecInfo kH264AVC1CodecInfo = { "avc1.*", CodecInfo::VIDEO, NULL, | 144 static const CodecInfo kH264AVC1CodecInfo = { "avc1.*", CodecInfo::VIDEO, NULL, |
144 CodecInfo::HISTOGRAM_H264 }; | 145 CodecInfo::HISTOGRAM_H264 }; |
145 static const CodecInfo kH264AVC3CodecInfo = { "avc3.*", CodecInfo::VIDEO, NULL, | 146 static const CodecInfo kH264AVC3CodecInfo = { "avc3.*", CodecInfo::VIDEO, NULL, |
146 CodecInfo::HISTOGRAM_H264 }; | 147 CodecInfo::HISTOGRAM_H264 }; |
148 #if defined(ENABLE_HEVC_DEMUXING) | |
149 static const CodecInfo kHEVCHEV1CodecInfo = { "hev1", CodecInfo::VIDEO, NULL, | |
ddorwin
2015/02/24 18:07:32
Please don't support the extensionless versions. W
servolk
2015/03/12 19:44:15
Done.
| |
150 CodecInfo::HISTOGRAM_HEVC }; | |
151 static const CodecInfo kHEVCHEV1CodecInfo2 = { "hev1.*", CodecInfo::VIDEO, NULL, | |
152 CodecInfo::HISTOGRAM_HEVC }; | |
153 static const CodecInfo kHEVCHVC1CodecInfo = { "hvc1", CodecInfo::VIDEO, NULL, | |
154 CodecInfo::HISTOGRAM_HEVC }; | |
155 static const CodecInfo kHEVCHVC1CodecInfo2 = { "hvc1.*", CodecInfo::VIDEO, NULL, | |
156 CodecInfo::HISTOGRAM_HEVC }; | |
157 #endif | |
147 static const CodecInfo kMPEG4AACCodecInfo = { "mp4a.40.*", CodecInfo::AUDIO, | 158 static const CodecInfo kMPEG4AACCodecInfo = { "mp4a.40.*", CodecInfo::AUDIO, |
148 &ValidateMP4ACodecID, | 159 &ValidateMP4ACodecID, |
149 CodecInfo::HISTOGRAM_MPEG4AAC }; | 160 CodecInfo::HISTOGRAM_MPEG4AAC }; |
150 static const CodecInfo kMPEG2AACLCCodecInfo = { "mp4a.67", CodecInfo::AUDIO, | 161 static const CodecInfo kMPEG2AACLCCodecInfo = { "mp4a.67", CodecInfo::AUDIO, |
151 NULL, | 162 NULL, |
152 CodecInfo::HISTOGRAM_MPEG2AAC }; | 163 CodecInfo::HISTOGRAM_MPEG2AAC }; |
153 | 164 |
154 static const CodecInfo* kVideoMP4Codecs[] = { | 165 static const CodecInfo* kVideoMP4Codecs[] = { |
155 &kH264AVC1CodecInfo, | 166 &kH264AVC1CodecInfo, |
156 &kH264AVC3CodecInfo, | 167 &kH264AVC3CodecInfo, |
168 #if defined(ENABLE_HEVC_DEMUXING) | |
169 &kHEVCHEV1CodecInfo, | |
170 &kHEVCHEV1CodecInfo2, | |
171 &kHEVCHVC1CodecInfo, | |
172 &kHEVCHVC1CodecInfo2, | |
173 #endif | |
157 &kMPEG4AACCodecInfo, | 174 &kMPEG4AACCodecInfo, |
158 &kMPEG2AACLCCodecInfo, | 175 &kMPEG2AACLCCodecInfo, |
159 NULL | 176 NULL |
160 }; | 177 }; |
161 | 178 |
162 static const CodecInfo* kAudioMP4Codecs[] = { | 179 static const CodecInfo* kAudioMP4Codecs[] = { |
163 &kMPEG4AACCodecInfo, | 180 &kMPEG4AACCodecInfo, |
164 &kMPEG2AACLCCodecInfo, | 181 &kMPEG2AACLCCodecInfo, |
165 NULL | 182 NULL |
166 }; | 183 }; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
213 | 230 |
214 static StreamParser* BuildADTSParser( | 231 static StreamParser* BuildADTSParser( |
215 const std::vector<std::string>& codecs, const LogCB& log_cb) { | 232 const std::vector<std::string>& codecs, const LogCB& log_cb) { |
216 return new ADTSStreamParser(); | 233 return new ADTSStreamParser(); |
217 } | 234 } |
218 | 235 |
219 #if defined(ENABLE_MPEG2TS_STREAM_PARSER) | 236 #if defined(ENABLE_MPEG2TS_STREAM_PARSER) |
220 static const CodecInfo* kVideoMP2TCodecs[] = { | 237 static const CodecInfo* kVideoMP2TCodecs[] = { |
221 &kH264AVC1CodecInfo, | 238 &kH264AVC1CodecInfo, |
222 &kH264AVC3CodecInfo, | 239 &kH264AVC3CodecInfo, |
240 #if defined(ENABLE_HEVC_DEMUXING) | |
241 // TODO(servolk): implement ES parser for HEVC in mpeg2ts container | |
242 //&kHEVCHEV1CodecInfo, | |
243 //&kHEVCHVC1CodecInfo, | |
244 #endif | |
223 &kMPEG4AACCodecInfo, | 245 &kMPEG4AACCodecInfo, |
224 &kMPEG2AACLCCodecInfo, | 246 &kMPEG2AACLCCodecInfo, |
225 NULL | 247 NULL |
226 }; | 248 }; |
227 | 249 |
228 static StreamParser* BuildMP2TParser( | 250 static StreamParser* BuildMP2TParser( |
229 const std::vector<std::string>& codecs, const media::LogCB& log_cb) { | 251 const std::vector<std::string>& codecs, const media::LogCB& log_cb) { |
230 bool has_sbr = false; | 252 bool has_sbr = false; |
231 for (size_t i = 0; i < codecs.size(); ++i) { | 253 for (size_t i = 0; i < codecs.size(); ++i) { |
232 std::string codec_id = codecs[i]; | 254 std::string codec_id = codecs[i]; |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
412 CodecInfo::HISTOGRAM_MAX + 1); | 434 CodecInfo::HISTOGRAM_MAX + 1); |
413 } | 435 } |
414 | 436 |
415 stream_parser.reset(factory_function(codecs, log_cb)); | 437 stream_parser.reset(factory_function(codecs, log_cb)); |
416 } | 438 } |
417 | 439 |
418 return stream_parser.Pass(); | 440 return stream_parser.Pass(); |
419 } | 441 } |
420 | 442 |
421 } // namespace media | 443 } // namespace media |
OLD | NEW |