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

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

Issue 1563893003: media: Fix case ordering of switch statements. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ps2 Created 4 years, 11 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/audio_decoder_config.cc ('k') | no next file » | 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 #include <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/containers/hash_tables.h" 10 #include "base/containers/hash_tables.h"
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 static bool IsCodecSupportedOnAndroid(MimeUtil::Codec codec) { 138 static bool IsCodecSupportedOnAndroid(MimeUtil::Codec codec) {
139 switch (codec) { 139 switch (codec) {
140 case MimeUtil::INVALID_CODEC: 140 case MimeUtil::INVALID_CODEC:
141 return false; 141 return false;
142 142
143 case MimeUtil::PCM: 143 case MimeUtil::PCM:
144 case MimeUtil::MP3: 144 case MimeUtil::MP3:
145 case MimeUtil::MPEG4_AAC_LC: 145 case MimeUtil::MPEG4_AAC_LC:
146 case MimeUtil::MPEG4_AAC_SBR_v1: 146 case MimeUtil::MPEG4_AAC_SBR_v1:
147 case MimeUtil::MPEG4_AAC_SBR_PS_v2: 147 case MimeUtil::MPEG4_AAC_SBR_PS_v2:
148 case MimeUtil::VORBIS:
148 case MimeUtil::H264_BASELINE: 149 case MimeUtil::H264_BASELINE:
149 case MimeUtil::H264_MAIN: 150 case MimeUtil::H264_MAIN:
150 case MimeUtil::H264_HIGH: 151 case MimeUtil::H264_HIGH:
151 case MimeUtil::VP8: 152 case MimeUtil::VP8:
152 case MimeUtil::VORBIS:
153 return true; 153 return true;
154 154
155 case MimeUtil::MPEG2_AAC_LC:
156 case MimeUtil::MPEG2_AAC_MAIN:
157 case MimeUtil::MPEG2_AAC_SSR:
158 // MPEG-2 variants of AAC are not supported on Android.
159 return false;
160
161 case MimeUtil::OPUS:
162 // Opus is supported only in Lollipop+ (API Level 21).
163 return base::android::BuildInfo::GetInstance()->sdk_int() >= 21;
164
155 case MimeUtil::HEVC_MAIN: 165 case MimeUtil::HEVC_MAIN:
156 #if defined(ENABLE_HEVC_DEMUXING) 166 #if defined(ENABLE_HEVC_DEMUXING)
157 // HEVC/H.265 is supported in Lollipop+ (API Level 21), according to 167 // HEVC/H.265 is supported in Lollipop+ (API Level 21), according to
158 // http://developer.android.com/reference/android/media/MediaFormat.html 168 // http://developer.android.com/reference/android/media/MediaFormat.html
159 return base::android::BuildInfo::GetInstance()->sdk_int() >= 21; 169 return base::android::BuildInfo::GetInstance()->sdk_int() >= 21;
160 #else 170 #else
161 return false; 171 return false;
162 #endif 172 #endif
163 173
164 case MimeUtil::MPEG2_AAC_LC:
165 case MimeUtil::MPEG2_AAC_MAIN:
166 case MimeUtil::MPEG2_AAC_SSR:
167 // MPEG-2 variants of AAC are not supported on Android.
168 return false;
169
170 case MimeUtil::VP9: 174 case MimeUtil::VP9:
171 // VP9 is supported only in KitKat+ (API Level 19). 175 // VP9 is supported only in KitKat+ (API Level 19).
172 return base::android::BuildInfo::GetInstance()->sdk_int() >= 19; 176 return base::android::BuildInfo::GetInstance()->sdk_int() >= 19;
173 177
174 case MimeUtil::OPUS:
175 // Opus is supported only in Lollipop+ (API Level 21).
176 return base::android::BuildInfo::GetInstance()->sdk_int() >= 21;
177
178 case MimeUtil::THEORA: 178 case MimeUtil::THEORA:
179 return false; 179 return false;
180 } 180 }
181 181
182 return false; 182 return false;
183 } 183 }
184 #endif 184 #endif
185 185
186 enum MediaFormatType { COMMON, PROPRIETARY }; 186 enum MediaFormatType { COMMON, PROPRIETARY };
187 187
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 MimeUtil::Codec codec; 272 MimeUtil::Codec codec;
273 }; 273 };
274 274
275 // List of codec IDs that provide enough information to determine the 275 // List of codec IDs that provide enough information to determine the
276 // codec and profile being requested. 276 // codec and profile being requested.
277 // 277 //
278 // The "mp4a" strings come from RFC 6381. 278 // The "mp4a" strings come from RFC 6381.
279 static const CodecIDMappings kUnambiguousCodecStringMap[] = { 279 static const CodecIDMappings kUnambiguousCodecStringMap[] = {
280 {"1", MimeUtil::PCM}, // We only allow this for WAV so it isn't ambiguous. 280 {"1", MimeUtil::PCM}, // We only allow this for WAV so it isn't ambiguous.
281 // avc1/avc3.XXXXXX may be unambiguous; handled by ParseH264CodecID(). 281 // avc1/avc3.XXXXXX may be unambiguous; handled by ParseH264CodecID().
282 // hev1/hvc1.XXXXXX may be unambiguous; handled by ParseHEVCCodecID().
282 {"mp3", MimeUtil::MP3}, 283 {"mp3", MimeUtil::MP3},
283 {"mp4a.66", MimeUtil::MPEG2_AAC_MAIN}, 284 {"mp4a.66", MimeUtil::MPEG2_AAC_MAIN},
284 {"mp4a.67", MimeUtil::MPEG2_AAC_LC}, 285 {"mp4a.67", MimeUtil::MPEG2_AAC_LC},
285 {"mp4a.68", MimeUtil::MPEG2_AAC_SSR}, 286 {"mp4a.68", MimeUtil::MPEG2_AAC_SSR},
286 {"mp4a.69", MimeUtil::MP3}, 287 {"mp4a.69", MimeUtil::MP3},
287 {"mp4a.6B", MimeUtil::MP3}, 288 {"mp4a.6B", MimeUtil::MP3},
288 {"mp4a.40.2", MimeUtil::MPEG4_AAC_LC}, 289 {"mp4a.40.2", MimeUtil::MPEG4_AAC_LC},
289 {"mp4a.40.02", MimeUtil::MPEG4_AAC_LC}, 290 {"mp4a.40.02", MimeUtil::MPEG4_AAC_LC},
290 {"mp4a.40.5", MimeUtil::MPEG4_AAC_SBR_v1}, 291 {"mp4a.40.5", MimeUtil::MPEG4_AAC_SBR_v1},
291 {"mp4a.40.05", MimeUtil::MPEG4_AAC_SBR_v1}, 292 {"mp4a.40.05", MimeUtil::MPEG4_AAC_SBR_v1},
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 std::vector<std::string>* codecs_out, 701 std::vector<std::string>* codecs_out,
701 const bool strip) { 702 const bool strip) {
702 g_media_mime_util.Get().ParseCodecString(codecs, codecs_out, strip); 703 g_media_mime_util.Get().ParseCodecString(codecs, codecs_out, strip);
703 } 704 }
704 705
705 void RemoveProprietaryMediaTypesAndCodecsForTests() { 706 void RemoveProprietaryMediaTypesAndCodecsForTests() {
706 g_media_mime_util.Get().RemoveProprietaryMediaTypesAndCodecsForTests(); 707 g_media_mime_util.Get().RemoveProprietaryMediaTypesAndCodecsForTests();
707 } 708 }
708 709
709 } // namespace media 710 } // namespace media
OLDNEW
« no previous file with comments | « media/base/audio_decoder_config.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698