| 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 void InitializeMimeTypeMaps(); | 91 void InitializeMimeTypeMaps(); |
| 92 | 92 |
| 93 // Initializes the supported media formats (|media_format_map_|). | 93 // Initializes the supported media formats (|media_format_map_|). |
| 94 void AddSupportedMediaFormats(); | 94 void AddSupportedMediaFormats(); |
| 95 | 95 |
| 96 // Adds |mime_type| with the specified codecs to |media_format_map_|. | 96 // Adds |mime_type| with the specified codecs to |media_format_map_|. |
| 97 void AddContainerWithCodecs(const std::string& mime_type, | 97 void AddContainerWithCodecs(const std::string& mime_type, |
| 98 const CodecSet& codecs_list, | 98 const CodecSet& codecs_list, |
| 99 bool is_proprietary_mime_type); | 99 bool is_proprietary_mime_type); |
| 100 | 100 |
| 101 // Returns IsSupported if all codec IDs in |codecs| are unambiguous and are | 101 // Returns IsSupported if all codec IDs in |codecs| are unambiguous, |
| 102 // supported in |mime_type_lower_case|. MayBeSupported is returned if at least | 102 // are supported in |mime_type_lower_case|, and can probably be decoded. |
| 103 // one codec ID in |codecs| is ambiguous but all the codecs are supported. | 103 // Returns MayBeSupported if all the codec IDs in |codecs| are supported in |
| 104 // IsNotSupported is returned if |mime_type_lower_case| is not supported or at | 104 // |mime_type_lower_case| but at least one codec ID is ambiguous or may not |
| 105 // least one is not supported in |mime_type_lower_case|. |is_encrypted| means | 105 // be supported by the decoder(s). IsNotSupported is returned if |
| 106 // the codec will be used with encrypted blocks. | 106 // |mime_type_lower_case| is not supported or at least one of the codec IDs in |
| 107 // |codecs| is not supported in |mime_type_lower_case|. |supported_codecs| |
| 108 // provides the list of codecs allowed in |mime_type_lower_case|. |
| 109 // |is_encrypted| means the codec will be used with encrypted blocks. |
| 107 SupportsType AreSupportedCodecs(const CodecSet& supported_codecs, | 110 SupportsType AreSupportedCodecs(const CodecSet& supported_codecs, |
| 108 const std::vector<std::string>& codecs, | 111 const std::vector<std::string>& codecs, |
| 109 const std::string& mime_type_lower_case, | 112 const std::string& mime_type_lower_case, |
| 110 bool is_encrypted) const; | 113 bool is_encrypted) const; |
| 111 | 114 |
| 112 // Converts a codec ID into an Codec enum value and indicates | 115 // Converts a codec ID into a Codec enum value and indicates whether the |
| 113 // whether the conversion was ambiguous. | 116 // specified codec, including profile, etc., is probably supported. |
| 114 // Returns true if this method was able to map |codec_id| with | 117 // Returns true if this method was able to map |codec_id|, interpreted for |
| 115 // |mime_type_lower_case| to a specific Codec enum value. |codec| and | 118 // |mime_type_lower_case|, to a specific Codec enum value. If so, |codec| |
| 116 // |is_ambiguous| are only valid if true is returned. Otherwise their value is | 119 // contains the resulting value and |is_known_supported| indicates whether |
| 117 // undefined after the call. | 120 // decoding of content represented by the codec ID is probably supported |
| 118 // |is_ambiguous| is true if |codec_id| did not have enough information to | 121 // (true) or there is not confidence that such content can be decoded (false). |
| 119 // unambiguously determine the proper Codec enum value. If |is_ambiguous| | 122 // Examples of the latter include ambiguous codec IDs (those in |
| 120 // is true |codec| contains the best guess for the intended Codec enum value. | 123 // kAmbiguousCodecStringMap) and profiles that are not definitively known to |
| 121 // |is_encrypted| means the codec will be used with encrypted blocks. | 124 // be supported. |codec| and |is_known_supported| are only valid if true is |
| 125 // returned; otherwise their value is undefined. |is_encrypted| means the |
| 126 // codec will be used with encrypted blocks. |
| 122 bool StringToCodec(const std::string& mime_type_lower_case, | 127 bool StringToCodec(const std::string& mime_type_lower_case, |
| 123 const std::string& codec_id, | 128 const std::string& codec_id, |
| 124 Codec* codec, | 129 Codec* codec, |
| 125 bool* is_ambiguous, | 130 bool* is_known_supported, |
| 126 bool is_encrypted) const; | 131 bool is_encrypted) const; |
| 127 | 132 |
| 128 // Returns true if |codec| is supported when contained in | 133 // Returns true if |codec| is supported when contained in |
| 129 // |mime_type_lower_case|. Note: This method will always return false for | 134 // |mime_type_lower_case|. Note: This method will always return false for |
| 130 // proprietary codecs if |allow_proprietary_codecs_| is set to false. | 135 // proprietary codecs if |allow_proprietary_codecs_| is set to false. |
| 131 // |is_encrypted| means the codec will be used with encrypted blocks. | 136 // |is_encrypted| means the codec will be used with encrypted blocks. |
| 132 bool IsCodecSupported(Codec codec, | 137 bool IsCodecSupported(Codec codec, |
| 133 const std::string& mime_type_lower_case, | 138 const std::string& mime_type_lower_case, |
| 134 bool is_encrypted) const; | 139 bool is_encrypted) const; |
| 135 | 140 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 164 // Lookup table for string compare based string -> Codec mappings. | 169 // Lookup table for string compare based string -> Codec mappings. |
| 165 StringToCodecMappings string_to_codec_map_; | 170 StringToCodecMappings string_to_codec_map_; |
| 166 | 171 |
| 167 DISALLOW_COPY_AND_ASSIGN(MimeUtil); | 172 DISALLOW_COPY_AND_ASSIGN(MimeUtil); |
| 168 }; | 173 }; |
| 169 | 174 |
| 170 } // namespace internal | 175 } // namespace internal |
| 171 } // namespace media | 176 } // namespace media |
| 172 | 177 |
| 173 #endif // MEDIA_BASE_MIME_UTIL_INTERNAL_H_ | 178 #endif // MEDIA_BASE_MIME_UTIL_INTERNAL_H_ |
| OLD | NEW |