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

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

Issue 2864593003: Add MimeUtil::Parse{Audio|Video}CodecString (Closed)
Patch Set: Feedback && Proprietary Codecs fix && Rebase Created 3 years, 7 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
« no previous file with comments | « media/base/media.cc ('k') | media/base/mime_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/audio_codecs.h"
11 #include "media/base/media_export.h" 12 #include "media/base/media_export.h"
13 #include "media/base/video_codecs.h"
12 14
13 namespace media { 15 namespace media {
14 16
15 // Check to see if a particular MIME type is in the list of 17 // Check to see if a particular MIME type is in the list of
16 // supported/recognized MIME types. 18 // supported/recognized MIME types.
17 MEDIA_EXPORT bool IsSupportedMediaMimeType(const std::string& mime_type); 19 MEDIA_EXPORT bool IsSupportedMediaMimeType(const std::string& mime_type);
18 20
19 // Splits various codecs into |codecs_out|, conditionally stripping the profile 21 // Splits various codecs into |codecs_out|, conditionally stripping the profile
20 // and level info when |strip| == true. For example, passed "aaa.b.c,dd.eee", if 22 // and level info when |strip| == true. For example, passed "aaa.b.c,dd.eee", if
21 // |strip| == true |codecs_out| will contain {"aaa", "dd"}, if |strip| == false 23 // |strip| == true |codecs_out| will contain {"aaa", "dd"}, if |strip| == false
22 // |codecs_out| will contain {"aaa.b.c", "dd.eee"}. 24 // |codecs_out| will contain {"aaa.b.c", "dd.eee"}.
23 // See http://www.ietf.org/rfc/rfc4281.txt. 25 // See http://www.ietf.org/rfc/rfc4281.txt.
24 MEDIA_EXPORT void SplitCodecsToVector(const std::string& codecs, 26 MEDIA_EXPORT void SplitCodecsToVector(const std::string& codecs,
25 std::vector<std::string>* codecs_out, 27 std::vector<std::string>* codecs_out,
26 bool strip); 28 bool strip);
27 29
30 // Returns true if successfully parsed the given |mime_type| and |codec_id|,
31 // setting |out_*| arguments to the parsed video codec, profile, and level.
32 // |out_is_ambiguous| will be true when the codec string is incomplete such that
33 // some guessing was required to decide the codec, profile, or level.
34 // Returns false if parsing fails (invalid string, or unrecognized video codec),
35 // in which case values for |out_*| arguments are undefined.
36 MEDIA_EXPORT bool ParseVideoCodecString(const std::string& mime_type,
37 const std::string& codec_id,
38 bool* out_is_ambiguous,
39 VideoCodec* out_codec,
40 VideoCodecProfile* out_profile,
41 uint8_t* out_level,
42 VideoColorSpace* out_colorspace);
43
44 // Returns true if successfully parsed the given |mime_type| and |codec_id|,
45 // setting |out_audio_codec| to found codec. |out_is_ambiguous| will be true
46 // when the codec string is incomplete such that some guessing was required to
47 // decide the codec.
48 // Returns false if parsing fails (invalid string, or unrecognized audio codec),
49 // in which case values for |out_*| arguments are undefined.
50 MEDIA_EXPORT bool ParseAudioCodecString(const std::string& mime_type,
51 const std::string& codec_id,
52 bool* out_is_ambiguous,
53 AudioCodec* out_codec);
54
28 // Indicates that the MIME type and (possible codec string) are supported. 55 // Indicates that the MIME type and (possible codec string) are supported.
29 enum SupportsType { 56 enum SupportsType {
30 // The given MIME type and codec combination is not supported. 57 // The given MIME type and codec combination is not supported.
31 IsNotSupported, 58 IsNotSupported,
32 59
33 // The given MIME type and codec combination is supported. 60 // The given MIME type and codec combination is supported.
34 IsSupported, 61 IsSupported,
35 62
36 // There's not enough information to determine if the given MIME type and 63 // There's not enough information to determine if the given MIME type and
37 // codec combination can be rendered or not before actually trying to play it. 64 // codec combination can be rendered or not before actually trying to play it.
(...skipping 22 matching lines...) Expand all
60 87
61 // Test only method that removes proprietary media types and codecs from the 88 // Test only method that removes proprietary media types and codecs from the
62 // list of supported MIME types and codecs. These types and codecs must be 89 // list of supported MIME types and codecs. These types and codecs must be
63 // removed to ensure consistent layout test results across all Chromium 90 // removed to ensure consistent layout test results across all Chromium
64 // variations. 91 // variations.
65 MEDIA_EXPORT void RemoveProprietaryMediaTypesAndCodecsForTests(); 92 MEDIA_EXPORT void RemoveProprietaryMediaTypesAndCodecsForTests();
66 93
67 } // namespace media 94 } // namespace media
68 95
69 #endif // MEDIA_BASE_MIME_UTIL_H_ 96 #endif // MEDIA_BASE_MIME_UTIL_H_
OLDNEW
« no previous file with comments | « media/base/media.cc ('k') | media/base/mime_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698