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

Side by Side Diff: media/ffmpeg/ffmpeg_common.cc

Issue 2785543002: Default to range to "limited" when getting color space from container. (Closed)
Patch Set: Created 3 years, 8 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698