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 "media/base/mime_util_internal.h" | 5 #include "media/base/mime_util_internal.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
| 9 #include "base/strings/string_split.h" | 9 #include "base/strings/string_split.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 580 return true; | 580 return true; |
| 581 | 581 |
| 582 // MediaPlayer only supports VP9 in WebM. | 582 // MediaPlayer only supports VP9 in WebM. |
| 583 return mime_type_lower_case == "video/webm"; | 583 return mime_type_lower_case == "video/webm"; |
| 584 } | 584 } |
| 585 } | 585 } |
| 586 | 586 |
| 587 return false; | 587 return false; |
| 588 } | 588 } |
| 589 | 589 |
| 590 bool MimeUtil::StringToCodec(const std::string& mime_type_lower_case, | 590 bool MimeUtil::StringToCodec(const std::string& mime_type_lower_case, |
|
ddorwin
2016/12/08 02:08:01
Checks for valid and support are spread out too mu
| |
| 591 const std::string& codec_id, | 591 const std::string& codec_id, |
| 592 Codec* codec, | 592 Codec* codec, |
| 593 bool* is_ambiguous, | 593 bool* is_ambiguous, |
| 594 VideoCodecProfile* out_profile, | 594 VideoCodecProfile* out_profile, |
| 595 uint8_t* out_level, | 595 uint8_t* out_level, |
| 596 bool is_encrypted) const { | 596 bool is_encrypted) const { |
| 597 DCHECK(out_profile); | 597 DCHECK(out_profile); |
| 598 DCHECK(out_level); | 598 DCHECK(out_level); |
| 599 *out_profile = VIDEO_CODEC_PROFILE_UNKNOWN; | 599 *out_profile = VIDEO_CODEC_PROFILE_UNKNOWN; |
| 600 *out_level = 0; | 600 *out_level = 0; |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 611 // either VP9, H.264 or HEVC/H.265 codec ID because currently those are the | 611 // either VP9, H.264 or HEVC/H.265 codec ID because currently those are the |
| 612 // only ones that are not added to the |string_to_codec_map_| and require | 612 // only ones that are not added to the |string_to_codec_map_| and require |
| 613 // parsing. | 613 // parsing. |
| 614 if (ParseVp9CodecID(mime_type_lower_case, codec_id, out_profile, out_level)) { | 614 if (ParseVp9CodecID(mime_type_lower_case, codec_id, out_profile, out_level)) { |
| 615 *codec = MimeUtil::VP9; | 615 *codec = MimeUtil::VP9; |
| 616 switch (*out_profile) { | 616 switch (*out_profile) { |
| 617 case VP9PROFILE_PROFILE0: | 617 case VP9PROFILE_PROFILE0: |
| 618 // Profile 0 should always be supported if VP9 is supported. | 618 // Profile 0 should always be supported if VP9 is supported. |
| 619 *is_ambiguous = false; | 619 *is_ambiguous = false; |
| 620 break; | 620 break; |
| 621 case VP9PROFILE_PROFILE2: | |
| 622 *is_ambiguous = false; | |
| 623 break; | |
| 621 default: | 624 default: |
| 622 // We don't know if the underlying platform supports these profiles. | 625 // We don't know if the underlying platform supports these profiles. |
|
ddorwin
2016/12/08 02:08:01
This statement does not seem true anymore. IsSuppo
| |
| 623 // Need to add platform level querying to get supported profiles | 626 // Need to add platform level querying to get supported profiles |
| 624 // (crbug/604566). | 627 // (crbug/604566). |
| 625 *is_ambiguous = true; | 628 *is_ambiguous = true; |
| 626 break; | 629 break; |
| 627 } | 630 } |
| 628 return true; | 631 return true; |
| 629 } | 632 } |
| 630 | 633 |
| 631 if (ParseAVCCodecId(codec_id, out_profile, out_level)) { | 634 if (ParseAVCCodecId(codec_id, out_profile, out_level)) { |
| 632 *codec = MimeUtil::H264; | 635 *codec = MimeUtil::H264; |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 733 const std::string& mime_type_lower_case, | 736 const std::string& mime_type_lower_case, |
| 734 bool is_encrypted) const { | 737 bool is_encrypted) const { |
| 735 Codec default_codec = Codec::INVALID_CODEC; | 738 Codec default_codec = Codec::INVALID_CODEC; |
| 736 if (!GetDefaultCodecLowerCase(mime_type_lower_case, &default_codec)) | 739 if (!GetDefaultCodecLowerCase(mime_type_lower_case, &default_codec)) |
| 737 return false; | 740 return false; |
| 738 return IsCodecSupported(default_codec, mime_type_lower_case, is_encrypted); | 741 return IsCodecSupported(default_codec, mime_type_lower_case, is_encrypted); |
| 739 } | 742 } |
| 740 | 743 |
| 741 } // namespace internal | 744 } // namespace internal |
| 742 } // namespace media | 745 } // namespace media |
| OLD | NEW |