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> |
11 | 11 |
12 #include "base/containers/hash_tables.h" | 12 #include "base/containers/hash_tables.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "media/base/media_export.h" | 14 #include "media/base/media_export.h" |
15 #include "media/base/mime_util.h" | 15 #include "media/base/mime_util.h" |
16 #include "media/base/video_codecs.h" | 16 #include "media/base/video_codecs.h" |
17 | 17 |
18 namespace media { | 18 namespace media { |
| 19 |
| 20 class VideoColorSpace; |
| 21 |
19 namespace internal { | 22 namespace internal { |
20 | 23 |
21 // Internal utility class for handling mime types. Should only be invoked by | 24 // Internal utility class for handling mime types. Should only be invoked by |
22 // tests and the functions within mime_util.cc -- NOT for direct use by others. | 25 // tests and the functions within mime_util.cc -- NOT for direct use by others. |
23 class MEDIA_EXPORT MimeUtil { | 26 class MEDIA_EXPORT MimeUtil { |
24 public: | 27 public: |
25 MimeUtil(); | 28 MimeUtil(); |
26 ~MimeUtil(); | 29 ~MimeUtil(); |
27 | 30 |
28 enum Codec { | 31 enum Codec { |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 // Returns true if this method was able to map |codec_id| with | 110 // Returns true if this method was able to map |codec_id| with |
108 // |mime_type_lower_case| to a specific Codec enum value. |codec| is only | 111 // |mime_type_lower_case| to a specific Codec enum value. |codec| is only |
109 // valid if true is returned. | 112 // valid if true is returned. |
110 // |ambiguous_codec_string| will be set to true when the codec string matches | 113 // |ambiguous_codec_string| will be set to true when the codec string matches |
111 // one of a small number of non-RFC compliant strings (e.g. "avc"). | 114 // one of a small number of non-RFC compliant strings (e.g. "avc"). |
112 // |profile| and |level| indicate video codec profile and level (unused for | 115 // |profile| and |level| indicate video codec profile and level (unused for |
113 // audio codecs). These will be VIDEO_CODEC_PROFILE_UNKNOWN and 0 respectively | 116 // audio codecs). These will be VIDEO_CODEC_PROFILE_UNKNOWN and 0 respectively |
114 // whenever |codec_id| is incomplete/invalid, or in some cases when | 117 // whenever |codec_id| is incomplete/invalid, or in some cases when |
115 // |ambiguous_codec_string| is set to true. | 118 // |ambiguous_codec_string| is set to true. |
116 // |is_encrypted| means the codec will be used with encrypted blocks. | 119 // |is_encrypted| means the codec will be used with encrypted blocks. |
117 // |out_eotf| is the electro-optical transfer function described by the | 120 // |out_color| is the color space described by the |
118 // |codec_id|. Will be gfx::ColorSpace::TransferID::INVALID for many codec | 121 // |codec_id|. |
119 // strings where EOTF is not described. | |
120 bool ParseCodecString(const std::string& mime_type_lower_case, | 122 bool ParseCodecString(const std::string& mime_type_lower_case, |
121 const std::string& codec_id, | 123 const std::string& codec_id, |
122 Codec* codec, | 124 Codec* codec, |
123 bool* ambiguous_codec_string, | 125 bool* ambiguous_codec_string, |
124 VideoCodecProfile* out_profile, | 126 VideoCodecProfile* out_profile, |
125 uint8_t* out_level, | 127 uint8_t* out_level, |
126 gfx::ColorSpace::TransferID* out_eotf) const; | 128 VideoColorSpace* out_colorspace) const; |
127 | 129 |
128 // Returns IsSupported if |codec| when platform supports codec contained in | 130 // Returns IsSupported if |codec| when platform supports codec contained in |
129 // |mime_type_lower_case|. Returns MayBeSupported when platform support is | 131 // |mime_type_lower_case|. Returns MayBeSupported when platform support is |
130 // unclear. Otherwise returns NotSupported. Note: This method will always | 132 // unclear. Otherwise returns NotSupported. Note: This method will always |
131 // return NotSupported for proprietary codecs if |allow_proprietary_codecs_| | 133 // return NotSupported for proprietary codecs if |allow_proprietary_codecs_| |
132 // is set to false. |is_encrypted| means the codec will be used with encrypted | 134 // is set to false. |is_encrypted| means the codec will be used with encrypted |
133 // blocks. | 135 // blocks. |
134 // TODO(chcunningham): Make this method return a bool. Platform support should | 136 // TODO(chcunningham): Make this method return a bool. Platform support should |
135 // always be knowable for a fully specified codec. | 137 // always be knowable for a fully specified codec. |
136 SupportsType IsCodecSupported(const std::string& mime_type_lower_case, | 138 SupportsType IsCodecSupported(const std::string& mime_type_lower_case, |
137 Codec codec, | 139 Codec codec, |
138 VideoCodecProfile video_profile, | 140 VideoCodecProfile video_profile, |
139 uint8_t video_level, | 141 uint8_t video_level, |
140 gfx::ColorSpace::TransferID eotf, | 142 const VideoColorSpace& eotf, |
141 bool is_encrypted) const; | 143 bool is_encrypted) const; |
142 | 144 |
143 // Wrapper around IsCodecSupported for simple codecs that are entirely | 145 // Wrapper around IsCodecSupported for simple codecs that are entirely |
144 // described (or implied) by the container mime-type. | 146 // described (or implied) by the container mime-type. |
145 SupportsType IsSimpleCodecSupported(const std::string& mime_type_lower_case, | 147 SupportsType IsSimpleCodecSupported(const std::string& mime_type_lower_case, |
146 Codec codec, | 148 Codec codec, |
147 bool is_encrypted) const; | 149 bool is_encrypted) const; |
148 | 150 |
149 // Returns true if |codec| refers to a proprietary codec. | 151 // Returns true if |codec| refers to a proprietary codec. |
150 bool IsCodecProprietary(Codec codec) const; | 152 bool IsCodecProprietary(Codec codec) const; |
(...skipping 24 matching lines...) Expand all Loading... |
175 // Whether proprietary codec support should be advertised to callers. | 177 // Whether proprietary codec support should be advertised to callers. |
176 bool allow_proprietary_codecs_; | 178 bool allow_proprietary_codecs_; |
177 | 179 |
178 DISALLOW_COPY_AND_ASSIGN(MimeUtil); | 180 DISALLOW_COPY_AND_ASSIGN(MimeUtil); |
179 }; | 181 }; |
180 | 182 |
181 } // namespace internal | 183 } // namespace internal |
182 } // namespace media | 184 } // namespace media |
183 | 185 |
184 #endif // MEDIA_BASE_MIME_UTIL_INTERNAL_H_ | 186 #endif // MEDIA_BASE_MIME_UTIL_INTERNAL_H_ |
OLD | NEW |