26 #define AVSC_NO_DECLSPEC
39 #define AVISYNTH_LIB "avisynth"
43 #if defined (__APPLE__)
44 #define AVISYNTH_LIB "libavxsynth.dylib"
46 #define AVISYNTH_LIB "libavxsynth.so"
49 #define LoadLibrary(x) dlopen(x, RTLD_NOW | RTLD_GLOBAL)
50 #define GetProcAddress dlsym
51 #define FreeLibrary dlclose
56 #define avs_is_yv24(vi) 0
57 #define avs_is_yv16(vi) 0
58 #define avs_is_yv411(vi) 0
59 #define avs_is_y8(vi) 0
64 #define AVSC_DECLARE_FUNC(name) name##_func name
78 #undef AVSC_DECLARE_FUNC
124 #define LOAD_AVS_FUNC(name, continue_on_fail) \
126 avs_library->name = (void*)GetProcAddress(avs_library->library, #name); \
127 if(!continue_on_fail && !avs_library->name) \
167 avs->
env = avs_library->avs_create_script_environment(3);
168 if (avs_library->avs_get_error) {
169 const char *
error = avs_library->avs_get_error(avs->
env);
190 if (avs == avs_ctx_list) {
191 avs_ctx_list = avs->
next;
194 while (prev->
next != avs)
200 avs_library->avs_release_clip(avs->
clip);
204 avs_library->avs_delete_script_environment(avs->
env);
359 char filename_ansi[MAX_PATH * 4];
360 wchar_t filename_wc[MAX_PATH * 4];
368 MultiByteToWideChar(CP_UTF8, 0, s->
filename, -1, filename_wc, MAX_PATH * 4);
369 WideCharToMultiByte(CP_THREAD_ACP, 0, filename_wc, -1, filename_ansi, MAX_PATH * 4, NULL, NULL);
374 val = avs_library->avs_invoke(avs->
env,
"Import", arg, 0);
386 avs->
clip = avs_library->avs_take_clip(
val, avs->
env);
387 avs->
vi = avs_library->avs_get_video_info(avs->
clip);
390 avs_library->avs_release_value(
val);
421 unsigned char *dst_p;
422 const unsigned char *src_p;
423 int n, i, plane, rowsize, planeheight, pitch,
bits;
459 frame = avs_library->avs_get_frame(avs->
clip, n);
460 error = avs_library->avs_clip_get_error(avs->
clip);
469 for (i = 0; i < avs->
n_planes; i++) {
478 src_p = src_p + (planeheight - 1) * pitch;
482 avs_library->avs_bit_blt(avs->
env, dst_p, rowsize, src_p, pitch, rowsize, planeheight);
483 dst_p += rowsize * planeheight;
486 avs_library->avs_release_video_frame(frame);
541 avs_library->avs_get_audio(avs->
clip, pkt->
data, n, samples);
542 error = avs_library->avs_clip_get_error(avs->
clip);
577 pkt->destruct = av_destruct_packet;
621 if ((timestamp >= avs->
vi->
num_frames) || (timestamp > INT_MAX) || (timestamp < 0))