Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(219)

Side by Side Diff: media/base/mime_util.h

Issue 401523002: Move media related mimetype functionality out of net/ and into media/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address CR comments Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2014 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 #ifndef MEDIA_BASE_MIME_UTIL_H_
scherkus (not reviewing) 2014/07/18 02:00:00 blank line before this
acolwell GONE FROM CHROMIUM 2014/07/18 16:17:12 Done.
5 #define MEDIA_BASE_MIME_UTIL_H_
6
7 #include <string>
8 #include <vector>
9
10 #include "base/files/file_path.h"
11 #include "media/base/media_export.h"
12
13 namespace media {
14
15 MEDIA_EXPORT bool IsSupportedMediaMimeType(const std::string& mime_type);
16
17 // Returns true if and only if all codecs are supported, false otherwise.
18 MEDIA_EXPORT bool AreSupportedMediaCodecs(
19 const std::vector<std::string>& codecs);
20
21 // Parses a codec string, populating |codecs_out| with the prefix of each codec
22 // in the string |codecs_in|. For example, passed "aaa.b.c,dd.eee", if
23 // |strip| == true |codecs_out| will contain {"aaa", "dd"}, if |strip| == false
24 // |codecs_out| will contain {"aaa.b.c", "dd.eee"}.
25 // See http://www.ietf.org/rfc/rfc4281.txt.
26 MEDIA_EXPORT void ParseCodecString(const std::string& codecs,
27 std::vector<std::string>* codecs_out,
28 bool strip);
29
30 // Check to see if a particular MIME type is in our list which only supports a
31 // certain subset of codecs.
32 MEDIA_EXPORT bool IsStrictMediaMimeType(const std::string& mime_type);
33
34 // Indicates that the MIME type and (possible codec string) are supported by the
35 // underlying platform.
36 enum SupportsType {
37 // The underlying platform is known not to support the given MIME type and
38 // codec combination.
39 IsNotSupported,
40
41 // The underlying platform is known to support the given MIME type and codec
42 // combination.
43 IsSupported,
44
45 // The underlying platform is unsure whether the given MIME type and codec
46 // combination can be rendered or not before actually trying to play it.
47 MayBeSupported
48 };
49
50 // Checks the |mime_type| and |codecs| against the MIME types known to support
51 // only a particular subset of codecs.
52 // * Returns IsSupported if the |mime_type| is supported and all the codecs
53 // within the |codecs| are supported for the |mime_type|.
54 // * Returns MayBeSupported if the |mime_type| is supported and is known to
55 // support only a subset of codecs, but |codecs| was empty. Also returned if
56 // all the codecs in |codecs| are supported, but additional codec parameters
57 // were supplied (such as profile) for which the support cannot be decided.
58 // * Returns IsNotSupported if either the |mime_type| is not supported or the
59 // |mime_type| is supported but at least one of the codecs within |codecs| is
60 // not supported for the |mime_type|.
61 MEDIA_EXPORT SupportsType IsSupportedStrictMediaMimeType(
62 const std::string& mime_type,
63 const std::vector<std::string>& codecs);
64
65 // Get the extensions associated with the given mime type. This should be passed
66 // in lower case. There could be multiple extensions for a given mime type, like
67 // "html,htm" for "text/html", or "txt,text,html,..." for "text/*".
68 // Note that we do not erase the existing elements in the the provided vector.
69 // Instead, we append the result to it.
70 MEDIA_EXPORT void GetExtensionsForMimeType(
scherkus (not reviewing) 2014/07/18 02:00:00 this isn't implemented
acolwell GONE FROM CHROMIUM 2014/07/18 16:17:12 removed
71 const std::string& mime_type,
72 std::vector<base::FilePath::StringType>* extensions);
73
74 // Test only method that removes proprietary media types and codecs from the
75 // list of supported MIME types and codecs. These types and codecs must be
76 // removed to ensure consistent layout test results across all Chromium
77 // variations.
78 MEDIA_EXPORT void RemoveProprietaryMediaTypesAndCodecsForTests();
79
80 } // namespace media
81
82 #endif // MEDIA_BASE_MIME_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698