vaapi_dmabuf_video_frame_mapper.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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_DMABUF_VIDEO_FRAME_MAPPER_H_
  5. #define MEDIA_GPU_VAAPI_VAAPI_DMABUF_VIDEO_FRAME_MAPPER_H_
  6. #include <memory>
  7. #include "media/gpu/media_gpu_export.h"
  8. #include "media/gpu/video_frame_mapper.h"
  9. namespace media {
  10. class VaapiWrapper;
  11. // VideoFrameMapper that provides access to the memory referred by DMABuf-backed
  12. // video frames using VA-API.
  13. // VaapiDmaBufVideoFrameMapper creates a new VaapiPicture from the given
  14. // VideoFrame and use the VaapiWrapper to access the memory there.
  15. class MEDIA_GPU_EXPORT VaapiDmaBufVideoFrameMapper : public VideoFrameMapper {
  16. public:
  17. static std::unique_ptr<VideoFrameMapper> Create(VideoPixelFormat format);
  18. VaapiDmaBufVideoFrameMapper(const VaapiDmaBufVideoFrameMapper&) = delete;
  19. VaapiDmaBufVideoFrameMapper& operator=(const VaapiDmaBufVideoFrameMapper&) =
  20. delete;
  21. ~VaapiDmaBufVideoFrameMapper() override;
  22. // VideoFrameMapper override.
  23. scoped_refptr<VideoFrame> Map(scoped_refptr<const VideoFrame> video_frame,
  24. int permissions) const override;
  25. private:
  26. explicit VaapiDmaBufVideoFrameMapper(VideoPixelFormat format);
  27. // Vaapi components for mapping.
  28. const scoped_refptr<VaapiWrapper> vaapi_wrapper_;
  29. };
  30. } // namespace media
  31. #endif // MEDIA_GPU_VAAPI_VAAPI_DMABUF_VIDEO_FRAME_MAPPER_H_