| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <iterator> | 6 #include <iterator> |
| 7 #include <map> | 7 #include <map> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
| (...skipping 934 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 945 static bool ParseH264CodecID(const std::string& codec_id, | 945 static bool ParseH264CodecID(const std::string& codec_id, |
| 946 MimeUtil::Codec* codec, | 946 MimeUtil::Codec* codec, |
| 947 bool* is_ambiguous) { | 947 bool* is_ambiguous) { |
| 948 // Make sure we have avc1.xxxxxx or avc3.xxxxxx | 948 // Make sure we have avc1.xxxxxx or avc3.xxxxxx |
| 949 if (codec_id.size() != 11 || | 949 if (codec_id.size() != 11 || |
| 950 (!StartsWithASCII(codec_id, "avc1.", true) && | 950 (!StartsWithASCII(codec_id, "avc1.", true) && |
| 951 !StartsWithASCII(codec_id, "avc3.", true))) { | 951 !StartsWithASCII(codec_id, "avc3.", true))) { |
| 952 return false; | 952 return false; |
| 953 } | 953 } |
| 954 | 954 |
| 955 std::string profile = base::StringToUpperASCII(codec_id.substr(5, 4)); | 955 std::string profile = StringToUpperASCII(codec_id.substr(5, 4)); |
| 956 if (profile == "42E0") { | 956 if (profile == "42E0") { |
| 957 *codec = MimeUtil::H264_BASELINE; | 957 *codec = MimeUtil::H264_BASELINE; |
| 958 } else if (profile == "4D40") { | 958 } else if (profile == "4D40") { |
| 959 *codec = MimeUtil::H264_MAIN; | 959 *codec = MimeUtil::H264_MAIN; |
| 960 } else if (profile == "6400") { | 960 } else if (profile == "6400") { |
| 961 *codec = MimeUtil::H264_HIGH; | 961 *codec = MimeUtil::H264_HIGH; |
| 962 } else { | 962 } else { |
| 963 *codec = MimeUtil::H264_BASELINE; | 963 *codec = MimeUtil::H264_BASELINE; |
| 964 *is_ambiguous = true; | 964 *is_ambiguous = true; |
| 965 return true; | 965 return true; |
| 966 } | 966 } |
| 967 | 967 |
| 968 *is_ambiguous = | 968 *is_ambiguous = !IsValidH264Level(StringToUpperASCII(codec_id.substr(9))); |
| 969 !IsValidH264Level(base::StringToUpperASCII(codec_id.substr(9))); | |
| 970 return true; | 969 return true; |
| 971 } | 970 } |
| 972 | 971 |
| 973 bool MimeUtil::StringToCodec(const std::string& codec_id, | 972 bool MimeUtil::StringToCodec(const std::string& codec_id, |
| 974 Codec* codec, | 973 Codec* codec, |
| 975 bool* is_ambiguous) const { | 974 bool* is_ambiguous) const { |
| 976 StringToCodecMappings::const_iterator itr = | 975 StringToCodecMappings::const_iterator itr = |
| 977 string_to_codec_map_.find(codec_id); | 976 string_to_codec_map_.find(codec_id); |
| 978 if (itr != string_to_codec_map_.end()) { | 977 if (itr != string_to_codec_map_.end()) { |
| 979 *codec = itr->second.codec; | 978 *codec = itr->second.codec; |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1360 post_data->append("\r\n" + value + "\r\n"); | 1359 post_data->append("\r\n" + value + "\r\n"); |
| 1361 } | 1360 } |
| 1362 | 1361 |
| 1363 void AddMultipartFinalDelimiterForUpload(const std::string& mime_boundary, | 1362 void AddMultipartFinalDelimiterForUpload(const std::string& mime_boundary, |
| 1364 std::string* post_data) { | 1363 std::string* post_data) { |
| 1365 DCHECK(post_data); | 1364 DCHECK(post_data); |
| 1366 post_data->append("--" + mime_boundary + "--\r\n"); | 1365 post_data->append("--" + mime_boundary + "--\r\n"); |
| 1367 } | 1366 } |
| 1368 | 1367 |
| 1369 } // namespace net | 1368 } // namespace net |
| OLD | NEW |