| Index: content/common/gpu/media/vaapi_picture_provider.cc
|
| diff --git a/content/common/gpu/media/vaapi_picture_provider.cc b/content/common/gpu/media/vaapi_picture_provider.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..f02567dfc0d24fd172170e70606873c341129a14
|
| --- /dev/null
|
| +++ b/content/common/gpu/media/vaapi_picture_provider.cc
|
| @@ -0,0 +1,59 @@
|
| +// 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 "base/bind.h"
|
| +#include "base/callback.h"
|
| +#include "content/common/gpu/media/vaapi_picture_provider.h"
|
| +#include "content/common/gpu/media/vaapi_wrapper.h"
|
| +#include "ui/gl/gl_context_glx.h"
|
| +#if !defined(USE_X11)
|
| +#include "content/common/gpu/media/vaapi_picture_provider_drm.h"
|
| +#else
|
| +#include "content/common/gpu/media/vaapi_picture_provider_x11.h"
|
| +#endif
|
| +
|
| +namespace content {
|
| +
|
| +VaapiPictureProvider::VaapiPictureProvider() {
|
| +}
|
| +
|
| +VaapiPictureProvider::~VaapiPictureProvider() {
|
| +}
|
| +
|
| +linked_ptr<VaapiPictureProvider::Picture> VaapiPictureProvider::CreatePicture(
|
| + int32 picture_buffer_id,
|
| + uint32 texture_id,
|
| + const gfx::Size& size) {
|
| + linked_ptr<Picture> picture =
|
| + AllocatePicture(picture_buffer_id, texture_id, size);
|
| +
|
| + if (!picture->Initialize())
|
| + picture.reset();
|
| +
|
| + return picture;
|
| +}
|
| +
|
| +scoped_ptr<VaapiPictureProvider> VaapiPictureProvider::Create(
|
| + scoped_refptr<VaapiWrapper> vaapi_wrapper,
|
| + gfx::GLContext* gl_context,
|
| + const base::Callback<bool(void)> make_context_current) {
|
| + scoped_ptr<VaapiPictureProvider> provider;
|
| +
|
| +#if defined(USE_X11)
|
| + provider.reset(
|
| + new X11VaapiPictureProvider(vaapi_wrapper,
|
| + static_cast<gfx::GLContextGLX*>(gl_context),
|
| + make_context_current));
|
| +#else
|
| + provider.reset(
|
| + new DrmVaapiPictureProvider(vaapi_wrapper, make_context_current));
|
| +#endif // USE_X11
|
| +
|
| + if (!provider->Initialize())
|
| + provider.reset();
|
| +
|
| + return provider.Pass();
|
| +}
|
| +
|
| +} // namespace content
|
|
|