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 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 DCHECK(out_level); | 574 DCHECK(out_level); |
575 | 575 |
576 *codec = INVALID_CODEC; | 576 *codec = INVALID_CODEC; |
577 *ambiguous_codec_string = false; | 577 *ambiguous_codec_string = false; |
578 *out_profile = VIDEO_CODEC_PROFILE_UNKNOWN; | 578 *out_profile = VIDEO_CODEC_PROFILE_UNKNOWN; |
579 *out_level = 0; | 579 *out_level = 0; |
580 | 580 |
581 // Most codec strings do not yet specify color. We choose 709 as default color | 581 // Most codec strings do not yet specify color. We choose 709 as default color |
582 // space elsewhere, so defaulting to 709 here as well. See here for context: | 582 // space elsewhere, so defaulting to 709 here as well. See here for context: |
583 // https://crrev.com/1221903003/ | 583 // https://crrev.com/1221903003/ |
584 *out_color_space = VideoColorSpace::BT709(); | 584 *out_color_space = VideoColorSpace::REC709(); |
585 | 585 |
586 std::map<std::string, Codec>::const_iterator itr = | 586 std::map<std::string, Codec>::const_iterator itr = |
587 GetStringToCodecMap().find(codec_id); | 587 GetStringToCodecMap().find(codec_id); |
588 if (itr != GetStringToCodecMap().end()) { | 588 if (itr != GetStringToCodecMap().end()) { |
589 *codec = itr->second; | 589 *codec = itr->second; |
590 | 590 |
591 return true; | 591 return true; |
592 } | 592 } |
593 | 593 |
594 // Check codec string against short list of allowed ambiguous codecs. | 594 // Check codec string against short list of allowed ambiguous codecs. |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 SupportsType MimeUtil::IsSimpleCodecSupported( | 643 SupportsType MimeUtil::IsSimpleCodecSupported( |
644 const std::string& mime_type_lower_case, | 644 const std::string& mime_type_lower_case, |
645 Codec codec, | 645 Codec codec, |
646 bool is_encrypted) const { | 646 bool is_encrypted) const { |
647 // Video codecs are not "simple" because they require a profile and level to | 647 // Video codecs are not "simple" because they require a profile and level to |
648 // be specified. There is no "default" video codec for a given container. | 648 // be specified. There is no "default" video codec for a given container. |
649 DCHECK_EQ(MimeUtilToVideoCodec(codec), kUnknownVideoCodec); | 649 DCHECK_EQ(MimeUtilToVideoCodec(codec), kUnknownVideoCodec); |
650 | 650 |
651 SupportsType result = IsCodecSupported( | 651 SupportsType result = IsCodecSupported( |
652 mime_type_lower_case, codec, VIDEO_CODEC_PROFILE_UNKNOWN, | 652 mime_type_lower_case, codec, VIDEO_CODEC_PROFILE_UNKNOWN, |
653 0 /* video_level */, VideoColorSpace::BT709(), is_encrypted); | 653 0 /* video_level */, VideoColorSpace::REC709(), is_encrypted); |
654 | 654 |
655 // Platform support should never be ambiguous for simple codecs (no range of | 655 // Platform support should never be ambiguous for simple codecs (no range of |
656 // profiles to consider). | 656 // profiles to consider). |
657 DCHECK_NE(result, MayBeSupported); | 657 DCHECK_NE(result, MayBeSupported); |
658 return result; | 658 return result; |
659 } | 659 } |
660 | 660 |
661 SupportsType MimeUtil::IsCodecSupported(const std::string& mime_type_lower_case, | 661 SupportsType MimeUtil::IsCodecSupported(const std::string& mime_type_lower_case, |
662 Codec codec, | 662 Codec codec, |
663 VideoCodecProfile video_profile, | 663 VideoCodecProfile video_profile, |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
778 SupportsType MimeUtil::IsDefaultCodecSupported(const std::string& mime_type, | 778 SupportsType MimeUtil::IsDefaultCodecSupported(const std::string& mime_type, |
779 bool is_encrypted) const { | 779 bool is_encrypted) const { |
780 Codec default_codec = Codec::INVALID_CODEC; | 780 Codec default_codec = Codec::INVALID_CODEC; |
781 if (!GetDefaultCodec(mime_type, &default_codec)) | 781 if (!GetDefaultCodec(mime_type, &default_codec)) |
782 return IsNotSupported; | 782 return IsNotSupported; |
783 return IsSimpleCodecSupported(mime_type, default_codec, is_encrypted); | 783 return IsSimpleCodecSupported(mime_type, default_codec, is_encrypted); |
784 } | 784 } |
785 | 785 |
786 } // namespace internal | 786 } // namespace internal |
787 } // namespace media | 787 } // namespace media |
OLD | NEW |