VideoDecoder.h 587 B

1234567891011121314151617181920212223242526
  1. /*
  2. * Copyright (c) 2022, Gregory Bertilson <zaggy1024@gmail.com>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/ByteBuffer.h>
  8. #include <AK/NonnullOwnPtr.h>
  9. #include "DecoderError.h"
  10. #include "VideoFrame.h"
  11. namespace Video {
  12. class VideoDecoder {
  13. public:
  14. virtual ~VideoDecoder() {};
  15. virtual DecoderErrorOr<void> receive_sample(ReadonlyBytes sample) = 0;
  16. DecoderErrorOr<void> receive_sample(ByteBuffer const& sample) { return receive_sample(sample.span()); }
  17. virtual DecoderErrorOr<NonnullOwnPtr<VideoFrame>> get_decoded_frame() = 0;
  18. };
  19. }