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