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/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 26 matching lines...) Expand all Loading... |
37 | 37 |
38 VideoCodec video_codec = kUnknownVideoCodec; | 38 VideoCodec video_codec = kUnknownVideoCodec; |
39 VideoCodecProfile profile = VIDEO_CODEC_PROFILE_UNKNOWN; | 39 VideoCodecProfile profile = VIDEO_CODEC_PROFILE_UNKNOWN; |
40 if (codec_id == "V_VP8") { | 40 if (codec_id == "V_VP8") { |
41 video_codec = kCodecVP8; | 41 video_codec = kCodecVP8; |
42 profile = VP8PROFILE_ANY; | 42 profile = VP8PROFILE_ANY; |
43 } else if (codec_id == "V_VP9") { | 43 } else if (codec_id == "V_VP9") { |
44 video_codec = kCodecVP9; | 44 video_codec = kCodecVP9; |
45 profile = VP9PROFILE_ANY; | 45 profile = VP9PROFILE_ANY; |
46 } else { | 46 } else { |
47 MEDIA_LOG(log_cb_) << "Unsupported video codec_id " << codec_id; | 47 MEDIA_LOG(ERROR, log_cb_) << "Unsupported video codec_id " << codec_id; |
48 return false; | 48 return false; |
49 } | 49 } |
50 | 50 |
51 VideoFrame::Format format = | 51 VideoFrame::Format format = |
52 (alpha_mode_ == 1) ? VideoFrame::YV12A : VideoFrame::YV12; | 52 (alpha_mode_ == 1) ? VideoFrame::YV12A : VideoFrame::YV12; |
53 | 53 |
54 if (pixel_width_ <= 0 || pixel_height_ <= 0) | 54 if (pixel_width_ <= 0 || pixel_height_ <= 0) |
55 return false; | 55 return false; |
56 | 56 |
57 // Set crop and display unit defaults if these elements are not present. | 57 // Set crop and display unit defaults if these elements are not present. |
(...skipping 18 matching lines...) Expand all Loading... |
76 pixel_height_ - (crop_top_ + crop_bottom_)); | 76 pixel_height_ - (crop_top_ + crop_bottom_)); |
77 if (display_unit_ == 0) { | 77 if (display_unit_ == 0) { |
78 if (display_width_ <= 0) | 78 if (display_width_ <= 0) |
79 display_width_ = visible_rect.width(); | 79 display_width_ = visible_rect.width(); |
80 if (display_height_ <= 0) | 80 if (display_height_ <= 0) |
81 display_height_ = visible_rect.height(); | 81 display_height_ = visible_rect.height(); |
82 } else if (display_unit_ == 3) { | 82 } else if (display_unit_ == 3) { |
83 if (display_width_ <= 0 || display_height_ <= 0) | 83 if (display_width_ <= 0 || display_height_ <= 0) |
84 return false; | 84 return false; |
85 } else { | 85 } else { |
86 MEDIA_LOG(log_cb_) << "Unsupported display unit type " << display_unit_; | 86 MEDIA_LOG(ERROR, log_cb_) << "Unsupported display unit type " |
| 87 << display_unit_; |
87 return false; | 88 return false; |
88 } | 89 } |
89 gfx::Size natural_size = gfx::Size(display_width_, display_height_); | 90 gfx::Size natural_size = gfx::Size(display_width_, display_height_); |
90 const uint8* extra_data = NULL; | 91 const uint8* extra_data = NULL; |
91 size_t extra_data_size = 0; | 92 size_t extra_data_size = 0; |
92 if (codec_private.size() > 0) { | 93 if (codec_private.size() > 0) { |
93 extra_data = &codec_private[0]; | 94 extra_data = &codec_private[0]; |
94 extra_data_size = codec_private.size(); | 95 extra_data_size = codec_private.size(); |
95 } | 96 } |
96 | 97 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 dst = &display_unit_; | 133 dst = &display_unit_; |
133 break; | 134 break; |
134 case kWebMIdAlphaMode: | 135 case kWebMIdAlphaMode: |
135 dst = &alpha_mode_; | 136 dst = &alpha_mode_; |
136 break; | 137 break; |
137 default: | 138 default: |
138 return true; | 139 return true; |
139 } | 140 } |
140 | 141 |
141 if (*dst != -1) { | 142 if (*dst != -1) { |
142 MEDIA_LOG(log_cb_) << "Multiple values for id " << std::hex << id | 143 MEDIA_LOG(ERROR, log_cb_) << "Multiple values for id " << std::hex << id |
143 << " specified (" << *dst << " and " << val << ")"; | 144 << " specified (" << *dst << " and " << val |
| 145 << ")"; |
144 return false; | 146 return false; |
145 } | 147 } |
146 | 148 |
147 *dst = val; | 149 *dst = val; |
148 return true; | 150 return true; |
149 } | 151 } |
150 | 152 |
151 bool WebMVideoClient::OnBinary(int id, const uint8* data, int size) { | 153 bool WebMVideoClient::OnBinary(int id, const uint8* data, int size) { |
152 // Accept binary fields we don't care about for now. | 154 // Accept binary fields we don't care about for now. |
153 return true; | 155 return true; |
154 } | 156 } |
155 | 157 |
156 bool WebMVideoClient::OnFloat(int id, double val) { | 158 bool WebMVideoClient::OnFloat(int id, double val) { |
157 // Accept float fields we don't care about for now. | 159 // Accept float fields we don't care about for now. |
158 return true; | 160 return true; |
159 } | 161 } |
160 | 162 |
161 } // namespace media | 163 } // namespace media |
OLD | NEW |