OLD | NEW |
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 <dlfcn.h> | 5 #include <dlfcn.h> |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 VADisplay va_display, | 235 VADisplay va_display, |
236 const base::Callback<bool(void)>& make_context_current, | 236 const base::Callback<bool(void)>& make_context_current, |
237 VASurfaceID va_surface_id, | 237 VASurfaceID va_surface_id, |
238 int32 picture_buffer_id, | 238 int32 picture_buffer_id, |
239 uint32 texture_id, | 239 uint32 texture_id, |
240 int width, int height) | 240 int width, int height) |
241 : x_display_(x_display), | 241 : x_display_(x_display), |
242 va_display_(va_display), | 242 va_display_(va_display), |
243 make_context_current_(make_context_current), | 243 make_context_current_(make_context_current), |
244 va_surface_id_(va_surface_id), | 244 va_surface_id_(va_surface_id), |
| 245 input_id_(0), |
245 picture_buffer_id_(picture_buffer_id), | 246 picture_buffer_id_(picture_buffer_id), |
246 texture_id_(texture_id), | 247 texture_id_(texture_id), |
247 width_(width), | 248 width_(width), |
248 height_(height), | 249 height_(height), |
249 available_(false), | 250 available_(false), |
| 251 poc_(0), |
250 x_pixmap_(0), | 252 x_pixmap_(0), |
251 glx_pixmap_(0) { | 253 glx_pixmap_(0) { |
252 // Bind the surface to a texture of the given width and height, | 254 // Bind the surface to a texture of the given width and height, |
253 // allocating pixmaps as needed. | 255 // allocating pixmaps as needed. |
254 if (!make_context_current_.Run()) | 256 if (!make_context_current_.Run()) |
255 return; | 257 return; |
256 | 258 |
257 glEnable(GL_TEXTURE_2D); | 259 glEnable(GL_TEXTURE_2D); |
258 glBindTexture(GL_TEXTURE_2D, texture_id_); | 260 glBindTexture(GL_TEXTURE_2D, texture_id_); |
259 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); | 261 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 | 327 |
326 // Wait for the data to be put into the buffer so it'd ready for output. | 328 // Wait for the data to be put into the buffer so it'd ready for output. |
327 va_res = VAAPI_SyncSurface(va_display_, va_surface_id_); | 329 va_res = VAAPI_SyncSurface(va_display_, va_surface_id_); |
328 VA_SUCCESS_OR_RETURN(va_res, "Failed syncing decoded picture", false); | 330 VA_SUCCESS_OR_RETURN(va_res, "Failed syncing decoded picture", false); |
329 | 331 |
330 return true; | 332 return true; |
331 } | 333 } |
332 | 334 |
333 VaapiH264Decoder::VaapiH264Decoder() { | 335 VaapiH264Decoder::VaapiH264Decoder() { |
334 Reset(); | 336 Reset(); |
| 337 curr_input_id_ = -1; |
| 338 x_display_ = NULL; |
| 339 fb_config_ = NULL; |
| 340 va_display_ = NULL; |
335 curr_sps_id_ = -1; | 341 curr_sps_id_ = -1; |
336 curr_pps_id_ = -1; | 342 curr_pps_id_ = -1; |
337 pic_width_ = -1; | 343 pic_width_ = -1; |
338 pic_height_ = -1; | 344 pic_height_ = -1; |
339 max_frame_num_ = 0; | 345 max_frame_num_ = 0; |
340 max_pic_num_ = 0; | 346 max_pic_num_ = 0; |
341 max_long_term_frame_idx_ = 0; | 347 max_long_term_frame_idx_ = 0; |
342 max_pic_order_cnt_lsb_ = 0; | 348 max_pic_order_cnt_lsb_ = 0; |
343 state_ = kUninitialized; | 349 state_ = kUninitialized; |
344 num_available_decode_surfaces_ = 0; | 350 num_available_decode_surfaces_ = 0; |
(...skipping 1744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2089 } | 2095 } |
2090 } | 2096 } |
2091 } | 2097 } |
2092 | 2098 |
2093 // static | 2099 // static |
2094 size_t VaapiH264Decoder::GetRequiredNumOfPictures() { | 2100 size_t VaapiH264Decoder::GetRequiredNumOfPictures() { |
2095 return kNumReqPictures; | 2101 return kNumReqPictures; |
2096 } | 2102 } |
2097 | 2103 |
2098 } // namespace content | 2104 } // namespace content |
OLD | NEW |