OLD | NEW |
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 Loading... |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |