mirror of
https://github.com/k4yt3x/video2x.git
synced 2024-12-29 16:09:10 +00:00
f8dcad3aef
* chore(libvideo2x)!: replace the C API with C++ API * fix: convert wide string to u8 for av_opt_set * style: removed unnecessary enum and struct specifiers Signed-off-by: k4yt3x <i@k4yt3x.com>
32 lines
691 B
C++
32 lines
691 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 AVPixelFormat hw_pix_fmt_;
|
|
static AVPixelFormat get_hw_format(AVCodecContext *ctx, const AVPixelFormat *pix_fmts);
|
|
|
|
AVFormatContext *fmt_ctx_;
|
|
AVCodecContext *dec_ctx_;
|
|
int in_vstream_idx_;
|
|
};
|
|
|
|
#endif // DECODER_H
|