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

Side by Side Diff: media/base/video_decoder_config.cc

Issue 1230593005: Reland: Change the video color space default. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: big rebase Created 5 years, 5 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.h ('k') | media/base/video_types.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/base/video_decoder_config.h" 5 #include "media/base/video_decoder_config.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "media/base/video_frame.h" 9 #include "media/base/video_frame.h"
10 10
11 namespace media { 11 namespace media {
12 12
13 VideoDecoderConfig::VideoDecoderConfig() 13 VideoDecoderConfig::VideoDecoderConfig()
14 : codec_(kUnknownVideoCodec), 14 : codec_(kUnknownVideoCodec),
15 profile_(VIDEO_CODEC_PROFILE_UNKNOWN), 15 profile_(VIDEO_CODEC_PROFILE_UNKNOWN),
16 format_(PIXEL_FORMAT_UNKNOWN), 16 format_(PIXEL_FORMAT_UNKNOWN),
17 is_encrypted_(false) { 17 is_encrypted_(false) {
18 } 18 }
19 19
20 VideoDecoderConfig::VideoDecoderConfig(VideoCodec codec, 20 VideoDecoderConfig::VideoDecoderConfig(VideoCodec codec,
21 VideoCodecProfile profile, 21 VideoCodecProfile profile,
22 VideoPixelFormat format, 22 VideoPixelFormat format,
23 ColorSpace color_space,
23 const gfx::Size& coded_size, 24 const gfx::Size& coded_size,
24 const gfx::Rect& visible_rect, 25 const gfx::Rect& visible_rect,
25 const gfx::Size& natural_size, 26 const gfx::Size& natural_size,
26 const uint8* extra_data, 27 const uint8* extra_data,
27 size_t extra_data_size, 28 size_t extra_data_size,
28 bool is_encrypted) { 29 bool is_encrypted) {
29 Initialize(codec, profile, format, COLOR_SPACE_UNSPECIFIED, coded_size, 30 Initialize(codec, profile, format, color_space, coded_size, visible_rect,
30 visible_rect, natural_size, extra_data, extra_data_size, 31 natural_size, extra_data, extra_data_size, is_encrypted, true);
31 is_encrypted, true);
32 } 32 }
33 33
34 VideoDecoderConfig::~VideoDecoderConfig() {} 34 VideoDecoderConfig::~VideoDecoderConfig() {}
35 35
36 // Some videos just want to watch the world burn, with a height of 0; cap the 36 // Some videos just want to watch the world burn, with a height of 0; cap the
37 // "infinite" aspect ratio resulting. 37 // "infinite" aspect ratio resulting.
38 static const int kInfiniteRatio = 99999; 38 static const int kInfiniteRatio = 99999;
39 39
40 // Common aspect ratios (multiplied by 100 and truncated) used for histogramming 40 // Common aspect ratios (multiplied by 100 and truncated) used for histogramming
41 // video sizes. These were taken on 20111103 from 41 // video sizes. These were taken on 20111103 from
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 UmaHistogramAspectRatio("Media.VideoVisibleAspectRatio", visible_rect); 81 UmaHistogramAspectRatio("Media.VideoVisibleAspectRatio", visible_rect);
82 UMA_HISTOGRAM_ENUMERATION("Media.VideoFramePixelFormat", format, 82 UMA_HISTOGRAM_ENUMERATION("Media.VideoFramePixelFormat", format,
83 PIXEL_FORMAT_MAX + 1); 83 PIXEL_FORMAT_MAX + 1);
84 UMA_HISTOGRAM_ENUMERATION("Media.VideoFrameColorSpace", color_space, 84 UMA_HISTOGRAM_ENUMERATION("Media.VideoFrameColorSpace", color_space,
85 COLOR_SPACE_MAX + 1); 85 COLOR_SPACE_MAX + 1);
86 } 86 }
87 87
88 codec_ = codec; 88 codec_ = codec;
89 profile_ = profile; 89 profile_ = profile;
90 format_ = format; 90 format_ = format;
91 color_space_ = color_space;
91 coded_size_ = coded_size; 92 coded_size_ = coded_size;
92 visible_rect_ = visible_rect; 93 visible_rect_ = visible_rect;
93 natural_size_ = natural_size; 94 natural_size_ = natural_size;
94 extra_data_.assign(extra_data, extra_data + extra_data_size); 95 extra_data_.assign(extra_data, extra_data + extra_data_size);
95 is_encrypted_ = is_encrypted; 96 is_encrypted_ = is_encrypted;
96 } 97 }
97 98
98 bool VideoDecoderConfig::IsValidConfig() const { 99 bool VideoDecoderConfig::IsValidConfig() const {
99 return codec_ != kUnknownVideoCodec && 100 return codec_ != kUnknownVideoCodec &&
100 natural_size_.width() > 0 && 101 natural_size_.width() > 0 &&
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 return "theora"; 152 return "theora";
152 case kCodecVP8: 153 case kCodecVP8:
153 return "vp8"; 154 return "vp8";
154 case kCodecVP9: 155 case kCodecVP9:
155 return "vp9"; 156 return "vp9";
156 } 157 }
157 NOTREACHED(); 158 NOTREACHED();
158 return ""; 159 return "";
159 } 160 }
160 161
161 VideoCodec VideoDecoderConfig::codec() const {
162 return codec_;
163 }
164
165 VideoCodecProfile VideoDecoderConfig::profile() const {
166 return profile_;
167 }
168
169 VideoPixelFormat VideoDecoderConfig::format() const {
170 return format_;
171 }
172
173 gfx::Size VideoDecoderConfig::coded_size() const {
174 return coded_size_;
175 }
176
177 gfx::Rect VideoDecoderConfig::visible_rect() const {
178 return visible_rect_;
179 }
180
181 gfx::Size VideoDecoderConfig::natural_size() const {
182 return natural_size_;
183 }
184
185 const uint8* VideoDecoderConfig::extra_data() const { 162 const uint8* VideoDecoderConfig::extra_data() const {
186 if (extra_data_.empty()) 163 if (extra_data_.empty())
187 return NULL; 164 return NULL;
188 return &extra_data_[0]; 165 return &extra_data_[0];
189 } 166 }
190 167
191 size_t VideoDecoderConfig::extra_data_size() const {
192 return extra_data_.size();
193 }
194
195 bool VideoDecoderConfig::is_encrypted() const {
196 return is_encrypted_;
197 }
198
199 } // namespace media 168 } // namespace media
OLDNEW
« no previous file with comments | « media/base/video_decoder_config.h ('k') | media/base/video_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698