blob: 05b00da5dc351a60f2d4aaa4caa4729213c63293 [file] [log] [blame]
Sjoerd Mullenderc4315491992-09-23 14:53:00 +00001/***********************************************************
Guido van Rossum524b5881995-01-04 19:10:35 +00002Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
3The Netherlands.
Sjoerd Mullenderc4315491992-09-23 14:53:00 +00004
5 All Rights Reserved
6
Guido van Rossumd266eb41996-10-25 14:44:06 +00007Permission to use, copy, modify, and distribute this software and its
8documentation for any purpose and without fee is hereby granted,
Sjoerd Mullenderc4315491992-09-23 14:53:00 +00009provided that the above copyright notice appear in all copies and that
Guido van Rossumd266eb41996-10-25 14:44:06 +000010both that copyright notice and this permission notice appear in
Sjoerd Mullenderc4315491992-09-23 14:53:00 +000011supporting documentation, and that the names of Stichting Mathematisch
Guido van Rossumd266eb41996-10-25 14:44:06 +000012Centrum or CWI or Corporation for National Research Initiatives or
13CNRI not be used in advertising or publicity pertaining to
14distribution of the software without specific, written prior
15permission.
Sjoerd Mullenderc4315491992-09-23 14:53:00 +000016
Guido van Rossumd266eb41996-10-25 14:44:06 +000017While CWI is the initial source for this software, a modified version
18is made available by the Corporation for National Research Initiatives
19(CNRI) at the Internet address ftp://ftp.python.org.
20
21STICHTING MATHEMATISCH CENTRUM AND CNRI DISCLAIM ALL WARRANTIES WITH
22REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
23MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH
24CENTRUM OR CNRI BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
25DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
26PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
27TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
28PERFORMANCE OF THIS SOFTWARE.
Sjoerd Mullenderc4315491992-09-23 14:53:00 +000029
30******************************************************************/
31
32
33/* Cl objects */
34
Sjoerd Mullender4e2a4271993-02-16 11:55:17 +000035#define CLDEBUG
36
Sjoerd Mullenderd53a4f31992-09-24 10:37:39 +000037#include <stdarg.h>
Sjoerd Mullenderc4315491992-09-23 14:53:00 +000038#include <cl.h>
Guido van Rossum72429051997-08-12 14:58:54 +000039#if defined(CL_JPEG_SOFTWARE) && !defined(CL_JPEG_COSMO)
40#include <dmedia/cl_cosmo.h>
41#endif
Roger E. Massee474fb31997-01-17 16:00:02 +000042#include "Python.h"
Sjoerd Mullenderc4315491992-09-23 14:53:00 +000043
44typedef struct {
Roger E. Massee474fb31997-01-17 16:00:02 +000045 PyObject_HEAD
Sjoerd Mullenderc4315491992-09-23 14:53:00 +000046 int ob_isCompressor; /* Compressor or Decompressor */
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +000047 CL_Handle ob_compressorHdl;
Sjoerd Mullender4e2a4271993-02-16 11:55:17 +000048 int *ob_paramtypes;
49 int ob_nparams;
Sjoerd Mullenderc4315491992-09-23 14:53:00 +000050} clobject;
51
Roger E. Massee474fb31997-01-17 16:00:02 +000052static PyObject *ClError; /* exception cl.error */
Sjoerd Mullenderd53a4f31992-09-24 10:37:39 +000053
54static int error_handler_called = 0;
55
Sjoerd Mullender4e2a4271993-02-16 11:55:17 +000056/*
57 * We want to use the function prototypes that are available in the C
58 * compiler on the SGI. Because of that, we need to declare the first
59 * argument of the compressor and decompressor methods as "object *",
60 * even though they are really "clobject *". Therefore we cast the
61 * argument to the proper type using this macro.
62 */
63#define SELF ((clobject *) self)
64
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +000065/********************************************************************
66 Utility routines.
67********************************************************************/
Sjoerd Mullenderd53a4f31992-09-24 10:37:39 +000068static void
Sjoerd Mullender3a997271993-02-04 16:43:28 +000069cl_ErrorHandler(CL_Handle handle, int code, const char *fmt, ...)
Sjoerd Mullenderd53a4f31992-09-24 10:37:39 +000070{
71 va_list ap;
72 char errbuf[BUFSIZ]; /* hopefully big enough */
Sjoerd Mullender384f2481992-09-29 16:43:43 +000073 char *p;
Sjoerd Mullenderd53a4f31992-09-24 10:37:39 +000074
Roger E. Massee474fb31997-01-17 16:00:02 +000075 if (PyErr_Occurred()) /* don't change existing error */
Sjoerd Mullender384f2481992-09-29 16:43:43 +000076 return;
Sjoerd Mullenderd53a4f31992-09-24 10:37:39 +000077 error_handler_called = 1;
78 va_start(ap, fmt);
79 vsprintf(errbuf, fmt, ap);
80 va_end(ap);
Sjoerd Mullender384f2481992-09-29 16:43:43 +000081 p = &errbuf[strlen(errbuf) - 1]; /* swat the line feed */
82 if (*p == '\n')
83 *p = 0;
Roger E. Massee474fb31997-01-17 16:00:02 +000084 PyErr_SetString(ClError, errbuf);
Sjoerd Mullenderd53a4f31992-09-24 10:37:39 +000085}
86
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +000087/*
88 * This assumes that params are always in the range 0 to some maximum.
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +000089 */
90static int
Sjoerd Mullender4e2a4271993-02-16 11:55:17 +000091param_type_is_float(clobject *self, int param)
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +000092{
Sjoerd Mullender3a997271993-02-04 16:43:28 +000093 int bufferlength;
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +000094
Sjoerd Mullender4e2a4271993-02-16 11:55:17 +000095 if (self->ob_paramtypes == NULL) {
96 error_handler_called = 0;
97 bufferlength = clQueryParams(self->ob_compressorHdl, 0, 0);
98 if (error_handler_called)
99 return -1;
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000100
Roger E. Massee474fb31997-01-17 16:00:02 +0000101 self->ob_paramtypes = PyMem_NEW(int, bufferlength);
Sjoerd Mullender4e2a4271993-02-16 11:55:17 +0000102 if (self->ob_paramtypes == NULL)
103 return -1;
104 self->ob_nparams = bufferlength / 2;
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000105
Roger E. Massee474fb31997-01-17 16:00:02 +0000106 (void) clQueryParams(self->ob_compressorHdl,
107 self->ob_paramtypes, bufferlength);
Sjoerd Mullender4e2a4271993-02-16 11:55:17 +0000108 if (error_handler_called) {
Roger E. Massee474fb31997-01-17 16:00:02 +0000109 PyMem_DEL(self->ob_paramtypes);
Sjoerd Mullender4e2a4271993-02-16 11:55:17 +0000110 self->ob_paramtypes = NULL;
111 return -1;
112 }
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000113 }
114
Sjoerd Mullender4e2a4271993-02-16 11:55:17 +0000115 if (param < 0 || param >= self->ob_nparams)
116 return -1;
117
118 if (self->ob_paramtypes[param*2 + 1] == CL_FLOATING_ENUM_VALUE ||
119 self->ob_paramtypes[param*2 + 1] == CL_FLOATING_RANGE_VALUE)
120 return 1;
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000121 else
Sjoerd Mullender4e2a4271993-02-16 11:55:17 +0000122 return 0;
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000123}
124
125/********************************************************************
126 Single image compression/decompression.
127********************************************************************/
Roger E. Massee474fb31997-01-17 16:00:02 +0000128static PyObject *
129cl_CompressImage(PyObject *self, PyObject *args)
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000130{
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000131 int compressionScheme, width, height, originalFormat;
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000132 float compressionRatio;
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000133 int frameBufferSize, compressedBufferSize;
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000134 char *frameBuffer;
Roger E. Massee474fb31997-01-17 16:00:02 +0000135 PyObject *compressedBuffer;
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000136
Roger E. Massee474fb31997-01-17 16:00:02 +0000137 if (!PyArg_Parse(args, "(iiiifs#)", &compressionScheme,
138 &width, &height,
139 &originalFormat, &compressionRatio, &frameBuffer,
140 &frameBufferSize))
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000141 return NULL;
142
Roger E. Massee474fb31997-01-17 16:00:02 +0000143 retry:
144 compressedBuffer = PyString_FromStringAndSize(NULL, frameBufferSize);
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000145 if (compressedBuffer == NULL)
146 return NULL;
147
148 compressedBufferSize = frameBufferSize;
149 error_handler_called = 0;
150 if (clCompressImage(compressionScheme, width, height, originalFormat,
151 compressionRatio, (void *) frameBuffer,
152 &compressedBufferSize,
Roger E. Massee474fb31997-01-17 16:00:02 +0000153 (void *) PyString_AsString(compressedBuffer))
Guido van Rossum72429051997-08-12 14:58:54 +0000154 == FAILURE || error_handler_called) {
Roger E. Massee474fb31997-01-17 16:00:02 +0000155 Py_DECREF(compressedBuffer);
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000156 if (!error_handler_called)
Roger E. Massee474fb31997-01-17 16:00:02 +0000157 PyErr_SetString(ClError, "clCompressImage failed");
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000158 return NULL;
159 }
160
161 if (compressedBufferSize > frameBufferSize) {
162 frameBufferSize = compressedBufferSize;
Roger E. Massee474fb31997-01-17 16:00:02 +0000163 Py_DECREF(compressedBuffer);
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000164 goto retry;
165 }
166
167 if (compressedBufferSize < frameBufferSize)
Roger E. Massee474fb31997-01-17 16:00:02 +0000168 if (_PyString_Resize(&compressedBuffer, compressedBufferSize))
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000169 return NULL;
170
171 return compressedBuffer;
172}
173
Roger E. Massee474fb31997-01-17 16:00:02 +0000174static PyObject *
175cl_DecompressImage(PyObject *self, PyObject *args)
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000176{
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000177 int compressionScheme, width, height, originalFormat;
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000178 char *compressedBuffer;
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000179 int compressedBufferSize, frameBufferSize;
Roger E. Massee474fb31997-01-17 16:00:02 +0000180 PyObject *frameBuffer;
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000181
Roger E. Massee474fb31997-01-17 16:00:02 +0000182 if (!PyArg_Parse(args, "(iiiis#)", &compressionScheme, &width, &height,
183 &originalFormat, &compressedBuffer,
184 &compressedBufferSize))
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000185 return NULL;
186
Sjoerd Mullender4e2a4271993-02-16 11:55:17 +0000187 frameBufferSize = width * height * CL_BytesPerPixel(originalFormat);
188
Roger E. Massee474fb31997-01-17 16:00:02 +0000189 frameBuffer = PyString_FromStringAndSize(NULL, frameBufferSize);
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000190 if (frameBuffer == NULL)
191 return NULL;
192
193 error_handler_called = 0;
194 if (clDecompressImage(compressionScheme, width, height, originalFormat,
195 compressedBufferSize, compressedBuffer,
Roger E. Massee474fb31997-01-17 16:00:02 +0000196 (void *) PyString_AsString(frameBuffer))
Guido van Rossum72429051997-08-12 14:58:54 +0000197 == FAILURE || error_handler_called) {
Roger E. Massee474fb31997-01-17 16:00:02 +0000198 Py_DECREF(frameBuffer);
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000199 if (!error_handler_called)
Roger E. Massee474fb31997-01-17 16:00:02 +0000200 PyErr_SetString(ClError, "clDecompressImage failed");
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000201 return NULL;
202 }
203
204 return frameBuffer;
205}
206
207/********************************************************************
208 Sequential compression/decompression.
209********************************************************************/
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000210#define CheckCompressor(self) if ((self)->ob_compressorHdl == NULL) { \
Roger E. Massee474fb31997-01-17 16:00:02 +0000211 PyErr_SetString(PyExc_RuntimeError, "(de)compressor not active"); \
212 return NULL; \
213}
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000214
Roger E. Massee474fb31997-01-17 16:00:02 +0000215static PyObject *
216doClose(clobject *self, PyObject *args, int (*close_func)(CL_Handle))
Sjoerd Mullender37f17b71992-09-25 10:28:20 +0000217{
218 CheckCompressor(self);
219
Roger E. Massee474fb31997-01-17 16:00:02 +0000220 if (!PyArg_NoArgs(args))
Sjoerd Mullender37f17b71992-09-25 10:28:20 +0000221 return NULL;
222
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000223 error_handler_called = 0;
Guido van Rossum72429051997-08-12 14:58:54 +0000224 if ((*close_func)(self->ob_compressorHdl) == FAILURE ||
225 error_handler_called) {
Sjoerd Mullender37f17b71992-09-25 10:28:20 +0000226 if (!error_handler_called)
Roger E. Massee474fb31997-01-17 16:00:02 +0000227 PyErr_SetString(ClError, "close failed");
Sjoerd Mullender37f17b71992-09-25 10:28:20 +0000228 return NULL;
229 }
230
231 self->ob_compressorHdl = NULL;
232
Sjoerd Mullender4e2a4271993-02-16 11:55:17 +0000233 if (self->ob_paramtypes)
Roger E. Massee474fb31997-01-17 16:00:02 +0000234 PyMem_DEL(self->ob_paramtypes);
Sjoerd Mullender4e2a4271993-02-16 11:55:17 +0000235 self->ob_paramtypes = NULL;
236
Roger E. Massee474fb31997-01-17 16:00:02 +0000237 Py_INCREF(Py_None);
238 return Py_None;
Sjoerd Mullender37f17b71992-09-25 10:28:20 +0000239}
240
Roger E. Massee474fb31997-01-17 16:00:02 +0000241static PyObject *
242clm_CloseCompressor(PyObject *self, PyObject *args)
Sjoerd Mullender37f17b71992-09-25 10:28:20 +0000243{
Sjoerd Mullender4e2a4271993-02-16 11:55:17 +0000244 return doClose(SELF, args, clCloseCompressor);
Sjoerd Mullender37f17b71992-09-25 10:28:20 +0000245}
246
Roger E. Massee474fb31997-01-17 16:00:02 +0000247static PyObject *
248clm_CloseDecompressor(PyObject *self, PyObject *args)
Sjoerd Mullender384f2481992-09-29 16:43:43 +0000249{
Sjoerd Mullender4e2a4271993-02-16 11:55:17 +0000250 return doClose(SELF, args, clCloseDecompressor);
Sjoerd Mullender384f2481992-09-29 16:43:43 +0000251}
252
Roger E. Massee474fb31997-01-17 16:00:02 +0000253static PyObject *
254clm_Compress(PyObject *self, PyObject *args)
Sjoerd Mullenderc4315491992-09-23 14:53:00 +0000255{
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000256 int numberOfFrames;
Sjoerd Mullender4e2a4271993-02-16 11:55:17 +0000257 int frameBufferSize, compressedBufferSize, size;
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000258 char *frameBuffer;
Roger E. Massee474fb31997-01-17 16:00:02 +0000259 PyObject *data;
Sjoerd Mullenderc4315491992-09-23 14:53:00 +0000260
Sjoerd Mullender4e2a4271993-02-16 11:55:17 +0000261 CheckCompressor(SELF);
Sjoerd Mullender37f17b71992-09-25 10:28:20 +0000262
Roger E. Massee474fb31997-01-17 16:00:02 +0000263 if (!PyArg_Parse(args, "(is#)", &numberOfFrames,
264 &frameBuffer, &frameBufferSize))
Sjoerd Mullenderc4315491992-09-23 14:53:00 +0000265 return NULL;
266
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000267 error_handler_called = 0;
Sjoerd Mullender4e2a4271993-02-16 11:55:17 +0000268 size = clGetParam(SELF->ob_compressorHdl, CL_COMPRESSED_BUFFER_SIZE);
269 compressedBufferSize = size;
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000270 if (error_handler_called)
271 return NULL;
272
Roger E. Massee474fb31997-01-17 16:00:02 +0000273 data = PyString_FromStringAndSize(NULL, size);
Sjoerd Mullenderc4315491992-09-23 14:53:00 +0000274 if (data == NULL)
275 return NULL;
276
Sjoerd Mullenderd53a4f31992-09-24 10:37:39 +0000277 error_handler_called = 0;
Sjoerd Mullender4e2a4271993-02-16 11:55:17 +0000278 if (clCompress(SELF->ob_compressorHdl, numberOfFrames,
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000279 (void *) frameBuffer, &compressedBufferSize,
Guido van Rossum72429051997-08-12 14:58:54 +0000280 (void *) PyString_AsString(data)) == FAILURE ||
281 error_handler_called) {
Roger E. Massee474fb31997-01-17 16:00:02 +0000282 Py_DECREF(data);
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000283 if (!error_handler_called)
Roger E. Massee474fb31997-01-17 16:00:02 +0000284 PyErr_SetString(ClError, "compress failed");
Sjoerd Mullenderd53a4f31992-09-24 10:37:39 +0000285 return NULL;
286 }
Sjoerd Mullenderc4315491992-09-23 14:53:00 +0000287
Sjoerd Mullender4e2a4271993-02-16 11:55:17 +0000288 if (compressedBufferSize < size)
Roger E. Massee474fb31997-01-17 16:00:02 +0000289 if (_PyString_Resize(&data, compressedBufferSize))
Sjoerd Mullenderc4315491992-09-23 14:53:00 +0000290 return NULL;
291
Sjoerd Mullender4e2a4271993-02-16 11:55:17 +0000292 if (compressedBufferSize > size) {
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000293 /* we didn't get all "compressed" data */
Roger E. Massee474fb31997-01-17 16:00:02 +0000294 Py_DECREF(data);
295 PyErr_SetString(ClError,
296 "compressed data is more than fitted");
Sjoerd Mullender384f2481992-09-29 16:43:43 +0000297 return NULL;
298 }
299
Sjoerd Mullenderd53a4f31992-09-24 10:37:39 +0000300 return data;
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000301}
Sjoerd Mullenderc4315491992-09-23 14:53:00 +0000302
Roger E. Massee474fb31997-01-17 16:00:02 +0000303static PyObject *
304clm_Decompress(PyObject *self, PyObject *args)
Sjoerd Mullenderc4315491992-09-23 14:53:00 +0000305{
Roger E. Massee474fb31997-01-17 16:00:02 +0000306 PyObject *data;
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000307 int numberOfFrames;
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000308 char *compressedData;
Sjoerd Mullender4e2a4271993-02-16 11:55:17 +0000309 int compressedDataSize, dataSize;
Sjoerd Mullenderc4315491992-09-23 14:53:00 +0000310
Sjoerd Mullender4e2a4271993-02-16 11:55:17 +0000311 CheckCompressor(SELF);
Sjoerd Mullender37f17b71992-09-25 10:28:20 +0000312
Roger E. Massee474fb31997-01-17 16:00:02 +0000313 if (!PyArg_Parse(args, "(is#)", &numberOfFrames, &compressedData,
314 &compressedDataSize))
Sjoerd Mullenderc4315491992-09-23 14:53:00 +0000315 return NULL;
316
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000317 error_handler_called = 0;
Sjoerd Mullender4e2a4271993-02-16 11:55:17 +0000318 dataSize = clGetParam(SELF->ob_compressorHdl, CL_FRAME_BUFFER_SIZE);
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000319 if (error_handler_called)
320 return NULL;
321
Roger E. Massee474fb31997-01-17 16:00:02 +0000322 data = PyString_FromStringAndSize(NULL, dataSize);
Sjoerd Mullenderc4315491992-09-23 14:53:00 +0000323 if (data == NULL)
324 return NULL;
325
Sjoerd Mullenderd53a4f31992-09-24 10:37:39 +0000326 error_handler_called = 0;
Sjoerd Mullender4e2a4271993-02-16 11:55:17 +0000327 if (clDecompress(SELF->ob_compressorHdl, numberOfFrames,
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000328 compressedDataSize, (void *) compressedData,
Guido van Rossum72429051997-08-12 14:58:54 +0000329 (void *) PyString_AsString(data)) == FAILURE ||
330 error_handler_called) {
Roger E. Massee474fb31997-01-17 16:00:02 +0000331 Py_DECREF(data);
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000332 if (!error_handler_called)
Roger E. Massee474fb31997-01-17 16:00:02 +0000333 PyErr_SetString(ClError, "decompress failed");
Sjoerd Mullenderd53a4f31992-09-24 10:37:39 +0000334 return NULL;
335 }
Sjoerd Mullenderc4315491992-09-23 14:53:00 +0000336
Sjoerd Mullenderd53a4f31992-09-24 10:37:39 +0000337 return data;
Sjoerd Mullenderc4315491992-09-23 14:53:00 +0000338}
339
Roger E. Massee474fb31997-01-17 16:00:02 +0000340static PyObject *
341doParams(clobject *self, PyObject *args, int (*func)(CL_Handle, int *, int),
Sjoerd Mullender4e2a4271993-02-16 11:55:17 +0000342 int modified)
Sjoerd Mullenderc4315491992-09-23 14:53:00 +0000343{
Roger E. Massee474fb31997-01-17 16:00:02 +0000344 PyObject *list, *v;
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000345 int *PVbuffer;
346 int length;
Sjoerd Mullenderc4315491992-09-23 14:53:00 +0000347 int i;
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000348 float number;
Sjoerd Mullenderc4315491992-09-23 14:53:00 +0000349
Sjoerd Mullender37f17b71992-09-25 10:28:20 +0000350 CheckCompressor(self);
351
Roger E. Massee474fb31997-01-17 16:00:02 +0000352 if (!PyArg_Parse(args, "O", &list))
Sjoerd Mullenderc4315491992-09-23 14:53:00 +0000353 return NULL;
Roger E. Massee474fb31997-01-17 16:00:02 +0000354 if (!PyList_Check(list)) {
355 PyErr_BadArgument();
Sjoerd Mullenderc4315491992-09-23 14:53:00 +0000356 return NULL;
357 }
Roger E. Massee474fb31997-01-17 16:00:02 +0000358 length = PyList_Size(list);
359 PVbuffer = PyMem_NEW(int, length);
Sjoerd Mullenderc4315491992-09-23 14:53:00 +0000360 if (PVbuffer == NULL)
Roger E. Massee474fb31997-01-17 16:00:02 +0000361 return PyErr_NoMemory();
Sjoerd Mullenderc4315491992-09-23 14:53:00 +0000362 for (i = 0; i < length; i++) {
Roger E. Massee474fb31997-01-17 16:00:02 +0000363 v = PyList_GetItem(list, i);
364 if (PyFloat_Check(v)) {
365 number = PyFloat_AsDouble(v);
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000366 PVbuffer[i] = CL_TypeIsInt(number);
Roger E. Massee474fb31997-01-17 16:00:02 +0000367 } else if (PyInt_Check(v)) {
368 PVbuffer[i] = PyInt_AsLong(v);
Sjoerd Mullender4e2a4271993-02-16 11:55:17 +0000369 if ((i & 1) &&
370 param_type_is_float(self, PVbuffer[i-1]) > 0) {
371 number = PVbuffer[i];
372 PVbuffer[i] = CL_TypeIsInt(number);
373 }
374 } else {
Roger E. Massee474fb31997-01-17 16:00:02 +0000375 PyMem_DEL(PVbuffer);
376 PyErr_BadArgument();
Sjoerd Mullenderc4315491992-09-23 14:53:00 +0000377 return NULL;
378 }
Sjoerd Mullenderc4315491992-09-23 14:53:00 +0000379 }
380
Sjoerd Mullenderd53a4f31992-09-24 10:37:39 +0000381 error_handler_called = 0;
Sjoerd Mullenderc4315491992-09-23 14:53:00 +0000382 (*func)(self->ob_compressorHdl, PVbuffer, length);
Sjoerd Mullenderf64992e1993-08-03 15:11:36 +0000383 if (error_handler_called) {
Roger E. Massee474fb31997-01-17 16:00:02 +0000384 PyMem_DEL(PVbuffer);
Sjoerd Mullenderd53a4f31992-09-24 10:37:39 +0000385 return NULL;
Sjoerd Mullenderf64992e1993-08-03 15:11:36 +0000386 }
Sjoerd Mullenderc4315491992-09-23 14:53:00 +0000387
388 if (modified) {
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000389 for (i = 0; i < length; i++) {
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000390 if ((i & 1) &&
Sjoerd Mullender4e2a4271993-02-16 11:55:17 +0000391 param_type_is_float(self, PVbuffer[i-1]) > 0) {
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000392 number = CL_TypeIsFloat(PVbuffer[i]);
Roger E. Massee474fb31997-01-17 16:00:02 +0000393 v = PyFloat_FromDouble(number);
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000394 } else
Roger E. Massee474fb31997-01-17 16:00:02 +0000395 v = PyInt_FromLong(PVbuffer[i]);
396 PyList_SetItem(list, i, v);
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000397 }
Sjoerd Mullenderc4315491992-09-23 14:53:00 +0000398 }
399
Roger E. Massee474fb31997-01-17 16:00:02 +0000400 PyMem_DEL(PVbuffer);
Sjoerd Mullenderc4315491992-09-23 14:53:00 +0000401
Roger E. Massee474fb31997-01-17 16:00:02 +0000402 Py_INCREF(Py_None);
403 return Py_None;
Sjoerd Mullenderc4315491992-09-23 14:53:00 +0000404}
405
Roger E. Massee474fb31997-01-17 16:00:02 +0000406static PyObject *
407clm_GetParams(PyObject *self, PyObject *args)
Sjoerd Mullenderc4315491992-09-23 14:53:00 +0000408{
Sjoerd Mullender4e2a4271993-02-16 11:55:17 +0000409 return doParams(SELF, args, clGetParams, 1);
Sjoerd Mullenderc4315491992-09-23 14:53:00 +0000410}
411
Roger E. Massee474fb31997-01-17 16:00:02 +0000412static PyObject *
413clm_SetParams(PyObject *self, PyObject *args)
Sjoerd Mullenderc4315491992-09-23 14:53:00 +0000414{
Sjoerd Mullender4e2a4271993-02-16 11:55:17 +0000415 return doParams(SELF, args, clSetParams, 0);
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000416}
417
Roger E. Massee474fb31997-01-17 16:00:02 +0000418static PyObject *
419do_get(clobject *self, PyObject *args, int (*func)(CL_Handle, int))
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000420{
421 int paramID, value;
422 float fvalue;
423
424 CheckCompressor(self);
425
Roger E. Massee474fb31997-01-17 16:00:02 +0000426 if (!PyArg_Parse(args, "i", &paramID))
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000427 return NULL;
428
429 error_handler_called = 0;
430 value = (*func)(self->ob_compressorHdl, paramID);
431 if (error_handler_called)
432 return NULL;
433
Sjoerd Mullender4e2a4271993-02-16 11:55:17 +0000434 if (param_type_is_float(self, paramID) > 0) {
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000435 fvalue = CL_TypeIsFloat(value);
Roger E. Massee474fb31997-01-17 16:00:02 +0000436 return PyFloat_FromDouble(fvalue);
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000437 }
438
Roger E. Massee474fb31997-01-17 16:00:02 +0000439 return PyInt_FromLong(value);
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000440}
441
Roger E. Massee474fb31997-01-17 16:00:02 +0000442static PyObject *
443clm_GetParam(PyObject *self, PyObject *args)
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000444{
Sjoerd Mullender4e2a4271993-02-16 11:55:17 +0000445 return do_get(SELF, args, clGetParam);
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000446}
447
Roger E. Massee474fb31997-01-17 16:00:02 +0000448static PyObject *
449clm_GetDefault(PyObject *self, PyObject *args)
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000450{
Sjoerd Mullender4e2a4271993-02-16 11:55:17 +0000451 return do_get(SELF, args, clGetDefault);
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000452}
453
Roger E. Massee474fb31997-01-17 16:00:02 +0000454static PyObject *
455clm_SetParam(PyObject *self, PyObject *args)
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000456{
457 int paramID, value;
458 float fvalue;
459
Sjoerd Mullender4e2a4271993-02-16 11:55:17 +0000460 CheckCompressor(SELF);
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000461
Roger E. Massee474fb31997-01-17 16:00:02 +0000462 if (!PyArg_Parse(args, "(ii)", &paramID, &value)) {
463 PyErr_Clear();
464 if (!PyArg_Parse(args, "(if)", &paramID, &fvalue)) {
465 PyErr_Clear();
466 PyErr_SetString(PyExc_TypeError,
467 "bad argument list (format '(ii)' or '(if)')");
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000468 return NULL;
469 }
470 value = CL_TypeIsInt(fvalue);
Sjoerd Mullender4e2a4271993-02-16 11:55:17 +0000471 } else {
472 if (param_type_is_float(SELF, paramID) > 0) {
473 fvalue = value;
474 value = CL_TypeIsInt(fvalue);
475 }
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000476 }
477
Sjoerd Mullender4e2a4271993-02-16 11:55:17 +0000478 error_handler_called = 0;
479 value = clSetParam(SELF->ob_compressorHdl, paramID, value);
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000480 if (error_handler_called)
481 return NULL;
482
Sjoerd Mullender4e2a4271993-02-16 11:55:17 +0000483 if (param_type_is_float(SELF, paramID) > 0)
Roger E. Massee474fb31997-01-17 16:00:02 +0000484 return PyFloat_FromDouble(CL_TypeIsFloat(value));
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000485 else
Roger E. Massee474fb31997-01-17 16:00:02 +0000486 return PyInt_FromLong(value);
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000487}
488
Roger E. Massee474fb31997-01-17 16:00:02 +0000489static PyObject *
490clm_GetParamID(PyObject *self, PyObject *args)
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000491{
492 char *name;
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000493 int value;
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000494
Sjoerd Mullender4e2a4271993-02-16 11:55:17 +0000495 CheckCompressor(SELF);
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000496
Roger E. Massee474fb31997-01-17 16:00:02 +0000497 if (!PyArg_Parse(args, "s", &name))
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000498 return NULL;
499
500 error_handler_called = 0;
Sjoerd Mullender4e2a4271993-02-16 11:55:17 +0000501 value = clGetParamID(SELF->ob_compressorHdl, name);
Guido van Rossum72429051997-08-12 14:58:54 +0000502 if (value == FAILURE || error_handler_called) {
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000503 if (!error_handler_called)
Roger E. Massee474fb31997-01-17 16:00:02 +0000504 PyErr_SetString(ClError, "getparamid failed");
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000505 return NULL;
506 }
507
Roger E. Massee474fb31997-01-17 16:00:02 +0000508 return PyInt_FromLong(value);
Sjoerd Mullenderc4315491992-09-23 14:53:00 +0000509}
510
Roger E. Massee474fb31997-01-17 16:00:02 +0000511static PyObject *
512clm_QueryParams(PyObject *self, PyObject *args)
Sjoerd Mullenderc4315491992-09-23 14:53:00 +0000513{
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000514 int bufferlength;
515 int *PVbuffer;
Roger E. Massee474fb31997-01-17 16:00:02 +0000516 PyObject *list;
Sjoerd Mullenderc4315491992-09-23 14:53:00 +0000517 int i;
518
Sjoerd Mullender4e2a4271993-02-16 11:55:17 +0000519 CheckCompressor(SELF);
Sjoerd Mullender37f17b71992-09-25 10:28:20 +0000520
Roger E. Massee474fb31997-01-17 16:00:02 +0000521 if (!PyArg_NoArgs(args))
Sjoerd Mullenderc4315491992-09-23 14:53:00 +0000522 return NULL;
523
Sjoerd Mullenderd53a4f31992-09-24 10:37:39 +0000524 error_handler_called = 0;
Sjoerd Mullender4e2a4271993-02-16 11:55:17 +0000525 bufferlength = clQueryParams(SELF->ob_compressorHdl, 0, 0);
Sjoerd Mullenderd53a4f31992-09-24 10:37:39 +0000526 if (error_handler_called)
527 return NULL;
Sjoerd Mullenderc4315491992-09-23 14:53:00 +0000528
Roger E. Massee474fb31997-01-17 16:00:02 +0000529 PVbuffer = PyMem_NEW(int, bufferlength);
Sjoerd Mullenderc4315491992-09-23 14:53:00 +0000530 if (PVbuffer == NULL)
Roger E. Massee474fb31997-01-17 16:00:02 +0000531 return PyErr_NoMemory();
Sjoerd Mullenderc4315491992-09-23 14:53:00 +0000532
Sjoerd Mullender4e2a4271993-02-16 11:55:17 +0000533 bufferlength = clQueryParams(SELF->ob_compressorHdl, PVbuffer,
Sjoerd Mullenderc4315491992-09-23 14:53:00 +0000534 bufferlength);
Sjoerd Mullenderd53a4f31992-09-24 10:37:39 +0000535 if (error_handler_called) {
Roger E. Massee474fb31997-01-17 16:00:02 +0000536 PyMem_DEL(PVbuffer);
Sjoerd Mullenderd53a4f31992-09-24 10:37:39 +0000537 return NULL;
538 }
Sjoerd Mullenderc4315491992-09-23 14:53:00 +0000539
Roger E. Massee474fb31997-01-17 16:00:02 +0000540 list = PyList_New(bufferlength);
Sjoerd Mullenderc4315491992-09-23 14:53:00 +0000541 if (list == NULL) {
Roger E. Massee474fb31997-01-17 16:00:02 +0000542 PyMem_DEL(PVbuffer);
Sjoerd Mullenderc4315491992-09-23 14:53:00 +0000543 return NULL;
544 }
545
Sjoerd Mullenderd53a4f31992-09-24 10:37:39 +0000546 for (i = 0; i < bufferlength; i++) {
547 if (i & 1)
Roger E. Massee474fb31997-01-17 16:00:02 +0000548 PyList_SetItem(list, i, PyInt_FromLong(PVbuffer[i]));
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000549 else if (PVbuffer[i] == 0) {
Roger E. Massee474fb31997-01-17 16:00:02 +0000550 Py_INCREF(Py_None);
551 PyList_SetItem(list, i, Py_None);
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000552 } else
Roger E. Massee474fb31997-01-17 16:00:02 +0000553 PyList_SetItem(list, i,
554 PyString_FromString((char *) PVbuffer[i]));
Sjoerd Mullenderd53a4f31992-09-24 10:37:39 +0000555 }
Sjoerd Mullenderc4315491992-09-23 14:53:00 +0000556
Roger E. Massee474fb31997-01-17 16:00:02 +0000557 PyMem_DEL(PVbuffer);
Sjoerd Mullenderc4315491992-09-23 14:53:00 +0000558
559 return list;
560}
561
Roger E. Massee474fb31997-01-17 16:00:02 +0000562static PyObject *
563clm_GetMinMax(PyObject *self, PyObject *args)
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000564{
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000565 int param, min, max;
566 float fmin, fmax;
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000567
Sjoerd Mullender4e2a4271993-02-16 11:55:17 +0000568 CheckCompressor(SELF);
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000569
Roger E. Massee474fb31997-01-17 16:00:02 +0000570 if (!PyArg_Parse(args, "i", &param))
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000571 return NULL;
572
Sjoerd Mullender4e2a4271993-02-16 11:55:17 +0000573 clGetMinMax(SELF->ob_compressorHdl, param, &min, &max);
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000574
Sjoerd Mullender4e2a4271993-02-16 11:55:17 +0000575 if (param_type_is_float(SELF, param) > 0) {
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000576 fmin = CL_TypeIsFloat(min);
577 fmax = CL_TypeIsFloat(max);
Roger E. Massee474fb31997-01-17 16:00:02 +0000578 return Py_BuildValue("(ff)", fmin, fmax);
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000579 }
580
Roger E. Massee474fb31997-01-17 16:00:02 +0000581 return Py_BuildValue("(ii)", min, max);
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000582}
583
Roger E. Massee474fb31997-01-17 16:00:02 +0000584static PyObject *
585clm_GetName(PyObject *self, PyObject *args)
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000586{
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000587 int param;
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000588 char *name;
589
Sjoerd Mullender4e2a4271993-02-16 11:55:17 +0000590 CheckCompressor(SELF);
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000591
Roger E. Massee474fb31997-01-17 16:00:02 +0000592 if (!PyArg_Parse(args, "i", &param))
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000593 return NULL;
594
595 error_handler_called = 0;
Sjoerd Mullender4e2a4271993-02-16 11:55:17 +0000596 name = clGetName(SELF->ob_compressorHdl, param);
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000597 if (name == NULL || error_handler_called) {
598 if (!error_handler_called)
Roger E. Massee474fb31997-01-17 16:00:02 +0000599 PyErr_SetString(ClError, "getname failed");
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000600 return NULL;
601 }
602
Roger E. Massee474fb31997-01-17 16:00:02 +0000603 return PyString_FromString(name);
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000604}
605
Roger E. Massee474fb31997-01-17 16:00:02 +0000606static PyObject *
607clm_QuerySchemeFromHandle(PyObject *self, PyObject *args)
Sjoerd Mullender4e2a4271993-02-16 11:55:17 +0000608{
609 CheckCompressor(SELF);
610
Roger E. Massee474fb31997-01-17 16:00:02 +0000611 if (!PyArg_NoArgs(args))
Sjoerd Mullender4e2a4271993-02-16 11:55:17 +0000612 return NULL;
613
Roger E. Massee474fb31997-01-17 16:00:02 +0000614 return PyInt_FromLong(clQuerySchemeFromHandle(SELF->ob_compressorHdl));
Sjoerd Mullender4e2a4271993-02-16 11:55:17 +0000615}
616
Roger E. Massee474fb31997-01-17 16:00:02 +0000617static PyObject *
618clm_ReadHeader(PyObject *self, PyObject *args)
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000619{
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000620 char *header;
621 int headerSize;
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000622
Sjoerd Mullender4e2a4271993-02-16 11:55:17 +0000623 CheckCompressor(SELF);
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000624
Roger E. Massee474fb31997-01-17 16:00:02 +0000625 if (!PyArg_Parse(args, "s#", &header, &headerSize))
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000626 return NULL;
627
Roger E. Massee474fb31997-01-17 16:00:02 +0000628 return PyInt_FromLong(clReadHeader(SELF->ob_compressorHdl,
629 headerSize, header));
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000630}
631
Roger E. Massee474fb31997-01-17 16:00:02 +0000632static PyMethodDef compressor_methods[] = {
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000633 {"close", clm_CloseCompressor}, /* alias */
Sjoerd Mullender384f2481992-09-29 16:43:43 +0000634 {"CloseCompressor", clm_CloseCompressor},
635 {"Compress", clm_Compress},
Sjoerd Mullender384f2481992-09-29 16:43:43 +0000636 {"GetDefault", clm_GetDefault},
637 {"GetMinMax", clm_GetMinMax},
638 {"GetName", clm_GetName},
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000639 {"GetParam", clm_GetParam},
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000640 {"GetParamID", clm_GetParamID},
Sjoerd Mullender384f2481992-09-29 16:43:43 +0000641 {"GetParams", clm_GetParams},
642 {"QueryParams", clm_QueryParams},
Sjoerd Mullender4e2a4271993-02-16 11:55:17 +0000643 {"QuerySchemeFromHandle",clm_QuerySchemeFromHandle},
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000644 {"SetParam", clm_SetParam},
Sjoerd Mullender384f2481992-09-29 16:43:43 +0000645 {"SetParams", clm_SetParams},
Sjoerd Mullenderc4315491992-09-23 14:53:00 +0000646 {NULL, NULL} /* sentinel */
647};
648
Roger E. Massee474fb31997-01-17 16:00:02 +0000649static PyMethodDef decompressor_methods[] = {
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000650 {"close", clm_CloseDecompressor}, /* alias */
Sjoerd Mullender384f2481992-09-29 16:43:43 +0000651 {"CloseDecompressor", clm_CloseDecompressor},
652 {"Decompress", clm_Decompress},
653 {"GetDefault", clm_GetDefault},
654 {"GetMinMax", clm_GetMinMax},
655 {"GetName", clm_GetName},
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000656 {"GetParam", clm_GetParam},
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000657 {"GetParamID", clm_GetParamID},
Sjoerd Mullender384f2481992-09-29 16:43:43 +0000658 {"GetParams", clm_GetParams},
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000659 {"ReadHeader", clm_ReadHeader},
Sjoerd Mullender384f2481992-09-29 16:43:43 +0000660 {"QueryParams", clm_QueryParams},
Sjoerd Mullender4e2a4271993-02-16 11:55:17 +0000661 {"QuerySchemeFromHandle",clm_QuerySchemeFromHandle},
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000662 {"SetParam", clm_SetParam},
Sjoerd Mullender384f2481992-09-29 16:43:43 +0000663 {"SetParams", clm_SetParams},
Sjoerd Mullenderc4315491992-09-23 14:53:00 +0000664 {NULL, NULL} /* sentinel */
665};
666
667static void
Roger E. Massee474fb31997-01-17 16:00:02 +0000668cl_dealloc(PyObject *self)
Sjoerd Mullenderc4315491992-09-23 14:53:00 +0000669{
Sjoerd Mullender4e2a4271993-02-16 11:55:17 +0000670 if (SELF->ob_compressorHdl) {
671 if (SELF->ob_isCompressor)
672 clCloseCompressor(SELF->ob_compressorHdl);
Sjoerd Mullenderc4315491992-09-23 14:53:00 +0000673 else
Sjoerd Mullender4e2a4271993-02-16 11:55:17 +0000674 clCloseDecompressor(SELF->ob_compressorHdl);
Sjoerd Mullenderc4315491992-09-23 14:53:00 +0000675 }
Roger E. Massee474fb31997-01-17 16:00:02 +0000676 PyMem_DEL(self);
Sjoerd Mullenderc4315491992-09-23 14:53:00 +0000677}
678
Roger E. Massee474fb31997-01-17 16:00:02 +0000679static PyObject *
680cl_getattr(PyObject *self, char *name)
Sjoerd Mullenderc4315491992-09-23 14:53:00 +0000681{
Sjoerd Mullender4e2a4271993-02-16 11:55:17 +0000682 if (SELF->ob_isCompressor)
Roger E. Massee474fb31997-01-17 16:00:02 +0000683 return Py_FindMethod(compressor_methods, self, name);
Sjoerd Mullenderc4315491992-09-23 14:53:00 +0000684 else
Roger E. Massee474fb31997-01-17 16:00:02 +0000685 return Py_FindMethod(decompressor_methods, self, name);
Sjoerd Mullenderc4315491992-09-23 14:53:00 +0000686}
687
Roger E. Massee474fb31997-01-17 16:00:02 +0000688static PyTypeObject Cltype = {
689 PyObject_HEAD_INIT(&PyType_Type)
Sjoerd Mullenderc4315491992-09-23 14:53:00 +0000690 0, /*ob_size*/
691 "cl", /*tp_name*/
692 sizeof(clobject), /*tp_size*/
693 0, /*tp_itemsize*/
694 /* methods */
Guido van Rossumb6775db1994-08-01 11:34:53 +0000695 (destructor)cl_dealloc, /*tp_dealloc*/
Sjoerd Mullenderc4315491992-09-23 14:53:00 +0000696 0, /*tp_print*/
Guido van Rossumb6775db1994-08-01 11:34:53 +0000697 (getattrfunc)cl_getattr, /*tp_getattr*/
Sjoerd Mullenderc4315491992-09-23 14:53:00 +0000698 0, /*tp_setattr*/
699 0, /*tp_compare*/
700 0, /*tp_repr*/
701 0, /*tp_as_number*/
702 0, /*tp_as_sequence*/
703 0, /*tp_as_mapping*/
704};
705
Roger E. Massee474fb31997-01-17 16:00:02 +0000706static PyObject *
707doOpen(PyObject *self, PyObject *args, int (*open_func)(int, CL_Handle *),
Sjoerd Mullender4e2a4271993-02-16 11:55:17 +0000708 int iscompressor)
Sjoerd Mullenderc4315491992-09-23 14:53:00 +0000709{
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000710 int scheme;
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000711 clobject *new;
Sjoerd Mullenderc4315491992-09-23 14:53:00 +0000712
Roger E. Massee474fb31997-01-17 16:00:02 +0000713 if (!PyArg_Parse(args, "i", &scheme))
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000714 return NULL;
Sjoerd Mullenderc4315491992-09-23 14:53:00 +0000715
Roger E. Massee474fb31997-01-17 16:00:02 +0000716 new = PyObject_NEW(clobject, &Cltype);
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000717 if (new == NULL)
718 return NULL;
Sjoerd Mullenderc4315491992-09-23 14:53:00 +0000719
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000720 new->ob_compressorHdl = NULL;
721 new->ob_isCompressor = iscompressor;
Sjoerd Mullender4e2a4271993-02-16 11:55:17 +0000722 new->ob_paramtypes = NULL;
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000723
724 error_handler_called = 0;
Guido van Rossum72429051997-08-12 14:58:54 +0000725 if ((*open_func)(scheme, &new->ob_compressorHdl) == FAILURE ||
726 error_handler_called) {
Roger E. Massee474fb31997-01-17 16:00:02 +0000727 Py_DECREF(new);
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000728 if (!error_handler_called)
Roger E. Massee474fb31997-01-17 16:00:02 +0000729 PyErr_SetString(ClError, "Open(De)Compressor failed");
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000730 return NULL;
Sjoerd Mullenderc4315491992-09-23 14:53:00 +0000731 }
Roger E. Massee474fb31997-01-17 16:00:02 +0000732 return (PyObject *)new;
Sjoerd Mullenderc4315491992-09-23 14:53:00 +0000733}
734
Roger E. Massee474fb31997-01-17 16:00:02 +0000735static PyObject *
736cl_OpenCompressor(PyObject *self, PyObject *args)
Sjoerd Mullenderc4315491992-09-23 14:53:00 +0000737{
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000738 return doOpen(self, args, clOpenCompressor, 1);
Sjoerd Mullenderc4315491992-09-23 14:53:00 +0000739}
740
Roger E. Massee474fb31997-01-17 16:00:02 +0000741static PyObject *
742cl_OpenDecompressor(PyObject *self, PyObject *args)
Sjoerd Mullenderc4315491992-09-23 14:53:00 +0000743{
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000744 return doOpen(self, args, clOpenDecompressor, 0);
Sjoerd Mullender384f2481992-09-29 16:43:43 +0000745}
746
Roger E. Massee474fb31997-01-17 16:00:02 +0000747static PyObject *
748cl_QueryScheme(PyObject *self, PyObject *args)
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000749{
750 char *header;
751 int headerlen;
752 int scheme;
753
Roger E. Massee474fb31997-01-17 16:00:02 +0000754 if (!PyArg_Parse(args, "s#", &header, &headerlen))
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000755 return NULL;
756
757 scheme = clQueryScheme(header);
758 if (scheme < 0) {
Roger E. Massee474fb31997-01-17 16:00:02 +0000759 PyErr_SetString(ClError, "unknown compression scheme");
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000760 return NULL;
761 }
762
Roger E. Massee474fb31997-01-17 16:00:02 +0000763 return PyInt_FromLong(scheme);
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000764}
765
Roger E. Massee474fb31997-01-17 16:00:02 +0000766static PyObject *
767cl_QueryMaxHeaderSize(PyObject *self, PyObject *args)
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000768{
769 int scheme;
770
Roger E. Massee474fb31997-01-17 16:00:02 +0000771 if (!PyArg_Parse(args, "i", &scheme))
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000772 return NULL;
773
Roger E. Massee474fb31997-01-17 16:00:02 +0000774 return PyInt_FromLong(clQueryMaxHeaderSize(scheme));
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000775}
776
Roger E. Massee474fb31997-01-17 16:00:02 +0000777static PyObject *
778cl_QueryAlgorithms(PyObject *self, PyObject *args)
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000779{
780 int algorithmMediaType;
781 int bufferlength;
782 int *PVbuffer;
Roger E. Massee474fb31997-01-17 16:00:02 +0000783 PyObject *list;
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000784 int i;
785
Roger E. Massee474fb31997-01-17 16:00:02 +0000786 if (!PyArg_Parse(args, "i", &algorithmMediaType))
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000787 return NULL;
788
789 error_handler_called = 0;
790 bufferlength = clQueryAlgorithms(algorithmMediaType, 0, 0);
791 if (error_handler_called)
792 return NULL;
793
Roger E. Massee474fb31997-01-17 16:00:02 +0000794 PVbuffer = PyMem_NEW(int, bufferlength);
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000795 if (PVbuffer == NULL)
Roger E. Massee474fb31997-01-17 16:00:02 +0000796 return PyErr_NoMemory();
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000797
798 bufferlength = clQueryAlgorithms(algorithmMediaType, PVbuffer,
Roger E. Massee474fb31997-01-17 16:00:02 +0000799 bufferlength);
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000800 if (error_handler_called) {
Roger E. Massee474fb31997-01-17 16:00:02 +0000801 PyMem_DEL(PVbuffer);
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000802 return NULL;
803 }
804
Roger E. Massee474fb31997-01-17 16:00:02 +0000805 list = PyList_New(bufferlength);
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000806 if (list == NULL) {
Roger E. Massee474fb31997-01-17 16:00:02 +0000807 PyMem_DEL(PVbuffer);
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000808 return NULL;
809 }
810
811 for (i = 0; i < bufferlength; i++) {
812 if (i & 1)
Roger E. Massee474fb31997-01-17 16:00:02 +0000813 PyList_SetItem(list, i, PyInt_FromLong(PVbuffer[i]));
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000814 else if (PVbuffer[i] == 0) {
Roger E. Massee474fb31997-01-17 16:00:02 +0000815 Py_INCREF(Py_None);
816 PyList_SetItem(list, i, Py_None);
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000817 } else
Roger E. Massee474fb31997-01-17 16:00:02 +0000818 PyList_SetItem(list, i,
819 PyString_FromString((char *) PVbuffer[i]));
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000820 }
821
Roger E. Massee474fb31997-01-17 16:00:02 +0000822 PyMem_DEL(PVbuffer);
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000823
824 return list;
825}
826
Roger E. Massee474fb31997-01-17 16:00:02 +0000827static PyObject *
828cl_QuerySchemeFromName(PyObject *self, PyObject *args)
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000829{
830 int algorithmMediaType;
831 char *name;
832 int scheme;
833
Roger E. Massee474fb31997-01-17 16:00:02 +0000834 if (!PyArg_Parse(args, "(is)", &algorithmMediaType, &name))
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000835 return NULL;
836
837 error_handler_called = 0;
838 scheme = clQuerySchemeFromName(algorithmMediaType, name);
839 if (error_handler_called) {
Roger E. Massee474fb31997-01-17 16:00:02 +0000840 PyErr_SetString(ClError, "unknown compression scheme");
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000841 return NULL;
842 }
843
Roger E. Massee474fb31997-01-17 16:00:02 +0000844 return PyInt_FromLong(scheme);
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000845}
846
Roger E. Massee474fb31997-01-17 16:00:02 +0000847static PyObject *
848cl_GetAlgorithmName(PyObject *self, PyObject *args)
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000849{
850 int scheme;
851 char *name;
852
Roger E. Massee474fb31997-01-17 16:00:02 +0000853 if (!PyArg_Parse(args, "i", &scheme))
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000854 return NULL;
855
856 name = clGetAlgorithmName(scheme);
857 if (name == 0) {
Roger E. Massee474fb31997-01-17 16:00:02 +0000858 PyErr_SetString(ClError, "unknown compression scheme");
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000859 return NULL;
860 }
861
Roger E. Massee474fb31997-01-17 16:00:02 +0000862 return PyString_FromString(name);
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000863}
864
Roger E. Massee474fb31997-01-17 16:00:02 +0000865static PyObject *
866do_set(PyObject *self, PyObject *args, int (*func)(int, int, int))
Sjoerd Mullender22e44cd1993-02-17 09:11:14 +0000867{
868 int scheme, paramID, value;
869 float fvalue;
870 int is_float = 0;
871
Roger E. Massee474fb31997-01-17 16:00:02 +0000872 if (!PyArg_Parse(args, "(iii)", &scheme, &paramID, &value)) {
873 PyErr_Clear();
874 if (!PyArg_Parse(args, "(iif)", &scheme, &paramID, &fvalue)) {
875 PyErr_Clear();
876 PyErr_SetString(PyExc_TypeError,
877 "bad argument list (format '(iii)' or '(iif)')");
Sjoerd Mullender22e44cd1993-02-17 09:11:14 +0000878 return NULL;
879 }
880 value = CL_TypeIsInt(fvalue);
881 is_float = 1;
882 } else {
883 /* check some parameters which we know to be floats */
884 switch (scheme) {
885 case CL_COMPRESSION_RATIO:
886 case CL_SPEED:
887 fvalue = value;
888 value = CL_TypeIsInt(fvalue);
889 is_float = 1;
890 break;
891 }
892 }
893
894 error_handler_called = 0;
895 value = (*func)(scheme, paramID, value);
896 if (error_handler_called)
897 return NULL;
898
899 if (is_float)
Roger E. Massee474fb31997-01-17 16:00:02 +0000900 return PyFloat_FromDouble(CL_TypeIsFloat(value));
Sjoerd Mullender22e44cd1993-02-17 09:11:14 +0000901 else
Roger E. Massee474fb31997-01-17 16:00:02 +0000902 return PyInt_FromLong(value);
Sjoerd Mullender22e44cd1993-02-17 09:11:14 +0000903}
904
Roger E. Massee474fb31997-01-17 16:00:02 +0000905static PyObject *
906cl_SetDefault(PyObject *self, PyObject *args)
Sjoerd Mullender22e44cd1993-02-17 09:11:14 +0000907{
908 return do_set(self, args, clSetDefault);
909}
910
Roger E. Massee474fb31997-01-17 16:00:02 +0000911static PyObject *
912cl_SetMin(PyObject *self, PyObject *args)
Sjoerd Mullender22e44cd1993-02-17 09:11:14 +0000913{
914 return do_set(self, args, clSetMin);
915}
916
Roger E. Massee474fb31997-01-17 16:00:02 +0000917static PyObject *
918cl_SetMax(PyObject *self, PyObject *args)
Sjoerd Mullender22e44cd1993-02-17 09:11:14 +0000919{
920 return do_set(self, args, clSetMax);
921}
922
Roger E. Massee474fb31997-01-17 16:00:02 +0000923#define func(name, handler) \
924static PyObject *cl_##name(PyObject *self, PyObject *args) \
925{ \
926 int x; \
927 if (!PyArg_Parse(args, "i", &x)) return NULL; \
928 return Py##handler(CL_##name(x)); \
929}
Sjoerd Mullender3db845b1995-05-17 11:16:52 +0000930
Roger E. Massee474fb31997-01-17 16:00:02 +0000931#define func2(name, handler) \
932static PyObject *cl_##name(PyObject *self, PyObject *args) \
933{ \
934 int a1, a2; \
935 if (!PyArg_Parse(args, "(ii)", &a1, &a2)) return NULL; \
936 return Py##handler(CL_##name(a1, a2)); \
937}
Sjoerd Mullender3db845b1995-05-17 11:16:52 +0000938
Roger E. Massee474fb31997-01-17 16:00:02 +0000939func(BytesPerSample, Int_FromLong)
940func(BytesPerPixel, Int_FromLong)
941func(AudioFormatName, String_FromString)
942func(VideoFormatName, String_FromString)
943func(AlgorithmNumber, Int_FromLong)
944func(AlgorithmType, Int_FromLong)
945func2(Algorithm, Int_FromLong)
946func(ParamNumber, Int_FromLong)
947func(ParamType, Int_FromLong)
948func2(ParamID, Int_FromLong)
Sjoerd Mullender3db845b1995-05-17 11:16:52 +0000949
Sjoerd Mullender4e2a4271993-02-16 11:55:17 +0000950#ifdef CLDEBUG
Roger E. Massee474fb31997-01-17 16:00:02 +0000951 static PyObject *
952cvt_type(PyObject *self, PyObject *args)
Sjoerd Mullender4e2a4271993-02-16 11:55:17 +0000953{
954 int number;
955 float fnumber;
956
Roger E. Massee474fb31997-01-17 16:00:02 +0000957 if (PyArg_Parse(args, "i", &number))
958 return PyFloat_FromDouble(CL_TypeIsFloat(number));
Sjoerd Mullender4e2a4271993-02-16 11:55:17 +0000959 else {
Roger E. Massee474fb31997-01-17 16:00:02 +0000960 PyErr_Clear();
961 if (PyArg_Parse(args, "f", &fnumber))
962 return PyInt_FromLong(CL_TypeIsInt(fnumber));
Sjoerd Mullender4e2a4271993-02-16 11:55:17 +0000963 return NULL;
964 }
965}
966#endif
967
Roger E. Massee474fb31997-01-17 16:00:02 +0000968static PyMethodDef cl_methods[] = {
Sjoerd Mullender8dd054d1992-12-14 13:17:29 +0000969 {"CompressImage", cl_CompressImage},
970 {"DecompressImage", cl_DecompressImage},
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000971 {"GetAlgorithmName", cl_GetAlgorithmName},
Sjoerd Mullenderc4315491992-09-23 14:53:00 +0000972 {"OpenCompressor", cl_OpenCompressor},
973 {"OpenDecompressor", cl_OpenDecompressor},
Sjoerd Mullender3a997271993-02-04 16:43:28 +0000974 {"QueryAlgorithms", cl_QueryAlgorithms},
975 {"QueryMaxHeaderSize", cl_QueryMaxHeaderSize},
976 {"QueryScheme", cl_QueryScheme},
977 {"QuerySchemeFromName", cl_QuerySchemeFromName},
Sjoerd Mullender22e44cd1993-02-17 09:11:14 +0000978 {"SetDefault", cl_SetDefault},
979 {"SetMax", cl_SetMax},
980 {"SetMin", cl_SetMin},
Sjoerd Mullender3db845b1995-05-17 11:16:52 +0000981 {"BytesPerSample", cl_BytesPerSample},
982 {"BytesPerPixel", cl_BytesPerPixel},
983 {"AudioFormatName", cl_AudioFormatName},
984 {"VideoFormatName", cl_VideoFormatName},
985 {"AlgorithmNumber", cl_AlgorithmNumber},
986 {"AlgorithmType", cl_AlgorithmType},
987 {"Algorithm", cl_Algorithm},
988 {"ParamNumber", cl_ParamNumber},
989 {"ParamType", cl_ParamType},
990 {"ParamID", cl_ParamID},
Sjoerd Mullender4e2a4271993-02-16 11:55:17 +0000991#ifdef CLDEBUG
992 {"cvt_type", cvt_type},
993#endif
Sjoerd Mullenderc4315491992-09-23 14:53:00 +0000994 {NULL, NULL} /* Sentinel */
995};
996
Sjoerd Mullender3db845b1995-05-17 11:16:52 +0000997#ifdef CL_JPEG_SOFTWARE
998#define IRIX_5_3_LIBRARY
999#endif
1000
Sjoerd Mullenderc4315491992-09-23 14:53:00 +00001001void
1002initcl()
1003{
Guido van Rossum72429051997-08-12 14:58:54 +00001004 PyObject *m, *d, *x;
Sjoerd Mullenderd53a4f31992-09-24 10:37:39 +00001005
Roger E. Massee474fb31997-01-17 16:00:02 +00001006 m = Py_InitModule("cl", cl_methods);
1007 d = PyModule_GetDict(m);
Sjoerd Mullenderd53a4f31992-09-24 10:37:39 +00001008
Guido van Rossum0cb96de1997-10-01 04:29:29 +00001009 ClError = PyErr_NewException("cl.error", NULL, NULL);
Roger E. Massee474fb31997-01-17 16:00:02 +00001010 (void) PyDict_SetItemString(d, "error", ClError);
Sjoerd Mullender3db845b1995-05-17 11:16:52 +00001011
Guido van Rossum72429051997-08-12 14:58:54 +00001012#ifdef CL_ADDED_ALGORITHM_ERROR
1013 x = PyInt_FromLong(CL_ADDED_ALGORITHM_ERROR);
1014 if (x == NULL || PyDict_SetItemString(d, "ADDED_ALGORITHM_ERROR", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001015 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001016 Py_DECREF(x);
Sjoerd Mullender3db845b1995-05-17 11:16:52 +00001017#endif
Guido van Rossum72429051997-08-12 14:58:54 +00001018#ifdef CL_ALAW
1019 x = PyInt_FromLong(CL_ALAW);
1020 if (x == NULL || PyDict_SetItemString(d, "ALAW", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001021 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001022 Py_DECREF(x);
Sjoerd Mullender3db845b1995-05-17 11:16:52 +00001023#endif
Guido van Rossum72429051997-08-12 14:58:54 +00001024#ifdef CL_ALGORITHM_ID
1025 x = PyInt_FromLong(CL_ALGORITHM_ID);
1026 if (x == NULL || PyDict_SetItemString(d, "ALGORITHM_ID", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001027 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001028 Py_DECREF(x);
Sjoerd Mullender3db845b1995-05-17 11:16:52 +00001029#endif
Guido van Rossum72429051997-08-12 14:58:54 +00001030#ifdef CL_ALGORITHM_TABLE_FULL
1031 x = PyInt_FromLong(CL_ALGORITHM_TABLE_FULL);
1032 if (x == NULL || PyDict_SetItemString(d, "ALGORITHM_TABLE_FULL", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001033 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001034 Py_DECREF(x);
1035#endif
1036#ifdef CL_ALGORITHM_VERSION
1037 x = PyInt_FromLong(CL_ALGORITHM_VERSION);
1038 if (x == NULL || PyDict_SetItemString(d, "ALGORITHM_VERSION", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001039 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001040 Py_DECREF(x);
1041#endif
1042#ifdef CL_ALG_AUDIO
1043 x = PyInt_FromLong(CL_ALG_AUDIO);
1044 if (x == NULL || PyDict_SetItemString(d, "ALG_AUDIO", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001045 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001046 Py_DECREF(x);
1047#endif
1048#ifdef CL_ALG_VIDEO
1049 x = PyInt_FromLong(CL_ALG_VIDEO);
1050 if (x == NULL || PyDict_SetItemString(d, "ALG_VIDEO", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001051 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001052 Py_DECREF(x);
1053#endif
1054#ifdef CL_AUDIO
1055 x = PyInt_FromLong(CL_AUDIO);
1056 if (x == NULL || PyDict_SetItemString(d, "AUDIO", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001057 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001058 Py_DECREF(x);
1059#endif
1060#ifdef CL_AWARE_BITRATE_POLICY
1061 x = PyInt_FromLong(CL_AWARE_BITRATE_POLICY);
1062 if (x == NULL || PyDict_SetItemString(d, "AWARE_BITRATE_POLICY", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001063 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001064 Py_DECREF(x);
1065#endif
1066#ifdef CL_AWARE_BITRATE_TARGET
1067 x = PyInt_FromLong(CL_AWARE_BITRATE_TARGET);
1068 if (x == NULL || PyDict_SetItemString(d, "AWARE_BITRATE_TARGET", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001069 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001070 Py_DECREF(x);
1071#endif
1072#ifdef CL_AWARE_CHANNEL_POLICY
1073 x = PyInt_FromLong(CL_AWARE_CHANNEL_POLICY);
1074 if (x == NULL || PyDict_SetItemString(d, "AWARE_CHANNEL_POLICY", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001075 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001076 Py_DECREF(x);
1077#endif
1078#ifdef CL_AWARE_CONST_QUAL
1079 x = PyInt_FromLong(CL_AWARE_CONST_QUAL);
1080 if (x == NULL || PyDict_SetItemString(d, "AWARE_CONST_QUAL", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001081 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001082 Py_DECREF(x);
1083#endif
1084#ifdef CL_AWARE_ERROR
1085 x = PyInt_FromLong(CL_AWARE_ERROR);
1086 if (x == NULL || PyDict_SetItemString(d, "AWARE_ERROR", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001087 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001088 Py_DECREF(x);
1089#endif
1090#ifdef CL_AWARE_FIXED_RATE
1091 x = PyInt_FromLong(CL_AWARE_FIXED_RATE);
1092 if (x == NULL || PyDict_SetItemString(d, "AWARE_FIXED_RATE", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001093 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001094 Py_DECREF(x);
1095#endif
1096#ifdef CL_AWARE_INDEPENDENT
1097 x = PyInt_FromLong(CL_AWARE_INDEPENDENT);
1098 if (x == NULL || PyDict_SetItemString(d, "AWARE_INDEPENDENT", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001099 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001100 Py_DECREF(x);
1101#endif
1102#ifdef CL_AWARE_JOINT_STEREO
1103 x = PyInt_FromLong(CL_AWARE_JOINT_STEREO);
1104 if (x == NULL || PyDict_SetItemString(d, "AWARE_JOINT_STEREO", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001105 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001106 Py_DECREF(x);
1107#endif
1108#ifdef CL_AWARE_LAYER
1109 x = PyInt_FromLong(CL_AWARE_LAYER);
1110 if (x == NULL || PyDict_SetItemString(d, "AWARE_LAYER", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001111 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001112 Py_DECREF(x);
1113#endif
1114#ifdef CL_AWARE_LOSSLESS
1115 x = PyInt_FromLong(CL_AWARE_LOSSLESS);
1116 if (x == NULL || PyDict_SetItemString(d, "AWARE_LOSSLESS", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001117 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001118 Py_DECREF(x);
1119#endif
1120#ifdef CL_AWARE_MPEG_AUDIO
1121 x = PyInt_FromLong(CL_AWARE_MPEG_AUDIO);
1122 if (x == NULL || PyDict_SetItemString(d, "AWARE_MPEG_AUDIO", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001123 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001124 Py_DECREF(x);
1125#endif
1126#ifdef CL_AWARE_MPEG_LAYER_I
1127 x = PyInt_FromLong(CL_AWARE_MPEG_LAYER_I);
1128 if (x == NULL || PyDict_SetItemString(d, "AWARE_MPEG_LAYER_I", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001129 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001130 Py_DECREF(x);
1131#endif
1132#ifdef CL_AWARE_MPEG_LAYER_II
1133 x = PyInt_FromLong(CL_AWARE_MPEG_LAYER_II);
1134 if (x == NULL || PyDict_SetItemString(d, "AWARE_MPEG_LAYER_II", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001135 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001136 Py_DECREF(x);
1137#endif
1138#ifdef CL_AWARE_MULTIRATE
1139 x = PyInt_FromLong(CL_AWARE_MULTIRATE);
1140 if (x == NULL || PyDict_SetItemString(d, "AWARE_MULTIRATE", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001141 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001142 Py_DECREF(x);
1143#endif
1144#ifdef CL_AWARE_NOISE_MARGIN
1145 x = PyInt_FromLong(CL_AWARE_NOISE_MARGIN);
1146 if (x == NULL || PyDict_SetItemString(d, "AWARE_NOISE_MARGIN", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001147 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001148 Py_DECREF(x);
1149#endif
1150#ifdef CL_AWARE_STEREO
1151 x = PyInt_FromLong(CL_AWARE_STEREO);
1152 if (x == NULL || PyDict_SetItemString(d, "AWARE_STEREO", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001153 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001154 Py_DECREF(x);
1155#endif
1156#ifdef CL_BAD_ALGORITHM_NAME
1157 x = PyInt_FromLong(CL_BAD_ALGORITHM_NAME);
1158 if (x == NULL || PyDict_SetItemString(d, "BAD_ALGORITHM_NAME", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001159 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001160 Py_DECREF(x);
1161#endif
1162#ifdef CL_BAD_ALGORITHM_TYPE
1163 x = PyInt_FromLong(CL_BAD_ALGORITHM_TYPE);
1164 if (x == NULL || PyDict_SetItemString(d, "BAD_ALGORITHM_TYPE", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001165 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001166 Py_DECREF(x);
1167#endif
1168#ifdef CL_BAD_BLOCK_SIZE
1169 x = PyInt_FromLong(CL_BAD_BLOCK_SIZE);
1170 if (x == NULL || PyDict_SetItemString(d, "BAD_BLOCK_SIZE", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001171 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001172 Py_DECREF(x);
1173#endif
1174#ifdef CL_BAD_BOARD
1175 x = PyInt_FromLong(CL_BAD_BOARD);
1176 if (x == NULL || PyDict_SetItemString(d, "BAD_BOARD", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001177 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001178 Py_DECREF(x);
1179#endif
1180#ifdef CL_BAD_BUFFERING
1181 x = PyInt_FromLong(CL_BAD_BUFFERING);
1182 if (x == NULL || PyDict_SetItemString(d, "BAD_BUFFERING", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001183 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001184 Py_DECREF(x);
1185#endif
1186#ifdef CL_BAD_BUFFERLENGTH_NEG
1187 x = PyInt_FromLong(CL_BAD_BUFFERLENGTH_NEG);
1188 if (x == NULL || PyDict_SetItemString(d, "BAD_BUFFERLENGTH_NEG", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001189 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001190 Py_DECREF(x);
1191#endif
1192#ifdef CL_BAD_BUFFERLENGTH_ODD
1193 x = PyInt_FromLong(CL_BAD_BUFFERLENGTH_ODD);
1194 if (x == NULL || PyDict_SetItemString(d, "BAD_BUFFERLENGTH_ODD", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001195 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001196 Py_DECREF(x);
1197#endif
1198#ifdef CL_BAD_BUFFER_EXISTS
1199 x = PyInt_FromLong(CL_BAD_BUFFER_EXISTS);
1200 if (x == NULL || PyDict_SetItemString(d, "BAD_BUFFER_EXISTS", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001201 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001202 Py_DECREF(x);
1203#endif
1204#ifdef CL_BAD_BUFFER_HANDLE
1205 x = PyInt_FromLong(CL_BAD_BUFFER_HANDLE);
1206 if (x == NULL || PyDict_SetItemString(d, "BAD_BUFFER_HANDLE", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001207 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001208 Py_DECREF(x);
1209#endif
1210#ifdef CL_BAD_BUFFER_POINTER
1211 x = PyInt_FromLong(CL_BAD_BUFFER_POINTER);
1212 if (x == NULL || PyDict_SetItemString(d, "BAD_BUFFER_POINTER", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001213 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001214 Py_DECREF(x);
1215#endif
1216#ifdef CL_BAD_BUFFER_QUERY_SIZE
1217 x = PyInt_FromLong(CL_BAD_BUFFER_QUERY_SIZE);
1218 if (x == NULL || PyDict_SetItemString(d, "BAD_BUFFER_QUERY_SIZE", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001219 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001220 Py_DECREF(x);
1221#endif
1222#ifdef CL_BAD_BUFFER_SIZE
1223 x = PyInt_FromLong(CL_BAD_BUFFER_SIZE);
1224 if (x == NULL || PyDict_SetItemString(d, "BAD_BUFFER_SIZE", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001225 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001226 Py_DECREF(x);
1227#endif
1228#ifdef CL_BAD_BUFFER_SIZE_POINTER
1229 x = PyInt_FromLong(CL_BAD_BUFFER_SIZE_POINTER);
1230 if (x == NULL || PyDict_SetItemString(d, "BAD_BUFFER_SIZE_POINTER", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001231 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001232 Py_DECREF(x);
1233#endif
1234#ifdef CL_BAD_BUFFER_TYPE
1235 x = PyInt_FromLong(CL_BAD_BUFFER_TYPE);
1236 if (x == NULL || PyDict_SetItemString(d, "BAD_BUFFER_TYPE", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001237 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001238 Py_DECREF(x);
1239#endif
1240#ifdef CL_BAD_COMPRESSION_SCHEME
1241 x = PyInt_FromLong(CL_BAD_COMPRESSION_SCHEME);
1242 if (x == NULL || PyDict_SetItemString(d, "BAD_COMPRESSION_SCHEME", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001243 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001244 Py_DECREF(x);
1245#endif
1246#ifdef CL_BAD_COMPRESSOR_HANDLE
1247 x = PyInt_FromLong(CL_BAD_COMPRESSOR_HANDLE);
1248 if (x == NULL || PyDict_SetItemString(d, "BAD_COMPRESSOR_HANDLE", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001249 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001250 Py_DECREF(x);
1251#endif
1252#ifdef CL_BAD_COMPRESSOR_HANDLE_POINTER
1253 x = PyInt_FromLong(CL_BAD_COMPRESSOR_HANDLE_POINTER);
1254 if (x == NULL || PyDict_SetItemString(d, "BAD_COMPRESSOR_HANDLE_POINTER", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001255 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001256 Py_DECREF(x);
1257#endif
1258#ifdef CL_BAD_FRAME_SIZE
1259 x = PyInt_FromLong(CL_BAD_FRAME_SIZE);
1260 if (x == NULL || PyDict_SetItemString(d, "BAD_FRAME_SIZE", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001261 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001262 Py_DECREF(x);
1263#endif
1264#ifdef CL_BAD_FUNCTIONALITY
1265 x = PyInt_FromLong(CL_BAD_FUNCTIONALITY);
1266 if (x == NULL || PyDict_SetItemString(d, "BAD_FUNCTIONALITY", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001267 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001268 Py_DECREF(x);
1269#endif
1270#ifdef CL_BAD_FUNCTION_POINTER
1271 x = PyInt_FromLong(CL_BAD_FUNCTION_POINTER);
1272 if (x == NULL || PyDict_SetItemString(d, "BAD_FUNCTION_POINTER", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001273 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001274 Py_DECREF(x);
1275#endif
1276#ifdef CL_BAD_HEADER_SIZE
1277 x = PyInt_FromLong(CL_BAD_HEADER_SIZE);
1278 if (x == NULL || PyDict_SetItemString(d, "BAD_HEADER_SIZE", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001279 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001280 Py_DECREF(x);
1281#endif
1282#ifdef CL_BAD_INITIAL_VALUE
1283 x = PyInt_FromLong(CL_BAD_INITIAL_VALUE);
1284 if (x == NULL || PyDict_SetItemString(d, "BAD_INITIAL_VALUE", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001285 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001286 Py_DECREF(x);
1287#endif
1288#ifdef CL_BAD_INTERNAL_FORMAT
1289 x = PyInt_FromLong(CL_BAD_INTERNAL_FORMAT);
1290 if (x == NULL || PyDict_SetItemString(d, "BAD_INTERNAL_FORMAT", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001291 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001292 Py_DECREF(x);
1293#endif
1294#ifdef CL_BAD_LICENSE
1295 x = PyInt_FromLong(CL_BAD_LICENSE);
1296 if (x == NULL || PyDict_SetItemString(d, "BAD_LICENSE", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001297 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001298 Py_DECREF(x);
1299#endif
1300#ifdef CL_BAD_MIN_GT_MAX
1301 x = PyInt_FromLong(CL_BAD_MIN_GT_MAX);
1302 if (x == NULL || PyDict_SetItemString(d, "BAD_MIN_GT_MAX", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001303 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001304 Py_DECREF(x);
1305#endif
1306#ifdef CL_BAD_NO_BUFFERSPACE
1307 x = PyInt_FromLong(CL_BAD_NO_BUFFERSPACE);
1308 if (x == NULL || PyDict_SetItemString(d, "BAD_NO_BUFFERSPACE", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001309 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001310 Py_DECREF(x);
1311#endif
1312#ifdef CL_BAD_NUMBER_OF_BLOCKS
1313 x = PyInt_FromLong(CL_BAD_NUMBER_OF_BLOCKS);
1314 if (x == NULL || PyDict_SetItemString(d, "BAD_NUMBER_OF_BLOCKS", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001315 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001316 Py_DECREF(x);
1317#endif
1318#ifdef CL_BAD_PARAM
1319 x = PyInt_FromLong(CL_BAD_PARAM);
1320 if (x == NULL || PyDict_SetItemString(d, "BAD_PARAM", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001321 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001322 Py_DECREF(x);
1323#endif
1324#ifdef CL_BAD_PARAM_ID_POINTER
1325 x = PyInt_FromLong(CL_BAD_PARAM_ID_POINTER);
1326 if (x == NULL || PyDict_SetItemString(d, "BAD_PARAM_ID_POINTER", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001327 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001328 Py_DECREF(x);
1329#endif
1330#ifdef CL_BAD_PARAM_TYPE
1331 x = PyInt_FromLong(CL_BAD_PARAM_TYPE);
1332 if (x == NULL || PyDict_SetItemString(d, "BAD_PARAM_TYPE", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001333 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001334 Py_DECREF(x);
1335#endif
1336#ifdef CL_BAD_POINTER
1337 x = PyInt_FromLong(CL_BAD_POINTER);
1338 if (x == NULL || PyDict_SetItemString(d, "BAD_POINTER", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001339 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001340 Py_DECREF(x);
1341#endif
1342#ifdef CL_BAD_PVBUFFER
1343 x = PyInt_FromLong(CL_BAD_PVBUFFER);
1344 if (x == NULL || PyDict_SetItemString(d, "BAD_PVBUFFER", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001345 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001346 Py_DECREF(x);
1347#endif
1348#ifdef CL_BAD_SCHEME_POINTER
1349 x = PyInt_FromLong(CL_BAD_SCHEME_POINTER);
1350 if (x == NULL || PyDict_SetItemString(d, "BAD_SCHEME_POINTER", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001351 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001352 Py_DECREF(x);
1353#endif
1354#ifdef CL_BAD_STREAM_HEADER
1355 x = PyInt_FromLong(CL_BAD_STREAM_HEADER);
1356 if (x == NULL || PyDict_SetItemString(d, "BAD_STREAM_HEADER", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001357 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001358 Py_DECREF(x);
1359#endif
1360#ifdef CL_BAD_STRING_POINTER
1361 x = PyInt_FromLong(CL_BAD_STRING_POINTER);
1362 if (x == NULL || PyDict_SetItemString(d, "BAD_STRING_POINTER", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001363 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001364 Py_DECREF(x);
1365#endif
1366#ifdef CL_BAD_TEXT_STRING_PTR
1367 x = PyInt_FromLong(CL_BAD_TEXT_STRING_PTR);
1368 if (x == NULL || PyDict_SetItemString(d, "BAD_TEXT_STRING_PTR", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001369 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001370 Py_DECREF(x);
1371#endif
1372#ifdef CL_BEST_FIT
1373 x = PyInt_FromLong(CL_BEST_FIT);
1374 if (x == NULL || PyDict_SetItemString(d, "BEST_FIT", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001375 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001376 Py_DECREF(x);
1377#endif
1378#ifdef CL_BIDIRECTIONAL
1379 x = PyInt_FromLong(CL_BIDIRECTIONAL);
1380 if (x == NULL || PyDict_SetItemString(d, "BIDIRECTIONAL", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001381 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001382 Py_DECREF(x);
1383#endif
1384#ifdef CL_BITRATE
1385 x = PyInt_FromLong(CL_BITRATE);
1386 if (x == NULL || PyDict_SetItemString(d, "BITRATE", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001387 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001388 Py_DECREF(x);
1389#endif
1390#ifdef CL_BITRATE_POLICY
1391 x = PyInt_FromLong(CL_BITRATE_POLICY);
1392 if (x == NULL || PyDict_SetItemString(d, "BITRATE_POLICY", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001393 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001394 Py_DECREF(x);
1395#endif
1396#ifdef CL_BITRATE_TARGET
1397 x = PyInt_FromLong(CL_BITRATE_TARGET);
1398 if (x == NULL || PyDict_SetItemString(d, "BITRATE_TARGET", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001399 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001400 Py_DECREF(x);
1401#endif
1402#ifdef CL_BITS_PER_COMPONENT
1403 x = PyInt_FromLong(CL_BITS_PER_COMPONENT);
1404 if (x == NULL || PyDict_SetItemString(d, "BITS_PER_COMPONENT", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001405 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001406 Py_DECREF(x);
1407#endif
1408#ifdef CL_BLENDING
1409 x = PyInt_FromLong(CL_BLENDING);
1410 if (x == NULL || PyDict_SetItemString(d, "BLENDING", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001411 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001412 Py_DECREF(x);
1413#endif
1414#ifdef CL_BLOCK_SIZE
1415 x = PyInt_FromLong(CL_BLOCK_SIZE);
1416 if (x == NULL || PyDict_SetItemString(d, "BLOCK_SIZE", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001417 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001418 Py_DECREF(x);
1419#endif
1420#ifdef CL_BOTTOM_UP
1421 x = PyInt_FromLong(CL_BOTTOM_UP);
1422 if (x == NULL || PyDict_SetItemString(d, "BOTTOM_UP", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001423 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001424 Py_DECREF(x);
1425#endif
1426#ifdef CL_BUFFER_NOT_CREATED
1427 x = PyInt_FromLong(CL_BUFFER_NOT_CREATED);
1428 if (x == NULL || PyDict_SetItemString(d, "BUFFER_NOT_CREATED", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001429 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001430 Py_DECREF(x);
1431#endif
1432#ifdef CL_BUF_COMPRESSED
1433 x = PyInt_FromLong(CL_BUF_COMPRESSED);
1434 if (x == NULL || PyDict_SetItemString(d, "BUF_COMPRESSED", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001435 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001436 Py_DECREF(x);
1437#endif
1438#ifdef CL_BUF_DATA
1439 x = PyInt_FromLong(CL_BUF_DATA);
1440 if (x == NULL || PyDict_SetItemString(d, "BUF_DATA", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001441 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001442 Py_DECREF(x);
1443#endif
1444#ifdef CL_BUF_FRAME
1445 x = PyInt_FromLong(CL_BUF_FRAME);
1446 if (x == NULL || PyDict_SetItemString(d, "BUF_FRAME", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001447 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001448 Py_DECREF(x);
1449#endif
1450#ifdef CL_CHANNEL_POLICY
1451 x = PyInt_FromLong(CL_CHANNEL_POLICY);
1452 if (x == NULL || PyDict_SetItemString(d, "CHANNEL_POLICY", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001453 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001454 Py_DECREF(x);
1455#endif
1456#ifdef CL_CHROMA_THRESHOLD
1457 x = PyInt_FromLong(CL_CHROMA_THRESHOLD);
1458 if (x == NULL || PyDict_SetItemString(d, "CHROMA_THRESHOLD", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001459 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001460 Py_DECREF(x);
1461#endif
1462#ifdef CL_CODEC
1463 x = PyInt_FromLong(CL_CODEC);
1464 if (x == NULL || PyDict_SetItemString(d, "CODEC", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001465 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001466 Py_DECREF(x);
1467#endif
1468#ifdef CL_COMPONENTS
1469 x = PyInt_FromLong(CL_COMPONENTS);
1470 if (x == NULL || PyDict_SetItemString(d, "COMPONENTS", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001471 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001472 Py_DECREF(x);
1473#endif
1474#ifdef CL_COMPRESSED_BUFFER_SIZE
1475 x = PyInt_FromLong(CL_COMPRESSED_BUFFER_SIZE);
1476 if (x == NULL || PyDict_SetItemString(d, "COMPRESSED_BUFFER_SIZE", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001477 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001478 Py_DECREF(x);
1479#endif
1480#ifdef CL_COMPRESSION_RATIO
1481 x = PyInt_FromLong(CL_COMPRESSION_RATIO);
1482 if (x == NULL || PyDict_SetItemString(d, "COMPRESSION_RATIO", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001483 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001484 Py_DECREF(x);
1485#endif
1486#ifdef CL_COMPRESSOR
1487 x = PyInt_FromLong(CL_COMPRESSOR);
1488 if (x == NULL || PyDict_SetItemString(d, "COMPRESSOR", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001489 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001490 Py_DECREF(x);
1491#endif
1492#ifdef CL_CONTINUOUS_BLOCK
1493 x = PyInt_FromLong(CL_CONTINUOUS_BLOCK);
1494 if (x == NULL || PyDict_SetItemString(d, "CONTINUOUS_BLOCK", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001495 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001496 Py_DECREF(x);
1497#endif
1498#ifdef CL_CONTINUOUS_NONBLOCK
1499 x = PyInt_FromLong(CL_CONTINUOUS_NONBLOCK);
1500 if (x == NULL || PyDict_SetItemString(d, "CONTINUOUS_NONBLOCK", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001501 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001502 Py_DECREF(x);
1503#endif
1504#ifdef CL_COSMO_CODEC_CONTROL
1505 x = PyInt_FromLong(CL_COSMO_CODEC_CONTROL);
1506 if (x == NULL || PyDict_SetItemString(d, "COSMO_CODEC_CONTROL", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001507 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001508 Py_DECREF(x);
1509#endif
1510#ifdef CL_COSMO_NUM_PARAMS
1511 x = PyInt_FromLong(CL_COSMO_NUM_PARAMS);
1512 if (x == NULL || PyDict_SetItemString(d, "COSMO_NUM_PARAMS", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001513 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001514 Py_DECREF(x);
1515#endif
1516#ifdef CL_COSMO_VALUE_BASE
1517 x = PyInt_FromLong(CL_COSMO_VALUE_BASE);
1518 if (x == NULL || PyDict_SetItemString(d, "COSMO_VALUE_BASE", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001519 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001520 Py_DECREF(x);
1521#endif
1522#ifdef CL_COSMO_VIDEO_MANUAL_CONTROL
1523 x = PyInt_FromLong(CL_COSMO_VIDEO_MANUAL_CONTROL);
1524 if (x == NULL || PyDict_SetItemString(d, "COSMO_VIDEO_MANUAL_CONTROL", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001525 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001526 Py_DECREF(x);
1527#endif
1528#ifdef CL_COSMO_VIDEO_TRANSFER_MODE
1529 x = PyInt_FromLong(CL_COSMO_VIDEO_TRANSFER_MODE);
1530 if (x == NULL || PyDict_SetItemString(d, "COSMO_VIDEO_TRANSFER_MODE", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001531 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001532 Py_DECREF(x);
1533#endif
1534#ifdef CL_DATA
1535 x = PyInt_FromLong(CL_DATA);
1536 if (x == NULL || PyDict_SetItemString(d, "DATA", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001537 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001538 Py_DECREF(x);
1539#endif
1540#ifdef CL_DECOMPRESSOR
1541 x = PyInt_FromLong(CL_DECOMPRESSOR);
1542 if (x == NULL || PyDict_SetItemString(d, "DECOMPRESSOR", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001543 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001544 Py_DECREF(x);
1545#endif
1546#ifdef CL_DSO_ERROR
1547 x = PyInt_FromLong(CL_DSO_ERROR);
1548 if (x == NULL || PyDict_SetItemString(d, "DSO_ERROR", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001549 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001550 Py_DECREF(x);
1551#endif
1552#ifdef CL_EDGE_THRESHOLD
1553 x = PyInt_FromLong(CL_EDGE_THRESHOLD);
1554 if (x == NULL || PyDict_SetItemString(d, "EDGE_THRESHOLD", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001555 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001556 Py_DECREF(x);
1557#endif
1558#ifdef CL_ENABLE_IMAGEINFO
1559 x = PyInt_FromLong(CL_ENABLE_IMAGEINFO);
1560 if (x == NULL || PyDict_SetItemString(d, "ENABLE_IMAGEINFO", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001561 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001562 Py_DECREF(x);
1563#endif
1564#ifdef CL_END_OF_SEQUENCE
1565 x = PyInt_FromLong(CL_END_OF_SEQUENCE);
1566 if (x == NULL || PyDict_SetItemString(d, "END_OF_SEQUENCE", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001567 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001568 Py_DECREF(x);
1569#endif
1570#ifdef CL_ENUM_VALUE
1571 x = PyInt_FromLong(CL_ENUM_VALUE);
1572 if (x == NULL || PyDict_SetItemString(d, "ENUM_VALUE", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001573 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001574 Py_DECREF(x);
1575#endif
1576#ifdef CL_EXACT_COMPRESSION_RATIO
1577 x = PyInt_FromLong(CL_EXACT_COMPRESSION_RATIO);
1578 if (x == NULL || PyDict_SetItemString(d, "EXACT_COMPRESSION_RATIO", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001579 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001580 Py_DECREF(x);
1581#endif
1582#ifdef CL_EXTERNAL_DEVICE
1583 x = PyInt_FromLong((long) CL_EXTERNAL_DEVICE);
1584 if (x == NULL || PyDict_SetItemString(d, "EXTERNAL_DEVICE", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001585 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001586 Py_DECREF(x);
1587#endif
1588#ifdef CL_FLOATING_ENUM_VALUE
1589 x = PyInt_FromLong(CL_FLOATING_ENUM_VALUE);
1590 if (x == NULL || PyDict_SetItemString(d, "FLOATING_ENUM_VALUE", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001591 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001592 Py_DECREF(x);
1593#endif
1594#ifdef CL_FLOATING_RANGE_VALUE
1595 x = PyInt_FromLong(CL_FLOATING_RANGE_VALUE);
1596 if (x == NULL || PyDict_SetItemString(d, "FLOATING_RANGE_VALUE", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001597 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001598 Py_DECREF(x);
1599#endif
1600#ifdef CL_FORMAT
1601 x = PyInt_FromLong(CL_FORMAT);
1602 if (x == NULL || PyDict_SetItemString(d, "FORMAT", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001603 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001604 Py_DECREF(x);
1605#endif
1606#ifdef CL_FORMAT_ABGR
1607 x = PyInt_FromLong(CL_FORMAT_ABGR);
1608 if (x == NULL || PyDict_SetItemString(d, "FORMAT_ABGR", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001609 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001610 Py_DECREF(x);
1611#endif
1612#ifdef CL_FORMAT_BGR
1613 x = PyInt_FromLong(CL_FORMAT_BGR);
1614 if (x == NULL || PyDict_SetItemString(d, "FORMAT_BGR", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001615 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001616 Py_DECREF(x);
1617#endif
1618#ifdef CL_FORMAT_BGR233
1619 x = PyInt_FromLong(CL_FORMAT_BGR233);
1620 if (x == NULL || PyDict_SetItemString(d, "FORMAT_BGR233", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001621 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001622 Py_DECREF(x);
1623#endif
1624#ifdef CL_FORMAT_GRAYSCALE
1625 x = PyInt_FromLong(CL_FORMAT_GRAYSCALE);
1626 if (x == NULL || PyDict_SetItemString(d, "FORMAT_GRAYSCALE", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001627 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001628 Py_DECREF(x);
1629#endif
1630#ifdef CL_FORMAT_MONO
1631 x = PyInt_FromLong(CL_FORMAT_MONO);
1632 if (x == NULL || PyDict_SetItemString(d, "FORMAT_MONO", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001633 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001634 Py_DECREF(x);
1635#endif
1636#ifdef CL_FORMAT_RBG323
1637 x = PyInt_FromLong(CL_FORMAT_RBG323);
1638 if (x == NULL || PyDict_SetItemString(d, "FORMAT_RBG323", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001639 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001640 Py_DECREF(x);
1641#endif
1642#ifdef CL_FORMAT_STEREO_INTERLEAVED
1643 x = PyInt_FromLong(CL_FORMAT_STEREO_INTERLEAVED);
1644 if (x == NULL || PyDict_SetItemString(d, "FORMAT_STEREO_INTERLEAVED", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001645 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001646 Py_DECREF(x);
1647#endif
1648#ifdef CL_FORMAT_XBGR
1649 x = PyInt_FromLong(CL_FORMAT_XBGR);
1650 if (x == NULL || PyDict_SetItemString(d, "FORMAT_XBGR", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001651 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001652 Py_DECREF(x);
1653#endif
1654#ifdef CL_FORMAT_YCbCr
1655 x = PyInt_FromLong(CL_FORMAT_YCbCr);
1656 if (x == NULL || PyDict_SetItemString(d, "FORMAT_YCbCr", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001657 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001658 Py_DECREF(x);
1659#endif
1660#ifdef CL_FORMAT_YCbCr422
1661 x = PyInt_FromLong(CL_FORMAT_YCbCr422);
1662 if (x == NULL || PyDict_SetItemString(d, "FORMAT_YCbCr422", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001663 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001664 Py_DECREF(x);
1665#endif
1666#ifdef CL_FORMAT_YCbCr422DC
1667 x = PyInt_FromLong(CL_FORMAT_YCbCr422DC);
1668 if (x == NULL || PyDict_SetItemString(d, "FORMAT_YCbCr422DC", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001669 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001670 Py_DECREF(x);
Sjoerd Mullender3db845b1995-05-17 11:16:52 +00001671#endif
1672#ifdef CL_FRAME
Guido van Rossum72429051997-08-12 14:58:54 +00001673 x = PyInt_FromLong(CL_FRAME);
1674 if (x == NULL || PyDict_SetItemString(d, "FRAME", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001675 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001676 Py_DECREF(x);
Sjoerd Mullender3db845b1995-05-17 11:16:52 +00001677#endif
Guido van Rossum72429051997-08-12 14:58:54 +00001678#ifdef CL_FRAMES_PER_CHUNK
1679 x = PyInt_FromLong(CL_FRAMES_PER_CHUNK);
1680 if (x == NULL || PyDict_SetItemString(d, "FRAMES_PER_CHUNK", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001681 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001682 Py_DECREF(x);
Sjoerd Mullender3db845b1995-05-17 11:16:52 +00001683#endif
Guido van Rossum72429051997-08-12 14:58:54 +00001684#ifdef CL_FRAME_BUFFER_SIZE
1685 x = PyInt_FromLong(CL_FRAME_BUFFER_SIZE);
1686 if (x == NULL || PyDict_SetItemString(d, "FRAME_BUFFER_SIZE", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001687 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001688 Py_DECREF(x);
1689#endif
1690#ifdef CL_FRAME_BUFFER_SIZE_ZERO
1691 x = PyInt_FromLong(CL_FRAME_BUFFER_SIZE_ZERO);
1692 if (x == NULL || PyDict_SetItemString(d, "FRAME_BUFFER_SIZE_ZERO", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001693 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001694 Py_DECREF(x);
1695#endif
1696#ifdef CL_FRAME_INDEX
1697 x = PyInt_FromLong(CL_FRAME_INDEX);
1698 if (x == NULL || PyDict_SetItemString(d, "FRAME_INDEX", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001699 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001700 Py_DECREF(x);
1701#endif
1702#ifdef CL_FRAME_RATE
1703 x = PyInt_FromLong(CL_FRAME_RATE);
1704 if (x == NULL || PyDict_SetItemString(d, "FRAME_RATE", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001705 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001706 Py_DECREF(x);
1707#endif
1708#ifdef CL_FRAME_SIZE
1709 x = PyInt_FromLong(CL_FRAME_SIZE);
1710 if (x == NULL || PyDict_SetItemString(d, "FRAME_SIZE", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001711 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001712 Py_DECREF(x);
1713#endif
1714#ifdef CL_FRAME_TYPE
1715 x = PyInt_FromLong(CL_FRAME_TYPE);
1716 if (x == NULL || PyDict_SetItemString(d, "FRAME_TYPE", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001717 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001718 Py_DECREF(x);
1719#endif
1720#ifdef CL_G711_ALAW
1721 x = PyInt_FromLong(CL_G711_ALAW);
1722 if (x == NULL || PyDict_SetItemString(d, "G711_ALAW", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001723 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001724 Py_DECREF(x);
1725#endif
1726#ifdef CL_G711_ALAW_SOFTWARE
1727 x = PyInt_FromLong(CL_G711_ALAW_SOFTWARE);
1728 if (x == NULL || PyDict_SetItemString(d, "G711_ALAW_SOFTWARE", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001729 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001730 Py_DECREF(x);
1731#endif
1732#ifdef CL_G711_ULAW
1733 x = PyInt_FromLong(CL_G711_ULAW);
1734 if (x == NULL || PyDict_SetItemString(d, "G711_ULAW", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001735 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001736 Py_DECREF(x);
1737#endif
1738#ifdef CL_G711_ULAW_SOFTWARE
1739 x = PyInt_FromLong(CL_G711_ULAW_SOFTWARE);
1740 if (x == NULL || PyDict_SetItemString(d, "G711_ULAW_SOFTWARE", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001741 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001742 Py_DECREF(x);
1743#endif
1744#ifdef CL_GRAYSCALE
1745 x = PyInt_FromLong(CL_GRAYSCALE);
1746 if (x == NULL || PyDict_SetItemString(d, "GRAYSCALE", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001747 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001748 Py_DECREF(x);
1749#endif
1750#ifdef CL_HDCC
1751 x = PyInt_FromLong(CL_HDCC);
1752 if (x == NULL || PyDict_SetItemString(d, "HDCC", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001753 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001754 Py_DECREF(x);
1755#endif
1756#ifdef CL_HDCC_SAMPLES_PER_TILE
1757 x = PyInt_FromLong(CL_HDCC_SAMPLES_PER_TILE);
1758 if (x == NULL || PyDict_SetItemString(d, "HDCC_SAMPLES_PER_TILE", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001759 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001760 Py_DECREF(x);
1761#endif
1762#ifdef CL_HDCC_SOFTWARE
1763 x = PyInt_FromLong(CL_HDCC_SOFTWARE);
1764 if (x == NULL || PyDict_SetItemString(d, "HDCC_SOFTWARE", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001765 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001766 Py_DECREF(x);
1767#endif
1768#ifdef CL_HDCC_TILE_THRESHOLD
1769 x = PyInt_FromLong(CL_HDCC_TILE_THRESHOLD);
1770 if (x == NULL || PyDict_SetItemString(d, "HDCC_TILE_THRESHOLD", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001771 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001772 Py_DECREF(x);
1773#endif
1774#ifdef CL_HEADER_START_CODE
1775 x = PyInt_FromLong(CL_HEADER_START_CODE);
1776 if (x == NULL || PyDict_SetItemString(d, "HEADER_START_CODE", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001777 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001778 Py_DECREF(x);
1779#endif
1780#ifdef CL_IMAGEINFO_FIELDMASK
1781 x = PyInt_FromLong(CL_IMAGEINFO_FIELDMASK);
1782 if (x == NULL || PyDict_SetItemString(d, "IMAGEINFO_FIELDMASK", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001783 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001784 Py_DECREF(x);
1785#endif
1786#ifdef CL_IMAGE_CROP_BOTTOM
1787 x = PyInt_FromLong(CL_IMAGE_CROP_BOTTOM);
1788 if (x == NULL || PyDict_SetItemString(d, "IMAGE_CROP_BOTTOM", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001789 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001790 Py_DECREF(x);
1791#endif
1792#ifdef CL_IMAGE_CROP_LEFT
1793 x = PyInt_FromLong(CL_IMAGE_CROP_LEFT);
1794 if (x == NULL || PyDict_SetItemString(d, "IMAGE_CROP_LEFT", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001795 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001796 Py_DECREF(x);
1797#endif
1798#ifdef CL_IMAGE_CROP_RIGHT
1799 x = PyInt_FromLong(CL_IMAGE_CROP_RIGHT);
1800 if (x == NULL || PyDict_SetItemString(d, "IMAGE_CROP_RIGHT", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001801 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001802 Py_DECREF(x);
1803#endif
1804#ifdef CL_IMAGE_CROP_TOP
1805 x = PyInt_FromLong(CL_IMAGE_CROP_TOP);
1806 if (x == NULL || PyDict_SetItemString(d, "IMAGE_CROP_TOP", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001807 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001808 Py_DECREF(x);
1809#endif
1810#ifdef CL_IMAGE_HEIGHT
1811 x = PyInt_FromLong(CL_IMAGE_HEIGHT);
1812 if (x == NULL || PyDict_SetItemString(d, "IMAGE_HEIGHT", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001813 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001814 Py_DECREF(x);
1815#endif
1816#ifdef CL_IMAGE_WIDTH
1817 x = PyInt_FromLong(CL_IMAGE_WIDTH);
1818 if (x == NULL || PyDict_SetItemString(d, "IMAGE_WIDTH", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001819 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001820 Py_DECREF(x);
1821#endif
1822#ifdef CL_IMPACT_CODEC_CONTROL
1823 x = PyInt_FromLong(CL_IMPACT_CODEC_CONTROL);
1824 if (x == NULL || PyDict_SetItemString(d, "IMPACT_CODEC_CONTROL", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001825 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001826 Py_DECREF(x);
1827#endif
1828#ifdef CL_IMPACT_FRAME_INTERLEAVE
1829 x = PyInt_FromLong(CL_IMPACT_FRAME_INTERLEAVE);
1830 if (x == NULL || PyDict_SetItemString(d, "IMPACT_FRAME_INTERLEAVE", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001831 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001832 Py_DECREF(x);
1833#endif
1834#ifdef CL_IMPACT_NUM_PARAMS
1835 x = PyInt_FromLong(CL_IMPACT_NUM_PARAMS);
1836 if (x == NULL || PyDict_SetItemString(d, "IMPACT_NUM_PARAMS", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001837 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001838 Py_DECREF(x);
1839#endif
1840#ifdef CL_INTERNAL_FORMAT
1841 x = PyInt_FromLong(CL_INTERNAL_FORMAT);
1842 if (x == NULL || PyDict_SetItemString(d, "INTERNAL_FORMAT", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001843 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001844 Py_DECREF(x);
1845#endif
1846#ifdef CL_INTERNAL_IMAGE_HEIGHT
1847 x = PyInt_FromLong(CL_INTERNAL_IMAGE_HEIGHT);
1848 if (x == NULL || PyDict_SetItemString(d, "INTERNAL_IMAGE_HEIGHT", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001849 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001850 Py_DECREF(x);
1851#endif
1852#ifdef CL_INTERNAL_IMAGE_WIDTH
1853 x = PyInt_FromLong(CL_INTERNAL_IMAGE_WIDTH);
1854 if (x == NULL || PyDict_SetItemString(d, "INTERNAL_IMAGE_WIDTH", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001855 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001856 Py_DECREF(x);
1857#endif
1858#ifdef CL_INTRA
1859 x = PyInt_FromLong(CL_INTRA);
1860 if (x == NULL || PyDict_SetItemString(d, "INTRA", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001861 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001862 Py_DECREF(x);
1863#endif
1864#ifdef CL_JPEG
1865 x = PyInt_FromLong(CL_JPEG);
1866 if (x == NULL || PyDict_SetItemString(d, "JPEG", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001867 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001868 Py_DECREF(x);
1869#endif
1870#ifdef CL_JPEG_COSMO
1871 x = PyInt_FromLong(CL_JPEG_COSMO);
1872 if (x == NULL || PyDict_SetItemString(d, "JPEG_COSMO", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001873 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001874 Py_DECREF(x);
1875#endif
1876#ifdef CL_JPEG_ERROR
1877 x = PyInt_FromLong(CL_JPEG_ERROR);
1878 if (x == NULL || PyDict_SetItemString(d, "JPEG_ERROR", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001879 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001880 Py_DECREF(x);
1881#endif
1882#ifdef CL_JPEG_IMPACT
1883 x = PyInt_FromLong(CL_JPEG_IMPACT);
1884 if (x == NULL || PyDict_SetItemString(d, "JPEG_IMPACT", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001885 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001886 Py_DECREF(x);
1887#endif
1888#ifdef CL_JPEG_NUM_PARAMS
1889 x = PyInt_FromLong(CL_JPEG_NUM_PARAMS);
1890 if (x == NULL || PyDict_SetItemString(d, "JPEG_NUM_PARAMS", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001891 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001892 Py_DECREF(x);
1893#endif
1894#ifdef CL_JPEG_QUALITY_FACTOR
1895 x = PyInt_FromLong(CL_JPEG_QUALITY_FACTOR);
1896 if (x == NULL || PyDict_SetItemString(d, "JPEG_QUALITY_FACTOR", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001897 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001898 Py_DECREF(x);
1899#endif
1900#ifdef CL_JPEG_QUANTIZATION_TABLES
1901 x = PyInt_FromLong(CL_JPEG_QUANTIZATION_TABLES);
1902 if (x == NULL || PyDict_SetItemString(d, "JPEG_QUANTIZATION_TABLES", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001903 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001904 Py_DECREF(x);
1905#endif
1906#ifdef CL_JPEG_SOFTWARE
1907 x = PyInt_FromLong(CL_JPEG_SOFTWARE);
1908 if (x == NULL || PyDict_SetItemString(d, "JPEG_SOFTWARE", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001909 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001910 Py_DECREF(x);
1911#endif
1912#ifdef CL_JPEG_STREAM_HEADERS
1913 x = PyInt_FromLong(CL_JPEG_STREAM_HEADERS);
1914 if (x == NULL || PyDict_SetItemString(d, "JPEG_STREAM_HEADERS", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001915 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001916 Py_DECREF(x);
1917#endif
1918#ifdef CL_KEYFRAME
1919 x = PyInt_FromLong(CL_KEYFRAME);
1920 if (x == NULL || PyDict_SetItemString(d, "KEYFRAME", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001921 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001922 Py_DECREF(x);
1923#endif
1924#ifdef CL_KEYFRAME_DISTANCE
1925 x = PyInt_FromLong(CL_KEYFRAME_DISTANCE);
1926 if (x == NULL || PyDict_SetItemString(d, "KEYFRAME_DISTANCE", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001927 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001928 Py_DECREF(x);
1929#endif
1930#ifdef CL_LAST_FRAME_INDEX
1931 x = PyInt_FromLong(CL_LAST_FRAME_INDEX);
1932 if (x == NULL || PyDict_SetItemString(d, "LAST_FRAME_INDEX", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001933 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001934 Py_DECREF(x);
1935#endif
1936#ifdef CL_LAYER
1937 x = PyInt_FromLong(CL_LAYER);
1938 if (x == NULL || PyDict_SetItemString(d, "LAYER", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001939 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001940 Py_DECREF(x);
Sjoerd Mullender3db845b1995-05-17 11:16:52 +00001941#endif
1942#ifdef CL_LUMA_THRESHOLD
Guido van Rossum72429051997-08-12 14:58:54 +00001943 x = PyInt_FromLong(CL_LUMA_THRESHOLD);
1944 if (x == NULL || PyDict_SetItemString(d, "LUMA_THRESHOLD", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001945 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001946 Py_DECREF(x);
1947#endif
1948#ifdef CL_MAX_NUMBER_OF_AUDIO_ALGORITHMS
1949 x = PyInt_FromLong(CL_MAX_NUMBER_OF_AUDIO_ALGORITHMS);
1950 if (x == NULL || PyDict_SetItemString(d, "MAX_NUMBER_OF_AUDIO_ALGORITHMS", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001951 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001952 Py_DECREF(x);
1953#endif
1954#ifdef CL_MAX_NUMBER_OF_FORMATS
1955 x = PyInt_FromLong(CL_MAX_NUMBER_OF_FORMATS);
1956 if (x == NULL || PyDict_SetItemString(d, "MAX_NUMBER_OF_FORMATS", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001957 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001958 Py_DECREF(x);
1959#endif
1960#ifdef CL_MAX_NUMBER_OF_ORIGINAL_FORMATS
1961 x = PyInt_FromLong(CL_MAX_NUMBER_OF_ORIGINAL_FORMATS);
1962 if (x == NULL || PyDict_SetItemString(d, "MAX_NUMBER_OF_ORIGINAL_FORMATS", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001963 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001964 Py_DECREF(x);
1965#endif
1966#ifdef CL_MAX_NUMBER_OF_PARAMS
1967 x = PyInt_FromLong(CL_MAX_NUMBER_OF_PARAMS);
1968 if (x == NULL || PyDict_SetItemString(d, "MAX_NUMBER_OF_PARAMS", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001969 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001970 Py_DECREF(x);
1971#endif
1972#ifdef CL_MAX_NUMBER_OF_VIDEO_ALGORITHMS
1973 x = PyInt_FromLong(CL_MAX_NUMBER_OF_VIDEO_ALGORITHMS);
1974 if (x == NULL || PyDict_SetItemString(d, "MAX_NUMBER_OF_VIDEO_ALGORITHMS", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001975 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001976 Py_DECREF(x);
1977#endif
1978#ifdef CL_MONO
1979 x = PyInt_FromLong(CL_MONO);
1980 if (x == NULL || PyDict_SetItemString(d, "MONO", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001981 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001982 Py_DECREF(x);
1983#endif
1984#ifdef CL_MPEG1_AUDIO_AWARE
1985 x = PyInt_FromLong(CL_MPEG1_AUDIO_AWARE);
1986 if (x == NULL || PyDict_SetItemString(d, "MPEG1_AUDIO_AWARE", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001987 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001988 Py_DECREF(x);
1989#endif
1990#ifdef CL_MPEG1_AUDIO_LAYER
1991 x = PyInt_FromLong(CL_MPEG1_AUDIO_LAYER);
1992 if (x == NULL || PyDict_SetItemString(d, "MPEG1_AUDIO_LAYER", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001993 return;
Guido van Rossum72429051997-08-12 14:58:54 +00001994 Py_DECREF(x);
1995#endif
1996#ifdef CL_MPEG1_AUDIO_LAYER_I
1997 x = PyInt_FromLong(CL_MPEG1_AUDIO_LAYER_I);
1998 if (x == NULL || PyDict_SetItemString(d, "MPEG1_AUDIO_LAYER_I", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00001999 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002000 Py_DECREF(x);
2001#endif
2002#ifdef CL_MPEG1_AUDIO_LAYER_II
2003 x = PyInt_FromLong(CL_MPEG1_AUDIO_LAYER_II);
2004 if (x == NULL || PyDict_SetItemString(d, "MPEG1_AUDIO_LAYER_II", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002005 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002006 Py_DECREF(x);
2007#endif
2008#ifdef CL_MPEG1_AUDIO_MODE
2009 x = PyInt_FromLong(CL_MPEG1_AUDIO_MODE);
2010 if (x == NULL || PyDict_SetItemString(d, "MPEG1_AUDIO_MODE", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002011 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002012 Py_DECREF(x);
2013#endif
2014#ifdef CL_MPEG1_AUDIO_MODE_DUAL
2015 x = PyInt_FromLong(CL_MPEG1_AUDIO_MODE_DUAL);
2016 if (x == NULL || PyDict_SetItemString(d, "MPEG1_AUDIO_MODE_DUAL", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002017 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002018 Py_DECREF(x);
2019#endif
2020#ifdef CL_MPEG1_AUDIO_MODE_JOINT
2021 x = PyInt_FromLong(CL_MPEG1_AUDIO_MODE_JOINT);
2022 if (x == NULL || PyDict_SetItemString(d, "MPEG1_AUDIO_MODE_JOINT", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002023 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002024 Py_DECREF(x);
2025#endif
2026#ifdef CL_MPEG1_AUDIO_MODE_SINGLE
2027 x = PyInt_FromLong(CL_MPEG1_AUDIO_MODE_SINGLE);
2028 if (x == NULL || PyDict_SetItemString(d, "MPEG1_AUDIO_MODE_SINGLE", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002029 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002030 Py_DECREF(x);
2031#endif
2032#ifdef CL_MPEG1_AUDIO_MODE_STEREO
2033 x = PyInt_FromLong(CL_MPEG1_AUDIO_MODE_STEREO);
2034 if (x == NULL || PyDict_SetItemString(d, "MPEG1_AUDIO_MODE_STEREO", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002035 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002036 Py_DECREF(x);
2037#endif
2038#ifdef CL_MPEG1_AUDIO_SOFTWARE
2039 x = PyInt_FromLong(CL_MPEG1_AUDIO_SOFTWARE);
2040 if (x == NULL || PyDict_SetItemString(d, "MPEG1_AUDIO_SOFTWARE", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002041 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002042 Py_DECREF(x);
2043#endif
2044#ifdef CL_MPEG1_END_OF_STREAM
2045 x = PyInt_FromLong(CL_MPEG1_END_OF_STREAM);
2046 if (x == NULL || PyDict_SetItemString(d, "MPEG1_END_OF_STREAM", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002047 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002048 Py_DECREF(x);
2049#endif
2050#ifdef CL_MPEG1_ERROR
2051 x = PyInt_FromLong(CL_MPEG1_ERROR);
2052 if (x == NULL || PyDict_SetItemString(d, "MPEG1_ERROR", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002053 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002054 Py_DECREF(x);
2055#endif
2056#ifdef CL_MPEG1_NUM_PARAMS
2057 x = PyInt_FromLong(CL_MPEG1_NUM_PARAMS);
2058 if (x == NULL || PyDict_SetItemString(d, "MPEG1_NUM_PARAMS", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002059 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002060 Py_DECREF(x);
2061#endif
2062#ifdef CL_MPEG1_VIDEO_M
2063 x = PyInt_FromLong(CL_MPEG1_VIDEO_M);
2064 if (x == NULL || PyDict_SetItemString(d, "MPEG1_VIDEO_M", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002065 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002066 Py_DECREF(x);
2067#endif
2068#ifdef CL_MPEG1_VIDEO_MAX_MOTION_VECTOR_LENGTH_B_X
2069 x = PyInt_FromLong(CL_MPEG1_VIDEO_MAX_MOTION_VECTOR_LENGTH_B_X);
2070 if (x == NULL || PyDict_SetItemString(d, "MPEG1_VIDEO_MAX_MOTION_VECTOR_LENGTH_B_X", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002071 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002072 Py_DECREF(x);
2073#endif
2074#ifdef CL_MPEG1_VIDEO_MAX_MOTION_VECTOR_LENGTH_B_Y
2075 x = PyInt_FromLong(CL_MPEG1_VIDEO_MAX_MOTION_VECTOR_LENGTH_B_Y);
2076 if (x == NULL || PyDict_SetItemString(d, "MPEG1_VIDEO_MAX_MOTION_VECTOR_LENGTH_B_Y", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002077 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002078 Py_DECREF(x);
2079#endif
2080#ifdef CL_MPEG1_VIDEO_MAX_MOTION_VECTOR_LENGTH_P_X
2081 x = PyInt_FromLong(CL_MPEG1_VIDEO_MAX_MOTION_VECTOR_LENGTH_P_X);
2082 if (x == NULL || PyDict_SetItemString(d, "MPEG1_VIDEO_MAX_MOTION_VECTOR_LENGTH_P_X", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002083 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002084 Py_DECREF(x);
2085#endif
2086#ifdef CL_MPEG1_VIDEO_MAX_MOTION_VECTOR_LENGTH_P_Y
2087 x = PyInt_FromLong(CL_MPEG1_VIDEO_MAX_MOTION_VECTOR_LENGTH_P_Y);
2088 if (x == NULL || PyDict_SetItemString(d, "MPEG1_VIDEO_MAX_MOTION_VECTOR_LENGTH_P_Y", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002089 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002090 Py_DECREF(x);
2091#endif
2092#ifdef CL_MPEG1_VIDEO_N
2093 x = PyInt_FromLong(CL_MPEG1_VIDEO_N);
2094 if (x == NULL || PyDict_SetItemString(d, "MPEG1_VIDEO_N", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002095 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002096 Py_DECREF(x);
2097#endif
2098#ifdef CL_MPEG1_VIDEO_SOFTNESS
2099 x = PyInt_FromLong(CL_MPEG1_VIDEO_SOFTNESS);
2100 if (x == NULL || PyDict_SetItemString(d, "MPEG1_VIDEO_SOFTNESS", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002101 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002102 Py_DECREF(x);
2103#endif
2104#ifdef CL_MPEG1_VIDEO_SOFTNESS_MAXIMUM
2105 x = PyInt_FromLong(CL_MPEG1_VIDEO_SOFTNESS_MAXIMUM);
2106 if (x == NULL || PyDict_SetItemString(d, "MPEG1_VIDEO_SOFTNESS_MAXIMUM", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002107 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002108 Py_DECREF(x);
2109#endif
2110#ifdef CL_MPEG1_VIDEO_SOFTNESS_MEDIUM
2111 x = PyInt_FromLong(CL_MPEG1_VIDEO_SOFTNESS_MEDIUM);
2112 if (x == NULL || PyDict_SetItemString(d, "MPEG1_VIDEO_SOFTNESS_MEDIUM", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002113 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002114 Py_DECREF(x);
2115#endif
2116#ifdef CL_MPEG1_VIDEO_SOFTNESS_NONE
2117 x = PyInt_FromLong(CL_MPEG1_VIDEO_SOFTNESS_NONE);
2118 if (x == NULL || PyDict_SetItemString(d, "MPEG1_VIDEO_SOFTNESS_NONE", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002119 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002120 Py_DECREF(x);
2121#endif
2122#ifdef CL_MPEG1_VIDEO_SOFTWARE
2123 x = PyInt_FromLong(CL_MPEG1_VIDEO_SOFTWARE);
2124 if (x == NULL || PyDict_SetItemString(d, "MPEG1_VIDEO_SOFTWARE", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002125 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002126 Py_DECREF(x);
2127#endif
2128#ifdef CL_MPEG_VIDEO
2129 x = PyInt_FromLong(CL_MPEG_VIDEO);
2130 if (x == NULL || PyDict_SetItemString(d, "MPEG_VIDEO", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002131 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002132 Py_DECREF(x);
2133#endif
2134#ifdef CL_MULTIRATE_AWARE
2135 x = PyInt_FromLong(CL_MULTIRATE_AWARE);
2136 if (x == NULL || PyDict_SetItemString(d, "MULTIRATE_AWARE", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002137 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002138 Py_DECREF(x);
2139#endif
2140#ifdef CL_MVC1
2141 x = PyInt_FromLong(CL_MVC1);
2142 if (x == NULL || PyDict_SetItemString(d, "MVC1", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002143 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002144 Py_DECREF(x);
2145#endif
2146#ifdef CL_MVC1_SOFTWARE
2147 x = PyInt_FromLong(CL_MVC1_SOFTWARE);
2148 if (x == NULL || PyDict_SetItemString(d, "MVC1_SOFTWARE", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002149 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002150 Py_DECREF(x);
2151#endif
2152#ifdef CL_MVC2
2153 x = PyInt_FromLong(CL_MVC2);
2154 if (x == NULL || PyDict_SetItemString(d, "MVC2", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002155 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002156 Py_DECREF(x);
2157#endif
2158#ifdef CL_MVC2_BLENDING
2159 x = PyInt_FromLong(CL_MVC2_BLENDING);
2160 if (x == NULL || PyDict_SetItemString(d, "MVC2_BLENDING", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002161 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002162 Py_DECREF(x);
2163#endif
2164#ifdef CL_MVC2_BLENDING_OFF
2165 x = PyInt_FromLong(CL_MVC2_BLENDING_OFF);
2166 if (x == NULL || PyDict_SetItemString(d, "MVC2_BLENDING_OFF", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002167 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002168 Py_DECREF(x);
2169#endif
2170#ifdef CL_MVC2_BLENDING_ON
2171 x = PyInt_FromLong(CL_MVC2_BLENDING_ON);
2172 if (x == NULL || PyDict_SetItemString(d, "MVC2_BLENDING_ON", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002173 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002174 Py_DECREF(x);
2175#endif
2176#ifdef CL_MVC2_CHROMA_THRESHOLD
2177 x = PyInt_FromLong(CL_MVC2_CHROMA_THRESHOLD);
2178 if (x == NULL || PyDict_SetItemString(d, "MVC2_CHROMA_THRESHOLD", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002179 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002180 Py_DECREF(x);
2181#endif
2182#ifdef CL_MVC2_EDGE_THRESHOLD
2183 x = PyInt_FromLong(CL_MVC2_EDGE_THRESHOLD);
2184 if (x == NULL || PyDict_SetItemString(d, "MVC2_EDGE_THRESHOLD", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002185 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002186 Py_DECREF(x);
2187#endif
2188#ifdef CL_MVC2_ERROR
2189 x = PyInt_FromLong(CL_MVC2_ERROR);
2190 if (x == NULL || PyDict_SetItemString(d, "MVC2_ERROR", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002191 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002192 Py_DECREF(x);
2193#endif
2194#ifdef CL_MVC2_LUMA_THRESHOLD
2195 x = PyInt_FromLong(CL_MVC2_LUMA_THRESHOLD);
2196 if (x == NULL || PyDict_SetItemString(d, "MVC2_LUMA_THRESHOLD", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002197 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002198 Py_DECREF(x);
2199#endif
2200#ifdef CL_MVC2_SOFTWARE
2201 x = PyInt_FromLong(CL_MVC2_SOFTWARE);
2202 if (x == NULL || PyDict_SetItemString(d, "MVC2_SOFTWARE", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002203 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002204 Py_DECREF(x);
2205#endif
2206#ifdef CL_MVC3_QUALITY_LEVEL
2207 x = PyInt_FromLong(CL_MVC3_QUALITY_LEVEL);
2208 if (x == NULL || PyDict_SetItemString(d, "MVC3_QUALITY_LEVEL", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002209 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002210 Py_DECREF(x);
2211#endif
2212#ifdef CL_MVC3_SOFTWARE
2213 x = PyInt_FromLong(CL_MVC3_SOFTWARE);
2214 if (x == NULL || PyDict_SetItemString(d, "MVC3_SOFTWARE", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002215 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002216 Py_DECREF(x);
2217#endif
2218#ifdef CL_NEXT_NOT_AVAILABLE
2219 x = PyInt_FromLong(CL_NEXT_NOT_AVAILABLE);
2220 if (x == NULL || PyDict_SetItemString(d, "NEXT_NOT_AVAILABLE", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002221 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002222 Py_DECREF(x);
2223#endif
2224#ifdef CL_NOISE_MARGIN
2225 x = PyInt_FromLong(CL_NOISE_MARGIN);
2226 if (x == NULL || PyDict_SetItemString(d, "NOISE_MARGIN", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002227 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002228 Py_DECREF(x);
2229#endif
2230#ifdef CL_NONE
2231 x = PyInt_FromLong(CL_NONE);
2232 if (x == NULL || PyDict_SetItemString(d, "NONE", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002233 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002234 Py_DECREF(x);
2235#endif
2236#ifdef CL_NUMBER_OF_FORMATS
2237 x = PyInt_FromLong(CL_NUMBER_OF_FORMATS);
2238 if (x == NULL || PyDict_SetItemString(d, "NUMBER_OF_FORMATS", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002239 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002240 Py_DECREF(x);
2241#endif
2242#ifdef CL_NUMBER_OF_FRAMES
2243 x = PyInt_FromLong(CL_NUMBER_OF_FRAMES);
2244 if (x == NULL || PyDict_SetItemString(d, "NUMBER_OF_FRAMES", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002245 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002246 Py_DECREF(x);
2247#endif
2248#ifdef CL_NUMBER_OF_PARAMS
2249 x = PyInt_FromLong(CL_NUMBER_OF_PARAMS);
2250 if (x == NULL || PyDict_SetItemString(d, "NUMBER_OF_PARAMS", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002251 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002252 Py_DECREF(x);
2253#endif
2254#ifdef CL_NUMBER_OF_PARAMS_FREEZE
2255 x = PyInt_FromLong(CL_NUMBER_OF_PARAMS_FREEZE);
2256 if (x == NULL || PyDict_SetItemString(d, "NUMBER_OF_PARAMS_FREEZE", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002257 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002258 Py_DECREF(x);
2259#endif
2260#ifdef CL_NUMBER_OF_VIDEO_FORMATS
2261 x = PyInt_FromLong(CL_NUMBER_OF_VIDEO_FORMATS);
2262 if (x == NULL || PyDict_SetItemString(d, "NUMBER_OF_VIDEO_FORMATS", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002263 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002264 Py_DECREF(x);
2265#endif
2266#ifdef CL_ORIENTATION
2267 x = PyInt_FromLong(CL_ORIENTATION);
2268 if (x == NULL || PyDict_SetItemString(d, "ORIENTATION", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002269 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002270 Py_DECREF(x);
2271#endif
2272#ifdef CL_ORIGINAL_FORMAT
2273 x = PyInt_FromLong(CL_ORIGINAL_FORMAT);
2274 if (x == NULL || PyDict_SetItemString(d, "ORIGINAL_FORMAT", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002275 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002276 Py_DECREF(x);
2277#endif
2278#ifdef CL_PARAM_OUT_OF_RANGE
2279 x = PyInt_FromLong(CL_PARAM_OUT_OF_RANGE);
2280 if (x == NULL || PyDict_SetItemString(d, "PARAM_OUT_OF_RANGE", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002281 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002282 Py_DECREF(x);
2283#endif
2284#ifdef CL_PIXEL_ASPECT
2285 x = PyInt_FromLong(CL_PIXEL_ASPECT);
2286 if (x == NULL || PyDict_SetItemString(d, "PIXEL_ASPECT", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002287 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002288 Py_DECREF(x);
2289#endif
2290#ifdef CL_PREDICTED
2291 x = PyInt_FromLong(CL_PREDICTED);
2292 if (x == NULL || PyDict_SetItemString(d, "PREDICTED", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002293 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002294 Py_DECREF(x);
2295#endif
2296#ifdef CL_PREROLL
2297 x = PyInt_FromLong(CL_PREROLL);
2298 if (x == NULL || PyDict_SetItemString(d, "PREROLL", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002299 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002300 Py_DECREF(x);
2301#endif
2302#ifdef CL_QUALITY_FACTOR
2303 x = PyInt_FromLong(CL_QUALITY_FACTOR);
2304 if (x == NULL || PyDict_SetItemString(d, "QUALITY_FACTOR", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002305 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002306 Py_DECREF(x);
2307#endif
2308#ifdef CL_QUALITY_LEVEL
2309 x = PyInt_FromLong(CL_QUALITY_LEVEL);
2310 if (x == NULL || PyDict_SetItemString(d, "QUALITY_LEVEL", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002311 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002312 Py_DECREF(x);
2313#endif
2314#ifdef CL_QUALITY_SPATIAL
2315 x = PyInt_FromLong(CL_QUALITY_SPATIAL);
2316 if (x == NULL || PyDict_SetItemString(d, "QUALITY_SPATIAL", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002317 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002318 Py_DECREF(x);
2319#endif
2320#ifdef CL_QUALITY_TEMPORAL
2321 x = PyInt_FromLong(CL_QUALITY_TEMPORAL);
2322 if (x == NULL || PyDict_SetItemString(d, "QUALITY_TEMPORAL", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002323 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002324 Py_DECREF(x);
2325#endif
2326#ifdef CL_QUANTIZATION_TABLES
2327 x = PyInt_FromLong(CL_QUANTIZATION_TABLES);
2328 if (x == NULL || PyDict_SetItemString(d, "QUANTIZATION_TABLES", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002329 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002330 Py_DECREF(x);
2331#endif
2332#ifdef CL_RANGE_VALUE
2333 x = PyInt_FromLong(CL_RANGE_VALUE);
2334 if (x == NULL || PyDict_SetItemString(d, "RANGE_VALUE", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002335 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002336 Py_DECREF(x);
2337#endif
2338#ifdef CL_RGB
2339 x = PyInt_FromLong(CL_RGB);
2340 if (x == NULL || PyDict_SetItemString(d, "RGB", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002341 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002342 Py_DECREF(x);
2343#endif
2344#ifdef CL_RGB332
2345 x = PyInt_FromLong(CL_RGB332);
2346 if (x == NULL || PyDict_SetItemString(d, "RGB332", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002347 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002348 Py_DECREF(x);
2349#endif
2350#ifdef CL_RGB8
2351 x = PyInt_FromLong(CL_RGB8);
2352 if (x == NULL || PyDict_SetItemString(d, "RGB8", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002353 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002354 Py_DECREF(x);
2355#endif
2356#ifdef CL_RGBA
2357 x = PyInt_FromLong(CL_RGBA);
2358 if (x == NULL || PyDict_SetItemString(d, "RGBA", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002359 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002360 Py_DECREF(x);
2361#endif
2362#ifdef CL_RGBX
2363 x = PyInt_FromLong(CL_RGBX);
2364 if (x == NULL || PyDict_SetItemString(d, "RGBX", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002365 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002366 Py_DECREF(x);
2367#endif
2368#ifdef CL_RLE
2369 x = PyInt_FromLong(CL_RLE);
2370 if (x == NULL || PyDict_SetItemString(d, "RLE", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002371 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002372 Py_DECREF(x);
2373#endif
2374#ifdef CL_RLE24
2375 x = PyInt_FromLong(CL_RLE24);
2376 if (x == NULL || PyDict_SetItemString(d, "RLE24", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002377 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002378 Py_DECREF(x);
2379#endif
2380#ifdef CL_RLE24_SOFTWARE
2381 x = PyInt_FromLong(CL_RLE24_SOFTWARE);
2382 if (x == NULL || PyDict_SetItemString(d, "RLE24_SOFTWARE", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002383 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002384 Py_DECREF(x);
2385#endif
2386#ifdef CL_RLE_SOFTWARE
2387 x = PyInt_FromLong(CL_RLE_SOFTWARE);
2388 if (x == NULL || PyDict_SetItemString(d, "RLE_SOFTWARE", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002389 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002390 Py_DECREF(x);
2391#endif
2392#ifdef CL_RTR
2393 x = PyInt_FromLong(CL_RTR);
2394 if (x == NULL || PyDict_SetItemString(d, "RTR", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002395 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002396 Py_DECREF(x);
2397#endif
2398#ifdef CL_RTR1
2399 x = PyInt_FromLong(CL_RTR1);
2400 if (x == NULL || PyDict_SetItemString(d, "RTR1", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002401 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002402 Py_DECREF(x);
2403#endif
2404#ifdef CL_RTR_QUALITY_LEVEL
2405 x = PyInt_FromLong(CL_RTR_QUALITY_LEVEL);
2406 if (x == NULL || PyDict_SetItemString(d, "RTR_QUALITY_LEVEL", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002407 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002408 Py_DECREF(x);
2409#endif
2410#ifdef CL_SAMPLES_PER_TILE
2411 x = PyInt_FromLong(CL_SAMPLES_PER_TILE);
2412 if (x == NULL || PyDict_SetItemString(d, "SAMPLES_PER_TILE", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002413 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002414 Py_DECREF(x);
2415#endif
2416#ifdef CL_SCHEME_BUSY
2417 x = PyInt_FromLong(CL_SCHEME_BUSY);
2418 if (x == NULL || PyDict_SetItemString(d, "SCHEME_BUSY", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002419 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002420 Py_DECREF(x);
2421#endif
2422#ifdef CL_SCHEME_NOT_AVAILABLE
2423 x = PyInt_FromLong(CL_SCHEME_NOT_AVAILABLE);
2424 if (x == NULL || PyDict_SetItemString(d, "SCHEME_NOT_AVAILABLE", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002425 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002426 Py_DECREF(x);
2427#endif
2428#ifdef CL_SPEED
2429 x = PyInt_FromLong(CL_SPEED);
2430 if (x == NULL || PyDict_SetItemString(d, "SPEED", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002431 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002432 Py_DECREF(x);
2433#endif
2434#ifdef CL_STEREO_INTERLEAVED
2435 x = PyInt_FromLong(CL_STEREO_INTERLEAVED);
2436 if (x == NULL || PyDict_SetItemString(d, "STEREO_INTERLEAVED", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002437 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002438 Py_DECREF(x);
2439#endif
2440#ifdef CL_STREAM_HEADERS
2441 x = PyInt_FromLong(CL_STREAM_HEADERS);
2442 if (x == NULL || PyDict_SetItemString(d, "STREAM_HEADERS", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002443 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002444 Py_DECREF(x);
2445#endif
2446#ifdef CL_TILE_THRESHOLD
2447 x = PyInt_FromLong(CL_TILE_THRESHOLD);
2448 if (x == NULL || PyDict_SetItemString(d, "TILE_THRESHOLD", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002449 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002450 Py_DECREF(x);
2451#endif
2452#ifdef CL_TOP_DOWN
2453 x = PyInt_FromLong(CL_TOP_DOWN);
2454 if (x == NULL || PyDict_SetItemString(d, "TOP_DOWN", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002455 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002456 Py_DECREF(x);
2457#endif
2458#ifdef CL_ULAW
2459 x = PyInt_FromLong(CL_ULAW);
2460 if (x == NULL || PyDict_SetItemString(d, "ULAW", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002461 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002462 Py_DECREF(x);
2463#endif
2464#ifdef CL_UNCOMPRESSED
2465 x = PyInt_FromLong(CL_UNCOMPRESSED);
2466 if (x == NULL || PyDict_SetItemString(d, "UNCOMPRESSED", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002467 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002468 Py_DECREF(x);
2469#endif
2470#ifdef CL_UNCOMPRESSED_AUDIO
2471 x = PyInt_FromLong(CL_UNCOMPRESSED_AUDIO);
2472 if (x == NULL || PyDict_SetItemString(d, "UNCOMPRESSED_AUDIO", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002473 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002474 Py_DECREF(x);
2475#endif
2476#ifdef CL_UNCOMPRESSED_VIDEO
2477 x = PyInt_FromLong(CL_UNCOMPRESSED_VIDEO);
2478 if (x == NULL || PyDict_SetItemString(d, "UNCOMPRESSED_VIDEO", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002479 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002480 Py_DECREF(x);
2481#endif
2482#ifdef CL_UNKNOWN_SCHEME
2483 x = PyInt_FromLong(CL_UNKNOWN_SCHEME);
2484 if (x == NULL || PyDict_SetItemString(d, "UNKNOWN_SCHEME", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002485 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002486 Py_DECREF(x);
2487#endif
2488#ifdef CL_VIDEO
2489 x = PyInt_FromLong(CL_VIDEO);
2490 if (x == NULL || PyDict_SetItemString(d, "VIDEO", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002491 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002492 Py_DECREF(x);
2493#endif
2494#ifdef CL_Y
2495 x = PyInt_FromLong(CL_Y);
2496 if (x == NULL || PyDict_SetItemString(d, "Y", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002497 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002498 Py_DECREF(x);
2499#endif
2500#ifdef CL_YCbCr
2501 x = PyInt_FromLong(CL_YCbCr);
2502 if (x == NULL || PyDict_SetItemString(d, "YCbCr", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002503 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002504 Py_DECREF(x);
2505#endif
2506#ifdef CL_YCbCr422
2507 x = PyInt_FromLong(CL_YCbCr422);
2508 if (x == NULL || PyDict_SetItemString(d, "YCbCr422", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002509 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002510 Py_DECREF(x);
2511#endif
2512#ifdef CL_YCbCr422DC
2513 x = PyInt_FromLong(CL_YCbCr422DC);
2514 if (x == NULL || PyDict_SetItemString(d, "YCbCr422DC", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002515 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002516 Py_DECREF(x);
2517#endif
2518#ifdef CL_YCbCr422HC
2519 x = PyInt_FromLong(CL_YCbCr422HC);
2520 if (x == NULL || PyDict_SetItemString(d, "YCbCr422HC", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002521 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002522 Py_DECREF(x);
2523#endif
2524#ifdef CL_YUV
2525 x = PyInt_FromLong(CL_YUV);
2526 if (x == NULL || PyDict_SetItemString(d, "YUV", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002527 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002528 Py_DECREF(x);
2529#endif
2530#ifdef CL_YUV422
2531 x = PyInt_FromLong(CL_YUV422);
2532 if (x == NULL || PyDict_SetItemString(d, "YUV422", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002533 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002534 Py_DECREF(x);
2535#endif
2536#ifdef CL_YUV422DC
2537 x = PyInt_FromLong(CL_YUV422DC);
2538 if (x == NULL || PyDict_SetItemString(d, "YUV422DC", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002539 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002540 Py_DECREF(x);
2541#endif
2542#ifdef CL_YUV422HC
2543 x = PyInt_FromLong(CL_YUV422HC);
2544 if (x == NULL || PyDict_SetItemString(d, "YUV422HC", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002545 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002546 Py_DECREF(x);
2547#endif
2548#ifdef AWCMP_STEREO
2549 x = PyInt_FromLong(AWCMP_STEREO);
2550 if (x == NULL || PyDict_SetItemString(d, "AWCMP_STEREO", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002551 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002552 Py_DECREF(x);
2553#endif
2554#ifdef AWCMP_JOINT_STEREO
2555 x = PyInt_FromLong(AWCMP_JOINT_STEREO);
2556 if (x == NULL || PyDict_SetItemString(d, "AWCMP_JOINT_STEREO", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002557 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002558 Py_DECREF(x);
2559#endif
2560#ifdef AWCMP_INDEPENDENT
2561 x = PyInt_FromLong(AWCMP_INDEPENDENT);
2562 if (x == NULL || PyDict_SetItemString(d, "AWCMP_INDEPENDENT", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002563 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002564 Py_DECREF(x);
2565#endif
2566#ifdef AWCMP_FIXED_RATE
2567 x = PyInt_FromLong(AWCMP_FIXED_RATE);
2568 if (x == NULL || PyDict_SetItemString(d, "AWCMP_FIXED_RATE", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002569 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002570 Py_DECREF(x);
2571#endif
2572#ifdef AWCMP_CONST_QUAL
2573 x = PyInt_FromLong(AWCMP_CONST_QUAL);
2574 if (x == NULL || PyDict_SetItemString(d, "AWCMP_CONST_QUAL", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002575 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002576 Py_DECREF(x);
2577#endif
2578#ifdef AWCMP_LOSSLESS
2579 x = PyInt_FromLong(AWCMP_LOSSLESS);
2580 if (x == NULL || PyDict_SetItemString(d, "AWCMP_LOSSLESS", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002581 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002582 Py_DECREF(x);
2583#endif
2584#ifdef AWCMP_MPEG_LAYER_I
2585 x = PyInt_FromLong(AWCMP_MPEG_LAYER_I);
2586 if (x == NULL || PyDict_SetItemString(d, "AWCMP_MPEG_LAYER_I", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002587 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002588 Py_DECREF(x);
2589#endif
2590#ifdef AWCMP_MPEG_LAYER_II
2591 x = PyInt_FromLong(AWCMP_MPEG_LAYER_II);
2592 if (x == NULL || PyDict_SetItemString(d, "AWCMP_MPEG_LAYER_II", x) < 0)
Guido van Rossumb189a2f1997-10-08 15:26:28 +00002593 return;
Guido van Rossum72429051997-08-12 14:58:54 +00002594 Py_DECREF(x);
Sjoerd Mullender3db845b1995-05-17 11:16:52 +00002595#endif
2596
Sjoerd Mullenderd53a4f31992-09-24 10:37:39 +00002597 (void) clSetErrorHandler(cl_ErrorHandler);
Sjoerd Mullenderc4315491992-09-23 14:53:00 +00002598}