| 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 "media/base/mime_util_internal.h" | 5 #include "media/base/mime_util_internal.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 static bool ParseVp9CodecID(const std::string& mime_type_lower_case, | 86 static bool ParseVp9CodecID(const std::string& mime_type_lower_case, |
| 87 const std::string& codec_id, | 87 const std::string& codec_id, |
| 88 VideoCodecProfile* out_profile, | 88 VideoCodecProfile* out_profile, |
| 89 uint8_t* out_level, | 89 uint8_t* out_level, |
| 90 VideoColorSpace* out_color_space) { | 90 VideoColorSpace* out_color_space) { |
| 91 if (mime_type_lower_case == "video/mp4") { | 91 if (mime_type_lower_case == "video/mp4") { |
| 92 // Only new style is allowed for mp4. | 92 // Only new style is allowed for mp4. |
| 93 return ParseNewStyleVp9CodecID(codec_id, out_profile, out_level, | 93 return ParseNewStyleVp9CodecID(codec_id, out_profile, out_level, |
| 94 out_color_space); | 94 out_color_space); |
| 95 } else if (mime_type_lower_case == "video/webm") { | 95 } else if (mime_type_lower_case == "video/webm") { |
| 96 if (HasNewVp9CodecStringSupport() && | 96 if (ParseNewStyleVp9CodecID(codec_id, out_profile, out_level, |
| 97 ParseNewStyleVp9CodecID(codec_id, out_profile, out_level, | |
| 98 out_color_space)) { | 97 out_color_space)) { |
| 99 return true; | 98 return true; |
| 100 } | 99 } |
| 101 | 100 |
| 102 return ParseLegacyVp9CodecID(codec_id, out_profile, out_level); | 101 return ParseLegacyVp9CodecID(codec_id, out_profile, out_level); |
| 103 } | 102 } |
| 104 return false; | 103 return false; |
| 105 } | 104 } |
| 106 | 105 |
| 107 static bool IsValidH264Level(uint8_t level_idc) { | 106 static bool IsValidH264Level(uint8_t level_idc) { |
| (...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 871 #if !defined(MEDIA_DISABLE_FFMPEG) && !defined(OS_ANDROID) | 870 #if !defined(MEDIA_DISABLE_FFMPEG) && !defined(OS_ANDROID) |
| 872 case H264PROFILE_HIGH10PROFILE: | 871 case H264PROFILE_HIGH10PROFILE: |
| 873 // FFmpeg is not generally used for encrypted videos, so we do not | 872 // FFmpeg is not generally used for encrypted videos, so we do not |
| 874 // know whether 10-bit is supported. | 873 // know whether 10-bit is supported. |
| 875 ambiguous_platform_support = is_encrypted; | 874 ambiguous_platform_support = is_encrypted; |
| 876 break; | 875 break; |
| 877 #endif | 876 #endif |
| 878 default: | 877 default: |
| 879 ambiguous_platform_support = true; | 878 ambiguous_platform_support = true; |
| 880 } | 879 } |
| 881 } else if (codec == MimeUtil::VP9 && video_profile != VP9PROFILE_PROFILE0) { | 880 } else if (codec == MimeUtil::VP9 && video_profile != VP9PROFILE_PROFILE0 && |
| 882 // We don't know if the underlying platform supports these profiles. Need | 881 is_encrypted) { |
| 883 // to add platform level querying to get supported profiles. | 882 // LibVPX is not generally used for encrypted videos, so we do not know |
| 884 // https://crbug.com/604566 | 883 // whether higher profiles are supported. |
| 884 // TODO(chcunningham/xhwang): Add details to indicate which key system will |
| 885 // be used and check support by querying the matching KeySystemProperties. |
| 885 ambiguous_platform_support = true; | 886 ambiguous_platform_support = true; |
| 886 } | 887 } |
| 887 | 888 |
| 888 AudioCodec audio_codec = MimeUtilToAudioCodec(codec); | 889 AudioCodec audio_codec = MimeUtilToAudioCodec(codec); |
| 889 if (audio_codec != kUnknownAudioCodec) { | 890 if (audio_codec != kUnknownAudioCodec) { |
| 890 AudioConfig audio_config = {audio_codec}; | 891 AudioConfig audio_config = {audio_codec}; |
| 891 | 892 |
| 892 // If MediaClient is provided use it to check for decoder support. | 893 // If MediaClient is provided use it to check for decoder support. |
| 893 MediaClient* media_client = GetMediaClient(); | 894 MediaClient* media_client = GetMediaClient(); |
| 894 if (media_client && !media_client->IsSupportedAudioConfig(audio_config)) | 895 if (media_client && !media_client->IsSupportedAudioConfig(audio_config)) |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 972 if (mime_type == "audio/flac") { | 973 if (mime_type == "audio/flac") { |
| 973 *default_codec = MimeUtil::FLAC; | 974 *default_codec = MimeUtil::FLAC; |
| 974 return true; | 975 return true; |
| 975 } | 976 } |
| 976 | 977 |
| 977 return false; | 978 return false; |
| 978 } | 979 } |
| 979 | 980 |
| 980 } // namespace internal | 981 } // namespace internal |
| 981 } // namespace media | 982 } // namespace media |
| OLD | NEW |