| 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 "media/ffmpeg/ffmpeg_common.h" | 5 #include "media/ffmpeg/ffmpeg_common.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/sha1.h" | 9 #include "base/sha1.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 aspect_ratio = stream->sample_aspect_ratio; | 450 aspect_ratio = stream->sample_aspect_ratio; |
| 451 else if (stream->codec->sample_aspect_ratio.num) | 451 else if (stream->codec->sample_aspect_ratio.num) |
| 452 aspect_ratio = stream->codec->sample_aspect_ratio; | 452 aspect_ratio = stream->codec->sample_aspect_ratio; |
| 453 | 453 |
| 454 VideoCodec codec = CodecIDToVideoCodec(stream->codec->codec_id); | 454 VideoCodec codec = CodecIDToVideoCodec(stream->codec->codec_id); |
| 455 | 455 |
| 456 VideoCodecProfile profile = VIDEO_CODEC_PROFILE_UNKNOWN; | 456 VideoCodecProfile profile = VIDEO_CODEC_PROFILE_UNKNOWN; |
| 457 if (codec == kCodecVP8) | 457 if (codec == kCodecVP8) |
| 458 profile = VP8PROFILE_ANY; | 458 profile = VP8PROFILE_ANY; |
| 459 else if (codec == kCodecVP9) | 459 else if (codec == kCodecVP9) |
| 460 profile = VP9PROFILE_ANY; | 460 // TODO(servolk): Find a way to obtain VP9 profile from FFmpeg. |
| 461 profile = VP9PROFILE_PROFILE0; |
| 461 else | 462 else |
| 462 profile = ProfileIDToVideoCodecProfile(stream->codec->profile); | 463 profile = ProfileIDToVideoCodecProfile(stream->codec->profile); |
| 463 | 464 |
| 464 // Without the FFmpeg h264 decoder, AVFormat is unable to get the profile, so | 465 // Without the FFmpeg h264 decoder, AVFormat is unable to get the profile, so |
| 465 // default to baseline and let the VDA fail later if it doesn't support the | 466 // default to baseline and let the VDA fail later if it doesn't support the |
| 466 // real profile. This is alright because if the FFmpeg h264 decoder isn't | 467 // real profile. This is alright because if the FFmpeg h264 decoder isn't |
| 467 // enabled, there is no fallback if the VDA fails. | 468 // enabled, there is no fallback if the VDA fails. |
| 468 #if defined(DISABLE_FFMPEG_VIDEO_DECODERS) | 469 #if defined(DISABLE_FFMPEG_VIDEO_DECODERS) |
| 469 if (codec == kCodecH264) | 470 if (codec == kCodecH264) |
| 470 profile = H264PROFILE_BASELINE; | 471 profile = H264PROFILE_BASELINE; |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 760 } | 761 } |
| 761 | 762 |
| 762 int32_t HashCodecName(const char* codec_name) { | 763 int32_t HashCodecName(const char* codec_name) { |
| 763 // Use the first 32-bits from the SHA1 hash as the identifier. | 764 // Use the first 32-bits from the SHA1 hash as the identifier. |
| 764 int32_t hash; | 765 int32_t hash; |
| 765 memcpy(&hash, base::SHA1HashString(codec_name).substr(0, 4).c_str(), 4); | 766 memcpy(&hash, base::SHA1HashString(codec_name).substr(0, 4).c_str(), 4); |
| 766 return hash; | 767 return hash; |
| 767 } | 768 } |
| 768 | 769 |
| 769 } // namespace media | 770 } // namespace media |
| OLD | NEW |