Chromium Code Reviews| 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 <map> | 5 #include <map> |
| 6 | 6 |
| 7 #include "base/containers/hash_tables.h" | 7 #include "base/containers/hash_tables.h" |
| 8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 137 | 137 |
| 138 case MimeUtil::PCM: | 138 case MimeUtil::PCM: |
| 139 case MimeUtil::MP3: | 139 case MimeUtil::MP3: |
| 140 case MimeUtil::MPEG4_AAC_LC: | 140 case MimeUtil::MPEG4_AAC_LC: |
| 141 case MimeUtil::MPEG4_AAC_SBR_v1: | 141 case MimeUtil::MPEG4_AAC_SBR_v1: |
| 142 case MimeUtil::MPEG4_AAC_SBR_PS_v2: | 142 case MimeUtil::MPEG4_AAC_SBR_PS_v2: |
| 143 case MimeUtil::H264_BASELINE: | 143 case MimeUtil::H264_BASELINE: |
| 144 case MimeUtil::H264_MAIN: | 144 case MimeUtil::H264_MAIN: |
| 145 case MimeUtil::H264_HIGH: | 145 case MimeUtil::H264_HIGH: |
| 146 case MimeUtil::VP8: | 146 case MimeUtil::VP8: |
| 147 case MimeUtil::VORBIS: | 147 case MimeUtil::VORBIS: |
|
ddorwin
2016/01/07 19:44:11
This should be before video (H264).
servolk
2016/01/07 22:08:04
Done.
| |
| 148 return true; | 148 return true; |
| 149 | 149 |
| 150 case MimeUtil::HEVC_MAIN: | |
| 151 #if defined(ENABLE_HEVC_DEMUXING) | |
| 152 // HEVC/H.265 is supported in Lollipop+ (API Level 21), according to | |
| 153 // http://developer.android.com/reference/android/media/MediaFormat.html | |
| 154 return base::android::BuildInfo::GetInstance()->sdk_int() >= 21; | |
| 155 #else | |
| 156 return false; | |
| 157 #endif | |
| 158 | |
| 159 case MimeUtil::MPEG2_AAC_LC: | 150 case MimeUtil::MPEG2_AAC_LC: |
| 160 case MimeUtil::MPEG2_AAC_MAIN: | 151 case MimeUtil::MPEG2_AAC_MAIN: |
| 161 case MimeUtil::MPEG2_AAC_SSR: | 152 case MimeUtil::MPEG2_AAC_SSR: |
| 162 // MPEG-2 variants of AAC are not supported on Android. | 153 // MPEG-2 variants of AAC are not supported on Android. |
| 163 return false; | 154 return false; |
| 164 | 155 |
|
ddorwin
2016/01/07 19:44:11
Opus should be here.
Then HEVC.
servolk
2016/01/07 22:08:04
Done.
| |
| 165 case MimeUtil::VP9: | 156 case MimeUtil::VP9: |
| 166 // VP9 is supported only in KitKat+ (API Level 19). | 157 // VP9 is supported only in KitKat+ (API Level 19). |
| 167 return base::android::BuildInfo::GetInstance()->sdk_int() >= 19; | 158 return base::android::BuildInfo::GetInstance()->sdk_int() >= 19; |
| 168 | 159 |
| 169 case MimeUtil::OPUS: | 160 case MimeUtil::OPUS: |
| 170 // Opus is supported only in Lollipop+ (API Level 21). | 161 // Opus is supported only in Lollipop+ (API Level 21). |
| 171 return base::android::BuildInfo::GetInstance()->sdk_int() >= 21; | 162 return base::android::BuildInfo::GetInstance()->sdk_int() >= 21; |
| 172 | 163 |
| 173 case MimeUtil::THEORA: | 164 case MimeUtil::THEORA: |
| 174 return false; | 165 return false; |
| 166 | |
| 167 case MimeUtil::HEVC_MAIN: | |
| 168 #if defined(ENABLE_HEVC_DEMUXING) | |
| 169 // HEVC/H.265 is supported in Lollipop+ (API Level 21), according to | |
| 170 // http://developer.android.com/reference/android/media/MediaFormat.html | |
| 171 return base::android::BuildInfo::GetInstance()->sdk_int() >= 21; | |
| 172 #else | |
| 173 return false; | |
| 174 #endif | |
| 175 } | 175 } |
| 176 | 176 |
| 177 return false; | 177 return false; |
| 178 } | 178 } |
| 179 #endif | 179 #endif |
| 180 | 180 |
| 181 enum MediaFormatType { COMMON, PROPRIETARY }; | 181 enum MediaFormatType { COMMON, PROPRIETARY }; |
| 182 | 182 |
| 183 struct MediaFormat { | 183 struct MediaFormat { |
| 184 const char* const mime_type; | 184 const char* const mime_type; |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 267 MimeUtil::Codec codec; | 267 MimeUtil::Codec codec; |
| 268 }; | 268 }; |
| 269 | 269 |
| 270 // List of codec IDs that provide enough information to determine the | 270 // List of codec IDs that provide enough information to determine the |
| 271 // codec and profile being requested. | 271 // codec and profile being requested. |
| 272 // | 272 // |
| 273 // The "mp4a" strings come from RFC 6381. | 273 // The "mp4a" strings come from RFC 6381. |
| 274 static const CodecIDMappings kUnambiguousCodecStringMap[] = { | 274 static const CodecIDMappings kUnambiguousCodecStringMap[] = { |
| 275 {"1", MimeUtil::PCM}, // We only allow this for WAV so it isn't ambiguous. | 275 {"1", MimeUtil::PCM}, // We only allow this for WAV so it isn't ambiguous. |
| 276 // avc1/avc3.XXXXXX may be unambiguous; handled by ParseH264CodecID(). | 276 // avc1/avc3.XXXXXX may be unambiguous; handled by ParseH264CodecID(). |
| 277 // hev1/hvc1.XXXXXX may be unambiguous; handled by ParseHEVCCodecID(). | |
| 277 {"mp3", MimeUtil::MP3}, | 278 {"mp3", MimeUtil::MP3}, |
| 278 {"mp4a.66", MimeUtil::MPEG2_AAC_MAIN}, | 279 {"mp4a.66", MimeUtil::MPEG2_AAC_MAIN}, |
| 279 {"mp4a.67", MimeUtil::MPEG2_AAC_LC}, | 280 {"mp4a.67", MimeUtil::MPEG2_AAC_LC}, |
| 280 {"mp4a.68", MimeUtil::MPEG2_AAC_SSR}, | 281 {"mp4a.68", MimeUtil::MPEG2_AAC_SSR}, |
| 281 {"mp4a.69", MimeUtil::MP3}, | 282 {"mp4a.69", MimeUtil::MP3}, |
| 282 {"mp4a.6B", MimeUtil::MP3}, | 283 {"mp4a.6B", MimeUtil::MP3}, |
| 283 {"mp4a.40.2", MimeUtil::MPEG4_AAC_LC}, | 284 {"mp4a.40.2", MimeUtil::MPEG4_AAC_LC}, |
| 284 {"mp4a.40.02", MimeUtil::MPEG4_AAC_LC}, | 285 {"mp4a.40.02", MimeUtil::MPEG4_AAC_LC}, |
| 285 {"mp4a.40.5", MimeUtil::MPEG4_AAC_SBR_v1}, | 286 {"mp4a.40.5", MimeUtil::MPEG4_AAC_SBR_v1}, |
| 286 {"mp4a.40.05", MimeUtil::MPEG4_AAC_SBR_v1}, | 287 {"mp4a.40.05", MimeUtil::MPEG4_AAC_SBR_v1}, |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 695 std::vector<std::string>* codecs_out, | 696 std::vector<std::string>* codecs_out, |
| 696 const bool strip) { | 697 const bool strip) { |
| 697 g_media_mime_util.Get().ParseCodecString(codecs, codecs_out, strip); | 698 g_media_mime_util.Get().ParseCodecString(codecs, codecs_out, strip); |
| 698 } | 699 } |
| 699 | 700 |
| 700 void RemoveProprietaryMediaTypesAndCodecsForTests() { | 701 void RemoveProprietaryMediaTypesAndCodecsForTests() { |
| 701 g_media_mime_util.Get().RemoveProprietaryMediaTypesAndCodecsForTests(); | 702 g_media_mime_util.Get().RemoveProprietaryMediaTypesAndCodecsForTests(); |
| 702 } | 703 } |
| 703 | 704 |
| 704 } // namespace media | 705 } // namespace media |
| OLD | NEW |