Chromium Code Reviews| Index: content/common/gpu/media/vaapi_picture.cc |
| diff --git a/content/common/gpu/media/vaapi_picture.cc b/content/common/gpu/media/vaapi_picture.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..d4ba59c8200be16d8d8d70029818c696b9832cb1 |
| --- /dev/null |
| +++ b/content/common/gpu/media/vaapi_picture.cc |
| @@ -0,0 +1,50 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "content/common/gpu/media/vaapi_picture.h" |
| +#include "content/common/gpu/media/vaapi_wrapper.h" |
| +#include "ui/gl/gl_bindings.h" |
| + |
| +#if defined(USE_X11) |
| +#include "content/common/gpu/media/vaapi_tfp_picture.h" |
| +#else |
| +#include "content/common/gpu/media/vaapi_drm_picture.h" |
| +#endif |
| + |
| +namespace content { |
| + |
| +// static |
| +linked_ptr<VaapiPicture> VaapiPicture::CreatePicture( |
| + const scoped_refptr<VaapiWrapper>& vaapi_wrapper, |
| + gfx::GLContext* gl_context, |
| + const base::Callback<bool(void)> make_context_current, |
| + int32 picture_buffer_id, |
| + uint32 texture_id, |
| + const gfx::Size& size) { |
| + linked_ptr<VaapiPicture> picture; |
| +#if defined(USE_X11) |
| + picture.reset(new VaapiTFPPicture( |
| + vaapi_wrapper, reinterpret_cast<gfx::GLContextGLX*>(gl_context), |
|
piman
2014/12/16 20:46:43
use static_cast instead of reinterpret_cast.
Can
llandwerlin-old
2014/12/17 11:46:37
Removing the gl context, this dcheck won't be need
|
| + make_context_current, picture_buffer_id, texture_id, size)); |
| +#else |
| + picture.reset(new VaapiDrmPicture(vaapi_wrapper, make_context_current, |
| + picture_buffer_id, texture_id, size)); |
| +#endif // USE_X11 |
| + |
| + if (!picture->Initialize()) |
| + picture.reset(); |
| + |
| + return picture; |
| +} |
| + |
| +// static |
| +uint32 VaapiPicture::GetGLTextureTarget() { |
| +#if defined(USE_OZONE) |
| + return GL_TEXTURE_EXTERNAL_OES; |
| +#else |
| + return GL_TEXTURE_2D; |
| +#endif |
| +} |
| + |
| +} // namespace content |