chromium/media/gpu/vaapi/vaapi_common.h

// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef MEDIA_GPU_VAAPI_VAAPI_COMMON_H_
#define MEDIA_GPU_VAAPI_VAAPI_COMMON_H_

#include "build/chromeos_buildflags.h"
#include "media/gpu/av1_picture.h"
#include "media/gpu/h264_dpb.h"
#include "media/gpu/vaapi/vaapi_utils.h"
#include "media/gpu/vp8_picture.h"
#include "media/gpu/vp9_picture.h"
#include "media/media_buildflags.h"

#if BUILDFLAG(ENABLE_HEVC_PARSER_AND_HW_DECODER)
#include "media/gpu/h265_dpb.h"
#endif  // BUILDFLAG(ENABLE_HEVC_PARSER_AND_HW_DECODER)

namespace media {

// These picture classes derive from platform-independent, codec-specific
// classes to allow augmenting them with VA-API-specific traits; used when
// providing associated hardware resources and parameters to VA-API drivers.

class VaapiH264Picture : public H264Picture {};

#if BUILDFLAG(ENABLE_HEVC_PARSER_AND_HW_DECODER)
class VaapiH265Picture : public H265Picture {
 public:
  explicit VaapiH265Picture(std::unique_ptr<VASurfaceHandle> va_surface);

  VaapiH265Picture(const VaapiH265Picture&) = delete;
  VaapiH265Picture& operator=(const VaapiH265Picture&) = delete;

  VaapiH265Picture* AsVaapiH265Picture() override;

  VASurfaceID va_surface_id() const { return va_surface_->id(); }

 protected:
  ~VaapiH265Picture() override;

 private:
  std::unique_ptr<VASurfaceHandle> va_surface_;
};
#endif  // BUILDFLAG(ENABLE_HEVC_PARSER_AND_HW_DECODER)

class VaapiVP8Picture : public VP8Picture {};

class VaapiVP9Picture : public VP9Picture {};

class VaapiAV1Picture : public AV1Picture {};

}  // namespace media

#endif  // MEDIA_GPU_VAAPI_VAAPI_COMMON_H_