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

Side by Side Diff: media/formats/webm/webm_video_client.cc

Issue 2333663003: Add color metadata info to VideoDecoderConfig. (Closed)
Patch Set: buildfix Created 4 years, 3 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/formats/webm/webm_video_client.h" 5 #include "media/formats/webm/webm_video_client.h"
6 6
7 #include "media/base/video_decoder_config.h" 7 #include "media/base/video_decoder_config.h"
8 #include "media/formats/webm/webm_constants.h" 8 #include "media/formats/webm/webm_constants.h"
9 9
10 namespace media { 10 namespace media {
(...skipping 10 matching lines...) Expand all
21 pixel_width_ = -1; 21 pixel_width_ = -1;
22 pixel_height_ = -1; 22 pixel_height_ = -1;
23 crop_bottom_ = -1; 23 crop_bottom_ = -1;
24 crop_top_ = -1; 24 crop_top_ = -1;
25 crop_left_ = -1; 25 crop_left_ = -1;
26 crop_right_ = -1; 26 crop_right_ = -1;
27 display_width_ = -1; 27 display_width_ = -1;
28 display_height_ = -1; 28 display_height_ = -1;
29 display_unit_ = -1; 29 display_unit_ = -1;
30 alpha_mode_ = -1; 30 alpha_mode_ = -1;
31 colour_parsed_ = false;
31 } 32 }
32 33
33 bool WebMVideoClient::InitializeConfig( 34 bool WebMVideoClient::InitializeConfig(
34 const std::string& codec_id, 35 const std::string& codec_id,
35 const std::vector<uint8_t>& codec_private, 36 const std::vector<uint8_t>& codec_private,
36 const EncryptionScheme& encryption_scheme, 37 const EncryptionScheme& encryption_scheme,
37 VideoDecoderConfig* config) { 38 VideoDecoderConfig* config) {
38 DCHECK(config); 39 DCHECK(config);
39 40
40 VideoCodec video_codec = kUnknownVideoCodec; 41 VideoCodec video_codec = kUnknownVideoCodec;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 } else { 90 } else {
90 MEDIA_LOG(ERROR, media_log_) << "Unsupported display unit type " 91 MEDIA_LOG(ERROR, media_log_) << "Unsupported display unit type "
91 << display_unit_; 92 << display_unit_;
92 return false; 93 return false;
93 } 94 }
94 gfx::Size natural_size = gfx::Size(display_width_, display_height_); 95 gfx::Size natural_size = gfx::Size(display_width_, display_height_);
95 96
96 config->Initialize(video_codec, profile, format, COLOR_SPACE_HD_REC709, 97 config->Initialize(video_codec, profile, format, COLOR_SPACE_HD_REC709,
97 coded_size, visible_rect, natural_size, codec_private, 98 coded_size, visible_rect, natural_size, codec_private,
98 encryption_scheme); 99 encryption_scheme);
100 if (colour_parsed_)
101 config->SetColorMetadata(colour_parser_.GetColorMetadata());
99 return config->IsValidConfig(); 102 return config->IsValidConfig();
100 } 103 }
101 104
105 WebMParserClient* WebMVideoClient::OnListStart(int id) {
106 if (id == kWebMIdColour) {
107 colour_parsed_ = false;
108 return &colour_parser_;
109 }
110
111 return this;
112 }
113
114 bool WebMVideoClient::OnListEnd(int id) {
115 if (id == kWebMIdColour)
116 colour_parsed_ = true;
117 return true;
118 }
119
102 bool WebMVideoClient::OnUInt(int id, int64_t val) { 120 bool WebMVideoClient::OnUInt(int id, int64_t val) {
103 int64_t* dst = NULL; 121 int64_t* dst = NULL;
104 122
105 switch (id) { 123 switch (id) {
106 case kWebMIdPixelWidth: 124 case kWebMIdPixelWidth:
107 dst = &pixel_width_; 125 dst = &pixel_width_;
108 break; 126 break;
109 case kWebMIdPixelHeight: 127 case kWebMIdPixelHeight:
110 dst = &pixel_height_; 128 dst = &pixel_height_;
111 break; 129 break;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 // Accept binary fields we don't care about for now. 170 // Accept binary fields we don't care about for now.
153 return true; 171 return true;
154 } 172 }
155 173
156 bool WebMVideoClient::OnFloat(int id, double val) { 174 bool WebMVideoClient::OnFloat(int id, double val) {
157 // Accept float fields we don't care about for now. 175 // Accept float fields we don't care about for now.
158 return true; 176 return true;
159 } 177 }
160 178
161 } // namespace media 179 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698