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