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 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 // avc1.xxxxxx & avc3.xxxxxx are considered ambiguous forms that are trying to | 521 // avc1.xxxxxx & avc3.xxxxxx are considered ambiguous forms that are trying to |
522 // signal H.264 Baseline. For example, the idc_level, profile_idc and | 522 // signal H.264 Baseline. For example, the idc_level, profile_idc and |
523 // constraint_set3_flag pieces may explicitly require decoder to conform to | 523 // constraint_set3_flag pieces may explicitly require decoder to conform to |
524 // baseline profile at the specified level (see Annex A and constraint_set0 in | 524 // baseline profile at the specified level (see Annex A and constraint_set0 in |
525 // ISO-14496-10). | 525 // ISO-14496-10). |
526 static bool ParseH264CodecID(const std::string& codec_id, | 526 static bool ParseH264CodecID(const std::string& codec_id, |
527 MimeUtil::Codec* codec, | 527 MimeUtil::Codec* codec, |
528 bool* is_ambiguous) { | 528 bool* is_ambiguous) { |
529 // Make sure we have avc1.xxxxxx or avc3.xxxxxx | 529 // Make sure we have avc1.xxxxxx or avc3.xxxxxx |
530 if (codec_id.size() != 11 || | 530 if (codec_id.size() != 11 || |
531 (!base::StartsWithASCII(codec_id, "avc1.", true) && | 531 (!base::StartsWith(codec_id, "avc1.", base::CompareCase::SENSITIVE) && |
532 !base::StartsWithASCII(codec_id, "avc3.", true))) { | 532 !base::StartsWith(codec_id, "avc3.", base::CompareCase::SENSITIVE))) { |
533 return false; | 533 return false; |
534 } | 534 } |
535 | 535 |
536 std::string profile = base::StringToUpperASCII(codec_id.substr(5, 4)); | 536 std::string profile = base::StringToUpperASCII(codec_id.substr(5, 4)); |
537 if (IsValidH264BaselineProfile(profile)) { | 537 if (IsValidH264BaselineProfile(profile)) { |
538 *codec = MimeUtil::H264_BASELINE; | 538 *codec = MimeUtil::H264_BASELINE; |
539 } else if (profile == "4D40") { | 539 } else if (profile == "4D40") { |
540 *codec = MimeUtil::H264_MAIN; | 540 *codec = MimeUtil::H264_MAIN; |
541 } else if (profile == "6400") { | 541 } else if (profile == "6400") { |
542 *codec = MimeUtil::H264_HIGH; | 542 *codec = MimeUtil::H264_HIGH; |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
649 std::vector<std::string>* codecs_out, | 649 std::vector<std::string>* codecs_out, |
650 const bool strip) { | 650 const bool strip) { |
651 g_media_mime_util.Get().ParseCodecString(codecs, codecs_out, strip); | 651 g_media_mime_util.Get().ParseCodecString(codecs, codecs_out, strip); |
652 } | 652 } |
653 | 653 |
654 void RemoveProprietaryMediaTypesAndCodecsForTests() { | 654 void RemoveProprietaryMediaTypesAndCodecsForTests() { |
655 g_media_mime_util.Get().RemoveProprietaryMediaTypesAndCodecsForTests(); | 655 g_media_mime_util.Get().RemoveProprietaryMediaTypesAndCodecsForTests(); |
656 } | 656 } |
657 | 657 |
658 } // namespace media | 658 } // namespace media |
OLD | NEW |