#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "media/gpu/vaapi/vaapi_dmabuf_video_frame_mapper.h"
#include <sys/mman.h>
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/ptr_util.h"
#include "build/build_config.h"
#include "media/base/color_plane_layout.h"
#include "media/gpu/chromeos/chromeos_compressed_gpu_memory_buffer_video_frame_utils.h"
#include "media/gpu/chromeos/platform_video_frame_utils.h"
#include "media/gpu/macros.h"
#include "media/gpu/vaapi/vaapi_utils.h"
#include "media/gpu/vaapi/vaapi_wrapper.h"
#include "ui/gfx/switches.h"
namespace media {
namespace {
constexpr VAImageFormat kImageFormatNV12{ … };
constexpr VAImageFormat kImageFormatP010{ … };
void DeallocateBuffers(std::unique_ptr<ScopedVAImage> va_image,
scoped_refptr<const FrameResource> ) { … }
scoped_refptr<VideoFrame> CreateMappedVideoFrame(
scoped_refptr<const FrameResource> src_video_frame,
std::unique_ptr<ScopedVAImage> va_image) { … }
bool IsFormatSupported(VideoPixelFormat format) { … }
}
std::unique_ptr<VideoFrameMapper> VaapiDmaBufVideoFrameMapper::Create(
VideoPixelFormat format) { … }
VaapiDmaBufVideoFrameMapper::VaapiDmaBufVideoFrameMapper(
VideoPixelFormat format)
: … { … }
VaapiDmaBufVideoFrameMapper::~VaapiDmaBufVideoFrameMapper() { … }
scoped_refptr<VideoFrame> VaapiDmaBufVideoFrameMapper::MapFrame(
scoped_refptr<const FrameResource> video_frame,
int permissions) { … }
}