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