vaapi_picture_native_pixmap_egl.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // Copyright 2018 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. #ifndef MEDIA_GPU_VAAPI_VAAPI_PICTURE_NATIVE_PIXMAP_EGL_H_
  5. #define MEDIA_GPU_VAAPI_VAAPI_PICTURE_NATIVE_PIXMAP_EGL_H_
  6. #include <stdint.h>
  7. #include "base/memory/ref_counted.h"
  8. #include "base/memory/weak_ptr.h"
  9. #include "media/gpu/vaapi/vaapi_picture_native_pixmap.h"
  10. #include "ui/gfx/buffer_types.h"
  11. #include "ui/gfx/geometry/size.h"
  12. namespace gfx {
  13. class NativePixmap;
  14. } // namespace gfx
  15. namespace media {
  16. class VaapiWrapper;
  17. // Implementation of VaapiPictureNativePixmap for EGL backends, see
  18. // https://crbug.com/785201.
  19. class VaapiPictureNativePixmapEgl : public VaapiPictureNativePixmap {
  20. public:
  21. VaapiPictureNativePixmapEgl(
  22. scoped_refptr<VaapiWrapper> vaapi_wrapper,
  23. const MakeGLContextCurrentCallback& make_context_current_cb,
  24. const BindGLImageCallback& bind_image_cb_,
  25. int32_t picture_buffer_id,
  26. const gfx::Size& size,
  27. const gfx::Size& visible_size,
  28. uint32_t texture_id,
  29. uint32_t client_texture_id,
  30. uint32_t texture_target);
  31. VaapiPictureNativePixmapEgl(const VaapiPictureNativePixmapEgl&) = delete;
  32. VaapiPictureNativePixmapEgl& operator=(const VaapiPictureNativePixmapEgl&) =
  33. delete;
  34. ~VaapiPictureNativePixmapEgl() override;
  35. // VaapiPicture implementation.
  36. VaapiStatus Allocate(gfx::BufferFormat format) override;
  37. bool ImportGpuMemoryBufferHandle(
  38. gfx::BufferFormat format,
  39. gfx::GpuMemoryBufferHandle gpu_memory_buffer_handle) override;
  40. private:
  41. VaapiStatus Initialize(scoped_refptr<gfx::NativePixmap> pixmap);
  42. };
  43. } // namespace media
  44. #endif // MEDIA_GPU_VAAPI_VAAPI_PICTURE_NATIVE_PIXMAP_EGL_H_