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

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

Issue 1896983004: Rename misleading |is_ambiguous| parameter Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 | « no previous file | media/base/mime_util_internal.cc » ('j') | media/base/mime_util_internal.cc » ('J')
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_INTERNAL_H_ 5 #ifndef MEDIA_BASE_MIME_UTIL_INTERNAL_H_
6 #define MEDIA_BASE_MIME_UTIL_INTERNAL_H_ 6 #define MEDIA_BASE_MIME_UTIL_INTERNAL_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 bool is_encrypted, 76 bool is_encrypted,
77 const PlatformInfo& platform_info); 77 const PlatformInfo& platform_info);
78 78
79 private: 79 private:
80 typedef base::hash_set<int> CodecSet; 80 typedef base::hash_set<int> CodecSet;
81 typedef std::map<std::string, CodecSet> MediaFormatMappings; 81 typedef std::map<std::string, CodecSet> MediaFormatMappings;
82 struct CodecEntry { 82 struct CodecEntry {
83 CodecEntry() : codec(INVALID_CODEC), is_ambiguous(true) {} 83 CodecEntry() : codec(INVALID_CODEC), is_ambiguous(true) {}
84 CodecEntry(Codec c, bool ambiguous) : codec(c), is_ambiguous(ambiguous) {} 84 CodecEntry(Codec c, bool ambiguous) : codec(c), is_ambiguous(ambiguous) {}
85 Codec codec; 85 Codec codec;
86 bool is_ambiguous; 86 bool is_ambiguous;
xhwang 2016/04/19 23:59:43 Do you want rename this as well?
ddorwin 2016/04/21 00:50:30 Hmm. It is set for ambiguous strings (kAmbiguousCo
87 }; 87 };
88 typedef std::map<std::string, CodecEntry> StringToCodecMappings; 88 typedef std::map<std::string, CodecEntry> StringToCodecMappings;
89 89
90 // Initializes the supported media types into hash sets for faster lookup. 90 // Initializes the supported media types into hash sets for faster lookup.
91 void InitializeMimeTypeMaps(); 91 void InitializeMimeTypeMaps();
92 92
93 // Initializes the supported media formats (|media_format_map_|). 93 // Initializes the supported media formats (|media_format_map_|).
94 void AddSupportedMediaFormats(); 94 void AddSupportedMediaFormats();
95 95
96 // Adds |mime_type| with the specified codecs to |media_format_map_|. 96 // Adds |mime_type| with the specified codecs to |media_format_map_|.
97 void AddContainerWithCodecs(const std::string& mime_type, 97 void AddContainerWithCodecs(const std::string& mime_type,
98 const CodecSet& codecs_list, 98 const CodecSet& codecs_list,
99 bool is_proprietary_mime_type); 99 bool is_proprietary_mime_type);
100 100
101 // Returns IsSupported if all codec IDs in |codecs| are unambiguous and are 101 // Returns IsSupported if all codec IDs in |codecs| are unambiguous, known to
ddorwin 2016/04/18 23:43:37 "known to be supported" here, which is not "confid
DaleCurtis 2016/04/20 19:18:54 Yeah, this is just redundant. It doesn't make sens
ddorwin 2016/04/21 00:50:30 It turns out this was a bit of a bad example. I've
102 // supported in |mime_type_lower_case|. MayBeSupported is returned if at least 102 // be supported, and are supported in |mime_type_lower_case|. MayBeSupported
xhwang 2016/04/19 23:59:42 nit and not for this CL: Since "maybe" is one word
ddorwin 2016/04/21 00:50:30 I believe this is based on "the codec may be suppo
xhwang 2016/04/21 05:59:44 Acknowledged.
103 // one codec ID in |codecs| is ambiguous but all the codecs are supported. 103 // is returned if all the codecs are supported but at least one codec ID in
104 // |codecs| is ambiguous or not confidently known to be supported.
DaleCurtis 2016/04/20 19:18:54 maybe something like "support can not be determine
ddorwin 2016/04/21 00:50:30 Reworded. WDYT?
104 // IsNotSupported is returned if |mime_type_lower_case| is not supported or at 105 // IsNotSupported is returned if |mime_type_lower_case| is not supported or at
105 // least one is not supported in |mime_type_lower_case|. |is_encrypted| means 106 // least one of the |codecs| is not supported in |mime_type_lower_case|.
106 // the codec will be used with encrypted blocks. 107 // |is_encrypted| means the codec will be used with encrypted blocks.
107 SupportsType AreSupportedCodecs(const CodecSet& supported_codecs, 108 SupportsType AreSupportedCodecs(const CodecSet& supported_codecs,
xhwang 2016/04/19 23:59:42 What is this parameter for? It's not documented an
ddorwin 2016/04/21 00:50:30 Done.
108 const std::vector<std::string>& codecs, 109 const std::vector<std::string>& codecs,
109 const std::string& mime_type_lower_case, 110 const std::string& mime_type_lower_case,
110 bool is_encrypted) const; 111 bool is_encrypted) const;
111 112
112 // Converts a codec ID into an Codec enum value and indicates 113 // Converts a codec ID into an Codec enum value and indicates
xhwang 2016/04/19 23:59:42 nit: s/an/a also needs reflow
ddorwin 2016/04/21 00:50:30 Done.
113 // whether the conversion was ambiguous. 114 // whether the specified codec, including profile, etc., is is known supported
xhwang 2016/04/19 23:59:42 s/is is/is/
ddorwin 2016/04/21 00:50:30 Done.
115 // ("probably") or not ("maybe"), such as a potentially unsupported profile.
114 // Returns true if this method was able to map |codec_id| to a specific 116 // Returns true if this method was able to map |codec_id| to a specific
115 // Codec enum value. |codec| and |is_ambiguous| are only valid if true 117 // Codec enum value. |codec| and |is_known_supported| are only valid if true
116 // is returned. Otherwise their value is undefined after the call. 118 // is returned. Otherwise their value is undefined after the call.
117 // |is_ambiguous| is true if |codec_id| did not have enough information to
118 // unambiguously determine the proper Codec enum value. If |is_ambiguous|
119 // is true |codec| contains the best guess for the intended Codec enum value.
120 // |is_encrypted| means the codec will be used with encrypted blocks. 119 // |is_encrypted| means the codec will be used with encrypted blocks.
121 bool StringToCodec(const std::string& codec_id, 120 bool StringToCodec(const std::string& codec_id,
122 Codec* codec, 121 Codec* codec,
123 bool* is_ambiguous, 122 bool* is_known_supported,
xhwang 2016/04/19 23:59:42 Thanks for the background context on naming. So is
ddorwin 2016/04/21 00:50:30 No, it is not strictly the opposite. Ambiguous (no
xhwang 2016/04/21 05:59:44 |is_probably_supported| is probably better, but no
ddorwin 2016/04/21 17:30:48 Done.
124 bool is_encrypted) const; 123 bool is_encrypted) const;
125 124
126 // Returns true if |codec| is supported when contained in 125 // Returns true if |codec| is supported when contained in
127 // |mime_type_lower_case|. Note: This method will always return false for 126 // |mime_type_lower_case|. Note: This method will always return false for
128 // proprietary codecs if |allow_proprietary_codecs_| is set to false. 127 // proprietary codecs if |allow_proprietary_codecs_| is set to false.
129 // |is_encrypted| means the codec will be used with encrypted blocks. 128 // |is_encrypted| means the codec will be used with encrypted blocks.
130 bool IsCodecSupported(Codec codec, 129 bool IsCodecSupported(Codec codec,
131 const std::string& mime_type_lower_case, 130 const std::string& mime_type_lower_case,
132 bool is_encrypted) const; 131 bool is_encrypted) const;
133 132
(...skipping 28 matching lines...) Expand all
162 // Lookup table for string compare based string -> Codec mappings. 161 // Lookup table for string compare based string -> Codec mappings.
163 StringToCodecMappings string_to_codec_map_; 162 StringToCodecMappings string_to_codec_map_;
164 163
165 DISALLOW_COPY_AND_ASSIGN(MimeUtil); 164 DISALLOW_COPY_AND_ASSIGN(MimeUtil);
166 }; 165 };
167 166
168 } // namespace internal 167 } // namespace internal
169 } // namespace media 168 } // namespace media
170 169
171 #endif // MEDIA_BASE_MIME_UTIL_INTERNAL_H_ 170 #endif // MEDIA_BASE_MIME_UTIL_INTERNAL_H_
OLDNEW
« no previous file with comments | « no previous file | media/base/mime_util_internal.cc » ('j') | media/base/mime_util_internal.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698