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

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

Issue 2746013006: use VideoColorSpace in decoder configuration (Closed)
Patch Set: oops, win compile fix reapplied Created 3 years, 9 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 | « media/base/video_decoder_config.cc ('k') | media/filters/h264_parser.h » ('j') | 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 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 std::vector<uint8_t> extra_data; 535 std::vector<uint8_t> extra_data;
536 if (codec_context->extradata_size > 0) { 536 if (codec_context->extradata_size > 0) {
537 extra_data.assign(codec_context->extradata, 537 extra_data.assign(codec_context->extradata,
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(gfx::ColorSpace::CreateVideo( 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_MPEG
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(
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 } 745 }
746 746
747 int32_t HashCodecName(const char* codec_name) { 747 int32_t HashCodecName(const char* codec_name) {
748 // Use the first 32-bits from the SHA1 hash as the identifier. 748 // Use the first 32-bits from the SHA1 hash as the identifier.
749 int32_t hash; 749 int32_t hash;
750 memcpy(&hash, base::SHA1HashString(codec_name).substr(0, 4).c_str(), 4); 750 memcpy(&hash, base::SHA1HashString(codec_name).substr(0, 4).c_str(), 4);
751 return hash; 751 return hash;
752 } 752 }
753 753
754 } // namespace media 754 } // namespace media
OLDNEW
« no previous file with comments | « media/base/video_decoder_config.cc ('k') | media/filters/h264_parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698