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

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

Issue 816353010: Implemented HEVC video demuxing and parsing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added hevc handling in media/base/android/media_codec_bridge.cc Created 5 years, 9 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/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
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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 audio_object_type == kAACSBRObjectType || 134 audio_object_type == kAACSBRObjectType ||
134 audio_object_type == kAACPSObjectType) { 135 audio_object_type == kAACPSObjectType) {
135 return true; 136 return true;
136 } 137 }
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,
ddorwin 2015/03/25 01:21:59 wolenetz: Do we check these against mime_util to m
servolk 2015/03/25 02:20:20 Unfortunately we don't at the moment. I think we n
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,
150 CodecInfo::HISTOGRAM_HEVC };
151 static const CodecInfo kHEVCHVC1CodecInfo = { "hvc1.*", CodecInfo::VIDEO, NULL,
152 CodecInfo::HISTOGRAM_HEVC };
153 #endif
147 static const CodecInfo kMPEG4AACCodecInfo = { "mp4a.40.*", CodecInfo::AUDIO, 154 static const CodecInfo kMPEG4AACCodecInfo = { "mp4a.40.*", CodecInfo::AUDIO,
148 &ValidateMP4ACodecID, 155 &ValidateMP4ACodecID,
149 CodecInfo::HISTOGRAM_MPEG4AAC }; 156 CodecInfo::HISTOGRAM_MPEG4AAC };
150 static const CodecInfo kMPEG2AACLCCodecInfo = { "mp4a.67", CodecInfo::AUDIO, 157 static const CodecInfo kMPEG2AACLCCodecInfo = { "mp4a.67", CodecInfo::AUDIO,
151 NULL, 158 NULL,
152 CodecInfo::HISTOGRAM_MPEG2AAC }; 159 CodecInfo::HISTOGRAM_MPEG2AAC };
153 160
154 static const CodecInfo* kVideoMP4Codecs[] = { 161 static const CodecInfo* kVideoMP4Codecs[] = {
155 &kH264AVC1CodecInfo, 162 &kH264AVC1CodecInfo,
156 &kH264AVC3CodecInfo, 163 &kH264AVC3CodecInfo,
164 #if defined(ENABLE_HEVC_DEMUXING)
165 &kHEVCHEV1CodecInfo,
166 &kHEVCHVC1CodecInfo,
167 #endif
157 &kMPEG4AACCodecInfo, 168 &kMPEG4AACCodecInfo,
158 &kMPEG2AACLCCodecInfo, 169 &kMPEG2AACLCCodecInfo,
159 NULL 170 NULL
160 }; 171 };
161 172
162 static const CodecInfo* kAudioMP4Codecs[] = { 173 static const CodecInfo* kAudioMP4Codecs[] = {
163 &kMPEG4AACCodecInfo, 174 &kMPEG4AACCodecInfo,
164 &kMPEG2AACLCCodecInfo, 175 &kMPEG2AACLCCodecInfo,
165 NULL 176 NULL
166 }; 177 };
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 224
214 static StreamParser* BuildADTSParser( 225 static StreamParser* BuildADTSParser(
215 const std::vector<std::string>& codecs, const LogCB& log_cb) { 226 const std::vector<std::string>& codecs, const LogCB& log_cb) {
216 return new ADTSStreamParser(); 227 return new ADTSStreamParser();
217 } 228 }
218 229
219 #if defined(ENABLE_MPEG2TS_STREAM_PARSER) 230 #if defined(ENABLE_MPEG2TS_STREAM_PARSER)
220 static const CodecInfo* kVideoMP2TCodecs[] = { 231 static const CodecInfo* kVideoMP2TCodecs[] = {
221 &kH264AVC1CodecInfo, 232 &kH264AVC1CodecInfo,
222 &kH264AVC3CodecInfo, 233 &kH264AVC3CodecInfo,
234 #if defined(ENABLE_HEVC_DEMUXING)
235 // TODO(servolk): implement ES parser for HEVC in mpeg2ts container
236 //&kHEVCHEV1CodecInfo,
237 //&kHEVCHVC1CodecInfo,
238 #endif
223 &kMPEG4AACCodecInfo, 239 &kMPEG4AACCodecInfo,
224 &kMPEG2AACLCCodecInfo, 240 &kMPEG2AACLCCodecInfo,
225 NULL 241 NULL
226 }; 242 };
227 243
228 static StreamParser* BuildMP2TParser( 244 static StreamParser* BuildMP2TParser(
229 const std::vector<std::string>& codecs, const media::LogCB& log_cb) { 245 const std::vector<std::string>& codecs, const media::LogCB& log_cb) {
230 bool has_sbr = false; 246 bool has_sbr = false;
231 for (size_t i = 0; i < codecs.size(); ++i) { 247 for (size_t i = 0; i < codecs.size(); ++i) {
232 std::string codec_id = codecs[i]; 248 std::string codec_id = codecs[i];
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 CodecInfo::HISTOGRAM_MAX + 1); 433 CodecInfo::HISTOGRAM_MAX + 1);
418 } 434 }
419 435
420 stream_parser.reset(factory_function(codecs, log_cb)); 436 stream_parser.reset(factory_function(codecs, log_cb));
421 } 437 }
422 438
423 return stream_parser.Pass(); 439 return stream_parser.Pass();
424 } 440 }
425 441
426 } // namespace media 442 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698