fix(libvideo2x): fixed wide character string paths on Windows

This commit is contained in:
k4yt3x
2024-11-01 22:19:01 -04:00
parent a8b952c3ad
commit 94e69f9f62
8 changed files with 84 additions and 36 deletions

View File

@@ -1,6 +1,8 @@
#ifndef DECODER_H
#define DECODER_H
#include <filesystem>
extern "C" {
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
@@ -9,7 +11,7 @@ extern "C" {
int init_decoder(
AVHWDeviceType hw_type,
AVBufferRef *hw_ctx,
const char *in_fname,
std::filesystem::path in_fpath,
AVFormatContext **fmt_ctx,
AVCodecContext **dec_ctx,
int *vstream_idx

View File

@@ -1,6 +1,8 @@
#ifndef ENCODER_H
#define ENCODER_H
#include <filesystem>
extern "C" {
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
@@ -11,7 +13,7 @@ extern "C" {
int init_encoder(
AVBufferRef *hw_ctx,
const char *out_fname,
std::filesystem::path out_fpath,
AVFormatContext *ifmt_ctx,
AVFormatContext **ofmt_ctx,
AVCodecContext **enc_ctx,

View File

@@ -43,7 +43,11 @@ enum Libvideo2xLogLevel {
struct LibplaceboConfig {
int out_width;
int out_height;
#ifdef _WIN32
const wchar_t *shader_path;
#else
const char *shader_path;
#endif
};
// Configuration for RealESRGAN filter
@@ -51,7 +55,11 @@ struct RealESRGANConfig {
int gpuid;
bool tta_mode;
int scaling_factor;
const char *model;
#ifdef _WIN32
const wchar_t *model_path;
#else
const char *model_path;
#endif
};
// Unified filter configuration
@@ -87,8 +95,13 @@ struct VideoProcessingContext {
// C-compatible process_video function
LIBVIDEO2X_API int process_video(
#ifdef _WIN32
const wchar_t *in_fname,
const wchar_t *out_fname,
#else
const char *in_fname,
const char *out_fname,
#endif
enum Libvideo2xLogLevel log_level,
bool benchmark,
enum AVHWDeviceType hw_device_type,

View File

@@ -17,7 +17,7 @@ class RealesrganFilter : public Filter {
int gpuid;
bool tta_mode;
int scaling_factor;
const char *model;
const std::filesystem::path model_path;
const std::filesystem::path custom_model_param_path;
const std::filesystem::path custom_model_bin_path;
AVRational in_time_base;
@@ -30,7 +30,7 @@ class RealesrganFilter : public Filter {
int gpuid = 0,
bool tta_mode = false,
int scaling_factor = 4,
const char *model = "realesr-animevideov3",
const std::filesystem::path model = std::filesystem::path("realesr-animevideov3"),
const std::filesystem::path custom_model_param_path = std::filesystem::path(),
const std::filesystem::path custom_model_bin_path = std::filesystem::path()
);