OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "content/common/gpu/media/vaapi_picture.h" |
| 6 #include "content/common/gpu/media/vaapi_wrapper.h" |
| 7 #include "ui/gl/gl_bindings.h" |
| 8 |
| 9 #if defined(USE_X11) |
| 10 #include "content/common/gpu/media/vaapi_tfp_picture.h" |
| 11 #else |
| 12 #include "content/common/gpu/media/vaapi_drm_picture.h" |
| 13 #endif |
| 14 |
| 15 namespace content { |
| 16 |
| 17 // static |
| 18 linked_ptr<VaapiPicture> VaapiPicture::CreatePicture( |
| 19 const scoped_refptr<VaapiWrapper>& vaapi_wrapper, |
| 20 gfx::GLContext* gl_context, |
| 21 const base::Callback<bool(void)> make_context_current, |
| 22 int32 picture_buffer_id, |
| 23 uint32 texture_id, |
| 24 const gfx::Size& size) { |
| 25 linked_ptr<VaapiPicture> picture; |
| 26 #if defined(USE_X11) |
| 27 picture.reset(new VaapiTFPPicture( |
| 28 vaapi_wrapper, reinterpret_cast<gfx::GLContextGLX*>(gl_context), |
| 29 make_context_current, picture_buffer_id, texture_id, size)); |
| 30 #else |
| 31 picture.reset(new VaapiDrmPicture(vaapi_wrapper, make_context_current, |
| 32 picture_buffer_id, texture_id, size)); |
| 33 #endif // USE_X11 |
| 34 |
| 35 if (!picture->Initialize()) |
| 36 picture.reset(); |
| 37 |
| 38 return picture; |
| 39 } |
| 40 |
| 41 // static |
| 42 uint32 VaapiPicture::GetGLTextureTarget() { |
| 43 #if defined(USE_OZONE) |
| 44 return GL_TEXTURE_EXTERNAL_OES; |
| 45 #else |
| 46 return GL_TEXTURE_2D; |
| 47 #endif |
| 48 } |
| 49 |
| 50 } // namespace content |
OLD | NEW |