#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "media/gpu/vaapi/test/shared_va_surface.h"
#include "base/files/file_util.h"
#include "base/hash/md5.h"
#include "media/base/video_types.h"
#include "media/gpu/vaapi/test/macros.h"
#include "media/gpu/vaapi/test/vaapi_device.h"
#include "third_party/libyuv/include/libyuv.h"
#include "ui/gfx/codec/png_codec.h"
namespace media {
namespace vaapi_test {
namespace {
bool IsSupportedFormat(uint32_t fourcc) { … }
bool DeriveImage(VADisplay display,
VASurfaceID surface_id,
VAImage* image,
uint8_t** image_data) { … }
VAImageFormat GetImageFormat(unsigned int va_rt_format) { … }
void GetSurfaceImage(VADisplay display,
VASurfaceID surface_id,
VAImageFormat format,
const gfx::Size size,
VAImage* image,
uint8_t** image_data) { … }
uint16_t JoinUint8(uint8_t first, uint8_t second) { … }
}
SharedVASurface::SharedVASurface(const VaapiDevice& va_device,
VASurfaceID id,
const gfx::Size& size,
unsigned int format)
: … { … }
scoped_refptr<SharedVASurface> SharedVASurface::Create(
const VaapiDevice& va_device,
unsigned int va_rt_format,
const gfx::Size& size,
VASurfaceAttrib attrib) { … }
SharedVASurface::~SharedVASurface() { … }
void SharedVASurface::FetchData(FetchPolicy fetch_policy,
const VAImageFormat& format,
VAImage* image,
uint8_t** image_data) const { … }
void SharedVASurface::SaveAsPNG(FetchPolicy fetch_policy,
const std::string& path) const { … }
std::string SharedVASurface::GetMD5Sum(FetchPolicy fetch_policy) const { … }
}
}