2024-12-04 08:06:35 +00:00
|
|
|
#pragma once
|
2024-10-08 02:29:00 +00:00
|
|
|
|
2024-11-02 02:19:01 +00:00
|
|
|
#include <filesystem>
|
|
|
|
|
2024-10-10 07:23:13 +00:00
|
|
|
extern "C" {
|
2024-10-08 02:29:00 +00:00
|
|
|
#include <libavcodec/avcodec.h>
|
|
|
|
#include <libavformat/avformat.h>
|
2024-10-10 07:23:13 +00:00
|
|
|
}
|
2024-10-08 02:29:00 +00:00
|
|
|
|
2024-12-17 16:24:51 +00:00
|
|
|
namespace video2x {
|
|
|
|
namespace decoder {
|
|
|
|
|
2024-11-17 00:00:00 +00:00
|
|
|
class Decoder {
|
|
|
|
public:
|
|
|
|
Decoder();
|
|
|
|
~Decoder();
|
|
|
|
|
|
|
|
int init(AVHWDeviceType hw_type, AVBufferRef *hw_ctx, const std::filesystem::path &in_fpath);
|
|
|
|
|
|
|
|
AVFormatContext *get_format_context() const;
|
|
|
|
AVCodecContext *get_codec_context() const;
|
|
|
|
int get_video_stream_index() const;
|
|
|
|
|
|
|
|
private:
|
2024-12-02 07:24:30 +00:00
|
|
|
static AVPixelFormat hw_pix_fmt_;
|
|
|
|
static AVPixelFormat get_hw_format(AVCodecContext *ctx, const AVPixelFormat *pix_fmts);
|
2024-11-17 00:00:00 +00:00
|
|
|
|
|
|
|
AVFormatContext *fmt_ctx_;
|
|
|
|
AVCodecContext *dec_ctx_;
|
|
|
|
int in_vstream_idx_;
|
|
|
|
};
|
2024-12-17 16:24:51 +00:00
|
|
|
|
|
|
|
} // namespace decoder
|
|
|
|
} // namespace video2x
|