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