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