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 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 // avc1.xxxxxx & avc3.xxxxxx are considered ambiguous forms that are trying to | 532 // avc1.xxxxxx & avc3.xxxxxx are considered ambiguous forms that are trying to |
533 // signal H.264 Baseline. For example, the idc_level, profile_idc and | 533 // signal H.264 Baseline. For example, the idc_level, profile_idc and |
534 // constraint_set3_flag pieces may explicitly require decoder to conform to | 534 // constraint_set3_flag pieces may explicitly require decoder to conform to |
535 // baseline profile at the specified level (see Annex A and constraint_set0 in | 535 // baseline profile at the specified level (see Annex A and constraint_set0 in |
536 // ISO-14496-10). | 536 // ISO-14496-10). |
537 static bool ParseH264CodecID(const std::string& codec_id, | 537 static bool ParseH264CodecID(const std::string& codec_id, |
538 MimeUtil::Codec* codec, | 538 MimeUtil::Codec* codec, |
539 bool* is_ambiguous) { | 539 bool* is_ambiguous) { |
540 // Make sure we have avc1.xxxxxx or avc3.xxxxxx | 540 // Make sure we have avc1.xxxxxx or avc3.xxxxxx |
541 if (codec_id.size() != 11 || | 541 if (codec_id.size() != 11 || |
542 (!StartsWithASCII(codec_id, "avc1.", true) && | 542 (!base::StartsWithASCII(codec_id, "avc1.", true) && |
543 !StartsWithASCII(codec_id, "avc3.", true))) { | 543 !base::StartsWithASCII(codec_id, "avc3.", true))) { |
544 return false; | 544 return false; |
545 } | 545 } |
546 | 546 |
547 std::string profile = base::StringToUpperASCII(codec_id.substr(5, 4)); | 547 std::string profile = base::StringToUpperASCII(codec_id.substr(5, 4)); |
548 if (IsValidH264BaselineProfile(profile)) { | 548 if (IsValidH264BaselineProfile(profile)) { |
549 *codec = MimeUtil::H264_BASELINE; | 549 *codec = MimeUtil::H264_BASELINE; |
550 } else if (profile == "4D40") { | 550 } else if (profile == "4D40") { |
551 *codec = MimeUtil::H264_MAIN; | 551 *codec = MimeUtil::H264_MAIN; |
552 } else if (profile == "6400") { | 552 } else if (profile == "6400") { |
553 *codec = MimeUtil::H264_HIGH; | 553 *codec = MimeUtil::H264_HIGH; |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
660 std::vector<std::string>* codecs_out, | 660 std::vector<std::string>* codecs_out, |
661 const bool strip) { | 661 const bool strip) { |
662 g_media_mime_util.Get().ParseCodecString(codecs, codecs_out, strip); | 662 g_media_mime_util.Get().ParseCodecString(codecs, codecs_out, strip); |
663 } | 663 } |
664 | 664 |
665 void RemoveProprietaryMediaTypesAndCodecsForTests() { | 665 void RemoveProprietaryMediaTypesAndCodecsForTests() { |
666 g_media_mime_util.Get().RemoveProprietaryMediaTypesAndCodecsForTests(); | 666 g_media_mime_util.Get().RemoveProprietaryMediaTypesAndCodecsForTests(); |
667 } | 667 } |
668 | 668 |
669 } // namespace media | 669 } // namespace media |
OLD | NEW |