27 #define AVSC_NO_DECLSPEC
35 #define AVISYNTH_LIB "avisynth"
36 #define USING_AVISYNTH
40 #if defined (__APPLE__)
41 #define AVISYNTH_LIB "libavxsynth.dylib"
43 #define AVISYNTH_LIB "libavxsynth.so"
46 #define LoadLibrary(x) dlopen(x, RTLD_NOW | RTLD_LOCAL)
47 #define GetProcAddress dlsym
48 #define FreeLibrary dlclose
53 #define AVSC_DECLARE_FUNC(name) name ## _func name
68 #undef AVSC_DECLARE_FUNC
111 #define LOAD_AVS_FUNC(name, continue_on_fail) \
113 (void *)GetProcAddress(avs_library.library, #name); \
114 if (!continue_on_fail && !avs_library.name) \
153 avs->
env = avs_library.avs_create_script_environment(3);
154 if (avs_library.avs_get_error) {
155 const char *
error = avs_library.avs_get_error(avs->
env);
177 if (avs == avs_ctx_list) {
178 avs_ctx_list = avs->
next;
181 while (prev->
next != avs)
187 avs_library.avs_release_clip(avs->
clip);
191 avs_library.avs_delete_script_environment(avs->
env);
230 #ifdef USING_AVISYNTH
267 "unknown AviSynth colorspace %d\n", avs->
vi->
pixel_type);
355 #ifdef USING_AVISYNTH
356 char filename_ansi[MAX_PATH * 4];
357 wchar_t filename_wc[MAX_PATH * 4];
363 #ifdef USING_AVISYNTH
365 MultiByteToWideChar(CP_UTF8, 0, s->
filename, -1, filename_wc, MAX_PATH * 4);
366 WideCharToMultiByte(CP_THREAD_ACP, 0, filename_wc, -1, filename_ansi,
372 val = avs_library.avs_invoke(avs->
env,
"Import", arg, 0);
384 avs->
clip = avs_library.avs_take_clip(val, avs->
env);
385 avs->
vi = avs_library.avs_get_video_info(avs->
clip);
388 avs_library.avs_release_value(val);
423 unsigned char *dst_p;
424 const unsigned char *src_p;
425 int n, i, plane, rowsize, planeheight, pitch,
bits;
436 #ifdef USING_AVISYNTH
456 (int64_t)avs->
vi->
height) * bits) / 8;
468 frame = avs_library.avs_get_frame(avs->
clip, n);
469 error = avs_library.avs_clip_get_error(avs->
clip);
478 for (i = 0; i < avs->
n_planes; i++) {
483 #ifdef USING_AVISYNTH
484 if (avs_library.avs_get_version(avs->
clip) == 3) {
498 src_p = src_p + (planeheight - 1) * pitch;
502 avs_library.avs_bit_blt(avs->
env, dst_p, rowsize, src_p, pitch,
503 rowsize, planeheight);
504 dst_p += rowsize * planeheight;
507 avs_library.avs_release_video_frame(frame);
567 avs_library.avs_get_audio(avs->
clip, pkt->
data, n, samples);
568 error = avs_library.avs_clip_get_error(avs->
clip);
636 int64_t timestamp,
int flags)
653 (timestamp > INT_MAX) ||