OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/video_codecs.h" | 5 #include "media/base/video_codecs.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 DVLOG(4) << __func__ << ": invalid constraint byte=" << elem[i]; | 278 DVLOG(4) << __func__ << ": invalid constraint byte=" << elem[i]; |
279 return false; | 279 return false; |
280 } | 280 } |
281 constraint_flags[i] = constr_byte; | 281 constraint_flags[i] = constr_byte; |
282 } | 282 } |
283 | 283 |
284 return true; | 284 return true; |
285 } | 285 } |
286 #endif | 286 #endif |
287 | 287 |
| 288 VideoCodec StringToVideoCodec(const std::string& codec_id) { |
| 289 std::vector<std::string> elem = base::SplitString( |
| 290 codec_id, ".", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
| 291 if (elem.empty()) |
| 292 return kUnknownVideoCodec; |
| 293 VideoCodecProfile profile = VIDEO_CODEC_PROFILE_UNKNOWN; |
| 294 uint8_t level = 0; |
| 295 if (ParseAVCCodecId(codec_id, &profile, &level)) |
| 296 return kCodecH264; |
| 297 if (codec_id == "vp8" || codec_id == "vp8.0") |
| 298 return kCodecVP8; |
| 299 if (codec_id == "vp9" || codec_id == "vp9.0") |
| 300 return kCodecVP9; |
| 301 if (codec_id == "theora") |
| 302 return kCodecTheora; |
| 303 #if BUILDFLAG(ENABLE_HEVC_DEMUXING) |
| 304 if (ParseHEVCCodecId(codec_id, &profile, &level)) |
| 305 return kCodecHEVC; |
| 306 #endif |
| 307 return kUnknownVideoCodec; |
| 308 } |
| 309 |
288 } // namespace media | 310 } // namespace media |
OLD | NEW |