2024-06-19 18:01:41 -05:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2024, Gregory Bertilson <zaggy1024@gmail.com>
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <LibMedia/CodecID.h>
|
2025-08-07 14:33:22 -07:00
|
|
|
#include <LibMedia/Export.h>
|
2024-06-19 18:01:41 -05:00
|
|
|
#include <LibMedia/VideoDecoder.h>
|
|
|
|
|
|
|
|
|
|
#include "FFmpegForward.h"
|
|
|
|
|
|
|
|
|
|
namespace Media::FFmpeg {
|
|
|
|
|
|
2025-08-07 14:33:22 -07:00
|
|
|
class MEDIA_API FFmpegVideoDecoder final : public VideoDecoder {
|
2024-06-19 18:01:41 -05:00
|
|
|
public:
|
2024-06-19 18:22:21 -05:00
|
|
|
static DecoderErrorOr<NonnullOwnPtr<FFmpegVideoDecoder>> try_create(CodecID, ReadonlyBytes codec_initialization_data);
|
2024-06-19 18:01:41 -05:00
|
|
|
FFmpegVideoDecoder(AVCodecContext* codec_context, AVPacket* packet, AVFrame* frame);
|
|
|
|
|
~FFmpegVideoDecoder();
|
|
|
|
|
|
2025-09-18 19:33:00 -05:00
|
|
|
DecoderErrorOr<void> receive_coded_data(AK::Duration timestamp, ReadonlyBytes coded_data) override;
|
2024-06-19 18:01:41 -05:00
|
|
|
DecoderErrorOr<NonnullOwnPtr<VideoFrame>> get_decoded_frame() override;
|
|
|
|
|
|
2024-06-19 22:26:23 -05:00
|
|
|
void flush() override;
|
|
|
|
|
|
2024-06-19 18:01:41 -05:00
|
|
|
private:
|
|
|
|
|
AVCodecContext* m_codec_context;
|
|
|
|
|
AVPacket* m_packet;
|
|
|
|
|
AVFrame* m_frame;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|