| 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 // Initializes the supported media formats (|media_format_map_|). |
| 94 void AddSupportedMediaFormats(); |
| 95 |
| 96 // Adds |mime_type| with the specified codecs to |media_format_map_|. |
| 97 void AddContainerWithCodecs(const std::string& mime_type, |
| 98 const std::string& codecs_list, |
| 99 bool is_proprietary_mime_type); |
| 100 |
| 93 // Returns IsSupported if all codec IDs in |codecs| are unambiguous and are | 101 // 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 | 102 // 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. | 103 // 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 | 104 // 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 | 105 // least one is not supported in |mime_type_lower_case|. |is_encrypted| means |
| 98 // the codec will be used with encrypted blocks. | 106 // the codec will be used with encrypted blocks. |
| 99 SupportsType AreSupportedCodecs(const CodecSet& supported_codecs, | 107 SupportsType AreSupportedCodecs(const CodecSet& supported_codecs, |
| 100 const std::vector<std::string>& codecs, | 108 const std::vector<std::string>& codecs, |
| 101 const std::string& mime_type_lower_case, | 109 const std::string& mime_type_lower_case, |
| 102 bool is_encrypted) const; | 110 bool is_encrypted) const; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 bool is_encrypted) const; | 145 bool is_encrypted) const; |
| 138 | 146 |
| 139 #if defined(OS_ANDROID) | 147 #if defined(OS_ANDROID) |
| 140 // Indicates the support of various codecs within the platform. | 148 // Indicates the support of various codecs within the platform. |
| 141 PlatformInfo platform_info_; | 149 PlatformInfo platform_info_; |
| 142 #endif | 150 #endif |
| 143 | 151 |
| 144 // A map of mime_types and hash map of the supported codecs for the mime_type. | 152 // A map of mime_types and hash map of the supported codecs for the mime_type. |
| 145 MediaFormatMappings media_format_map_; | 153 MediaFormatMappings media_format_map_; |
| 146 | 154 |
| 147 // Keeps track of whether proprietary codec support should be | 155 // List of proprietary containers in |media_format_map_|. |
| 148 // advertised to callers. | 156 std::vector<std::string> proprietary_media_containers_; |
| 157 // Whether proprietary codec support should be advertised to callers. |
| 149 bool allow_proprietary_codecs_; | 158 bool allow_proprietary_codecs_; |
| 150 | 159 |
| 151 // Lookup table for string compare based string -> Codec mappings. | 160 // Lookup table for string compare based string -> Codec mappings. |
| 152 StringToCodecMappings string_to_codec_map_; | 161 StringToCodecMappings string_to_codec_map_; |
| 153 | 162 |
| 154 DISALLOW_COPY_AND_ASSIGN(MimeUtil); | 163 DISALLOW_COPY_AND_ASSIGN(MimeUtil); |
| 155 }; | 164 }; |
| 156 | 165 |
| 157 } // namespace internal | 166 } // namespace internal |
| 158 } // namespace media | 167 } // namespace media |
| 159 | 168 |
| 160 #endif // MEDIA_BASE_MIME_UTIL_INTERNAL_H_ | 169 #endif // MEDIA_BASE_MIME_UTIL_INTERNAL_H_ |
| OLD | NEW |