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_H_ | 5 #ifndef MEDIA_BASE_MIME_UTIL_H_ |
6 #define MEDIA_BASE_MIME_UTIL_H_ | 6 #define MEDIA_BASE_MIME_UTIL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "media/base/media_export.h" | 11 #include "media/base/media_export.h" |
12 | 12 |
13 namespace media { | 13 namespace media { |
14 | 14 |
15 // Check to see if a particular MIME type is in the list of | 15 // Check to see if a particular MIME type is in the list of |
16 // supported/recognized MIME types. | 16 // supported/recognized MIME types. |
17 MEDIA_EXPORT bool IsSupportedMediaMimeType(const std::string& mime_type); | 17 MEDIA_EXPORT bool IsSupportedMediaMimeType(const std::string& mime_type); |
18 | 18 |
19 // Parses a codec string, populating |codecs_out| with the prefix of each codec | 19 // Parses a codec string, populating |codecs_out| with the prefix of each codec |
20 // in the string |codecs_in|. For example, passed "aaa.b.c,dd.eee", if | 20 // in the string |codecs_in|. For example, passed "aaa.b.c,dd.eee", if |
21 // |strip| == true |codecs_out| will contain {"aaa", "dd"}, if |strip| == false | 21 // |strip| == true |codecs_out| will contain {"aaa", "dd"}, if |strip| == false |
22 // |codecs_out| will contain {"aaa.b.c", "dd.eee"}. | 22 // |codecs_out| will contain {"aaa.b.c", "dd.eee"}. |
23 // See http://www.ietf.org/rfc/rfc4281.txt. | 23 // See http://www.ietf.org/rfc/rfc4281.txt. |
24 MEDIA_EXPORT void ParseCodecString(const std::string& codecs, | 24 MEDIA_EXPORT void ParseCodecString(const std::string& codecs, |
25 std::vector<std::string>* codecs_out, | 25 std::vector<std::string>* codecs_out, |
26 bool strip); | 26 bool strip); |
27 | 27 |
28 // Indicates that the MIME type and (possible codec string) are supported by the | 28 // Indicates that the MIME type and (possible codec string) are supported. |
29 // underlying platform. | |
30 enum SupportsType { | 29 enum SupportsType { |
31 // The underlying platform is known not to support the given MIME type and | 30 // The given MIME type and codec combination is not supported. |
32 // codec combination. | |
33 IsNotSupported, | 31 IsNotSupported, |
34 | 32 |
35 // The underlying platform is known to support the given MIME type and codec | 33 // The given MIME type and codec combination is supported. |
36 // combination. | |
37 IsSupported, | 34 IsSupported, |
38 | 35 |
39 // The underlying platform is unsure whether the given MIME type and codec | 36 // There's not enough information to determine if the given MIME type and |
40 // combination can be rendered or not before actually trying to play it. | 37 // codec combination can be rendered or not before actually trying to play it. |
41 MayBeSupported | 38 MayBeSupported |
42 }; | 39 }; |
43 | 40 |
44 // Checks the |mime_type| and |codecs| against the MIME types known to support | 41 // Checks the |mime_type| and |codecs| against the MIME types known to support |
45 // only a particular subset of codecs. | 42 // only a particular subset of codecs. |
46 // * Returns IsSupported if the |mime_type| is supported and all the codecs | 43 // * Returns IsSupported if the |mime_type| is supported and all the codecs |
47 // within the |codecs| are supported for the |mime_type|. | 44 // within the |codecs| are supported for the |mime_type|. |
48 // * Returns MayBeSupported if the |mime_type| is supported and is known to | 45 // * Returns MayBeSupported if the |mime_type| is supported and is known to |
49 // support only a subset of codecs, but |codecs| was empty. Also returned if | 46 // support only a subset of codecs, but |codecs| was empty. Also returned if |
50 // all the codecs in |codecs| are supported, but additional codec parameters | 47 // all the codecs in |codecs| are supported, but additional codec parameters |
51 // were supplied (such as profile) for which the support cannot be decided. | 48 // were supplied (such as profile) for which the support cannot be decided. |
52 // * Returns IsNotSupported if either the |mime_type| is not supported or the | 49 // * Returns IsNotSupported if either the |mime_type| is not supported or the |
53 // |mime_type| is supported but at least one of the codecs within |codecs| is | 50 // |mime_type| is supported but at least one of the codecs within |codecs| is |
54 // not supported for the |mime_type|. | 51 // not supported for the |mime_type|. |
55 MEDIA_EXPORT SupportsType | 52 MEDIA_EXPORT SupportsType |
56 IsSupportedMediaFormat(const std::string& mime_type, | 53 IsSupportedMediaFormat(const std::string& mime_type, |
57 const std::vector<std::string>& codecs); | 54 const std::vector<std::string>& codecs); |
58 | 55 |
| 56 // Similar to the above, but for encrypted formats. |
| 57 MEDIA_EXPORT SupportsType |
| 58 IsSupportedEncryptedMediaFormat(const std::string& mime_type, |
| 59 const std::vector<std::string>& codecs); |
| 60 |
59 // Test only method that removes proprietary media types and codecs from the | 61 // Test only method that removes proprietary media types and codecs from the |
60 // list of supported MIME types and codecs. These types and codecs must be | 62 // list of supported MIME types and codecs. These types and codecs must be |
61 // removed to ensure consistent layout test results across all Chromium | 63 // removed to ensure consistent layout test results across all Chromium |
62 // variations. | 64 // variations. |
63 MEDIA_EXPORT void RemoveProprietaryMediaTypesAndCodecsForTests(); | 65 MEDIA_EXPORT void RemoveProprietaryMediaTypesAndCodecsForTests(); |
64 | 66 |
65 } // namespace media | 67 } // namespace media |
66 | 68 |
67 #endif // MEDIA_BASE_MIME_UTIL_H_ | 69 #endif // MEDIA_BASE_MIME_UTIL_H_ |
OLD | NEW |