#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "media/gpu/vaapi/vaapi_utils.h"
#include <algorithm>
#include <type_traits>
#include <utility>
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/synchronization/lock.h"
#include "build/chromeos_buildflags.h"
#include "media/gpu/vaapi/vaapi_common.h"
#include "media/gpu/vaapi/vaapi_wrapper.h"
#include "media/gpu/vp8_picture.h"
#include "media/gpu/vp8_reference_frame_vector.h"
#include "third_party/libva_protected_content/va_protected_content.h"
namespace media {
namespace {
template <typename To, typename From>
void CheckedMemcpy(To& to, From& from) { … }
}
std::unique_ptr<ScopedVABufferMapping> ScopedVABufferMapping::Create(
const base::Lock* lock,
VADisplay va_display,
VABufferID buffer_id) { … }
ScopedVABufferMapping::ScopedVABufferMapping(const base::Lock* lock,
VADisplay va_display,
VABufferID buffer_id,
void* va_buffer_data)
: … { … }
ScopedVABufferMapping::~ScopedVABufferMapping() { … }
std::unique_ptr<ScopedVABuffer> ScopedVABuffer::Create(
base::Lock* lock,
VADisplay va_display,
VAContextID va_context_id,
VABufferType va_buffer_type,
size_t size) { … }
std::unique_ptr<ScopedVABuffer> ScopedVABuffer::CreateForTesting(
VABufferID va_buffer_id,
VABufferType va_buffer_type,
size_t size) { … }
ScopedVABuffer::ScopedVABuffer(base::Lock* lock,
VADisplay va_display,
VABufferID va_buffer_id,
VABufferType va_buffer_type,
size_t size)
: … { … }
ScopedVABuffer::~ScopedVABuffer() { … }
std::unique_ptr<ScopedVAImage> ScopedVAImage::Create(
base::Lock* lock,
VADisplay va_display,
VASurfaceID va_surface_id,
const VAImageFormat& format,
const gfx::Size& size) { … }
ScopedVAImage::ScopedVAImage(base::Lock* lock,
VADisplay va_display,
const VAImage& image,
std::unique_ptr<ScopedVABufferMapping> va_buffer)
: … { … }
ScopedVAImage::~ScopedVAImage() { … }
ScopedVASurface::ScopedVASurface(scoped_refptr<VaapiWrapper> vaapi_wrapper,
VASurfaceID va_surface_id,
const gfx::Size& size,
unsigned int va_rt_format)
: … { … }
ScopedVASurface::~ScopedVASurface() { … }
bool ScopedVASurface::IsValid() const { … }
void FillVP8DataStructures(const Vp8FrameHeader& frame_header,
const Vp8ReferenceFrameVector& reference_frames,
VAIQMatrixBufferVP8* iq_matrix_buf,
VAProbabilityDataBufferVP8* prob_buf,
VAPictureParameterBufferVP8* pic_param,
VASliceParameterBufferVP8* slice_param) { … }
bool IsValidVABufferType(VABufferType type) { … }
}