OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 #ifndef MEDIA_BASE_MIME_UTIL_INTERNAL_H_ | 5 #ifndef MEDIA_BASE_MIME_UTIL_INTERNAL_H_ |
6 #define MEDIA_BASE_MIME_UTIL_INTERNAL_H_ | 6 #define MEDIA_BASE_MIME_UTIL_INTERNAL_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 typedef base::hash_set<int> CodecSet; | 80 typedef base::hash_set<int> CodecSet; |
81 typedef std::map<std::string, CodecSet> MediaFormatMappings; | 81 typedef std::map<std::string, CodecSet> MediaFormatMappings; |
82 struct CodecEntry { | 82 struct CodecEntry { |
83 CodecEntry() : codec(INVALID_CODEC), is_ambiguous(true) {} | 83 CodecEntry() : codec(INVALID_CODEC), is_ambiguous(true) {} |
84 CodecEntry(Codec c, bool ambiguous) : codec(c), is_ambiguous(ambiguous) {} | 84 CodecEntry(Codec c, bool ambiguous) : codec(c), is_ambiguous(ambiguous) {} |
85 Codec codec; | 85 Codec codec; |
86 bool is_ambiguous; | 86 bool is_ambiguous; |
87 }; | 87 }; |
88 typedef std::map<std::string, CodecEntry> StringToCodecMappings; | 88 typedef std::map<std::string, CodecEntry> StringToCodecMappings; |
89 | 89 |
90 // For faster lookup, keep hash sets. | 90 // Initializes the supported media types into hash sets for faster lookup. |
91 void InitializeMimeTypeMaps(); | 91 void InitializeMimeTypeMaps(); |
92 | 92 |
| 93 // Adds |mime_type| with the specified codecs to |media_format_map_|. |
| 94 void AddContainerWithCodecs(const std::string& mime_type, |
| 95 const std::string& codecs_list); |
| 96 |
93 // Returns IsSupported if all codec IDs in |codecs| are unambiguous and are | 97 // Returns IsSupported if all codec IDs in |codecs| are unambiguous and are |
94 // supported in |mime_type_lower_case|. MayBeSupported is returned if at least | 98 // supported in |mime_type_lower_case|. MayBeSupported is returned if at least |
95 // one codec ID in |codecs| is ambiguous but all the codecs are supported. | 99 // one codec ID in |codecs| is ambiguous but all the codecs are supported. |
96 // IsNotSupported is returned if |mime_type_lower_case| is not supported or at | 100 // IsNotSupported is returned if |mime_type_lower_case| is not supported or at |
97 // least one is not supported in |mime_type_lower_case|. |is_encrypted| means | 101 // least one is not supported in |mime_type_lower_case|. |is_encrypted| means |
98 // the codec will be used with encrypted blocks. | 102 // the codec will be used with encrypted blocks. |
99 SupportsType AreSupportedCodecs(const CodecSet& supported_codecs, | 103 SupportsType AreSupportedCodecs(const CodecSet& supported_codecs, |
100 const std::vector<std::string>& codecs, | 104 const std::vector<std::string>& codecs, |
101 const std::string& mime_type_lower_case, | 105 const std::string& mime_type_lower_case, |
102 bool is_encrypted) const; | 106 bool is_encrypted) const; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 // Lookup table for string compare based string -> Codec mappings. | 155 // Lookup table for string compare based string -> Codec mappings. |
152 StringToCodecMappings string_to_codec_map_; | 156 StringToCodecMappings string_to_codec_map_; |
153 | 157 |
154 DISALLOW_COPY_AND_ASSIGN(MimeUtil); | 158 DISALLOW_COPY_AND_ASSIGN(MimeUtil); |
155 }; | 159 }; |
156 | 160 |
157 } // namespace internal | 161 } // namespace internal |
158 } // namespace media | 162 } // namespace media |
159 | 163 |
160 #endif // MEDIA_BASE_MIME_UTIL_INTERNAL_H_ | 164 #endif // MEDIA_BASE_MIME_UTIL_INTERNAL_H_ |
OLD | NEW |