| 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 758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 866 #if !defined(MEDIA_DISABLE_FFMPEG) && !defined(OS_ANDROID) | 865 #if !defined(MEDIA_DISABLE_FFMPEG) && !defined(OS_ANDROID) |
| 867 case H264PROFILE_HIGH10PROFILE: | 866 case H264PROFILE_HIGH10PROFILE: |
| 868 // FFmpeg is not generally used for encrypted videos, so we do not | 867 // FFmpeg is not generally used for encrypted videos, so we do not |
| 869 // know whether 10-bit is supported. | 868 // know whether 10-bit is supported. |
| 870 ambiguous_platform_support = is_encrypted; | 869 ambiguous_platform_support = is_encrypted; |
| 871 break; | 870 break; |
| 872 #endif | 871 #endif |
| 873 default: | 872 default: |
| 874 ambiguous_platform_support = true; | 873 ambiguous_platform_support = true; |
| 875 } | 874 } |
| 876 } else if (codec == MimeUtil::VP9 && video_profile != VP9PROFILE_PROFILE0) { | 875 } else if (codec == MimeUtil::VP9 && video_profile != VP9PROFILE_PROFILE0 && |
| 877 // We don't know if the underlying platform supports these profiles. Need | 876 is_encrypted) { |
| 878 // to add platform level querying to get supported profiles. | 877 // LibVPX is not generally used for encrypted videos, so we do not know |
| 879 // https://crbug.com/604566 | 878 // whether higher profiles are supported. |
| 879 // TODO(chcunningham/xhwang): Add details to indicate which key system will |
| 880 // be used and check support by querying the matching KeySystemProperties. |
| 880 ambiguous_platform_support = true; | 881 ambiguous_platform_support = true; |
| 881 } | 882 } |
| 882 | 883 |
| 883 AudioCodec audio_codec = MimeUtilToAudioCodec(codec); | 884 AudioCodec audio_codec = MimeUtilToAudioCodec(codec); |
| 884 if (audio_codec != kUnknownAudioCodec) { | 885 if (audio_codec != kUnknownAudioCodec) { |
| 885 AudioConfig audio_config = {audio_codec}; | 886 AudioConfig audio_config = {audio_codec}; |
| 886 | 887 |
| 887 // If MediaClient is provided use it to check for decoder support. | 888 // If MediaClient is provided use it to check for decoder support. |
| 888 MediaClient* media_client = GetMediaClient(); | 889 MediaClient* media_client = GetMediaClient(); |
| 889 if (media_client && !media_client->IsSupportedAudioConfig(audio_config)) | 890 if (media_client && !media_client->IsSupportedAudioConfig(audio_config)) |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 967 if (mime_type == "audio/flac") { | 968 if (mime_type == "audio/flac") { |
| 968 *default_codec = MimeUtil::FLAC; | 969 *default_codec = MimeUtil::FLAC; |
| 969 return true; | 970 return true; |
| 970 } | 971 } |
| 971 | 972 |
| 972 return false; | 973 return false; |
| 973 } | 974 } |
| 974 | 975 |
| 975 } // namespace internal | 976 } // namespace internal |
| 976 } // namespace media | 977 } // namespace media |
| OLD | NEW |