| 1 |
|
|---|
| 2 |
|
|---|
| 3 | /* Cl objects */
|
|---|
| 4 |
|
|---|
| 5 | #define CLDEBUG
|
|---|
| 6 |
|
|---|
| 7 | #include <stdarg.h>
|
|---|
| 8 | #include <cl.h>
|
|---|
| 9 | #if defined(CL_JPEG_SOFTWARE) && !defined(CL_JPEG_COSMO)
|
|---|
| 10 | #include <dmedia/cl_cosmo.h>
|
|---|
| 11 | #endif
|
|---|
| 12 | #include "Python.h"
|
|---|
| 13 |
|
|---|
| 14 | typedef struct {
|
|---|
| 15 | PyObject_HEAD
|
|---|
| 16 | int ob_isCompressor; /* Compressor or Decompressor */
|
|---|
| 17 | CL_Handle ob_compressorHdl;
|
|---|
| 18 | int *ob_paramtypes;
|
|---|
| 19 | int ob_nparams;
|
|---|
| 20 | } clobject;
|
|---|
| 21 |
|
|---|
| 22 | static PyObject *ClError; /* exception cl.error */
|
|---|
| 23 |
|
|---|
| 24 | static int error_handler_called = 0;
|
|---|
| 25 |
|
|---|
| 26 | /*
|
|---|
| 27 | * We want to use the function prototypes that are available in the C
|
|---|
| 28 | * compiler on the SGI. Because of that, we need to declare the first
|
|---|
| 29 | * argument of the compressor and decompressor methods as "object *",
|
|---|
| 30 | * even though they are really "clobject *". Therefore we cast the
|
|---|
| 31 | * argument to the proper type using this macro.
|
|---|
| 32 | */
|
|---|
| 33 | #define SELF ((clobject *) self)
|
|---|
| 34 |
|
|---|
| 35 | /********************************************************************
|
|---|
| 36 | Utility routines.
|
|---|
| 37 | ********************************************************************/
|
|---|
| 38 | static void
|
|---|
| 39 | cl_ErrorHandler(CL_Handle handle, int code, const char *fmt, ...)
|
|---|
| 40 | {
|
|---|
| 41 | va_list ap;
|
|---|
| 42 | char errbuf[BUFSIZ]; /* hopefully big enough */
|
|---|
| 43 | char *p;
|
|---|
| 44 |
|
|---|
| 45 | if (PyErr_Occurred()) /* don't change existing error */
|
|---|
| 46 | return;
|
|---|
| 47 | error_handler_called = 1;
|
|---|
| 48 | va_start(ap, fmt);
|
|---|
| 49 | vsprintf(errbuf, fmt, ap);
|
|---|
| 50 | va_end(ap);
|
|---|
| 51 | p = &errbuf[strlen(errbuf) - 1]; /* swat the line feed */
|
|---|
| 52 | if (*p == '\n')
|
|---|
| 53 | *p = 0;
|
|---|
| 54 | PyErr_SetString(ClError, errbuf);
|
|---|
| 55 | }
|
|---|
| 56 |
|
|---|
| 57 | /*
|
|---|
| 58 | * This assumes that params are always in the range 0 to some maximum.
|
|---|
| 59 | */
|
|---|
| 60 | static int
|
|---|
| 61 | param_type_is_float(clobject *self, int param)
|
|---|
| 62 | {
|
|---|
| 63 | int bufferlength;
|
|---|
| 64 |
|
|---|
| 65 | if (self->ob_paramtypes == NULL) {
|
|---|
| 66 | error_handler_called = 0;
|
|---|
| 67 | bufferlength = clQueryParams(self->ob_compressorHdl, 0, 0);
|
|---|
| 68 | if (error_handler_called)
|
|---|
| 69 | return -1;
|
|---|
| 70 |
|
|---|
| 71 | self->ob_paramtypes = PyMem_NEW(int, bufferlength);
|
|---|
| 72 | if (self->ob_paramtypes == NULL)
|
|---|
| 73 | return -1;
|
|---|
| 74 | self->ob_nparams = bufferlength / 2;
|
|---|
| 75 |
|
|---|
| 76 | (void) clQueryParams(self->ob_compressorHdl,
|
|---|
| 77 | self->ob_paramtypes, bufferlength);
|
|---|
| 78 | if (error_handler_called) {
|
|---|
| 79 | PyMem_DEL(self->ob_paramtypes);
|
|---|
| 80 | self->ob_paramtypes = NULL;
|
|---|
| 81 | return -1;
|
|---|
| 82 | }
|
|---|
| 83 | }
|
|---|
| 84 |
|
|---|
| 85 | if (param < 0 || param >= self->ob_nparams)
|
|---|
| 86 | return -1;
|
|---|
| 87 |
|
|---|
| 88 | if (self->ob_paramtypes[param*2 + 1] == CL_FLOATING_ENUM_VALUE ||
|
|---|
| 89 | self->ob_paramtypes[param*2 + 1] == CL_FLOATING_RANGE_VALUE)
|
|---|
| 90 | return 1;
|
|---|
| 91 | else
|
|---|
| 92 | return 0;
|
|---|
| 93 | }
|
|---|
| 94 |
|
|---|
| 95 | /********************************************************************
|
|---|
| 96 | Single image compression/decompression.
|
|---|
| 97 | ********************************************************************/
|
|---|
| 98 | static PyObject *
|
|---|
| 99 | cl_CompressImage(PyObject *self, PyObject *args)
|
|---|
| 100 | {
|
|---|
| 101 | int compressionScheme, width, height, originalFormat;
|
|---|
| 102 | float compressionRatio;
|
|---|
| 103 | int frameBufferSize, compressedBufferSize;
|
|---|
| 104 | char *frameBuffer;
|
|---|
| 105 | PyObject *compressedBuffer;
|
|---|
| 106 |
|
|---|
| 107 | if (!PyArg_ParseTuple(args, "iiiifs#", &compressionScheme,
|
|---|
| 108 | &width, &height,
|
|---|
| 109 | &originalFormat, &compressionRatio, &frameBuffer,
|
|---|
| 110 | &frameBufferSize))
|
|---|
| 111 | return NULL;
|
|---|
| 112 |
|
|---|
| 113 | retry:
|
|---|
| 114 | compressedBuffer = PyString_FromStringAndSize(NULL, frameBufferSize);
|
|---|
| 115 | if (compressedBuffer == NULL)
|
|---|
| 116 | return NULL;
|
|---|
| 117 |
|
|---|
| 118 | compressedBufferSize = frameBufferSize;
|
|---|
| 119 | error_handler_called = 0;
|
|---|
| 120 | if (clCompressImage(compressionScheme, width, height, originalFormat,
|
|---|
| 121 | compressionRatio, (void *) frameBuffer,
|
|---|
| 122 | &compressedBufferSize,
|
|---|
| 123 | (void *) PyString_AsString(compressedBuffer))
|
|---|
| 124 | == FAILURE || error_handler_called) {
|
|---|
| 125 | Py_DECREF(compressedBuffer);
|
|---|
| 126 | if (!error_handler_called)
|
|---|
| 127 | PyErr_SetString(ClError, "clCompressImage failed");
|
|---|
| 128 | return NULL;
|
|---|
| 129 | }
|
|---|
| 130 |
|
|---|
| 131 | if (compressedBufferSize > frameBufferSize) {
|
|---|
| 132 | frameBufferSize = compressedBufferSize;
|
|---|
| 133 | Py_DECREF(compressedBuffer);
|
|---|
| 134 | goto retry;
|
|---|
| 135 | }
|
|---|
| 136 |
|
|---|
| 137 | if (compressedBufferSize < frameBufferSize)
|
|---|
| 138 | _PyString_Resize(&compressedBuffer, compressedBufferSize);
|
|---|
| 139 |
|
|---|
| 140 | return compressedBuffer;
|
|---|
| 141 | }
|
|---|
| 142 |
|
|---|
| 143 | static PyObject *
|
|---|
| 144 | cl_DecompressImage(PyObject *self, PyObject *args)
|
|---|
| 145 | {
|
|---|
| 146 | int compressionScheme, width, height, originalFormat;
|
|---|
| 147 | char *compressedBuffer;
|
|---|
| 148 | int compressedBufferSize, frameBufferSize;
|
|---|
| 149 | PyObject *frameBuffer;
|
|---|
| 150 |
|
|---|
| 151 | if (!PyArg_ParseTuple(args, "iiiis#", &compressionScheme, &width, &height,
|
|---|
| 152 | &originalFormat, &compressedBuffer,
|
|---|
| 153 | &compressedBufferSize))
|
|---|
| 154 | return NULL;
|
|---|
| 155 |
|
|---|
| 156 | frameBufferSize = width * height * CL_BytesPerPixel(originalFormat);
|
|---|
| 157 |
|
|---|
| 158 | frameBuffer = PyString_FromStringAndSize(NULL, frameBufferSize);
|
|---|
| 159 | if (frameBuffer == NULL)
|
|---|
| 160 | return NULL;
|
|---|
| 161 |
|
|---|
| 162 | error_handler_called = 0;
|
|---|
| 163 | if (clDecompressImage(compressionScheme, width, height, originalFormat,
|
|---|
| 164 | compressedBufferSize, compressedBuffer,
|
|---|
| 165 | (void *) PyString_AsString(frameBuffer))
|
|---|
| 166 | == FAILURE || error_handler_called) {
|
|---|
| 167 | Py_DECREF(frameBuffer);
|
|---|
| 168 | if (!error_handler_called)
|
|---|
| 169 | PyErr_SetString(ClError, "clDecompressImage failed");
|
|---|
| 170 | return NULL;
|
|---|
| 171 | }
|
|---|
| 172 |
|
|---|
| 173 | return frameBuffer;
|
|---|
| 174 | }
|
|---|
| 175 |
|
|---|
| 176 | /********************************************************************
|
|---|
| 177 | Sequential compression/decompression.
|
|---|
| 178 | ********************************************************************/
|
|---|
| 179 | #define CheckCompressor(self) if ((self)->ob_compressorHdl == NULL) { \
|
|---|
| 180 | PyErr_SetString(PyExc_RuntimeError, "(de)compressor not active"); \
|
|---|
| 181 | return NULL; \
|
|---|
| 182 | }
|
|---|
| 183 |
|
|---|
| 184 | static PyObject *
|
|---|
| 185 | doClose(clobject *self, int (*close_func)(CL_Handle))
|
|---|
| 186 | {
|
|---|
| 187 | CheckCompressor(self);
|
|---|
| 188 |
|
|---|
| 189 | error_handler_called = 0;
|
|---|
| 190 | if ((*close_func)(self->ob_compressorHdl) == FAILURE ||
|
|---|
| 191 | error_handler_called) {
|
|---|
| 192 | if (!error_handler_called)
|
|---|
| 193 | PyErr_SetString(ClError, "close failed");
|
|---|
| 194 | return NULL;
|
|---|
| 195 | }
|
|---|
| 196 |
|
|---|
| 197 | self->ob_compressorHdl = NULL;
|
|---|
| 198 |
|
|---|
| 199 | if (self->ob_paramtypes)
|
|---|
| 200 | PyMem_DEL(self->ob_paramtypes);
|
|---|
| 201 | self->ob_paramtypes = NULL;
|
|---|
| 202 |
|
|---|
| 203 | Py_INCREF(Py_None);
|
|---|
| 204 | return Py_None;
|
|---|
| 205 | }
|
|---|
| 206 |
|
|---|
| 207 | static PyObject *
|
|---|
| 208 | clm_CloseCompressor(PyObject *self)
|
|---|
| 209 | {
|
|---|
| 210 | return doClose(SELF, clCloseCompressor);
|
|---|
| 211 | }
|
|---|
| 212 |
|
|---|
| 213 | static PyObject *
|
|---|
| 214 | clm_CloseDecompressor(PyObject *self)
|
|---|
| 215 | {
|
|---|
| 216 | return doClose(SELF, clCloseDecompressor);
|
|---|
| 217 | }
|
|---|
| 218 |
|
|---|
| 219 | static PyObject *
|
|---|
| 220 | clm_Compress(PyObject *self, PyObject *args)
|
|---|
| 221 | {
|
|---|
| 222 | int numberOfFrames;
|
|---|
| 223 | int frameBufferSize, compressedBufferSize, size;
|
|---|
| 224 | char *frameBuffer;
|
|---|
| 225 | PyObject *data;
|
|---|
| 226 |
|
|---|
| 227 | CheckCompressor(SELF);
|
|---|
| 228 |
|
|---|
| 229 | if (!PyArg_Parse(args, "(is#)", &numberOfFrames,
|
|---|
| 230 | &frameBuffer, &frameBufferSize))
|
|---|
| 231 | return NULL;
|
|---|
| 232 |
|
|---|
| 233 | error_handler_called = 0;
|
|---|
| 234 | size = clGetParam(SELF->ob_compressorHdl, CL_COMPRESSED_BUFFER_SIZE);
|
|---|
| 235 | compressedBufferSize = size;
|
|---|
| 236 | if (error_handler_called)
|
|---|
| 237 | return NULL;
|
|---|
| 238 |
|
|---|
| 239 | data = PyString_FromStringAndSize(NULL, size);
|
|---|
| 240 | if (data == NULL)
|
|---|
| 241 | return NULL;
|
|---|
| 242 |
|
|---|
| 243 | error_handler_called = 0;
|
|---|
| 244 | if (clCompress(SELF->ob_compressorHdl, numberOfFrames,
|
|---|
| 245 | (void *) frameBuffer, &compressedBufferSize,
|
|---|
| 246 | (void *) PyString_AsString(data)) == FAILURE ||
|
|---|
| 247 | error_handler_called) {
|
|---|
| 248 | Py_DECREF(data);
|
|---|
| 249 | if (!error_handler_called)
|
|---|
| 250 | PyErr_SetString(ClError, "compress failed");
|
|---|
| 251 | return NULL;
|
|---|
| 252 | }
|
|---|
| 253 |
|
|---|
| 254 | if (compressedBufferSize < size)
|
|---|
| 255 | if (_PyString_Resize(&data, compressedBufferSize))
|
|---|
| 256 | return NULL;
|
|---|
| 257 |
|
|---|
| 258 | if (compressedBufferSize > size) {
|
|---|
| 259 | /* we didn't get all "compressed" data */
|
|---|
| 260 | Py_DECREF(data);
|
|---|
| 261 | PyErr_SetString(ClError,
|
|---|
| 262 | "compressed data is more than fitted");
|
|---|
| 263 | return NULL;
|
|---|
| 264 | }
|
|---|
| 265 |
|
|---|
| 266 | return data;
|
|---|
| 267 | }
|
|---|
| 268 |
|
|---|
| 269 | static PyObject *
|
|---|
| 270 | clm_Decompress(PyObject *self, PyObject *args)
|
|---|
| 271 | {
|
|---|
| 272 | PyObject *data;
|
|---|
| 273 | int numberOfFrames;
|
|---|
| 274 | char *compressedData;
|
|---|
| 275 | int compressedDataSize, dataSize;
|
|---|
| 276 |
|
|---|
| 277 | CheckCompressor(SELF);
|
|---|
| 278 |
|
|---|
| 279 | if (!PyArg_Parse(args, "(is#)", &numberOfFrames, &compressedData,
|
|---|
| 280 | &compressedDataSize))
|
|---|
| 281 | return NULL;
|
|---|
| 282 |
|
|---|
| 283 | error_handler_called = 0;
|
|---|
| 284 | dataSize = clGetParam(SELF->ob_compressorHdl, CL_FRAME_BUFFER_SIZE);
|
|---|
| 285 | if (error_handler_called)
|
|---|
| 286 | return NULL;
|
|---|
| 287 |
|
|---|
| 288 | data = PyString_FromStringAndSize(NULL, dataSize);
|
|---|
| 289 | if (data == NULL)
|
|---|
| 290 | return NULL;
|
|---|
| 291 |
|
|---|
| 292 | error_handler_called = 0;
|
|---|
| 293 | if (clDecompress(SELF->ob_compressorHdl, numberOfFrames,
|
|---|
| 294 | compressedDataSize, (void *) compressedData,
|
|---|
| 295 | (void *) PyString_AsString(data)) == FAILURE ||
|
|---|
| 296 | error_handler_called) {
|
|---|
| 297 | Py_DECREF(data);
|
|---|
| 298 | if (!error_handler_called)
|
|---|
| 299 | PyErr_SetString(ClError, "decompress failed");
|
|---|
| 300 | return NULL;
|
|---|
| 301 | }
|
|---|
| 302 |
|
|---|
| 303 | return data;
|
|---|
| 304 | }
|
|---|
| 305 |
|
|---|
| 306 | static PyObject *
|
|---|
| 307 | doParams(clobject *self, PyObject *args, int (*func)(CL_Handle, int *, int),
|
|---|
| 308 | int modified)
|
|---|
| 309 | {
|
|---|
| 310 | PyObject *list, *v;
|
|---|
| 311 | int *PVbuffer;
|
|---|
| 312 | int length;
|
|---|
| 313 | int i;
|
|---|
| 314 | float number;
|
|---|
| 315 |
|
|---|
| 316 | CheckCompressor(self);
|
|---|
| 317 |
|
|---|
| 318 | if (!PyArg_Parse(args, "O", &list))
|
|---|
| 319 | return NULL;
|
|---|
| 320 | if (!PyList_Check(list)) {
|
|---|
| 321 | PyErr_BadArgument();
|
|---|
| 322 | return NULL;
|
|---|
| 323 | }
|
|---|
| 324 | length = PyList_Size(list);
|
|---|
| 325 | PVbuffer = PyMem_NEW(int, length);
|
|---|
| 326 | if (PVbuffer == NULL)
|
|---|
| 327 | return PyErr_NoMemory();
|
|---|
| 328 | for (i = 0; i < length; i++) {
|
|---|
| 329 | v = PyList_GetItem(list, i);
|
|---|
| 330 | if (PyFloat_Check(v)) {
|
|---|
| 331 | number = PyFloat_AsDouble(v);
|
|---|
| 332 | PVbuffer[i] = CL_TypeIsInt(number);
|
|---|
| 333 | } else if (PyInt_Check(v)) {
|
|---|
| 334 | PVbuffer[i] = PyInt_AsLong(v);
|
|---|
| 335 | if ((i & 1) &&
|
|---|
| 336 | param_type_is_float(self, PVbuffer[i-1]) > 0) {
|
|---|
| 337 | number = PVbuffer[i];
|
|---|
| 338 | PVbuffer[i] = CL_TypeIsInt(number);
|
|---|
| 339 | }
|
|---|
| 340 | } else {
|
|---|
| 341 | PyMem_DEL(PVbuffer);
|
|---|
| 342 | PyErr_BadArgument();
|
|---|
| 343 | return NULL;
|
|---|
| 344 | }
|
|---|
| 345 | }
|
|---|
| 346 |
|
|---|
| 347 | error_handler_called = 0;
|
|---|
| 348 | (*func)(self->ob_compressorHdl, PVbuffer, length);
|
|---|
| 349 | if (error_handler_called) {
|
|---|
| 350 | PyMem_DEL(PVbuffer);
|
|---|
| 351 | return NULL;
|
|---|
| 352 | }
|
|---|
| 353 |
|
|---|
| 354 | if (modified) {
|
|---|
| 355 | for (i = 0; i < length; i++) {
|
|---|
| 356 | if ((i & 1) &&
|
|---|
| 357 | param_type_is_float(self, PVbuffer[i-1]) > 0) {
|
|---|
| 358 | number = CL_TypeIsFloat(PVbuffer[i]);
|
|---|
| 359 | v = PyFloat_FromDouble(number);
|
|---|
| 360 | } else
|
|---|
| 361 | v = PyInt_FromLong(PVbuffer[i]);
|
|---|
| 362 | PyList_SetItem(list, i, v);
|
|---|
| 363 | }
|
|---|
| 364 | }
|
|---|
| 365 |
|
|---|
| 366 | PyMem_DEL(PVbuffer);
|
|---|
| 367 |
|
|---|
| 368 | Py_INCREF(Py_None);
|
|---|
| 369 | return Py_None;
|
|---|
| 370 | }
|
|---|
| 371 |
|
|---|
| 372 | static PyObject *
|
|---|
| 373 | clm_GetParams(PyObject *self, PyObject *args)
|
|---|
| 374 | {
|
|---|
| 375 | return doParams(SELF, args, clGetParams, 1);
|
|---|
| 376 | }
|
|---|
| 377 |
|
|---|
| 378 | static PyObject *
|
|---|
| 379 | clm_SetParams(PyObject *self, PyObject *args)
|
|---|
| 380 | {
|
|---|
| 381 | return doParams(SELF, args, clSetParams, 0);
|
|---|
| 382 | }
|
|---|
| 383 |
|
|---|
| 384 | static PyObject *
|
|---|
| 385 | do_get(clobject *self, PyObject *args, int (*func)(CL_Handle, int))
|
|---|
| 386 | {
|
|---|
| 387 | int paramID, value;
|
|---|
| 388 | float fvalue;
|
|---|
| 389 |
|
|---|
| 390 | CheckCompressor(self);
|
|---|
| 391 |
|
|---|
| 392 | if (!PyArg_Parse(args, "i", ¶mID))
|
|---|
| 393 | return NULL;
|
|---|
| 394 |
|
|---|
| 395 | error_handler_called = 0;
|
|---|
| 396 | value = (*func)(self->ob_compressorHdl, paramID);
|
|---|
| 397 | if (error_handler_called)
|
|---|
| 398 | return NULL;
|
|---|
| 399 |
|
|---|
| 400 | if (param_type_is_float(self, paramID) > 0) {
|
|---|
| 401 | fvalue = CL_TypeIsFloat(value);
|
|---|
| 402 | return PyFloat_FromDouble(fvalue);
|
|---|
| 403 | }
|
|---|
| 404 |
|
|---|
| 405 | return PyInt_FromLong(value);
|
|---|
| 406 | }
|
|---|
| 407 |
|
|---|
| 408 | static PyObject *
|
|---|
| 409 | clm_GetParam(PyObject *self, PyObject *args)
|
|---|
| 410 | {
|
|---|
| 411 | return do_get(SELF, args, clGetParam);
|
|---|
| 412 | }
|
|---|
| 413 |
|
|---|
| 414 | static PyObject *
|
|---|
| 415 | clm_GetDefault(PyObject *self, PyObject *args)
|
|---|
| 416 | {
|
|---|
| 417 | return do_get(SELF, args, clGetDefault);
|
|---|
| 418 | }
|
|---|
| 419 |
|
|---|
| 420 | static PyObject *
|
|---|
| 421 | clm_SetParam(PyObject *self, PyObject *args)
|
|---|
| 422 | {
|
|---|
| 423 | int paramID, value;
|
|---|
| 424 | float fvalue;
|
|---|
| 425 |
|
|---|
| 426 | CheckCompressor(SELF);
|
|---|
| 427 |
|
|---|
| 428 | if (!PyArg_Parse(args, "(ii)", ¶mID, &value)) {
|
|---|
| 429 | PyErr_Clear();
|
|---|
| 430 | if (!PyArg_Parse(args, "(if)", ¶mID, &fvalue)) {
|
|---|
| 431 | PyErr_Clear();
|
|---|
| 432 | PyErr_SetString(PyExc_TypeError,
|
|---|
| 433 | "bad argument list (format '(ii)' or '(if)')");
|
|---|
| 434 | return NULL;
|
|---|
| 435 | }
|
|---|
| 436 | value = CL_TypeIsInt(fvalue);
|
|---|
| 437 | } else {
|
|---|
| 438 | if (param_type_is_float(SELF, paramID) > 0) {
|
|---|
| 439 | fvalue = value;
|
|---|
| 440 | value = CL_TypeIsInt(fvalue);
|
|---|
| 441 | }
|
|---|
| 442 | }
|
|---|
| 443 |
|
|---|
| 444 | error_handler_called = 0;
|
|---|
| 445 | value = clSetParam(SELF->ob_compressorHdl, paramID, value);
|
|---|
| 446 | if (error_handler_called)
|
|---|
| 447 | return NULL;
|
|---|
| 448 |
|
|---|
| 449 | if (param_type_is_float(SELF, paramID) > 0)
|
|---|
| 450 | return PyFloat_FromDouble(CL_TypeIsFloat(value));
|
|---|
| 451 | else
|
|---|
| 452 | return PyInt_FromLong(value);
|
|---|
| 453 | }
|
|---|
| 454 |
|
|---|
| 455 | static PyObject *
|
|---|
| 456 | clm_GetParamID(PyObject *self, PyObject *args)
|
|---|
| 457 | {
|
|---|
| 458 | char *name;
|
|---|
| 459 | int value;
|
|---|
| 460 |
|
|---|
| 461 | CheckCompressor(SELF);
|
|---|
| 462 |
|
|---|
| 463 | if (!PyArg_Parse(args, "s", &name))
|
|---|
| 464 | return NULL;
|
|---|
| 465 |
|
|---|
| 466 | error_handler_called = 0;
|
|---|
| 467 | value = clGetParamID(SELF->ob_compressorHdl, name);
|
|---|
| 468 | if (value == FAILURE || error_handler_called) {
|
|---|
| 469 | if (!error_handler_called)
|
|---|
| 470 | PyErr_SetString(ClError, "getparamid failed");
|
|---|
| 471 | return NULL;
|
|---|
| 472 | }
|
|---|
| 473 |
|
|---|
| 474 | return PyInt_FromLong(value);
|
|---|
| 475 | }
|
|---|
| 476 |
|
|---|
| 477 | static PyObject *
|
|---|
| 478 | clm_QueryParams(PyObject *self)
|
|---|
| 479 | {
|
|---|
| 480 | int bufferlength;
|
|---|
| 481 | int *PVbuffer;
|
|---|
| 482 | PyObject *list;
|
|---|
| 483 | int i;
|
|---|
| 484 |
|
|---|
| 485 | CheckCompressor(SELF);
|
|---|
| 486 |
|
|---|
| 487 | error_handler_called = 0;
|
|---|
| 488 | bufferlength = clQueryParams(SELF->ob_compressorHdl, 0, 0);
|
|---|
| 489 | if (error_handler_called)
|
|---|
| 490 | return NULL;
|
|---|
| 491 |
|
|---|
| 492 | PVbuffer = PyMem_NEW(int, bufferlength);
|
|---|
| 493 | if (PVbuffer == NULL)
|
|---|
| 494 | return PyErr_NoMemory();
|
|---|
| 495 |
|
|---|
| 496 | bufferlength = clQueryParams(SELF->ob_compressorHdl, PVbuffer,
|
|---|
| 497 | bufferlength);
|
|---|
| 498 | if (error_handler_called) {
|
|---|
| 499 | PyMem_DEL(PVbuffer);
|
|---|
| 500 | return NULL;
|
|---|
| 501 | }
|
|---|
| 502 |
|
|---|
| 503 | list = PyList_New(bufferlength);
|
|---|
| 504 | if (list == NULL) {
|
|---|
| 505 | PyMem_DEL(PVbuffer);
|
|---|
| 506 | return NULL;
|
|---|
| 507 | }
|
|---|
| 508 |
|
|---|
| 509 | for (i = 0; i < bufferlength; i++) {
|
|---|
| 510 | if (i & 1)
|
|---|
| 511 | PyList_SetItem(list, i, PyInt_FromLong(PVbuffer[i]));
|
|---|
| 512 | else if (PVbuffer[i] == 0) {
|
|---|
| 513 | Py_INCREF(Py_None);
|
|---|
| 514 | PyList_SetItem(list, i, Py_None);
|
|---|
| 515 | } else
|
|---|
| 516 | PyList_SetItem(list, i,
|
|---|
| 517 | PyString_FromString((char *) PVbuffer[i]));
|
|---|
| 518 | }
|
|---|
| 519 |
|
|---|
| 520 | PyMem_DEL(PVbuffer);
|
|---|
| 521 |
|
|---|
| 522 | return list;
|
|---|
| 523 | }
|
|---|
| 524 |
|
|---|
| 525 | static PyObject *
|
|---|
| 526 | clm_GetMinMax(PyObject *self, PyObject *args)
|
|---|
| 527 | {
|
|---|
| 528 | int param, min, max;
|
|---|
| 529 | float fmin, fmax;
|
|---|
| 530 |
|
|---|
| 531 | CheckCompressor(SELF);
|
|---|
| 532 |
|
|---|
| 533 | if (!PyArg_Parse(args, "i", ¶m))
|
|---|
| 534 | return NULL;
|
|---|
| 535 |
|
|---|
| 536 | clGetMinMax(SELF->ob_compressorHdl, param, &min, &max);
|
|---|
| 537 |
|
|---|
| 538 | if (param_type_is_float(SELF, param) > 0) {
|
|---|
| 539 | fmin = CL_TypeIsFloat(min);
|
|---|
| 540 | fmax = CL_TypeIsFloat(max);
|
|---|
| 541 | return Py_BuildValue("(ff)", fmin, fmax);
|
|---|
| 542 | }
|
|---|
| 543 |
|
|---|
| 544 | return Py_BuildValue("(ii)", min, max);
|
|---|
| 545 | }
|
|---|
| 546 |
|
|---|
| 547 | static PyObject *
|
|---|
| 548 | clm_GetName(PyObject *self, PyObject *args)
|
|---|
| 549 | {
|
|---|
| 550 | int param;
|
|---|
| 551 | char *name;
|
|---|
| 552 |
|
|---|
| 553 | CheckCompressor(SELF);
|
|---|
| 554 |
|
|---|
| 555 | if (!PyArg_Parse(args, "i", ¶m))
|
|---|
| 556 | return NULL;
|
|---|
| 557 |
|
|---|
| 558 | error_handler_called = 0;
|
|---|
| 559 | name = clGetName(SELF->ob_compressorHdl, param);
|
|---|
| 560 | if (name == NULL || error_handler_called) {
|
|---|
| 561 | if (!error_handler_called)
|
|---|
| 562 | PyErr_SetString(ClError, "getname failed");
|
|---|
| 563 | return NULL;
|
|---|
| 564 | }
|
|---|
| 565 |
|
|---|
| 566 | return PyString_FromString(name);
|
|---|
| 567 | }
|
|---|
| 568 |
|
|---|
| 569 | static PyObject *
|
|---|
| 570 | clm_QuerySchemeFromHandle(PyObject *self)
|
|---|
| 571 | {
|
|---|
| 572 | CheckCompressor(SELF);
|
|---|
| 573 | return PyInt_FromLong(clQuerySchemeFromHandle(SELF->ob_compressorHdl));
|
|---|
| 574 | }
|
|---|
| 575 |
|
|---|
| 576 | static PyObject *
|
|---|
| 577 | clm_ReadHeader(PyObject *self, PyObject *args)
|
|---|
| 578 | {
|
|---|
| 579 | char *header;
|
|---|
| 580 | int headerSize;
|
|---|
| 581 |
|
|---|
| 582 | CheckCompressor(SELF);
|
|---|
| 583 |
|
|---|
| 584 | if (!PyArg_Parse(args, "s#", &header, &headerSize))
|
|---|
| 585 | return NULL;
|
|---|
| 586 |
|
|---|
| 587 | return PyInt_FromLong(clReadHeader(SELF->ob_compressorHdl,
|
|---|
| 588 | headerSize, header));
|
|---|
| 589 | }
|
|---|
| 590 |
|
|---|
| 591 | static PyMethodDef compressor_methods[] = {
|
|---|
| 592 | {"close", clm_CloseCompressor, METH_NOARGS}, /* alias */
|
|---|
| 593 | {"CloseCompressor", clm_CloseCompressor, METH_NOARGS},
|
|---|
| 594 | {"Compress", clm_Compress, METH_OLDARGS},
|
|---|
| 595 | {"GetDefault", clm_GetDefault, METH_OLDARGS},
|
|---|
| 596 | {"GetMinMax", clm_GetMinMax, METH_OLDARGS},
|
|---|
| 597 | {"GetName", clm_GetName, METH_OLDARGS},
|
|---|
| 598 | {"GetParam", clm_GetParam, METH_OLDARGS},
|
|---|
| 599 | {"GetParamID", clm_GetParamID, METH_OLDARGS},
|
|---|
| 600 | {"GetParams", clm_GetParams, METH_OLDARGS},
|
|---|
| 601 | {"QueryParams", clm_QueryParams, METH_NOARGS},
|
|---|
| 602 | {"QuerySchemeFromHandle",clm_QuerySchemeFromHandle, METH_NOARGS},
|
|---|
| 603 | {"SetParam", clm_SetParam, METH_OLDARGS},
|
|---|
| 604 | {"SetParams", clm_SetParams, METH_OLDARGS},
|
|---|
| 605 | {NULL, NULL} /* sentinel */
|
|---|
| 606 | };
|
|---|
| 607 |
|
|---|
| 608 | static PyMethodDef decompressor_methods[] = {
|
|---|
| 609 | {"close", clm_CloseDecompressor, METH_NOARGS}, /* alias */
|
|---|
| 610 | {"CloseDecompressor", clm_CloseDecompressor, METH_NOARGS},
|
|---|
| 611 | {"Decompress", clm_Decompress, METH_OLDARGS},
|
|---|
| 612 | {"GetDefault", clm_GetDefault, METH_OLDARGS},
|
|---|
| 613 | {"GetMinMax", clm_GetMinMax, METH_OLDARGS},
|
|---|
| 614 | {"GetName", clm_GetName, METH_OLDARGS},
|
|---|
| 615 | {"GetParam", clm_GetParam, METH_OLDARGS},
|
|---|
| 616 | {"GetParamID", clm_GetParamID, METH_OLDARGS},
|
|---|
| 617 | {"GetParams", clm_GetParams, METH_OLDARGS},
|
|---|
| 618 | {"ReadHeader", clm_ReadHeader, METH_OLDARGS},
|
|---|
| 619 | {"QueryParams", clm_QueryParams, METH_NOARGS},
|
|---|
| 620 | {"QuerySchemeFromHandle",clm_QuerySchemeFromHandle, METH_NOARGS},
|
|---|
| 621 | {"SetParam", clm_SetParam, METH_OLDARGS},
|
|---|
| 622 | {"SetParams", clm_SetParams, METH_OLDARGS},
|
|---|
| 623 | {NULL, NULL} /* sentinel */
|
|---|
| 624 | };
|
|---|
| 625 |
|
|---|
| 626 | static void
|
|---|
| 627 | cl_dealloc(PyObject *self)
|
|---|
| 628 | {
|
|---|
| 629 | if (SELF->ob_compressorHdl) {
|
|---|
| 630 | if (SELF->ob_isCompressor)
|
|---|
| 631 | clCloseCompressor(SELF->ob_compressorHdl);
|
|---|
| 632 | else
|
|---|
| 633 | clCloseDecompressor(SELF->ob_compressorHdl);
|
|---|
| 634 | }
|
|---|
| 635 | PyObject_Del(self);
|
|---|
| 636 | }
|
|---|
| 637 |
|
|---|
| 638 | static PyObject *
|
|---|
| 639 | cl_getattr(PyObject *self, char *name)
|
|---|
| 640 | {
|
|---|
| 641 | if (SELF->ob_isCompressor)
|
|---|
| 642 | return Py_FindMethod(compressor_methods, self, name);
|
|---|
| 643 | else
|
|---|
| 644 | return Py_FindMethod(decompressor_methods, self, name);
|
|---|
| 645 | }
|
|---|
| 646 |
|
|---|
| 647 | static PyTypeObject Cltype = {
|
|---|
| 648 | PyObject_HEAD_INIT(&PyType_Type)
|
|---|
| 649 | 0, /*ob_size*/
|
|---|
| 650 | "cl.cl", /*tp_name*/
|
|---|
| 651 | sizeof(clobject), /*tp_size*/
|
|---|
| 652 | 0, /*tp_itemsize*/
|
|---|
| 653 | /* methods */
|
|---|
| 654 | (destructor)cl_dealloc, /*tp_dealloc*/
|
|---|
| 655 | 0, /*tp_print*/
|
|---|
| 656 | (getattrfunc)cl_getattr, /*tp_getattr*/
|
|---|
| 657 | 0, /*tp_setattr*/
|
|---|
| 658 | 0, /*tp_compare*/
|
|---|
| 659 | 0, /*tp_repr*/
|
|---|
| 660 | 0, /*tp_as_number*/
|
|---|
| 661 | 0, /*tp_as_sequence*/
|
|---|
| 662 | 0, /*tp_as_mapping*/
|
|---|
| 663 | };
|
|---|
| 664 |
|
|---|
| 665 | static PyObject *
|
|---|
| 666 | doOpen(PyObject *self, PyObject *args, int (*open_func)(int, CL_Handle *),
|
|---|
| 667 | int iscompressor)
|
|---|
| 668 | {
|
|---|
| 669 | int scheme;
|
|---|
| 670 | clobject *new;
|
|---|
| 671 |
|
|---|
| 672 | if (!PyArg_ParseTuple(args, "i", &scheme))
|
|---|
| 673 | return NULL;
|
|---|
| 674 |
|
|---|
| 675 | new = PyObject_New(clobject, &Cltype);
|
|---|
| 676 | if (new == NULL)
|
|---|
| 677 | return NULL;
|
|---|
| 678 |
|
|---|
| 679 | new->ob_compressorHdl = NULL;
|
|---|
| 680 | new->ob_isCompressor = iscompressor;
|
|---|
| 681 | new->ob_paramtypes = NULL;
|
|---|
| 682 |
|
|---|
| 683 | error_handler_called = 0;
|
|---|
| 684 | if ((*open_func)(scheme, &new->ob_compressorHdl) == FAILURE ||
|
|---|
| 685 | error_handler_called) {
|
|---|
| 686 | Py_DECREF(new);
|
|---|
| 687 | if (!error_handler_called)
|
|---|
| 688 | PyErr_SetString(ClError, "Open(De)Compressor failed");
|
|---|
| 689 | return NULL;
|
|---|
| 690 | }
|
|---|
| 691 | return (PyObject *)new;
|
|---|
| 692 | }
|
|---|
| 693 |
|
|---|
| 694 | static PyObject *
|
|---|
| 695 | cl_OpenCompressor(PyObject *self, PyObject *args)
|
|---|
| 696 | {
|
|---|
| 697 | return doOpen(self, args, clOpenCompressor, 1);
|
|---|
| 698 | }
|
|---|
| 699 |
|
|---|
| 700 | static PyObject *
|
|---|
| 701 | cl_OpenDecompressor(PyObject *self, PyObject *args)
|
|---|
| 702 | {
|
|---|
| 703 | return doOpen(self, args, clOpenDecompressor, 0);
|
|---|
| 704 | }
|
|---|
| 705 |
|
|---|
| 706 | static PyObject *
|
|---|
| 707 | cl_QueryScheme(PyObject *self, PyObject *args)
|
|---|
| 708 | {
|
|---|
| 709 | char *header;
|
|---|
| 710 | int headerlen;
|
|---|
| 711 | int scheme;
|
|---|
| 712 |
|
|---|
| 713 | if (!PyArg_ParseTuple(args, "s#", &header, &headerlen))
|
|---|
| 714 | return NULL;
|
|---|
| 715 |
|
|---|
| 716 | scheme = clQueryScheme(header);
|
|---|
| 717 | if (scheme < 0) {
|
|---|
| 718 | PyErr_SetString(ClError, "unknown compression scheme");
|
|---|
| 719 | return NULL;
|
|---|
| 720 | }
|
|---|
| 721 |
|
|---|
| 722 | return PyInt_FromLong(scheme);
|
|---|
| 723 | }
|
|---|
| 724 |
|
|---|
| 725 | static PyObject *
|
|---|
| 726 | cl_QueryMaxHeaderSize(PyObject *self, PyObject *args)
|
|---|
| 727 | {
|
|---|
| 728 | int scheme;
|
|---|
| 729 |
|
|---|
| 730 | if (!PyArg_ParseTuple(args, "i", &scheme))
|
|---|
| 731 | return NULL;
|
|---|
| 732 |
|
|---|
| 733 | return PyInt_FromLong(clQueryMaxHeaderSize(scheme));
|
|---|
| 734 | }
|
|---|
| 735 |
|
|---|
| 736 | static PyObject *
|
|---|
| 737 | cl_QueryAlgorithms(PyObject *self, PyObject *args)
|
|---|
| 738 | {
|
|---|
| 739 | int algorithmMediaType;
|
|---|
| 740 | int bufferlength;
|
|---|
| 741 | int *PVbuffer;
|
|---|
| 742 | PyObject *list;
|
|---|
| 743 | int i;
|
|---|
| 744 |
|
|---|
| 745 | if (!PyArg_ParseTuple(args, "i", &algorithmMediaType))
|
|---|
| 746 | return NULL;
|
|---|
| 747 |
|
|---|
| 748 | error_handler_called = 0;
|
|---|
| 749 | bufferlength = clQueryAlgorithms(algorithmMediaType, 0, 0);
|
|---|
| 750 | if (error_handler_called)
|
|---|
| 751 | return NULL;
|
|---|
| 752 |
|
|---|
| 753 | PVbuffer = PyMem_NEW(int, bufferlength);
|
|---|
| 754 | if (PVbuffer == NULL)
|
|---|
| 755 | return PyErr_NoMemory();
|
|---|
| 756 |
|
|---|
| 757 | bufferlength = clQueryAlgorithms(algorithmMediaType, PVbuffer,
|
|---|
| 758 | bufferlength);
|
|---|
| 759 | if (error_handler_called) {
|
|---|
| 760 | PyMem_DEL(PVbuffer);
|
|---|
| 761 | return NULL;
|
|---|
| 762 | }
|
|---|
| 763 |
|
|---|
| 764 | list = PyList_New(bufferlength);
|
|---|
| 765 | if (list == NULL) {
|
|---|
| 766 | PyMem_DEL(PVbuffer);
|
|---|
| 767 | return NULL;
|
|---|
| 768 | }
|
|---|
| 769 |
|
|---|
| 770 | for (i = 0; i < bufferlength; i++) {
|
|---|
| 771 | if (i & 1)
|
|---|
| 772 | PyList_SetItem(list, i, PyInt_FromLong(PVbuffer[i]));
|
|---|
| 773 | else if (PVbuffer[i] == 0) {
|
|---|
| 774 | Py_INCREF(Py_None);
|
|---|
| 775 | PyList_SetItem(list, i, Py_None);
|
|---|
| 776 | } else
|
|---|
| 777 | PyList_SetItem(list, i,
|
|---|
| 778 | PyString_FromString((char *) PVbuffer[i]));
|
|---|
| 779 | }
|
|---|
| 780 |
|
|---|
| 781 | PyMem_DEL(PVbuffer);
|
|---|
| 782 |
|
|---|
| 783 | return list;
|
|---|
| 784 | }
|
|---|
| 785 |
|
|---|
| 786 | static PyObject *
|
|---|
| 787 | cl_QuerySchemeFromName(PyObject *self, PyObject *args)
|
|---|
| 788 | {
|
|---|
| 789 | int algorithmMediaType;
|
|---|
| 790 | char *name;
|
|---|
| 791 | int scheme;
|
|---|
| 792 |
|
|---|
| 793 | if (!PyArg_ParseTuple(args, "is", &algorithmMediaType, &name))
|
|---|
| 794 | return NULL;
|
|---|
| 795 |
|
|---|
| 796 | error_handler_called = 0;
|
|---|
| 797 | scheme = clQuerySchemeFromName(algorithmMediaType, name);
|
|---|
| 798 | if (error_handler_called) {
|
|---|
| 799 | PyErr_SetString(ClError, "unknown compression scheme");
|
|---|
| 800 | return NULL;
|
|---|
| 801 | }
|
|---|
| 802 |
|
|---|
| 803 | return PyInt_FromLong(scheme);
|
|---|
| 804 | }
|
|---|
| 805 |
|
|---|
| 806 | static PyObject *
|
|---|
| 807 | cl_GetAlgorithmName(PyObject *self, PyObject *args)
|
|---|
| 808 | {
|
|---|
| 809 | int scheme;
|
|---|
| 810 | char *name;
|
|---|
| 811 |
|
|---|
| 812 | if (!PyArg_ParseTuple(args, "i", &scheme))
|
|---|
| 813 | return NULL;
|
|---|
| 814 |
|
|---|
| 815 | name = clGetAlgorithmName(scheme);
|
|---|
| 816 | if (name == 0) {
|
|---|
| 817 | PyErr_SetString(ClError, "unknown compression scheme");
|
|---|
| 818 | return NULL;
|
|---|
| 819 | }
|
|---|
| 820 |
|
|---|
| 821 | return PyString_FromString(name);
|
|---|
| 822 | }
|
|---|
| 823 |
|
|---|
| 824 | static PyObject *
|
|---|
| 825 | do_set(PyObject *self, PyObject *args, int (*func)(int, int, int))
|
|---|
| 826 | {
|
|---|
| 827 | int scheme, paramID, value;
|
|---|
| 828 | float fvalue;
|
|---|
| 829 | int is_float = 0;
|
|---|
| 830 |
|
|---|
| 831 | if (!PyArg_ParseTuple(args, "iii", &scheme, ¶mID, &value)) {
|
|---|
| 832 | PyErr_Clear();
|
|---|
| 833 | if (!PyArg_ParseTuple(args, "iif", &scheme, ¶mID, &fvalue)) {
|
|---|
| 834 | PyErr_Clear();
|
|---|
| 835 | PyErr_SetString(PyExc_TypeError,
|
|---|
| 836 | "bad argument list (format '(iii)' or '(iif)')");
|
|---|
| 837 | return NULL;
|
|---|
| 838 | }
|
|---|
| 839 | value = CL_TypeIsInt(fvalue);
|
|---|
| 840 | is_float = 1;
|
|---|
| 841 | } else {
|
|---|
| 842 | /* check some parameters which we know to be floats */
|
|---|
| 843 | switch (scheme) {
|
|---|
| 844 | case CL_COMPRESSION_RATIO:
|
|---|
| 845 | case CL_SPEED:
|
|---|
| 846 | fvalue = value;
|
|---|
| 847 | value = CL_TypeIsInt(fvalue);
|
|---|
| 848 | is_float = 1;
|
|---|
| 849 | break;
|
|---|
| 850 | }
|
|---|
| 851 | }
|
|---|
| 852 |
|
|---|
| 853 | error_handler_called = 0;
|
|---|
| 854 | value = (*func)(scheme, paramID, value);
|
|---|
| 855 | if (error_handler_called)
|
|---|
| 856 | return NULL;
|
|---|
| 857 |
|
|---|
| 858 | if (is_float)
|
|---|
| 859 | return PyFloat_FromDouble(CL_TypeIsFloat(value));
|
|---|
| 860 | else
|
|---|
| 861 | return PyInt_FromLong(value);
|
|---|
| 862 | }
|
|---|
| 863 |
|
|---|
| 864 | static PyObject *
|
|---|
| 865 | cl_SetDefault(PyObject *self, PyObject *args)
|
|---|
| 866 | {
|
|---|
| 867 | return do_set(self, args, clSetDefault);
|
|---|
| 868 | }
|
|---|
| 869 |
|
|---|
| 870 | static PyObject *
|
|---|
| 871 | cl_SetMin(PyObject *self, PyObject *args)
|
|---|
| 872 | {
|
|---|
| 873 | return do_set(self, args, clSetMin);
|
|---|
| 874 | }
|
|---|
| 875 |
|
|---|
| 876 | static PyObject *
|
|---|
| 877 | cl_SetMax(PyObject *self, PyObject *args)
|
|---|
| 878 | {
|
|---|
| 879 | return do_set(self, args, clSetMax);
|
|---|
| 880 | }
|
|---|
| 881 |
|
|---|
| 882 | #define func(name, handler) \
|
|---|
| 883 | static PyObject *cl_##name(PyObject *self, PyObject *args) \
|
|---|
| 884 | { \
|
|---|
| 885 | int x; \
|
|---|
| 886 | if (!PyArg_ParseTuple(args, "i", &x)) return NULL; \
|
|---|
| 887 | return Py##handler(CL_##name(x)); \
|
|---|
| 888 | }
|
|---|
| 889 |
|
|---|
| 890 | #define func2(name, handler) \
|
|---|
| 891 | static PyObject *cl_##name(PyObject *self, PyObject *args) \
|
|---|
| 892 | { \
|
|---|
| 893 | int a1, a2; \
|
|---|
| 894 | if (!PyArg_ParseTuple(args, "ii", &a1, &a2)) return NULL; \
|
|---|
| 895 | return Py##handler(CL_##name(a1, a2)); \
|
|---|
| 896 | }
|
|---|
| 897 |
|
|---|
| 898 | func(BytesPerSample, Int_FromLong)
|
|---|
| 899 | func(BytesPerPixel, Int_FromLong)
|
|---|
| 900 | func(AudioFormatName, String_FromString)
|
|---|
| 901 | func(VideoFormatName, String_FromString)
|
|---|
| 902 | func(AlgorithmNumber, Int_FromLong)
|
|---|
| 903 | func(AlgorithmType, Int_FromLong)
|
|---|
| 904 | func2(Algorithm, Int_FromLong)
|
|---|
| 905 | func(ParamNumber, Int_FromLong)
|
|---|
| 906 | func(ParamType, Int_FromLong)
|
|---|
| 907 | func2(ParamID, Int_FromLong)
|
|---|
| 908 |
|
|---|
| 909 | #ifdef CLDEBUG
|
|---|
| 910 | static PyObject *
|
|---|
| 911 | cvt_type(PyObject *self, PyObject *args)
|
|---|
| 912 | {
|
|---|
| 913 | int number;
|
|---|
| 914 | float fnumber;
|
|---|
| 915 |
|
|---|
| 916 | if (PyArg_Parse(args, "i", &number))
|
|---|
| 917 | return PyFloat_FromDouble(CL_TypeIsFloat(number));
|
|---|
| 918 | else {
|
|---|
| 919 | PyErr_Clear();
|
|---|
| 920 | if (PyArg_Parse(args, "f", &fnumber))
|
|---|
| 921 | return PyInt_FromLong(CL_TypeIsInt(fnumber));
|
|---|
| 922 | return NULL;
|
|---|
| 923 | }
|
|---|
| 924 | }
|
|---|
| 925 | #endif
|
|---|
| 926 |
|
|---|
| 927 | static PyMethodDef cl_methods[] = {
|
|---|
| 928 | {"CompressImage", cl_CompressImage, METH_VARARGS},
|
|---|
| 929 | {"DecompressImage", cl_DecompressImage, METH_VARARGS},
|
|---|
| 930 | {"GetAlgorithmName", cl_GetAlgorithmName, METH_VARARGS},
|
|---|
| 931 | {"OpenCompressor", cl_OpenCompressor, METH_VARARGS},
|
|---|
| 932 | {"OpenDecompressor", cl_OpenDecompressor, METH_VARARGS},
|
|---|
| 933 | {"QueryAlgorithms", cl_QueryAlgorithms, METH_VARARGS},
|
|---|
| 934 | {"QueryMaxHeaderSize", cl_QueryMaxHeaderSize, METH_VARARGS},
|
|---|
| 935 | {"QueryScheme", cl_QueryScheme, METH_VARARGS},
|
|---|
| 936 | {"QuerySchemeFromName", cl_QuerySchemeFromName, METH_VARARGS},
|
|---|
| 937 | {"SetDefault", cl_SetDefault, METH_VARARGS},
|
|---|
| 938 | {"SetMax", cl_SetMax, METH_VARARGS},
|
|---|
| 939 | {"SetMin", cl_SetMin, METH_VARARGS},
|
|---|
| 940 | {"BytesPerSample", cl_BytesPerSample, METH_VARARGS},
|
|---|
| 941 | {"BytesPerPixel", cl_BytesPerPixel, METH_VARARGS},
|
|---|
| 942 | {"AudioFormatName", cl_AudioFormatName, METH_VARARGS},
|
|---|
| 943 | {"VideoFormatName", cl_VideoFormatName, METH_VARARGS},
|
|---|
| 944 | {"AlgorithmNumber", cl_AlgorithmNumber, METH_VARARGS},
|
|---|
| 945 | {"AlgorithmType", cl_AlgorithmType, METH_VARARGS},
|
|---|
| 946 | {"Algorithm", cl_Algorithm, METH_VARARGS},
|
|---|
| 947 | {"ParamNumber", cl_ParamNumber, METH_VARARGS},
|
|---|
| 948 | {"ParamType", cl_ParamType, METH_VARARGS},
|
|---|
| 949 | {"ParamID", cl_ParamID, METH_VARARGS},
|
|---|
| 950 | #ifdef CLDEBUG
|
|---|
| 951 | {"cvt_type", cvt_type, METH_VARARGS},
|
|---|
| 952 | #endif
|
|---|
| 953 | {NULL, NULL} /* Sentinel */
|
|---|
| 954 | };
|
|---|
| 955 |
|
|---|
| 956 | #ifdef CL_JPEG_SOFTWARE
|
|---|
| 957 | #define IRIX_5_3_LIBRARY
|
|---|
| 958 | #endif
|
|---|
| 959 |
|
|---|
| 960 | void
|
|---|
| 961 | initcl(void)
|
|---|
| 962 | {
|
|---|
| 963 | PyObject *m, *d, *x;
|
|---|
| 964 |
|
|---|
| 965 | m = Py_InitModule("cl", cl_methods);
|
|---|
| 966 | if (m == NULL)
|
|---|
| 967 | return;
|
|---|
| 968 | d = PyModule_GetDict(m);
|
|---|
| 969 |
|
|---|
| 970 | ClError = PyErr_NewException("cl.error", NULL, NULL);
|
|---|
| 971 | (void) PyDict_SetItemString(d, "error", ClError);
|
|---|
| 972 |
|
|---|
| 973 | #ifdef CL_ADDED_ALGORITHM_ERROR
|
|---|
| 974 | x = PyInt_FromLong(CL_ADDED_ALGORITHM_ERROR);
|
|---|
| 975 | if (x == NULL || PyDict_SetItemString(d, "ADDED_ALGORITHM_ERROR", x) < 0)
|
|---|
| 976 | return;
|
|---|
| 977 | Py_DECREF(x);
|
|---|
| 978 | #endif
|
|---|
| 979 | #ifdef CL_ALAW
|
|---|
| 980 | x = PyInt_FromLong(CL_ALAW);
|
|---|
| 981 | if (x == NULL || PyDict_SetItemString(d, "ALAW", x) < 0)
|
|---|
| 982 | return;
|
|---|
| 983 | Py_DECREF(x);
|
|---|
| 984 | #endif
|
|---|
| 985 | #ifdef CL_ALGORITHM_ID
|
|---|
| 986 | x = PyInt_FromLong(CL_ALGORITHM_ID);
|
|---|
| 987 | if (x == NULL || PyDict_SetItemString(d, "ALGORITHM_ID", x) < 0)
|
|---|
| 988 | return;
|
|---|
| 989 | Py_DECREF(x);
|
|---|
| 990 | #endif
|
|---|
| 991 | #ifdef CL_ALGORITHM_TABLE_FULL
|
|---|
| 992 | x = PyInt_FromLong(CL_ALGORITHM_TABLE_FULL);
|
|---|
| 993 | if (x == NULL || PyDict_SetItemString(d, "ALGORITHM_TABLE_FULL", x) < 0)
|
|---|
| 994 | return;
|
|---|
| 995 | Py_DECREF(x);
|
|---|
| 996 | #endif
|
|---|
| 997 | #ifdef CL_ALGORITHM_VERSION
|
|---|
| 998 | x = PyInt_FromLong(CL_ALGORITHM_VERSION);
|
|---|
| 999 | if (x == NULL || PyDict_SetItemString(d, "ALGORITHM_VERSION", x) < 0)
|
|---|
| 1000 | return;
|
|---|
| 1001 | Py_DECREF(x);
|
|---|
| 1002 | #endif
|
|---|
| 1003 | #ifdef CL_ALG_AUDIO
|
|---|
| 1004 | x = PyInt_FromLong(CL_ALG_AUDIO);
|
|---|
| 1005 | if (x == NULL || PyDict_SetItemString(d, "ALG_AUDIO", x) < 0)
|
|---|
| 1006 | return;
|
|---|
| 1007 | Py_DECREF(x);
|
|---|
| 1008 | #endif
|
|---|
| 1009 | #ifdef CL_ALG_VIDEO
|
|---|
| 1010 | x = PyInt_FromLong(CL_ALG_VIDEO);
|
|---|
| 1011 | if (x == NULL || PyDict_SetItemString(d, "ALG_VIDEO", x) < 0)
|
|---|
| 1012 | return;
|
|---|
| 1013 | Py_DECREF(x);
|
|---|
| 1014 | #endif
|
|---|
| 1015 | #ifdef CL_AUDIO
|
|---|
| 1016 | x = PyInt_FromLong(CL_AUDIO);
|
|---|
| 1017 | if (x == NULL || PyDict_SetItemString(d, "AUDIO", x) < 0)
|
|---|
| 1018 | return;
|
|---|
| 1019 | Py_DECREF(x);
|
|---|
| 1020 | #endif
|
|---|
| 1021 | #ifdef CL_AWARE_BITRATE_POLICY
|
|---|
| 1022 | x = PyInt_FromLong(CL_AWARE_BITRATE_POLICY);
|
|---|
| 1023 | if (x == NULL || PyDict_SetItemString(d, "AWARE_BITRATE_POLICY", x) < 0)
|
|---|
| 1024 | return;
|
|---|
| 1025 | Py_DECREF(x);
|
|---|
| 1026 | #endif
|
|---|
| 1027 | #ifdef CL_AWARE_BITRATE_TARGET
|
|---|
| 1028 | x = PyInt_FromLong(CL_AWARE_BITRATE_TARGET);
|
|---|
| 1029 | if (x == NULL || PyDict_SetItemString(d, "AWARE_BITRATE_TARGET", x) < 0)
|
|---|
| 1030 | return;
|
|---|
| 1031 | Py_DECREF(x);
|
|---|
| 1032 | #endif
|
|---|
| 1033 | #ifdef CL_AWARE_CHANNEL_POLICY
|
|---|
| 1034 | x = PyInt_FromLong(CL_AWARE_CHANNEL_POLICY);
|
|---|
| 1035 | if (x == NULL || PyDict_SetItemString(d, "AWARE_CHANNEL_POLICY", x) < 0)
|
|---|
| 1036 | return;
|
|---|
| 1037 | Py_DECREF(x);
|
|---|
| 1038 | #endif
|
|---|
| 1039 | #ifdef CL_AWARE_CONST_QUAL
|
|---|
| 1040 | x = PyInt_FromLong(CL_AWARE_CONST_QUAL);
|
|---|
| 1041 | if (x == NULL || PyDict_SetItemString(d, "AWARE_CONST_QUAL", x) < 0)
|
|---|
| 1042 | return;
|
|---|
| 1043 | Py_DECREF(x);
|
|---|
| 1044 | #endif
|
|---|
| 1045 | #ifdef CL_AWARE_ERROR
|
|---|
| 1046 | x = PyInt_FromLong(CL_AWARE_ERROR);
|
|---|
| 1047 | if (x == NULL || PyDict_SetItemString(d, "AWARE_ERROR", x) < 0)
|
|---|
| 1048 | return;
|
|---|
| 1049 | Py_DECREF(x);
|
|---|
| 1050 | #endif
|
|---|
| 1051 | #ifdef CL_AWARE_FIXED_RATE
|
|---|
| 1052 | x = PyInt_FromLong(CL_AWARE_FIXED_RATE);
|
|---|
| 1053 | if (x == NULL || PyDict_SetItemString(d, "AWARE_FIXED_RATE", x) < 0)
|
|---|
| 1054 | return;
|
|---|
| 1055 | Py_DECREF(x);
|
|---|
| 1056 | #endif
|
|---|
| 1057 | #ifdef CL_AWARE_INDEPENDENT
|
|---|
| 1058 | x = PyInt_FromLong(CL_AWARE_INDEPENDENT);
|
|---|
| 1059 | if (x == NULL || PyDict_SetItemString(d, "AWARE_INDEPENDENT", x) < 0)
|
|---|
| 1060 | return;
|
|---|
| 1061 | Py_DECREF(x);
|
|---|
| 1062 | #endif
|
|---|
| 1063 | #ifdef CL_AWARE_JOINT_STEREO
|
|---|
| 1064 | x = PyInt_FromLong(CL_AWARE_JOINT_STEREO);
|
|---|
| 1065 | if (x == NULL || PyDict_SetItemString(d, "AWARE_JOINT_STEREO", x) < 0)
|
|---|
| 1066 | return;
|
|---|
| 1067 | Py_DECREF(x);
|
|---|
| 1068 | #endif
|
|---|
| 1069 | #ifdef CL_AWARE_LAYER
|
|---|
| 1070 | x = PyInt_FromLong(CL_AWARE_LAYER);
|
|---|
| 1071 | if (x == NULL || PyDict_SetItemString(d, "AWARE_LAYER", x) < 0)
|
|---|
| 1072 | return;
|
|---|
| 1073 | Py_DECREF(x);
|
|---|
| 1074 | #endif
|
|---|
| 1075 | #ifdef CL_AWARE_LOSSLESS
|
|---|
| 1076 | x = PyInt_FromLong(CL_AWARE_LOSSLESS);
|
|---|
| 1077 | if (x == NULL || PyDict_SetItemString(d, "AWARE_LOSSLESS", x) < 0)
|
|---|
| 1078 | return;
|
|---|
| 1079 | Py_DECREF(x);
|
|---|
| 1080 | #endif
|
|---|
| 1081 | #ifdef CL_AWARE_MPEG_AUDIO
|
|---|
| 1082 | x = PyInt_FromLong(CL_AWARE_MPEG_AUDIO);
|
|---|
| 1083 | if (x == NULL || PyDict_SetItemString(d, "AWARE_MPEG_AUDIO", x) < 0)
|
|---|
| 1084 | return;
|
|---|
| 1085 | Py_DECREF(x);
|
|---|
| 1086 | #endif
|
|---|
| 1087 | #ifdef CL_AWARE_MPEG_LAYER_I
|
|---|
| 1088 | x = PyInt_FromLong(CL_AWARE_MPEG_LAYER_I);
|
|---|
| 1089 | if (x == NULL || PyDict_SetItemString(d, "AWARE_MPEG_LAYER_I", x) < 0)
|
|---|
| 1090 | return;
|
|---|
| 1091 | Py_DECREF(x);
|
|---|
| 1092 | #endif
|
|---|
| 1093 | #ifdef CL_AWARE_MPEG_LAYER_II
|
|---|
| 1094 | x = PyInt_FromLong(CL_AWARE_MPEG_LAYER_II);
|
|---|
| 1095 | if (x == NULL || PyDict_SetItemString(d, "AWARE_MPEG_LAYER_II", x) < 0)
|
|---|
| 1096 | return;
|
|---|
| 1097 | Py_DECREF(x);
|
|---|
| 1098 | #endif
|
|---|
| 1099 | #ifdef CL_AWARE_MULTIRATE
|
|---|
| 1100 | x = PyInt_FromLong(CL_AWARE_MULTIRATE);
|
|---|
| 1101 | if (x == NULL || PyDict_SetItemString(d, "AWARE_MULTIRATE", x) < 0)
|
|---|
| 1102 | return;
|
|---|
| 1103 | Py_DECREF(x);
|
|---|
| 1104 | #endif
|
|---|
| 1105 | #ifdef CL_AWARE_NOISE_MARGIN
|
|---|
| 1106 | x = PyInt_FromLong(CL_AWARE_NOISE_MARGIN);
|
|---|
| 1107 | if (x == NULL || PyDict_SetItemString(d, "AWARE_NOISE_MARGIN", x) < 0)
|
|---|
| 1108 | return;
|
|---|
| 1109 | Py_DECREF(x);
|
|---|
| 1110 | #endif
|
|---|
| 1111 | #ifdef CL_AWARE_STEREO
|
|---|
| 1112 | x = PyInt_FromLong(CL_AWARE_STEREO);
|
|---|
| 1113 | if (x == NULL || PyDict_SetItemString(d, "AWARE_STEREO", x) < 0)
|
|---|
| 1114 | return;
|
|---|
| 1115 | Py_DECREF(x);
|
|---|
| 1116 | #endif
|
|---|
| 1117 | #ifdef CL_BAD_ALGORITHM_NAME
|
|---|
| 1118 | x = PyInt_FromLong(CL_BAD_ALGORITHM_NAME);
|
|---|
| 1119 | if (x == NULL || PyDict_SetItemString(d, "BAD_ALGORITHM_NAME", x) < 0)
|
|---|
| 1120 | return;
|
|---|
| 1121 | Py_DECREF(x);
|
|---|
| 1122 | #endif
|
|---|
| 1123 | #ifdef CL_BAD_ALGORITHM_TYPE
|
|---|
| 1124 | x = PyInt_FromLong(CL_BAD_ALGORITHM_TYPE);
|
|---|
| 1125 | if (x == NULL || PyDict_SetItemString(d, "BAD_ALGORITHM_TYPE", x) < 0)
|
|---|
| 1126 | return;
|
|---|
| 1127 | Py_DECREF(x);
|
|---|
| 1128 | #endif
|
|---|
| 1129 | #ifdef CL_BAD_BLOCK_SIZE
|
|---|
| 1130 | x = PyInt_FromLong(CL_BAD_BLOCK_SIZE);
|
|---|
| 1131 | if (x == NULL || PyDict_SetItemString(d, "BAD_BLOCK_SIZE", x) < 0)
|
|---|
| 1132 | return;
|
|---|
| 1133 | Py_DECREF(x);
|
|---|
| 1134 | #endif
|
|---|
| 1135 | #ifdef CL_BAD_BOARD
|
|---|
| 1136 | x = PyInt_FromLong(CL_BAD_BOARD);
|
|---|
| 1137 | if (x == NULL || PyDict_SetItemString(d, "BAD_BOARD", x) < 0)
|
|---|
| 1138 | return;
|
|---|
| 1139 | Py_DECREF(x);
|
|---|
| 1140 | #endif
|
|---|
| 1141 | #ifdef CL_BAD_BUFFERING
|
|---|
| 1142 | x = PyInt_FromLong(CL_BAD_BUFFERING);
|
|---|
| 1143 | if (x == NULL || PyDict_SetItemString(d, "BAD_BUFFERING", x) < 0)
|
|---|
| 1144 | return;
|
|---|
| 1145 | Py_DECREF(x);
|
|---|
| 1146 | #endif
|
|---|
| 1147 | #ifdef CL_BAD_BUFFERLENGTH_NEG
|
|---|
| 1148 | x = PyInt_FromLong(CL_BAD_BUFFERLENGTH_NEG);
|
|---|
| 1149 | if (x == NULL || PyDict_SetItemString(d, "BAD_BUFFERLENGTH_NEG", x) < 0)
|
|---|
| 1150 | return;
|
|---|
| 1151 | Py_DECREF(x);
|
|---|
| 1152 | #endif
|
|---|
| 1153 | #ifdef CL_BAD_BUFFERLENGTH_ODD
|
|---|
| 1154 | x = PyInt_FromLong(CL_BAD_BUFFERLENGTH_ODD);
|
|---|
| 1155 | if (x == NULL || PyDict_SetItemString(d, "BAD_BUFFERLENGTH_ODD", x) < 0)
|
|---|
| 1156 | return;
|
|---|
| 1157 | Py_DECREF(x);
|
|---|
| 1158 | #endif
|
|---|
| 1159 | #ifdef CL_BAD_BUFFER_EXISTS
|
|---|
| 1160 | x = PyInt_FromLong(CL_BAD_BUFFER_EXISTS);
|
|---|
| 1161 | if (x == NULL || PyDict_SetItemString(d, "BAD_BUFFER_EXISTS", x) < 0)
|
|---|
| 1162 | return;
|
|---|
| 1163 | Py_DECREF(x);
|
|---|
| 1164 | #endif
|
|---|
| 1165 | #ifdef CL_BAD_BUFFER_HANDLE
|
|---|
| 1166 | x = PyInt_FromLong(CL_BAD_BUFFER_HANDLE);
|
|---|
| 1167 | if (x == NULL || PyDict_SetItemString(d, "BAD_BUFFER_HANDLE", x) < 0)
|
|---|
| 1168 | return;
|
|---|
| 1169 | Py_DECREF(x);
|
|---|
| 1170 | #endif
|
|---|
| 1171 | #ifdef CL_BAD_BUFFER_POINTER
|
|---|
| 1172 | x = PyInt_FromLong(CL_BAD_BUFFER_POINTER);
|
|---|
| 1173 | if (x == NULL || PyDict_SetItemString(d, "BAD_BUFFER_POINTER", x) < 0)
|
|---|
| 1174 | return;
|
|---|
| 1175 | Py_DECREF(x);
|
|---|
| 1176 | #endif
|
|---|
| 1177 | #ifdef CL_BAD_BUFFER_QUERY_SIZE
|
|---|
| 1178 | x = PyInt_FromLong(CL_BAD_BUFFER_QUERY_SIZE);
|
|---|
| 1179 | if (x == NULL || PyDict_SetItemString(d, "BAD_BUFFER_QUERY_SIZE", x) < 0)
|
|---|
| 1180 | return;
|
|---|
| 1181 | Py_DECREF(x);
|
|---|
| 1182 | #endif
|
|---|
| 1183 | #ifdef CL_BAD_BUFFER_SIZE
|
|---|
| 1184 | x = PyInt_FromLong(CL_BAD_BUFFER_SIZE);
|
|---|
| 1185 | if (x == NULL || PyDict_SetItemString(d, "BAD_BUFFER_SIZE", x) < 0)
|
|---|
| 1186 | return;
|
|---|
| 1187 | Py_DECREF(x);
|
|---|
| 1188 | #endif
|
|---|
| 1189 | #ifdef CL_BAD_BUFFER_SIZE_POINTER
|
|---|
| 1190 | x = PyInt_FromLong(CL_BAD_BUFFER_SIZE_POINTER);
|
|---|
| 1191 | if (x == NULL || PyDict_SetItemString(d, "BAD_BUFFER_SIZE_POINTER", x) < 0)
|
|---|
| 1192 | return;
|
|---|
| 1193 | Py_DECREF(x);
|
|---|
| 1194 | #endif
|
|---|
| 1195 | #ifdef CL_BAD_BUFFER_TYPE
|
|---|
| 1196 | x = PyInt_FromLong(CL_BAD_BUFFER_TYPE);
|
|---|
| 1197 | if (x == NULL || PyDict_SetItemString(d, "BAD_BUFFER_TYPE", x) < 0)
|
|---|
| 1198 | return;
|
|---|
| 1199 | Py_DECREF(x);
|
|---|
| 1200 | #endif
|
|---|
| 1201 | #ifdef CL_BAD_COMPRESSION_SCHEME
|
|---|
| 1202 | x = PyInt_FromLong(CL_BAD_COMPRESSION_SCHEME);
|
|---|
| 1203 | if (x == NULL || PyDict_SetItemString(d, "BAD_COMPRESSION_SCHEME", x) < 0)
|
|---|
| 1204 | return;
|
|---|
| 1205 | Py_DECREF(x);
|
|---|
| 1206 | #endif
|
|---|
| 1207 | #ifdef CL_BAD_COMPRESSOR_HANDLE
|
|---|
| 1208 | x = PyInt_FromLong(CL_BAD_COMPRESSOR_HANDLE);
|
|---|
| 1209 | if (x == NULL || PyDict_SetItemString(d, "BAD_COMPRESSOR_HANDLE", x) < 0)
|
|---|
| 1210 | return;
|
|---|
| 1211 | Py_DECREF(x);
|
|---|
| 1212 | #endif
|
|---|
| 1213 | #ifdef CL_BAD_COMPRESSOR_HANDLE_POINTER
|
|---|
| 1214 | x = PyInt_FromLong(CL_BAD_COMPRESSOR_HANDLE_POINTER);
|
|---|
| 1215 | if (x == NULL || PyDict_SetItemString(d, "BAD_COMPRESSOR_HANDLE_POINTER", x) < 0)
|
|---|
| 1216 | return;
|
|---|
| 1217 | Py_DECREF(x);
|
|---|
| 1218 | #endif
|
|---|
| 1219 | #ifdef CL_BAD_FRAME_SIZE
|
|---|
| 1220 | x = PyInt_FromLong(CL_BAD_FRAME_SIZE);
|
|---|
| 1221 | if (x == NULL || PyDict_SetItemString(d, "BAD_FRAME_SIZE", x) < 0)
|
|---|
| 1222 | return;
|
|---|
| 1223 | Py_DECREF(x);
|
|---|
| 1224 | #endif
|
|---|
| 1225 | #ifdef CL_BAD_FUNCTIONALITY
|
|---|
| 1226 | x = PyInt_FromLong(CL_BAD_FUNCTIONALITY);
|
|---|
| 1227 | if (x == NULL || PyDict_SetItemString(d, "BAD_FUNCTIONALITY", x) < 0)
|
|---|
| 1228 | return;
|
|---|
| 1229 | Py_DECREF(x);
|
|---|
| 1230 | #endif
|
|---|
| 1231 | #ifdef CL_BAD_FUNCTION_POINTER
|
|---|
| 1232 | x = PyInt_FromLong(CL_BAD_FUNCTION_POINTER);
|
|---|
| 1233 | if (x == NULL || PyDict_SetItemString(d, "BAD_FUNCTION_POINTER", x) < 0)
|
|---|
| 1234 | return;
|
|---|
| 1235 | Py_DECREF(x);
|
|---|
| 1236 | #endif
|
|---|
| 1237 | #ifdef CL_BAD_HEADER_SIZE
|
|---|
| 1238 | x = PyInt_FromLong(CL_BAD_HEADER_SIZE);
|
|---|
| 1239 | if (x == NULL || PyDict_SetItemString(d, "BAD_HEADER_SIZE", x) < 0)
|
|---|
| 1240 | return;
|
|---|
| 1241 | Py_DECREF(x);
|
|---|
| 1242 | #endif
|
|---|
| 1243 | #ifdef CL_BAD_INITIAL_VALUE
|
|---|
| 1244 | x = PyInt_FromLong(CL_BAD_INITIAL_VALUE);
|
|---|
| 1245 | if (x == NULL || PyDict_SetItemString(d, "BAD_INITIAL_VALUE", x) < 0)
|
|---|
| 1246 | return;
|
|---|
| 1247 | Py_DECREF(x);
|
|---|
| 1248 | #endif
|
|---|
| 1249 | #ifdef CL_BAD_INTERNAL_FORMAT
|
|---|
| 1250 | x = PyInt_FromLong(CL_BAD_INTERNAL_FORMAT);
|
|---|
| 1251 | if (x == NULL || PyDict_SetItemString(d, "BAD_INTERNAL_FORMAT", x) < 0)
|
|---|
| 1252 | return;
|
|---|
| 1253 | Py_DECREF(x);
|
|---|
| 1254 | #endif
|
|---|
| 1255 | #ifdef CL_BAD_LICENSE
|
|---|
| 1256 | x = PyInt_FromLong(CL_BAD_LICENSE);
|
|---|
| 1257 | if (x == NULL || PyDict_SetItemString(d, "BAD_LICENSE", x) < 0)
|
|---|
| 1258 | return;
|
|---|
| 1259 | Py_DECREF(x);
|
|---|
| 1260 | #endif
|
|---|
| 1261 | #ifdef CL_BAD_MIN_GT_MAX
|
|---|
| 1262 | x = PyInt_FromLong(CL_BAD_MIN_GT_MAX);
|
|---|
| 1263 | if (x == NULL || PyDict_SetItemString(d, "BAD_MIN_GT_MAX", x) < 0)
|
|---|
| 1264 | return;
|
|---|
| 1265 | Py_DECREF(x);
|
|---|
| 1266 | #endif
|
|---|
| 1267 | #ifdef CL_BAD_NO_BUFFERSPACE
|
|---|
| 1268 | x = PyInt_FromLong(CL_BAD_NO_BUFFERSPACE);
|
|---|
| 1269 | if (x == NULL || PyDict_SetItemString(d, "BAD_NO_BUFFERSPACE", x) < 0)
|
|---|
| 1270 | return;
|
|---|
| 1271 | Py_DECREF(x);
|
|---|
| 1272 | #endif
|
|---|
| 1273 | #ifdef CL_BAD_NUMBER_OF_BLOCKS
|
|---|
| 1274 | x = PyInt_FromLong(CL_BAD_NUMBER_OF_BLOCKS);
|
|---|
| 1275 | if (x == NULL || PyDict_SetItemString(d, "BAD_NUMBER_OF_BLOCKS", x) < 0)
|
|---|
| 1276 | return;
|
|---|
| 1277 | Py_DECREF(x);
|
|---|
| 1278 | #endif
|
|---|
| 1279 | #ifdef CL_BAD_PARAM
|
|---|
| 1280 | x = PyInt_FromLong(CL_BAD_PARAM);
|
|---|
| 1281 | if (x == NULL || PyDict_SetItemString(d, "BAD_PARAM", x) < 0)
|
|---|
| 1282 | return;
|
|---|
| 1283 | Py_DECREF(x);
|
|---|
| 1284 | #endif
|
|---|
| 1285 | #ifdef CL_BAD_PARAM_ID_POINTER
|
|---|
| 1286 | x = PyInt_FromLong(CL_BAD_PARAM_ID_POINTER);
|
|---|
| 1287 | if (x == NULL || PyDict_SetItemString(d, "BAD_PARAM_ID_POINTER", x) < 0)
|
|---|
| 1288 | return;
|
|---|
| 1289 | Py_DECREF(x);
|
|---|
| 1290 | #endif
|
|---|
| 1291 | #ifdef CL_BAD_PARAM_TYPE
|
|---|
| 1292 | x = PyInt_FromLong(CL_BAD_PARAM_TYPE);
|
|---|
| 1293 | if (x == NULL || PyDict_SetItemString(d, "BAD_PARAM_TYPE", x) < 0)
|
|---|
| 1294 | return;
|
|---|
| 1295 | Py_DECREF(x);
|
|---|
| 1296 | #endif
|
|---|
| 1297 | #ifdef CL_BAD_POINTER
|
|---|
| 1298 | x = PyInt_FromLong(CL_BAD_POINTER);
|
|---|
| 1299 | if (x == NULL || PyDict_SetItemString(d, "BAD_POINTER", x) < 0)
|
|---|
| 1300 | return;
|
|---|
| 1301 | Py_DECREF(x);
|
|---|
| 1302 | #endif
|
|---|
| 1303 | #ifdef CL_BAD_PVBUFFER
|
|---|
| 1304 | x = PyInt_FromLong(CL_BAD_PVBUFFER);
|
|---|
| 1305 | if (x == NULL || PyDict_SetItemString(d, "BAD_PVBUFFER", x) < 0)
|
|---|
| 1306 | return;
|
|---|
| 1307 | Py_DECREF(x);
|
|---|
| 1308 | #endif
|
|---|
| 1309 | #ifdef CL_BAD_SCHEME_POINTER
|
|---|
| 1310 | x = PyInt_FromLong(CL_BAD_SCHEME_POINTER);
|
|---|
| 1311 | if (x == NULL || PyDict_SetItemString(d, "BAD_SCHEME_POINTER", x) < 0)
|
|---|
| 1312 | return;
|
|---|
| 1313 | Py_DECREF(x);
|
|---|
| 1314 | #endif
|
|---|
| 1315 | #ifdef CL_BAD_STREAM_HEADER
|
|---|
| 1316 | x = PyInt_FromLong(CL_BAD_STREAM_HEADER);
|
|---|
| 1317 | if (x == NULL || PyDict_SetItemString(d, "BAD_STREAM_HEADER", x) < 0)
|
|---|
| 1318 | return;
|
|---|
| 1319 | Py_DECREF(x);
|
|---|
| 1320 | #endif
|
|---|
| 1321 | #ifdef CL_BAD_STRING_POINTER
|
|---|
| 1322 | x = PyInt_FromLong(CL_BAD_STRING_POINTER);
|
|---|
| 1323 | if (x == NULL || PyDict_SetItemString(d, "BAD_STRING_POINTER", x) < 0)
|
|---|
| 1324 | return;
|
|---|
| 1325 | Py_DECREF(x);
|
|---|
| 1326 | #endif
|
|---|
| 1327 | #ifdef CL_BAD_TEXT_STRING_PTR
|
|---|
| 1328 | x = PyInt_FromLong(CL_BAD_TEXT_STRING_PTR);
|
|---|
| 1329 | if (x == NULL || PyDict_SetItemString(d, "BAD_TEXT_STRING_PTR", x) < 0)
|
|---|
| 1330 | return;
|
|---|
| 1331 | Py_DECREF(x);
|
|---|
| 1332 | #endif
|
|---|
| 1333 | #ifdef CL_BEST_FIT
|
|---|
| 1334 | x = PyInt_FromLong(CL_BEST_FIT);
|
|---|
| 1335 | if (x == NULL || PyDict_SetItemString(d, "BEST_FIT", x) < 0)
|
|---|
| 1336 | return;
|
|---|
| 1337 | Py_DECREF(x);
|
|---|
| 1338 | #endif
|
|---|
| 1339 | #ifdef CL_BIDIRECTIONAL
|
|---|
| 1340 | x = PyInt_FromLong(CL_BIDIRECTIONAL);
|
|---|
| 1341 | if (x == NULL || PyDict_SetItemString(d, "BIDIRECTIONAL", x) < 0)
|
|---|
| 1342 | return;
|
|---|
| 1343 | Py_DECREF(x);
|
|---|
| 1344 | #endif
|
|---|
| 1345 | #ifdef CL_BITRATE
|
|---|
| 1346 | x = PyInt_FromLong(CL_BITRATE);
|
|---|
| 1347 | if (x == NULL || PyDict_SetItemString(d, "BITRATE", x) < 0)
|
|---|
| 1348 | return;
|
|---|
| 1349 | Py_DECREF(x);
|
|---|
| 1350 | #endif
|
|---|
| 1351 | #ifdef CL_BITRATE_POLICY
|
|---|
| 1352 | x = PyInt_FromLong(CL_BITRATE_POLICY);
|
|---|
| 1353 | if (x == NULL || PyDict_SetItemString(d, "BITRATE_POLICY", x) < 0)
|
|---|
| 1354 | return;
|
|---|
| 1355 | Py_DECREF(x);
|
|---|
| 1356 | #endif
|
|---|
| 1357 | #ifdef CL_BITRATE_TARGET
|
|---|
| 1358 | x = PyInt_FromLong(CL_BITRATE_TARGET);
|
|---|
| 1359 | if (x == NULL || PyDict_SetItemString(d, "BITRATE_TARGET", x) < 0)
|
|---|
| 1360 | return;
|
|---|
| 1361 | Py_DECREF(x);
|
|---|
| 1362 | #endif
|
|---|
| 1363 | #ifdef CL_BITS_PER_COMPONENT
|
|---|
| 1364 | x = PyInt_FromLong(CL_BITS_PER_COMPONENT);
|
|---|
| 1365 | if (x == NULL || PyDict_SetItemString(d, "BITS_PER_COMPONENT", x) < 0)
|
|---|
| 1366 | return;
|
|---|
| 1367 | Py_DECREF(x);
|
|---|
| 1368 | #endif
|
|---|
| 1369 | #ifdef CL_BLENDING
|
|---|
| 1370 | x = PyInt_FromLong(CL_BLENDING);
|
|---|
| 1371 | if (x == NULL || PyDict_SetItemString(d, "BLENDING", x) < 0)
|
|---|
| 1372 | return;
|
|---|
| 1373 | Py_DECREF(x);
|
|---|
| 1374 | #endif
|
|---|
| 1375 | #ifdef CL_BLOCK_SIZE
|
|---|
| 1376 | x = PyInt_FromLong(CL_BLOCK_SIZE);
|
|---|
| 1377 | if (x == NULL || PyDict_SetItemString(d, "BLOCK_SIZE", x) < 0)
|
|---|
| 1378 | return;
|
|---|
| 1379 | Py_DECREF(x);
|
|---|
| 1380 | #endif
|
|---|
| 1381 | #ifdef CL_BOTTOM_UP
|
|---|
| 1382 | x = PyInt_FromLong(CL_BOTTOM_UP);
|
|---|
| 1383 | if (x == NULL || PyDict_SetItemString(d, "BOTTOM_UP", x) < 0)
|
|---|
| 1384 | return;
|
|---|
| 1385 | Py_DECREF(x);
|
|---|
| 1386 | #endif
|
|---|
| 1387 | #ifdef CL_BUFFER_NOT_CREATED
|
|---|
| 1388 | x = PyInt_FromLong(CL_BUFFER_NOT_CREATED);
|
|---|
| 1389 | if (x == NULL || PyDict_SetItemString(d, "BUFFER_NOT_CREATED", x) < 0)
|
|---|
| 1390 | return;
|
|---|
| 1391 | Py_DECREF(x);
|
|---|
| 1392 | #endif
|
|---|
| 1393 | #ifdef CL_BUF_COMPRESSED
|
|---|
| 1394 | x = PyInt_FromLong(CL_BUF_COMPRESSED);
|
|---|
| 1395 | if (x == NULL || PyDict_SetItemString(d, "BUF_COMPRESSED", x) < 0)
|
|---|
| 1396 | return;
|
|---|
| 1397 | Py_DECREF(x);
|
|---|
| 1398 | #endif
|
|---|
| 1399 | #ifdef CL_BUF_DATA
|
|---|
| 1400 | x = PyInt_FromLong(CL_BUF_DATA);
|
|---|
| 1401 | if (x == NULL || PyDict_SetItemString(d, "BUF_DATA", x) < 0)
|
|---|
| 1402 | return;
|
|---|
| 1403 | Py_DECREF(x);
|
|---|
| 1404 | #endif
|
|---|
| 1405 | #ifdef CL_BUF_FRAME
|
|---|
| 1406 | x = PyInt_FromLong(CL_BUF_FRAME);
|
|---|
| 1407 | if (x == NULL || PyDict_SetItemString(d, "BUF_FRAME", x) < 0)
|
|---|
| 1408 | return;
|
|---|
| 1409 | Py_DECREF(x);
|
|---|
| 1410 | #endif
|
|---|
| 1411 | #ifdef CL_CHANNEL_POLICY
|
|---|
| 1412 | x = PyInt_FromLong(CL_CHANNEL_POLICY);
|
|---|
| 1413 | if (x == NULL || PyDict_SetItemString(d, "CHANNEL_POLICY", x) < 0)
|
|---|
| 1414 | return;
|
|---|
| 1415 | Py_DECREF(x);
|
|---|
| 1416 | #endif
|
|---|
| 1417 | #ifdef CL_CHROMA_THRESHOLD
|
|---|
| 1418 | x = PyInt_FromLong(CL_CHROMA_THRESHOLD);
|
|---|
| 1419 | if (x == NULL || PyDict_SetItemString(d, "CHROMA_THRESHOLD", x) < 0)
|
|---|
| 1420 | return;
|
|---|
| 1421 | Py_DECREF(x);
|
|---|
| 1422 | #endif
|
|---|
| 1423 | #ifdef CL_CODEC
|
|---|
| 1424 | x = PyInt_FromLong(CL_CODEC);
|
|---|
| 1425 | if (x == NULL || PyDict_SetItemString(d, "CODEC", x) < 0)
|
|---|
| 1426 | return;
|
|---|
| 1427 | Py_DECREF(x);
|
|---|
| 1428 | #endif
|
|---|
| 1429 | #ifdef CL_COMPONENTS
|
|---|
| 1430 | x = PyInt_FromLong(CL_COMPONENTS);
|
|---|
| 1431 | if (x == NULL || PyDict_SetItemString(d, "COMPONENTS", x) < 0)
|
|---|
| 1432 | return;
|
|---|
| 1433 | Py_DECREF(x);
|
|---|
| 1434 | #endif
|
|---|
| 1435 | #ifdef CL_COMPRESSED_BUFFER_SIZE
|
|---|
| 1436 | x = PyInt_FromLong(CL_COMPRESSED_BUFFER_SIZE);
|
|---|
| 1437 | if (x == NULL || PyDict_SetItemString(d, "COMPRESSED_BUFFER_SIZE", x) < 0)
|
|---|
| 1438 | return;
|
|---|
| 1439 | Py_DECREF(x);
|
|---|
| 1440 | #endif
|
|---|
| 1441 | #ifdef CL_COMPRESSION_RATIO
|
|---|
| 1442 | x = PyInt_FromLong(CL_COMPRESSION_RATIO);
|
|---|
| 1443 | if (x == NULL || PyDict_SetItemString(d, "COMPRESSION_RATIO", x) < 0)
|
|---|
| 1444 | return;
|
|---|
| 1445 | Py_DECREF(x);
|
|---|
| 1446 | #endif
|
|---|
| 1447 | #ifdef CL_COMPRESSOR
|
|---|
| 1448 | x = PyInt_FromLong(CL_COMPRESSOR);
|
|---|
| 1449 | if (x == NULL || PyDict_SetItemString(d, "COMPRESSOR", x) < 0)
|
|---|
| 1450 | return;
|
|---|
| 1451 | Py_DECREF(x);
|
|---|
| 1452 | #endif
|
|---|
| 1453 | #ifdef CL_CONTINUOUS_BLOCK
|
|---|
| 1454 | x = PyInt_FromLong(CL_CONTINUOUS_BLOCK);
|
|---|
| 1455 | if (x == NULL || PyDict_SetItemString(d, "CONTINUOUS_BLOCK", x) < 0)
|
|---|
| 1456 | return;
|
|---|
| 1457 | Py_DECREF(x);
|
|---|
| 1458 | #endif
|
|---|
| 1459 | #ifdef CL_CONTINUOUS_NONBLOCK
|
|---|
| 1460 | x = PyInt_FromLong(CL_CONTINUOUS_NONBLOCK);
|
|---|
| 1461 | if (x == NULL || PyDict_SetItemString(d, "CONTINUOUS_NONBLOCK", x) < 0)
|
|---|
| 1462 | return;
|
|---|
| 1463 | Py_DECREF(x);
|
|---|
| 1464 | #endif
|
|---|
| 1465 | #ifdef CL_COSMO_CODEC_CONTROL
|
|---|
| 1466 | x = PyInt_FromLong(CL_COSMO_CODEC_CONTROL);
|
|---|
| 1467 | if (x == NULL || PyDict_SetItemString(d, "COSMO_CODEC_CONTROL", x) < 0)
|
|---|
| 1468 | return;
|
|---|
| 1469 | Py_DECREF(x);
|
|---|
| 1470 | #endif
|
|---|
| 1471 | #ifdef CL_COSMO_NUM_PARAMS
|
|---|
| 1472 | x = PyInt_FromLong(CL_COSMO_NUM_PARAMS);
|
|---|
| 1473 | if (x == NULL || PyDict_SetItemString(d, "COSMO_NUM_PARAMS", x) < 0)
|
|---|
| 1474 | return;
|
|---|
| 1475 | Py_DECREF(x);
|
|---|
| 1476 | #endif
|
|---|
| 1477 | #ifdef CL_COSMO_VALUE_BASE
|
|---|
| 1478 | x = PyInt_FromLong(CL_COSMO_VALUE_BASE);
|
|---|
| 1479 | if (x == NULL || PyDict_SetItemString(d, "COSMO_VALUE_BASE", x) < 0)
|
|---|
| 1480 | return;
|
|---|
| 1481 | Py_DECREF(x);
|
|---|
| 1482 | #endif
|
|---|
| 1483 | #ifdef CL_COSMO_VIDEO_MANUAL_CONTROL
|
|---|
| 1484 | x = PyInt_FromLong(CL_COSMO_VIDEO_MANUAL_CONTROL);
|
|---|
| 1485 | if (x == NULL || PyDict_SetItemString(d, "COSMO_VIDEO_MANUAL_CONTROL", x) < 0)
|
|---|
| 1486 | return;
|
|---|
| 1487 | Py_DECREF(x);
|
|---|
| 1488 | #endif
|
|---|
| 1489 | #ifdef CL_COSMO_VIDEO_TRANSFER_MODE
|
|---|
| 1490 | x = PyInt_FromLong(CL_COSMO_VIDEO_TRANSFER_MODE);
|
|---|
| 1491 | if (x == NULL || PyDict_SetItemString(d, "COSMO_VIDEO_TRANSFER_MODE", x) < 0)
|
|---|
| 1492 | return;
|
|---|
| 1493 | Py_DECREF(x);
|
|---|
| 1494 | #endif
|
|---|
| 1495 | #ifdef CL_DATA
|
|---|
| 1496 | x = PyInt_FromLong(CL_DATA);
|
|---|
| 1497 | if (x == NULL || PyDict_SetItemString(d, "DATA", x) < 0)
|
|---|
| 1498 | return;
|
|---|
| 1499 | Py_DECREF(x);
|
|---|
| 1500 | #endif
|
|---|
| 1501 | #ifdef CL_DECOMPRESSOR
|
|---|
| 1502 | x = PyInt_FromLong(CL_DECOMPRESSOR);
|
|---|
| 1503 | if (x == NULL || PyDict_SetItemString(d, "DECOMPRESSOR", x) < 0)
|
|---|
| 1504 | return;
|
|---|
| 1505 | Py_DECREF(x);
|
|---|
| 1506 | #endif
|
|---|
| 1507 | #ifdef CL_DSO_ERROR
|
|---|
| 1508 | x = PyInt_FromLong(CL_DSO_ERROR);
|
|---|
| 1509 | if (x == NULL || PyDict_SetItemString(d, "DSO_ERROR", x) < 0)
|
|---|
| 1510 | return;
|
|---|
| 1511 | Py_DECREF(x);
|
|---|
| 1512 | #endif
|
|---|
| 1513 | #ifdef CL_EDGE_THRESHOLD
|
|---|
| 1514 | x = PyInt_FromLong(CL_EDGE_THRESHOLD);
|
|---|
| 1515 | if (x == NULL || PyDict_SetItemString(d, "EDGE_THRESHOLD", x) < 0)
|
|---|
| 1516 | return;
|
|---|
| 1517 | Py_DECREF(x);
|
|---|
| 1518 | #endif
|
|---|
| 1519 | #ifdef CL_ENABLE_IMAGEINFO
|
|---|
| 1520 | x = PyInt_FromLong(CL_ENABLE_IMAGEINFO);
|
|---|
| 1521 | if (x == NULL || PyDict_SetItemString(d, "ENABLE_IMAGEINFO", x) < 0)
|
|---|
| 1522 | return;
|
|---|
| 1523 | Py_DECREF(x);
|
|---|
| 1524 | #endif
|
|---|
| 1525 | #ifdef CL_END_OF_SEQUENCE
|
|---|
| 1526 | x = PyInt_FromLong(CL_END_OF_SEQUENCE);
|
|---|
| 1527 | if (x == NULL || PyDict_SetItemString(d, "END_OF_SEQUENCE", x) < 0)
|
|---|
| 1528 | return;
|
|---|
| 1529 | Py_DECREF(x);
|
|---|
| 1530 | #endif
|
|---|
| 1531 | #ifdef CL_ENUM_VALUE
|
|---|
| 1532 | x = PyInt_FromLong(CL_ENUM_VALUE);
|
|---|
| 1533 | if (x == NULL || PyDict_SetItemString(d, "ENUM_VALUE", x) < 0)
|
|---|
| 1534 | return;
|
|---|
| 1535 | Py_DECREF(x);
|
|---|
| 1536 | #endif
|
|---|
| 1537 | #ifdef CL_EXACT_COMPRESSION_RATIO
|
|---|
| 1538 | x = PyInt_FromLong(CL_EXACT_COMPRESSION_RATIO);
|
|---|
| 1539 | if (x == NULL || PyDict_SetItemString(d, "EXACT_COMPRESSION_RATIO", x) < 0)
|
|---|
| 1540 | return;
|
|---|
| 1541 | Py_DECREF(x);
|
|---|
| 1542 | #endif
|
|---|
| 1543 | #ifdef CL_EXTERNAL_DEVICE
|
|---|
| 1544 | x = PyInt_FromLong((long) CL_EXTERNAL_DEVICE);
|
|---|
| 1545 | if (x == NULL || PyDict_SetItemString(d, "EXTERNAL_DEVICE", x) < 0)
|
|---|
| 1546 | return;
|
|---|
| 1547 | Py_DECREF(x);
|
|---|
| 1548 | #endif
|
|---|
| 1549 | #ifdef CL_FLOATING_ENUM_VALUE
|
|---|
| 1550 | x = PyInt_FromLong(CL_FLOATING_ENUM_VALUE);
|
|---|
| 1551 | if (x == NULL || PyDict_SetItemString(d, "FLOATING_ENUM_VALUE", x) < 0)
|
|---|
| 1552 | return;
|
|---|
| 1553 | Py_DECREF(x);
|
|---|
| 1554 | #endif
|
|---|
| 1555 | #ifdef CL_FLOATING_RANGE_VALUE
|
|---|
| 1556 | x = PyInt_FromLong(CL_FLOATING_RANGE_VALUE);
|
|---|
| 1557 | if (x == NULL || PyDict_SetItemString(d, "FLOATING_RANGE_VALUE", x) < 0)
|
|---|
| 1558 | return;
|
|---|
| 1559 | Py_DECREF(x);
|
|---|
| 1560 | #endif
|
|---|
| 1561 | #ifdef CL_FORMAT
|
|---|
| 1562 | x = PyInt_FromLong(CL_FORMAT);
|
|---|
| 1563 | if (x == NULL || PyDict_SetItemString(d, "FORMAT", x) < 0)
|
|---|
| 1564 | return;
|
|---|
| 1565 | Py_DECREF(x);
|
|---|
| 1566 | #endif
|
|---|
| 1567 | #ifdef CL_FORMAT_ABGR
|
|---|
| 1568 | x = PyInt_FromLong(CL_FORMAT_ABGR);
|
|---|
| 1569 | if (x == NULL || PyDict_SetItemString(d, "FORMAT_ABGR", x) < 0)
|
|---|
| 1570 | return;
|
|---|
| 1571 | Py_DECREF(x);
|
|---|
| 1572 | #endif
|
|---|
| 1573 | #ifdef CL_FORMAT_BGR
|
|---|
| 1574 | x = PyInt_FromLong(CL_FORMAT_BGR);
|
|---|
| 1575 | if (x == NULL || PyDict_SetItemString(d, "FORMAT_BGR", x) < 0)
|
|---|
| 1576 | return;
|
|---|
| 1577 | Py_DECREF(x);
|
|---|
| 1578 | #endif
|
|---|
| 1579 | #ifdef CL_FORMAT_BGR233
|
|---|
| 1580 | x = PyInt_FromLong(CL_FORMAT_BGR233);
|
|---|
| 1581 | if (x == NULL || PyDict_SetItemString(d, "FORMAT_BGR233", x) < 0)
|
|---|
| 1582 | return;
|
|---|
| 1583 | Py_DECREF(x);
|
|---|
| 1584 | #endif
|
|---|
| 1585 | #ifdef CL_FORMAT_GRAYSCALE
|
|---|
| 1586 | x = PyInt_FromLong(CL_FORMAT_GRAYSCALE);
|
|---|
| 1587 | if (x == NULL || PyDict_SetItemString(d, "FORMAT_GRAYSCALE", x) < 0)
|
|---|
| 1588 | return;
|
|---|
| 1589 | Py_DECREF(x);
|
|---|
| 1590 | #endif
|
|---|
| 1591 | #ifdef CL_FORMAT_MONO
|
|---|
| 1592 | x = PyInt_FromLong(CL_FORMAT_MONO);
|
|---|
| 1593 | if (x == NULL || PyDict_SetItemString(d, "FORMAT_MONO", x) < 0)
|
|---|
| 1594 | return;
|
|---|
| 1595 | Py_DECREF(x);
|
|---|
| 1596 | #endif
|
|---|
| 1597 | #ifdef CL_FORMAT_RBG323
|
|---|
| 1598 | x = PyInt_FromLong(CL_FORMAT_RBG323);
|
|---|
| 1599 | if (x == NULL || PyDict_SetItemString(d, "FORMAT_RBG323", x) < 0)
|
|---|
| 1600 | return;
|
|---|
| 1601 | Py_DECREF(x);
|
|---|
| 1602 | #endif
|
|---|
| 1603 | #ifdef CL_FORMAT_STEREO_INTERLEAVED
|
|---|
| 1604 | x = PyInt_FromLong(CL_FORMAT_STEREO_INTERLEAVED);
|
|---|
| 1605 | if (x == NULL || PyDict_SetItemString(d, "FORMAT_STEREO_INTERLEAVED", x) < 0)
|
|---|
| 1606 | return;
|
|---|
| 1607 | Py_DECREF(x);
|
|---|
| 1608 | #endif
|
|---|
| 1609 | #ifdef CL_FORMAT_XBGR
|
|---|
| 1610 | x = PyInt_FromLong(CL_FORMAT_XBGR);
|
|---|
| 1611 | if (x == NULL || PyDict_SetItemString(d, "FORMAT_XBGR", x) < 0)
|
|---|
| 1612 | return;
|
|---|
| 1613 | Py_DECREF(x);
|
|---|
| 1614 | #endif
|
|---|
| 1615 | #ifdef CL_FORMAT_YCbCr
|
|---|
| 1616 | x = PyInt_FromLong(CL_FORMAT_YCbCr);
|
|---|
| 1617 | if (x == NULL || PyDict_SetItemString(d, "FORMAT_YCbCr", x) < 0)
|
|---|
| 1618 | return;
|
|---|
| 1619 | Py_DECREF(x);
|
|---|
| 1620 | #endif
|
|---|
| 1621 | #ifdef CL_FORMAT_YCbCr422
|
|---|
| 1622 | x = PyInt_FromLong(CL_FORMAT_YCbCr422);
|
|---|
| 1623 | if (x == NULL || PyDict_SetItemString(d, "FORMAT_YCbCr422", x) < 0)
|
|---|
| 1624 | return;
|
|---|
| 1625 | Py_DECREF(x);
|
|---|
| 1626 | #endif
|
|---|
| 1627 | #ifdef CL_FORMAT_YCbCr422DC
|
|---|
| 1628 | x = PyInt_FromLong(CL_FORMAT_YCbCr422DC);
|
|---|
| 1629 | if (x == NULL || PyDict_SetItemString(d, "FORMAT_YCbCr422DC", x) < 0)
|
|---|
| 1630 | return;
|
|---|
| 1631 | Py_DECREF(x);
|
|---|
| 1632 | #endif
|
|---|
| 1633 | #ifdef CL_FRAME
|
|---|
| 1634 | x = PyInt_FromLong(CL_FRAME);
|
|---|
| 1635 | if (x == NULL || PyDict_SetItemString(d, "FRAME", x) < 0)
|
|---|
| 1636 | return;
|
|---|
| 1637 | Py_DECREF(x);
|
|---|
| 1638 | #endif
|
|---|
| 1639 | #ifdef CL_FRAMES_PER_CHUNK
|
|---|
| 1640 | x = PyInt_FromLong(CL_FRAMES_PER_CHUNK);
|
|---|
| 1641 | if (x == NULL || PyDict_SetItemString(d, "FRAMES_PER_CHUNK", x) < 0)
|
|---|
| 1642 | return;
|
|---|
| 1643 | Py_DECREF(x);
|
|---|
| 1644 | #endif
|
|---|
| 1645 | #ifdef CL_FRAME_BUFFER_SIZE
|
|---|
| 1646 | x = PyInt_FromLong(CL_FRAME_BUFFER_SIZE);
|
|---|
| 1647 | if (x == NULL || PyDict_SetItemString(d, "FRAME_BUFFER_SIZE", x) < 0)
|
|---|
| 1648 | return;
|
|---|
| 1649 | Py_DECREF(x);
|
|---|
| 1650 | #endif
|
|---|
| 1651 | #ifdef CL_FRAME_BUFFER_SIZE_ZERO
|
|---|
| 1652 | x = PyInt_FromLong(CL_FRAME_BUFFER_SIZE_ZERO);
|
|---|
| 1653 | if (x == NULL || PyDict_SetItemString(d, "FRAME_BUFFER_SIZE_ZERO", x) < 0)
|
|---|
| 1654 | return;
|
|---|
| 1655 | Py_DECREF(x);
|
|---|
| 1656 | #endif
|
|---|
| 1657 | #ifdef CL_FRAME_INDEX
|
|---|
| 1658 | x = PyInt_FromLong(CL_FRAME_INDEX);
|
|---|
| 1659 | if (x == NULL || PyDict_SetItemString(d, "FRAME_INDEX", x) < 0)
|
|---|
| 1660 | return;
|
|---|
| 1661 | Py_DECREF(x);
|
|---|
| 1662 | #endif
|
|---|
| 1663 | #ifdef CL_FRAME_RATE
|
|---|
| 1664 | x = PyInt_FromLong(CL_FRAME_RATE);
|
|---|
| 1665 | if (x == NULL || PyDict_SetItemString(d, "FRAME_RATE", x) < 0)
|
|---|
| 1666 | return;
|
|---|
| 1667 | Py_DECREF(x);
|
|---|
| 1668 | #endif
|
|---|
| 1669 | #ifdef CL_FRAME_SIZE
|
|---|
| 1670 | x = PyInt_FromLong(CL_FRAME_SIZE);
|
|---|
| 1671 | if (x == NULL || PyDict_SetItemString(d, "FRAME_SIZE", x) < 0)
|
|---|
| 1672 | return;
|
|---|
| 1673 | Py_DECREF(x);
|
|---|
| 1674 | #endif
|
|---|
| 1675 | #ifdef CL_FRAME_TYPE
|
|---|
| 1676 | x = PyInt_FromLong(CL_FRAME_TYPE);
|
|---|
| 1677 | if (x == NULL || PyDict_SetItemString(d, "FRAME_TYPE", x) < 0)
|
|---|
| 1678 | return;
|
|---|
| 1679 | Py_DECREF(x);
|
|---|
| 1680 | #endif
|
|---|
| 1681 | #ifdef CL_G711_ALAW
|
|---|
| 1682 | x = PyInt_FromLong(CL_G711_ALAW);
|
|---|
| 1683 | if (x == NULL || PyDict_SetItemString(d, "G711_ALAW", x) < 0)
|
|---|
| 1684 | return;
|
|---|
| 1685 | Py_DECREF(x);
|
|---|
| 1686 | #endif
|
|---|
| 1687 | #ifdef CL_G711_ALAW_SOFTWARE
|
|---|
| 1688 | x = PyInt_FromLong(CL_G711_ALAW_SOFTWARE);
|
|---|
| 1689 | if (x == NULL || PyDict_SetItemString(d, "G711_ALAW_SOFTWARE", x) < 0)
|
|---|
| 1690 | return;
|
|---|
| 1691 | Py_DECREF(x);
|
|---|
| 1692 | #endif
|
|---|
| 1693 | #ifdef CL_G711_ULAW
|
|---|
| 1694 | x = PyInt_FromLong(CL_G711_ULAW);
|
|---|
| 1695 | if (x == NULL || PyDict_SetItemString(d, "G711_ULAW", x) < 0)
|
|---|
| 1696 | return;
|
|---|
| 1697 | Py_DECREF(x);
|
|---|
| 1698 | #endif
|
|---|
| 1699 | #ifdef CL_G711_ULAW_SOFTWARE
|
|---|
| 1700 | x = PyInt_FromLong(CL_G711_ULAW_SOFTWARE);
|
|---|
| 1701 | if (x == NULL || PyDict_SetItemString(d, "G711_ULAW_SOFTWARE", x) < 0)
|
|---|
| 1702 | return;
|
|---|
| 1703 | Py_DECREF(x);
|
|---|
| 1704 | #endif
|
|---|
| 1705 | #ifdef CL_GRAYSCALE
|
|---|
| 1706 | x = PyInt_FromLong(CL_GRAYSCALE);
|
|---|
| 1707 | if (x == NULL || PyDict_SetItemString(d, "GRAYSCALE", x) < 0)
|
|---|
| 1708 | return;
|
|---|
| 1709 | Py_DECREF(x);
|
|---|
| 1710 | #endif
|
|---|
| 1711 | #ifdef CL_HDCC
|
|---|
| 1712 | x = PyInt_FromLong(CL_HDCC);
|
|---|
| 1713 | if (x == NULL || PyDict_SetItemString(d, "HDCC", x) < 0)
|
|---|
| 1714 | return;
|
|---|
| 1715 | Py_DECREF(x);
|
|---|
| 1716 | #endif
|
|---|
| 1717 | #ifdef CL_HDCC_SAMPLES_PER_TILE
|
|---|
| 1718 | x = PyInt_FromLong(CL_HDCC_SAMPLES_PER_TILE);
|
|---|
| 1719 | if (x == NULL || PyDict_SetItemString(d, "HDCC_SAMPLES_PER_TILE", x) < 0)
|
|---|
| 1720 | return;
|
|---|
| 1721 | Py_DECREF(x);
|
|---|
| 1722 | #endif
|
|---|
| 1723 | #ifdef CL_HDCC_SOFTWARE
|
|---|
| 1724 | x = PyInt_FromLong(CL_HDCC_SOFTWARE);
|
|---|
| 1725 | if (x == NULL || PyDict_SetItemString(d, "HDCC_SOFTWARE", x) < 0)
|
|---|
| 1726 | return;
|
|---|
| 1727 | Py_DECREF(x);
|
|---|
| 1728 | #endif
|
|---|
| 1729 | #ifdef CL_HDCC_TILE_THRESHOLD
|
|---|
| 1730 | x = PyInt_FromLong(CL_HDCC_TILE_THRESHOLD);
|
|---|
| 1731 | if (x == NULL || PyDict_SetItemString(d, "HDCC_TILE_THRESHOLD", x) < 0)
|
|---|
| 1732 | return;
|
|---|
| 1733 | Py_DECREF(x);
|
|---|
| 1734 | #endif
|
|---|
| 1735 | #ifdef CL_HEADER_START_CODE
|
|---|
| 1736 | x = PyInt_FromLong(CL_HEADER_START_CODE);
|
|---|
| 1737 | if (x == NULL || PyDict_SetItemString(d, "HEADER_START_CODE", x) < 0)
|
|---|
| 1738 | return;
|
|---|
| 1739 | Py_DECREF(x);
|
|---|
| 1740 | #endif
|
|---|
| 1741 | #ifdef CL_IMAGEINFO_FIELDMASK
|
|---|
| 1742 | x = PyInt_FromLong(CL_IMAGEINFO_FIELDMASK);
|
|---|
| 1743 | if (x == NULL || PyDict_SetItemString(d, "IMAGEINFO_FIELDMASK", x) < 0)
|
|---|
| 1744 | return;
|
|---|
| 1745 | Py_DECREF(x);
|
|---|
| 1746 | #endif
|
|---|
| 1747 | #ifdef CL_IMAGE_CROP_BOTTOM
|
|---|
| 1748 | x = PyInt_FromLong(CL_IMAGE_CROP_BOTTOM);
|
|---|
| 1749 | if (x == NULL || PyDict_SetItemString(d, "IMAGE_CROP_BOTTOM", x) < 0)
|
|---|
| 1750 | return;
|
|---|
| 1751 | Py_DECREF(x);
|
|---|
| 1752 | #endif
|
|---|
| 1753 | #ifdef CL_IMAGE_CROP_LEFT
|
|---|
| 1754 | x = PyInt_FromLong(CL_IMAGE_CROP_LEFT);
|
|---|
| 1755 | if (x == NULL || PyDict_SetItemString(d, "IMAGE_CROP_LEFT", x) < 0)
|
|---|
| 1756 | return;
|
|---|
| 1757 | Py_DECREF(x);
|
|---|
| 1758 | #endif
|
|---|
| 1759 | #ifdef CL_IMAGE_CROP_RIGHT
|
|---|
| 1760 | x = PyInt_FromLong(CL_IMAGE_CROP_RIGHT);
|
|---|
| 1761 | if (x == NULL || PyDict_SetItemString(d, "IMAGE_CROP_RIGHT", x) < 0)
|
|---|
| 1762 | return;
|
|---|
| 1763 | Py_DECREF(x);
|
|---|
| 1764 | #endif
|
|---|
| 1765 | #ifdef CL_IMAGE_CROP_TOP
|
|---|
| 1766 | x = PyInt_FromLong(CL_IMAGE_CROP_TOP);
|
|---|
| 1767 | if (x == NULL || PyDict_SetItemString(d, "IMAGE_CROP_TOP", x) < 0)
|
|---|
| 1768 | return;
|
|---|
| 1769 | Py_DECREF(x);
|
|---|
| 1770 | #endif
|
|---|
| 1771 | #ifdef CL_IMAGE_HEIGHT
|
|---|
| 1772 | x = PyInt_FromLong(CL_IMAGE_HEIGHT);
|
|---|
| 1773 | if (x == NULL || PyDict_SetItemString(d, "IMAGE_HEIGHT", x) < 0)
|
|---|
| 1774 | return;
|
|---|
| 1775 | Py_DECREF(x);
|
|---|
| 1776 | #endif
|
|---|
| 1777 | #ifdef CL_IMAGE_WIDTH
|
|---|
| 1778 | x = PyInt_FromLong(CL_IMAGE_WIDTH);
|
|---|
| 1779 | if (x == NULL || PyDict_SetItemString(d, "IMAGE_WIDTH", x) < 0)
|
|---|
| 1780 | return;
|
|---|
| 1781 | Py_DECREF(x);
|
|---|
| 1782 | #endif
|
|---|
| 1783 | #ifdef CL_IMPACT_CODEC_CONTROL
|
|---|
| 1784 | x = PyInt_FromLong(CL_IMPACT_CODEC_CONTROL);
|
|---|
| 1785 | if (x == NULL || PyDict_SetItemString(d, "IMPACT_CODEC_CONTROL", x) < 0)
|
|---|
| 1786 | return;
|
|---|
| 1787 | Py_DECREF(x);
|
|---|
| 1788 | #endif
|
|---|
| 1789 | #ifdef CL_IMPACT_FRAME_INTERLEAVE
|
|---|
| 1790 | x = PyInt_FromLong(CL_IMPACT_FRAME_INTERLEAVE);
|
|---|
| 1791 | if (x == NULL || PyDict_SetItemString(d, "IMPACT_FRAME_INTERLEAVE", x) < 0)
|
|---|
| 1792 | return;
|
|---|
| 1793 | Py_DECREF(x);
|
|---|
| 1794 | #endif
|
|---|
| 1795 | #ifdef CL_IMPACT_NUM_PARAMS
|
|---|
| 1796 | x = PyInt_FromLong(CL_IMPACT_NUM_PARAMS);
|
|---|
| 1797 | if (x == NULL || PyDict_SetItemString(d, "IMPACT_NUM_PARAMS", x) < 0)
|
|---|
| 1798 | return;
|
|---|
| 1799 | Py_DECREF(x);
|
|---|
| 1800 | #endif
|
|---|
| 1801 | #ifdef CL_INTERNAL_FORMAT
|
|---|
| 1802 | x = PyInt_FromLong(CL_INTERNAL_FORMAT);
|
|---|
| 1803 | if (x == NULL || PyDict_SetItemString(d, "INTERNAL_FORMAT", x) < 0)
|
|---|
| 1804 | return;
|
|---|
| 1805 | Py_DECREF(x);
|
|---|
| 1806 | #endif
|
|---|
| 1807 | #ifdef CL_INTERNAL_IMAGE_HEIGHT
|
|---|
| 1808 | x = PyInt_FromLong(CL_INTERNAL_IMAGE_HEIGHT);
|
|---|
| 1809 | if (x == NULL || PyDict_SetItemString(d, "INTERNAL_IMAGE_HEIGHT", x) < 0)
|
|---|
| 1810 | return;
|
|---|
| 1811 | Py_DECREF(x);
|
|---|
| 1812 | #endif
|
|---|
| 1813 | #ifdef CL_INTERNAL_IMAGE_WIDTH
|
|---|
| 1814 | x = PyInt_FromLong(CL_INTERNAL_IMAGE_WIDTH);
|
|---|
| 1815 | if (x == NULL || PyDict_SetItemString(d, "INTERNAL_IMAGE_WIDTH", x) < 0)
|
|---|
| 1816 | return;
|
|---|
| 1817 | Py_DECREF(x);
|
|---|
| 1818 | #endif
|
|---|
| 1819 | #ifdef CL_INTRA
|
|---|
| 1820 | x = PyInt_FromLong(CL_INTRA);
|
|---|
| 1821 | if (x == NULL || PyDict_SetItemString(d, "INTRA", x) < 0)
|
|---|
| 1822 | return;
|
|---|
| 1823 | Py_DECREF(x);
|
|---|
| 1824 | #endif
|
|---|
| 1825 | #ifdef CL_JPEG
|
|---|
| 1826 | x = PyInt_FromLong(CL_JPEG);
|
|---|
| 1827 | if (x == NULL || PyDict_SetItemString(d, "JPEG", x) < 0)
|
|---|
| 1828 | return;
|
|---|
| 1829 | Py_DECREF(x);
|
|---|
| 1830 | #endif
|
|---|
| 1831 | #ifdef CL_JPEG_COSMO
|
|---|
| 1832 | x = PyInt_FromLong(CL_JPEG_COSMO);
|
|---|
| 1833 | if (x == NULL || PyDict_SetItemString(d, "JPEG_COSMO", x) < 0)
|
|---|
| 1834 | return;
|
|---|
| 1835 | Py_DECREF(x);
|
|---|
| 1836 | #endif
|
|---|
| 1837 | #ifdef CL_JPEG_ERROR
|
|---|
| 1838 | x = PyInt_FromLong(CL_JPEG_ERROR);
|
|---|
| 1839 | if (x == NULL || PyDict_SetItemString(d, "JPEG_ERROR", x) < 0)
|
|---|
| 1840 | return;
|
|---|
| 1841 | Py_DECREF(x);
|
|---|
| 1842 | #endif
|
|---|
| 1843 | #ifdef CL_JPEG_IMPACT
|
|---|
| 1844 | x = PyInt_FromLong(CL_JPEG_IMPACT);
|
|---|
| 1845 | if (x == NULL || PyDict_SetItemString(d, "JPEG_IMPACT", x) < 0)
|
|---|
| 1846 | return;
|
|---|
| 1847 | Py_DECREF(x);
|
|---|
| 1848 | #endif
|
|---|
| 1849 | #ifdef CL_JPEG_NUM_PARAMS
|
|---|
| 1850 | x = PyInt_FromLong(CL_JPEG_NUM_PARAMS);
|
|---|
| 1851 | if (x == NULL || PyDict_SetItemString(d, "JPEG_NUM_PARAMS", x) < 0)
|
|---|
| 1852 | return;
|
|---|
| 1853 | Py_DECREF(x);
|
|---|
| 1854 | #endif
|
|---|
| 1855 | #ifdef CL_JPEG_QUALITY_FACTOR
|
|---|
| 1856 | x = PyInt_FromLong(CL_JPEG_QUALITY_FACTOR);
|
|---|
| 1857 | if (x == NULL || PyDict_SetItemString(d, "JPEG_QUALITY_FACTOR", x) < 0)
|
|---|
| 1858 | return;
|
|---|
| 1859 | Py_DECREF(x);
|
|---|
| 1860 | #endif
|
|---|
| 1861 | #ifdef CL_JPEG_QUANTIZATION_TABLES
|
|---|
| 1862 | x = PyInt_FromLong(CL_JPEG_QUANTIZATION_TABLES);
|
|---|
| 1863 | if (x == NULL || PyDict_SetItemString(d, "JPEG_QUANTIZATION_TABLES", x) < 0)
|
|---|
| 1864 | return;
|
|---|
| 1865 | Py_DECREF(x);
|
|---|
| 1866 | #endif
|
|---|
| 1867 | #ifdef CL_JPEG_SOFTWARE
|
|---|
| 1868 | x = PyInt_FromLong(CL_JPEG_SOFTWARE);
|
|---|
| 1869 | if (x == NULL || PyDict_SetItemString(d, "JPEG_SOFTWARE", x) < 0)
|
|---|
| 1870 | return;
|
|---|
| 1871 | Py_DECREF(x);
|
|---|
| 1872 | #endif
|
|---|
| 1873 | #ifdef CL_JPEG_STREAM_HEADERS
|
|---|
| 1874 | x = PyInt_FromLong(CL_JPEG_STREAM_HEADERS);
|
|---|
| 1875 | if (x == NULL || PyDict_SetItemString(d, "JPEG_STREAM_HEADERS", x) < 0)
|
|---|
| 1876 | return;
|
|---|
| 1877 | Py_DECREF(x);
|
|---|
| 1878 | #endif
|
|---|
| 1879 | #ifdef CL_KEYFRAME
|
|---|
| 1880 | x = PyInt_FromLong(CL_KEYFRAME);
|
|---|
| 1881 | if (x == NULL || PyDict_SetItemString(d, "KEYFRAME", x) < 0)
|
|---|
| 1882 | return;
|
|---|
| 1883 | Py_DECREF(x);
|
|---|
| 1884 | #endif
|
|---|
| 1885 | #ifdef CL_KEYFRAME_DISTANCE
|
|---|
| 1886 | x = PyInt_FromLong(CL_KEYFRAME_DISTANCE);
|
|---|
| 1887 | if (x == NULL || PyDict_SetItemString(d, "KEYFRAME_DISTANCE", x) < 0)
|
|---|
| 1888 | return;
|
|---|
| 1889 | Py_DECREF(x);
|
|---|
| 1890 | #endif
|
|---|
| 1891 | #ifdef CL_LAST_FRAME_INDEX
|
|---|
| 1892 | x = PyInt_FromLong(CL_LAST_FRAME_INDEX);
|
|---|
| 1893 | if (x == NULL || PyDict_SetItemString(d, "LAST_FRAME_INDEX", x) < 0)
|
|---|
| 1894 | return;
|
|---|
| 1895 | Py_DECREF(x);
|
|---|
| 1896 | #endif
|
|---|
| 1897 | #ifdef CL_LAYER
|
|---|
| 1898 | x = PyInt_FromLong(CL_LAYER);
|
|---|
| 1899 | if (x == NULL || PyDict_SetItemString(d, "LAYER", x) < 0)
|
|---|
| 1900 | return;
|
|---|
| 1901 | Py_DECREF(x);
|
|---|
| 1902 | #endif
|
|---|
| 1903 | #ifdef CL_LUMA_THRESHOLD
|
|---|
| 1904 | x = PyInt_FromLong(CL_LUMA_THRESHOLD);
|
|---|
| 1905 | if (x == NULL || PyDict_SetItemString(d, "LUMA_THRESHOLD", x) < 0)
|
|---|
| 1906 | return;
|
|---|
| 1907 | Py_DECREF(x);
|
|---|
| 1908 | #endif
|
|---|
| 1909 | #ifdef CL_MAX_NUMBER_OF_AUDIO_ALGORITHMS
|
|---|
| 1910 | x = PyInt_FromLong(CL_MAX_NUMBER_OF_AUDIO_ALGORITHMS);
|
|---|
| 1911 | if (x == NULL || PyDict_SetItemString(d, "MAX_NUMBER_OF_AUDIO_ALGORITHMS", x) < 0)
|
|---|
| 1912 | return;
|
|---|
| 1913 | Py_DECREF(x);
|
|---|
| 1914 | #endif
|
|---|
| 1915 | #ifdef CL_MAX_NUMBER_OF_FORMATS
|
|---|
| 1916 | x = PyInt_FromLong(CL_MAX_NUMBER_OF_FORMATS);
|
|---|
| 1917 | if (x == NULL || PyDict_SetItemString(d, "MAX_NUMBER_OF_FORMATS", x) < 0)
|
|---|
| 1918 | return;
|
|---|
| 1919 | Py_DECREF(x);
|
|---|
| 1920 | #endif
|
|---|
| 1921 | #ifdef CL_MAX_NUMBER_OF_ORIGINAL_FORMATS
|
|---|
| 1922 | x = PyInt_FromLong(CL_MAX_NUMBER_OF_ORIGINAL_FORMATS);
|
|---|
| 1923 | if (x == NULL || PyDict_SetItemString(d, "MAX_NUMBER_OF_ORIGINAL_FORMATS", x) < 0)
|
|---|
| 1924 | return;
|
|---|
| 1925 | Py_DECREF(x);
|
|---|
| 1926 | #endif
|
|---|
| 1927 | #ifdef CL_MAX_NUMBER_OF_PARAMS
|
|---|
| 1928 | x = PyInt_FromLong(CL_MAX_NUMBER_OF_PARAMS);
|
|---|
| 1929 | if (x == NULL || PyDict_SetItemString(d, "MAX_NUMBER_OF_PARAMS", x) < 0)
|
|---|
| 1930 | return;
|
|---|
| 1931 | Py_DECREF(x);
|
|---|
| 1932 | #endif
|
|---|
| 1933 | #ifdef CL_MAX_NUMBER_OF_VIDEO_ALGORITHMS
|
|---|
| 1934 | x = PyInt_FromLong(CL_MAX_NUMBER_OF_VIDEO_ALGORITHMS);
|
|---|
| 1935 | if (x == NULL || PyDict_SetItemString(d, "MAX_NUMBER_OF_VIDEO_ALGORITHMS", x) < 0)
|
|---|
| 1936 | return;
|
|---|
| 1937 | Py_DECREF(x);
|
|---|
| 1938 | #endif
|
|---|
| 1939 | #ifdef CL_MONO
|
|---|
| 1940 | x = PyInt_FromLong(CL_MONO);
|
|---|
| 1941 | if (x == NULL || PyDict_SetItemString(d, "MONO", x) < 0)
|
|---|
| 1942 | return;
|
|---|
| 1943 | Py_DECREF(x);
|
|---|
| 1944 | #endif
|
|---|
| 1945 | #ifdef CL_MPEG1_AUDIO_AWARE
|
|---|
| 1946 | x = PyInt_FromLong(CL_MPEG1_AUDIO_AWARE);
|
|---|
| 1947 | if (x == NULL || PyDict_SetItemString(d, "MPEG1_AUDIO_AWARE", x) < 0)
|
|---|
| 1948 | return;
|
|---|
| 1949 | Py_DECREF(x);
|
|---|
| 1950 | #endif
|
|---|
| 1951 | #ifdef CL_MPEG1_AUDIO_LAYER
|
|---|
| 1952 | x = PyInt_FromLong(CL_MPEG1_AUDIO_LAYER);
|
|---|
| 1953 | if (x == NULL || PyDict_SetItemString(d, "MPEG1_AUDIO_LAYER", x) < 0)
|
|---|
| 1954 | return;
|
|---|
| 1955 | Py_DECREF(x);
|
|---|
| 1956 | #endif
|
|---|
| 1957 | #ifdef CL_MPEG1_AUDIO_LAYER_I
|
|---|
| 1958 | x = PyInt_FromLong(CL_MPEG1_AUDIO_LAYER_I);
|
|---|
| 1959 | if (x == NULL || PyDict_SetItemString(d, "MPEG1_AUDIO_LAYER_I", x) < 0)
|
|---|
| 1960 | return;
|
|---|
| 1961 | Py_DECREF(x);
|
|---|
| 1962 | #endif
|
|---|
| 1963 | #ifdef CL_MPEG1_AUDIO_LAYER_II
|
|---|
| 1964 | x = PyInt_FromLong(CL_MPEG1_AUDIO_LAYER_II);
|
|---|
| 1965 | if (x == NULL || PyDict_SetItemString(d, "MPEG1_AUDIO_LAYER_II", x) < 0)
|
|---|
| 1966 | return;
|
|---|
| 1967 | Py_DECREF(x);
|
|---|
| 1968 | #endif
|
|---|
| 1969 | #ifdef CL_MPEG1_AUDIO_MODE
|
|---|
| 1970 | x = PyInt_FromLong(CL_MPEG1_AUDIO_MODE);
|
|---|
| 1971 | if (x == NULL || PyDict_SetItemString(d, "MPEG1_AUDIO_MODE", x) < 0)
|
|---|
| 1972 | return;
|
|---|
| 1973 | Py_DECREF(x);
|
|---|
| 1974 | #endif
|
|---|
| 1975 | #ifdef CL_MPEG1_AUDIO_MODE_DUAL
|
|---|
| 1976 | x = PyInt_FromLong(CL_MPEG1_AUDIO_MODE_DUAL);
|
|---|
| 1977 | if (x == NULL || PyDict_SetItemString(d, "MPEG1_AUDIO_MODE_DUAL", x) < 0)
|
|---|
| 1978 | return;
|
|---|
| 1979 | Py_DECREF(x);
|
|---|
| 1980 | #endif
|
|---|
| 1981 | #ifdef CL_MPEG1_AUDIO_MODE_JOINT
|
|---|
| 1982 | x = PyInt_FromLong(CL_MPEG1_AUDIO_MODE_JOINT);
|
|---|
| 1983 | if (x == NULL || PyDict_SetItemString(d, "MPEG1_AUDIO_MODE_JOINT", x) < 0)
|
|---|
| 1984 | return;
|
|---|
| 1985 | Py_DECREF(x);
|
|---|
| 1986 | #endif
|
|---|
| 1987 | #ifdef CL_MPEG1_AUDIO_MODE_SINGLE
|
|---|
| 1988 | x = PyInt_FromLong(CL_MPEG1_AUDIO_MODE_SINGLE);
|
|---|
| 1989 | if (x == NULL || PyDict_SetItemString(d, "MPEG1_AUDIO_MODE_SINGLE", x) < 0)
|
|---|
| 1990 | return;
|
|---|
| 1991 | Py_DECREF(x);
|
|---|
| 1992 | #endif
|
|---|
| 1993 | #ifdef CL_MPEG1_AUDIO_MODE_STEREO
|
|---|
| 1994 | x = PyInt_FromLong(CL_MPEG1_AUDIO_MODE_STEREO);
|
|---|
| 1995 | if (x == NULL || PyDict_SetItemString(d, "MPEG1_AUDIO_MODE_STEREO", x) < 0)
|
|---|
| 1996 | return;
|
|---|
| 1997 | Py_DECREF(x);
|
|---|
| 1998 | #endif
|
|---|
| 1999 | #ifdef CL_MPEG1_AUDIO_SOFTWARE
|
|---|
| 2000 | x = PyInt_FromLong(CL_MPEG1_AUDIO_SOFTWARE);
|
|---|
| 2001 | if (x == NULL || PyDict_SetItemString(d, "MPEG1_AUDIO_SOFTWARE", x) < 0)
|
|---|
| 2002 | return;
|
|---|
| 2003 | Py_DECREF(x);
|
|---|
| 2004 | #endif
|
|---|
| 2005 | #ifdef CL_MPEG1_END_OF_STREAM
|
|---|
| 2006 | x = PyInt_FromLong(CL_MPEG1_END_OF_STREAM);
|
|---|
| 2007 | if (x == NULL || PyDict_SetItemString(d, "MPEG1_END_OF_STREAM", x) < 0)
|
|---|
| 2008 | return;
|
|---|
| 2009 | Py_DECREF(x);
|
|---|
| 2010 | #endif
|
|---|
| 2011 | #ifdef CL_MPEG1_ERROR
|
|---|
| 2012 | x = PyInt_FromLong(CL_MPEG1_ERROR);
|
|---|
| 2013 | if (x == NULL || PyDict_SetItemString(d, "MPEG1_ERROR", x) < 0)
|
|---|
| 2014 | return;
|
|---|
| 2015 | Py_DECREF(x);
|
|---|
| 2016 | #endif
|
|---|
| 2017 | #ifdef CL_MPEG1_NUM_PARAMS
|
|---|
| 2018 | x = PyInt_FromLong(CL_MPEG1_NUM_PARAMS);
|
|---|
| 2019 | if (x == NULL || PyDict_SetItemString(d, "MPEG1_NUM_PARAMS", x) < 0)
|
|---|
| 2020 | return;
|
|---|
| 2021 | Py_DECREF(x);
|
|---|
| 2022 | #endif
|
|---|
| 2023 | #ifdef CL_MPEG1_VIDEO_M
|
|---|
| 2024 | x = PyInt_FromLong(CL_MPEG1_VIDEO_M);
|
|---|
| 2025 | if (x == NULL || PyDict_SetItemString(d, "MPEG1_VIDEO_M", x) < 0)
|
|---|
| 2026 | return;
|
|---|
| 2027 | Py_DECREF(x);
|
|---|
| 2028 | #endif
|
|---|
| 2029 | #ifdef CL_MPEG1_VIDEO_MAX_MOTION_VECTOR_LENGTH_B_X
|
|---|
| 2030 | x = PyInt_FromLong(CL_MPEG1_VIDEO_MAX_MOTION_VECTOR_LENGTH_B_X);
|
|---|
| 2031 | if (x == NULL || PyDict_SetItemString(d, "MPEG1_VIDEO_MAX_MOTION_VECTOR_LENGTH_B_X", x) < 0)
|
|---|
| 2032 | return;
|
|---|
| 2033 | Py_DECREF(x);
|
|---|
| 2034 | #endif
|
|---|
| 2035 | #ifdef CL_MPEG1_VIDEO_MAX_MOTION_VECTOR_LENGTH_B_Y
|
|---|
| 2036 | x = PyInt_FromLong(CL_MPEG1_VIDEO_MAX_MOTION_VECTOR_LENGTH_B_Y);
|
|---|
| 2037 | if (x == NULL || PyDict_SetItemString(d, "MPEG1_VIDEO_MAX_MOTION_VECTOR_LENGTH_B_Y", x) < 0)
|
|---|
| 2038 | return;
|
|---|
| 2039 | Py_DECREF(x);
|
|---|
| 2040 | #endif
|
|---|
| 2041 | #ifdef CL_MPEG1_VIDEO_MAX_MOTION_VECTOR_LENGTH_P_X
|
|---|
| 2042 | x = PyInt_FromLong(CL_MPEG1_VIDEO_MAX_MOTION_VECTOR_LENGTH_P_X);
|
|---|
| 2043 | if (x == NULL || PyDict_SetItemString(d, "MPEG1_VIDEO_MAX_MOTION_VECTOR_LENGTH_P_X", x) < 0)
|
|---|
| 2044 | return;
|
|---|
| 2045 | Py_DECREF(x);
|
|---|
| 2046 | #endif
|
|---|
| 2047 | #ifdef CL_MPEG1_VIDEO_MAX_MOTION_VECTOR_LENGTH_P_Y
|
|---|
| 2048 | x = PyInt_FromLong(CL_MPEG1_VIDEO_MAX_MOTION_VECTOR_LENGTH_P_Y);
|
|---|
| 2049 | if (x == NULL || PyDict_SetItemString(d, "MPEG1_VIDEO_MAX_MOTION_VECTOR_LENGTH_P_Y", x) < 0)
|
|---|
| 2050 | return;
|
|---|
| 2051 | Py_DECREF(x);
|
|---|
| 2052 | #endif
|
|---|
| 2053 | #ifdef CL_MPEG1_VIDEO_N
|
|---|
| 2054 | x = PyInt_FromLong(CL_MPEG1_VIDEO_N);
|
|---|
| 2055 | if (x == NULL || PyDict_SetItemString(d, "MPEG1_VIDEO_N", x) < 0)
|
|---|
| 2056 | return;
|
|---|
| 2057 | Py_DECREF(x);
|
|---|
| 2058 | #endif
|
|---|
| 2059 | #ifdef CL_MPEG1_VIDEO_SOFTNESS
|
|---|
| 2060 | x = PyInt_FromLong(CL_MPEG1_VIDEO_SOFTNESS);
|
|---|
| 2061 | if (x == NULL || PyDict_SetItemString(d, "MPEG1_VIDEO_SOFTNESS", x) < 0)
|
|---|
| 2062 | return;
|
|---|
| 2063 | Py_DECREF(x);
|
|---|
| 2064 | #endif
|
|---|
| 2065 | #ifdef CL_MPEG1_VIDEO_SOFTNESS_MAXIMUM
|
|---|
| 2066 | x = PyInt_FromLong(CL_MPEG1_VIDEO_SOFTNESS_MAXIMUM);
|
|---|
| 2067 | if (x == NULL || PyDict_SetItemString(d, "MPEG1_VIDEO_SOFTNESS_MAXIMUM", x) < 0)
|
|---|
| 2068 | return;
|
|---|
| 2069 | Py_DECREF(x);
|
|---|
| 2070 | #endif
|
|---|
| 2071 | #ifdef CL_MPEG1_VIDEO_SOFTNESS_MEDIUM
|
|---|
| 2072 | x = PyInt_FromLong(CL_MPEG1_VIDEO_SOFTNESS_MEDIUM);
|
|---|
| 2073 | if (x == NULL || PyDict_SetItemString(d, "MPEG1_VIDEO_SOFTNESS_MEDIUM", x) < 0)
|
|---|
| 2074 | return;
|
|---|
| 2075 | Py_DECREF(x);
|
|---|
| 2076 | #endif
|
|---|
| 2077 | #ifdef CL_MPEG1_VIDEO_SOFTNESS_NONE
|
|---|
| 2078 | x = PyInt_FromLong(CL_MPEG1_VIDEO_SOFTNESS_NONE);
|
|---|
| 2079 | if (x == NULL || PyDict_SetItemString(d, "MPEG1_VIDEO_SOFTNESS_NONE", x) < 0)
|
|---|
| 2080 | return;
|
|---|
| 2081 | Py_DECREF(x);
|
|---|
| 2082 | #endif
|
|---|
| 2083 | #ifdef CL_MPEG1_VIDEO_SOFTWARE
|
|---|
| 2084 | x = PyInt_FromLong(CL_MPEG1_VIDEO_SOFTWARE);
|
|---|
| 2085 | if (x == NULL || PyDict_SetItemString(d, "MPEG1_VIDEO_SOFTWARE", x) < 0)
|
|---|
| 2086 | return;
|
|---|
| 2087 | Py_DECREF(x);
|
|---|
| 2088 | #endif
|
|---|
| 2089 | #ifdef CL_MPEG_VIDEO
|
|---|
| 2090 | x = PyInt_FromLong(CL_MPEG_VIDEO);
|
|---|
| 2091 | if (x == NULL || PyDict_SetItemString(d, "MPEG_VIDEO", x) < 0)
|
|---|
| 2092 | return;
|
|---|
| 2093 | Py_DECREF(x);
|
|---|
| 2094 | #endif
|
|---|
| 2095 | #ifdef CL_MULTIRATE_AWARE
|
|---|
| 2096 | x = PyInt_FromLong(CL_MULTIRATE_AWARE);
|
|---|
| 2097 | if (x == NULL || PyDict_SetItemString(d, "MULTIRATE_AWARE", x) < 0)
|
|---|
| 2098 | return;
|
|---|
| 2099 | Py_DECREF(x);
|
|---|
| 2100 | #endif
|
|---|
| 2101 | #ifdef CL_MVC1
|
|---|
| 2102 | x = PyInt_FromLong(CL_MVC1);
|
|---|
| 2103 | if (x == NULL || PyDict_SetItemString(d, "MVC1", x) < 0)
|
|---|
| 2104 | return;
|
|---|
| 2105 | Py_DECREF(x);
|
|---|
| 2106 | #endif
|
|---|
| 2107 | #ifdef CL_MVC1_SOFTWARE
|
|---|
| 2108 | x = PyInt_FromLong(CL_MVC1_SOFTWARE);
|
|---|
| 2109 | if (x == NULL || PyDict_SetItemString(d, "MVC1_SOFTWARE", x) < 0)
|
|---|
| 2110 | return;
|
|---|
| 2111 | Py_DECREF(x);
|
|---|
| 2112 | #endif
|
|---|
| 2113 | #ifdef CL_MVC2
|
|---|
| 2114 | x = PyInt_FromLong(CL_MVC2);
|
|---|
| 2115 | if (x == NULL || PyDict_SetItemString(d, "MVC2", x) < 0)
|
|---|
| 2116 | return;
|
|---|
| 2117 | Py_DECREF(x);
|
|---|
| 2118 | #endif
|
|---|
| 2119 | #ifdef CL_MVC2_BLENDING
|
|---|
| 2120 | x = PyInt_FromLong(CL_MVC2_BLENDING);
|
|---|
| 2121 | if (x == NULL || PyDict_SetItemString(d, "MVC2_BLENDING", x) < 0)
|
|---|
| 2122 | return;
|
|---|
| 2123 | Py_DECREF(x);
|
|---|
| 2124 | #endif
|
|---|
| 2125 | #ifdef CL_MVC2_BLENDING_OFF
|
|---|
| 2126 | x = PyInt_FromLong(CL_MVC2_BLENDING_OFF);
|
|---|
| 2127 | if (x == NULL || PyDict_SetItemString(d, "MVC2_BLENDING_OFF", x) < 0)
|
|---|
| 2128 | return;
|
|---|
| 2129 | Py_DECREF(x);
|
|---|
| 2130 | #endif
|
|---|
| 2131 | #ifdef CL_MVC2_BLENDING_ON
|
|---|
| 2132 | x = PyInt_FromLong(CL_MVC2_BLENDING_ON);
|
|---|
| 2133 | if (x == NULL || PyDict_SetItemString(d, "MVC2_BLENDING_ON", x) < 0)
|
|---|
| 2134 | return;
|
|---|
| 2135 | Py_DECREF(x);
|
|---|
| 2136 | #endif
|
|---|
| 2137 | #ifdef CL_MVC2_CHROMA_THRESHOLD
|
|---|
| 2138 | x = PyInt_FromLong(CL_MVC2_CHROMA_THRESHOLD);
|
|---|
| 2139 | if (x == NULL || PyDict_SetItemString(d, "MVC2_CHROMA_THRESHOLD", x) < 0)
|
|---|
| 2140 | return;
|
|---|
| 2141 | Py_DECREF(x);
|
|---|
| 2142 | #endif
|
|---|
| 2143 | #ifdef CL_MVC2_EDGE_THRESHOLD
|
|---|
| 2144 | x = PyInt_FromLong(CL_MVC2_EDGE_THRESHOLD);
|
|---|
| 2145 | if (x == NULL || PyDict_SetItemString(d, "MVC2_EDGE_THRESHOLD", x) < 0)
|
|---|
| 2146 | return;
|
|---|
| 2147 | Py_DECREF(x);
|
|---|
| 2148 | #endif
|
|---|
| 2149 | #ifdef CL_MVC2_ERROR
|
|---|
| 2150 | x = PyInt_FromLong(CL_MVC2_ERROR);
|
|---|
| 2151 | if (x == NULL || PyDict_SetItemString(d, "MVC2_ERROR", x) < 0)
|
|---|
| 2152 | return;
|
|---|
| 2153 | Py_DECREF(x);
|
|---|
| 2154 | #endif
|
|---|
| 2155 | #ifdef CL_MVC2_LUMA_THRESHOLD
|
|---|
| 2156 | x = PyInt_FromLong(CL_MVC2_LUMA_THRESHOLD);
|
|---|
| 2157 | if (x == NULL || PyDict_SetItemString(d, "MVC2_LUMA_THRESHOLD", x) < 0)
|
|---|
| 2158 | return;
|
|---|
| 2159 | Py_DECREF(x);
|
|---|
| 2160 | #endif
|
|---|
| 2161 | #ifdef CL_MVC2_SOFTWARE
|
|---|
| 2162 | x = PyInt_FromLong(CL_MVC2_SOFTWARE);
|
|---|
| 2163 | if (x == NULL || PyDict_SetItemString(d, "MVC2_SOFTWARE", x) < 0)
|
|---|
| 2164 | return;
|
|---|
| 2165 | Py_DECREF(x);
|
|---|
| 2166 | #endif
|
|---|
| 2167 | #ifdef CL_MVC3_QUALITY_LEVEL
|
|---|
| 2168 | x = PyInt_FromLong(CL_MVC3_QUALITY_LEVEL);
|
|---|
| 2169 | if (x == NULL || PyDict_SetItemString(d, "MVC3_QUALITY_LEVEL", x) < 0)
|
|---|
| 2170 | return;
|
|---|
| 2171 | Py_DECREF(x);
|
|---|
| 2172 | #endif
|
|---|
| 2173 | #ifdef CL_MVC3_SOFTWARE
|
|---|
| 2174 | x = PyInt_FromLong(CL_MVC3_SOFTWARE);
|
|---|
| 2175 | if (x == NULL || PyDict_SetItemString(d, "MVC3_SOFTWARE", x) < 0)
|
|---|
| 2176 | return;
|
|---|
| 2177 | Py_DECREF(x);
|
|---|
| 2178 | #endif
|
|---|
| 2179 | #ifdef CL_NEXT_NOT_AVAILABLE
|
|---|
| 2180 | x = PyInt_FromLong(CL_NEXT_NOT_AVAILABLE);
|
|---|
| 2181 | if (x == NULL || PyDict_SetItemString(d, "NEXT_NOT_AVAILABLE", x) < 0)
|
|---|
| 2182 | return;
|
|---|
| 2183 | Py_DECREF(x);
|
|---|
| 2184 | #endif
|
|---|
| 2185 | #ifdef CL_NOISE_MARGIN
|
|---|
| 2186 | x = PyInt_FromLong(CL_NOISE_MARGIN);
|
|---|
| 2187 | if (x == NULL || PyDict_SetItemString(d, "NOISE_MARGIN", x) < 0)
|
|---|
| 2188 | return;
|
|---|
| 2189 | Py_DECREF(x);
|
|---|
| 2190 | #endif
|
|---|
| 2191 | #ifdef CL_NONE
|
|---|
| 2192 | x = PyInt_FromLong(CL_NONE);
|
|---|
| 2193 | if (x == NULL || PyDict_SetItemString(d, "NONE", x) < 0)
|
|---|
| 2194 | return;
|
|---|
| 2195 | Py_DECREF(x);
|
|---|
| 2196 | #endif
|
|---|
| 2197 | #ifdef CL_NUMBER_OF_FORMATS
|
|---|
| 2198 | x = PyInt_FromLong(CL_NUMBER_OF_FORMATS);
|
|---|
| 2199 | if (x == NULL || PyDict_SetItemString(d, "NUMBER_OF_FORMATS", x) < 0)
|
|---|
| 2200 | return;
|
|---|
| 2201 | Py_DECREF(x);
|
|---|
| 2202 | #endif
|
|---|
| 2203 | #ifdef CL_NUMBER_OF_FRAMES
|
|---|
| 2204 | x = PyInt_FromLong(CL_NUMBER_OF_FRAMES);
|
|---|
| 2205 | if (x == NULL || PyDict_SetItemString(d, "NUMBER_OF_FRAMES", x) < 0)
|
|---|
| 2206 | return;
|
|---|
| 2207 | Py_DECREF(x);
|
|---|
| 2208 | #endif
|
|---|
| 2209 | #ifdef CL_NUMBER_OF_PARAMS
|
|---|
| 2210 | x = PyInt_FromLong(CL_NUMBER_OF_PARAMS);
|
|---|
| 2211 | if (x == NULL || PyDict_SetItemString(d, "NUMBER_OF_PARAMS", x) < 0)
|
|---|
| 2212 | return;
|
|---|
| 2213 | Py_DECREF(x);
|
|---|
| 2214 | #endif
|
|---|
| 2215 | #ifdef CL_NUMBER_OF_PARAMS_FREEZE
|
|---|
| 2216 | x = PyInt_FromLong(CL_NUMBER_OF_PARAMS_FREEZE);
|
|---|
| 2217 | if (x == NULL || PyDict_SetItemString(d, "NUMBER_OF_PARAMS_FREEZE", x) < 0)
|
|---|
| 2218 | return;
|
|---|
| 2219 | Py_DECREF(x);
|
|---|
| 2220 | #endif
|
|---|
| 2221 | #ifdef CL_NUMBER_OF_VIDEO_FORMATS
|
|---|
| 2222 | x = PyInt_FromLong(CL_NUMBER_OF_VIDEO_FORMATS);
|
|---|
| 2223 | if (x == NULL || PyDict_SetItemString(d, "NUMBER_OF_VIDEO_FORMATS", x) < 0)
|
|---|
| 2224 | return;
|
|---|
| 2225 | Py_DECREF(x);
|
|---|
| 2226 | #endif
|
|---|
| 2227 | #ifdef CL_ORIENTATION
|
|---|
| 2228 | x = PyInt_FromLong(CL_ORIENTATION);
|
|---|
| 2229 | if (x == NULL || PyDict_SetItemString(d, "ORIENTATION", x) < 0)
|
|---|
| 2230 | return;
|
|---|
| 2231 | Py_DECREF(x);
|
|---|
| 2232 | #endif
|
|---|
| 2233 | #ifdef CL_ORIGINAL_FORMAT
|
|---|
| 2234 | x = PyInt_FromLong(CL_ORIGINAL_FORMAT);
|
|---|
| 2235 | if (x == NULL || PyDict_SetItemString(d, "ORIGINAL_FORMAT", x) < 0)
|
|---|
| 2236 | return;
|
|---|
| 2237 | Py_DECREF(x);
|
|---|
| 2238 | #endif
|
|---|
| 2239 | #ifdef CL_PARAM_OUT_OF_RANGE
|
|---|
| 2240 | x = PyInt_FromLong(CL_PARAM_OUT_OF_RANGE);
|
|---|
| 2241 | if (x == NULL || PyDict_SetItemString(d, "PARAM_OUT_OF_RANGE", x) < 0)
|
|---|
| 2242 | return;
|
|---|
| 2243 | Py_DECREF(x);
|
|---|
| 2244 | #endif
|
|---|
| 2245 | #ifdef CL_PIXEL_ASPECT
|
|---|
| 2246 | x = PyInt_FromLong(CL_PIXEL_ASPECT);
|
|---|
| 2247 | if (x == NULL || PyDict_SetItemString(d, "PIXEL_ASPECT", x) < 0)
|
|---|
| 2248 | return;
|
|---|
| 2249 | Py_DECREF(x);
|
|---|
| 2250 | #endif
|
|---|
| 2251 | #ifdef CL_PREDICTED
|
|---|
| 2252 | x = PyInt_FromLong(CL_PREDICTED);
|
|---|
| 2253 | if (x == NULL || PyDict_SetItemString(d, "PREDICTED", x) < 0)
|
|---|
| 2254 | return;
|
|---|
| 2255 | Py_DECREF(x);
|
|---|
| 2256 | #endif
|
|---|
| 2257 | #ifdef CL_PREROLL
|
|---|
| 2258 | x = PyInt_FromLong(CL_PREROLL);
|
|---|
| 2259 | if (x == NULL || PyDict_SetItemString(d, "PREROLL", x) < 0)
|
|---|
| 2260 | return;
|
|---|
| 2261 | Py_DECREF(x);
|
|---|
| 2262 | #endif
|
|---|
| 2263 | #ifdef CL_QUALITY_FACTOR
|
|---|
| 2264 | x = PyInt_FromLong(CL_QUALITY_FACTOR);
|
|---|
| 2265 | if (x == NULL || PyDict_SetItemString(d, "QUALITY_FACTOR", x) < 0)
|
|---|
| 2266 | return;
|
|---|
| 2267 | Py_DECREF(x);
|
|---|
| 2268 | #endif
|
|---|
| 2269 | #ifdef CL_QUALITY_LEVEL
|
|---|
| 2270 | x = PyInt_FromLong(CL_QUALITY_LEVEL);
|
|---|
| 2271 | if (x == NULL || PyDict_SetItemString(d, "QUALITY_LEVEL", x) < 0)
|
|---|
| 2272 | return;
|
|---|
| 2273 | Py_DECREF(x);
|
|---|
| 2274 | #endif
|
|---|
| 2275 | #ifdef CL_QUALITY_SPATIAL
|
|---|
| 2276 | x = PyInt_FromLong(CL_QUALITY_SPATIAL);
|
|---|
| 2277 | if (x == NULL || PyDict_SetItemString(d, "QUALITY_SPATIAL", x) < 0)
|
|---|
| 2278 | return;
|
|---|
| 2279 | Py_DECREF(x);
|
|---|
| 2280 | #endif
|
|---|
| 2281 | #ifdef CL_QUALITY_TEMPORAL
|
|---|
| 2282 | x = PyInt_FromLong(CL_QUALITY_TEMPORAL);
|
|---|
| 2283 | if (x == NULL || PyDict_SetItemString(d, "QUALITY_TEMPORAL", x) < 0)
|
|---|
| 2284 | return;
|
|---|
| 2285 | Py_DECREF(x);
|
|---|
| 2286 | #endif
|
|---|
| 2287 | #ifdef CL_QUANTIZATION_TABLES
|
|---|
| 2288 | x = PyInt_FromLong(CL_QUANTIZATION_TABLES);
|
|---|
| 2289 | if (x == NULL || PyDict_SetItemString(d, "QUANTIZATION_TABLES", x) < 0)
|
|---|
| 2290 | return;
|
|---|
| 2291 | Py_DECREF(x);
|
|---|
| 2292 | #endif
|
|---|
| 2293 | #ifdef CL_RANGE_VALUE
|
|---|
| 2294 | x = PyInt_FromLong(CL_RANGE_VALUE);
|
|---|
| 2295 | if (x == NULL || PyDict_SetItemString(d, "RANGE_VALUE", x) < 0)
|
|---|
| 2296 | return;
|
|---|
| 2297 | Py_DECREF(x);
|
|---|
| 2298 | #endif
|
|---|
| 2299 | #ifdef CL_RGB
|
|---|
| 2300 | x = PyInt_FromLong(CL_RGB);
|
|---|
| 2301 | if (x == NULL || PyDict_SetItemString(d, "RGB", x) < 0)
|
|---|
| 2302 | return;
|
|---|
| 2303 | Py_DECREF(x);
|
|---|
| 2304 | #endif
|
|---|
| 2305 | #ifdef CL_RGB332
|
|---|
| 2306 | x = PyInt_FromLong(CL_RGB332);
|
|---|
| 2307 | if (x == NULL || PyDict_SetItemString(d, "RGB332", x) < 0)
|
|---|
| 2308 | return;
|
|---|
| 2309 | Py_DECREF(x);
|
|---|
| 2310 | #endif
|
|---|
| 2311 | #ifdef CL_RGB8
|
|---|
| 2312 | x = PyInt_FromLong(CL_RGB8);
|
|---|
| 2313 | if (x == NULL || PyDict_SetItemString(d, "RGB8", x) < 0)
|
|---|
| 2314 | return;
|
|---|
| 2315 | Py_DECREF(x);
|
|---|
| 2316 | #endif
|
|---|
| 2317 | #ifdef CL_RGBA
|
|---|
| 2318 | x = PyInt_FromLong(CL_RGBA);
|
|---|
| 2319 | if (x == NULL || PyDict_SetItemString(d, "RGBA", x) < 0)
|
|---|
| 2320 | return;
|
|---|
| 2321 | Py_DECREF(x);
|
|---|
| 2322 | #endif
|
|---|
| 2323 | #ifdef CL_RGBX
|
|---|
| 2324 | x = PyInt_FromLong(CL_RGBX);
|
|---|
| 2325 | if (x == NULL || PyDict_SetItemString(d, "RGBX", x) < 0)
|
|---|
| 2326 | return;
|
|---|
| 2327 | Py_DECREF(x);
|
|---|
| 2328 | #endif
|
|---|
| 2329 | #ifdef CL_RLE
|
|---|
| 2330 | x = PyInt_FromLong(CL_RLE);
|
|---|
| 2331 | if (x == NULL || PyDict_SetItemString(d, "RLE", x) < 0)
|
|---|
| 2332 | return;
|
|---|
| 2333 | Py_DECREF(x);
|
|---|
| 2334 | #endif
|
|---|
| 2335 | #ifdef CL_RLE24
|
|---|
| 2336 | x = PyInt_FromLong(CL_RLE24);
|
|---|
| 2337 | if (x == NULL || PyDict_SetItemString(d, "RLE24", x) < 0)
|
|---|
| 2338 | return;
|
|---|
| 2339 | Py_DECREF(x);
|
|---|
| 2340 | #endif
|
|---|
| 2341 | #ifdef CL_RLE24_SOFTWARE
|
|---|
| 2342 | x = PyInt_FromLong(CL_RLE24_SOFTWARE);
|
|---|
| 2343 | if (x == NULL || PyDict_SetItemString(d, "RLE24_SOFTWARE", x) < 0)
|
|---|
| 2344 | return;
|
|---|
| 2345 | Py_DECREF(x);
|
|---|
| 2346 | #endif
|
|---|
| 2347 | #ifdef CL_RLE_SOFTWARE
|
|---|
| 2348 | x = PyInt_FromLong(CL_RLE_SOFTWARE);
|
|---|
| 2349 | if (x == NULL || PyDict_SetItemString(d, "RLE_SOFTWARE", x) < 0)
|
|---|
| 2350 | return;
|
|---|
| 2351 | Py_DECREF(x);
|
|---|
| 2352 | #endif
|
|---|
| 2353 | #ifdef CL_RTR
|
|---|
| 2354 | x = PyInt_FromLong(CL_RTR);
|
|---|
| 2355 | if (x == NULL || PyDict_SetItemString(d, "RTR", x) < 0)
|
|---|
| 2356 | return;
|
|---|
| 2357 | Py_DECREF(x);
|
|---|
| 2358 | #endif
|
|---|
| 2359 | #ifdef CL_RTR1
|
|---|
| 2360 | x = PyInt_FromLong(CL_RTR1);
|
|---|
| 2361 | if (x == NULL || PyDict_SetItemString(d, "RTR1", x) < 0)
|
|---|
| 2362 | return;
|
|---|
| 2363 | Py_DECREF(x);
|
|---|
| 2364 | #endif
|
|---|
| 2365 | #ifdef CL_RTR_QUALITY_LEVEL
|
|---|
| 2366 | x = PyInt_FromLong(CL_RTR_QUALITY_LEVEL);
|
|---|
| 2367 | if (x == NULL || PyDict_SetItemString(d, "RTR_QUALITY_LEVEL", x) < 0)
|
|---|
| 2368 | return;
|
|---|
| 2369 | Py_DECREF(x);
|
|---|
| 2370 | #endif
|
|---|
| 2371 | #ifdef CL_SAMPLES_PER_TILE
|
|---|
| 2372 | x = PyInt_FromLong(CL_SAMPLES_PER_TILE);
|
|---|
| 2373 | if (x == NULL || PyDict_SetItemString(d, "SAMPLES_PER_TILE", x) < 0)
|
|---|
| 2374 | return;
|
|---|
| 2375 | Py_DECREF(x);
|
|---|
| 2376 | #endif
|
|---|
| 2377 | #ifdef CL_SCHEME_BUSY
|
|---|
| 2378 | x = PyInt_FromLong(CL_SCHEME_BUSY);
|
|---|
| 2379 | if (x == NULL || PyDict_SetItemString(d, "SCHEME_BUSY", x) < 0)
|
|---|
| 2380 | return;
|
|---|
| 2381 | Py_DECREF(x);
|
|---|
| 2382 | #endif
|
|---|
| 2383 | #ifdef CL_SCHEME_NOT_AVAILABLE
|
|---|
| 2384 | x = PyInt_FromLong(CL_SCHEME_NOT_AVAILABLE);
|
|---|
| 2385 | if (x == NULL || PyDict_SetItemString(d, "SCHEME_NOT_AVAILABLE", x) < 0)
|
|---|
| 2386 | return;
|
|---|
| 2387 | Py_DECREF(x);
|
|---|
| 2388 | #endif
|
|---|
| 2389 | #ifdef CL_SPEED
|
|---|
| 2390 | x = PyInt_FromLong(CL_SPEED);
|
|---|
| 2391 | if (x == NULL || PyDict_SetItemString(d, "SPEED", x) < 0)
|
|---|
| 2392 | return;
|
|---|
| 2393 | Py_DECREF(x);
|
|---|
| 2394 | #endif
|
|---|
| 2395 | #ifdef CL_STEREO_INTERLEAVED
|
|---|
| 2396 | x = PyInt_FromLong(CL_STEREO_INTERLEAVED);
|
|---|
| 2397 | if (x == NULL || PyDict_SetItemString(d, "STEREO_INTERLEAVED", x) < 0)
|
|---|
| 2398 | return;
|
|---|
| 2399 | Py_DECREF(x);
|
|---|
| 2400 | #endif
|
|---|
| 2401 | #ifdef CL_STREAM_HEADERS
|
|---|
| 2402 | x = PyInt_FromLong(CL_STREAM_HEADERS);
|
|---|
| 2403 | if (x == NULL || PyDict_SetItemString(d, "STREAM_HEADERS", x) < 0)
|
|---|
| 2404 | return;
|
|---|
| 2405 | Py_DECREF(x);
|
|---|
| 2406 | #endif
|
|---|
| 2407 | #ifdef CL_TILE_THRESHOLD
|
|---|
| 2408 | x = PyInt_FromLong(CL_TILE_THRESHOLD);
|
|---|
| 2409 | if (x == NULL || PyDict_SetItemString(d, "TILE_THRESHOLD", x) < 0)
|
|---|
| 2410 | return;
|
|---|
| 2411 | Py_DECREF(x);
|
|---|
| 2412 | #endif
|
|---|
| 2413 | #ifdef CL_TOP_DOWN
|
|---|
| 2414 | x = PyInt_FromLong(CL_TOP_DOWN);
|
|---|
| 2415 | if (x == NULL || PyDict_SetItemString(d, "TOP_DOWN", x) < 0)
|
|---|
| 2416 | return;
|
|---|
| 2417 | Py_DECREF(x);
|
|---|
| 2418 | #endif
|
|---|
| 2419 | #ifdef CL_ULAW
|
|---|
| 2420 | x = PyInt_FromLong(CL_ULAW);
|
|---|
| 2421 | if (x == NULL || PyDict_SetItemString(d, "ULAW", x) < 0)
|
|---|
| 2422 | return;
|
|---|
| 2423 | Py_DECREF(x);
|
|---|
| 2424 | #endif
|
|---|
| 2425 | #ifdef CL_UNCOMPRESSED
|
|---|
| 2426 | x = PyInt_FromLong(CL_UNCOMPRESSED);
|
|---|
| 2427 | if (x == NULL || PyDict_SetItemString(d, "UNCOMPRESSED", x) < 0)
|
|---|
| 2428 | return;
|
|---|
| 2429 | Py_DECREF(x);
|
|---|
| 2430 | #endif
|
|---|
| 2431 | #ifdef CL_UNCOMPRESSED_AUDIO
|
|---|
| 2432 | x = PyInt_FromLong(CL_UNCOMPRESSED_AUDIO);
|
|---|
| 2433 | if (x == NULL || PyDict_SetItemString(d, "UNCOMPRESSED_AUDIO", x) < 0)
|
|---|
| 2434 | return;
|
|---|
| 2435 | Py_DECREF(x);
|
|---|
| 2436 | #endif
|
|---|
| 2437 | #ifdef CL_UNCOMPRESSED_VIDEO
|
|---|
| 2438 | x = PyInt_FromLong(CL_UNCOMPRESSED_VIDEO);
|
|---|
| 2439 | if (x == NULL || PyDict_SetItemString(d, "UNCOMPRESSED_VIDEO", x) < 0)
|
|---|
| 2440 | return;
|
|---|
| 2441 | Py_DECREF(x);
|
|---|
| 2442 | #endif
|
|---|
| 2443 | #ifdef CL_UNKNOWN_SCHEME
|
|---|
| 2444 | x = PyInt_FromLong(CL_UNKNOWN_SCHEME);
|
|---|
| 2445 | if (x == NULL || PyDict_SetItemString(d, "UNKNOWN_SCHEME", x) < 0)
|
|---|
| 2446 | return;
|
|---|
| 2447 | Py_DECREF(x);
|
|---|
| 2448 | #endif
|
|---|
| 2449 | #ifdef CL_VIDEO
|
|---|
| 2450 | x = PyInt_FromLong(CL_VIDEO);
|
|---|
| 2451 | if (x == NULL || PyDict_SetItemString(d, "VIDEO", x) < 0)
|
|---|
| 2452 | return;
|
|---|
| 2453 | Py_DECREF(x);
|
|---|
| 2454 | #endif
|
|---|
| 2455 | #ifdef CL_Y
|
|---|
| 2456 | x = PyInt_FromLong(CL_Y);
|
|---|
| 2457 | if (x == NULL || PyDict_SetItemString(d, "Y", x) < 0)
|
|---|
| 2458 | return;
|
|---|
| 2459 | Py_DECREF(x);
|
|---|
| 2460 | #endif
|
|---|
| 2461 | #ifdef CL_YCbCr
|
|---|
| 2462 | x = PyInt_FromLong(CL_YCbCr);
|
|---|
| 2463 | if (x == NULL || PyDict_SetItemString(d, "YCbCr", x) < 0)
|
|---|
| 2464 | return;
|
|---|
| 2465 | Py_DECREF(x);
|
|---|
| 2466 | #endif
|
|---|
| 2467 | #ifdef CL_YCbCr422
|
|---|
| 2468 | x = PyInt_FromLong(CL_YCbCr422);
|
|---|
| 2469 | if (x == NULL || PyDict_SetItemString(d, "YCbCr422", x) < 0)
|
|---|
| 2470 | return;
|
|---|
| 2471 | Py_DECREF(x);
|
|---|
| 2472 | #endif
|
|---|
| 2473 | #ifdef CL_YCbCr422DC
|
|---|
| 2474 | x = PyInt_FromLong(CL_YCbCr422DC);
|
|---|
| 2475 | if (x == NULL || PyDict_SetItemString(d, "YCbCr422DC", x) < 0)
|
|---|
| 2476 | return;
|
|---|
| 2477 | Py_DECREF(x);
|
|---|
| 2478 | #endif
|
|---|
| 2479 | #ifdef CL_YCbCr422HC
|
|---|
| 2480 | x = PyInt_FromLong(CL_YCbCr422HC);
|
|---|
| 2481 | if (x == NULL || PyDict_SetItemString(d, "YCbCr422HC", x) < 0)
|
|---|
| 2482 | return;
|
|---|
| 2483 | Py_DECREF(x);
|
|---|
| 2484 | #endif
|
|---|
| 2485 | #ifdef CL_YUV
|
|---|
| 2486 | x = PyInt_FromLong(CL_YUV);
|
|---|
| 2487 | if (x == NULL || PyDict_SetItemString(d, "YUV", x) < 0)
|
|---|
| 2488 | return;
|
|---|
| 2489 | Py_DECREF(x);
|
|---|
| 2490 | #endif
|
|---|
| 2491 | #ifdef CL_YUV422
|
|---|
| 2492 | x = PyInt_FromLong(CL_YUV422);
|
|---|
| 2493 | if (x == NULL || PyDict_SetItemString(d, "YUV422", x) < 0)
|
|---|
| 2494 | return;
|
|---|
| 2495 | Py_DECREF(x);
|
|---|
| 2496 | #endif
|
|---|
| 2497 | #ifdef CL_YUV422DC
|
|---|
| 2498 | x = PyInt_FromLong(CL_YUV422DC);
|
|---|
| 2499 | if (x == NULL || PyDict_SetItemString(d, "YUV422DC", x) < 0)
|
|---|
| 2500 | return;
|
|---|
| 2501 | Py_DECREF(x);
|
|---|
| 2502 | #endif
|
|---|
| 2503 | #ifdef CL_YUV422HC
|
|---|
| 2504 | x = PyInt_FromLong(CL_YUV422HC);
|
|---|
| 2505 | if (x == NULL || PyDict_SetItemString(d, "YUV422HC", x) < 0)
|
|---|
| 2506 | return;
|
|---|
| 2507 | Py_DECREF(x);
|
|---|
| 2508 | #endif
|
|---|
| 2509 | #ifdef AWCMP_STEREO
|
|---|
| 2510 | x = PyInt_FromLong(AWCMP_STEREO);
|
|---|
| 2511 | if (x == NULL || PyDict_SetItemString(d, "AWCMP_STEREO", x) < 0)
|
|---|
| 2512 | return;
|
|---|
| 2513 | Py_DECREF(x);
|
|---|
| 2514 | #endif
|
|---|
| 2515 | #ifdef AWCMP_JOINT_STEREO
|
|---|
| 2516 | x = PyInt_FromLong(AWCMP_JOINT_STEREO);
|
|---|
| 2517 | if (x == NULL || PyDict_SetItemString(d, "AWCMP_JOINT_STEREO", x) < 0)
|
|---|
| 2518 | return;
|
|---|
| 2519 | Py_DECREF(x);
|
|---|
| 2520 | #endif
|
|---|
| 2521 | #ifdef AWCMP_INDEPENDENT
|
|---|
| 2522 | x = PyInt_FromLong(AWCMP_INDEPENDENT);
|
|---|
| 2523 | if (x == NULL || PyDict_SetItemString(d, "AWCMP_INDEPENDENT", x) < 0)
|
|---|
| 2524 | return;
|
|---|
| 2525 | Py_DECREF(x);
|
|---|
| 2526 | #endif
|
|---|
| 2527 | #ifdef AWCMP_FIXED_RATE
|
|---|
| 2528 | x = PyInt_FromLong(AWCMP_FIXED_RATE);
|
|---|
| 2529 | if (x == NULL || PyDict_SetItemString(d, "AWCMP_FIXED_RATE", x) < 0)
|
|---|
| 2530 | return;
|
|---|
| 2531 | Py_DECREF(x);
|
|---|
| 2532 | #endif
|
|---|
| 2533 | #ifdef AWCMP_CONST_QUAL
|
|---|
| 2534 | x = PyInt_FromLong(AWCMP_CONST_QUAL);
|
|---|
| 2535 | if (x == NULL || PyDict_SetItemString(d, "AWCMP_CONST_QUAL", x) < 0)
|
|---|
| 2536 | return;
|
|---|
| 2537 | Py_DECREF(x);
|
|---|
| 2538 | #endif
|
|---|
| 2539 | #ifdef AWCMP_LOSSLESS
|
|---|
| 2540 | x = PyInt_FromLong(AWCMP_LOSSLESS);
|
|---|
| 2541 | if (x == NULL || PyDict_SetItemString(d, "AWCMP_LOSSLESS", x) < 0)
|
|---|
| 2542 | return;
|
|---|
| 2543 | Py_DECREF(x);
|
|---|
| 2544 | #endif
|
|---|
| 2545 | #ifdef AWCMP_MPEG_LAYER_I
|
|---|
| 2546 | x = PyInt_FromLong(AWCMP_MPEG_LAYER_I);
|
|---|
| 2547 | if (x == NULL || PyDict_SetItemString(d, "AWCMP_MPEG_LAYER_I", x) < 0)
|
|---|
| 2548 | return;
|
|---|
| 2549 | Py_DECREF(x);
|
|---|
| 2550 | #endif
|
|---|
| 2551 | #ifdef AWCMP_MPEG_LAYER_II
|
|---|
| 2552 | x = PyInt_FromLong(AWCMP_MPEG_LAYER_II);
|
|---|
| 2553 | if (x == NULL || PyDict_SetItemString(d, "AWCMP_MPEG_LAYER_II", x) < 0)
|
|---|
| 2554 | return;
|
|---|
| 2555 | Py_DECREF(x);
|
|---|
| 2556 | #endif
|
|---|
| 2557 |
|
|---|
| 2558 | (void) clSetErrorHandler(cl_ErrorHandler);
|
|---|
| 2559 | }
|
|---|