mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 14:57:34 +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:
parent
3720f66bb1
commit
2b4b6c5613
4 changed files with 34 additions and 12 deletions
|
@ -42,11 +42,6 @@ DecoderErrorOr<void> Decoder::receive_sample(Span<u8 const> chunk_data)
|
|||
return {};
|
||||
}
|
||||
|
||||
DecoderErrorOr<void> Decoder::receive_sample(ByteBuffer const& chunk_data)
|
||||
{
|
||||
return receive_sample(chunk_data.span());
|
||||
}
|
||||
|
||||
void Decoder::dump_frame_info()
|
||||
{
|
||||
m_parser->dump_info();
|
||||
|
|
|
@ -13,23 +13,24 @@
|
|||
#include <AK/Span.h>
|
||||
#include <LibVideo/Color/CodingIndependentCodePoints.h>
|
||||
#include <LibVideo/DecoderError.h>
|
||||
#include <LibVideo/VideoDecoder.h>
|
||||
#include <LibVideo/VideoFrame.h>
|
||||
|
||||
#include "Parser.h"
|
||||
|
||||
namespace Video::VP9 {
|
||||
|
||||
class Decoder {
|
||||
class Decoder : public VideoDecoder {
|
||||
friend class Parser;
|
||||
|
||||
public:
|
||||
Decoder();
|
||||
~Decoder() override { }
|
||||
/* (8.1) General */
|
||||
DecoderErrorOr<void> receive_sample(Span<u8 const>);
|
||||
DecoderErrorOr<void> receive_sample(ByteBuffer const&);
|
||||
DecoderErrorOr<void> receive_sample(Span<u8 const>) override;
|
||||
void dump_frame_info();
|
||||
|
||||
DecoderErrorOr<NonnullOwnPtr<VideoFrame>> get_decoded_frame();
|
||||
DecoderErrorOr<NonnullOwnPtr<VideoFrame>> get_decoded_frame() override;
|
||||
|
||||
private:
|
||||
typedef i32 Intermediate;
|
||||
|
|
26
Userland/Libraries/LibVideo/VideoDecoder.h
Normal file
26
Userland/Libraries/LibVideo/VideoDecoder.h
Normal 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;
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue