27 #define AVSC_NO_DECLSPEC
41 #define AVISYNTH_LIB "avisynth"
45 #if defined (__APPLE__)
46 #define AVISYNTH_LIB "libavxsynth.dylib"
48 #define AVISYNTH_LIB "libavxsynth.so"
51 #define LoadLibrary(x) dlopen(x, RTLD_NOW | RTLD_GLOBAL)
52 #define GetProcAddress dlsym
53 #define FreeLibrary dlclose
58 #define avs_is_yv24(vi) 0
59 #define avs_is_yv16(vi) 0
60 #define avs_is_yv411(vi) 0
61 #define avs_is_y8(vi) 0
66 #define AVSC_DECLARE_FUNC(name) name##_func name
81 #undef AVSC_DECLARE_FUNC
127 #define LOAD_AVS_FUNC(name, continue_on_fail) \
129 avs_library->name = (void*)GetProcAddress(avs_library->library, #name); \
130 if(!continue_on_fail && !avs_library->name) \
171 avs->
env = avs_library->avs_create_script_environment(3);
172 if (avs_library->avs_get_error) {
173 const char *
error = avs_library->avs_get_error(avs->
env);
194 if (avs == avs_ctx_list) {
195 avs_ctx_list = avs->
next;
198 while (prev->
next != avs)
204 avs_library->avs_release_clip(avs->
clip);
208 avs_library->avs_delete_script_environment(avs->
env);
363 char filename_ansi[MAX_PATH * 4];
364 wchar_t filename_wc[MAX_PATH * 4];
372 MultiByteToWideChar(CP_UTF8, 0, s->
filename, -1, filename_wc, MAX_PATH * 4);
373 WideCharToMultiByte(CP_THREAD_ACP, 0, filename_wc, -1, filename_ansi, MAX_PATH * 4, NULL, NULL);
378 val = avs_library->avs_invoke(avs->
env,
"Import", arg, 0);
390 avs->
clip = avs_library->avs_take_clip(
val, avs->
env);
391 avs->
vi = avs_library->avs_get_video_info(avs->
clip);
394 avs_library->avs_release_value(
val);
425 unsigned char *dst_p;
426 const unsigned char *src_p;
427 int n, i, plane, rowsize, planeheight, pitch,
bits;
463 frame = avs_library->avs_get_frame(avs->
clip, n);
464 error = avs_library->avs_clip_get_error(avs->
clip);
473 for (i = 0; i < avs->
n_planes; i++) {
479 if (avs_library->avs_get_version(avs->
clip) == 3) {
493 src_p = src_p + (planeheight - 1) * pitch;
497 avs_library->avs_bit_blt(avs->
env, dst_p, rowsize, src_p, pitch, rowsize, planeheight);
498 dst_p += rowsize * planeheight;
501 avs_library->avs_release_video_frame(frame);
556 avs_library->avs_get_audio(avs->
clip, pkt->
data, n, samples);
557 error = avs_library->avs_clip_get_error(avs->
clip);
592 pkt->destruct = av_destruct_packet;
636 if ((timestamp >= avs->
vi->
num_frames) || (timestamp > INT_MAX) || (timestamp < 0))