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_GLOBAL)
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);
354 #ifdef USING_AVISYNTH
355 char filename_ansi[MAX_PATH * 4];
356 wchar_t filename_wc[MAX_PATH * 4];
362 #ifdef USING_AVISYNTH
364 MultiByteToWideChar(CP_UTF8, 0, s->
filename, -1, filename_wc, MAX_PATH * 4);
365 WideCharToMultiByte(CP_THREAD_ACP, 0, filename_wc, -1, filename_ansi,
366 MAX_PATH * 4, NULL, NULL);
371 val = avs_library.avs_invoke(avs->
env,
"Import", arg, 0);
383 avs->
clip = avs_library.avs_take_clip(val, avs->
env);
384 avs->
vi = avs_library.avs_get_video_info(avs->
clip);
387 avs_library.avs_release_value(val);
422 unsigned char *dst_p;
423 const unsigned char *src_p;
424 int n, i, plane, rowsize, planeheight, pitch,
bits;
435 #ifdef USING_AVISYNTH
455 (int64_t)avs->
vi->
height) * bits) / 8;
467 frame = avs_library.avs_get_frame(avs->
clip, n);
468 error = avs_library.avs_clip_get_error(avs->
clip);
477 for (i = 0; i < avs->
n_planes; i++) {
482 #ifdef USING_AVISYNTH
483 if (avs_library.avs_get_version(avs->
clip) == 3) {
497 src_p = src_p + (planeheight - 1) * pitch;
501 avs_library.avs_bit_blt(avs->
env, dst_p, rowsize, src_p, pitch,
502 rowsize, planeheight);
503 dst_p += rowsize * planeheight;
506 avs_library.avs_release_video_frame(frame);
566 avs_library.avs_get_audio(avs->
clip, pkt->
data, n, samples);
567 error = avs_library.avs_clip_get_error(avs->
clip);
635 int64_t timestamp,
int flags)
652 (timestamp > INT_MAX) ||