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 "base/bind.h" |
| 6 #include "base/callback.h" |
| 7 #include "content/common/gpu/media/vaapi_picture_provider.h" |
| 8 #include "content/common/gpu/media/vaapi_wrapper.h" |
| 9 #include "ui/gl/gl_context_glx.h" |
| 10 #if !defined(USE_X11) |
| 11 #include "content/common/gpu/media/vaapi_picture_provider_drm.h" |
| 12 #else |
| 13 #include "content/common/gpu/media/vaapi_picture_provider_x11.h" |
| 14 #endif |
| 15 |
| 16 namespace content { |
| 17 |
| 18 VaapiPictureProvider::VaapiPictureProvider() { |
| 19 } |
| 20 |
| 21 VaapiPictureProvider::~VaapiPictureProvider() { |
| 22 } |
| 23 |
| 24 linked_ptr<VaapiPictureProvider::Picture> VaapiPictureProvider::CreatePicture( |
| 25 int32 picture_buffer_id, |
| 26 uint32 texture_id, |
| 27 const gfx::Size& size) { |
| 28 linked_ptr<Picture> picture = |
| 29 AllocatePicture(picture_buffer_id, texture_id, size); |
| 30 |
| 31 if (!picture->Initialize()) |
| 32 picture.reset(); |
| 33 |
| 34 return picture; |
| 35 } |
| 36 |
| 37 scoped_ptr<VaapiPictureProvider> VaapiPictureProvider::Create( |
| 38 scoped_refptr<VaapiWrapper> vaapi_wrapper, |
| 39 gfx::GLContext* gl_context, |
| 40 const base::Callback<bool(void)> make_context_current) { |
| 41 scoped_ptr<VaapiPictureProvider> provider; |
| 42 |
| 43 #if defined(USE_X11) |
| 44 provider.reset( |
| 45 new X11VaapiPictureProvider(vaapi_wrapper, |
| 46 static_cast<gfx::GLContextGLX*>(gl_context), |
| 47 make_context_current)); |
| 48 #else |
| 49 provider.reset( |
| 50 new DrmVaapiPictureProvider(vaapi_wrapper, make_context_current)); |
| 51 #endif // USE_X11 |
| 52 |
| 53 if (!provider->Initialize()) |
| 54 provider.reset(); |
| 55 |
| 56 return provider.Pass(); |
| 57 } |
| 58 |
| 59 } // namespace content |
OLD | NEW |