OSDN Git Service

Added option to choose between 8-Bit and 10-Bit encoding at runtime. We now include...
[x264-launcher/x264-launcher.git] / src / avisynth_c.h
1 // Avisynth C Interface Version 0.20
2 // Copyright 2003 Kevin Atkinson
3
4 // This program is free software; you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation; either version 2 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA, or visit
17 // http://www.gnu.org/copyleft/gpl.html .
18 //
19 // As a special exception, I give you permission to link to the
20 // Avisynth C interface with independent modules that communicate with
21 // the Avisynth C interface solely through the interfaces defined in
22 // avisynth_c.h, regardless of the license terms of these independent
23 // modules, and to copy and distribute the resulting combined work
24 // under terms of your choice, provided that every copy of the
25 // combined work is accompanied by a complete copy of the source code
26 // of the Avisynth C interface and Avisynth itself (with the version
27 // used to produce the combined work), being distributed under the
28 // terms of the GNU General Public License plus this exception.  An
29 // independent module is a module which is not derived from or based
30 // on Avisynth C Interface, such as 3rd-party filters, import and
31 // export plugins, or graphical user interfaces.
32
33 // NOTE: this is a partial update of the Avisynth C interface to recognize
34 // new color spaces added in Avisynth 2.60. By no means is this document
35 // completely Avisynth 2.60 compliant.
36
37 #ifndef __AVISYNTH_C__
38 #define __AVISYNTH_C__
39
40 /* AVS uses a versioned interface to control backwards compatibility */
41 #define AVS_INTERFACE_25 2
42
43 /* Types */
44 typedef struct AVS_Clip AVS_Clip;
45 typedef struct AVS_ScriptEnvironment AVS_ScriptEnvironment;
46
47 /* AVS_Value is layed out identicly to AVSValue */
48 typedef struct AVS_Value AVS_Value;
49 struct AVS_Value
50 {
51         short type; // 'a'rray, 'c'lip, 'b'ool, 'i'nt, 'f'loat, 's'tring, 'v'oid, or 'l'ong
52         short array_size;
53         union
54         {
55                 void * clip; // do not use directly, use avs_take_clip
56                 char boolean;
57                 int integer;
58                 float floating_pt;
59                 const char * string;
60                 const AVS_Value * array;
61         } d;
62 };
63
64 /* Function pointers */
65 typedef AVS_ScriptEnvironment* (__stdcall *avs_create_script_environment_func)(int version);
66 typedef AVS_Value (__stdcall *avs_invoke_func)(AVS_ScriptEnvironment *, const char * name, AVS_Value args, const char** arg_names);
67 typedef int (__stdcall *avs_function_exists_func)(AVS_ScriptEnvironment *, const char * name);
68 typedef void (__stdcall *avs_delete_script_environment_func)(AVS_ScriptEnvironment *);
69
70 /* Inline functions */
71 inline static int avs_is_int(AVS_Value v) { return v.type == 'i'; }
72 inline static int avs_is_float(AVS_Value v) { return v.type == 'f' || v.type == 'i'; }
73 inline static int avs_is_error(AVS_Value v) { return v.type == 'e'; }
74 inline static int avs_as_bool(AVS_Value v) { return v.d.boolean; }
75 inline static double avs_as_float(AVS_Value v) { return avs_is_int(v) ? v.d.integer : v.d.floating_pt; }
76 inline static AVS_Value avs_new_value_array(AVS_Value * v0, int size) { AVS_Value v; v.type = 'a'; v.d.array = v0; v.array_size = size; return v; }
77
78 #endif //__AVISYNTH_C__