Add vapoursynth-script pkg-config file.
[vapoursynth-svn.git] / include / vapoursynth_api.h
blobcb2cb4add38bd1ab320c5379b0c09f043ed3f5d8
1 #ifndef __PYX_HAVE_API__vapoursynth
2 #define __PYX_HAVE_API__vapoursynth
3 #include "Python.h"
4 #include "vapoursynth.h"
6 static int (*__pyx_f_11vapoursynth_vpy_evaluateScript)(struct VPYScriptExport *, char const *, char const *) = 0;
7 #define vpy_evaluateScript __pyx_f_11vapoursynth_vpy_evaluateScript
8 static void (*__pyx_f_11vapoursynth_vpy_freeScript)(struct VPYScriptExport *) = 0;
9 #define vpy_freeScript __pyx_f_11vapoursynth_vpy_freeScript
10 static char *(*__pyx_f_11vapoursynth_vpy_getError)(struct VPYScriptExport *) = 0;
11 #define vpy_getError __pyx_f_11vapoursynth_vpy_getError
12 static VSNodeRef *(*__pyx_f_11vapoursynth_vpy_getOutput)(struct VPYScriptExport *, int) = 0;
13 #define vpy_getOutput __pyx_f_11vapoursynth_vpy_getOutput
14 static void (*__pyx_f_11vapoursynth_vpy_clearOutput)(struct VPYScriptExport *, int) = 0;
15 #define vpy_clearOutput __pyx_f_11vapoursynth_vpy_clearOutput
16 static VSCore *(*__pyx_f_11vapoursynth_vpy_getCore)(struct VPYScriptExport *) = 0;
17 #define vpy_getCore __pyx_f_11vapoursynth_vpy_getCore
18 static VSAPI const *(*__pyx_f_11vapoursynth_vpy_getVSApi)(void) = 0;
19 #define vpy_getVSApi __pyx_f_11vapoursynth_vpy_getVSApi
20 static int (*__pyx_f_11vapoursynth_vpy_getVariable)(struct VPYScriptExport *, char const *, VSMap *) = 0;
21 #define vpy_getVariable __pyx_f_11vapoursynth_vpy_getVariable
22 static void (*__pyx_f_11vapoursynth_vpy_setVariable)(struct VPYScriptExport *, VSMap const *) = 0;
23 #define vpy_setVariable __pyx_f_11vapoursynth_vpy_setVariable
24 static int (*__pyx_f_11vapoursynth_vpy_clearVariable)(struct VPYScriptExport *, char const *) = 0;
25 #define vpy_clearVariable __pyx_f_11vapoursynth_vpy_clearVariable
26 static void (*__pyx_f_11vapoursynth_vpy_clearEnvironment)(struct VPYScriptExport *) = 0;
27 #define vpy_clearEnvironment __pyx_f_11vapoursynth_vpy_clearEnvironment
28 static void (*__pyx_f_11vapoursynth_vpy_initVSScript)(void) = 0;
29 #define vpy_initVSScript __pyx_f_11vapoursynth_vpy_initVSScript
30 #if !defined(__Pyx_PyIdentifier_FromString)
31 #if PY_MAJOR_VERSION < 3
32 #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s)
33 #else
34 #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s)
35 #endif
36 #endif
38 #ifndef __PYX_HAVE_RT_ImportModule
39 #define __PYX_HAVE_RT_ImportModule
40 static PyObject *__Pyx_ImportModule(const char *name) {
41 PyObject *py_name = 0;
42 PyObject *py_module = 0;
43 py_name = __Pyx_PyIdentifier_FromString(name);
44 if (!py_name)
45 goto bad;
46 py_module = PyImport_Import(py_name);
47 Py_DECREF(py_name);
48 return py_module;
49 bad:
50 Py_XDECREF(py_name);
51 return 0;
53 #endif
55 #ifndef __PYX_HAVE_RT_ImportFunction
56 #define __PYX_HAVE_RT_ImportFunction
57 static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig) {
58 PyObject *d = 0;
59 PyObject *cobj = 0;
60 union {
61 void (*fp)(void);
62 void *p;
63 } tmp;
64 d = PyObject_GetAttrString(module, (char *)"__pyx_capi__");
65 if (!d)
66 goto bad;
67 cobj = PyDict_GetItemString(d, funcname);
68 if (!cobj) {
69 PyErr_Format(PyExc_ImportError,
70 "%s does not export expected C function %s",
71 PyModule_GetName(module), funcname);
72 goto bad;
74 #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3 && PY_MINOR_VERSION==0)
75 if (!PyCapsule_IsValid(cobj, sig)) {
76 PyErr_Format(PyExc_TypeError,
77 "C function %s.%s has wrong signature (expected %s, got %s)",
78 PyModule_GetName(module), funcname, sig, PyCapsule_GetName(cobj));
79 goto bad;
81 tmp.p = PyCapsule_GetPointer(cobj, sig);
82 #else
83 {const char *desc, *s1, *s2;
84 desc = (const char *)PyCObject_GetDesc(cobj);
85 if (!desc)
86 goto bad;
87 s1 = desc; s2 = sig;
88 while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; }
89 if (*s1 != *s2) {
90 PyErr_Format(PyExc_TypeError,
91 "C function %s.%s has wrong signature (expected %s, got %s)",
92 PyModule_GetName(module), funcname, sig, desc);
93 goto bad;
95 tmp.p = PyCObject_AsVoidPtr(cobj);}
96 #endif
97 *f = tmp.fp;
98 if (!(*f))
99 goto bad;
100 Py_DECREF(d);
101 return 0;
102 bad:
103 Py_XDECREF(d);
104 return -1;
106 #endif
109 static int import_vapoursynth(void) {
110 PyObject *module = 0;
111 module = __Pyx_ImportModule("vapoursynth");
112 if (!module) goto bad;
113 if (__Pyx_ImportFunction(module, "vpy_evaluateScript", (void (**)(void))&__pyx_f_11vapoursynth_vpy_evaluateScript, "int (struct VPYScriptExport *, char const *, char const *)") < 0) goto bad;
114 if (__Pyx_ImportFunction(module, "vpy_freeScript", (void (**)(void))&__pyx_f_11vapoursynth_vpy_freeScript, "void (struct VPYScriptExport *)") < 0) goto bad;
115 if (__Pyx_ImportFunction(module, "vpy_getError", (void (**)(void))&__pyx_f_11vapoursynth_vpy_getError, "char *(struct VPYScriptExport *)") < 0) goto bad;
116 if (__Pyx_ImportFunction(module, "vpy_getOutput", (void (**)(void))&__pyx_f_11vapoursynth_vpy_getOutput, "VSNodeRef *(struct VPYScriptExport *, int)") < 0) goto bad;
117 if (__Pyx_ImportFunction(module, "vpy_clearOutput", (void (**)(void))&__pyx_f_11vapoursynth_vpy_clearOutput, "void (struct VPYScriptExport *, int)") < 0) goto bad;
118 if (__Pyx_ImportFunction(module, "vpy_getCore", (void (**)(void))&__pyx_f_11vapoursynth_vpy_getCore, "VSCore *(struct VPYScriptExport *)") < 0) goto bad;
119 if (__Pyx_ImportFunction(module, "vpy_getVSApi", (void (**)(void))&__pyx_f_11vapoursynth_vpy_getVSApi, "VSAPI const *(void)") < 0) goto bad;
120 if (__Pyx_ImportFunction(module, "vpy_getVariable", (void (**)(void))&__pyx_f_11vapoursynth_vpy_getVariable, "int (struct VPYScriptExport *, char const *, VSMap *)") < 0) goto bad;
121 if (__Pyx_ImportFunction(module, "vpy_setVariable", (void (**)(void))&__pyx_f_11vapoursynth_vpy_setVariable, "void (struct VPYScriptExport *, VSMap const *)") < 0) goto bad;
122 if (__Pyx_ImportFunction(module, "vpy_clearVariable", (void (**)(void))&__pyx_f_11vapoursynth_vpy_clearVariable, "int (struct VPYScriptExport *, char const *)") < 0) goto bad;
123 if (__Pyx_ImportFunction(module, "vpy_clearEnvironment", (void (**)(void))&__pyx_f_11vapoursynth_vpy_clearEnvironment, "void (struct VPYScriptExport *)") < 0) goto bad;
124 if (__Pyx_ImportFunction(module, "vpy_initVSScript", (void (**)(void))&__pyx_f_11vapoursynth_vpy_initVSScript, "void (void)") < 0) goto bad;
125 Py_DECREF(module); module = 0;
126 return 0;
127 bad:
128 Py_XDECREF(module);
129 return -1;
132 #endif /* !__PYX_HAVE_API__vapoursynth */