Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(146)

Side by Side Diff: media/base/mime_util.cc

Issue 1172183002: Move StartsWith[ASCII] to base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@string_util3
Patch Set: merger Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/base/key_systems.cc ('k') | media/filters/source_buffer_stream_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « media/base/key_systems.cc ('k') | media/filters/source_buffer_stream_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698