summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibVideo/VideoDecoder.h
blob: a4b239c4c4549951ac1309f958b3af37492a4a80 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/*
 * Copyright (c) 2022, Gregory Bertilson <zaggy1024@gmail.com>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#pragma once

#include <AK/ByteBuffer.h>
#include <AK/NonnullOwnPtr.h>

#include "DecoderError.h"
#include "VideoFrame.h"

namespace Video {

class VideoDecoder {
public:
    virtual ~VideoDecoder() {};

    virtual DecoderErrorOr<void> receive_sample(ReadonlyBytes sample) = 0;
    DecoderErrorOr<void> receive_sample(ByteBuffer const& sample) { return receive_sample(sample.span()); }
    virtual DecoderErrorOr<NonnullOwnPtr<VideoFrame>> get_decoded_frame() = 0;
};

}