mirror of
https://github.com/k4yt3x/video2x.git
synced 2026-02-04 03:22:07 +08:00
refactor(libvideo2x): convert the video processor into a class (#1246)
Signed-off-by: k4yt3x <i@k4yt3x.com>
This commit is contained in:
@@ -3,13 +3,51 @@
|
||||
|
||||
#include <cstdint>
|
||||
#include <filesystem>
|
||||
#include <vector>
|
||||
|
||||
extern "C" {
|
||||
#include <libavcodec/avcodec.h>
|
||||
#include <libavformat/avformat.h>
|
||||
#include <libavutil/pixdesc.h>
|
||||
}
|
||||
|
||||
#include "libvideo2x/libvideo2x.h"
|
||||
#include "fsutils.h"
|
||||
|
||||
// Encoder configurations
|
||||
struct EncoderConfig {
|
||||
// Non-AVCodecContext options
|
||||
AVCodecID codec;
|
||||
bool copy_streams;
|
||||
|
||||
// Basic video options
|
||||
int width;
|
||||
int height;
|
||||
int frm_rate_mul;
|
||||
AVPixelFormat pix_fmt;
|
||||
|
||||
// Rate control and compression
|
||||
int64_t bit_rate;
|
||||
int rc_buffer_size;
|
||||
int rc_min_rate;
|
||||
int rc_max_rate;
|
||||
int qmin;
|
||||
int qmax;
|
||||
|
||||
// GOP and frame structure
|
||||
int gop_size;
|
||||
int max_b_frames;
|
||||
int keyint_min;
|
||||
int refs;
|
||||
|
||||
// Performance and threading
|
||||
int thread_count;
|
||||
|
||||
// Latency and buffering
|
||||
int delay;
|
||||
|
||||
// Extra AVOptions
|
||||
std::vector<std::pair<StringType, StringType>> extra_opts;
|
||||
};
|
||||
|
||||
class Encoder {
|
||||
public:
|
||||
@@ -22,7 +60,6 @@ class Encoder {
|
||||
AVFormatContext *ifmt_ctx,
|
||||
AVCodecContext *dec_ctx,
|
||||
EncoderConfig &enc_cfg,
|
||||
const ProcessorConfig &proc_cfg,
|
||||
int in_vstream_idx
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user