/src/serenity/Userland/Libraries/LibMedia/VideoDecoder.h
Line | Count | Source |
1 | | /* |
2 | | * Copyright (c) 2022, Gregory Bertilson <zaggy1024@gmail.com> |
3 | | * |
4 | | * SPDX-License-Identifier: BSD-2-Clause |
5 | | */ |
6 | | |
7 | | #pragma once |
8 | | |
9 | | #include <AK/ByteBuffer.h> |
10 | | #include <AK/NonnullOwnPtr.h> |
11 | | #include <AK/Time.h> |
12 | | |
13 | | #include "DecoderError.h" |
14 | | |
15 | | namespace Media { |
16 | | |
17 | | class VideoDecoder { |
18 | | public: |
19 | 711 | virtual ~VideoDecoder() = default; |
20 | | |
21 | | virtual DecoderErrorOr<void> receive_sample(Duration timestamp, ReadonlyBytes sample) = 0; |
22 | 0 | DecoderErrorOr<void> receive_sample(Duration timestamp, ByteBuffer const& sample) { return receive_sample(timestamp, sample.span()); } |
23 | | virtual DecoderErrorOr<NonnullOwnPtr<VideoFrame>> get_decoded_frame() = 0; |
24 | | |
25 | | virtual void flush() = 0; |
26 | | }; |
27 | | |
28 | | } |