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/sha1.h" | 8 #include "base/sha1.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 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
538 codec_context->extradata + codec_context->extradata_size); | 538 codec_context->extradata + codec_context->extradata_size); |
539 } | 539 } |
540 config->Initialize(codec, profile, format, color_space, coded_size, | 540 config->Initialize(codec, profile, format, color_space, coded_size, |
541 visible_rect, natural_size, extra_data, | 541 visible_rect, natural_size, extra_data, |
542 GetEncryptionScheme(stream)); | 542 GetEncryptionScheme(stream)); |
543 | 543 |
544 const AVCodecParameters* codec_parameters = stream->codecpar; | 544 const AVCodecParameters* codec_parameters = stream->codecpar; |
545 config->set_color_space_info(VideoColorSpace( | 545 config->set_color_space_info(VideoColorSpace( |
546 codec_parameters->color_primaries, codec_parameters->color_trc, | 546 codec_parameters->color_primaries, codec_parameters->color_trc, |
547 codec_parameters->color_space, | 547 codec_parameters->color_space, |
548 codec_parameters->color_range != AVCOL_RANGE_MPEG | 548 codec_parameters->color_range == AVCOL_RANGE_JPEG |
549 ? gfx::ColorSpace::RangeID::FULL | 549 ? gfx::ColorSpace::RangeID::FULL |
550 : gfx::ColorSpace::RangeID::LIMITED)); | 550 : gfx::ColorSpace::RangeID::LIMITED)); |
551 | 551 |
552 return true; | 552 return true; |
553 } | 553 } |
554 | 554 |
555 void VideoDecoderConfigToAVCodecContext( | 555 void VideoDecoderConfigToAVCodecContext( |
556 const VideoDecoderConfig& config, | 556 const VideoDecoderConfig& config, |
557 AVCodecContext* codec_context) { | 557 AVCodecContext* codec_context) { |
558 codec_context->codec_type = AVMEDIA_TYPE_VIDEO; | 558 codec_context->codec_type = AVMEDIA_TYPE_VIDEO; |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
751 } | 751 } |
752 | 752 |
753 int32_t HashCodecName(const char* codec_name) { | 753 int32_t HashCodecName(const char* codec_name) { |
754 // Use the first 32-bits from the SHA1 hash as the identifier. | 754 // Use the first 32-bits from the SHA1 hash as the identifier. |
755 int32_t hash; | 755 int32_t hash; |
756 memcpy(&hash, base::SHA1HashString(codec_name).substr(0, 4).c_str(), 4); | 756 memcpy(&hash, base::SHA1HashString(codec_name).substr(0, 4).c_str(), 4); |
757 return hash; | 757 return hash; |
758 } | 758 } |
759 | 759 |
760 } // namespace media | 760 } // namespace media |
OLD | NEW |