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