vaapi_picture_native_pixmap.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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_H_
  5. #define MEDIA_GPU_VAAPI_VAAPI_PICTURE_NATIVE_PIXMAP_H_
  6. #include <stdint.h>
  7. #include "base/memory/ref_counted.h"
  8. #include "media/gpu/vaapi/va_surface.h"
  9. #include "media/gpu/vaapi/vaapi_picture.h"
  10. #include "ui/gfx/buffer_types.h"
  11. #include "ui/gfx/geometry/size.h"
  12. #include "ui/gfx/gpu_memory_buffer.h"
  13. namespace gl {
  14. class GLImage;
  15. }
  16. namespace media {
  17. class VaapiWrapper;
  18. // Implementation of VaapiPicture based on NativePixmaps.
  19. class VaapiPictureNativePixmap : public VaapiPicture {
  20. public:
  21. VaapiPictureNativePixmap(
  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. VaapiPictureNativePixmap(const VaapiPictureNativePixmap&) = delete;
  32. VaapiPictureNativePixmap& operator=(const VaapiPictureNativePixmap&) = delete;
  33. ~VaapiPictureNativePixmap() override;
  34. // VaapiPicture implementation.
  35. bool DownloadFromSurface(scoped_refptr<VASurface> va_surface) override;
  36. bool AllowOverlay() const override;
  37. VASurfaceID va_surface_id() const override;
  38. protected:
  39. // GLImage bound to the GL textures used by the VDA client.
  40. scoped_refptr<gl::GLImage> gl_image_;
  41. // VASurface used to transfer from the decoder's pixel format.
  42. scoped_refptr<VASurface> va_surface_;
  43. };
  44. } // namespace media
  45. #endif // MEDIA_GPU_VAAPI_VAAPI_PICTURE_NATIVE_PIXMAP_H_