#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "media/gpu/chromeos/generic_dmabuf_video_frame_mapper.h"
#include <sys/mman.h>
#include <utility>
#include <vector>
#include "base/containers/contains.h"
#include "base/functional/bind.h"
#include "base/memory/ptr_util.h"
#include "media/gpu/chromeos/chromeos_compressed_gpu_memory_buffer_video_frame_utils.h"
#include "media/gpu/macros.h"
namespace media {
namespace {
uint8_t* Mmap(const size_t length, const int fd, int permissions) { … }
void MunmapBuffers(const std::vector<std::pair<uint8_t*, size_t>>& chunks,
scoped_refptr<const FrameResource> video_frame) { … }
scoped_refptr<VideoFrame> CreateMappedVideoFrame(
scoped_refptr<const FrameResource> src_video_frame,
uint8_t* plane_addrs[VideoFrame::kMaxPlanes],
const std::vector<std::pair<uint8_t*, size_t>>& chunks) { … }
bool IsFormatSupported(VideoPixelFormat format) { … }
}
std::unique_ptr<GenericDmaBufVideoFrameMapper>
GenericDmaBufVideoFrameMapper::Create(VideoPixelFormat format) { … }
GenericDmaBufVideoFrameMapper::GenericDmaBufVideoFrameMapper(
VideoPixelFormat format)
: … { … }
scoped_refptr<VideoFrame> GenericDmaBufVideoFrameMapper::MapFrame(
scoped_refptr<const FrameResource> video_frame,
int permissions) { … }
}