Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/encryption_scheme.h" | |
|
ddorwin
2016/03/02 23:24:05
This is no longer necessary since we're just passi
dougsteed
2016/03/03 04:45:00
Done.
| |
| 7 #include "media/base/video_decoder_config.h" | 8 #include "media/base/video_decoder_config.h" |
| 8 #include "media/formats/webm/webm_constants.h" | 9 #include "media/formats/webm/webm_constants.h" |
| 9 | 10 |
| 10 namespace media { | 11 namespace media { |
| 11 | 12 |
| 12 WebMVideoClient::WebMVideoClient(const scoped_refptr<MediaLog>& media_log) | 13 WebMVideoClient::WebMVideoClient(const scoped_refptr<MediaLog>& media_log) |
| 13 : media_log_(media_log) { | 14 : media_log_(media_log) { |
| 14 Reset(); | 15 Reset(); |
| 15 } | 16 } |
| 16 | 17 |
| 17 WebMVideoClient::~WebMVideoClient() { | 18 WebMVideoClient::~WebMVideoClient() { |
| 18 } | 19 } |
| 19 | 20 |
| 20 void WebMVideoClient::Reset() { | 21 void WebMVideoClient::Reset() { |
| 21 pixel_width_ = -1; | 22 pixel_width_ = -1; |
| 22 pixel_height_ = -1; | 23 pixel_height_ = -1; |
| 23 crop_bottom_ = -1; | 24 crop_bottom_ = -1; |
| 24 crop_top_ = -1; | 25 crop_top_ = -1; |
| 25 crop_left_ = -1; | 26 crop_left_ = -1; |
| 26 crop_right_ = -1; | 27 crop_right_ = -1; |
| 27 display_width_ = -1; | 28 display_width_ = -1; |
| 28 display_height_ = -1; | 29 display_height_ = -1; |
| 29 display_unit_ = -1; | 30 display_unit_ = -1; |
| 30 alpha_mode_ = -1; | 31 alpha_mode_ = -1; |
| 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 bool is_encrypted, | 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; |
| 41 VideoCodecProfile profile = VIDEO_CODEC_PROFILE_UNKNOWN; | 42 VideoCodecProfile profile = VIDEO_CODEC_PROFILE_UNKNOWN; |
| 42 if (codec_id == "V_VP8") { | 43 if (codec_id == "V_VP8") { |
| 43 video_codec = kCodecVP8; | 44 video_codec = kCodecVP8; |
| 44 profile = VP8PROFILE_ANY; | 45 profile = VP8PROFILE_ANY; |
| 45 } else if (codec_id == "V_VP9") { | 46 } else if (codec_id == "V_VP9") { |
| 46 video_codec = kCodecVP9; | 47 video_codec = kCodecVP9; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 86 return false; | 87 return false; |
| 87 } else { | 88 } else { |
| 88 MEDIA_LOG(ERROR, media_log_) << "Unsupported display unit type " | 89 MEDIA_LOG(ERROR, media_log_) << "Unsupported display unit type " |
| 89 << display_unit_; | 90 << display_unit_; |
| 90 return false; | 91 return false; |
| 91 } | 92 } |
| 92 gfx::Size natural_size = gfx::Size(display_width_, display_height_); | 93 gfx::Size natural_size = gfx::Size(display_width_, display_height_); |
| 93 | 94 |
| 94 config->Initialize(video_codec, profile, format, COLOR_SPACE_HD_REC709, | 95 config->Initialize(video_codec, profile, format, COLOR_SPACE_HD_REC709, |
| 95 coded_size, visible_rect, natural_size, codec_private, | 96 coded_size, visible_rect, natural_size, codec_private, |
| 96 is_encrypted); | 97 encryption_scheme); |
| 97 return config->IsValidConfig(); | 98 return config->IsValidConfig(); |
| 98 } | 99 } |
| 99 | 100 |
| 100 bool WebMVideoClient::OnUInt(int id, int64_t val) { | 101 bool WebMVideoClient::OnUInt(int id, int64_t val) { |
| 101 int64_t* dst = NULL; | 102 int64_t* dst = NULL; |
| 102 | 103 |
| 103 switch (id) { | 104 switch (id) { |
| 104 case kWebMIdPixelWidth: | 105 case kWebMIdPixelWidth: |
| 105 dst = &pixel_width_; | 106 dst = &pixel_width_; |
| 106 break; | 107 break; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 150 // Accept binary fields we don't care about for now. | 151 // Accept binary fields we don't care about for now. |
| 151 return true; | 152 return true; |
| 152 } | 153 } |
| 153 | 154 |
| 154 bool WebMVideoClient::OnFloat(int id, double val) { | 155 bool WebMVideoClient::OnFloat(int id, double val) { |
| 155 // Accept float fields we don't care about for now. | 156 // Accept float fields we don't care about for now. |
| 156 return true; | 157 return true; |
| 157 } | 158 } |
| 158 | 159 |
| 159 } // namespace media | 160 } // namespace media |
| OLD | NEW |