av1_vaapi_video_decoder_delegate.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // Copyright 2020 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef MEDIA_GPU_VAAPI_AV1_VAAPI_VIDEO_DECODER_DELEGATE_H_
  5. #define MEDIA_GPU_VAAPI_AV1_VAAPI_VIDEO_DECODER_DELEGATE_H_
  6. #include <memory>
  7. #include <vector>
  8. #include "media/gpu/av1_decoder.h"
  9. #include "media/gpu/vaapi/vaapi_video_decoder_delegate.h"
  10. namespace media {
  11. class ScopedVABuffer;
  12. class AV1VaapiVideoDecoderDelegate : public AV1Decoder::AV1Accelerator,
  13. public VaapiVideoDecoderDelegate {
  14. public:
  15. AV1VaapiVideoDecoderDelegate(
  16. DecodeSurfaceHandler<VASurface>* const vaapi_dec,
  17. scoped_refptr<VaapiWrapper> vaapi_wrapper,
  18. ProtectedSessionUpdateCB on_protected_session_update_cb =
  19. base::DoNothing(),
  20. CdmContext* cdm_context = nullptr,
  21. EncryptionScheme encryption_scheme = EncryptionScheme::kUnencrypted);
  22. ~AV1VaapiVideoDecoderDelegate() override;
  23. AV1VaapiVideoDecoderDelegate(const AV1VaapiVideoDecoderDelegate&) = delete;
  24. AV1VaapiVideoDecoderDelegate& operator=(const AV1VaapiVideoDecoderDelegate&) =
  25. delete;
  26. // AV1Decoder::AV1Accelerator implementation.
  27. scoped_refptr<AV1Picture> CreateAV1Picture(bool apply_grain) override;
  28. Status SubmitDecode(const AV1Picture& pic,
  29. const libgav1::ObuSequenceHeader& seq_header,
  30. const AV1ReferenceFrameVector& ref_frames,
  31. const libgav1::Vector<libgav1::TileBuffer>& tile_buffers,
  32. base::span<const uint8_t> data) override;
  33. bool OutputPicture(const AV1Picture& pic) override;
  34. // VaapiVideoDecoderDelegate implementation.
  35. void OnVAContextDestructionSoon() override;
  36. private:
  37. std::unique_ptr<ScopedVABuffer> picture_params_;
  38. std::unique_ptr<ScopedVABuffer> crypto_params_;
  39. };
  40. } // namespace media
  41. #endif // MEDIA_GPU_VAAPI_AV1_VAAPI_VIDEO_DECODER_DELEGATE_H_