|
@@ -32,12 +32,11 @@
|
|
#define AVSC_NO_DECLSPEC
|
|
#define AVSC_NO_DECLSPEC
|
|
|
|
|
|
/* Platform-specific directives for AviSynth vs AvxSynth. */
|
|
/* Platform-specific directives for AviSynth vs AvxSynth. */
|
|
-#ifdef _WIN32
|
|
|
|
|
|
+#if CONFIG_AVISYNTH
|
|
#include <windows.h>
|
|
#include <windows.h>
|
|
#undef EXTERN_C
|
|
#undef EXTERN_C
|
|
#include <avisynth/avisynth_c.h>
|
|
#include <avisynth/avisynth_c.h>
|
|
#define AVISYNTH_LIB "avisynth"
|
|
#define AVISYNTH_LIB "avisynth"
|
|
- #define USING_AVISYNTH
|
|
|
|
#else
|
|
#else
|
|
#include <dlfcn.h>
|
|
#include <dlfcn.h>
|
|
#include <avxsynth/avxsynth_c.h>
|
|
#include <avxsynth/avxsynth_c.h>
|
|
@@ -66,7 +65,7 @@ typedef struct AviSynthLibrary {
|
|
AVSC_DECLARE_FUNC(avs_release_value);
|
|
AVSC_DECLARE_FUNC(avs_release_value);
|
|
AVSC_DECLARE_FUNC(avs_release_video_frame);
|
|
AVSC_DECLARE_FUNC(avs_release_video_frame);
|
|
AVSC_DECLARE_FUNC(avs_take_clip);
|
|
AVSC_DECLARE_FUNC(avs_take_clip);
|
|
-#ifdef USING_AVISYNTH
|
|
|
|
|
|
+#if CONFIG_AVISYNTH
|
|
AVSC_DECLARE_FUNC(avs_bits_per_pixel);
|
|
AVSC_DECLARE_FUNC(avs_bits_per_pixel);
|
|
AVSC_DECLARE_FUNC(avs_get_height_p);
|
|
AVSC_DECLARE_FUNC(avs_get_height_p);
|
|
AVSC_DECLARE_FUNC(avs_get_pitch_p);
|
|
AVSC_DECLARE_FUNC(avs_get_pitch_p);
|
|
@@ -146,7 +145,7 @@ static av_cold int avisynth_load_library(void)
|
|
LOAD_AVS_FUNC(avs_release_value, 0);
|
|
LOAD_AVS_FUNC(avs_release_value, 0);
|
|
LOAD_AVS_FUNC(avs_release_video_frame, 0);
|
|
LOAD_AVS_FUNC(avs_release_video_frame, 0);
|
|
LOAD_AVS_FUNC(avs_take_clip, 0);
|
|
LOAD_AVS_FUNC(avs_take_clip, 0);
|
|
-#ifdef USING_AVISYNTH
|
|
|
|
|
|
+#if CONFIG_AVISYNTH
|
|
LOAD_AVS_FUNC(avs_bits_per_pixel, 1);
|
|
LOAD_AVS_FUNC(avs_bits_per_pixel, 1);
|
|
LOAD_AVS_FUNC(avs_get_height_p, 1);
|
|
LOAD_AVS_FUNC(avs_get_height_p, 1);
|
|
LOAD_AVS_FUNC(avs_get_pitch_p, 1);
|
|
LOAD_AVS_FUNC(avs_get_pitch_p, 1);
|
|
@@ -253,7 +252,7 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st)
|
|
avpriv_set_pts_info(st, 32, avs->vi->fps_denominator, avs->vi->fps_numerator);
|
|
avpriv_set_pts_info(st, 32, avs->vi->fps_denominator, avs->vi->fps_numerator);
|
|
|
|
|
|
switch (avs->vi->pixel_type) {
|
|
switch (avs->vi->pixel_type) {
|
|
-#ifdef USING_AVISYNTH
|
|
|
|
|
|
+#if CONFIG_AVISYNTH
|
|
/* 10~16-bit YUV pix_fmts (AviSynth+) */
|
|
/* 10~16-bit YUV pix_fmts (AviSynth+) */
|
|
case AVS_CS_YUV444P10:
|
|
case AVS_CS_YUV444P10:
|
|
st->codecpar->format = AV_PIX_FMT_YUV444P10;
|
|
st->codecpar->format = AV_PIX_FMT_YUV444P10;
|
|
@@ -509,7 +508,7 @@ static int avisynth_open_file(AVFormatContext *s)
|
|
AviSynthContext *avs = s->priv_data;
|
|
AviSynthContext *avs = s->priv_data;
|
|
AVS_Value arg, val;
|
|
AVS_Value arg, val;
|
|
int ret;
|
|
int ret;
|
|
-#ifdef USING_AVISYNTH
|
|
|
|
|
|
+#if CONFIG_AVISYNTH
|
|
char filename_ansi[MAX_PATH * 4];
|
|
char filename_ansi[MAX_PATH * 4];
|
|
wchar_t filename_wc[MAX_PATH * 4];
|
|
wchar_t filename_wc[MAX_PATH * 4];
|
|
#endif
|
|
#endif
|
|
@@ -517,7 +516,7 @@ static int avisynth_open_file(AVFormatContext *s)
|
|
if (ret = avisynth_context_create(s))
|
|
if (ret = avisynth_context_create(s))
|
|
return ret;
|
|
return ret;
|
|
|
|
|
|
-#ifdef USING_AVISYNTH
|
|
|
|
|
|
+#if CONFIG_AVISYNTH
|
|
/* Convert UTF-8 to ANSI code page */
|
|
/* Convert UTF-8 to ANSI code page */
|
|
MultiByteToWideChar(CP_UTF8, 0, s->filename, -1, filename_wc, MAX_PATH * 4);
|
|
MultiByteToWideChar(CP_UTF8, 0, s->filename, -1, filename_wc, MAX_PATH * 4);
|
|
WideCharToMultiByte(CP_THREAD_ACP, 0, filename_wc, -1, filename_ansi,
|
|
WideCharToMultiByte(CP_THREAD_ACP, 0, filename_wc, -1, filename_ansi,
|
|
@@ -541,7 +540,7 @@ static int avisynth_open_file(AVFormatContext *s)
|
|
avs->clip = avs_library.avs_take_clip(val, avs->env);
|
|
avs->clip = avs_library.avs_take_clip(val, avs->env);
|
|
avs->vi = avs_library.avs_get_video_info(avs->clip);
|
|
avs->vi = avs_library.avs_get_video_info(avs->clip);
|
|
|
|
|
|
-#ifdef USING_AVISYNTH
|
|
|
|
|
|
+#if CONFIG_AVISYNTH
|
|
/* On Windows, libav supports AviSynth interface version 6 or higher.
|
|
/* On Windows, libav supports AviSynth interface version 6 or higher.
|
|
* This includes AviSynth 2.6 RC1 or higher, and AviSynth+ r1718 or higher,
|
|
* This includes AviSynth 2.6 RC1 or higher, and AviSynth+ r1718 or higher,
|
|
* and excludes 2.5 and the 2.6 alphas. Since AvxSynth identifies itself
|
|
* and excludes 2.5 and the 2.6 alphas. Since AvxSynth identifies itself
|
|
@@ -605,7 +604,7 @@ static int avisynth_read_packet_video(AVFormatContext *s, AVPacket *pkt,
|
|
if (discard)
|
|
if (discard)
|
|
return 0;
|
|
return 0;
|
|
|
|
|
|
-#ifdef USING_AVISYNTH
|
|
|
|
|
|
+#if CONFIG_AVISYNTH
|
|
/* Detect whether we're using AviSynth 2.6 or AviSynth+ by
|
|
/* Detect whether we're using AviSynth 2.6 or AviSynth+ by
|
|
* looking for whether avs_is_planar_rgb exists. */
|
|
* looking for whether avs_is_planar_rgb exists. */
|
|
if (GetProcAddress(avs_library.library, "avs_is_planar_rgb") == NULL)
|
|
if (GetProcAddress(avs_library.library, "avs_is_planar_rgb") == NULL)
|
|
@@ -649,7 +648,7 @@ static int avisynth_read_packet_video(AVFormatContext *s, AVPacket *pkt,
|
|
dst_p = pkt->data;
|
|
dst_p = pkt->data;
|
|
for (i = 0; i < avs->n_planes; i++) {
|
|
for (i = 0; i < avs->n_planes; i++) {
|
|
plane = avs->planes[i];
|
|
plane = avs->planes[i];
|
|
-#ifdef USING_AVISYNTH
|
|
|
|
|
|
+#if CONFIG_AVISYNTH
|
|
src_p = avs_library.avs_get_read_ptr_p(frame, plane);
|
|
src_p = avs_library.avs_get_read_ptr_p(frame, plane);
|
|
pitch = avs_library.avs_get_pitch_p(frame, plane);
|
|
pitch = avs_library.avs_get_pitch_p(frame, plane);
|
|
|
|
|