2022-10-29 19:53:24 -05:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2022, Gregory Bertilson <zaggy1024@gmail.com>
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <AK/ByteBuffer.h>
|
|
|
|
|
#include <AK/NonnullOwnPtr.h>
|
2024-06-19 18:29:12 -05:00
|
|
|
#include <AK/Time.h>
|
2022-10-29 19:53:24 -05:00
|
|
|
|
|
|
|
|
#include "DecoderError.h"
|
|
|
|
|
|
2024-06-10 15:04:03 -05:00
|
|
|
namespace Media {
|
2022-10-29 19:53:24 -05:00
|
|
|
|
|
|
|
|
class VideoDecoder {
|
|
|
|
|
public:
|
2024-12-27 18:47:33 -05:00
|
|
|
virtual ~VideoDecoder() { }
|
2022-10-29 19:53:24 -05:00
|
|
|
|
2024-07-16 23:44:30 -06:00
|
|
|
virtual DecoderErrorOr<void> receive_sample(AK::Duration timestamp, ReadonlyBytes sample) = 0;
|
|
|
|
|
DecoderErrorOr<void> receive_sample(AK::Duration timestamp, ByteBuffer const& sample) { return receive_sample(timestamp, sample.span()); }
|
2022-10-29 19:53:24 -05:00
|
|
|
virtual DecoderErrorOr<NonnullOwnPtr<VideoFrame>> get_decoded_frame() = 0;
|
2024-06-19 22:36:27 -05:00
|
|
|
|
2024-06-19 22:26:23 -05:00
|
|
|
virtual void flush() = 0;
|
2022-10-29 19:53:24 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|