mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-06 09:36:08 +00:00
LibMedia: Move FFmpegIOContext into it's own file
This allows it to be reused for video.
This commit is contained in:
parent
2f9d2acdb2
commit
3412935a62
Notes:
github-actions[bot]
2025-03-13 18:35:00 +00:00
Author: https://github.com/Lubrsi
Commit: 3412935a62
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3892
Reviewed-by: https://github.com/ADKaster
5 changed files with 117 additions and 84 deletions
|
@ -9,6 +9,7 @@
|
|||
#include "Loader.h"
|
||||
#include <AK/Error.h>
|
||||
#include <AK/NonnullOwnPtr.h>
|
||||
#include <LibMedia/FFmpeg/FFmpegIOContext.h>
|
||||
|
||||
extern "C" {
|
||||
#include <libavcodec/avcodec.h>
|
||||
|
@ -17,22 +18,9 @@ extern "C" {
|
|||
|
||||
namespace Audio {
|
||||
|
||||
class FFmpegIOContext {
|
||||
public:
|
||||
explicit FFmpegIOContext(AVIOContext*);
|
||||
~FFmpegIOContext();
|
||||
|
||||
static ErrorOr<NonnullOwnPtr<FFmpegIOContext>> create(AK::SeekableStream& stream);
|
||||
|
||||
AVIOContext* avio_context() const { return m_avio_context; }
|
||||
|
||||
private:
|
||||
AVIOContext* m_avio_context { nullptr };
|
||||
};
|
||||
|
||||
class FFmpegLoaderPlugin : public LoaderPlugin {
|
||||
public:
|
||||
explicit FFmpegLoaderPlugin(NonnullOwnPtr<SeekableStream>, NonnullOwnPtr<FFmpegIOContext>);
|
||||
explicit FFmpegLoaderPlugin(NonnullOwnPtr<SeekableStream>, NonnullOwnPtr<Media::FFmpeg::FFmpegIOContext>);
|
||||
virtual ~FFmpegLoaderPlugin();
|
||||
|
||||
static bool sniff(SeekableStream& stream);
|
||||
|
@ -58,7 +46,7 @@ private:
|
|||
AVCodecContext* m_codec_context { nullptr };
|
||||
AVFormatContext* m_format_context { nullptr };
|
||||
AVFrame* m_frame { nullptr };
|
||||
NonnullOwnPtr<FFmpegIOContext> m_io_context;
|
||||
NonnullOwnPtr<Media::FFmpeg::FFmpegIOContext> m_io_context;
|
||||
int m_loaded_samples { 0 };
|
||||
AVPacket* m_packet { nullptr };
|
||||
int m_total_samples { 0 };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue