video2x/include/libvideo2x/decoder.h
k4yt3x 169509b7d4
refactor(*): refactored the encoder and decoder into classes
Signed-off-by: k4yt3x <i@k4yt3x.com>
2024-11-17 00:00:00 +00:00

33 lines
710 B
C++

#ifndef DECODER_H
#define DECODER_H
#include <filesystem>
extern "C" {
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
}
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:
static enum AVPixelFormat hw_pix_fmt_;
static enum AVPixelFormat
get_hw_format(AVCodecContext *ctx, const enum AVPixelFormat *pix_fmts);
AVFormatContext *fmt_ctx_;
AVCodecContext *dec_ctx_;
int in_vstream_idx_;
};
#endif // DECODER_H