1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 21:57:35 +00:00

LibVideo: Make VP9::Decoder a subclass of a new abstract VideoDecoder

This will allow other decoders to be used in place of VP9::Decoder when
new video decoders are implemented, such as AV1.
This commit is contained in:
Zaggy1024 2022-10-29 19:53:24 -05:00 committed by Andreas Kling
parent 3720f66bb1
commit 2b4b6c5613
4 changed files with 34 additions and 12 deletions

View file

@ -0,0 +1,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(Span<u8 const> sample) = 0;
DecoderErrorOr<void> receive_sample(ByteBuffer const& sample) { return receive_sample(sample.span()); }
virtual DecoderErrorOr<NonnullOwnPtr<VideoFrame>> get_decoded_frame() = 0;
};
}