Chromium Code Reviews| 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 92 NULL | 92 NULL |
| 93 }; | 93 }; |
| 94 | 94 |
| 95 static StreamParser* BuildWebMParser( | 95 static StreamParser* BuildWebMParser( |
| 96 const std::vector<std::string>& codecs, | 96 const std::vector<std::string>& codecs, |
| 97 const LogCB& log_cb) { | 97 const LogCB& log_cb) { |
| 98 return new WebMStreamParser(); | 98 return new WebMStreamParser(); |
| 99 } | 99 } |
| 100 | 100 |
| 101 #if defined(USE_PROPRIETARY_CODECS) | 101 #if defined(USE_PROPRIETARY_CODECS) |
| 102 static const int kNullObjectType = 0; | |
| 102 // AAC Object Type IDs that Chrome supports. | 103 // AAC Object Type IDs that Chrome supports. |
| 103 static const int kAACLCObjectType = 2; | 104 static const int kAACLCObjectType = 2; |
| 104 static const int kAACSBRObjectType = 5; | 105 static const int kAACSBRObjectType = 5; |
| 105 | 106 |
| 106 static int GetMP4AudioObjectType(const std::string& codec_id, | 107 static int GetMP4AudioObjectType(const std::string& codec_id, |
| 107 const LogCB& log_cb) { | 108 const LogCB& log_cb) { |
| 108 int audio_object_type; | 109 int audio_object_type = kNullObjectType; |
| 109 std::vector<std::string> tokens; | 110 std::vector<std::string> tokens; |
| 110 if (Tokenize(codec_id, ".", &tokens) != 3 || | 111 if (Tokenize(codec_id, ".", &tokens) != 3 || |
| 111 tokens[0] != "mp4a" || tokens[1] != "40" || | 112 tokens[0] != "mp4a" || tokens[1] != "40" || |
| 112 !base::HexStringToInt(tokens[2], &audio_object_type)) { | 113 !base::HexStringToInt(tokens[2], &audio_object_type)) { |
|
Peter Kasting
2014/07/26 00:45:33
Note: You _might_ be able to get rid of the warnin
| |
| 113 MEDIA_LOG(log_cb) << "Malformed mimetype codec '" << codec_id << "'"; | 114 MEDIA_LOG(log_cb) << "Malformed mimetype codec '" << codec_id << "'"; |
| 114 return -1; | 115 return -1; |
| 115 } | 116 } |
| 116 | 117 |
| 117 | 118 |
| 118 return audio_object_type; | 119 return audio_object_type; |
| 119 } | 120 } |
| 120 | 121 |
| 121 bool ValidateMP4ACodecID(const std::string& codec_id, const LogCB& log_cb) { | 122 bool ValidateMP4ACodecID(const std::string& codec_id, const LogCB& log_cb) { |
| 122 int audio_object_type = GetMP4AudioObjectType(codec_id, log_cb); | 123 int audio_object_type = GetMP4AudioObjectType(codec_id, log_cb); |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 406 CodecInfo::HISTOGRAM_MAX + 1); | 407 CodecInfo::HISTOGRAM_MAX + 1); |
| 407 } | 408 } |
| 408 | 409 |
| 409 stream_parser.reset(factory_function(codecs, log_cb)); | 410 stream_parser.reset(factory_function(codecs, log_cb)); |
| 410 } | 411 } |
| 411 | 412 |
| 412 return stream_parser.Pass(); | 413 return stream_parser.Pass(); |
| 413 } | 414 } |
| 414 | 415 |
| 415 } // namespace media | 416 } // namespace media |
| OLD | NEW |