1 /* Generated by Cython 0.29.21 */
2
3 /* BEGIN: Cython Metadata
4 {
5 "distutils": {
6 "depends": [
7 "/opt/hostedtoolcache/Python/3.7.9/x64/include/python3.7m/Python.h",
8 "/tmp/vendor/include/libavcodec/avcodec.h",
9 "/tmp/vendor/include/libavdevice/avdevice.h",
10 "/tmp/vendor/include/libavfilter/avfilter.h",
11 "/tmp/vendor/include/libavfilter/buffersink.h",
12 "/tmp/vendor/include/libavfilter/buffersrc.h",
13 "/tmp/vendor/include/libavformat/avformat.h",
14 "/tmp/vendor/include/libavutil/audio_fifo.h",
15 "/tmp/vendor/include/libavutil/avutil.h",
16 "/tmp/vendor/include/libavutil/channel_layout.h",
17 "/tmp/vendor/include/libavutil/dict.h",
18 "/tmp/vendor/include/libavutil/error.h",
19 "/tmp/vendor/include/libavutil/frame.h",
20 "/tmp/vendor/include/libavutil/imgutils.h",
21 "/tmp/vendor/include/libavutil/log.h",
22 "/tmp/vendor/include/libavutil/mathematics.h",
23 "/tmp/vendor/include/libavutil/motion_vector.h",
24 "/tmp/vendor/include/libavutil/opt.h",
25 "/tmp/vendor/include/libavutil/pixdesc.h",
26 "/tmp/vendor/include/libavutil/rational.h",
27 "/tmp/vendor/include/libavutil/samplefmt.h",
28 "/tmp/vendor/include/libswresample/swresample.h",
29 "/tmp/vendor/include/libswscale/swscale.h",
30 "build/temp.linux-x86_64-3.7/include/pyav/config.h"
31 ],
32 "include_dirs": [
33 "/tmp/vendor/include",
34 "build/temp.linux-x86_64-3.7/include",
35 "/opt/hostedtoolcache/Python/3.7.9/x64/include/python3.7m",
36 "include"
37 ],
38 "libraries": [
39 "avutil",
40 "avcodec",
41 "avdevice",
42 "swscale",
43 "swresample",
44 "avformat",
45 "avfilter"
46 ],
47 "library_dirs": [
48 "/opt/hostedtoolcache/Python/3.7.9/x64/lib",
49 "/tmp/vendor/lib"
50 ],
51 "name": "av.audio.codeccontext",
52 "sources": [
53 "av/audio/codeccontext.pyx"
54 ]
55 },
56 "module_name": "av.audio.codeccontext"
57 }
58 END: Cython Metadata */
59
60 #define PY_SSIZE_T_CLEAN
61 #include "Python.h"
62 #ifndef Py_PYTHON_H
63 #error Python headers needed to compile C extensions, please install development version of Python.
64 #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
65 #error Cython requires Python 2.6+ or Python 3.3+.
66 #else
67 #define CYTHON_ABI "0_29_21"
68 #define CYTHON_HEX_VERSION 0x001D15F0
69 #define CYTHON_FUTURE_DIVISION 0
70 #include <stddef.h>
71 #ifndef offsetof
72 #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
73 #endif
74 #if !defined(WIN32) && !defined(MS_WINDOWS)
75 #ifndef __stdcall
76 #define __stdcall
77 #endif
78 #ifndef __cdecl
79 #define __cdecl
80 #endif
81 #ifndef __fastcall
82 #define __fastcall
83 #endif
84 #endif
85 #ifndef DL_IMPORT
86 #define DL_IMPORT(t) t
87 #endif
88 #ifndef DL_EXPORT
89 #define DL_EXPORT(t) t
90 #endif
91 #define __PYX_COMMA ,
92 #ifndef HAVE_LONG_LONG
93 #if PY_VERSION_HEX >= 0x02070000
94 #define HAVE_LONG_LONG
95 #endif
96 #endif
97 #ifndef PY_LONG_LONG
98 #define PY_LONG_LONG LONG_LONG
99 #endif
100 #ifndef Py_HUGE_VAL
101 #define Py_HUGE_VAL HUGE_VAL
102 #endif
103 #ifdef PYPY_VERSION
104 #define CYTHON_COMPILING_IN_PYPY 1
105 #define CYTHON_COMPILING_IN_PYSTON 0
106 #define CYTHON_COMPILING_IN_CPYTHON 0
107 #undef CYTHON_USE_TYPE_SLOTS
108 #define CYTHON_USE_TYPE_SLOTS 0
109 #undef CYTHON_USE_PYTYPE_LOOKUP
110 #define CYTHON_USE_PYTYPE_LOOKUP 0
111 #if PY_VERSION_HEX < 0x03050000
112 #undef CYTHON_USE_ASYNC_SLOTS
113 #define CYTHON_USE_ASYNC_SLOTS 0
114 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
115 #define CYTHON_USE_ASYNC_SLOTS 1
116 #endif
117 #undef CYTHON_USE_PYLIST_INTERNALS
118 #define CYTHON_USE_PYLIST_INTERNALS 0
119 #undef CYTHON_USE_UNICODE_INTERNALS
120 #define CYTHON_USE_UNICODE_INTERNALS 0
121 #undef CYTHON_USE_UNICODE_WRITER
122 #define CYTHON_USE_UNICODE_WRITER 0
123 #undef CYTHON_USE_PYLONG_INTERNALS
124 #define CYTHON_USE_PYLONG_INTERNALS 0
125 #undef CYTHON_AVOID_BORROWED_REFS
126 #define CYTHON_AVOID_BORROWED_REFS 1
127 #undef CYTHON_ASSUME_SAFE_MACROS
128 #define CYTHON_ASSUME_SAFE_MACROS 0
129 #undef CYTHON_UNPACK_METHODS
130 #define CYTHON_UNPACK_METHODS 0
131 #undef CYTHON_FAST_THREAD_STATE
132 #define CYTHON_FAST_THREAD_STATE 0
133 #undef CYTHON_FAST_PYCALL
134 #define CYTHON_FAST_PYCALL 0
135 #undef CYTHON_PEP489_MULTI_PHASE_INIT
136 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
137 #undef CYTHON_USE_TP_FINALIZE
138 #define CYTHON_USE_TP_FINALIZE 0
139 #undef CYTHON_USE_DICT_VERSIONS
140 #define CYTHON_USE_DICT_VERSIONS 0
141 #undef CYTHON_USE_EXC_INFO_STACK
142 #define CYTHON_USE_EXC_INFO_STACK 0
143 #elif defined(PYSTON_VERSION)
144 #define CYTHON_COMPILING_IN_PYPY 0
145 #define CYTHON_COMPILING_IN_PYSTON 1
146 #define CYTHON_COMPILING_IN_CPYTHON 0
147 #ifndef CYTHON_USE_TYPE_SLOTS
148 #define CYTHON_USE_TYPE_SLOTS 1
149 #endif
150 #undef CYTHON_USE_PYTYPE_LOOKUP
151 #define CYTHON_USE_PYTYPE_LOOKUP 0
152 #undef CYTHON_USE_ASYNC_SLOTS
153 #define CYTHON_USE_ASYNC_SLOTS 0
154 #undef CYTHON_USE_PYLIST_INTERNALS
155 #define CYTHON_USE_PYLIST_INTERNALS 0
156 #ifndef CYTHON_USE_UNICODE_INTERNALS
157 #define CYTHON_USE_UNICODE_INTERNALS 1
158 #endif
159 #undef CYTHON_USE_UNICODE_WRITER
160 #define CYTHON_USE_UNICODE_WRITER 0
161 #undef CYTHON_USE_PYLONG_INTERNALS
162 #define CYTHON_USE_PYLONG_INTERNALS 0
163 #ifndef CYTHON_AVOID_BORROWED_REFS
164 #define CYTHON_AVOID_BORROWED_REFS 0
165 #endif
166 #ifndef CYTHON_ASSUME_SAFE_MACROS
167 #define CYTHON_ASSUME_SAFE_MACROS 1
168 #endif
169 #ifndef CYTHON_UNPACK_METHODS
170 #define CYTHON_UNPACK_METHODS 1
171 #endif
172 #undef CYTHON_FAST_THREAD_STATE
173 #define CYTHON_FAST_THREAD_STATE 0
174 #undef CYTHON_FAST_PYCALL
175 #define CYTHON_FAST_PYCALL 0
176 #undef CYTHON_PEP489_MULTI_PHASE_INIT
177 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
178 #undef CYTHON_USE_TP_FINALIZE
179 #define CYTHON_USE_TP_FINALIZE 0
180 #undef CYTHON_USE_DICT_VERSIONS
181 #define CYTHON_USE_DICT_VERSIONS 0
182 #undef CYTHON_USE_EXC_INFO_STACK
183 #define CYTHON_USE_EXC_INFO_STACK 0
184 #else
185 #define CYTHON_COMPILING_IN_PYPY 0
186 #define CYTHON_COMPILING_IN_PYSTON 0
187 #define CYTHON_COMPILING_IN_CPYTHON 1
188 #ifndef CYTHON_USE_TYPE_SLOTS
189 #define CYTHON_USE_TYPE_SLOTS 1
190 #endif
191 #if PY_VERSION_HEX < 0x02070000
192 #undef CYTHON_USE_PYTYPE_LOOKUP
193 #define CYTHON_USE_PYTYPE_LOOKUP 0
194 #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
195 #define CYTHON_USE_PYTYPE_LOOKUP 1
196 #endif
197 #if PY_MAJOR_VERSION < 3
198 #undef CYTHON_USE_ASYNC_SLOTS
199 #define CYTHON_USE_ASYNC_SLOTS 0
200 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
201 #define CYTHON_USE_ASYNC_SLOTS 1
202 #endif
203 #if PY_VERSION_HEX < 0x02070000
204 #undef CYTHON_USE_PYLONG_INTERNALS
205 #define CYTHON_USE_PYLONG_INTERNALS 0
206 #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
207 #define CYTHON_USE_PYLONG_INTERNALS 1
208 #endif
209 #ifndef CYTHON_USE_PYLIST_INTERNALS
210 #define CYTHON_USE_PYLIST_INTERNALS 1
211 #endif
212 #ifndef CYTHON_USE_UNICODE_INTERNALS
213 #define CYTHON_USE_UNICODE_INTERNALS 1
214 #endif
215 #if PY_VERSION_HEX < 0x030300F0
216 #undef CYTHON_USE_UNICODE_WRITER
217 #define CYTHON_USE_UNICODE_WRITER 0
218 #elif !defined(CYTHON_USE_UNICODE_WRITER)
219 #define CYTHON_USE_UNICODE_WRITER 1
220 #endif
221 #ifndef CYTHON_AVOID_BORROWED_REFS
222 #define CYTHON_AVOID_BORROWED_REFS 0
223 #endif
224 #ifndef CYTHON_ASSUME_SAFE_MACROS
225 #define CYTHON_ASSUME_SAFE_MACROS 1
226 #endif
227 #ifndef CYTHON_UNPACK_METHODS
228 #define CYTHON_UNPACK_METHODS 1
229 #endif
230 #ifndef CYTHON_FAST_THREAD_STATE
231 #define CYTHON_FAST_THREAD_STATE 1
232 #endif
233 #ifndef CYTHON_FAST_PYCALL
234 #define CYTHON_FAST_PYCALL 1
235 #endif
236 #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
237 #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
238 #endif
239 #ifndef CYTHON_USE_TP_FINALIZE
240 #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
241 #endif
242 #ifndef CYTHON_USE_DICT_VERSIONS
243 #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
244 #endif
245 #ifndef CYTHON_USE_EXC_INFO_STACK
246 #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
247 #endif
248 #endif
249 #if !defined(CYTHON_FAST_PYCCALL)
250 #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
251 #endif
252 #if CYTHON_USE_PYLONG_INTERNALS
253 #include "longintrepr.h"
254 #undef SHIFT
255 #undef BASE
256 #undef MASK
257 #ifdef SIZEOF_VOID_P
258 enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
259 #endif
260 #endif
261 #ifndef __has_attribute
262 #define __has_attribute(x) 0
263 #endif
264 #ifndef __has_cpp_attribute
265 #define __has_cpp_attribute(x) 0
266 #endif
267 #ifndef CYTHON_RESTRICT
268 #if defined(__GNUC__)
269 #define CYTHON_RESTRICT __restrict__
270 #elif defined(_MSC_VER) && _MSC_VER >= 1400
271 #define CYTHON_RESTRICT __restrict
272 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
273 #define CYTHON_RESTRICT restrict
274 #else
275 #define CYTHON_RESTRICT
276 #endif
277 #endif
278 #ifndef CYTHON_UNUSED
279 # if defined(__GNUC__)
280 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
281 # define CYTHON_UNUSED __attribute__ ((__unused__))
282 # else
283 # define CYTHON_UNUSED
284 # endif
285 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
286 # define CYTHON_UNUSED __attribute__ ((__unused__))
287 # else
288 # define CYTHON_UNUSED
289 # endif
290 #endif
291 #ifndef CYTHON_MAYBE_UNUSED_VAR
292 # if defined(__cplusplus)
CYTHON_MAYBE_UNUSED_VAR(const T &)293 template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
294 # else
295 # define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
296 # endif
297 #endif
298 #ifndef CYTHON_NCP_UNUSED
299 # if CYTHON_COMPILING_IN_CPYTHON
300 # define CYTHON_NCP_UNUSED
301 # else
302 # define CYTHON_NCP_UNUSED CYTHON_UNUSED
303 # endif
304 #endif
305 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
306 #ifdef _MSC_VER
307 #ifndef _MSC_STDINT_H_
308 #if _MSC_VER < 1300
309 typedef unsigned char uint8_t;
310 typedef unsigned int uint32_t;
311 #else
312 typedef unsigned __int8 uint8_t;
313 typedef unsigned __int32 uint32_t;
314 #endif
315 #endif
316 #else
317 #include <stdint.h>
318 #endif
319 #ifndef CYTHON_FALLTHROUGH
320 #if defined(__cplusplus) && __cplusplus >= 201103L
321 #if __has_cpp_attribute(fallthrough)
322 #define CYTHON_FALLTHROUGH [[fallthrough]]
323 #elif __has_cpp_attribute(clang::fallthrough)
324 #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
325 #elif __has_cpp_attribute(gnu::fallthrough)
326 #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
327 #endif
328 #endif
329 #ifndef CYTHON_FALLTHROUGH
330 #if __has_attribute(fallthrough)
331 #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
332 #else
333 #define CYTHON_FALLTHROUGH
334 #endif
335 #endif
336 #if defined(__clang__ ) && defined(__apple_build_version__)
337 #if __apple_build_version__ < 7000000
338 #undef CYTHON_FALLTHROUGH
339 #define CYTHON_FALLTHROUGH
340 #endif
341 #endif
342 #endif
343
344 #ifndef CYTHON_INLINE
345 #if defined(__clang__)
346 #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
347 #elif defined(__GNUC__)
348 #define CYTHON_INLINE __inline__
349 #elif defined(_MSC_VER)
350 #define CYTHON_INLINE __inline
351 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
352 #define CYTHON_INLINE inline
353 #else
354 #define CYTHON_INLINE
355 #endif
356 #endif
357
358 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
359 #define Py_OptimizeFlag 0
360 #endif
361 #define __PYX_BUILD_PY_SSIZE_T "n"
362 #define CYTHON_FORMAT_SSIZE_T "z"
363 #if PY_MAJOR_VERSION < 3
364 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
365 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
366 PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
367 #define __Pyx_DefaultClassType PyClass_Type
368 #else
369 #define __Pyx_BUILTIN_MODULE_NAME "builtins"
370 #if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2
371 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
372 PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
373 #else
374 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
375 PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
376 #endif
377 #define __Pyx_DefaultClassType PyType_Type
378 #endif
379 #ifndef Py_TPFLAGS_CHECKTYPES
380 #define Py_TPFLAGS_CHECKTYPES 0
381 #endif
382 #ifndef Py_TPFLAGS_HAVE_INDEX
383 #define Py_TPFLAGS_HAVE_INDEX 0
384 #endif
385 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
386 #define Py_TPFLAGS_HAVE_NEWBUFFER 0
387 #endif
388 #ifndef Py_TPFLAGS_HAVE_FINALIZE
389 #define Py_TPFLAGS_HAVE_FINALIZE 0
390 #endif
391 #ifndef METH_STACKLESS
392 #define METH_STACKLESS 0
393 #endif
394 #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
395 #ifndef METH_FASTCALL
396 #define METH_FASTCALL 0x80
397 #endif
398 typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
399 typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
400 Py_ssize_t nargs, PyObject *kwnames);
401 #else
402 #define __Pyx_PyCFunctionFast _PyCFunctionFast
403 #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
404 #endif
405 #if CYTHON_FAST_PYCCALL
406 #define __Pyx_PyFastCFunction_Check(func)\
407 ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
408 #else
409 #define __Pyx_PyFastCFunction_Check(func) 0
410 #endif
411 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
412 #define PyObject_Malloc(s) PyMem_Malloc(s)
413 #define PyObject_Free(p) PyMem_Free(p)
414 #define PyObject_Realloc(p) PyMem_Realloc(p)
415 #endif
416 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
417 #define PyMem_RawMalloc(n) PyMem_Malloc(n)
418 #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n)
419 #define PyMem_RawFree(p) PyMem_Free(p)
420 #endif
421 #if CYTHON_COMPILING_IN_PYSTON
422 #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co)
423 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
424 #else
425 #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
426 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
427 #endif
428 #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
429 #define __Pyx_PyThreadState_Current PyThreadState_GET()
430 #elif PY_VERSION_HEX >= 0x03060000
431 #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
432 #elif PY_VERSION_HEX >= 0x03000000
433 #define __Pyx_PyThreadState_Current PyThreadState_GET()
434 #else
435 #define __Pyx_PyThreadState_Current _PyThreadState_Current
436 #endif
437 #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
438 #include "pythread.h"
439 #define Py_tss_NEEDS_INIT 0
440 typedef int Py_tss_t;
PyThread_tss_create(Py_tss_t * key)441 static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
442 *key = PyThread_create_key();
443 return 0;
444 }
PyThread_tss_alloc(void)445 static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
446 Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
447 *key = Py_tss_NEEDS_INIT;
448 return key;
449 }
PyThread_tss_free(Py_tss_t * key)450 static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
451 PyObject_Free(key);
452 }
PyThread_tss_is_created(Py_tss_t * key)453 static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
454 return *key != Py_tss_NEEDS_INIT;
455 }
PyThread_tss_delete(Py_tss_t * key)456 static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
457 PyThread_delete_key(*key);
458 *key = Py_tss_NEEDS_INIT;
459 }
PyThread_tss_set(Py_tss_t * key,void * value)460 static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
461 return PyThread_set_key_value(*key, value);
462 }
PyThread_tss_get(Py_tss_t * key)463 static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
464 return PyThread_get_key_value(*key);
465 }
466 #endif
467 #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
468 #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
469 #else
470 #define __Pyx_PyDict_NewPresized(n) PyDict_New()
471 #endif
472 #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
473 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
474 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
475 #else
476 #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
477 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
478 #endif
479 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
480 #define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
481 #else
482 #define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name)
483 #endif
484 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
485 #define CYTHON_PEP393_ENABLED 1
486 #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
487 0 : _PyUnicode_Ready((PyObject *)(op)))
488 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
489 #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
490 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
491 #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
492 #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
493 #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
494 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch)
495 #if defined(PyUnicode_IS_READY) && defined(PyUnicode_GET_SIZE)
496 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
497 #else
498 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u))
499 #endif
500 #else
501 #define CYTHON_PEP393_ENABLED 0
502 #define PyUnicode_1BYTE_KIND 1
503 #define PyUnicode_2BYTE_KIND 2
504 #define PyUnicode_4BYTE_KIND 4
505 #define __Pyx_PyUnicode_READY(op) (0)
506 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
507 #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
508 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
509 #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
510 #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
511 #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
512 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
513 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u))
514 #endif
515 #if CYTHON_COMPILING_IN_PYPY
516 #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
517 #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
518 #else
519 #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
520 #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
521 PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
522 #endif
523 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
524 #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
525 #endif
526 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
527 #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
528 #endif
529 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
530 #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
531 #endif
532 #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyString_Check(b) && !PyString_CheckExact(b)))) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
533 #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
534 #if PY_MAJOR_VERSION >= 3
535 #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
536 #else
537 #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
538 #endif
539 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
540 #define PyObject_ASCII(o) PyObject_Repr(o)
541 #endif
542 #if PY_MAJOR_VERSION >= 3
543 #define PyBaseString_Type PyUnicode_Type
544 #define PyStringObject PyUnicodeObject
545 #define PyString_Type PyUnicode_Type
546 #define PyString_Check PyUnicode_Check
547 #define PyString_CheckExact PyUnicode_CheckExact
548 #ifndef PyObject_Unicode
549 #define PyObject_Unicode PyObject_Str
550 #endif
551 #endif
552 #if PY_MAJOR_VERSION >= 3
553 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
554 #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
555 #else
556 #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
557 #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
558 #endif
559 #ifndef PySet_CheckExact
560 #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
561 #endif
562 #if PY_VERSION_HEX >= 0x030900A4
563 #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
564 #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
565 #else
566 #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
567 #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
568 #endif
569 #if CYTHON_ASSUME_SAFE_MACROS
570 #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq)
571 #else
572 #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq)
573 #endif
574 #if PY_MAJOR_VERSION >= 3
575 #define PyIntObject PyLongObject
576 #define PyInt_Type PyLong_Type
577 #define PyInt_Check(op) PyLong_Check(op)
578 #define PyInt_CheckExact(op) PyLong_CheckExact(op)
579 #define PyInt_FromString PyLong_FromString
580 #define PyInt_FromUnicode PyLong_FromUnicode
581 #define PyInt_FromLong PyLong_FromLong
582 #define PyInt_FromSize_t PyLong_FromSize_t
583 #define PyInt_FromSsize_t PyLong_FromSsize_t
584 #define PyInt_AsLong PyLong_AsLong
585 #define PyInt_AS_LONG PyLong_AS_LONG
586 #define PyInt_AsSsize_t PyLong_AsSsize_t
587 #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
588 #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
589 #define PyNumber_Int PyNumber_Long
590 #endif
591 #if PY_MAJOR_VERSION >= 3
592 #define PyBoolObject PyLongObject
593 #endif
594 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
595 #ifndef PyUnicode_InternFromString
596 #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
597 #endif
598 #endif
599 #if PY_VERSION_HEX < 0x030200A4
600 typedef long Py_hash_t;
601 #define __Pyx_PyInt_FromHash_t PyInt_FromLong
602 #define __Pyx_PyInt_AsHash_t PyInt_AsLong
603 #else
604 #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
605 #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
606 #endif
607 #if PY_MAJOR_VERSION >= 3
608 #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func))
609 #else
610 #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
611 #endif
612 #if CYTHON_USE_ASYNC_SLOTS
613 #if PY_VERSION_HEX >= 0x030500B1
614 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
615 #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
616 #else
617 #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
618 #endif
619 #else
620 #define __Pyx_PyType_AsAsync(obj) NULL
621 #endif
622 #ifndef __Pyx_PyAsyncMethodsStruct
623 typedef struct {
624 unaryfunc am_await;
625 unaryfunc am_aiter;
626 unaryfunc am_anext;
627 } __Pyx_PyAsyncMethodsStruct;
628 #endif
629
630 #if defined(WIN32) || defined(MS_WINDOWS)
631 #define _USE_MATH_DEFINES
632 #endif
633 #include <math.h>
634 #ifdef NAN
635 #define __PYX_NAN() ((float) NAN)
636 #else
__PYX_NAN()637 static CYTHON_INLINE float __PYX_NAN() {
638 float value;
639 memset(&value, 0xFF, sizeof(value));
640 return value;
641 }
642 #endif
643 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
644 #define __Pyx_truncl trunc
645 #else
646 #define __Pyx_truncl truncl
647 #endif
648
649 #define __PYX_MARK_ERR_POS(f_index, lineno) \
650 { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
651 #define __PYX_ERR(f_index, lineno, Ln_error) \
652 { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }
653
654 #ifndef __PYX_EXTERN_C
655 #ifdef __cplusplus
656 #define __PYX_EXTERN_C extern "C"
657 #else
658 #define __PYX_EXTERN_C extern
659 #endif
660 #endif
661
662 #define __PYX_HAVE__av__audio__codeccontext
663 #define __PYX_HAVE_API__av__audio__codeccontext
664 /* Early includes */
665 #include <stdint.h>
666 #include "pyav/config.h"
667 #include "libavutil/mathematics.h"
668 #include "libavutil/rational.h"
669 #include "libavutil/avutil.h"
670 #include "libavutil/pixdesc.h"
671 #include "libavutil/channel_layout.h"
672 #include "libavutil/audio_fifo.h"
673 #include "stdarg.h"
674 #include "libavutil/opt.h"
675 #include "libavutil/imgutils.h"
676 #include "libavutil/log.h"
677 #include "libavutil/dict.h"
678 #include "libavutil/error.h"
679 #include "libavutil/frame.h"
680 #include "libavutil/samplefmt.h"
681 #include "libavutil/motion_vector.h"
682 #include "libavcodec/avcodec.h"
683 #include "libavdevice/avdevice.h"
684 #include "libavformat/avformat.h"
685 #include "libswresample/swresample.h"
686 #include "libswscale/swscale.h"
687 #include "libavfilter/avfilter.h"
688 #include "libavfilter/buffersink.h"
689 #include "libavfilter/buffersrc.h"
690 #include "stdio.h"
691 #ifdef _OPENMP
692 #include <omp.h>
693 #endif /* _OPENMP */
694
695 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
696 #define CYTHON_WITHOUT_ASSERTIONS
697 #endif
698
699 typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
700 const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
701
702 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 1
703 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
704 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
705 #define __PYX_DEFAULT_STRING_ENCODING "ascii"
706 #define __Pyx_PyObject_FromString __Pyx_PyStr_FromString
707 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyStr_FromStringAndSize
708 #define __Pyx_uchar_cast(c) ((unsigned char)c)
709 #define __Pyx_long_cast(x) ((long)x)
710 #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
711 (sizeof(type) < sizeof(Py_ssize_t)) ||\
712 (sizeof(type) > sizeof(Py_ssize_t) &&\
713 likely(v < (type)PY_SSIZE_T_MAX ||\
714 v == (type)PY_SSIZE_T_MAX) &&\
715 (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
716 v == (type)PY_SSIZE_T_MIN))) ||\
717 (sizeof(type) == sizeof(Py_ssize_t) &&\
718 (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
719 v == (type)PY_SSIZE_T_MAX))) )
__Pyx_is_valid_index(Py_ssize_t i,Py_ssize_t limit)720 static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
721 return (size_t) i < (size_t) limit;
722 }
723 #if defined (__cplusplus) && __cplusplus >= 201103L
724 #include <cstdlib>
725 #define __Pyx_sst_abs(value) std::abs(value)
726 #elif SIZEOF_INT >= SIZEOF_SIZE_T
727 #define __Pyx_sst_abs(value) abs(value)
728 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
729 #define __Pyx_sst_abs(value) labs(value)
730 #elif defined (_MSC_VER)
731 #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
732 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
733 #define __Pyx_sst_abs(value) llabs(value)
734 #elif defined (__GNUC__)
735 #define __Pyx_sst_abs(value) __builtin_llabs(value)
736 #else
737 #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
738 #endif
739 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
740 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
741 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
742 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
743 #define __Pyx_PyBytes_FromString PyBytes_FromString
744 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
745 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
746 #if PY_MAJOR_VERSION < 3
747 #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
748 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
749 #else
750 #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
751 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
752 #endif
753 #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s))
754 #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s))
755 #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s))
756 #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s))
757 #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s))
758 #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s))
759 #define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s))
760 #define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
761 #define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
762 #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s))
763 #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s))
764 #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
765 #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
766 #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
767 #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
768 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
__Pyx_Py_UNICODE_strlen(const Py_UNICODE * u)769 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
770 const Py_UNICODE *u_end = u;
771 while (*u_end++) ;
772 return (size_t)(u_end - u - 1);
773 }
774 #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
775 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
776 #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
777 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
778 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
779 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
780 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
781 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
782 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
783 #define __Pyx_PySequence_Tuple(obj)\
784 (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
785 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
786 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
787 #if CYTHON_ASSUME_SAFE_MACROS
788 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
789 #else
790 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
791 #endif
792 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
793 #if PY_MAJOR_VERSION >= 3
794 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
795 #else
796 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
797 #endif
798 #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
799 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
800 static int __Pyx_sys_getdefaultencoding_not_ascii;
__Pyx_init_sys_getdefaultencoding_params(void)801 static int __Pyx_init_sys_getdefaultencoding_params(void) {
802 PyObject* sys;
803 PyObject* default_encoding = NULL;
804 PyObject* ascii_chars_u = NULL;
805 PyObject* ascii_chars_b = NULL;
806 const char* default_encoding_c;
807 sys = PyImport_ImportModule("sys");
808 if (!sys) goto bad;
809 default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
810 Py_DECREF(sys);
811 if (!default_encoding) goto bad;
812 default_encoding_c = PyBytes_AsString(default_encoding);
813 if (!default_encoding_c) goto bad;
814 if (strcmp(default_encoding_c, "ascii") == 0) {
815 __Pyx_sys_getdefaultencoding_not_ascii = 0;
816 } else {
817 char ascii_chars[128];
818 int c;
819 for (c = 0; c < 128; c++) {
820 ascii_chars[c] = c;
821 }
822 __Pyx_sys_getdefaultencoding_not_ascii = 1;
823 ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
824 if (!ascii_chars_u) goto bad;
825 ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
826 if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
827 PyErr_Format(
828 PyExc_ValueError,
829 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
830 default_encoding_c);
831 goto bad;
832 }
833 Py_DECREF(ascii_chars_u);
834 Py_DECREF(ascii_chars_b);
835 }
836 Py_DECREF(default_encoding);
837 return 0;
838 bad:
839 Py_XDECREF(default_encoding);
840 Py_XDECREF(ascii_chars_u);
841 Py_XDECREF(ascii_chars_b);
842 return -1;
843 }
844 #endif
845 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
846 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
847 #else
848 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
849 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
850 static char* __PYX_DEFAULT_STRING_ENCODING;
__Pyx_init_sys_getdefaultencoding_params(void)851 static int __Pyx_init_sys_getdefaultencoding_params(void) {
852 PyObject* sys;
853 PyObject* default_encoding = NULL;
854 char* default_encoding_c;
855 sys = PyImport_ImportModule("sys");
856 if (!sys) goto bad;
857 default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
858 Py_DECREF(sys);
859 if (!default_encoding) goto bad;
860 default_encoding_c = PyBytes_AsString(default_encoding);
861 if (!default_encoding_c) goto bad;
862 __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
863 if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
864 strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
865 Py_DECREF(default_encoding);
866 return 0;
867 bad:
868 Py_XDECREF(default_encoding);
869 return -1;
870 }
871 #endif
872 #endif
873
874
875 /* Test for GCC > 2.95 */
876 #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
877 #define likely(x) __builtin_expect(!!(x), 1)
878 #define unlikely(x) __builtin_expect(!!(x), 0)
879 #else /* !__GNUC__ or GCC < 2.95 */
880 #define likely(x) (x)
881 #define unlikely(x) (x)
882 #endif /* __GNUC__ */
__Pyx_pretend_to_initialize(void * ptr)883 static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
884
885 static PyObject *__pyx_m = NULL;
886 static PyObject *__pyx_d;
887 static PyObject *__pyx_b;
888 static PyObject *__pyx_cython_runtime = NULL;
889 static PyObject *__pyx_empty_tuple;
890 static PyObject *__pyx_empty_bytes;
891 static PyObject *__pyx_empty_unicode;
892 static int __pyx_lineno;
893 static int __pyx_clineno = 0;
894 static const char * __pyx_cfilenm= __FILE__;
895 static const char *__pyx_filename;
896
897
898 static const char *__pyx_f[] = {
899 "stringsource",
900 "av/audio/codeccontext.pyx",
901 "av/audio/format.pxd",
902 "av/audio/layout.pxd",
903 "av/buffer.pxd",
904 "av/bytesource.pxd",
905 "av/codec/codec.pxd",
906 "av/container/streams.pxd",
907 "av/dictionary.pxd",
908 "av/format.pxd",
909 "av/container/core.pxd",
910 "av/stream.pxd",
911 "av/packet.pxd",
912 "av/sidedata/sidedata.pxd",
913 "av/frame.pxd",
914 "av/audio/frame.pxd",
915 "av/audio/fifo.pxd",
916 "av/audio/resampler.pxd",
917 };
918
919 /*--- Type declarations ---*/
920 struct __pyx_obj_2av_5audio_6format_AudioFormat;
921 struct __pyx_obj_2av_5audio_6layout_AudioLayout;
922 struct __pyx_obj_2av_5audio_6layout_AudioChannel;
923 struct __pyx_obj_2av_6buffer_Buffer;
924 struct __pyx_obj_2av_10bytesource_ByteSource;
925 struct __pyx_obj_2av_5codec_5codec_Codec;
926 struct __pyx_obj_2av_5codec_7context_CodecContext;
927 struct __pyx_obj_2av_9container_7streams_StreamContainer;
928 struct __pyx_obj_2av_10dictionary__Dictionary;
929 struct __pyx_obj_2av_6format_ContainerFormat;
930 struct __pyx_obj_2av_9container_4core_Container;
931 struct __pyx_obj_2av_6stream_Stream;
932 struct __pyx_obj_2av_6packet_Packet;
933 struct __pyx_obj_2av_8sidedata_8sidedata_SideData;
934 struct __pyx_obj_2av_8sidedata_8sidedata__SideDataContainer;
935 struct __pyx_obj_2av_5frame_Frame;
936 struct __pyx_obj_2av_5audio_5frame_AudioFrame;
937 struct __pyx_obj_2av_5audio_4fifo_AudioFifo;
938 struct __pyx_obj_2av_5audio_9resampler_AudioResampler;
939 struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext;
940 struct __pyx_opt_args_2av_10bytesource_bytesource;
941
942 /* "av/bytesource.pxd":14
943 * cdef size_t length
944 *
945 * cdef ByteSource bytesource(object, bint allow_none=*) # <<<<<<<<<<<<<<
946 */
947 struct __pyx_opt_args_2av_10bytesource_bytesource {
948 int __pyx_n;
949 int allow_none;
950 };
951 struct __pyx_opt_args_2av_5codec_5codec_5Codec__init;
952
953 /* "av/codec/codec.pxd":10
954 * cdef readonly bint is_encoder
955 *
956 * cdef _init(self, name=?) # <<<<<<<<<<<<<<
957 *
958 *
959 */
960 struct __pyx_opt_args_2av_5codec_5codec_5Codec__init {
961 int __pyx_n;
962 PyObject *name;
963 };
964 struct __pyx_opt_args_2av_5codec_7context_12CodecContext_open;
965 struct __pyx_opt_args_2av_5codec_7context_12CodecContext_close;
966 struct __pyx_opt_args_2av_5codec_7context_12CodecContext_encode;
967 struct __pyx_opt_args_2av_5codec_7context_12CodecContext_decode;
968
969 /* "av/codec/context.pxd":34
970 *
971 * # Public API.
972 * cpdef open(self, bint strict=?) # <<<<<<<<<<<<<<
973 * cpdef close(self, bint strict=?)
974 *
975 */
976 struct __pyx_opt_args_2av_5codec_7context_12CodecContext_open {
977 int __pyx_n;
978 int strict;
979 };
980
981 /* "av/codec/context.pxd":35
982 * # Public API.
983 * cpdef open(self, bint strict=?)
984 * cpdef close(self, bint strict=?) # <<<<<<<<<<<<<<
985 *
986 * cdef _set_default_time_base(self)
987 */
988 struct __pyx_opt_args_2av_5codec_7context_12CodecContext_close {
989 int __pyx_n;
990 int strict;
991 };
992
993 /* "av/codec/context.pxd":40
994 *
995 * # Wraps both versions of the transcode API, returning lists.
996 * cpdef encode(self, Frame frame=?) # <<<<<<<<<<<<<<
997 * cpdef decode(self, Packet packet=?)
998 *
999 */
1000 struct __pyx_opt_args_2av_5codec_7context_12CodecContext_encode {
1001 int __pyx_n;
1002 struct __pyx_obj_2av_5frame_Frame *frame;
1003 };
1004
1005 /* "av/codec/context.pxd":41
1006 * # Wraps both versions of the transcode API, returning lists.
1007 * cpdef encode(self, Frame frame=?)
1008 * cpdef decode(self, Packet packet=?) # <<<<<<<<<<<<<<
1009 *
1010 * # Used by both transcode APIs to setup user-land objects.
1011 */
1012 struct __pyx_opt_args_2av_5codec_7context_12CodecContext_decode {
1013 int __pyx_n;
1014 struct __pyx_obj_2av_6packet_Packet *packet;
1015 };
1016 struct __pyx_t_2av_9container_4core_timeout_info;
1017 typedef struct __pyx_t_2av_9container_4core_timeout_info __pyx_t_2av_9container_4core_timeout_info;
1018
1019 /* "av/container/core.pxd":10
1020 *
1021 * # Interrupt callback information, times are in seconds.
1022 * ctypedef struct timeout_info: # <<<<<<<<<<<<<<
1023 * double start_time
1024 * double timeout
1025 */
1026 struct __pyx_t_2av_9container_4core_timeout_info {
1027 double start_time;
1028 double timeout;
1029 };
1030 struct __pyx_opt_args_2av_5frame_5Frame__copy_internal_attributes;
1031
1032 /* "av/frame.pxd":19
1033 * cdef readonly int index
1034 *
1035 * cdef _copy_internal_attributes(self, Frame source, bint data_layout=?) # <<<<<<<<<<<<<<
1036 *
1037 * cdef _init_user_attributes(self)
1038 */
1039 struct __pyx_opt_args_2av_5frame_5Frame__copy_internal_attributes {
1040 int __pyx_n;
1041 int data_layout;
1042 };
1043 struct __pyx_opt_args_2av_5audio_4fifo_9AudioFifo_read;
1044 struct __pyx_opt_args_2av_5audio_4fifo_9AudioFifo_read_many;
1045
1046 /* "av/audio/fifo.pxd":18
1047 *
1048 * cpdef write(self, AudioFrame frame)
1049 * cpdef read(self, int samples=*, bint partial=*) # <<<<<<<<<<<<<<
1050 * cpdef read_many(self, int samples, bint partial=*)
1051 */
1052 struct __pyx_opt_args_2av_5audio_4fifo_9AudioFifo_read {
1053 int __pyx_n;
1054 int samples;
1055 int partial;
1056 };
1057
1058 /* "av/audio/fifo.pxd":19
1059 * cpdef write(self, AudioFrame frame)
1060 * cpdef read(self, int samples=*, bint partial=*)
1061 * cpdef read_many(self, int samples, bint partial=*) # <<<<<<<<<<<<<<
1062 */
1063 struct __pyx_opt_args_2av_5audio_4fifo_9AudioFifo_read_many {
1064 int __pyx_n;
1065 int partial;
1066 };
1067 struct __pyx_opt_args_2av_5error_stash_exception;
1068 struct __pyx_opt_args_2av_5error_err_check;
1069 struct __pyx_opt_args_2av_5error_make_error;
1070
1071 /* "av/error.pxd":2
1072 *
1073 * cdef int stash_exception(exc_info=*) # <<<<<<<<<<<<<<
1074 *
1075 * cpdef int err_check(int res, filename=*) except -1
1076 */
1077 struct __pyx_opt_args_2av_5error_stash_exception {
1078 int __pyx_n;
1079 PyObject *exc_info;
1080 };
1081
1082 /* "av/error.pxd":4
1083 * cdef int stash_exception(exc_info=*)
1084 *
1085 * cpdef int err_check(int res, filename=*) except -1 # <<<<<<<<<<<<<<
1086 * cpdef make_error(int res, filename=*, log=*)
1087 */
1088 struct __pyx_opt_args_2av_5error_err_check {
1089 int __pyx_n;
1090 PyObject *filename;
1091 };
1092
1093 /* "av/error.pxd":5
1094 *
1095 * cpdef int err_check(int res, filename=*) except -1
1096 * cpdef make_error(int res, filename=*, log=*) # <<<<<<<<<<<<<<
1097 */
1098 struct __pyx_opt_args_2av_5error_make_error {
1099 int __pyx_n;
1100 PyObject *filename;
1101 PyObject *log;
1102 };
1103
1104 /* "av/audio/format.pxd":4
1105 *
1106 *
1107 * cdef class AudioFormat(object): # <<<<<<<<<<<<<<
1108 *
1109 * cdef lib.AVSampleFormat sample_fmt
1110 */
1111 struct __pyx_obj_2av_5audio_6format_AudioFormat {
1112 PyObject_HEAD
1113 struct __pyx_vtabstruct_2av_5audio_6format_AudioFormat *__pyx_vtab;
1114 enum AVSampleFormat sample_fmt;
1115 };
1116
1117
1118 /* "av/audio/layout.pxd":4
1119 *
1120 *
1121 * cdef class AudioLayout(object): # <<<<<<<<<<<<<<
1122 *
1123 * # The layout for FFMpeg; this is essentially a bitmask of channels.
1124 */
1125 struct __pyx_obj_2av_5audio_6layout_AudioLayout {
1126 PyObject_HEAD
1127 struct __pyx_vtabstruct_2av_5audio_6layout_AudioLayout *__pyx_vtab;
1128 uint64_t layout;
1129 int nb_channels;
1130 PyObject *channels;
1131 };
1132
1133
1134 /* "av/audio/layout.pxd":20
1135 *
1136 *
1137 * cdef class AudioChannel(object): # <<<<<<<<<<<<<<
1138 *
1139 * # The channel for FFmpeg.
1140 */
1141 struct __pyx_obj_2av_5audio_6layout_AudioChannel {
1142 PyObject_HEAD
1143 uint64_t channel;
1144 };
1145
1146
1147 /* "av/buffer.pxd":2
1148 *
1149 * cdef class Buffer(object): # <<<<<<<<<<<<<<
1150 *
1151 * cdef size_t _buffer_size(self)
1152 */
1153 struct __pyx_obj_2av_6buffer_Buffer {
1154 PyObject_HEAD
1155 struct __pyx_vtabstruct_2av_6buffer_Buffer *__pyx_vtab;
1156 };
1157
1158
1159 /* "av/bytesource.pxd":4
1160 *
1161 *
1162 * cdef class ByteSource(object): # <<<<<<<<<<<<<<
1163 *
1164 * cdef object owner
1165 */
1166 struct __pyx_obj_2av_10bytesource_ByteSource {
1167 PyObject_HEAD
1168 PyObject *owner;
1169 int has_view;
1170 Py_buffer view;
1171 unsigned char *ptr;
1172 size_t length;
1173 };
1174
1175
1176 /* "av/codec/codec.pxd":4
1177 *
1178 *
1179 * cdef class Codec(object): # <<<<<<<<<<<<<<
1180 *
1181 * cdef const lib.AVCodec *ptr
1182 */
1183 struct __pyx_obj_2av_5codec_5codec_Codec {
1184 PyObject_HEAD
1185 struct __pyx_vtabstruct_2av_5codec_5codec_Codec *__pyx_vtab;
1186 struct AVCodec const *ptr;
1187 struct AVCodecDescriptor const *desc;
1188 int is_encoder;
1189 };
1190
1191
1192 /* "av/codec/context.pxd":10
1193 *
1194 *
1195 * cdef class CodecContext(object): # <<<<<<<<<<<<<<
1196 *
1197 * cdef lib.AVCodecContext *ptr
1198 */
1199 struct __pyx_obj_2av_5codec_7context_CodecContext {
1200 PyObject_HEAD
1201 struct __pyx_vtabstruct_2av_5codec_7context_CodecContext *__pyx_vtab;
1202 struct AVCodecContext *ptr;
1203 int allocated;
1204 int stream_index;
1205 struct AVCodecParserContext *parser;
1206 struct __pyx_obj_2av_10bytesource_ByteSource *extradata_source;
1207 struct __pyx_obj_2av_5codec_5codec_Codec *codec;
1208 PyObject *options;
1209 struct __pyx_obj_2av_5frame_Frame *_next_frame;
1210 };
1211
1212
1213 /* "av/container/streams.pxd":4
1214 *
1215 *
1216 * cdef class StreamContainer(object): # <<<<<<<<<<<<<<
1217 *
1218 * cdef list _streams
1219 */
1220 struct __pyx_obj_2av_9container_7streams_StreamContainer {
1221 PyObject_HEAD
1222 struct __pyx_vtabstruct_2av_9container_7streams_StreamContainer *__pyx_vtab;
1223 PyObject *_streams;
1224 PyObject *video;
1225 PyObject *audio;
1226 PyObject *subtitles;
1227 PyObject *data;
1228 PyObject *other;
1229 };
1230
1231
1232 /* "av/dictionary.pxd":4
1233 *
1234 *
1235 * cdef class _Dictionary(object): # <<<<<<<<<<<<<<
1236 *
1237 * cdef lib.AVDictionary *ptr
1238 */
1239 struct __pyx_obj_2av_10dictionary__Dictionary {
1240 PyObject_HEAD
1241 struct __pyx_vtabstruct_2av_10dictionary__Dictionary *__pyx_vtab;
1242 AVDictionary *ptr;
1243 };
1244
1245
1246 /* "av/format.pxd":4
1247 *
1248 *
1249 * cdef class ContainerFormat(object): # <<<<<<<<<<<<<<
1250 *
1251 * cdef readonly str name
1252 */
1253 struct __pyx_obj_2av_6format_ContainerFormat {
1254 PyObject_HEAD
1255 PyObject *name;
1256 struct AVInputFormat *iptr;
1257 struct AVOutputFormat *optr;
1258 };
1259
1260
1261 /* "av/container/core.pxd":15
1262 *
1263 *
1264 * cdef class Container(object): # <<<<<<<<<<<<<<
1265 *
1266 * cdef readonly bint writeable
1267 */
1268 struct __pyx_obj_2av_9container_4core_Container {
1269 PyObject_HEAD
1270 struct __pyx_vtabstruct_2av_9container_4core_Container *__pyx_vtab;
1271 int writeable;
1272 struct AVFormatContext *ptr;
1273 PyObject *name;
1274 PyObject *metadata_encoding;
1275 PyObject *metadata_errors;
1276 PyObject *file;
1277 PyObject *fread;
1278 PyObject *fwrite;
1279 PyObject *fseek;
1280 PyObject *ftell;
1281 struct AVIOContext *iocontext;
1282 unsigned char *buffer;
1283 long pos;
1284 int pos_is_valid;
1285 int input_was_opened;
1286 struct __pyx_obj_2av_6format_ContainerFormat *format;
1287 PyObject *options;
1288 PyObject *container_options;
1289 PyObject *stream_options;
1290 struct __pyx_obj_2av_9container_7streams_StreamContainer *streams;
1291 PyObject *metadata;
1292 PyObject *open_timeout;
1293 PyObject *read_timeout;
1294 __pyx_t_2av_9container_4core_timeout_info interrupt_callback_info;
1295 };
1296
1297
1298 /* "av/stream.pxd":10
1299 *
1300 *
1301 * cdef class Stream(object): # <<<<<<<<<<<<<<
1302 *
1303 * # Stream attributes.
1304 */
1305 struct __pyx_obj_2av_6stream_Stream {
1306 PyObject_HEAD
1307 struct __pyx_vtabstruct_2av_6stream_Stream *__pyx_vtab;
1308 struct __pyx_obj_2av_9container_4core_Container *container;
1309 struct AVStream *_stream;
1310 PyObject *metadata;
1311 struct AVCodecContext *_codec_context;
1312 struct AVCodec const *_codec;
1313 struct __pyx_obj_2av_5codec_7context_CodecContext *codec_context;
1314 };
1315
1316
1317 /* "av/packet.pxd":8
1318 *
1319 *
1320 * cdef class Packet(Buffer): # <<<<<<<<<<<<<<
1321 *
1322 * cdef lib.AVPacket struct
1323 */
1324 struct __pyx_obj_2av_6packet_Packet {
1325 struct __pyx_obj_2av_6buffer_Buffer __pyx_base;
1326 struct AVPacket __pyx_struct;
1327 struct __pyx_obj_2av_6stream_Stream *_stream;
1328 AVRational _time_base;
1329 struct __pyx_obj_2av_10bytesource_ByteSource *source;
1330 };
1331
1332
1333 /* "av/sidedata/sidedata.pxd":9
1334 *
1335 *
1336 * cdef class SideData(Buffer): # <<<<<<<<<<<<<<
1337 *
1338 * cdef Frame frame
1339 */
1340 struct __pyx_obj_2av_8sidedata_8sidedata_SideData {
1341 struct __pyx_obj_2av_6buffer_Buffer __pyx_base;
1342 struct __pyx_obj_2av_5frame_Frame *frame;
1343 struct AVFrameSideData *ptr;
1344 struct __pyx_obj_2av_10dictionary__Dictionary *metadata;
1345 };
1346
1347
1348 /* "av/sidedata/sidedata.pxd":18
1349 * cdef SideData wrap_side_data(Frame frame, int index)
1350 *
1351 * cdef class _SideDataContainer(object): # <<<<<<<<<<<<<<
1352 *
1353 * cdef Frame frame
1354 */
1355 struct __pyx_obj_2av_8sidedata_8sidedata__SideDataContainer {
1356 PyObject_HEAD
1357 struct __pyx_obj_2av_5frame_Frame *frame;
1358 PyObject *_by_index;
1359 PyObject *_by_type;
1360 };
1361
1362
1363 /* "av/frame.pxd":7
1364 *
1365 *
1366 * cdef class Frame(object): # <<<<<<<<<<<<<<
1367 *
1368 * cdef lib.AVFrame *ptr
1369 */
1370 struct __pyx_obj_2av_5frame_Frame {
1371 PyObject_HEAD
1372 struct __pyx_vtabstruct_2av_5frame_Frame *__pyx_vtab;
1373 struct AVFrame *ptr;
1374 AVRational _time_base;
1375 struct __pyx_obj_2av_8sidedata_8sidedata__SideDataContainer *_side_data;
1376 int index;
1377 };
1378
1379
1380 /* "av/audio/frame.pxd":9
1381 *
1382 *
1383 * cdef class AudioFrame(Frame): # <<<<<<<<<<<<<<
1384 *
1385 * # For raw storage of the frame's data; don't ever touch this.
1386 */
1387 struct __pyx_obj_2av_5audio_5frame_AudioFrame {
1388 struct __pyx_obj_2av_5frame_Frame __pyx_base;
1389 uint8_t *_buffer;
1390 size_t _buffer_size;
1391 struct __pyx_obj_2av_5audio_6layout_AudioLayout *layout;
1392 struct __pyx_obj_2av_5audio_6format_AudioFormat *format;
1393 };
1394
1395
1396 /* "av/audio/fifo.pxd":7
1397 *
1398 *
1399 * cdef class AudioFifo: # <<<<<<<<<<<<<<
1400 *
1401 * cdef lib.AVAudioFifo *ptr
1402 */
1403 struct __pyx_obj_2av_5audio_4fifo_AudioFifo {
1404 PyObject_HEAD
1405 struct __pyx_vtabstruct_2av_5audio_4fifo_AudioFifo *__pyx_vtab;
1406 struct AVAudioFifo *ptr;
1407 struct __pyx_obj_2av_5audio_5frame_AudioFrame *template;
1408 uint64_t samples_written;
1409 uint64_t samples_read;
1410 double pts_per_sample;
1411 };
1412
1413
1414 /* "av/audio/resampler.pxd":9
1415 *
1416 *
1417 * cdef class AudioResampler(object): # <<<<<<<<<<<<<<
1418 *
1419 * cdef readonly bint is_passthrough
1420 */
1421 struct __pyx_obj_2av_5audio_9resampler_AudioResampler {
1422 PyObject_HEAD
1423 struct __pyx_vtabstruct_2av_5audio_9resampler_AudioResampler *__pyx_vtab;
1424 int is_passthrough;
1425 struct SwrContext *ptr;
1426 struct __pyx_obj_2av_5audio_5frame_AudioFrame *template;
1427 unsigned int template_rate;
1428 struct __pyx_obj_2av_5audio_6format_AudioFormat *format;
1429 struct __pyx_obj_2av_5audio_6layout_AudioLayout *layout;
1430 int rate;
1431 uint64_t samples_in;
1432 double pts_per_sample_in;
1433 uint64_t samples_out;
1434 int simple_pts_out;
1435 };
1436
1437
1438 /* "av/audio/codeccontext.pxd":8
1439 *
1440 *
1441 * cdef class AudioCodecContext(CodecContext): # <<<<<<<<<<<<<<
1442 *
1443 * # Hold onto the frames that we will decode until we have a full one.
1444 */
1445 struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext {
1446 struct __pyx_obj_2av_5codec_7context_CodecContext __pyx_base;
1447 struct __pyx_obj_2av_5audio_5frame_AudioFrame *next_frame;
1448 struct __pyx_obj_2av_5audio_9resampler_AudioResampler *resampler;
1449 struct __pyx_obj_2av_5audio_4fifo_AudioFifo *fifo;
1450 };
1451
1452
1453
1454 /* "av/audio/format.pxd":4
1455 *
1456 *
1457 * cdef class AudioFormat(object): # <<<<<<<<<<<<<<
1458 *
1459 * cdef lib.AVSampleFormat sample_fmt
1460 */
1461
1462 struct __pyx_vtabstruct_2av_5audio_6format_AudioFormat {
1463 PyObject *(*_init)(struct __pyx_obj_2av_5audio_6format_AudioFormat *, enum AVSampleFormat);
1464 };
1465 static struct __pyx_vtabstruct_2av_5audio_6format_AudioFormat *__pyx_vtabptr_2av_5audio_6format_AudioFormat;
1466
1467
1468 /* "av/audio/layout.pxd":4
1469 *
1470 *
1471 * cdef class AudioLayout(object): # <<<<<<<<<<<<<<
1472 *
1473 * # The layout for FFMpeg; this is essentially a bitmask of channels.
1474 */
1475
1476 struct __pyx_vtabstruct_2av_5audio_6layout_AudioLayout {
1477 PyObject *(*_init)(struct __pyx_obj_2av_5audio_6layout_AudioLayout *, uint64_t);
1478 };
1479 static struct __pyx_vtabstruct_2av_5audio_6layout_AudioLayout *__pyx_vtabptr_2av_5audio_6layout_AudioLayout;
1480
1481
1482 /* "av/buffer.pxd":2
1483 *
1484 * cdef class Buffer(object): # <<<<<<<<<<<<<<
1485 *
1486 * cdef size_t _buffer_size(self)
1487 */
1488
1489 struct __pyx_vtabstruct_2av_6buffer_Buffer {
1490 size_t (*_buffer_size)(struct __pyx_obj_2av_6buffer_Buffer *);
1491 void *(*_buffer_ptr)(struct __pyx_obj_2av_6buffer_Buffer *);
1492 int (*_buffer_writable)(struct __pyx_obj_2av_6buffer_Buffer *);
1493 };
1494 static struct __pyx_vtabstruct_2av_6buffer_Buffer *__pyx_vtabptr_2av_6buffer_Buffer;
1495
1496
1497 /* "av/codec/codec.pxd":4
1498 *
1499 *
1500 * cdef class Codec(object): # <<<<<<<<<<<<<<
1501 *
1502 * cdef const lib.AVCodec *ptr
1503 */
1504
1505 struct __pyx_vtabstruct_2av_5codec_5codec_Codec {
1506 PyObject *(*_init)(struct __pyx_obj_2av_5codec_5codec_Codec *, struct __pyx_opt_args_2av_5codec_5codec_5Codec__init *__pyx_optional_args);
1507 };
1508 static struct __pyx_vtabstruct_2av_5codec_5codec_Codec *__pyx_vtabptr_2av_5codec_5codec_Codec;
1509
1510
1511 /* "av/codec/context.pxd":10
1512 *
1513 *
1514 * cdef class CodecContext(object): # <<<<<<<<<<<<<<
1515 *
1516 * cdef lib.AVCodecContext *ptr
1517 */
1518
1519 struct __pyx_vtabstruct_2av_5codec_7context_CodecContext {
1520 PyObject *(*_init)(struct __pyx_obj_2av_5codec_7context_CodecContext *, struct AVCodecContext *, struct AVCodec const *);
1521 PyObject *(*open)(struct __pyx_obj_2av_5codec_7context_CodecContext *, int __pyx_skip_dispatch, struct __pyx_opt_args_2av_5codec_7context_12CodecContext_open *__pyx_optional_args);
1522 PyObject *(*close)(struct __pyx_obj_2av_5codec_7context_CodecContext *, int __pyx_skip_dispatch, struct __pyx_opt_args_2av_5codec_7context_12CodecContext_close *__pyx_optional_args);
1523 PyObject *(*_set_default_time_base)(struct __pyx_obj_2av_5codec_7context_CodecContext *);
1524 PyObject *(*encode)(struct __pyx_obj_2av_5codec_7context_CodecContext *, int __pyx_skip_dispatch, struct __pyx_opt_args_2av_5codec_7context_12CodecContext_encode *__pyx_optional_args);
1525 PyObject *(*decode)(struct __pyx_obj_2av_5codec_7context_CodecContext *, int __pyx_skip_dispatch, struct __pyx_opt_args_2av_5codec_7context_12CodecContext_decode *__pyx_optional_args);
1526 PyObject *(*_prepare_frames_for_encode)(struct __pyx_obj_2av_5codec_7context_CodecContext *, struct __pyx_obj_2av_5frame_Frame *);
1527 PyObject *(*_setup_encoded_packet)(struct __pyx_obj_2av_5codec_7context_CodecContext *, struct __pyx_obj_2av_6packet_Packet *);
1528 PyObject *(*_setup_decoded_frame)(struct __pyx_obj_2av_5codec_7context_CodecContext *, struct __pyx_obj_2av_5frame_Frame *, struct __pyx_obj_2av_6packet_Packet *);
1529 PyObject *(*_send_frame_and_recv)(struct __pyx_obj_2av_5codec_7context_CodecContext *, struct __pyx_obj_2av_5frame_Frame *);
1530 PyObject *(*_recv_packet)(struct __pyx_obj_2av_5codec_7context_CodecContext *);
1531 PyObject *(*_send_packet_and_recv)(struct __pyx_obj_2av_5codec_7context_CodecContext *, struct __pyx_obj_2av_6packet_Packet *);
1532 PyObject *(*_recv_frame)(struct __pyx_obj_2av_5codec_7context_CodecContext *);
1533 struct __pyx_obj_2av_5frame_Frame *(*_alloc_next_frame)(struct __pyx_obj_2av_5codec_7context_CodecContext *);
1534 };
1535 static struct __pyx_vtabstruct_2av_5codec_7context_CodecContext *__pyx_vtabptr_2av_5codec_7context_CodecContext;
1536
1537
1538 /* "av/container/streams.pxd":4
1539 *
1540 *
1541 * cdef class StreamContainer(object): # <<<<<<<<<<<<<<
1542 *
1543 * cdef list _streams
1544 */
1545
1546 struct __pyx_vtabstruct_2av_9container_7streams_StreamContainer {
1547 PyObject *(*add_stream)(struct __pyx_obj_2av_9container_7streams_StreamContainer *, struct __pyx_obj_2av_6stream_Stream *);
1548 };
1549 static struct __pyx_vtabstruct_2av_9container_7streams_StreamContainer *__pyx_vtabptr_2av_9container_7streams_StreamContainer;
1550
1551
1552 /* "av/dictionary.pxd":4
1553 *
1554 *
1555 * cdef class _Dictionary(object): # <<<<<<<<<<<<<<
1556 *
1557 * cdef lib.AVDictionary *ptr
1558 */
1559
1560 struct __pyx_vtabstruct_2av_10dictionary__Dictionary {
1561 struct __pyx_obj_2av_10dictionary__Dictionary *(*copy)(struct __pyx_obj_2av_10dictionary__Dictionary *, int __pyx_skip_dispatch);
1562 };
1563 static struct __pyx_vtabstruct_2av_10dictionary__Dictionary *__pyx_vtabptr_2av_10dictionary__Dictionary;
1564
1565
1566 /* "av/container/core.pxd":15
1567 *
1568 *
1569 * cdef class Container(object): # <<<<<<<<<<<<<<
1570 *
1571 * cdef readonly bint writeable
1572 */
1573
1574 struct __pyx_vtabstruct_2av_9container_4core_Container {
1575 int (*err_check)(struct __pyx_obj_2av_9container_4core_Container *, int);
1576 PyObject *(*set_timeout)(struct __pyx_obj_2av_9container_4core_Container *, PyObject *);
1577 PyObject *(*start_timeout)(struct __pyx_obj_2av_9container_4core_Container *);
1578 };
1579 static struct __pyx_vtabstruct_2av_9container_4core_Container *__pyx_vtabptr_2av_9container_4core_Container;
1580
1581
1582 /* "av/stream.pxd":10
1583 *
1584 *
1585 * cdef class Stream(object): # <<<<<<<<<<<<<<
1586 *
1587 * # Stream attributes.
1588 */
1589
1590 struct __pyx_vtabstruct_2av_6stream_Stream {
1591 PyObject *(*_init)(struct __pyx_obj_2av_6stream_Stream *, struct __pyx_obj_2av_9container_4core_Container *, struct AVStream *);
1592 PyObject *(*_finalize_for_output)(struct __pyx_obj_2av_6stream_Stream *);
1593 };
1594 static struct __pyx_vtabstruct_2av_6stream_Stream *__pyx_vtabptr_2av_6stream_Stream;
1595
1596
1597 /* "av/packet.pxd":8
1598 *
1599 *
1600 * cdef class Packet(Buffer): # <<<<<<<<<<<<<<
1601 *
1602 * cdef lib.AVPacket struct
1603 */
1604
1605 struct __pyx_vtabstruct_2av_6packet_Packet {
1606 struct __pyx_vtabstruct_2av_6buffer_Buffer __pyx_base;
1607 PyObject *(*_rebase_time)(struct __pyx_obj_2av_6packet_Packet *, AVRational);
1608 };
1609 static struct __pyx_vtabstruct_2av_6packet_Packet *__pyx_vtabptr_2av_6packet_Packet;
1610
1611
1612 /* "av/sidedata/sidedata.pxd":9
1613 *
1614 *
1615 * cdef class SideData(Buffer): # <<<<<<<<<<<<<<
1616 *
1617 * cdef Frame frame
1618 */
1619
1620 struct __pyx_vtabstruct_2av_8sidedata_8sidedata_SideData {
1621 struct __pyx_vtabstruct_2av_6buffer_Buffer __pyx_base;
1622 };
1623 static struct __pyx_vtabstruct_2av_8sidedata_8sidedata_SideData *__pyx_vtabptr_2av_8sidedata_8sidedata_SideData;
1624
1625
1626 /* "av/frame.pxd":7
1627 *
1628 *
1629 * cdef class Frame(object): # <<<<<<<<<<<<<<
1630 *
1631 * cdef lib.AVFrame *ptr
1632 */
1633
1634 struct __pyx_vtabstruct_2av_5frame_Frame {
1635 PyObject *(*_rebase_time)(struct __pyx_obj_2av_5frame_Frame *, AVRational);
1636 PyObject *(*_copy_internal_attributes)(struct __pyx_obj_2av_5frame_Frame *, struct __pyx_obj_2av_5frame_Frame *, struct __pyx_opt_args_2av_5frame_5Frame__copy_internal_attributes *__pyx_optional_args);
1637 PyObject *(*_init_user_attributes)(struct __pyx_obj_2av_5frame_Frame *);
1638 };
1639 static struct __pyx_vtabstruct_2av_5frame_Frame *__pyx_vtabptr_2av_5frame_Frame;
1640
1641
1642 /* "av/audio/frame.pxd":9
1643 *
1644 *
1645 * cdef class AudioFrame(Frame): # <<<<<<<<<<<<<<
1646 *
1647 * # For raw storage of the frame's data; don't ever touch this.
1648 */
1649
1650 struct __pyx_vtabstruct_2av_5audio_5frame_AudioFrame {
1651 struct __pyx_vtabstruct_2av_5frame_Frame __pyx_base;
1652 PyObject *(*_init)(struct __pyx_obj_2av_5audio_5frame_AudioFrame *, enum AVSampleFormat, uint64_t, unsigned int, unsigned int);
1653 };
1654 static struct __pyx_vtabstruct_2av_5audio_5frame_AudioFrame *__pyx_vtabptr_2av_5audio_5frame_AudioFrame;
1655
1656
1657 /* "av/audio/fifo.pxd":7
1658 *
1659 *
1660 * cdef class AudioFifo: # <<<<<<<<<<<<<<
1661 *
1662 * cdef lib.AVAudioFifo *ptr
1663 */
1664
1665 struct __pyx_vtabstruct_2av_5audio_4fifo_AudioFifo {
1666 PyObject *(*write)(struct __pyx_obj_2av_5audio_4fifo_AudioFifo *, struct __pyx_obj_2av_5audio_5frame_AudioFrame *, int __pyx_skip_dispatch);
1667 PyObject *(*read)(struct __pyx_obj_2av_5audio_4fifo_AudioFifo *, int __pyx_skip_dispatch, struct __pyx_opt_args_2av_5audio_4fifo_9AudioFifo_read *__pyx_optional_args);
1668 PyObject *(*read_many)(struct __pyx_obj_2av_5audio_4fifo_AudioFifo *, int, int __pyx_skip_dispatch, struct __pyx_opt_args_2av_5audio_4fifo_9AudioFifo_read_many *__pyx_optional_args);
1669 };
1670 static struct __pyx_vtabstruct_2av_5audio_4fifo_AudioFifo *__pyx_vtabptr_2av_5audio_4fifo_AudioFifo;
1671
1672
1673 /* "av/audio/resampler.pxd":9
1674 *
1675 *
1676 * cdef class AudioResampler(object): # <<<<<<<<<<<<<<
1677 *
1678 * cdef readonly bint is_passthrough
1679 */
1680
1681 struct __pyx_vtabstruct_2av_5audio_9resampler_AudioResampler {
1682 PyObject *(*resample)(struct __pyx_obj_2av_5audio_9resampler_AudioResampler *, struct __pyx_obj_2av_5audio_5frame_AudioFrame *, int __pyx_skip_dispatch);
1683 };
1684 static struct __pyx_vtabstruct_2av_5audio_9resampler_AudioResampler *__pyx_vtabptr_2av_5audio_9resampler_AudioResampler;
1685
1686
1687 /* "av/audio/codeccontext.pyx":11
1688 *
1689 *
1690 * cdef class AudioCodecContext(CodecContext): # <<<<<<<<<<<<<<
1691 *
1692 * cdef _init(self, lib.AVCodecContext *ptr, const lib.AVCodec *codec):
1693 */
1694
1695 struct __pyx_vtabstruct_2av_5audio_12codeccontext_AudioCodecContext {
1696 struct __pyx_vtabstruct_2av_5codec_7context_CodecContext __pyx_base;
1697 };
1698 static struct __pyx_vtabstruct_2av_5audio_12codeccontext_AudioCodecContext *__pyx_vtabptr_2av_5audio_12codeccontext_AudioCodecContext;
1699
1700 /* --- Runtime support code (head) --- */
1701 /* Refnanny.proto */
1702 #ifndef CYTHON_REFNANNY
1703 #define CYTHON_REFNANNY 0
1704 #endif
1705 #if CYTHON_REFNANNY
1706 typedef struct {
1707 void (*INCREF)(void*, PyObject*, int);
1708 void (*DECREF)(void*, PyObject*, int);
1709 void (*GOTREF)(void*, PyObject*, int);
1710 void (*GIVEREF)(void*, PyObject*, int);
1711 void* (*SetupContext)(const char*, int, const char*);
1712 void (*FinishContext)(void**);
1713 } __Pyx_RefNannyAPIStruct;
1714 static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
1715 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
1716 #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
1717 #ifdef WITH_THREAD
1718 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1719 if (acquire_gil) {\
1720 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1721 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1722 PyGILState_Release(__pyx_gilstate_save);\
1723 } else {\
1724 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1725 }
1726 #else
1727 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1728 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
1729 #endif
1730 #define __Pyx_RefNannyFinishContext()\
1731 __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
1732 #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1733 #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1734 #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1735 #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1736 #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
1737 #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
1738 #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
1739 #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
1740 #else
1741 #define __Pyx_RefNannyDeclarations
1742 #define __Pyx_RefNannySetupContext(name, acquire_gil)
1743 #define __Pyx_RefNannyFinishContext()
1744 #define __Pyx_INCREF(r) Py_INCREF(r)
1745 #define __Pyx_DECREF(r) Py_DECREF(r)
1746 #define __Pyx_GOTREF(r)
1747 #define __Pyx_GIVEREF(r)
1748 #define __Pyx_XINCREF(r) Py_XINCREF(r)
1749 #define __Pyx_XDECREF(r) Py_XDECREF(r)
1750 #define __Pyx_XGOTREF(r)
1751 #define __Pyx_XGIVEREF(r)
1752 #endif
1753 #define __Pyx_XDECREF_SET(r, v) do {\
1754 PyObject *tmp = (PyObject *) r;\
1755 r = v; __Pyx_XDECREF(tmp);\
1756 } while (0)
1757 #define __Pyx_DECREF_SET(r, v) do {\
1758 PyObject *tmp = (PyObject *) r;\
1759 r = v; __Pyx_DECREF(tmp);\
1760 } while (0)
1761 #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
1762 #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
1763
1764 /* PyObjectGetAttrStr.proto */
1765 #if CYTHON_USE_TYPE_SLOTS
1766 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
1767 #else
1768 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1769 #endif
1770
1771 /* GetBuiltinName.proto */
1772 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
1773
1774 /* ExtTypeTest.proto */
1775 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
1776
1777 /* PyObjectCall.proto */
1778 #if CYTHON_COMPILING_IN_CPYTHON
1779 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1780 #else
1781 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1782 #endif
1783
1784 /* PyFunctionFastCall.proto */
1785 #if CYTHON_FAST_PYCALL
1786 #define __Pyx_PyFunction_FastCall(func, args, nargs)\
1787 __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
1788 #if 1 || PY_VERSION_HEX < 0x030600B1
1789 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
1790 #else
1791 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
1792 #endif
1793 #define __Pyx_BUILD_ASSERT_EXPR(cond)\
1794 (sizeof(char [1 - 2*!(cond)]) - 1)
1795 #ifndef Py_MEMBER_SIZE
1796 #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
1797 #endif
1798 static size_t __pyx_pyframe_localsplus_offset = 0;
1799 #include "frameobject.h"
1800 #define __Pxy_PyFrame_Initialize_Offsets()\
1801 ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
1802 (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
1803 #define __Pyx_PyFrame_GetLocalsplus(frame)\
1804 (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
1805 #endif
1806
1807 /* PyObjectCallMethO.proto */
1808 #if CYTHON_COMPILING_IN_CPYTHON
1809 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1810 #endif
1811
1812 /* PyObjectCallNoArg.proto */
1813 #if CYTHON_COMPILING_IN_CPYTHON
1814 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
1815 #else
1816 #define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
1817 #endif
1818
1819 /* ListAppend.proto */
1820 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
__Pyx_PyList_Append(PyObject * list,PyObject * x)1821 static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
1822 PyListObject* L = (PyListObject*) list;
1823 Py_ssize_t len = Py_SIZE(list);
1824 if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
1825 Py_INCREF(x);
1826 PyList_SET_ITEM(list, len, x);
1827 __Pyx_SET_SIZE(list, len + 1);
1828 return 0;
1829 }
1830 return PyList_Append(list, x);
1831 }
1832 #else
1833 #define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
1834 #endif
1835
1836 /* PyCFunctionFastCall.proto */
1837 #if CYTHON_FAST_PYCCALL
1838 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
1839 #else
1840 #define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL)
1841 #endif
1842
1843 /* PyObjectCall2Args.proto */
1844 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);
1845
1846 /* PyObjectCallOneArg.proto */
1847 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
1848
1849 /* PyObjectGetMethod.proto */
1850 static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method);
1851
1852 /* PyObjectCallMethod1.proto */
1853 static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg);
1854
1855 /* append.proto */
1856 static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x);
1857
1858 /* PyObjectSetAttrStr.proto */
1859 #if CYTHON_USE_TYPE_SLOTS
1860 #define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o, n, NULL)
1861 static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value);
1862 #else
1863 #define __Pyx_PyObject_DelAttrStr(o,n) PyObject_DelAttr(o,n)
1864 #define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v)
1865 #endif
1866
1867 /* PyThreadStateGet.proto */
1868 #if CYTHON_FAST_THREAD_STATE
1869 #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
1870 #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current;
1871 #define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type
1872 #else
1873 #define __Pyx_PyThreadState_declare
1874 #define __Pyx_PyThreadState_assign
1875 #define __Pyx_PyErr_Occurred() PyErr_Occurred()
1876 #endif
1877
1878 /* PyErrFetchRestore.proto */
1879 #if CYTHON_FAST_THREAD_STATE
1880 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1881 #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1882 #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1883 #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1884 #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1885 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1886 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1887 #if CYTHON_COMPILING_IN_CPYTHON
1888 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1889 #else
1890 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1891 #endif
1892 #else
1893 #define __Pyx_PyErr_Clear() PyErr_Clear()
1894 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1895 #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
1896 #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
1897 #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb)
1898 #define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb)
1899 #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
1900 #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
1901 #endif
1902
1903 /* RaiseException.proto */
1904 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1905
1906 /* CallNextTpDealloc.proto */
1907 static void __Pyx_call_next_tp_dealloc(PyObject* obj, destructor current_tp_dealloc);
1908
1909 /* CallNextTpTraverse.proto */
1910 static int __Pyx_call_next_tp_traverse(PyObject* obj, visitproc v, void *a, traverseproc current_tp_traverse);
1911
1912 /* CallNextTpClear.proto */
1913 static void __Pyx_call_next_tp_clear(PyObject* obj, inquiry current_tp_dealloc);
1914
1915 /* TypeImport.proto */
1916 #ifndef __PYX_HAVE_RT_ImportType_proto
1917 #define __PYX_HAVE_RT_ImportType_proto
1918 enum __Pyx_ImportType_CheckSize {
1919 __Pyx_ImportType_CheckSize_Error = 0,
1920 __Pyx_ImportType_CheckSize_Warn = 1,
1921 __Pyx_ImportType_CheckSize_Ignore = 2
1922 };
1923 static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size);
1924 #endif
1925
1926 /* GetVTable.proto */
1927 static void* __Pyx_GetVtable(PyObject *dict);
1928
1929 /* PyObject_GenericGetAttrNoDict.proto */
1930 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1931 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
1932 #else
1933 #define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
1934 #endif
1935
1936 /* PyObject_GenericGetAttr.proto */
1937 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1938 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
1939 #else
1940 #define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
1941 #endif
1942
1943 /* SetVTable.proto */
1944 static int __Pyx_SetVtable(PyObject *dict, void *vtable);
1945
1946 /* PyErrExceptionMatches.proto */
1947 #if CYTHON_FAST_THREAD_STATE
1948 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
1949 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
1950 #else
1951 #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
1952 #endif
1953
1954 /* PyObjectGetAttrStrNoError.proto */
1955 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);
1956
1957 /* SetupReduce.proto */
1958 static int __Pyx_setup_reduce(PyObject* type_obj);
1959
1960 /* PyDictVersioning.proto */
1961 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
1962 #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1)
1963 #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag)
1964 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
1965 (version_var) = __PYX_GET_DICT_VERSION(dict);\
1966 (cache_var) = (value);
1967 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
1968 static PY_UINT64_T __pyx_dict_version = 0;\
1969 static PyObject *__pyx_dict_cached_value = NULL;\
1970 if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
1971 (VAR) = __pyx_dict_cached_value;\
1972 } else {\
1973 (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1974 __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1975 }\
1976 }
1977 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1978 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1979 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1980 #else
1981 #define __PYX_GET_DICT_VERSION(dict) (0)
1982 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
1983 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP);
1984 #endif
1985
1986 /* CLineInTraceback.proto */
1987 #ifdef CYTHON_CLINE_IN_TRACEBACK
1988 #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
1989 #else
1990 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
1991 #endif
1992
1993 /* CodeObjectCache.proto */
1994 typedef struct {
1995 PyCodeObject* code_object;
1996 int code_line;
1997 } __Pyx_CodeObjectCacheEntry;
1998 struct __Pyx_CodeObjectCache {
1999 int count;
2000 int max_count;
2001 __Pyx_CodeObjectCacheEntry* entries;
2002 };
2003 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
2004 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
2005 static PyCodeObject *__pyx_find_code_object(int code_line);
2006 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
2007
2008 /* AddTraceback.proto */
2009 static void __Pyx_AddTraceback(const char *funcname, int c_line,
2010 int py_line, const char *filename);
2011
2012 /* CIntToPy.proto */
2013 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
2014
2015 /* CIntFromPy.proto */
2016 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
2017
2018 /* CIntToPy.proto */
2019 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
2020
2021 /* CIntFromPy.proto */
2022 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
2023
2024 /* FastTypeChecks.proto */
2025 #if CYTHON_COMPILING_IN_CPYTHON
2026 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
2027 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
2028 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
2029 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
2030 #else
2031 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
2032 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
2033 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
2034 #endif
2035 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
2036
2037 /* CheckBinaryVersion.proto */
2038 static int __Pyx_check_binary_version(void);
2039
2040 /* FunctionImport.proto */
2041 static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig);
2042
2043 /* InitStrings.proto */
2044 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
2045
2046 static PyObject *__pyx_f_2av_5audio_12codeccontext_17AudioCodecContext__init(struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext *__pyx_v_self, struct AVCodecContext *__pyx_v_ptr, struct AVCodec const *__pyx_v_codec); /* proto*/
2047 static PyObject *__pyx_f_2av_5audio_12codeccontext_17AudioCodecContext__set_default_time_base(struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext *__pyx_v_self); /* proto*/
2048 static PyObject *__pyx_f_2av_5audio_12codeccontext_17AudioCodecContext__prepare_frames_for_encode(struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext *__pyx_v_self, struct __pyx_obj_2av_5frame_Frame *__pyx_v_input_frame); /* proto*/
2049 static struct __pyx_obj_2av_5frame_Frame *__pyx_f_2av_5audio_12codeccontext_17AudioCodecContext__alloc_next_frame(CYTHON_UNUSED struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext *__pyx_v_self); /* proto*/
2050 static PyObject *__pyx_f_2av_5audio_12codeccontext_17AudioCodecContext__setup_decoded_frame(struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext *__pyx_v_self, struct __pyx_obj_2av_5frame_Frame *__pyx_v_frame, struct __pyx_obj_2av_6packet_Packet *__pyx_v_packet); /* proto*/
2051
2052 /* Module declarations from 'libc.stdint' */
2053
2054 /* Module declarations from 'libav' */
2055
2056 /* Module declarations from 'av.audio.format' */
2057 static PyTypeObject *__pyx_ptype_2av_5audio_6format_AudioFormat = 0;
2058 static struct __pyx_obj_2av_5audio_6format_AudioFormat *(*__pyx_f_2av_5audio_6format_get_audio_format)(enum AVSampleFormat); /*proto*/
2059
2060 /* Module declarations from 'av.audio.layout' */
2061 static PyTypeObject *__pyx_ptype_2av_5audio_6layout_AudioLayout = 0;
2062 static PyTypeObject *__pyx_ptype_2av_5audio_6layout_AudioChannel = 0;
2063 static struct __pyx_obj_2av_5audio_6layout_AudioLayout *(*__pyx_f_2av_5audio_6layout_get_audio_layout)(int, uint64_t); /*proto*/
2064
2065 /* Module declarations from 'av.buffer' */
2066 static PyTypeObject *__pyx_ptype_2av_6buffer_Buffer = 0;
2067
2068 /* Module declarations from 'cpython.buffer' */
2069
2070 /* Module declarations from 'av.bytesource' */
2071 static PyTypeObject *__pyx_ptype_2av_10bytesource_ByteSource = 0;
2072
2073 /* Module declarations from 'av.codec.codec' */
2074 static PyTypeObject *__pyx_ptype_2av_5codec_5codec_Codec = 0;
2075
2076 /* Module declarations from 'av.codec.context' */
2077 static PyTypeObject *__pyx_ptype_2av_5codec_7context_CodecContext = 0;
2078
2079 /* Module declarations from 'av.container.streams' */
2080 static PyTypeObject *__pyx_ptype_2av_9container_7streams_StreamContainer = 0;
2081
2082 /* Module declarations from 'av.dictionary' */
2083 static PyTypeObject *__pyx_ptype_2av_10dictionary__Dictionary = 0;
2084 static struct __pyx_obj_2av_10dictionary__Dictionary *(*__pyx_f_2av_10dictionary_wrap_dictionary)(AVDictionary *); /*proto*/
2085
2086 /* Module declarations from 'av.format' */
2087 static PyTypeObject *__pyx_ptype_2av_6format_ContainerFormat = 0;
2088
2089 /* Module declarations from 'av.container.core' */
2090 static PyTypeObject *__pyx_ptype_2av_9container_4core_Container = 0;
2091
2092 /* Module declarations from 'av.stream' */
2093 static PyTypeObject *__pyx_ptype_2av_6stream_Stream = 0;
2094
2095 /* Module declarations from 'av.packet' */
2096 static PyTypeObject *__pyx_ptype_2av_6packet_Packet = 0;
2097
2098 /* Module declarations from 'av.sidedata.sidedata' */
2099 static PyTypeObject *__pyx_ptype_2av_8sidedata_8sidedata_SideData = 0;
2100 static PyTypeObject *__pyx_ptype_2av_8sidedata_8sidedata__SideDataContainer = 0;
2101
2102 /* Module declarations from 'av.frame' */
2103 static PyTypeObject *__pyx_ptype_2av_5frame_Frame = 0;
2104
2105 /* Module declarations from 'av.audio.frame' */
2106 static PyTypeObject *__pyx_ptype_2av_5audio_5frame_AudioFrame = 0;
2107 static struct __pyx_obj_2av_5audio_5frame_AudioFrame *(*__pyx_f_2av_5audio_5frame_alloc_audio_frame)(void); /*proto*/
2108
2109 /* Module declarations from 'av.audio.fifo' */
2110 static PyTypeObject *__pyx_ptype_2av_5audio_4fifo_AudioFifo = 0;
2111
2112 /* Module declarations from 'av.audio.resampler' */
2113 static PyTypeObject *__pyx_ptype_2av_5audio_9resampler_AudioResampler = 0;
2114
2115 /* Module declarations from 'av.error' */
2116 static int (*__pyx_f_2av_5error_err_check)(int, int __pyx_skip_dispatch, struct __pyx_opt_args_2av_5error_err_check *__pyx_optional_args); /*proto*/
2117
2118 /* Module declarations from 'av.audio.codeccontext' */
2119 static PyTypeObject *__pyx_ptype_2av_5audio_12codeccontext_AudioCodecContext = 0;
2120 #define __Pyx_MODULE_NAME "av.audio.codeccontext"
2121 extern int __pyx_module_is_main_av__audio__codeccontext;
2122 int __pyx_module_is_main_av__audio__codeccontext = 0;
2123
2124 /* Implementation of 'av.audio.codeccontext' */
2125 static PyObject *__pyx_builtin_TypeError;
2126 static const char __pyx_k_main[] = "__main__";
2127 static const char __pyx_k_name[] = "__name__";
2128 static const char __pyx_k_test[] = "__test__";
2129 static const char __pyx_k_append[] = "append";
2130 static const char __pyx_k_format[] = "format";
2131 static const char __pyx_k_layout[] = "layout";
2132 static const char __pyx_k_reduce[] = "__reduce__";
2133 static const char __pyx_k_getstate[] = "__getstate__";
2134 static const char __pyx_k_setstate[] = "__setstate__";
2135 static const char __pyx_k_TypeError[] = "TypeError";
2136 static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
2137 static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
2138 static const char __pyx_k_sample_rate[] = "sample_rate";
2139 static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
2140 static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
2141 static const char __pyx_k_AudioCodecContext[] = "AudioCodecContext";
2142 static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
2143 static const char __pyx_k_self_parser_self_ptr_cannot_be_c[] = "self.parser,self.ptr cannot be converted to a Python object for pickling";
2144 static PyObject *__pyx_n_s_AudioCodecContext;
2145 static PyObject *__pyx_n_s_TypeError;
2146 static PyObject *__pyx_n_s_append;
2147 static PyObject *__pyx_n_s_cline_in_traceback;
2148 static PyObject *__pyx_n_s_format;
2149 static PyObject *__pyx_n_s_getstate;
2150 static PyObject *__pyx_n_s_layout;
2151 static PyObject *__pyx_n_s_main;
2152 static PyObject *__pyx_n_s_name;
2153 static PyObject *__pyx_n_s_pyx_vtable;
2154 static PyObject *__pyx_n_s_reduce;
2155 static PyObject *__pyx_n_s_reduce_cython;
2156 static PyObject *__pyx_n_s_reduce_ex;
2157 static PyObject *__pyx_n_s_sample_rate;
2158 static PyObject *__pyx_kp_s_self_parser_self_ptr_cannot_be_c;
2159 static PyObject *__pyx_n_s_setstate;
2160 static PyObject *__pyx_n_s_setstate_cython;
2161 static PyObject *__pyx_n_s_test;
2162 static PyObject *__pyx_pf_2av_5audio_12codeccontext_17AudioCodecContext_10frame_size___get__(struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext *__pyx_v_self); /* proto */
2163 static PyObject *__pyx_pf_2av_5audio_12codeccontext_17AudioCodecContext_11sample_rate___get__(struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext *__pyx_v_self); /* proto */
2164 static int __pyx_pf_2av_5audio_12codeccontext_17AudioCodecContext_11sample_rate_2__set__(struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext *__pyx_v_self, int __pyx_v_value); /* proto */
2165 static PyObject *__pyx_pf_2av_5audio_12codeccontext_17AudioCodecContext_4rate___get__(struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext *__pyx_v_self); /* proto */
2166 static int __pyx_pf_2av_5audio_12codeccontext_17AudioCodecContext_4rate_2__set__(struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
2167 static PyObject *__pyx_pf_2av_5audio_12codeccontext_17AudioCodecContext_8channels___get__(struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext *__pyx_v_self); /* proto */
2168 static int __pyx_pf_2av_5audio_12codeccontext_17AudioCodecContext_8channels_2__set__(struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
2169 static PyObject *__pyx_pf_2av_5audio_12codeccontext_17AudioCodecContext_14channel_layout___get__(struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext *__pyx_v_self); /* proto */
2170 static PyObject *__pyx_pf_2av_5audio_12codeccontext_17AudioCodecContext_6layout___get__(struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext *__pyx_v_self); /* proto */
2171 static int __pyx_pf_2av_5audio_12codeccontext_17AudioCodecContext_6layout_2__set__(struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
2172 static PyObject *__pyx_pf_2av_5audio_12codeccontext_17AudioCodecContext_6format___get__(struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext *__pyx_v_self); /* proto */
2173 static int __pyx_pf_2av_5audio_12codeccontext_17AudioCodecContext_6format_2__set__(struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
2174 static PyObject *__pyx_pf_2av_5audio_12codeccontext_17AudioCodecContext___reduce_cython__(CYTHON_UNUSED struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext *__pyx_v_self); /* proto */
2175 static PyObject *__pyx_pf_2av_5audio_12codeccontext_17AudioCodecContext_2__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
2176 static PyObject *__pyx_tp_new_2av_5audio_12codeccontext_AudioCodecContext(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2177 static PyObject *__pyx_tuple_;
2178 static PyObject *__pyx_tuple__2;
2179 /* Late includes */
2180
2181 /* "av/audio/codeccontext.pyx":13
2182 * cdef class AudioCodecContext(CodecContext):
2183 *
2184 * cdef _init(self, lib.AVCodecContext *ptr, const lib.AVCodec *codec): # <<<<<<<<<<<<<<
2185 * CodecContext._init(self, ptr, codec)
2186 *
2187 */
2188
__pyx_f_2av_5audio_12codeccontext_17AudioCodecContext__init(struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext * __pyx_v_self,struct AVCodecContext * __pyx_v_ptr,struct AVCodec const * __pyx_v_codec)2189 static PyObject *__pyx_f_2av_5audio_12codeccontext_17AudioCodecContext__init(struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext *__pyx_v_self, struct AVCodecContext *__pyx_v_ptr, struct AVCodec const *__pyx_v_codec) {
2190 PyObject *__pyx_r = NULL;
2191 __Pyx_RefNannyDeclarations
2192 PyObject *__pyx_t_1 = NULL;
2193 int __pyx_t_2;
2194 int __pyx_t_3;
2195 uint64_t __pyx_t_4;
2196 int __pyx_lineno = 0;
2197 const char *__pyx_filename = NULL;
2198 int __pyx_clineno = 0;
2199 __Pyx_RefNannySetupContext("_init", 0);
2200
2201 /* "av/audio/codeccontext.pyx":14
2202 *
2203 * cdef _init(self, lib.AVCodecContext *ptr, const lib.AVCodec *codec):
2204 * CodecContext._init(self, ptr, codec) # <<<<<<<<<<<<<<
2205 *
2206 * # Sometimes there isn't a layout set, but there are a number of
2207 */
2208 __pyx_t_1 = __pyx_vtabptr_2av_5codec_7context_CodecContext->_init(((struct __pyx_obj_2av_5codec_7context_CodecContext *)__pyx_v_self), __pyx_v_ptr, __pyx_v_codec); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 14, __pyx_L1_error)
2209 __Pyx_GOTREF(__pyx_t_1);
2210 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2211
2212 /* "av/audio/codeccontext.pyx":20
2213 * # TODO: Put this behind `not bare_metal`.
2214 * # TODO: Do this more efficiently.
2215 * if self.ptr.channels and not self.ptr.channel_layout: # <<<<<<<<<<<<<<
2216 * self.ptr.channel_layout = get_audio_layout(self.ptr.channels, 0).layout
2217 *
2218 */
2219 __pyx_t_3 = (__pyx_v_self->__pyx_base.ptr->channels != 0);
2220 if (__pyx_t_3) {
2221 } else {
2222 __pyx_t_2 = __pyx_t_3;
2223 goto __pyx_L4_bool_binop_done;
2224 }
2225 __pyx_t_3 = ((!(__pyx_v_self->__pyx_base.ptr->channel_layout != 0)) != 0);
2226 __pyx_t_2 = __pyx_t_3;
2227 __pyx_L4_bool_binop_done:;
2228 if (__pyx_t_2) {
2229
2230 /* "av/audio/codeccontext.pyx":21
2231 * # TODO: Do this more efficiently.
2232 * if self.ptr.channels and not self.ptr.channel_layout:
2233 * self.ptr.channel_layout = get_audio_layout(self.ptr.channels, 0).layout # <<<<<<<<<<<<<<
2234 *
2235 * cdef _set_default_time_base(self):
2236 */
2237 __pyx_t_1 = ((PyObject *)__pyx_f_2av_5audio_6layout_get_audio_layout(__pyx_v_self->__pyx_base.ptr->channels, 0)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 21, __pyx_L1_error)
2238 __Pyx_GOTREF(__pyx_t_1);
2239 __pyx_t_4 = ((struct __pyx_obj_2av_5audio_6layout_AudioLayout *)__pyx_t_1)->layout;
2240 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2241 __pyx_v_self->__pyx_base.ptr->channel_layout = __pyx_t_4;
2242
2243 /* "av/audio/codeccontext.pyx":20
2244 * # TODO: Put this behind `not bare_metal`.
2245 * # TODO: Do this more efficiently.
2246 * if self.ptr.channels and not self.ptr.channel_layout: # <<<<<<<<<<<<<<
2247 * self.ptr.channel_layout = get_audio_layout(self.ptr.channels, 0).layout
2248 *
2249 */
2250 }
2251
2252 /* "av/audio/codeccontext.pyx":13
2253 * cdef class AudioCodecContext(CodecContext):
2254 *
2255 * cdef _init(self, lib.AVCodecContext *ptr, const lib.AVCodec *codec): # <<<<<<<<<<<<<<
2256 * CodecContext._init(self, ptr, codec)
2257 *
2258 */
2259
2260 /* function exit code */
2261 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2262 goto __pyx_L0;
2263 __pyx_L1_error:;
2264 __Pyx_XDECREF(__pyx_t_1);
2265 __Pyx_AddTraceback("av.audio.codeccontext.AudioCodecContext._init", __pyx_clineno, __pyx_lineno, __pyx_filename);
2266 __pyx_r = 0;
2267 __pyx_L0:;
2268 __Pyx_XGIVEREF(__pyx_r);
2269 __Pyx_RefNannyFinishContext();
2270 return __pyx_r;
2271 }
2272
2273 /* "av/audio/codeccontext.pyx":23
2274 * self.ptr.channel_layout = get_audio_layout(self.ptr.channels, 0).layout
2275 *
2276 * cdef _set_default_time_base(self): # <<<<<<<<<<<<<<
2277 * self.ptr.time_base.num = 1
2278 * self.ptr.time_base.den = self.ptr.sample_rate
2279 */
2280
__pyx_f_2av_5audio_12codeccontext_17AudioCodecContext__set_default_time_base(struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext * __pyx_v_self)2281 static PyObject *__pyx_f_2av_5audio_12codeccontext_17AudioCodecContext__set_default_time_base(struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext *__pyx_v_self) {
2282 PyObject *__pyx_r = NULL;
2283 __Pyx_RefNannyDeclarations
2284 int __pyx_t_1;
2285 __Pyx_RefNannySetupContext("_set_default_time_base", 0);
2286
2287 /* "av/audio/codeccontext.pyx":24
2288 *
2289 * cdef _set_default_time_base(self):
2290 * self.ptr.time_base.num = 1 # <<<<<<<<<<<<<<
2291 * self.ptr.time_base.den = self.ptr.sample_rate
2292 *
2293 */
2294 __pyx_v_self->__pyx_base.ptr->time_base.num = 1;
2295
2296 /* "av/audio/codeccontext.pyx":25
2297 * cdef _set_default_time_base(self):
2298 * self.ptr.time_base.num = 1
2299 * self.ptr.time_base.den = self.ptr.sample_rate # <<<<<<<<<<<<<<
2300 *
2301 * cdef _prepare_frames_for_encode(self, Frame input_frame):
2302 */
2303 __pyx_t_1 = __pyx_v_self->__pyx_base.ptr->sample_rate;
2304 __pyx_v_self->__pyx_base.ptr->time_base.den = __pyx_t_1;
2305
2306 /* "av/audio/codeccontext.pyx":23
2307 * self.ptr.channel_layout = get_audio_layout(self.ptr.channels, 0).layout
2308 *
2309 * cdef _set_default_time_base(self): # <<<<<<<<<<<<<<
2310 * self.ptr.time_base.num = 1
2311 * self.ptr.time_base.den = self.ptr.sample_rate
2312 */
2313
2314 /* function exit code */
2315 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2316 __Pyx_XGIVEREF(__pyx_r);
2317 __Pyx_RefNannyFinishContext();
2318 return __pyx_r;
2319 }
2320
2321 /* "av/audio/codeccontext.pyx":27
2322 * self.ptr.time_base.den = self.ptr.sample_rate
2323 *
2324 * cdef _prepare_frames_for_encode(self, Frame input_frame): # <<<<<<<<<<<<<<
2325 *
2326 * cdef AudioFrame frame = input_frame
2327 */
2328
__pyx_f_2av_5audio_12codeccontext_17AudioCodecContext__prepare_frames_for_encode(struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext * __pyx_v_self,struct __pyx_obj_2av_5frame_Frame * __pyx_v_input_frame)2329 static PyObject *__pyx_f_2av_5audio_12codeccontext_17AudioCodecContext__prepare_frames_for_encode(struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext *__pyx_v_self, struct __pyx_obj_2av_5frame_Frame *__pyx_v_input_frame) {
2330 struct __pyx_obj_2av_5audio_5frame_AudioFrame *__pyx_v_frame = 0;
2331 int __pyx_v_is_flushing;
2332 int __pyx_v_use_fifo;
2333 PyObject *__pyx_v_frames = NULL;
2334 PyObject *__pyx_r = NULL;
2335 __Pyx_RefNannyDeclarations
2336 PyObject *__pyx_t_1 = NULL;
2337 int __pyx_t_2;
2338 int __pyx_t_3;
2339 PyObject *__pyx_t_4 = NULL;
2340 PyObject *__pyx_t_5 = NULL;
2341 PyObject *__pyx_t_6 = NULL;
2342 struct __pyx_opt_args_2av_5audio_4fifo_9AudioFifo_read_many __pyx_t_7;
2343 int __pyx_t_8;
2344 int __pyx_lineno = 0;
2345 const char *__pyx_filename = NULL;
2346 int __pyx_clineno = 0;
2347 __Pyx_RefNannySetupContext("_prepare_frames_for_encode", 0);
2348
2349 /* "av/audio/codeccontext.pyx":29
2350 * cdef _prepare_frames_for_encode(self, Frame input_frame):
2351 *
2352 * cdef AudioFrame frame = input_frame # <<<<<<<<<<<<<<
2353 *
2354 * # Resample. A None frame will flush the resampler, and then the fifo (if used).
2355 */
2356 if (!(likely(((((PyObject *)__pyx_v_input_frame)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_input_frame), __pyx_ptype_2av_5audio_5frame_AudioFrame))))) __PYX_ERR(1, 29, __pyx_L1_error)
2357 __pyx_t_1 = ((PyObject *)__pyx_v_input_frame);
2358 __Pyx_INCREF(__pyx_t_1);
2359 __pyx_v_frame = ((struct __pyx_obj_2av_5audio_5frame_AudioFrame *)__pyx_t_1);
2360 __pyx_t_1 = 0;
2361
2362 /* "av/audio/codeccontext.pyx":34
2363 * # Note that the resampler will simply return an input frame if there is
2364 * # no resampling to be done. The control flow was just a little easier this way.
2365 * if not self.resampler: # <<<<<<<<<<<<<<
2366 * self.resampler = AudioResampler(
2367 * self.format,
2368 */
2369 __pyx_t_2 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_self->resampler)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(1, 34, __pyx_L1_error)
2370 __pyx_t_3 = ((!__pyx_t_2) != 0);
2371 if (__pyx_t_3) {
2372
2373 /* "av/audio/codeccontext.pyx":36
2374 * if not self.resampler:
2375 * self.resampler = AudioResampler(
2376 * self.format, # <<<<<<<<<<<<<<
2377 * self.layout,
2378 * self.ptr.sample_rate
2379 */
2380 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_format); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 36, __pyx_L1_error)
2381 __Pyx_GOTREF(__pyx_t_1);
2382
2383 /* "av/audio/codeccontext.pyx":37
2384 * self.resampler = AudioResampler(
2385 * self.format,
2386 * self.layout, # <<<<<<<<<<<<<<
2387 * self.ptr.sample_rate
2388 * )
2389 */
2390 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_layout); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 37, __pyx_L1_error)
2391 __Pyx_GOTREF(__pyx_t_4);
2392
2393 /* "av/audio/codeccontext.pyx":38
2394 * self.format,
2395 * self.layout,
2396 * self.ptr.sample_rate # <<<<<<<<<<<<<<
2397 * )
2398 * frame = self.resampler.resample(frame)
2399 */
2400 __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_self->__pyx_base.ptr->sample_rate); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 38, __pyx_L1_error)
2401 __Pyx_GOTREF(__pyx_t_5);
2402
2403 /* "av/audio/codeccontext.pyx":35
2404 * # no resampling to be done. The control flow was just a little easier this way.
2405 * if not self.resampler:
2406 * self.resampler = AudioResampler( # <<<<<<<<<<<<<<
2407 * self.format,
2408 * self.layout,
2409 */
2410 __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 35, __pyx_L1_error)
2411 __Pyx_GOTREF(__pyx_t_6);
2412 __Pyx_GIVEREF(__pyx_t_1);
2413 PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1);
2414 __Pyx_GIVEREF(__pyx_t_4);
2415 PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_4);
2416 __Pyx_GIVEREF(__pyx_t_5);
2417 PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_5);
2418 __pyx_t_1 = 0;
2419 __pyx_t_4 = 0;
2420 __pyx_t_5 = 0;
2421 __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_2av_5audio_9resampler_AudioResampler), __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 35, __pyx_L1_error)
2422 __Pyx_GOTREF(__pyx_t_5);
2423 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
2424 __Pyx_GIVEREF(__pyx_t_5);
2425 __Pyx_GOTREF(__pyx_v_self->resampler);
2426 __Pyx_DECREF(((PyObject *)__pyx_v_self->resampler));
2427 __pyx_v_self->resampler = ((struct __pyx_obj_2av_5audio_9resampler_AudioResampler *)__pyx_t_5);
2428 __pyx_t_5 = 0;
2429
2430 /* "av/audio/codeccontext.pyx":34
2431 * # Note that the resampler will simply return an input frame if there is
2432 * # no resampling to be done. The control flow was just a little easier this way.
2433 * if not self.resampler: # <<<<<<<<<<<<<<
2434 * self.resampler = AudioResampler(
2435 * self.format,
2436 */
2437 }
2438
2439 /* "av/audio/codeccontext.pyx":40
2440 * self.ptr.sample_rate
2441 * )
2442 * frame = self.resampler.resample(frame) # <<<<<<<<<<<<<<
2443 *
2444 * cdef bint is_flushing = input_frame is None
2445 */
2446 __pyx_t_5 = ((struct __pyx_vtabstruct_2av_5audio_9resampler_AudioResampler *)__pyx_v_self->resampler->__pyx_vtab)->resample(__pyx_v_self->resampler, __pyx_v_frame, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 40, __pyx_L1_error)
2447 __Pyx_GOTREF(__pyx_t_5);
2448 if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_2av_5audio_5frame_AudioFrame))))) __PYX_ERR(1, 40, __pyx_L1_error)
2449 __Pyx_DECREF_SET(__pyx_v_frame, ((struct __pyx_obj_2av_5audio_5frame_AudioFrame *)__pyx_t_5));
2450 __pyx_t_5 = 0;
2451
2452 /* "av/audio/codeccontext.pyx":42
2453 * frame = self.resampler.resample(frame)
2454 *
2455 * cdef bint is_flushing = input_frame is None # <<<<<<<<<<<<<<
2456 * cdef bint use_fifo = not (self.ptr.codec.capabilities & lib.AV_CODEC_CAP_VARIABLE_FRAME_SIZE)
2457 *
2458 */
2459 __pyx_t_3 = (((PyObject *)__pyx_v_input_frame) == Py_None);
2460 __pyx_v_is_flushing = __pyx_t_3;
2461
2462 /* "av/audio/codeccontext.pyx":43
2463 *
2464 * cdef bint is_flushing = input_frame is None
2465 * cdef bint use_fifo = not (self.ptr.codec.capabilities & lib.AV_CODEC_CAP_VARIABLE_FRAME_SIZE) # <<<<<<<<<<<<<<
2466 *
2467 * if use_fifo:
2468 */
2469 __pyx_v_use_fifo = (!((__pyx_v_self->__pyx_base.ptr->codec->capabilities & AV_CODEC_CAP_VARIABLE_FRAME_SIZE) != 0));
2470
2471 /* "av/audio/codeccontext.pyx":45
2472 * cdef bint use_fifo = not (self.ptr.codec.capabilities & lib.AV_CODEC_CAP_VARIABLE_FRAME_SIZE)
2473 *
2474 * if use_fifo: # <<<<<<<<<<<<<<
2475 * if not self.fifo:
2476 * self.fifo = AudioFifo()
2477 */
2478 __pyx_t_3 = (__pyx_v_use_fifo != 0);
2479 if (__pyx_t_3) {
2480
2481 /* "av/audio/codeccontext.pyx":46
2482 *
2483 * if use_fifo:
2484 * if not self.fifo: # <<<<<<<<<<<<<<
2485 * self.fifo = AudioFifo()
2486 * if frame is not None:
2487 */
2488 __pyx_t_3 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_self->fifo)); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(1, 46, __pyx_L1_error)
2489 __pyx_t_2 = ((!__pyx_t_3) != 0);
2490 if (__pyx_t_2) {
2491
2492 /* "av/audio/codeccontext.pyx":47
2493 * if use_fifo:
2494 * if not self.fifo:
2495 * self.fifo = AudioFifo() # <<<<<<<<<<<<<<
2496 * if frame is not None:
2497 * self.fifo.write(frame)
2498 */
2499 __pyx_t_5 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_2av_5audio_4fifo_AudioFifo)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 47, __pyx_L1_error)
2500 __Pyx_GOTREF(__pyx_t_5);
2501 __Pyx_GIVEREF(__pyx_t_5);
2502 __Pyx_GOTREF(__pyx_v_self->fifo);
2503 __Pyx_DECREF(((PyObject *)__pyx_v_self->fifo));
2504 __pyx_v_self->fifo = ((struct __pyx_obj_2av_5audio_4fifo_AudioFifo *)__pyx_t_5);
2505 __pyx_t_5 = 0;
2506
2507 /* "av/audio/codeccontext.pyx":46
2508 *
2509 * if use_fifo:
2510 * if not self.fifo: # <<<<<<<<<<<<<<
2511 * self.fifo = AudioFifo()
2512 * if frame is not None:
2513 */
2514 }
2515
2516 /* "av/audio/codeccontext.pyx":48
2517 * if not self.fifo:
2518 * self.fifo = AudioFifo()
2519 * if frame is not None: # <<<<<<<<<<<<<<
2520 * self.fifo.write(frame)
2521 * frames = self.fifo.read_many(self.ptr.frame_size, partial=is_flushing)
2522 */
2523 __pyx_t_2 = (((PyObject *)__pyx_v_frame) != Py_None);
2524 __pyx_t_3 = (__pyx_t_2 != 0);
2525 if (__pyx_t_3) {
2526
2527 /* "av/audio/codeccontext.pyx":49
2528 * self.fifo = AudioFifo()
2529 * if frame is not None:
2530 * self.fifo.write(frame) # <<<<<<<<<<<<<<
2531 * frames = self.fifo.read_many(self.ptr.frame_size, partial=is_flushing)
2532 * if is_flushing:
2533 */
2534 __pyx_t_5 = ((struct __pyx_vtabstruct_2av_5audio_4fifo_AudioFifo *)__pyx_v_self->fifo->__pyx_vtab)->write(__pyx_v_self->fifo, __pyx_v_frame, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 49, __pyx_L1_error)
2535 __Pyx_GOTREF(__pyx_t_5);
2536 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2537
2538 /* "av/audio/codeccontext.pyx":48
2539 * if not self.fifo:
2540 * self.fifo = AudioFifo()
2541 * if frame is not None: # <<<<<<<<<<<<<<
2542 * self.fifo.write(frame)
2543 * frames = self.fifo.read_many(self.ptr.frame_size, partial=is_flushing)
2544 */
2545 }
2546
2547 /* "av/audio/codeccontext.pyx":50
2548 * if frame is not None:
2549 * self.fifo.write(frame)
2550 * frames = self.fifo.read_many(self.ptr.frame_size, partial=is_flushing) # <<<<<<<<<<<<<<
2551 * if is_flushing:
2552 * frames.append(None)
2553 */
2554 __pyx_t_7.__pyx_n = 1;
2555 __pyx_t_7.partial = __pyx_v_is_flushing;
2556 __pyx_t_5 = ((struct __pyx_vtabstruct_2av_5audio_4fifo_AudioFifo *)__pyx_v_self->fifo->__pyx_vtab)->read_many(__pyx_v_self->fifo, __pyx_v_self->__pyx_base.ptr->frame_size, 0, &__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 50, __pyx_L1_error)
2557 __Pyx_GOTREF(__pyx_t_5);
2558 __pyx_v_frames = __pyx_t_5;
2559 __pyx_t_5 = 0;
2560
2561 /* "av/audio/codeccontext.pyx":51
2562 * self.fifo.write(frame)
2563 * frames = self.fifo.read_many(self.ptr.frame_size, partial=is_flushing)
2564 * if is_flushing: # <<<<<<<<<<<<<<
2565 * frames.append(None)
2566 * else:
2567 */
2568 __pyx_t_3 = (__pyx_v_is_flushing != 0);
2569 if (__pyx_t_3) {
2570
2571 /* "av/audio/codeccontext.pyx":52
2572 * frames = self.fifo.read_many(self.ptr.frame_size, partial=is_flushing)
2573 * if is_flushing:
2574 * frames.append(None) # <<<<<<<<<<<<<<
2575 * else:
2576 * frames = [frame]
2577 */
2578 __pyx_t_8 = __Pyx_PyObject_Append(__pyx_v_frames, Py_None); if (unlikely(__pyx_t_8 == ((int)-1))) __PYX_ERR(1, 52, __pyx_L1_error)
2579
2580 /* "av/audio/codeccontext.pyx":51
2581 * self.fifo.write(frame)
2582 * frames = self.fifo.read_many(self.ptr.frame_size, partial=is_flushing)
2583 * if is_flushing: # <<<<<<<<<<<<<<
2584 * frames.append(None)
2585 * else:
2586 */
2587 }
2588
2589 /* "av/audio/codeccontext.pyx":45
2590 * cdef bint use_fifo = not (self.ptr.codec.capabilities & lib.AV_CODEC_CAP_VARIABLE_FRAME_SIZE)
2591 *
2592 * if use_fifo: # <<<<<<<<<<<<<<
2593 * if not self.fifo:
2594 * self.fifo = AudioFifo()
2595 */
2596 goto __pyx_L4;
2597 }
2598
2599 /* "av/audio/codeccontext.pyx":54
2600 * frames.append(None)
2601 * else:
2602 * frames = [frame] # <<<<<<<<<<<<<<
2603 *
2604 * return frames
2605 */
2606 /*else*/ {
2607 __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 54, __pyx_L1_error)
2608 __Pyx_GOTREF(__pyx_t_5);
2609 __Pyx_INCREF(((PyObject *)__pyx_v_frame));
2610 __Pyx_GIVEREF(((PyObject *)__pyx_v_frame));
2611 PyList_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_frame));
2612 __pyx_v_frames = __pyx_t_5;
2613 __pyx_t_5 = 0;
2614 }
2615 __pyx_L4:;
2616
2617 /* "av/audio/codeccontext.pyx":56
2618 * frames = [frame]
2619 *
2620 * return frames # <<<<<<<<<<<<<<
2621 *
2622 * cdef Frame _alloc_next_frame(self):
2623 */
2624 __Pyx_XDECREF(__pyx_r);
2625 __Pyx_INCREF(__pyx_v_frames);
2626 __pyx_r = __pyx_v_frames;
2627 goto __pyx_L0;
2628
2629 /* "av/audio/codeccontext.pyx":27
2630 * self.ptr.time_base.den = self.ptr.sample_rate
2631 *
2632 * cdef _prepare_frames_for_encode(self, Frame input_frame): # <<<<<<<<<<<<<<
2633 *
2634 * cdef AudioFrame frame = input_frame
2635 */
2636
2637 /* function exit code */
2638 __pyx_L1_error:;
2639 __Pyx_XDECREF(__pyx_t_1);
2640 __Pyx_XDECREF(__pyx_t_4);
2641 __Pyx_XDECREF(__pyx_t_5);
2642 __Pyx_XDECREF(__pyx_t_6);
2643 __Pyx_AddTraceback("av.audio.codeccontext.AudioCodecContext._prepare_frames_for_encode", __pyx_clineno, __pyx_lineno, __pyx_filename);
2644 __pyx_r = 0;
2645 __pyx_L0:;
2646 __Pyx_XDECREF((PyObject *)__pyx_v_frame);
2647 __Pyx_XDECREF(__pyx_v_frames);
2648 __Pyx_XGIVEREF(__pyx_r);
2649 __Pyx_RefNannyFinishContext();
2650 return __pyx_r;
2651 }
2652
2653 /* "av/audio/codeccontext.pyx":58
2654 * return frames
2655 *
2656 * cdef Frame _alloc_next_frame(self): # <<<<<<<<<<<<<<
2657 * return alloc_audio_frame()
2658 *
2659 */
2660
__pyx_f_2av_5audio_12codeccontext_17AudioCodecContext__alloc_next_frame(CYTHON_UNUSED struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext * __pyx_v_self)2661 static struct __pyx_obj_2av_5frame_Frame *__pyx_f_2av_5audio_12codeccontext_17AudioCodecContext__alloc_next_frame(CYTHON_UNUSED struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext *__pyx_v_self) {
2662 struct __pyx_obj_2av_5frame_Frame *__pyx_r = NULL;
2663 __Pyx_RefNannyDeclarations
2664 PyObject *__pyx_t_1 = NULL;
2665 int __pyx_lineno = 0;
2666 const char *__pyx_filename = NULL;
2667 int __pyx_clineno = 0;
2668 __Pyx_RefNannySetupContext("_alloc_next_frame", 0);
2669
2670 /* "av/audio/codeccontext.pyx":59
2671 *
2672 * cdef Frame _alloc_next_frame(self):
2673 * return alloc_audio_frame() # <<<<<<<<<<<<<<
2674 *
2675 * cdef _setup_decoded_frame(self, Frame frame, Packet packet):
2676 */
2677 __Pyx_XDECREF(((PyObject *)__pyx_r));
2678 __pyx_t_1 = ((PyObject *)__pyx_f_2av_5audio_5frame_alloc_audio_frame()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 59, __pyx_L1_error)
2679 __Pyx_GOTREF(__pyx_t_1);
2680 __pyx_r = ((struct __pyx_obj_2av_5frame_Frame *)__pyx_t_1);
2681 __pyx_t_1 = 0;
2682 goto __pyx_L0;
2683
2684 /* "av/audio/codeccontext.pyx":58
2685 * return frames
2686 *
2687 * cdef Frame _alloc_next_frame(self): # <<<<<<<<<<<<<<
2688 * return alloc_audio_frame()
2689 *
2690 */
2691
2692 /* function exit code */
2693 __pyx_L1_error:;
2694 __Pyx_XDECREF(__pyx_t_1);
2695 __Pyx_AddTraceback("av.audio.codeccontext.AudioCodecContext._alloc_next_frame", __pyx_clineno, __pyx_lineno, __pyx_filename);
2696 __pyx_r = 0;
2697 __pyx_L0:;
2698 __Pyx_XGIVEREF((PyObject *)__pyx_r);
2699 __Pyx_RefNannyFinishContext();
2700 return __pyx_r;
2701 }
2702
2703 /* "av/audio/codeccontext.pyx":61
2704 * return alloc_audio_frame()
2705 *
2706 * cdef _setup_decoded_frame(self, Frame frame, Packet packet): # <<<<<<<<<<<<<<
2707 * CodecContext._setup_decoded_frame(self, frame, packet)
2708 * cdef AudioFrame aframe = frame
2709 */
2710
__pyx_f_2av_5audio_12codeccontext_17AudioCodecContext__setup_decoded_frame(struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext * __pyx_v_self,struct __pyx_obj_2av_5frame_Frame * __pyx_v_frame,struct __pyx_obj_2av_6packet_Packet * __pyx_v_packet)2711 static PyObject *__pyx_f_2av_5audio_12codeccontext_17AudioCodecContext__setup_decoded_frame(struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext *__pyx_v_self, struct __pyx_obj_2av_5frame_Frame *__pyx_v_frame, struct __pyx_obj_2av_6packet_Packet *__pyx_v_packet) {
2712 struct __pyx_obj_2av_5audio_5frame_AudioFrame *__pyx_v_aframe = 0;
2713 PyObject *__pyx_r = NULL;
2714 __Pyx_RefNannyDeclarations
2715 PyObject *__pyx_t_1 = NULL;
2716 int __pyx_lineno = 0;
2717 const char *__pyx_filename = NULL;
2718 int __pyx_clineno = 0;
2719 __Pyx_RefNannySetupContext("_setup_decoded_frame", 0);
2720
2721 /* "av/audio/codeccontext.pyx":62
2722 *
2723 * cdef _setup_decoded_frame(self, Frame frame, Packet packet):
2724 * CodecContext._setup_decoded_frame(self, frame, packet) # <<<<<<<<<<<<<<
2725 * cdef AudioFrame aframe = frame
2726 * aframe._init_user_attributes()
2727 */
2728 __pyx_t_1 = __pyx_vtabptr_2av_5codec_7context_CodecContext->_setup_decoded_frame(((struct __pyx_obj_2av_5codec_7context_CodecContext *)__pyx_v_self), __pyx_v_frame, __pyx_v_packet); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 62, __pyx_L1_error)
2729 __Pyx_GOTREF(__pyx_t_1);
2730 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2731
2732 /* "av/audio/codeccontext.pyx":63
2733 * cdef _setup_decoded_frame(self, Frame frame, Packet packet):
2734 * CodecContext._setup_decoded_frame(self, frame, packet)
2735 * cdef AudioFrame aframe = frame # <<<<<<<<<<<<<<
2736 * aframe._init_user_attributes()
2737 *
2738 */
2739 if (!(likely(((((PyObject *)__pyx_v_frame)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_v_frame), __pyx_ptype_2av_5audio_5frame_AudioFrame))))) __PYX_ERR(1, 63, __pyx_L1_error)
2740 __pyx_t_1 = ((PyObject *)__pyx_v_frame);
2741 __Pyx_INCREF(__pyx_t_1);
2742 __pyx_v_aframe = ((struct __pyx_obj_2av_5audio_5frame_AudioFrame *)__pyx_t_1);
2743 __pyx_t_1 = 0;
2744
2745 /* "av/audio/codeccontext.pyx":64
2746 * CodecContext._setup_decoded_frame(self, frame, packet)
2747 * cdef AudioFrame aframe = frame
2748 * aframe._init_user_attributes() # <<<<<<<<<<<<<<
2749 *
2750 * property frame_size:
2751 */
2752 __pyx_t_1 = ((struct __pyx_vtabstruct_2av_5audio_5frame_AudioFrame *)__pyx_v_aframe->__pyx_base.__pyx_vtab)->__pyx_base._init_user_attributes(((struct __pyx_obj_2av_5frame_Frame *)__pyx_v_aframe)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 64, __pyx_L1_error)
2753 __Pyx_GOTREF(__pyx_t_1);
2754 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2755
2756 /* "av/audio/codeccontext.pyx":61
2757 * return alloc_audio_frame()
2758 *
2759 * cdef _setup_decoded_frame(self, Frame frame, Packet packet): # <<<<<<<<<<<<<<
2760 * CodecContext._setup_decoded_frame(self, frame, packet)
2761 * cdef AudioFrame aframe = frame
2762 */
2763
2764 /* function exit code */
2765 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2766 goto __pyx_L0;
2767 __pyx_L1_error:;
2768 __Pyx_XDECREF(__pyx_t_1);
2769 __Pyx_AddTraceback("av.audio.codeccontext.AudioCodecContext._setup_decoded_frame", __pyx_clineno, __pyx_lineno, __pyx_filename);
2770 __pyx_r = 0;
2771 __pyx_L0:;
2772 __Pyx_XDECREF((PyObject *)__pyx_v_aframe);
2773 __Pyx_XGIVEREF(__pyx_r);
2774 __Pyx_RefNannyFinishContext();
2775 return __pyx_r;
2776 }
2777
2778 /* "av/audio/codeccontext.pyx":72
2779 * :type: int
2780 * """
2781 * def __get__(self): return self.ptr.frame_size # <<<<<<<<<<<<<<
2782 *
2783 * property sample_rate:
2784 */
2785
2786 /* Python wrapper */
2787 static PyObject *__pyx_pw_2av_5audio_12codeccontext_17AudioCodecContext_10frame_size_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_2av_5audio_12codeccontext_17AudioCodecContext_10frame_size_1__get__(PyObject * __pyx_v_self)2788 static PyObject *__pyx_pw_2av_5audio_12codeccontext_17AudioCodecContext_10frame_size_1__get__(PyObject *__pyx_v_self) {
2789 PyObject *__pyx_r = 0;
2790 __Pyx_RefNannyDeclarations
2791 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
2792 __pyx_r = __pyx_pf_2av_5audio_12codeccontext_17AudioCodecContext_10frame_size___get__(((struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext *)__pyx_v_self));
2793
2794 /* function exit code */
2795 __Pyx_RefNannyFinishContext();
2796 return __pyx_r;
2797 }
2798
__pyx_pf_2av_5audio_12codeccontext_17AudioCodecContext_10frame_size___get__(struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext * __pyx_v_self)2799 static PyObject *__pyx_pf_2av_5audio_12codeccontext_17AudioCodecContext_10frame_size___get__(struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext *__pyx_v_self) {
2800 PyObject *__pyx_r = NULL;
2801 __Pyx_RefNannyDeclarations
2802 PyObject *__pyx_t_1 = NULL;
2803 int __pyx_lineno = 0;
2804 const char *__pyx_filename = NULL;
2805 int __pyx_clineno = 0;
2806 __Pyx_RefNannySetupContext("__get__", 0);
2807 __Pyx_XDECREF(__pyx_r);
2808 __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->__pyx_base.ptr->frame_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 72, __pyx_L1_error)
2809 __Pyx_GOTREF(__pyx_t_1);
2810 __pyx_r = __pyx_t_1;
2811 __pyx_t_1 = 0;
2812 goto __pyx_L0;
2813
2814 /* function exit code */
2815 __pyx_L1_error:;
2816 __Pyx_XDECREF(__pyx_t_1);
2817 __Pyx_AddTraceback("av.audio.codeccontext.AudioCodecContext.frame_size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2818 __pyx_r = NULL;
2819 __pyx_L0:;
2820 __Pyx_XGIVEREF(__pyx_r);
2821 __Pyx_RefNannyFinishContext();
2822 return __pyx_r;
2823 }
2824
2825 /* "av/audio/codeccontext.pyx":80
2826 * :type: int
2827 * """
2828 * def __get__(self): # <<<<<<<<<<<<<<
2829 * return self.ptr.sample_rate
2830 *
2831 */
2832
2833 /* Python wrapper */
2834 static PyObject *__pyx_pw_2av_5audio_12codeccontext_17AudioCodecContext_11sample_rate_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_2av_5audio_12codeccontext_17AudioCodecContext_11sample_rate_1__get__(PyObject * __pyx_v_self)2835 static PyObject *__pyx_pw_2av_5audio_12codeccontext_17AudioCodecContext_11sample_rate_1__get__(PyObject *__pyx_v_self) {
2836 PyObject *__pyx_r = 0;
2837 __Pyx_RefNannyDeclarations
2838 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
2839 __pyx_r = __pyx_pf_2av_5audio_12codeccontext_17AudioCodecContext_11sample_rate___get__(((struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext *)__pyx_v_self));
2840
2841 /* function exit code */
2842 __Pyx_RefNannyFinishContext();
2843 return __pyx_r;
2844 }
2845
__pyx_pf_2av_5audio_12codeccontext_17AudioCodecContext_11sample_rate___get__(struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext * __pyx_v_self)2846 static PyObject *__pyx_pf_2av_5audio_12codeccontext_17AudioCodecContext_11sample_rate___get__(struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext *__pyx_v_self) {
2847 PyObject *__pyx_r = NULL;
2848 __Pyx_RefNannyDeclarations
2849 PyObject *__pyx_t_1 = NULL;
2850 int __pyx_lineno = 0;
2851 const char *__pyx_filename = NULL;
2852 int __pyx_clineno = 0;
2853 __Pyx_RefNannySetupContext("__get__", 0);
2854
2855 /* "av/audio/codeccontext.pyx":81
2856 * """
2857 * def __get__(self):
2858 * return self.ptr.sample_rate # <<<<<<<<<<<<<<
2859 *
2860 * def __set__(self, int value):
2861 */
2862 __Pyx_XDECREF(__pyx_r);
2863 __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->__pyx_base.ptr->sample_rate); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 81, __pyx_L1_error)
2864 __Pyx_GOTREF(__pyx_t_1);
2865 __pyx_r = __pyx_t_1;
2866 __pyx_t_1 = 0;
2867 goto __pyx_L0;
2868
2869 /* "av/audio/codeccontext.pyx":80
2870 * :type: int
2871 * """
2872 * def __get__(self): # <<<<<<<<<<<<<<
2873 * return self.ptr.sample_rate
2874 *
2875 */
2876
2877 /* function exit code */
2878 __pyx_L1_error:;
2879 __Pyx_XDECREF(__pyx_t_1);
2880 __Pyx_AddTraceback("av.audio.codeccontext.AudioCodecContext.sample_rate.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2881 __pyx_r = NULL;
2882 __pyx_L0:;
2883 __Pyx_XGIVEREF(__pyx_r);
2884 __Pyx_RefNannyFinishContext();
2885 return __pyx_r;
2886 }
2887
2888 /* "av/audio/codeccontext.pyx":83
2889 * return self.ptr.sample_rate
2890 *
2891 * def __set__(self, int value): # <<<<<<<<<<<<<<
2892 * self.ptr.sample_rate = value
2893 *
2894 */
2895
2896 /* Python wrapper */
2897 static int __pyx_pw_2av_5audio_12codeccontext_17AudioCodecContext_11sample_rate_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_value); /*proto*/
__pyx_pw_2av_5audio_12codeccontext_17AudioCodecContext_11sample_rate_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_arg_value)2898 static int __pyx_pw_2av_5audio_12codeccontext_17AudioCodecContext_11sample_rate_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_value) {
2899 int __pyx_v_value;
2900 int __pyx_lineno = 0;
2901 const char *__pyx_filename = NULL;
2902 int __pyx_clineno = 0;
2903 int __pyx_r;
2904 __Pyx_RefNannyDeclarations
2905 __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
2906 assert(__pyx_arg_value); {
2907 __pyx_v_value = __Pyx_PyInt_As_int(__pyx_arg_value); if (unlikely((__pyx_v_value == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 83, __pyx_L3_error)
2908 }
2909 goto __pyx_L4_argument_unpacking_done;
2910 __pyx_L3_error:;
2911 __Pyx_AddTraceback("av.audio.codeccontext.AudioCodecContext.sample_rate.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2912 __Pyx_RefNannyFinishContext();
2913 return -1;
2914 __pyx_L4_argument_unpacking_done:;
2915 __pyx_r = __pyx_pf_2av_5audio_12codeccontext_17AudioCodecContext_11sample_rate_2__set__(((struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext *)__pyx_v_self), ((int)__pyx_v_value));
2916
2917 /* function exit code */
2918 __Pyx_RefNannyFinishContext();
2919 return __pyx_r;
2920 }
2921
__pyx_pf_2av_5audio_12codeccontext_17AudioCodecContext_11sample_rate_2__set__(struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext * __pyx_v_self,int __pyx_v_value)2922 static int __pyx_pf_2av_5audio_12codeccontext_17AudioCodecContext_11sample_rate_2__set__(struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext *__pyx_v_self, int __pyx_v_value) {
2923 int __pyx_r;
2924 __Pyx_RefNannyDeclarations
2925 __Pyx_RefNannySetupContext("__set__", 0);
2926
2927 /* "av/audio/codeccontext.pyx":84
2928 *
2929 * def __set__(self, int value):
2930 * self.ptr.sample_rate = value # <<<<<<<<<<<<<<
2931 *
2932 * property rate:
2933 */
2934 __pyx_v_self->__pyx_base.ptr->sample_rate = __pyx_v_value;
2935
2936 /* "av/audio/codeccontext.pyx":83
2937 * return self.ptr.sample_rate
2938 *
2939 * def __set__(self, int value): # <<<<<<<<<<<<<<
2940 * self.ptr.sample_rate = value
2941 *
2942 */
2943
2944 /* function exit code */
2945 __pyx_r = 0;
2946 __Pyx_RefNannyFinishContext();
2947 return __pyx_r;
2948 }
2949
2950 /* "av/audio/codeccontext.pyx":88
2951 * property rate:
2952 * """Another name for :attr:`sample_rate`."""
2953 * def __get__(self): # <<<<<<<<<<<<<<
2954 * return self.sample_rate
2955 *
2956 */
2957
2958 /* Python wrapper */
2959 static PyObject *__pyx_pw_2av_5audio_12codeccontext_17AudioCodecContext_4rate_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_2av_5audio_12codeccontext_17AudioCodecContext_4rate_1__get__(PyObject * __pyx_v_self)2960 static PyObject *__pyx_pw_2av_5audio_12codeccontext_17AudioCodecContext_4rate_1__get__(PyObject *__pyx_v_self) {
2961 PyObject *__pyx_r = 0;
2962 __Pyx_RefNannyDeclarations
2963 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
2964 __pyx_r = __pyx_pf_2av_5audio_12codeccontext_17AudioCodecContext_4rate___get__(((struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext *)__pyx_v_self));
2965
2966 /* function exit code */
2967 __Pyx_RefNannyFinishContext();
2968 return __pyx_r;
2969 }
2970
__pyx_pf_2av_5audio_12codeccontext_17AudioCodecContext_4rate___get__(struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext * __pyx_v_self)2971 static PyObject *__pyx_pf_2av_5audio_12codeccontext_17AudioCodecContext_4rate___get__(struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext *__pyx_v_self) {
2972 PyObject *__pyx_r = NULL;
2973 __Pyx_RefNannyDeclarations
2974 PyObject *__pyx_t_1 = NULL;
2975 int __pyx_lineno = 0;
2976 const char *__pyx_filename = NULL;
2977 int __pyx_clineno = 0;
2978 __Pyx_RefNannySetupContext("__get__", 0);
2979
2980 /* "av/audio/codeccontext.pyx":89
2981 * """Another name for :attr:`sample_rate`."""
2982 * def __get__(self):
2983 * return self.sample_rate # <<<<<<<<<<<<<<
2984 *
2985 * def __set__(self, value):
2986 */
2987 __Pyx_XDECREF(__pyx_r);
2988 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_sample_rate); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 89, __pyx_L1_error)
2989 __Pyx_GOTREF(__pyx_t_1);
2990 __pyx_r = __pyx_t_1;
2991 __pyx_t_1 = 0;
2992 goto __pyx_L0;
2993
2994 /* "av/audio/codeccontext.pyx":88
2995 * property rate:
2996 * """Another name for :attr:`sample_rate`."""
2997 * def __get__(self): # <<<<<<<<<<<<<<
2998 * return self.sample_rate
2999 *
3000 */
3001
3002 /* function exit code */
3003 __pyx_L1_error:;
3004 __Pyx_XDECREF(__pyx_t_1);
3005 __Pyx_AddTraceback("av.audio.codeccontext.AudioCodecContext.rate.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3006 __pyx_r = NULL;
3007 __pyx_L0:;
3008 __Pyx_XGIVEREF(__pyx_r);
3009 __Pyx_RefNannyFinishContext();
3010 return __pyx_r;
3011 }
3012
3013 /* "av/audio/codeccontext.pyx":91
3014 * return self.sample_rate
3015 *
3016 * def __set__(self, value): # <<<<<<<<<<<<<<
3017 * self.sample_rate = value
3018 *
3019 */
3020
3021 /* Python wrapper */
3022 static int __pyx_pw_2av_5audio_12codeccontext_17AudioCodecContext_4rate_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
__pyx_pw_2av_5audio_12codeccontext_17AudioCodecContext_4rate_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_v_value)3023 static int __pyx_pw_2av_5audio_12codeccontext_17AudioCodecContext_4rate_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
3024 int __pyx_r;
3025 __Pyx_RefNannyDeclarations
3026 __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
3027 __pyx_r = __pyx_pf_2av_5audio_12codeccontext_17AudioCodecContext_4rate_2__set__(((struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext *)__pyx_v_self), ((PyObject *)__pyx_v_value));
3028
3029 /* function exit code */
3030 __Pyx_RefNannyFinishContext();
3031 return __pyx_r;
3032 }
3033
__pyx_pf_2av_5audio_12codeccontext_17AudioCodecContext_4rate_2__set__(struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext * __pyx_v_self,PyObject * __pyx_v_value)3034 static int __pyx_pf_2av_5audio_12codeccontext_17AudioCodecContext_4rate_2__set__(struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext *__pyx_v_self, PyObject *__pyx_v_value) {
3035 int __pyx_r;
3036 __Pyx_RefNannyDeclarations
3037 int __pyx_lineno = 0;
3038 const char *__pyx_filename = NULL;
3039 int __pyx_clineno = 0;
3040 __Pyx_RefNannySetupContext("__set__", 0);
3041
3042 /* "av/audio/codeccontext.pyx":92
3043 *
3044 * def __set__(self, value):
3045 * self.sample_rate = value # <<<<<<<<<<<<<<
3046 *
3047 * # TODO: Integrate into AudioLayout.
3048 */
3049 if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_sample_rate, __pyx_v_value) < 0) __PYX_ERR(1, 92, __pyx_L1_error)
3050
3051 /* "av/audio/codeccontext.pyx":91
3052 * return self.sample_rate
3053 *
3054 * def __set__(self, value): # <<<<<<<<<<<<<<
3055 * self.sample_rate = value
3056 *
3057 */
3058
3059 /* function exit code */
3060 __pyx_r = 0;
3061 goto __pyx_L0;
3062 __pyx_L1_error:;
3063 __Pyx_AddTraceback("av.audio.codeccontext.AudioCodecContext.rate.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3064 __pyx_r = -1;
3065 __pyx_L0:;
3066 __Pyx_RefNannyFinishContext();
3067 return __pyx_r;
3068 }
3069
3070 /* "av/audio/codeccontext.pyx":96
3071 * # TODO: Integrate into AudioLayout.
3072 * property channels:
3073 * def __get__(self): # <<<<<<<<<<<<<<
3074 * return self.ptr.channels
3075 *
3076 */
3077
3078 /* Python wrapper */
3079 static PyObject *__pyx_pw_2av_5audio_12codeccontext_17AudioCodecContext_8channels_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_2av_5audio_12codeccontext_17AudioCodecContext_8channels_1__get__(PyObject * __pyx_v_self)3080 static PyObject *__pyx_pw_2av_5audio_12codeccontext_17AudioCodecContext_8channels_1__get__(PyObject *__pyx_v_self) {
3081 PyObject *__pyx_r = 0;
3082 __Pyx_RefNannyDeclarations
3083 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
3084 __pyx_r = __pyx_pf_2av_5audio_12codeccontext_17AudioCodecContext_8channels___get__(((struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext *)__pyx_v_self));
3085
3086 /* function exit code */
3087 __Pyx_RefNannyFinishContext();
3088 return __pyx_r;
3089 }
3090
__pyx_pf_2av_5audio_12codeccontext_17AudioCodecContext_8channels___get__(struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext * __pyx_v_self)3091 static PyObject *__pyx_pf_2av_5audio_12codeccontext_17AudioCodecContext_8channels___get__(struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext *__pyx_v_self) {
3092 PyObject *__pyx_r = NULL;
3093 __Pyx_RefNannyDeclarations
3094 PyObject *__pyx_t_1 = NULL;
3095 int __pyx_lineno = 0;
3096 const char *__pyx_filename = NULL;
3097 int __pyx_clineno = 0;
3098 __Pyx_RefNannySetupContext("__get__", 0);
3099
3100 /* "av/audio/codeccontext.pyx":97
3101 * property channels:
3102 * def __get__(self):
3103 * return self.ptr.channels # <<<<<<<<<<<<<<
3104 *
3105 * def __set__(self, value):
3106 */
3107 __Pyx_XDECREF(__pyx_r);
3108 __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->__pyx_base.ptr->channels); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 97, __pyx_L1_error)
3109 __Pyx_GOTREF(__pyx_t_1);
3110 __pyx_r = __pyx_t_1;
3111 __pyx_t_1 = 0;
3112 goto __pyx_L0;
3113
3114 /* "av/audio/codeccontext.pyx":96
3115 * # TODO: Integrate into AudioLayout.
3116 * property channels:
3117 * def __get__(self): # <<<<<<<<<<<<<<
3118 * return self.ptr.channels
3119 *
3120 */
3121
3122 /* function exit code */
3123 __pyx_L1_error:;
3124 __Pyx_XDECREF(__pyx_t_1);
3125 __Pyx_AddTraceback("av.audio.codeccontext.AudioCodecContext.channels.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3126 __pyx_r = NULL;
3127 __pyx_L0:;
3128 __Pyx_XGIVEREF(__pyx_r);
3129 __Pyx_RefNannyFinishContext();
3130 return __pyx_r;
3131 }
3132
3133 /* "av/audio/codeccontext.pyx":99
3134 * return self.ptr.channels
3135 *
3136 * def __set__(self, value): # <<<<<<<<<<<<<<
3137 * self.ptr.channels = value
3138 * self.ptr.channel_layout = lib.av_get_default_channel_layout(value)
3139 */
3140
3141 /* Python wrapper */
3142 static int __pyx_pw_2av_5audio_12codeccontext_17AudioCodecContext_8channels_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
__pyx_pw_2av_5audio_12codeccontext_17AudioCodecContext_8channels_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_v_value)3143 static int __pyx_pw_2av_5audio_12codeccontext_17AudioCodecContext_8channels_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
3144 int __pyx_r;
3145 __Pyx_RefNannyDeclarations
3146 __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
3147 __pyx_r = __pyx_pf_2av_5audio_12codeccontext_17AudioCodecContext_8channels_2__set__(((struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext *)__pyx_v_self), ((PyObject *)__pyx_v_value));
3148
3149 /* function exit code */
3150 __Pyx_RefNannyFinishContext();
3151 return __pyx_r;
3152 }
3153
__pyx_pf_2av_5audio_12codeccontext_17AudioCodecContext_8channels_2__set__(struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext * __pyx_v_self,PyObject * __pyx_v_value)3154 static int __pyx_pf_2av_5audio_12codeccontext_17AudioCodecContext_8channels_2__set__(struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext *__pyx_v_self, PyObject *__pyx_v_value) {
3155 int __pyx_r;
3156 __Pyx_RefNannyDeclarations
3157 int __pyx_t_1;
3158 int __pyx_lineno = 0;
3159 const char *__pyx_filename = NULL;
3160 int __pyx_clineno = 0;
3161 __Pyx_RefNannySetupContext("__set__", 0);
3162
3163 /* "av/audio/codeccontext.pyx":100
3164 *
3165 * def __set__(self, value):
3166 * self.ptr.channels = value # <<<<<<<<<<<<<<
3167 * self.ptr.channel_layout = lib.av_get_default_channel_layout(value)
3168 * property channel_layout:
3169 */
3170 __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 100, __pyx_L1_error)
3171 __pyx_v_self->__pyx_base.ptr->channels = __pyx_t_1;
3172
3173 /* "av/audio/codeccontext.pyx":101
3174 * def __set__(self, value):
3175 * self.ptr.channels = value
3176 * self.ptr.channel_layout = lib.av_get_default_channel_layout(value) # <<<<<<<<<<<<<<
3177 * property channel_layout:
3178 * def __get__(self):
3179 */
3180 __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 101, __pyx_L1_error)
3181 __pyx_v_self->__pyx_base.ptr->channel_layout = av_get_default_channel_layout(__pyx_t_1);
3182
3183 /* "av/audio/codeccontext.pyx":99
3184 * return self.ptr.channels
3185 *
3186 * def __set__(self, value): # <<<<<<<<<<<<<<
3187 * self.ptr.channels = value
3188 * self.ptr.channel_layout = lib.av_get_default_channel_layout(value)
3189 */
3190
3191 /* function exit code */
3192 __pyx_r = 0;
3193 goto __pyx_L0;
3194 __pyx_L1_error:;
3195 __Pyx_AddTraceback("av.audio.codeccontext.AudioCodecContext.channels.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3196 __pyx_r = -1;
3197 __pyx_L0:;
3198 __Pyx_RefNannyFinishContext();
3199 return __pyx_r;
3200 }
3201
3202 /* "av/audio/codeccontext.pyx":103
3203 * self.ptr.channel_layout = lib.av_get_default_channel_layout(value)
3204 * property channel_layout:
3205 * def __get__(self): # <<<<<<<<<<<<<<
3206 * return self.ptr.channel_layout
3207 *
3208 */
3209
3210 /* Python wrapper */
3211 static PyObject *__pyx_pw_2av_5audio_12codeccontext_17AudioCodecContext_14channel_layout_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_2av_5audio_12codeccontext_17AudioCodecContext_14channel_layout_1__get__(PyObject * __pyx_v_self)3212 static PyObject *__pyx_pw_2av_5audio_12codeccontext_17AudioCodecContext_14channel_layout_1__get__(PyObject *__pyx_v_self) {
3213 PyObject *__pyx_r = 0;
3214 __Pyx_RefNannyDeclarations
3215 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
3216 __pyx_r = __pyx_pf_2av_5audio_12codeccontext_17AudioCodecContext_14channel_layout___get__(((struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext *)__pyx_v_self));
3217
3218 /* function exit code */
3219 __Pyx_RefNannyFinishContext();
3220 return __pyx_r;
3221 }
3222
__pyx_pf_2av_5audio_12codeccontext_17AudioCodecContext_14channel_layout___get__(struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext * __pyx_v_self)3223 static PyObject *__pyx_pf_2av_5audio_12codeccontext_17AudioCodecContext_14channel_layout___get__(struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext *__pyx_v_self) {
3224 PyObject *__pyx_r = NULL;
3225 __Pyx_RefNannyDeclarations
3226 PyObject *__pyx_t_1 = NULL;
3227 int __pyx_lineno = 0;
3228 const char *__pyx_filename = NULL;
3229 int __pyx_clineno = 0;
3230 __Pyx_RefNannySetupContext("__get__", 0);
3231
3232 /* "av/audio/codeccontext.pyx":104
3233 * property channel_layout:
3234 * def __get__(self):
3235 * return self.ptr.channel_layout # <<<<<<<<<<<<<<
3236 *
3237 * property layout:
3238 */
3239 __Pyx_XDECREF(__pyx_r);
3240 __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->__pyx_base.ptr->channel_layout); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 104, __pyx_L1_error)
3241 __Pyx_GOTREF(__pyx_t_1);
3242 __pyx_r = __pyx_t_1;
3243 __pyx_t_1 = 0;
3244 goto __pyx_L0;
3245
3246 /* "av/audio/codeccontext.pyx":103
3247 * self.ptr.channel_layout = lib.av_get_default_channel_layout(value)
3248 * property channel_layout:
3249 * def __get__(self): # <<<<<<<<<<<<<<
3250 * return self.ptr.channel_layout
3251 *
3252 */
3253
3254 /* function exit code */
3255 __pyx_L1_error:;
3256 __Pyx_XDECREF(__pyx_t_1);
3257 __Pyx_AddTraceback("av.audio.codeccontext.AudioCodecContext.channel_layout.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3258 __pyx_r = NULL;
3259 __pyx_L0:;
3260 __Pyx_XGIVEREF(__pyx_r);
3261 __Pyx_RefNannyFinishContext();
3262 return __pyx_r;
3263 }
3264
3265 /* "av/audio/codeccontext.pyx":112
3266 * :type: AudioLayout
3267 * """
3268 * def __get__(self): # <<<<<<<<<<<<<<
3269 * return get_audio_layout(self.ptr.channels, self.ptr.channel_layout)
3270 *
3271 */
3272
3273 /* Python wrapper */
3274 static PyObject *__pyx_pw_2av_5audio_12codeccontext_17AudioCodecContext_6layout_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_2av_5audio_12codeccontext_17AudioCodecContext_6layout_1__get__(PyObject * __pyx_v_self)3275 static PyObject *__pyx_pw_2av_5audio_12codeccontext_17AudioCodecContext_6layout_1__get__(PyObject *__pyx_v_self) {
3276 PyObject *__pyx_r = 0;
3277 __Pyx_RefNannyDeclarations
3278 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
3279 __pyx_r = __pyx_pf_2av_5audio_12codeccontext_17AudioCodecContext_6layout___get__(((struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext *)__pyx_v_self));
3280
3281 /* function exit code */
3282 __Pyx_RefNannyFinishContext();
3283 return __pyx_r;
3284 }
3285
__pyx_pf_2av_5audio_12codeccontext_17AudioCodecContext_6layout___get__(struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext * __pyx_v_self)3286 static PyObject *__pyx_pf_2av_5audio_12codeccontext_17AudioCodecContext_6layout___get__(struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext *__pyx_v_self) {
3287 PyObject *__pyx_r = NULL;
3288 __Pyx_RefNannyDeclarations
3289 PyObject *__pyx_t_1 = NULL;
3290 int __pyx_lineno = 0;
3291 const char *__pyx_filename = NULL;
3292 int __pyx_clineno = 0;
3293 __Pyx_RefNannySetupContext("__get__", 0);
3294
3295 /* "av/audio/codeccontext.pyx":113
3296 * """
3297 * def __get__(self):
3298 * return get_audio_layout(self.ptr.channels, self.ptr.channel_layout) # <<<<<<<<<<<<<<
3299 *
3300 * def __set__(self, value):
3301 */
3302 __Pyx_XDECREF(__pyx_r);
3303 __pyx_t_1 = ((PyObject *)__pyx_f_2av_5audio_6layout_get_audio_layout(__pyx_v_self->__pyx_base.ptr->channels, __pyx_v_self->__pyx_base.ptr->channel_layout)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 113, __pyx_L1_error)
3304 __Pyx_GOTREF(__pyx_t_1);
3305 __pyx_r = __pyx_t_1;
3306 __pyx_t_1 = 0;
3307 goto __pyx_L0;
3308
3309 /* "av/audio/codeccontext.pyx":112
3310 * :type: AudioLayout
3311 * """
3312 * def __get__(self): # <<<<<<<<<<<<<<
3313 * return get_audio_layout(self.ptr.channels, self.ptr.channel_layout)
3314 *
3315 */
3316
3317 /* function exit code */
3318 __pyx_L1_error:;
3319 __Pyx_XDECREF(__pyx_t_1);
3320 __Pyx_AddTraceback("av.audio.codeccontext.AudioCodecContext.layout.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3321 __pyx_r = NULL;
3322 __pyx_L0:;
3323 __Pyx_XGIVEREF(__pyx_r);
3324 __Pyx_RefNannyFinishContext();
3325 return __pyx_r;
3326 }
3327
3328 /* "av/audio/codeccontext.pyx":115
3329 * return get_audio_layout(self.ptr.channels, self.ptr.channel_layout)
3330 *
3331 * def __set__(self, value): # <<<<<<<<<<<<<<
3332 * cdef AudioLayout layout = AudioLayout(value)
3333 * self.ptr.channel_layout = layout.layout
3334 */
3335
3336 /* Python wrapper */
3337 static int __pyx_pw_2av_5audio_12codeccontext_17AudioCodecContext_6layout_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
__pyx_pw_2av_5audio_12codeccontext_17AudioCodecContext_6layout_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_v_value)3338 static int __pyx_pw_2av_5audio_12codeccontext_17AudioCodecContext_6layout_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
3339 int __pyx_r;
3340 __Pyx_RefNannyDeclarations
3341 __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
3342 __pyx_r = __pyx_pf_2av_5audio_12codeccontext_17AudioCodecContext_6layout_2__set__(((struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext *)__pyx_v_self), ((PyObject *)__pyx_v_value));
3343
3344 /* function exit code */
3345 __Pyx_RefNannyFinishContext();
3346 return __pyx_r;
3347 }
3348
__pyx_pf_2av_5audio_12codeccontext_17AudioCodecContext_6layout_2__set__(struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext * __pyx_v_self,PyObject * __pyx_v_value)3349 static int __pyx_pf_2av_5audio_12codeccontext_17AudioCodecContext_6layout_2__set__(struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext *__pyx_v_self, PyObject *__pyx_v_value) {
3350 struct __pyx_obj_2av_5audio_6layout_AudioLayout *__pyx_v_layout = 0;
3351 int __pyx_r;
3352 __Pyx_RefNannyDeclarations
3353 PyObject *__pyx_t_1 = NULL;
3354 uint64_t __pyx_t_2;
3355 int __pyx_t_3;
3356 int __pyx_lineno = 0;
3357 const char *__pyx_filename = NULL;
3358 int __pyx_clineno = 0;
3359 __Pyx_RefNannySetupContext("__set__", 0);
3360
3361 /* "av/audio/codeccontext.pyx":116
3362 *
3363 * def __set__(self, value):
3364 * cdef AudioLayout layout = AudioLayout(value) # <<<<<<<<<<<<<<
3365 * self.ptr.channel_layout = layout.layout
3366 * self.ptr.channels = layout.nb_channels
3367 */
3368 __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_2av_5audio_6layout_AudioLayout), __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 116, __pyx_L1_error)
3369 __Pyx_GOTREF(__pyx_t_1);
3370 __pyx_v_layout = ((struct __pyx_obj_2av_5audio_6layout_AudioLayout *)__pyx_t_1);
3371 __pyx_t_1 = 0;
3372
3373 /* "av/audio/codeccontext.pyx":117
3374 * def __set__(self, value):
3375 * cdef AudioLayout layout = AudioLayout(value)
3376 * self.ptr.channel_layout = layout.layout # <<<<<<<<<<<<<<
3377 * self.ptr.channels = layout.nb_channels
3378 *
3379 */
3380 __pyx_t_2 = __pyx_v_layout->layout;
3381 __pyx_v_self->__pyx_base.ptr->channel_layout = __pyx_t_2;
3382
3383 /* "av/audio/codeccontext.pyx":118
3384 * cdef AudioLayout layout = AudioLayout(value)
3385 * self.ptr.channel_layout = layout.layout
3386 * self.ptr.channels = layout.nb_channels # <<<<<<<<<<<<<<
3387 *
3388 * property format:
3389 */
3390 __pyx_t_3 = __pyx_v_layout->nb_channels;
3391 __pyx_v_self->__pyx_base.ptr->channels = __pyx_t_3;
3392
3393 /* "av/audio/codeccontext.pyx":115
3394 * return get_audio_layout(self.ptr.channels, self.ptr.channel_layout)
3395 *
3396 * def __set__(self, value): # <<<<<<<<<<<<<<
3397 * cdef AudioLayout layout = AudioLayout(value)
3398 * self.ptr.channel_layout = layout.layout
3399 */
3400
3401 /* function exit code */
3402 __pyx_r = 0;
3403 goto __pyx_L0;
3404 __pyx_L1_error:;
3405 __Pyx_XDECREF(__pyx_t_1);
3406 __Pyx_AddTraceback("av.audio.codeccontext.AudioCodecContext.layout.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3407 __pyx_r = -1;
3408 __pyx_L0:;
3409 __Pyx_XDECREF((PyObject *)__pyx_v_layout);
3410 __Pyx_RefNannyFinishContext();
3411 return __pyx_r;
3412 }
3413
3414 /* "av/audio/codeccontext.pyx":126
3415 * :type: AudioFormat
3416 * """
3417 * def __get__(self): # <<<<<<<<<<<<<<
3418 * return get_audio_format(self.ptr.sample_fmt)
3419 *
3420 */
3421
3422 /* Python wrapper */
3423 static PyObject *__pyx_pw_2av_5audio_12codeccontext_17AudioCodecContext_6format_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_2av_5audio_12codeccontext_17AudioCodecContext_6format_1__get__(PyObject * __pyx_v_self)3424 static PyObject *__pyx_pw_2av_5audio_12codeccontext_17AudioCodecContext_6format_1__get__(PyObject *__pyx_v_self) {
3425 PyObject *__pyx_r = 0;
3426 __Pyx_RefNannyDeclarations
3427 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
3428 __pyx_r = __pyx_pf_2av_5audio_12codeccontext_17AudioCodecContext_6format___get__(((struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext *)__pyx_v_self));
3429
3430 /* function exit code */
3431 __Pyx_RefNannyFinishContext();
3432 return __pyx_r;
3433 }
3434
__pyx_pf_2av_5audio_12codeccontext_17AudioCodecContext_6format___get__(struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext * __pyx_v_self)3435 static PyObject *__pyx_pf_2av_5audio_12codeccontext_17AudioCodecContext_6format___get__(struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext *__pyx_v_self) {
3436 PyObject *__pyx_r = NULL;
3437 __Pyx_RefNannyDeclarations
3438 PyObject *__pyx_t_1 = NULL;
3439 int __pyx_lineno = 0;
3440 const char *__pyx_filename = NULL;
3441 int __pyx_clineno = 0;
3442 __Pyx_RefNannySetupContext("__get__", 0);
3443
3444 /* "av/audio/codeccontext.pyx":127
3445 * """
3446 * def __get__(self):
3447 * return get_audio_format(self.ptr.sample_fmt) # <<<<<<<<<<<<<<
3448 *
3449 * def __set__(self, value):
3450 */
3451 __Pyx_XDECREF(__pyx_r);
3452 __pyx_t_1 = ((PyObject *)__pyx_f_2av_5audio_6format_get_audio_format(__pyx_v_self->__pyx_base.ptr->sample_fmt)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 127, __pyx_L1_error)
3453 __Pyx_GOTREF(__pyx_t_1);
3454 __pyx_r = __pyx_t_1;
3455 __pyx_t_1 = 0;
3456 goto __pyx_L0;
3457
3458 /* "av/audio/codeccontext.pyx":126
3459 * :type: AudioFormat
3460 * """
3461 * def __get__(self): # <<<<<<<<<<<<<<
3462 * return get_audio_format(self.ptr.sample_fmt)
3463 *
3464 */
3465
3466 /* function exit code */
3467 __pyx_L1_error:;
3468 __Pyx_XDECREF(__pyx_t_1);
3469 __Pyx_AddTraceback("av.audio.codeccontext.AudioCodecContext.format.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3470 __pyx_r = NULL;
3471 __pyx_L0:;
3472 __Pyx_XGIVEREF(__pyx_r);
3473 __Pyx_RefNannyFinishContext();
3474 return __pyx_r;
3475 }
3476
3477 /* "av/audio/codeccontext.pyx":129
3478 * return get_audio_format(self.ptr.sample_fmt)
3479 *
3480 * def __set__(self, value): # <<<<<<<<<<<<<<
3481 * cdef AudioFormat format = AudioFormat(value)
3482 * self.ptr.sample_fmt = format.sample_fmt
3483 */
3484
3485 /* Python wrapper */
3486 static int __pyx_pw_2av_5audio_12codeccontext_17AudioCodecContext_6format_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
__pyx_pw_2av_5audio_12codeccontext_17AudioCodecContext_6format_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_v_value)3487 static int __pyx_pw_2av_5audio_12codeccontext_17AudioCodecContext_6format_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
3488 int __pyx_r;
3489 __Pyx_RefNannyDeclarations
3490 __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
3491 __pyx_r = __pyx_pf_2av_5audio_12codeccontext_17AudioCodecContext_6format_2__set__(((struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext *)__pyx_v_self), ((PyObject *)__pyx_v_value));
3492
3493 /* function exit code */
3494 __Pyx_RefNannyFinishContext();
3495 return __pyx_r;
3496 }
3497
__pyx_pf_2av_5audio_12codeccontext_17AudioCodecContext_6format_2__set__(struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext * __pyx_v_self,PyObject * __pyx_v_value)3498 static int __pyx_pf_2av_5audio_12codeccontext_17AudioCodecContext_6format_2__set__(struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext *__pyx_v_self, PyObject *__pyx_v_value) {
3499 struct __pyx_obj_2av_5audio_6format_AudioFormat *__pyx_v_format = 0;
3500 int __pyx_r;
3501 __Pyx_RefNannyDeclarations
3502 PyObject *__pyx_t_1 = NULL;
3503 enum AVSampleFormat __pyx_t_2;
3504 int __pyx_lineno = 0;
3505 const char *__pyx_filename = NULL;
3506 int __pyx_clineno = 0;
3507 __Pyx_RefNannySetupContext("__set__", 0);
3508
3509 /* "av/audio/codeccontext.pyx":130
3510 *
3511 * def __set__(self, value):
3512 * cdef AudioFormat format = AudioFormat(value) # <<<<<<<<<<<<<<
3513 * self.ptr.sample_fmt = format.sample_fmt
3514 */
3515 __pyx_t_1 = __Pyx_PyObject_CallOneArg(((PyObject *)__pyx_ptype_2av_5audio_6format_AudioFormat), __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 130, __pyx_L1_error)
3516 __Pyx_GOTREF(__pyx_t_1);
3517 __pyx_v_format = ((struct __pyx_obj_2av_5audio_6format_AudioFormat *)__pyx_t_1);
3518 __pyx_t_1 = 0;
3519
3520 /* "av/audio/codeccontext.pyx":131
3521 * def __set__(self, value):
3522 * cdef AudioFormat format = AudioFormat(value)
3523 * self.ptr.sample_fmt = format.sample_fmt # <<<<<<<<<<<<<<
3524 */
3525 __pyx_t_2 = __pyx_v_format->sample_fmt;
3526 __pyx_v_self->__pyx_base.ptr->sample_fmt = __pyx_t_2;
3527
3528 /* "av/audio/codeccontext.pyx":129
3529 * return get_audio_format(self.ptr.sample_fmt)
3530 *
3531 * def __set__(self, value): # <<<<<<<<<<<<<<
3532 * cdef AudioFormat format = AudioFormat(value)
3533 * self.ptr.sample_fmt = format.sample_fmt
3534 */
3535
3536 /* function exit code */
3537 __pyx_r = 0;
3538 goto __pyx_L0;
3539 __pyx_L1_error:;
3540 __Pyx_XDECREF(__pyx_t_1);
3541 __Pyx_AddTraceback("av.audio.codeccontext.AudioCodecContext.format.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3542 __pyx_r = -1;
3543 __pyx_L0:;
3544 __Pyx_XDECREF((PyObject *)__pyx_v_format);
3545 __Pyx_RefNannyFinishContext();
3546 return __pyx_r;
3547 }
3548
3549 /* "(tree fragment)":1
3550 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
3551 * raise TypeError("self.parser,self.ptr cannot be converted to a Python object for pickling")
3552 * def __setstate_cython__(self, __pyx_state):
3553 */
3554
3555 /* Python wrapper */
3556 static PyObject *__pyx_pw_2av_5audio_12codeccontext_17AudioCodecContext_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
3557 static char __pyx_doc_2av_5audio_12codeccontext_17AudioCodecContext___reduce_cython__[] = "AudioCodecContext.__reduce_cython__()";
__pyx_pw_2av_5audio_12codeccontext_17AudioCodecContext_1__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)3558 static PyObject *__pyx_pw_2av_5audio_12codeccontext_17AudioCodecContext_1__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
3559 PyObject *__pyx_r = 0;
3560 __Pyx_RefNannyDeclarations
3561 __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
3562 __pyx_r = __pyx_pf_2av_5audio_12codeccontext_17AudioCodecContext___reduce_cython__(((struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext *)__pyx_v_self));
3563
3564 /* function exit code */
3565 __Pyx_RefNannyFinishContext();
3566 return __pyx_r;
3567 }
3568
__pyx_pf_2av_5audio_12codeccontext_17AudioCodecContext___reduce_cython__(CYTHON_UNUSED struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext * __pyx_v_self)3569 static PyObject *__pyx_pf_2av_5audio_12codeccontext_17AudioCodecContext___reduce_cython__(CYTHON_UNUSED struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext *__pyx_v_self) {
3570 PyObject *__pyx_r = NULL;
3571 __Pyx_RefNannyDeclarations
3572 PyObject *__pyx_t_1 = NULL;
3573 int __pyx_lineno = 0;
3574 const char *__pyx_filename = NULL;
3575 int __pyx_clineno = 0;
3576 __Pyx_RefNannySetupContext("__reduce_cython__", 0);
3577
3578 /* "(tree fragment)":2
3579 * def __reduce_cython__(self):
3580 * raise TypeError("self.parser,self.ptr cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<<
3581 * def __setstate_cython__(self, __pyx_state):
3582 * raise TypeError("self.parser,self.ptr cannot be converted to a Python object for pickling")
3583 */
3584 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __pyx_L1_error)
3585 __Pyx_GOTREF(__pyx_t_1);
3586 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
3587 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3588 __PYX_ERR(0, 2, __pyx_L1_error)
3589
3590 /* "(tree fragment)":1
3591 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
3592 * raise TypeError("self.parser,self.ptr cannot be converted to a Python object for pickling")
3593 * def __setstate_cython__(self, __pyx_state):
3594 */
3595
3596 /* function exit code */
3597 __pyx_L1_error:;
3598 __Pyx_XDECREF(__pyx_t_1);
3599 __Pyx_AddTraceback("av.audio.codeccontext.AudioCodecContext.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3600 __pyx_r = NULL;
3601 __Pyx_XGIVEREF(__pyx_r);
3602 __Pyx_RefNannyFinishContext();
3603 return __pyx_r;
3604 }
3605
3606 /* "(tree fragment)":3
3607 * def __reduce_cython__(self):
3608 * raise TypeError("self.parser,self.ptr cannot be converted to a Python object for pickling")
3609 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
3610 * raise TypeError("self.parser,self.ptr cannot be converted to a Python object for pickling")
3611 */
3612
3613 /* Python wrapper */
3614 static PyObject *__pyx_pw_2av_5audio_12codeccontext_17AudioCodecContext_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
3615 static char __pyx_doc_2av_5audio_12codeccontext_17AudioCodecContext_2__setstate_cython__[] = "AudioCodecContext.__setstate_cython__(__pyx_state)";
__pyx_pw_2av_5audio_12codeccontext_17AudioCodecContext_3__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)3616 static PyObject *__pyx_pw_2av_5audio_12codeccontext_17AudioCodecContext_3__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
3617 PyObject *__pyx_r = 0;
3618 __Pyx_RefNannyDeclarations
3619 __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
3620 __pyx_r = __pyx_pf_2av_5audio_12codeccontext_17AudioCodecContext_2__setstate_cython__(((struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
3621
3622 /* function exit code */
3623 __Pyx_RefNannyFinishContext();
3624 return __pyx_r;
3625 }
3626
__pyx_pf_2av_5audio_12codeccontext_17AudioCodecContext_2__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)3627 static PyObject *__pyx_pf_2av_5audio_12codeccontext_17AudioCodecContext_2__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
3628 PyObject *__pyx_r = NULL;
3629 __Pyx_RefNannyDeclarations
3630 PyObject *__pyx_t_1 = NULL;
3631 int __pyx_lineno = 0;
3632 const char *__pyx_filename = NULL;
3633 int __pyx_clineno = 0;
3634 __Pyx_RefNannySetupContext("__setstate_cython__", 0);
3635
3636 /* "(tree fragment)":4
3637 * raise TypeError("self.parser,self.ptr cannot be converted to a Python object for pickling")
3638 * def __setstate_cython__(self, __pyx_state):
3639 * raise TypeError("self.parser,self.ptr cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<<
3640 */
3641 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 4, __pyx_L1_error)
3642 __Pyx_GOTREF(__pyx_t_1);
3643 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
3644 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3645 __PYX_ERR(0, 4, __pyx_L1_error)
3646
3647 /* "(tree fragment)":3
3648 * def __reduce_cython__(self):
3649 * raise TypeError("self.parser,self.ptr cannot be converted to a Python object for pickling")
3650 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
3651 * raise TypeError("self.parser,self.ptr cannot be converted to a Python object for pickling")
3652 */
3653
3654 /* function exit code */
3655 __pyx_L1_error:;
3656 __Pyx_XDECREF(__pyx_t_1);
3657 __Pyx_AddTraceback("av.audio.codeccontext.AudioCodecContext.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3658 __pyx_r = NULL;
3659 __Pyx_XGIVEREF(__pyx_r);
3660 __Pyx_RefNannyFinishContext();
3661 return __pyx_r;
3662 }
3663 static struct __pyx_vtabstruct_2av_5audio_12codeccontext_AudioCodecContext __pyx_vtable_2av_5audio_12codeccontext_AudioCodecContext;
3664
__pyx_tp_new_2av_5audio_12codeccontext_AudioCodecContext(PyTypeObject * t,PyObject * a,PyObject * k)3665 static PyObject *__pyx_tp_new_2av_5audio_12codeccontext_AudioCodecContext(PyTypeObject *t, PyObject *a, PyObject *k) {
3666 struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext *p;
3667 PyObject *o = __pyx_ptype_2av_5codec_7context_CodecContext->tp_new(t, a, k);
3668 if (unlikely(!o)) return 0;
3669 p = ((struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext *)o);
3670 p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_2av_5codec_7context_CodecContext*)__pyx_vtabptr_2av_5audio_12codeccontext_AudioCodecContext;
3671 p->next_frame = ((struct __pyx_obj_2av_5audio_5frame_AudioFrame *)Py_None); Py_INCREF(Py_None);
3672 p->resampler = ((struct __pyx_obj_2av_5audio_9resampler_AudioResampler *)Py_None); Py_INCREF(Py_None);
3673 p->fifo = ((struct __pyx_obj_2av_5audio_4fifo_AudioFifo *)Py_None); Py_INCREF(Py_None);
3674 return o;
3675 }
3676
__pyx_tp_dealloc_2av_5audio_12codeccontext_AudioCodecContext(PyObject * o)3677 static void __pyx_tp_dealloc_2av_5audio_12codeccontext_AudioCodecContext(PyObject *o) {
3678 struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext *p = (struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext *)o;
3679 #if CYTHON_USE_TP_FINALIZE
3680 if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
3681 if (PyObject_CallFinalizerFromDealloc(o)) return;
3682 }
3683 #endif
3684 PyObject_GC_UnTrack(o);
3685 Py_CLEAR(p->next_frame);
3686 Py_CLEAR(p->resampler);
3687 Py_CLEAR(p->fifo);
3688 PyObject_GC_Track(o);
3689 if (likely(__pyx_ptype_2av_5codec_7context_CodecContext)) __pyx_ptype_2av_5codec_7context_CodecContext->tp_dealloc(o); else __Pyx_call_next_tp_dealloc(o, __pyx_tp_dealloc_2av_5audio_12codeccontext_AudioCodecContext);
3690 }
3691
__pyx_tp_traverse_2av_5audio_12codeccontext_AudioCodecContext(PyObject * o,visitproc v,void * a)3692 static int __pyx_tp_traverse_2av_5audio_12codeccontext_AudioCodecContext(PyObject *o, visitproc v, void *a) {
3693 int e;
3694 struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext *p = (struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext *)o;
3695 e = ((likely(__pyx_ptype_2av_5codec_7context_CodecContext)) ? ((__pyx_ptype_2av_5codec_7context_CodecContext->tp_traverse) ? __pyx_ptype_2av_5codec_7context_CodecContext->tp_traverse(o, v, a) : 0) : __Pyx_call_next_tp_traverse(o, v, a, __pyx_tp_traverse_2av_5audio_12codeccontext_AudioCodecContext)); if (e) return e;
3696 if (p->next_frame) {
3697 e = (*v)(((PyObject *)p->next_frame), a); if (e) return e;
3698 }
3699 if (p->resampler) {
3700 e = (*v)(((PyObject *)p->resampler), a); if (e) return e;
3701 }
3702 if (p->fifo) {
3703 e = (*v)(((PyObject *)p->fifo), a); if (e) return e;
3704 }
3705 return 0;
3706 }
3707
__pyx_tp_clear_2av_5audio_12codeccontext_AudioCodecContext(PyObject * o)3708 static int __pyx_tp_clear_2av_5audio_12codeccontext_AudioCodecContext(PyObject *o) {
3709 PyObject* tmp;
3710 struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext *p = (struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext *)o;
3711 if (likely(__pyx_ptype_2av_5codec_7context_CodecContext)) { if (__pyx_ptype_2av_5codec_7context_CodecContext->tp_clear) __pyx_ptype_2av_5codec_7context_CodecContext->tp_clear(o); } else __Pyx_call_next_tp_clear(o, __pyx_tp_clear_2av_5audio_12codeccontext_AudioCodecContext);
3712 tmp = ((PyObject*)p->next_frame);
3713 p->next_frame = ((struct __pyx_obj_2av_5audio_5frame_AudioFrame *)Py_None); Py_INCREF(Py_None);
3714 Py_XDECREF(tmp);
3715 tmp = ((PyObject*)p->resampler);
3716 p->resampler = ((struct __pyx_obj_2av_5audio_9resampler_AudioResampler *)Py_None); Py_INCREF(Py_None);
3717 Py_XDECREF(tmp);
3718 tmp = ((PyObject*)p->fifo);
3719 p->fifo = ((struct __pyx_obj_2av_5audio_4fifo_AudioFifo *)Py_None); Py_INCREF(Py_None);
3720 Py_XDECREF(tmp);
3721 return 0;
3722 }
3723
__pyx_getprop_2av_5audio_12codeccontext_17AudioCodecContext_frame_size(PyObject * o,CYTHON_UNUSED void * x)3724 static PyObject *__pyx_getprop_2av_5audio_12codeccontext_17AudioCodecContext_frame_size(PyObject *o, CYTHON_UNUSED void *x) {
3725 return __pyx_pw_2av_5audio_12codeccontext_17AudioCodecContext_10frame_size_1__get__(o);
3726 }
3727
__pyx_getprop_2av_5audio_12codeccontext_17AudioCodecContext_sample_rate(PyObject * o,CYTHON_UNUSED void * x)3728 static PyObject *__pyx_getprop_2av_5audio_12codeccontext_17AudioCodecContext_sample_rate(PyObject *o, CYTHON_UNUSED void *x) {
3729 return __pyx_pw_2av_5audio_12codeccontext_17AudioCodecContext_11sample_rate_1__get__(o);
3730 }
3731
__pyx_setprop_2av_5audio_12codeccontext_17AudioCodecContext_sample_rate(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)3732 static int __pyx_setprop_2av_5audio_12codeccontext_17AudioCodecContext_sample_rate(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
3733 if (v) {
3734 return __pyx_pw_2av_5audio_12codeccontext_17AudioCodecContext_11sample_rate_3__set__(o, v);
3735 }
3736 else {
3737 PyErr_SetString(PyExc_NotImplementedError, "__del__");
3738 return -1;
3739 }
3740 }
3741
__pyx_getprop_2av_5audio_12codeccontext_17AudioCodecContext_rate(PyObject * o,CYTHON_UNUSED void * x)3742 static PyObject *__pyx_getprop_2av_5audio_12codeccontext_17AudioCodecContext_rate(PyObject *o, CYTHON_UNUSED void *x) {
3743 return __pyx_pw_2av_5audio_12codeccontext_17AudioCodecContext_4rate_1__get__(o);
3744 }
3745
__pyx_setprop_2av_5audio_12codeccontext_17AudioCodecContext_rate(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)3746 static int __pyx_setprop_2av_5audio_12codeccontext_17AudioCodecContext_rate(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
3747 if (v) {
3748 return __pyx_pw_2av_5audio_12codeccontext_17AudioCodecContext_4rate_3__set__(o, v);
3749 }
3750 else {
3751 PyErr_SetString(PyExc_NotImplementedError, "__del__");
3752 return -1;
3753 }
3754 }
3755
__pyx_getprop_2av_5audio_12codeccontext_17AudioCodecContext_channels(PyObject * o,CYTHON_UNUSED void * x)3756 static PyObject *__pyx_getprop_2av_5audio_12codeccontext_17AudioCodecContext_channels(PyObject *o, CYTHON_UNUSED void *x) {
3757 return __pyx_pw_2av_5audio_12codeccontext_17AudioCodecContext_8channels_1__get__(o);
3758 }
3759
__pyx_setprop_2av_5audio_12codeccontext_17AudioCodecContext_channels(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)3760 static int __pyx_setprop_2av_5audio_12codeccontext_17AudioCodecContext_channels(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
3761 if (v) {
3762 return __pyx_pw_2av_5audio_12codeccontext_17AudioCodecContext_8channels_3__set__(o, v);
3763 }
3764 else {
3765 PyErr_SetString(PyExc_NotImplementedError, "__del__");
3766 return -1;
3767 }
3768 }
3769
__pyx_getprop_2av_5audio_12codeccontext_17AudioCodecContext_channel_layout(PyObject * o,CYTHON_UNUSED void * x)3770 static PyObject *__pyx_getprop_2av_5audio_12codeccontext_17AudioCodecContext_channel_layout(PyObject *o, CYTHON_UNUSED void *x) {
3771 return __pyx_pw_2av_5audio_12codeccontext_17AudioCodecContext_14channel_layout_1__get__(o);
3772 }
3773
__pyx_getprop_2av_5audio_12codeccontext_17AudioCodecContext_layout(PyObject * o,CYTHON_UNUSED void * x)3774 static PyObject *__pyx_getprop_2av_5audio_12codeccontext_17AudioCodecContext_layout(PyObject *o, CYTHON_UNUSED void *x) {
3775 return __pyx_pw_2av_5audio_12codeccontext_17AudioCodecContext_6layout_1__get__(o);
3776 }
3777
__pyx_setprop_2av_5audio_12codeccontext_17AudioCodecContext_layout(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)3778 static int __pyx_setprop_2av_5audio_12codeccontext_17AudioCodecContext_layout(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
3779 if (v) {
3780 return __pyx_pw_2av_5audio_12codeccontext_17AudioCodecContext_6layout_3__set__(o, v);
3781 }
3782 else {
3783 PyErr_SetString(PyExc_NotImplementedError, "__del__");
3784 return -1;
3785 }
3786 }
3787
__pyx_getprop_2av_5audio_12codeccontext_17AudioCodecContext_format(PyObject * o,CYTHON_UNUSED void * x)3788 static PyObject *__pyx_getprop_2av_5audio_12codeccontext_17AudioCodecContext_format(PyObject *o, CYTHON_UNUSED void *x) {
3789 return __pyx_pw_2av_5audio_12codeccontext_17AudioCodecContext_6format_1__get__(o);
3790 }
3791
__pyx_setprop_2av_5audio_12codeccontext_17AudioCodecContext_format(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)3792 static int __pyx_setprop_2av_5audio_12codeccontext_17AudioCodecContext_format(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
3793 if (v) {
3794 return __pyx_pw_2av_5audio_12codeccontext_17AudioCodecContext_6format_3__set__(o, v);
3795 }
3796 else {
3797 PyErr_SetString(PyExc_NotImplementedError, "__del__");
3798 return -1;
3799 }
3800 }
3801
3802 static PyMethodDef __pyx_methods_2av_5audio_12codeccontext_AudioCodecContext[] = {
3803 {"__reduce_cython__", (PyCFunction)__pyx_pw_2av_5audio_12codeccontext_17AudioCodecContext_1__reduce_cython__, METH_NOARGS, __pyx_doc_2av_5audio_12codeccontext_17AudioCodecContext___reduce_cython__},
3804 {"__setstate_cython__", (PyCFunction)__pyx_pw_2av_5audio_12codeccontext_17AudioCodecContext_3__setstate_cython__, METH_O, __pyx_doc_2av_5audio_12codeccontext_17AudioCodecContext_2__setstate_cython__},
3805 {0, 0, 0, 0}
3806 };
3807
3808 static struct PyGetSetDef __pyx_getsets_2av_5audio_12codeccontext_AudioCodecContext[] = {
3809 {(char *)"frame_size", __pyx_getprop_2av_5audio_12codeccontext_17AudioCodecContext_frame_size, 0, (char *)"\n Number of samples per channel in an audio frame.\n\n :type: int\n ", 0},
3810 {(char *)"sample_rate", __pyx_getprop_2av_5audio_12codeccontext_17AudioCodecContext_sample_rate, __pyx_setprop_2av_5audio_12codeccontext_17AudioCodecContext_sample_rate, (char *)"\n Sample rate of the audio data, in samples per second.\n\n :type: int\n ", 0},
3811 {(char *)"rate", __pyx_getprop_2av_5audio_12codeccontext_17AudioCodecContext_rate, __pyx_setprop_2av_5audio_12codeccontext_17AudioCodecContext_rate, (char *)"Another name for :attr:`sample_rate`.", 0},
3812 {(char *)"channels", __pyx_getprop_2av_5audio_12codeccontext_17AudioCodecContext_channels, __pyx_setprop_2av_5audio_12codeccontext_17AudioCodecContext_channels, (char *)0, 0},
3813 {(char *)"channel_layout", __pyx_getprop_2av_5audio_12codeccontext_17AudioCodecContext_channel_layout, 0, (char *)0, 0},
3814 {(char *)"layout", __pyx_getprop_2av_5audio_12codeccontext_17AudioCodecContext_layout, __pyx_setprop_2av_5audio_12codeccontext_17AudioCodecContext_layout, (char *)"\n The audio channel layout.\n\n :type: AudioLayout\n ", 0},
3815 {(char *)"format", __pyx_getprop_2av_5audio_12codeccontext_17AudioCodecContext_format, __pyx_setprop_2av_5audio_12codeccontext_17AudioCodecContext_format, (char *)"\n The audio sample format.\n\n :type: AudioFormat\n ", 0},
3816 {0, 0, 0, 0, 0}
3817 };
3818
3819 static PyTypeObject __pyx_type_2av_5audio_12codeccontext_AudioCodecContext = {
3820 PyVarObject_HEAD_INIT(0, 0)
3821 "av.audio.codeccontext.AudioCodecContext", /*tp_name*/
3822 sizeof(struct __pyx_obj_2av_5audio_12codeccontext_AudioCodecContext), /*tp_basicsize*/
3823 0, /*tp_itemsize*/
3824 __pyx_tp_dealloc_2av_5audio_12codeccontext_AudioCodecContext, /*tp_dealloc*/
3825 #if PY_VERSION_HEX < 0x030800b4
3826 0, /*tp_print*/
3827 #endif
3828 #if PY_VERSION_HEX >= 0x030800b4
3829 0, /*tp_vectorcall_offset*/
3830 #endif
3831 0, /*tp_getattr*/
3832 0, /*tp_setattr*/
3833 #if PY_MAJOR_VERSION < 3
3834 0, /*tp_compare*/
3835 #endif
3836 #if PY_MAJOR_VERSION >= 3
3837 0, /*tp_as_async*/
3838 #endif
3839 0, /*tp_repr*/
3840 0, /*tp_as_number*/
3841 0, /*tp_as_sequence*/
3842 0, /*tp_as_mapping*/
3843 0, /*tp_hash*/
3844 0, /*tp_call*/
3845 0, /*tp_str*/
3846 0, /*tp_getattro*/
3847 0, /*tp_setattro*/
3848 0, /*tp_as_buffer*/
3849 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
3850 0, /*tp_doc*/
3851 __pyx_tp_traverse_2av_5audio_12codeccontext_AudioCodecContext, /*tp_traverse*/
3852 __pyx_tp_clear_2av_5audio_12codeccontext_AudioCodecContext, /*tp_clear*/
3853 0, /*tp_richcompare*/
3854 0, /*tp_weaklistoffset*/
3855 0, /*tp_iter*/
3856 0, /*tp_iternext*/
3857 __pyx_methods_2av_5audio_12codeccontext_AudioCodecContext, /*tp_methods*/
3858 0, /*tp_members*/
3859 __pyx_getsets_2av_5audio_12codeccontext_AudioCodecContext, /*tp_getset*/
3860 0, /*tp_base*/
3861 0, /*tp_dict*/
3862 0, /*tp_descr_get*/
3863 0, /*tp_descr_set*/
3864 0, /*tp_dictoffset*/
3865 0, /*tp_init*/
3866 0, /*tp_alloc*/
3867 __pyx_tp_new_2av_5audio_12codeccontext_AudioCodecContext, /*tp_new*/
3868 0, /*tp_free*/
3869 0, /*tp_is_gc*/
3870 0, /*tp_bases*/
3871 0, /*tp_mro*/
3872 0, /*tp_cache*/
3873 0, /*tp_subclasses*/
3874 0, /*tp_weaklist*/
3875 0, /*tp_del*/
3876 0, /*tp_version_tag*/
3877 #if PY_VERSION_HEX >= 0x030400a1
3878 0, /*tp_finalize*/
3879 #endif
3880 #if PY_VERSION_HEX >= 0x030800b1
3881 0, /*tp_vectorcall*/
3882 #endif
3883 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
3884 0, /*tp_print*/
3885 #endif
3886 };
3887
3888 static PyMethodDef __pyx_methods[] = {
3889 {0, 0, 0, 0}
3890 };
3891
3892 #if PY_MAJOR_VERSION >= 3
3893 #if CYTHON_PEP489_MULTI_PHASE_INIT
3894 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
3895 static int __pyx_pymod_exec_codeccontext(PyObject* module); /*proto*/
3896 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
3897 {Py_mod_create, (void*)__pyx_pymod_create},
3898 {Py_mod_exec, (void*)__pyx_pymod_exec_codeccontext},
3899 {0, NULL}
3900 };
3901 #endif
3902
3903 static struct PyModuleDef __pyx_moduledef = {
3904 PyModuleDef_HEAD_INIT,
3905 "codeccontext",
3906 0, /* m_doc */
3907 #if CYTHON_PEP489_MULTI_PHASE_INIT
3908 0, /* m_size */
3909 #else
3910 -1, /* m_size */
3911 #endif
3912 __pyx_methods /* m_methods */,
3913 #if CYTHON_PEP489_MULTI_PHASE_INIT
3914 __pyx_moduledef_slots, /* m_slots */
3915 #else
3916 NULL, /* m_reload */
3917 #endif
3918 NULL, /* m_traverse */
3919 NULL, /* m_clear */
3920 NULL /* m_free */
3921 };
3922 #endif
3923 #ifndef CYTHON_SMALL_CODE
3924 #if defined(__clang__)
3925 #define CYTHON_SMALL_CODE
3926 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
3927 #define CYTHON_SMALL_CODE __attribute__((cold))
3928 #else
3929 #define CYTHON_SMALL_CODE
3930 #endif
3931 #endif
3932
3933 static __Pyx_StringTabEntry __pyx_string_tab[] = {
3934 {&__pyx_n_s_AudioCodecContext, __pyx_k_AudioCodecContext, sizeof(__pyx_k_AudioCodecContext), 0, 0, 1, 1},
3935 {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
3936 {&__pyx_n_s_append, __pyx_k_append, sizeof(__pyx_k_append), 0, 0, 1, 1},
3937 {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
3938 {&__pyx_n_s_format, __pyx_k_format, sizeof(__pyx_k_format), 0, 0, 1, 1},
3939 {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
3940 {&__pyx_n_s_layout, __pyx_k_layout, sizeof(__pyx_k_layout), 0, 0, 1, 1},
3941 {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
3942 {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
3943 {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
3944 {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1},
3945 {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
3946 {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
3947 {&__pyx_n_s_sample_rate, __pyx_k_sample_rate, sizeof(__pyx_k_sample_rate), 0, 0, 1, 1},
3948 {&__pyx_kp_s_self_parser_self_ptr_cannot_be_c, __pyx_k_self_parser_self_ptr_cannot_be_c, sizeof(__pyx_k_self_parser_self_ptr_cannot_be_c), 0, 0, 1, 0},
3949 {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1},
3950 {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
3951 {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
3952 {0, 0, 0, 0, 0, 0, 0}
3953 };
__Pyx_InitCachedBuiltins(void)3954 static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
3955 __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 2, __pyx_L1_error)
3956 return 0;
3957 __pyx_L1_error:;
3958 return -1;
3959 }
3960
__Pyx_InitCachedConstants(void)3961 static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
3962 __Pyx_RefNannyDeclarations
3963 __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
3964
3965 /* "(tree fragment)":2
3966 * def __reduce_cython__(self):
3967 * raise TypeError("self.parser,self.ptr cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<<
3968 * def __setstate_cython__(self, __pyx_state):
3969 * raise TypeError("self.parser,self.ptr cannot be converted to a Python object for pickling")
3970 */
3971 __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_self_parser_self_ptr_cannot_be_c); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 2, __pyx_L1_error)
3972 __Pyx_GOTREF(__pyx_tuple_);
3973 __Pyx_GIVEREF(__pyx_tuple_);
3974
3975 /* "(tree fragment)":4
3976 * raise TypeError("self.parser,self.ptr cannot be converted to a Python object for pickling")
3977 * def __setstate_cython__(self, __pyx_state):
3978 * raise TypeError("self.parser,self.ptr cannot be converted to a Python object for pickling") # <<<<<<<<<<<<<<
3979 */
3980 __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_self_parser_self_ptr_cannot_be_c); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 4, __pyx_L1_error)
3981 __Pyx_GOTREF(__pyx_tuple__2);
3982 __Pyx_GIVEREF(__pyx_tuple__2);
3983 __Pyx_RefNannyFinishContext();
3984 return 0;
3985 __pyx_L1_error:;
3986 __Pyx_RefNannyFinishContext();
3987 return -1;
3988 }
3989
__Pyx_InitGlobals(void)3990 static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
3991 if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(1, 1, __pyx_L1_error);
3992 return 0;
3993 __pyx_L1_error:;
3994 return -1;
3995 }
3996
3997 static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
3998 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
3999 static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
4000 static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
4001 static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
4002 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
4003 static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
4004
__Pyx_modinit_global_init_code(void)4005 static int __Pyx_modinit_global_init_code(void) {
4006 __Pyx_RefNannyDeclarations
4007 __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
4008 /*--- Global init code ---*/
4009 __Pyx_RefNannyFinishContext();
4010 return 0;
4011 }
4012
__Pyx_modinit_variable_export_code(void)4013 static int __Pyx_modinit_variable_export_code(void) {
4014 __Pyx_RefNannyDeclarations
4015 __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
4016 /*--- Variable export code ---*/
4017 __Pyx_RefNannyFinishContext();
4018 return 0;
4019 }
4020
__Pyx_modinit_function_export_code(void)4021 static int __Pyx_modinit_function_export_code(void) {
4022 __Pyx_RefNannyDeclarations
4023 __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
4024 /*--- Function export code ---*/
4025 __Pyx_RefNannyFinishContext();
4026 return 0;
4027 }
4028
__Pyx_modinit_type_init_code(void)4029 static int __Pyx_modinit_type_init_code(void) {
4030 __Pyx_RefNannyDeclarations
4031 PyObject *__pyx_t_1 = NULL;
4032 int __pyx_lineno = 0;
4033 const char *__pyx_filename = NULL;
4034 int __pyx_clineno = 0;
4035 __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
4036 /*--- Type init code ---*/
4037 __pyx_t_1 = PyImport_ImportModule("av.codec.context"); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1, __pyx_L1_error)
4038 __Pyx_GOTREF(__pyx_t_1);
4039 __pyx_ptype_2av_5codec_7context_CodecContext = __Pyx_ImportType(__pyx_t_1, "av.codec.context", "CodecContext", sizeof(struct __pyx_obj_2av_5codec_7context_CodecContext), __Pyx_ImportType_CheckSize_Warn);
4040 if (!__pyx_ptype_2av_5codec_7context_CodecContext) __PYX_ERR(1, 1, __pyx_L1_error)
4041 __pyx_vtabptr_2av_5codec_7context_CodecContext = (struct __pyx_vtabstruct_2av_5codec_7context_CodecContext*)__Pyx_GetVtable(__pyx_ptype_2av_5codec_7context_CodecContext->tp_dict); if (unlikely(!__pyx_vtabptr_2av_5codec_7context_CodecContext)) __PYX_ERR(1, 1, __pyx_L1_error)
4042 __pyx_vtabptr_2av_5audio_12codeccontext_AudioCodecContext = &__pyx_vtable_2av_5audio_12codeccontext_AudioCodecContext;
4043 __pyx_vtable_2av_5audio_12codeccontext_AudioCodecContext.__pyx_base = *__pyx_vtabptr_2av_5codec_7context_CodecContext;
4044 __pyx_vtable_2av_5audio_12codeccontext_AudioCodecContext.__pyx_base._init = (PyObject *(*)(struct __pyx_obj_2av_5codec_7context_CodecContext *, struct AVCodecContext *, struct AVCodec const *))__pyx_f_2av_5audio_12codeccontext_17AudioCodecContext__init;
4045 __pyx_vtable_2av_5audio_12codeccontext_AudioCodecContext.__pyx_base._set_default_time_base = (PyObject *(*)(struct __pyx_obj_2av_5codec_7context_CodecContext *))__pyx_f_2av_5audio_12codeccontext_17AudioCodecContext__set_default_time_base;
4046 __pyx_vtable_2av_5audio_12codeccontext_AudioCodecContext.__pyx_base._prepare_frames_for_encode = (PyObject *(*)(struct __pyx_obj_2av_5codec_7context_CodecContext *, struct __pyx_obj_2av_5frame_Frame *))__pyx_f_2av_5audio_12codeccontext_17AudioCodecContext__prepare_frames_for_encode;
4047 __pyx_vtable_2av_5audio_12codeccontext_AudioCodecContext.__pyx_base._setup_decoded_frame = (PyObject *(*)(struct __pyx_obj_2av_5codec_7context_CodecContext *, struct __pyx_obj_2av_5frame_Frame *, struct __pyx_obj_2av_6packet_Packet *))__pyx_f_2av_5audio_12codeccontext_17AudioCodecContext__setup_decoded_frame;
4048 __pyx_vtable_2av_5audio_12codeccontext_AudioCodecContext.__pyx_base._alloc_next_frame = (struct __pyx_obj_2av_5frame_Frame *(*)(struct __pyx_obj_2av_5codec_7context_CodecContext *))__pyx_f_2av_5audio_12codeccontext_17AudioCodecContext__alloc_next_frame;
4049 __pyx_type_2av_5audio_12codeccontext_AudioCodecContext.tp_base = __pyx_ptype_2av_5codec_7context_CodecContext;
4050 if (PyType_Ready(&__pyx_type_2av_5audio_12codeccontext_AudioCodecContext) < 0) __PYX_ERR(1, 11, __pyx_L1_error)
4051 #if PY_VERSION_HEX < 0x030800B1
4052 __pyx_type_2av_5audio_12codeccontext_AudioCodecContext.tp_print = 0;
4053 #endif
4054 if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_2av_5audio_12codeccontext_AudioCodecContext.tp_dictoffset && __pyx_type_2av_5audio_12codeccontext_AudioCodecContext.tp_getattro == PyObject_GenericGetAttr)) {
4055 __pyx_type_2av_5audio_12codeccontext_AudioCodecContext.tp_getattro = __Pyx_PyObject_GenericGetAttr;
4056 }
4057 if (__Pyx_SetVtable(__pyx_type_2av_5audio_12codeccontext_AudioCodecContext.tp_dict, __pyx_vtabptr_2av_5audio_12codeccontext_AudioCodecContext) < 0) __PYX_ERR(1, 11, __pyx_L1_error)
4058 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_AudioCodecContext, (PyObject *)&__pyx_type_2av_5audio_12codeccontext_AudioCodecContext) < 0) __PYX_ERR(1, 11, __pyx_L1_error)
4059 if (__Pyx_setup_reduce((PyObject*)&__pyx_type_2av_5audio_12codeccontext_AudioCodecContext) < 0) __PYX_ERR(1, 11, __pyx_L1_error)
4060 __pyx_ptype_2av_5audio_12codeccontext_AudioCodecContext = &__pyx_type_2av_5audio_12codeccontext_AudioCodecContext;
4061 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4062 __Pyx_RefNannyFinishContext();
4063 return 0;
4064 __pyx_L1_error:;
4065 __Pyx_XDECREF(__pyx_t_1);
4066 __Pyx_RefNannyFinishContext();
4067 return -1;
4068 }
4069
__Pyx_modinit_type_import_code(void)4070 static int __Pyx_modinit_type_import_code(void) {
4071 __Pyx_RefNannyDeclarations
4072 PyObject *__pyx_t_1 = NULL;
4073 int __pyx_lineno = 0;
4074 const char *__pyx_filename = NULL;
4075 int __pyx_clineno = 0;
4076 __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
4077 /*--- Type import code ---*/
4078 __pyx_t_1 = PyImport_ImportModule("av.audio.format"); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error)
4079 __Pyx_GOTREF(__pyx_t_1);
4080 __pyx_ptype_2av_5audio_6format_AudioFormat = __Pyx_ImportType(__pyx_t_1, "av.audio.format", "AudioFormat", sizeof(struct __pyx_obj_2av_5audio_6format_AudioFormat), __Pyx_ImportType_CheckSize_Warn);
4081 if (!__pyx_ptype_2av_5audio_6format_AudioFormat) __PYX_ERR(2, 4, __pyx_L1_error)
4082 __pyx_vtabptr_2av_5audio_6format_AudioFormat = (struct __pyx_vtabstruct_2av_5audio_6format_AudioFormat*)__Pyx_GetVtable(__pyx_ptype_2av_5audio_6format_AudioFormat->tp_dict); if (unlikely(!__pyx_vtabptr_2av_5audio_6format_AudioFormat)) __PYX_ERR(2, 4, __pyx_L1_error)
4083 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4084 __pyx_t_1 = PyImport_ImportModule("av.audio.layout"); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 4, __pyx_L1_error)
4085 __Pyx_GOTREF(__pyx_t_1);
4086 __pyx_ptype_2av_5audio_6layout_AudioLayout = __Pyx_ImportType(__pyx_t_1, "av.audio.layout", "AudioLayout", sizeof(struct __pyx_obj_2av_5audio_6layout_AudioLayout), __Pyx_ImportType_CheckSize_Warn);
4087 if (!__pyx_ptype_2av_5audio_6layout_AudioLayout) __PYX_ERR(3, 4, __pyx_L1_error)
4088 __pyx_vtabptr_2av_5audio_6layout_AudioLayout = (struct __pyx_vtabstruct_2av_5audio_6layout_AudioLayout*)__Pyx_GetVtable(__pyx_ptype_2av_5audio_6layout_AudioLayout->tp_dict); if (unlikely(!__pyx_vtabptr_2av_5audio_6layout_AudioLayout)) __PYX_ERR(3, 4, __pyx_L1_error)
4089 __pyx_ptype_2av_5audio_6layout_AudioChannel = __Pyx_ImportType(__pyx_t_1, "av.audio.layout", "AudioChannel", sizeof(struct __pyx_obj_2av_5audio_6layout_AudioChannel), __Pyx_ImportType_CheckSize_Warn);
4090 if (!__pyx_ptype_2av_5audio_6layout_AudioChannel) __PYX_ERR(3, 20, __pyx_L1_error)
4091 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4092 __pyx_t_1 = PyImport_ImportModule("av.buffer"); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2, __pyx_L1_error)
4093 __Pyx_GOTREF(__pyx_t_1);
4094 __pyx_ptype_2av_6buffer_Buffer = __Pyx_ImportType(__pyx_t_1, "av.buffer", "Buffer", sizeof(struct __pyx_obj_2av_6buffer_Buffer), __Pyx_ImportType_CheckSize_Warn);
4095 if (!__pyx_ptype_2av_6buffer_Buffer) __PYX_ERR(4, 2, __pyx_L1_error)
4096 __pyx_vtabptr_2av_6buffer_Buffer = (struct __pyx_vtabstruct_2av_6buffer_Buffer*)__Pyx_GetVtable(__pyx_ptype_2av_6buffer_Buffer->tp_dict); if (unlikely(!__pyx_vtabptr_2av_6buffer_Buffer)) __PYX_ERR(4, 2, __pyx_L1_error)
4097 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4098 __pyx_t_1 = PyImport_ImportModule("av.bytesource"); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 4, __pyx_L1_error)
4099 __Pyx_GOTREF(__pyx_t_1);
4100 __pyx_ptype_2av_10bytesource_ByteSource = __Pyx_ImportType(__pyx_t_1, "av.bytesource", "ByteSource", sizeof(struct __pyx_obj_2av_10bytesource_ByteSource), __Pyx_ImportType_CheckSize_Warn);
4101 if (!__pyx_ptype_2av_10bytesource_ByteSource) __PYX_ERR(5, 4, __pyx_L1_error)
4102 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4103 __pyx_t_1 = PyImport_ImportModule("av.codec.codec"); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 4, __pyx_L1_error)
4104 __Pyx_GOTREF(__pyx_t_1);
4105 __pyx_ptype_2av_5codec_5codec_Codec = __Pyx_ImportType(__pyx_t_1, "av.codec.codec", "Codec", sizeof(struct __pyx_obj_2av_5codec_5codec_Codec), __Pyx_ImportType_CheckSize_Warn);
4106 if (!__pyx_ptype_2av_5codec_5codec_Codec) __PYX_ERR(6, 4, __pyx_L1_error)
4107 __pyx_vtabptr_2av_5codec_5codec_Codec = (struct __pyx_vtabstruct_2av_5codec_5codec_Codec*)__Pyx_GetVtable(__pyx_ptype_2av_5codec_5codec_Codec->tp_dict); if (unlikely(!__pyx_vtabptr_2av_5codec_5codec_Codec)) __PYX_ERR(6, 4, __pyx_L1_error)
4108 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4109 __pyx_t_1 = PyImport_ImportModule("av.container.streams"); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 4, __pyx_L1_error)
4110 __Pyx_GOTREF(__pyx_t_1);
4111 __pyx_ptype_2av_9container_7streams_StreamContainer = __Pyx_ImportType(__pyx_t_1, "av.container.streams", "StreamContainer", sizeof(struct __pyx_obj_2av_9container_7streams_StreamContainer), __Pyx_ImportType_CheckSize_Warn);
4112 if (!__pyx_ptype_2av_9container_7streams_StreamContainer) __PYX_ERR(7, 4, __pyx_L1_error)
4113 __pyx_vtabptr_2av_9container_7streams_StreamContainer = (struct __pyx_vtabstruct_2av_9container_7streams_StreamContainer*)__Pyx_GetVtable(__pyx_ptype_2av_9container_7streams_StreamContainer->tp_dict); if (unlikely(!__pyx_vtabptr_2av_9container_7streams_StreamContainer)) __PYX_ERR(7, 4, __pyx_L1_error)
4114 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4115 __pyx_t_1 = PyImport_ImportModule("av.dictionary"); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 4, __pyx_L1_error)
4116 __Pyx_GOTREF(__pyx_t_1);
4117 __pyx_ptype_2av_10dictionary__Dictionary = __Pyx_ImportType(__pyx_t_1, "av.dictionary", "_Dictionary", sizeof(struct __pyx_obj_2av_10dictionary__Dictionary), __Pyx_ImportType_CheckSize_Warn);
4118 if (!__pyx_ptype_2av_10dictionary__Dictionary) __PYX_ERR(8, 4, __pyx_L1_error)
4119 __pyx_vtabptr_2av_10dictionary__Dictionary = (struct __pyx_vtabstruct_2av_10dictionary__Dictionary*)__Pyx_GetVtable(__pyx_ptype_2av_10dictionary__Dictionary->tp_dict); if (unlikely(!__pyx_vtabptr_2av_10dictionary__Dictionary)) __PYX_ERR(8, 4, __pyx_L1_error)
4120 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4121 __pyx_t_1 = PyImport_ImportModule("av.format"); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 4, __pyx_L1_error)
4122 __Pyx_GOTREF(__pyx_t_1);
4123 __pyx_ptype_2av_6format_ContainerFormat = __Pyx_ImportType(__pyx_t_1, "av.format", "ContainerFormat", sizeof(struct __pyx_obj_2av_6format_ContainerFormat), __Pyx_ImportType_CheckSize_Warn);
4124 if (!__pyx_ptype_2av_6format_ContainerFormat) __PYX_ERR(9, 4, __pyx_L1_error)
4125 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4126 __pyx_t_1 = PyImport_ImportModule("av.container.core"); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 15, __pyx_L1_error)
4127 __Pyx_GOTREF(__pyx_t_1);
4128 __pyx_ptype_2av_9container_4core_Container = __Pyx_ImportType(__pyx_t_1, "av.container.core", "Container", sizeof(struct __pyx_obj_2av_9container_4core_Container), __Pyx_ImportType_CheckSize_Warn);
4129 if (!__pyx_ptype_2av_9container_4core_Container) __PYX_ERR(10, 15, __pyx_L1_error)
4130 __pyx_vtabptr_2av_9container_4core_Container = (struct __pyx_vtabstruct_2av_9container_4core_Container*)__Pyx_GetVtable(__pyx_ptype_2av_9container_4core_Container->tp_dict); if (unlikely(!__pyx_vtabptr_2av_9container_4core_Container)) __PYX_ERR(10, 15, __pyx_L1_error)
4131 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4132 __pyx_t_1 = PyImport_ImportModule("av.stream"); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 10, __pyx_L1_error)
4133 __Pyx_GOTREF(__pyx_t_1);
4134 __pyx_ptype_2av_6stream_Stream = __Pyx_ImportType(__pyx_t_1, "av.stream", "Stream", sizeof(struct __pyx_obj_2av_6stream_Stream), __Pyx_ImportType_CheckSize_Warn);
4135 if (!__pyx_ptype_2av_6stream_Stream) __PYX_ERR(11, 10, __pyx_L1_error)
4136 __pyx_vtabptr_2av_6stream_Stream = (struct __pyx_vtabstruct_2av_6stream_Stream*)__Pyx_GetVtable(__pyx_ptype_2av_6stream_Stream->tp_dict); if (unlikely(!__pyx_vtabptr_2av_6stream_Stream)) __PYX_ERR(11, 10, __pyx_L1_error)
4137 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4138 __pyx_t_1 = PyImport_ImportModule("av.packet"); if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 8, __pyx_L1_error)
4139 __Pyx_GOTREF(__pyx_t_1);
4140 __pyx_ptype_2av_6packet_Packet = __Pyx_ImportType(__pyx_t_1, "av.packet", "Packet", sizeof(struct __pyx_obj_2av_6packet_Packet), __Pyx_ImportType_CheckSize_Warn);
4141 if (!__pyx_ptype_2av_6packet_Packet) __PYX_ERR(12, 8, __pyx_L1_error)
4142 __pyx_vtabptr_2av_6packet_Packet = (struct __pyx_vtabstruct_2av_6packet_Packet*)__Pyx_GetVtable(__pyx_ptype_2av_6packet_Packet->tp_dict); if (unlikely(!__pyx_vtabptr_2av_6packet_Packet)) __PYX_ERR(12, 8, __pyx_L1_error)
4143 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4144 __pyx_t_1 = PyImport_ImportModule("av.sidedata.sidedata"); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 9, __pyx_L1_error)
4145 __Pyx_GOTREF(__pyx_t_1);
4146 __pyx_ptype_2av_8sidedata_8sidedata_SideData = __Pyx_ImportType(__pyx_t_1, "av.sidedata.sidedata", "SideData", sizeof(struct __pyx_obj_2av_8sidedata_8sidedata_SideData), __Pyx_ImportType_CheckSize_Warn);
4147 if (!__pyx_ptype_2av_8sidedata_8sidedata_SideData) __PYX_ERR(13, 9, __pyx_L1_error)
4148 __pyx_vtabptr_2av_8sidedata_8sidedata_SideData = (struct __pyx_vtabstruct_2av_8sidedata_8sidedata_SideData*)__Pyx_GetVtable(__pyx_ptype_2av_8sidedata_8sidedata_SideData->tp_dict); if (unlikely(!__pyx_vtabptr_2av_8sidedata_8sidedata_SideData)) __PYX_ERR(13, 9, __pyx_L1_error)
4149 __pyx_ptype_2av_8sidedata_8sidedata__SideDataContainer = __Pyx_ImportType(__pyx_t_1, "av.sidedata.sidedata", "_SideDataContainer", sizeof(struct __pyx_obj_2av_8sidedata_8sidedata__SideDataContainer), __Pyx_ImportType_CheckSize_Warn);
4150 if (!__pyx_ptype_2av_8sidedata_8sidedata__SideDataContainer) __PYX_ERR(13, 18, __pyx_L1_error)
4151 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4152 __pyx_t_1 = PyImport_ImportModule("av.frame"); if (unlikely(!__pyx_t_1)) __PYX_ERR(14, 7, __pyx_L1_error)
4153 __Pyx_GOTREF(__pyx_t_1);
4154 __pyx_ptype_2av_5frame_Frame = __Pyx_ImportType(__pyx_t_1, "av.frame", "Frame", sizeof(struct __pyx_obj_2av_5frame_Frame), __Pyx_ImportType_CheckSize_Warn);
4155 if (!__pyx_ptype_2av_5frame_Frame) __PYX_ERR(14, 7, __pyx_L1_error)
4156 __pyx_vtabptr_2av_5frame_Frame = (struct __pyx_vtabstruct_2av_5frame_Frame*)__Pyx_GetVtable(__pyx_ptype_2av_5frame_Frame->tp_dict); if (unlikely(!__pyx_vtabptr_2av_5frame_Frame)) __PYX_ERR(14, 7, __pyx_L1_error)
4157 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4158 __pyx_t_1 = PyImport_ImportModule("av.audio.frame"); if (unlikely(!__pyx_t_1)) __PYX_ERR(15, 9, __pyx_L1_error)
4159 __Pyx_GOTREF(__pyx_t_1);
4160 __pyx_ptype_2av_5audio_5frame_AudioFrame = __Pyx_ImportType(__pyx_t_1, "av.audio.frame", "AudioFrame", sizeof(struct __pyx_obj_2av_5audio_5frame_AudioFrame), __Pyx_ImportType_CheckSize_Warn);
4161 if (!__pyx_ptype_2av_5audio_5frame_AudioFrame) __PYX_ERR(15, 9, __pyx_L1_error)
4162 __pyx_vtabptr_2av_5audio_5frame_AudioFrame = (struct __pyx_vtabstruct_2av_5audio_5frame_AudioFrame*)__Pyx_GetVtable(__pyx_ptype_2av_5audio_5frame_AudioFrame->tp_dict); if (unlikely(!__pyx_vtabptr_2av_5audio_5frame_AudioFrame)) __PYX_ERR(15, 9, __pyx_L1_error)
4163 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4164 __pyx_t_1 = PyImport_ImportModule("av.audio.fifo"); if (unlikely(!__pyx_t_1)) __PYX_ERR(16, 7, __pyx_L1_error)
4165 __Pyx_GOTREF(__pyx_t_1);
4166 __pyx_ptype_2av_5audio_4fifo_AudioFifo = __Pyx_ImportType(__pyx_t_1, "av.audio.fifo", "AudioFifo", sizeof(struct __pyx_obj_2av_5audio_4fifo_AudioFifo), __Pyx_ImportType_CheckSize_Warn);
4167 if (!__pyx_ptype_2av_5audio_4fifo_AudioFifo) __PYX_ERR(16, 7, __pyx_L1_error)
4168 __pyx_vtabptr_2av_5audio_4fifo_AudioFifo = (struct __pyx_vtabstruct_2av_5audio_4fifo_AudioFifo*)__Pyx_GetVtable(__pyx_ptype_2av_5audio_4fifo_AudioFifo->tp_dict); if (unlikely(!__pyx_vtabptr_2av_5audio_4fifo_AudioFifo)) __PYX_ERR(16, 7, __pyx_L1_error)
4169 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4170 __pyx_t_1 = PyImport_ImportModule("av.audio.resampler"); if (unlikely(!__pyx_t_1)) __PYX_ERR(17, 9, __pyx_L1_error)
4171 __Pyx_GOTREF(__pyx_t_1);
4172 __pyx_ptype_2av_5audio_9resampler_AudioResampler = __Pyx_ImportType(__pyx_t_1, "av.audio.resampler", "AudioResampler", sizeof(struct __pyx_obj_2av_5audio_9resampler_AudioResampler), __Pyx_ImportType_CheckSize_Warn);
4173 if (!__pyx_ptype_2av_5audio_9resampler_AudioResampler) __PYX_ERR(17, 9, __pyx_L1_error)
4174 __pyx_vtabptr_2av_5audio_9resampler_AudioResampler = (struct __pyx_vtabstruct_2av_5audio_9resampler_AudioResampler*)__Pyx_GetVtable(__pyx_ptype_2av_5audio_9resampler_AudioResampler->tp_dict); if (unlikely(!__pyx_vtabptr_2av_5audio_9resampler_AudioResampler)) __PYX_ERR(17, 9, __pyx_L1_error)
4175 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4176 __Pyx_RefNannyFinishContext();
4177 return 0;
4178 __pyx_L1_error:;
4179 __Pyx_XDECREF(__pyx_t_1);
4180 __Pyx_RefNannyFinishContext();
4181 return -1;
4182 }
4183
__Pyx_modinit_variable_import_code(void)4184 static int __Pyx_modinit_variable_import_code(void) {
4185 __Pyx_RefNannyDeclarations
4186 __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
4187 /*--- Variable import code ---*/
4188 __Pyx_RefNannyFinishContext();
4189 return 0;
4190 }
4191
__Pyx_modinit_function_import_code(void)4192 static int __Pyx_modinit_function_import_code(void) {
4193 __Pyx_RefNannyDeclarations
4194 PyObject *__pyx_t_1 = NULL;
4195 int __pyx_lineno = 0;
4196 const char *__pyx_filename = NULL;
4197 int __pyx_clineno = 0;
4198 __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
4199 /*--- Function import code ---*/
4200 __pyx_t_1 = PyImport_ImportModule("av.audio.format"); if (!__pyx_t_1) __PYX_ERR(1, 1, __pyx_L1_error)
4201 __Pyx_GOTREF(__pyx_t_1);
4202 if (__Pyx_ImportFunction(__pyx_t_1, "get_audio_format", (void (**)(void))&__pyx_f_2av_5audio_6format_get_audio_format, "struct __pyx_obj_2av_5audio_6format_AudioFormat *(enum AVSampleFormat)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
4203 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4204 __pyx_t_1 = PyImport_ImportModule("av.audio.layout"); if (!__pyx_t_1) __PYX_ERR(1, 1, __pyx_L1_error)
4205 __Pyx_GOTREF(__pyx_t_1);
4206 if (__Pyx_ImportFunction(__pyx_t_1, "get_audio_layout", (void (**)(void))&__pyx_f_2av_5audio_6layout_get_audio_layout, "struct __pyx_obj_2av_5audio_6layout_AudioLayout *(int, uint64_t)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
4207 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4208 __pyx_t_1 = PyImport_ImportModule("av.dictionary"); if (!__pyx_t_1) __PYX_ERR(1, 1, __pyx_L1_error)
4209 __Pyx_GOTREF(__pyx_t_1);
4210 if (__Pyx_ImportFunction(__pyx_t_1, "wrap_dictionary", (void (**)(void))&__pyx_f_2av_10dictionary_wrap_dictionary, "struct __pyx_obj_2av_10dictionary__Dictionary *(AVDictionary *)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
4211 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4212 __pyx_t_1 = PyImport_ImportModule("av.audio.frame"); if (!__pyx_t_1) __PYX_ERR(1, 1, __pyx_L1_error)
4213 __Pyx_GOTREF(__pyx_t_1);
4214 if (__Pyx_ImportFunction(__pyx_t_1, "alloc_audio_frame", (void (**)(void))&__pyx_f_2av_5audio_5frame_alloc_audio_frame, "struct __pyx_obj_2av_5audio_5frame_AudioFrame *(void)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
4215 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4216 __pyx_t_1 = PyImport_ImportModule("av.error"); if (!__pyx_t_1) __PYX_ERR(1, 1, __pyx_L1_error)
4217 __Pyx_GOTREF(__pyx_t_1);
4218 if (__Pyx_ImportFunction(__pyx_t_1, "err_check", (void (**)(void))&__pyx_f_2av_5error_err_check, "int (int, int __pyx_skip_dispatch, struct __pyx_opt_args_2av_5error_err_check *__pyx_optional_args)") < 0) __PYX_ERR(1, 1, __pyx_L1_error)
4219 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4220 __Pyx_RefNannyFinishContext();
4221 return 0;
4222 __pyx_L1_error:;
4223 __Pyx_XDECREF(__pyx_t_1);
4224 __Pyx_RefNannyFinishContext();
4225 return -1;
4226 }
4227
4228
4229 #ifndef CYTHON_NO_PYINIT_EXPORT
4230 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
4231 #elif PY_MAJOR_VERSION < 3
4232 #ifdef __cplusplus
4233 #define __Pyx_PyMODINIT_FUNC extern "C" void
4234 #else
4235 #define __Pyx_PyMODINIT_FUNC void
4236 #endif
4237 #else
4238 #ifdef __cplusplus
4239 #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
4240 #else
4241 #define __Pyx_PyMODINIT_FUNC PyObject *
4242 #endif
4243 #endif
4244
4245
4246 #if PY_MAJOR_VERSION < 3
4247 __Pyx_PyMODINIT_FUNC initcodeccontext(void) CYTHON_SMALL_CODE; /*proto*/
initcodeccontext(void)4248 __Pyx_PyMODINIT_FUNC initcodeccontext(void)
4249 #else
4250 __Pyx_PyMODINIT_FUNC PyInit_codeccontext(void) CYTHON_SMALL_CODE; /*proto*/
4251 __Pyx_PyMODINIT_FUNC PyInit_codeccontext(void)
4252 #if CYTHON_PEP489_MULTI_PHASE_INIT
4253 {
4254 return PyModuleDef_Init(&__pyx_moduledef);
4255 }
4256 static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
4257 #if PY_VERSION_HEX >= 0x030700A1
4258 static PY_INT64_T main_interpreter_id = -1;
4259 PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
4260 if (main_interpreter_id == -1) {
4261 main_interpreter_id = current_id;
4262 return (unlikely(current_id == -1)) ? -1 : 0;
4263 } else if (unlikely(main_interpreter_id != current_id))
4264 #else
4265 static PyInterpreterState *main_interpreter = NULL;
4266 PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
4267 if (!main_interpreter) {
4268 main_interpreter = current_interpreter;
4269 } else if (unlikely(main_interpreter != current_interpreter))
4270 #endif
4271 {
4272 PyErr_SetString(
4273 PyExc_ImportError,
4274 "Interpreter change detected - this module can only be loaded into one interpreter per process.");
4275 return -1;
4276 }
4277 return 0;
4278 }
4279 static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) {
4280 PyObject *value = PyObject_GetAttrString(spec, from_name);
4281 int result = 0;
4282 if (likely(value)) {
4283 if (allow_none || value != Py_None) {
4284 result = PyDict_SetItemString(moddict, to_name, value);
4285 }
4286 Py_DECREF(value);
4287 } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
4288 PyErr_Clear();
4289 } else {
4290 result = -1;
4291 }
4292 return result;
4293 }
4294 static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
4295 PyObject *module = NULL, *moddict, *modname;
4296 if (__Pyx_check_single_interpreter())
4297 return NULL;
4298 if (__pyx_m)
4299 return __Pyx_NewRef(__pyx_m);
4300 modname = PyObject_GetAttrString(spec, "name");
4301 if (unlikely(!modname)) goto bad;
4302 module = PyModule_NewObject(modname);
4303 Py_DECREF(modname);
4304 if (unlikely(!module)) goto bad;
4305 moddict = PyModule_GetDict(module);
4306 if (unlikely(!moddict)) goto bad;
4307 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
4308 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
4309 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
4310 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
4311 return module;
4312 bad:
4313 Py_XDECREF(module);
4314 return NULL;
4315 }
4316
4317
4318 static CYTHON_SMALL_CODE int __pyx_pymod_exec_codeccontext(PyObject *__pyx_pyinit_module)
4319 #endif
4320 #endif
4321 {
4322 PyObject *__pyx_t_1 = NULL;
4323 int __pyx_lineno = 0;
4324 const char *__pyx_filename = NULL;
4325 int __pyx_clineno = 0;
4326 __Pyx_RefNannyDeclarations
4327 #if CYTHON_PEP489_MULTI_PHASE_INIT
4328 if (__pyx_m) {
4329 if (__pyx_m == __pyx_pyinit_module) return 0;
4330 PyErr_SetString(PyExc_RuntimeError, "Module 'codeccontext' has already been imported. Re-initialisation is not supported.");
4331 return -1;
4332 }
4333 #elif PY_MAJOR_VERSION >= 3
4334 if (__pyx_m) return __Pyx_NewRef(__pyx_m);
4335 #endif
4336 #if CYTHON_REFNANNY
4337 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
4338 if (!__Pyx_RefNanny) {
4339 PyErr_Clear();
4340 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
4341 if (!__Pyx_RefNanny)
4342 Py_FatalError("failed to import 'refnanny' module");
4343 }
4344 #endif
4345 __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_codeccontext(void)", 0);
4346 if (__Pyx_check_binary_version() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
4347 #ifdef __Pxy_PyFrame_Initialize_Offsets
4348 __Pxy_PyFrame_Initialize_Offsets();
4349 #endif
4350 __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(1, 1, __pyx_L1_error)
4351 __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(1, 1, __pyx_L1_error)
4352 __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(1, 1, __pyx_L1_error)
4353 #ifdef __Pyx_CyFunction_USED
4354 if (__pyx_CyFunction_init() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
4355 #endif
4356 #ifdef __Pyx_FusedFunction_USED
4357 if (__pyx_FusedFunction_init() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
4358 #endif
4359 #ifdef __Pyx_Coroutine_USED
4360 if (__pyx_Coroutine_init() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
4361 #endif
4362 #ifdef __Pyx_Generator_USED
4363 if (__pyx_Generator_init() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
4364 #endif
4365 #ifdef __Pyx_AsyncGen_USED
4366 if (__pyx_AsyncGen_init() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
4367 #endif
4368 #ifdef __Pyx_StopAsyncIteration_USED
4369 if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
4370 #endif
4371 /*--- Library function declarations ---*/
4372 /*--- Threads initialization code ---*/
4373 #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
4374 #ifdef WITH_THREAD /* Python build with threading support? */
4375 PyEval_InitThreads();
4376 #endif
4377 #endif
4378 /*--- Module creation code ---*/
4379 #if CYTHON_PEP489_MULTI_PHASE_INIT
4380 __pyx_m = __pyx_pyinit_module;
4381 Py_INCREF(__pyx_m);
4382 #else
4383 #if PY_MAJOR_VERSION < 3
4384 __pyx_m = Py_InitModule4("codeccontext", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
4385 #else
4386 __pyx_m = PyModule_Create(&__pyx_moduledef);
4387 #endif
4388 if (unlikely(!__pyx_m)) __PYX_ERR(1, 1, __pyx_L1_error)
4389 #endif
4390 __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(1, 1, __pyx_L1_error)
4391 Py_INCREF(__pyx_d);
4392 __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(1, 1, __pyx_L1_error)
4393 Py_INCREF(__pyx_b);
4394 __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(1, 1, __pyx_L1_error)
4395 Py_INCREF(__pyx_cython_runtime);
4396 if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(1, 1, __pyx_L1_error);
4397 /*--- Initialize various global constants etc. ---*/
4398 if (__Pyx_InitGlobals() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
4399 #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
4400 if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
4401 #endif
4402 if (__pyx_module_is_main_av__audio__codeccontext) {
4403 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
4404 }
4405 #if PY_MAJOR_VERSION >= 3
4406 {
4407 PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(1, 1, __pyx_L1_error)
4408 if (!PyDict_GetItemString(modules, "av.audio.codeccontext")) {
4409 if (unlikely(PyDict_SetItemString(modules, "av.audio.codeccontext", __pyx_m) < 0)) __PYX_ERR(1, 1, __pyx_L1_error)
4410 }
4411 }
4412 #endif
4413 /*--- Builtin init code ---*/
4414 if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
4415 /*--- Constants init code ---*/
4416 if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
4417 /*--- Global type/function init code ---*/
4418 (void)__Pyx_modinit_global_init_code();
4419 (void)__Pyx_modinit_variable_export_code();
4420 (void)__Pyx_modinit_function_export_code();
4421 if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(1, 1, __pyx_L1_error)
4422 if (unlikely(__Pyx_modinit_type_import_code() < 0)) __PYX_ERR(1, 1, __pyx_L1_error)
4423 (void)__Pyx_modinit_variable_import_code();
4424 if (unlikely(__Pyx_modinit_function_import_code() < 0)) __PYX_ERR(1, 1, __pyx_L1_error)
4425 /*--- Execution code ---*/
4426 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
4427 if (__Pyx_patch_abc() < 0) __PYX_ERR(1, 1, __pyx_L1_error)
4428 #endif
4429
4430 /* "av/audio/codeccontext.pyx":1
4431 * cimport libav as lib # <<<<<<<<<<<<<<
4432 *
4433 * from av.audio.format cimport AudioFormat, get_audio_format
4434 */
4435 __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 1, __pyx_L1_error)
4436 __Pyx_GOTREF(__pyx_t_1);
4437 if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(1, 1, __pyx_L1_error)
4438 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4439
4440 /*--- Wrapped vars code ---*/
4441
4442 goto __pyx_L0;
4443 __pyx_L1_error:;
4444 __Pyx_XDECREF(__pyx_t_1);
4445 if (__pyx_m) {
4446 if (__pyx_d) {
4447 __Pyx_AddTraceback("init av.audio.codeccontext", __pyx_clineno, __pyx_lineno, __pyx_filename);
4448 }
4449 Py_CLEAR(__pyx_m);
4450 } else if (!PyErr_Occurred()) {
4451 PyErr_SetString(PyExc_ImportError, "init av.audio.codeccontext");
4452 }
4453 __pyx_L0:;
4454 __Pyx_RefNannyFinishContext();
4455 #if CYTHON_PEP489_MULTI_PHASE_INIT
4456 return (__pyx_m != NULL) ? 0 : -1;
4457 #elif PY_MAJOR_VERSION >= 3
4458 return __pyx_m;
4459 #else
4460 return;
4461 #endif
4462 }
4463
4464 /* --- Runtime support code --- */
4465 /* Refnanny */
4466 #if CYTHON_REFNANNY
__Pyx_RefNannyImportAPI(const char * modname)4467 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
4468 PyObject *m = NULL, *p = NULL;
4469 void *r = NULL;
4470 m = PyImport_ImportModule(modname);
4471 if (!m) goto end;
4472 p = PyObject_GetAttrString(m, "RefNannyAPI");
4473 if (!p) goto end;
4474 r = PyLong_AsVoidPtr(p);
4475 end:
4476 Py_XDECREF(p);
4477 Py_XDECREF(m);
4478 return (__Pyx_RefNannyAPIStruct *)r;
4479 }
4480 #endif
4481
4482 /* PyObjectGetAttrStr */
4483 #if CYTHON_USE_TYPE_SLOTS
__Pyx_PyObject_GetAttrStr(PyObject * obj,PyObject * attr_name)4484 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
4485 PyTypeObject* tp = Py_TYPE(obj);
4486 if (likely(tp->tp_getattro))
4487 return tp->tp_getattro(obj, attr_name);
4488 #if PY_MAJOR_VERSION < 3
4489 if (likely(tp->tp_getattr))
4490 return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
4491 #endif
4492 return PyObject_GetAttr(obj, attr_name);
4493 }
4494 #endif
4495
4496 /* GetBuiltinName */
__Pyx_GetBuiltinName(PyObject * name)4497 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
4498 PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
4499 if (unlikely(!result)) {
4500 PyErr_Format(PyExc_NameError,
4501 #if PY_MAJOR_VERSION >= 3
4502 "name '%U' is not defined", name);
4503 #else
4504 "name '%.200s' is not defined", PyString_AS_STRING(name));
4505 #endif
4506 }
4507 return result;
4508 }
4509
4510 /* ExtTypeTest */
__Pyx_TypeTest(PyObject * obj,PyTypeObject * type)4511 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
4512 if (unlikely(!type)) {
4513 PyErr_SetString(PyExc_SystemError, "Missing type object");
4514 return 0;
4515 }
4516 if (likely(__Pyx_TypeCheck(obj, type)))
4517 return 1;
4518 PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
4519 Py_TYPE(obj)->tp_name, type->tp_name);
4520 return 0;
4521 }
4522
4523 /* PyObjectCall */
4524 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_Call(PyObject * func,PyObject * arg,PyObject * kw)4525 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
4526 PyObject *result;
4527 ternaryfunc call = func->ob_type->tp_call;
4528 if (unlikely(!call))
4529 return PyObject_Call(func, arg, kw);
4530 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
4531 return NULL;
4532 result = (*call)(func, arg, kw);
4533 Py_LeaveRecursiveCall();
4534 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
4535 PyErr_SetString(
4536 PyExc_SystemError,
4537 "NULL result without error in PyObject_Call");
4538 }
4539 return result;
4540 }
4541 #endif
4542
4543 /* PyFunctionFastCall */
4544 #if CYTHON_FAST_PYCALL
__Pyx_PyFunction_FastCallNoKw(PyCodeObject * co,PyObject ** args,Py_ssize_t na,PyObject * globals)4545 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
4546 PyObject *globals) {
4547 PyFrameObject *f;
4548 PyThreadState *tstate = __Pyx_PyThreadState_Current;
4549 PyObject **fastlocals;
4550 Py_ssize_t i;
4551 PyObject *result;
4552 assert(globals != NULL);
4553 /* XXX Perhaps we should create a specialized
4554 PyFrame_New() that doesn't take locals, but does
4555 take builtins without sanity checking them.
4556 */
4557 assert(tstate != NULL);
4558 f = PyFrame_New(tstate, co, globals, NULL);
4559 if (f == NULL) {
4560 return NULL;
4561 }
4562 fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
4563 for (i = 0; i < na; i++) {
4564 Py_INCREF(*args);
4565 fastlocals[i] = *args++;
4566 }
4567 result = PyEval_EvalFrameEx(f,0);
4568 ++tstate->recursion_depth;
4569 Py_DECREF(f);
4570 --tstate->recursion_depth;
4571 return result;
4572 }
4573 #if 1 || PY_VERSION_HEX < 0x030600B1
__Pyx_PyFunction_FastCallDict(PyObject * func,PyObject ** args,Py_ssize_t nargs,PyObject * kwargs)4574 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
4575 PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
4576 PyObject *globals = PyFunction_GET_GLOBALS(func);
4577 PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
4578 PyObject *closure;
4579 #if PY_MAJOR_VERSION >= 3
4580 PyObject *kwdefs;
4581 #endif
4582 PyObject *kwtuple, **k;
4583 PyObject **d;
4584 Py_ssize_t nd;
4585 Py_ssize_t nk;
4586 PyObject *result;
4587 assert(kwargs == NULL || PyDict_Check(kwargs));
4588 nk = kwargs ? PyDict_Size(kwargs) : 0;
4589 if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
4590 return NULL;
4591 }
4592 if (
4593 #if PY_MAJOR_VERSION >= 3
4594 co->co_kwonlyargcount == 0 &&
4595 #endif
4596 likely(kwargs == NULL || nk == 0) &&
4597 co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
4598 if (argdefs == NULL && co->co_argcount == nargs) {
4599 result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
4600 goto done;
4601 }
4602 else if (nargs == 0 && argdefs != NULL
4603 && co->co_argcount == Py_SIZE(argdefs)) {
4604 /* function called with no arguments, but all parameters have
4605 a default value: use default values as arguments .*/
4606 args = &PyTuple_GET_ITEM(argdefs, 0);
4607 result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
4608 goto done;
4609 }
4610 }
4611 if (kwargs != NULL) {
4612 Py_ssize_t pos, i;
4613 kwtuple = PyTuple_New(2 * nk);
4614 if (kwtuple == NULL) {
4615 result = NULL;
4616 goto done;
4617 }
4618 k = &PyTuple_GET_ITEM(kwtuple, 0);
4619 pos = i = 0;
4620 while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
4621 Py_INCREF(k[i]);
4622 Py_INCREF(k[i+1]);
4623 i += 2;
4624 }
4625 nk = i / 2;
4626 }
4627 else {
4628 kwtuple = NULL;
4629 k = NULL;
4630 }
4631 closure = PyFunction_GET_CLOSURE(func);
4632 #if PY_MAJOR_VERSION >= 3
4633 kwdefs = PyFunction_GET_KW_DEFAULTS(func);
4634 #endif
4635 if (argdefs != NULL) {
4636 d = &PyTuple_GET_ITEM(argdefs, 0);
4637 nd = Py_SIZE(argdefs);
4638 }
4639 else {
4640 d = NULL;
4641 nd = 0;
4642 }
4643 #if PY_MAJOR_VERSION >= 3
4644 result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
4645 args, (int)nargs,
4646 k, (int)nk,
4647 d, (int)nd, kwdefs, closure);
4648 #else
4649 result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
4650 args, (int)nargs,
4651 k, (int)nk,
4652 d, (int)nd, closure);
4653 #endif
4654 Py_XDECREF(kwtuple);
4655 done:
4656 Py_LeaveRecursiveCall();
4657 return result;
4658 }
4659 #endif
4660 #endif
4661
4662 /* PyObjectCallMethO */
4663 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_CallMethO(PyObject * func,PyObject * arg)4664 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
4665 PyObject *self, *result;
4666 PyCFunction cfunc;
4667 cfunc = PyCFunction_GET_FUNCTION(func);
4668 self = PyCFunction_GET_SELF(func);
4669 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
4670 return NULL;
4671 result = cfunc(self, arg);
4672 Py_LeaveRecursiveCall();
4673 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
4674 PyErr_SetString(
4675 PyExc_SystemError,
4676 "NULL result without error in PyObject_Call");
4677 }
4678 return result;
4679 }
4680 #endif
4681
4682 /* PyObjectCallNoArg */
4683 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_CallNoArg(PyObject * func)4684 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
4685 #if CYTHON_FAST_PYCALL
4686 if (PyFunction_Check(func)) {
4687 return __Pyx_PyFunction_FastCall(func, NULL, 0);
4688 }
4689 #endif
4690 #ifdef __Pyx_CyFunction_USED
4691 if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func)))
4692 #else
4693 if (likely(PyCFunction_Check(func)))
4694 #endif
4695 {
4696 if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
4697 return __Pyx_PyObject_CallMethO(func, NULL);
4698 }
4699 }
4700 return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
4701 }
4702 #endif
4703
4704 /* PyCFunctionFastCall */
4705 #if CYTHON_FAST_PYCCALL
__Pyx_PyCFunction_FastCall(PyObject * func_obj,PyObject ** args,Py_ssize_t nargs)4706 static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
4707 PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
4708 PyCFunction meth = PyCFunction_GET_FUNCTION(func);
4709 PyObject *self = PyCFunction_GET_SELF(func);
4710 int flags = PyCFunction_GET_FLAGS(func);
4711 assert(PyCFunction_Check(func));
4712 assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
4713 assert(nargs >= 0);
4714 assert(nargs == 0 || args != NULL);
4715 /* _PyCFunction_FastCallDict() must not be called with an exception set,
4716 because it may clear it (directly or indirectly) and so the
4717 caller loses its exception */
4718 assert(!PyErr_Occurred());
4719 if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
4720 return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
4721 } else {
4722 return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
4723 }
4724 }
4725 #endif
4726
4727 /* PyObjectCall2Args */
__Pyx_PyObject_Call2Args(PyObject * function,PyObject * arg1,PyObject * arg2)4728 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
4729 PyObject *args, *result = NULL;
4730 #if CYTHON_FAST_PYCALL
4731 if (PyFunction_Check(function)) {
4732 PyObject *args[2] = {arg1, arg2};
4733 return __Pyx_PyFunction_FastCall(function, args, 2);
4734 }
4735 #endif
4736 #if CYTHON_FAST_PYCCALL
4737 if (__Pyx_PyFastCFunction_Check(function)) {
4738 PyObject *args[2] = {arg1, arg2};
4739 return __Pyx_PyCFunction_FastCall(function, args, 2);
4740 }
4741 #endif
4742 args = PyTuple_New(2);
4743 if (unlikely(!args)) goto done;
4744 Py_INCREF(arg1);
4745 PyTuple_SET_ITEM(args, 0, arg1);
4746 Py_INCREF(arg2);
4747 PyTuple_SET_ITEM(args, 1, arg2);
4748 Py_INCREF(function);
4749 result = __Pyx_PyObject_Call(function, args, NULL);
4750 Py_DECREF(args);
4751 Py_DECREF(function);
4752 done:
4753 return result;
4754 }
4755
4756 /* PyObjectCallOneArg */
4757 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx__PyObject_CallOneArg(PyObject * func,PyObject * arg)4758 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
4759 PyObject *result;
4760 PyObject *args = PyTuple_New(1);
4761 if (unlikely(!args)) return NULL;
4762 Py_INCREF(arg);
4763 PyTuple_SET_ITEM(args, 0, arg);
4764 result = __Pyx_PyObject_Call(func, args, NULL);
4765 Py_DECREF(args);
4766 return result;
4767 }
__Pyx_PyObject_CallOneArg(PyObject * func,PyObject * arg)4768 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
4769 #if CYTHON_FAST_PYCALL
4770 if (PyFunction_Check(func)) {
4771 return __Pyx_PyFunction_FastCall(func, &arg, 1);
4772 }
4773 #endif
4774 if (likely(PyCFunction_Check(func))) {
4775 if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
4776 return __Pyx_PyObject_CallMethO(func, arg);
4777 #if CYTHON_FAST_PYCCALL
4778 } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
4779 return __Pyx_PyCFunction_FastCall(func, &arg, 1);
4780 #endif
4781 }
4782 }
4783 return __Pyx__PyObject_CallOneArg(func, arg);
4784 }
4785 #else
__Pyx_PyObject_CallOneArg(PyObject * func,PyObject * arg)4786 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
4787 PyObject *result;
4788 PyObject *args = PyTuple_Pack(1, arg);
4789 if (unlikely(!args)) return NULL;
4790 result = __Pyx_PyObject_Call(func, args, NULL);
4791 Py_DECREF(args);
4792 return result;
4793 }
4794 #endif
4795
4796 /* PyObjectGetMethod */
__Pyx_PyObject_GetMethod(PyObject * obj,PyObject * name,PyObject ** method)4797 static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) {
4798 PyObject *attr;
4799 #if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP
4800 PyTypeObject *tp = Py_TYPE(obj);
4801 PyObject *descr;
4802 descrgetfunc f = NULL;
4803 PyObject **dictptr, *dict;
4804 int meth_found = 0;
4805 assert (*method == NULL);
4806 if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) {
4807 attr = __Pyx_PyObject_GetAttrStr(obj, name);
4808 goto try_unpack;
4809 }
4810 if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) {
4811 return 0;
4812 }
4813 descr = _PyType_Lookup(tp, name);
4814 if (likely(descr != NULL)) {
4815 Py_INCREF(descr);
4816 #if PY_MAJOR_VERSION >= 3
4817 #ifdef __Pyx_CyFunction_USED
4818 if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr)))
4819 #else
4820 if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type)))
4821 #endif
4822 #else
4823 #ifdef __Pyx_CyFunction_USED
4824 if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr)))
4825 #else
4826 if (likely(PyFunction_Check(descr)))
4827 #endif
4828 #endif
4829 {
4830 meth_found = 1;
4831 } else {
4832 f = Py_TYPE(descr)->tp_descr_get;
4833 if (f != NULL && PyDescr_IsData(descr)) {
4834 attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
4835 Py_DECREF(descr);
4836 goto try_unpack;
4837 }
4838 }
4839 }
4840 dictptr = _PyObject_GetDictPtr(obj);
4841 if (dictptr != NULL && (dict = *dictptr) != NULL) {
4842 Py_INCREF(dict);
4843 attr = __Pyx_PyDict_GetItemStr(dict, name);
4844 if (attr != NULL) {
4845 Py_INCREF(attr);
4846 Py_DECREF(dict);
4847 Py_XDECREF(descr);
4848 goto try_unpack;
4849 }
4850 Py_DECREF(dict);
4851 }
4852 if (meth_found) {
4853 *method = descr;
4854 return 1;
4855 }
4856 if (f != NULL) {
4857 attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
4858 Py_DECREF(descr);
4859 goto try_unpack;
4860 }
4861 if (descr != NULL) {
4862 *method = descr;
4863 return 0;
4864 }
4865 PyErr_Format(PyExc_AttributeError,
4866 #if PY_MAJOR_VERSION >= 3
4867 "'%.50s' object has no attribute '%U'",
4868 tp->tp_name, name);
4869 #else
4870 "'%.50s' object has no attribute '%.400s'",
4871 tp->tp_name, PyString_AS_STRING(name));
4872 #endif
4873 return 0;
4874 #else
4875 attr = __Pyx_PyObject_GetAttrStr(obj, name);
4876 goto try_unpack;
4877 #endif
4878 try_unpack:
4879 #if CYTHON_UNPACK_METHODS
4880 if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) {
4881 PyObject *function = PyMethod_GET_FUNCTION(attr);
4882 Py_INCREF(function);
4883 Py_DECREF(attr);
4884 *method = function;
4885 return 1;
4886 }
4887 #endif
4888 *method = attr;
4889 return 0;
4890 }
4891
4892 /* PyObjectCallMethod1 */
__Pyx__PyObject_CallMethod1(PyObject * method,PyObject * arg)4893 static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) {
4894 PyObject *result = __Pyx_PyObject_CallOneArg(method, arg);
4895 Py_DECREF(method);
4896 return result;
4897 }
__Pyx_PyObject_CallMethod1(PyObject * obj,PyObject * method_name,PyObject * arg)4898 static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) {
4899 PyObject *method = NULL, *result;
4900 int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
4901 if (likely(is_method)) {
4902 result = __Pyx_PyObject_Call2Args(method, obj, arg);
4903 Py_DECREF(method);
4904 return result;
4905 }
4906 if (unlikely(!method)) return NULL;
4907 return __Pyx__PyObject_CallMethod1(method, arg);
4908 }
4909
4910 /* append */
__Pyx_PyObject_Append(PyObject * L,PyObject * x)4911 static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x) {
4912 if (likely(PyList_CheckExact(L))) {
4913 if (unlikely(__Pyx_PyList_Append(L, x) < 0)) return -1;
4914 } else {
4915 PyObject* retval = __Pyx_PyObject_CallMethod1(L, __pyx_n_s_append, x);
4916 if (unlikely(!retval))
4917 return -1;
4918 Py_DECREF(retval);
4919 }
4920 return 0;
4921 }
4922
4923 /* PyObjectSetAttrStr */
4924 #if CYTHON_USE_TYPE_SLOTS
__Pyx_PyObject_SetAttrStr(PyObject * obj,PyObject * attr_name,PyObject * value)4925 static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) {
4926 PyTypeObject* tp = Py_TYPE(obj);
4927 if (likely(tp->tp_setattro))
4928 return tp->tp_setattro(obj, attr_name, value);
4929 #if PY_MAJOR_VERSION < 3
4930 if (likely(tp->tp_setattr))
4931 return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value);
4932 #endif
4933 return PyObject_SetAttr(obj, attr_name, value);
4934 }
4935 #endif
4936
4937 /* PyErrFetchRestore */
4938 #if CYTHON_FAST_THREAD_STATE
__Pyx_ErrRestoreInState(PyThreadState * tstate,PyObject * type,PyObject * value,PyObject * tb)4939 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
4940 PyObject *tmp_type, *tmp_value, *tmp_tb;
4941 tmp_type = tstate->curexc_type;
4942 tmp_value = tstate->curexc_value;
4943 tmp_tb = tstate->curexc_traceback;
4944 tstate->curexc_type = type;
4945 tstate->curexc_value = value;
4946 tstate->curexc_traceback = tb;
4947 Py_XDECREF(tmp_type);
4948 Py_XDECREF(tmp_value);
4949 Py_XDECREF(tmp_tb);
4950 }
__Pyx_ErrFetchInState(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)4951 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
4952 *type = tstate->curexc_type;
4953 *value = tstate->curexc_value;
4954 *tb = tstate->curexc_traceback;
4955 tstate->curexc_type = 0;
4956 tstate->curexc_value = 0;
4957 tstate->curexc_traceback = 0;
4958 }
4959 #endif
4960
4961 /* RaiseException */
4962 #if PY_MAJOR_VERSION < 3
__Pyx_Raise(PyObject * type,PyObject * value,PyObject * tb,CYTHON_UNUSED PyObject * cause)4963 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
4964 CYTHON_UNUSED PyObject *cause) {
4965 __Pyx_PyThreadState_declare
4966 Py_XINCREF(type);
4967 if (!value || value == Py_None)
4968 value = NULL;
4969 else
4970 Py_INCREF(value);
4971 if (!tb || tb == Py_None)
4972 tb = NULL;
4973 else {
4974 Py_INCREF(tb);
4975 if (!PyTraceBack_Check(tb)) {
4976 PyErr_SetString(PyExc_TypeError,
4977 "raise: arg 3 must be a traceback or None");
4978 goto raise_error;
4979 }
4980 }
4981 if (PyType_Check(type)) {
4982 #if CYTHON_COMPILING_IN_PYPY
4983 if (!value) {
4984 Py_INCREF(Py_None);
4985 value = Py_None;
4986 }
4987 #endif
4988 PyErr_NormalizeException(&type, &value, &tb);
4989 } else {
4990 if (value) {
4991 PyErr_SetString(PyExc_TypeError,
4992 "instance exception may not have a separate value");
4993 goto raise_error;
4994 }
4995 value = type;
4996 type = (PyObject*) Py_TYPE(type);
4997 Py_INCREF(type);
4998 if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
4999 PyErr_SetString(PyExc_TypeError,
5000 "raise: exception class must be a subclass of BaseException");
5001 goto raise_error;
5002 }
5003 }
5004 __Pyx_PyThreadState_assign
5005 __Pyx_ErrRestore(type, value, tb);
5006 return;
5007 raise_error:
5008 Py_XDECREF(value);
5009 Py_XDECREF(type);
5010 Py_XDECREF(tb);
5011 return;
5012 }
5013 #else
__Pyx_Raise(PyObject * type,PyObject * value,PyObject * tb,PyObject * cause)5014 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
5015 PyObject* owned_instance = NULL;
5016 if (tb == Py_None) {
5017 tb = 0;
5018 } else if (tb && !PyTraceBack_Check(tb)) {
5019 PyErr_SetString(PyExc_TypeError,
5020 "raise: arg 3 must be a traceback or None");
5021 goto bad;
5022 }
5023 if (value == Py_None)
5024 value = 0;
5025 if (PyExceptionInstance_Check(type)) {
5026 if (value) {
5027 PyErr_SetString(PyExc_TypeError,
5028 "instance exception may not have a separate value");
5029 goto bad;
5030 }
5031 value = type;
5032 type = (PyObject*) Py_TYPE(value);
5033 } else if (PyExceptionClass_Check(type)) {
5034 PyObject *instance_class = NULL;
5035 if (value && PyExceptionInstance_Check(value)) {
5036 instance_class = (PyObject*) Py_TYPE(value);
5037 if (instance_class != type) {
5038 int is_subclass = PyObject_IsSubclass(instance_class, type);
5039 if (!is_subclass) {
5040 instance_class = NULL;
5041 } else if (unlikely(is_subclass == -1)) {
5042 goto bad;
5043 } else {
5044 type = instance_class;
5045 }
5046 }
5047 }
5048 if (!instance_class) {
5049 PyObject *args;
5050 if (!value)
5051 args = PyTuple_New(0);
5052 else if (PyTuple_Check(value)) {
5053 Py_INCREF(value);
5054 args = value;
5055 } else
5056 args = PyTuple_Pack(1, value);
5057 if (!args)
5058 goto bad;
5059 owned_instance = PyObject_Call(type, args, NULL);
5060 Py_DECREF(args);
5061 if (!owned_instance)
5062 goto bad;
5063 value = owned_instance;
5064 if (!PyExceptionInstance_Check(value)) {
5065 PyErr_Format(PyExc_TypeError,
5066 "calling %R should have returned an instance of "
5067 "BaseException, not %R",
5068 type, Py_TYPE(value));
5069 goto bad;
5070 }
5071 }
5072 } else {
5073 PyErr_SetString(PyExc_TypeError,
5074 "raise: exception class must be a subclass of BaseException");
5075 goto bad;
5076 }
5077 if (cause) {
5078 PyObject *fixed_cause;
5079 if (cause == Py_None) {
5080 fixed_cause = NULL;
5081 } else if (PyExceptionClass_Check(cause)) {
5082 fixed_cause = PyObject_CallObject(cause, NULL);
5083 if (fixed_cause == NULL)
5084 goto bad;
5085 } else if (PyExceptionInstance_Check(cause)) {
5086 fixed_cause = cause;
5087 Py_INCREF(fixed_cause);
5088 } else {
5089 PyErr_SetString(PyExc_TypeError,
5090 "exception causes must derive from "
5091 "BaseException");
5092 goto bad;
5093 }
5094 PyException_SetCause(value, fixed_cause);
5095 }
5096 PyErr_SetObject(type, value);
5097 if (tb) {
5098 #if CYTHON_COMPILING_IN_PYPY
5099 PyObject *tmp_type, *tmp_value, *tmp_tb;
5100 PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
5101 Py_INCREF(tb);
5102 PyErr_Restore(tmp_type, tmp_value, tb);
5103 Py_XDECREF(tmp_tb);
5104 #else
5105 PyThreadState *tstate = __Pyx_PyThreadState_Current;
5106 PyObject* tmp_tb = tstate->curexc_traceback;
5107 if (tb != tmp_tb) {
5108 Py_INCREF(tb);
5109 tstate->curexc_traceback = tb;
5110 Py_XDECREF(tmp_tb);
5111 }
5112 #endif
5113 }
5114 bad:
5115 Py_XDECREF(owned_instance);
5116 return;
5117 }
5118 #endif
5119
5120 /* CallNextTpDealloc */
__Pyx_call_next_tp_dealloc(PyObject * obj,destructor current_tp_dealloc)5121 static void __Pyx_call_next_tp_dealloc(PyObject* obj, destructor current_tp_dealloc) {
5122 PyTypeObject* type = Py_TYPE(obj);
5123 while (type && type->tp_dealloc != current_tp_dealloc)
5124 type = type->tp_base;
5125 while (type && type->tp_dealloc == current_tp_dealloc)
5126 type = type->tp_base;
5127 if (type)
5128 type->tp_dealloc(obj);
5129 }
5130
5131 /* CallNextTpTraverse */
__Pyx_call_next_tp_traverse(PyObject * obj,visitproc v,void * a,traverseproc current_tp_traverse)5132 static int __Pyx_call_next_tp_traverse(PyObject* obj, visitproc v, void *a, traverseproc current_tp_traverse) {
5133 PyTypeObject* type = Py_TYPE(obj);
5134 while (type && type->tp_traverse != current_tp_traverse)
5135 type = type->tp_base;
5136 while (type && type->tp_traverse == current_tp_traverse)
5137 type = type->tp_base;
5138 if (type && type->tp_traverse)
5139 return type->tp_traverse(obj, v, a);
5140 return 0;
5141 }
5142
5143 /* CallNextTpClear */
__Pyx_call_next_tp_clear(PyObject * obj,inquiry current_tp_clear)5144 static void __Pyx_call_next_tp_clear(PyObject* obj, inquiry current_tp_clear) {
5145 PyTypeObject* type = Py_TYPE(obj);
5146 while (type && type->tp_clear != current_tp_clear)
5147 type = type->tp_base;
5148 while (type && type->tp_clear == current_tp_clear)
5149 type = type->tp_base;
5150 if (type && type->tp_clear)
5151 type->tp_clear(obj);
5152 }
5153
5154 /* TypeImport */
5155 #ifndef __PYX_HAVE_RT_ImportType
5156 #define __PYX_HAVE_RT_ImportType
__Pyx_ImportType(PyObject * module,const char * module_name,const char * class_name,size_t size,enum __Pyx_ImportType_CheckSize check_size)5157 static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name,
5158 size_t size, enum __Pyx_ImportType_CheckSize check_size)
5159 {
5160 PyObject *result = 0;
5161 char warning[200];
5162 Py_ssize_t basicsize;
5163 #ifdef Py_LIMITED_API
5164 PyObject *py_basicsize;
5165 #endif
5166 result = PyObject_GetAttrString(module, class_name);
5167 if (!result)
5168 goto bad;
5169 if (!PyType_Check(result)) {
5170 PyErr_Format(PyExc_TypeError,
5171 "%.200s.%.200s is not a type object",
5172 module_name, class_name);
5173 goto bad;
5174 }
5175 #ifndef Py_LIMITED_API
5176 basicsize = ((PyTypeObject *)result)->tp_basicsize;
5177 #else
5178 py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
5179 if (!py_basicsize)
5180 goto bad;
5181 basicsize = PyLong_AsSsize_t(py_basicsize);
5182 Py_DECREF(py_basicsize);
5183 py_basicsize = 0;
5184 if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
5185 goto bad;
5186 #endif
5187 if ((size_t)basicsize < size) {
5188 PyErr_Format(PyExc_ValueError,
5189 "%.200s.%.200s size changed, may indicate binary incompatibility. "
5190 "Expected %zd from C header, got %zd from PyObject",
5191 module_name, class_name, size, basicsize);
5192 goto bad;
5193 }
5194 if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) {
5195 PyErr_Format(PyExc_ValueError,
5196 "%.200s.%.200s size changed, may indicate binary incompatibility. "
5197 "Expected %zd from C header, got %zd from PyObject",
5198 module_name, class_name, size, basicsize);
5199 goto bad;
5200 }
5201 else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) {
5202 PyOS_snprintf(warning, sizeof(warning),
5203 "%s.%s size changed, may indicate binary incompatibility. "
5204 "Expected %zd from C header, got %zd from PyObject",
5205 module_name, class_name, size, basicsize);
5206 if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
5207 }
5208 return (PyTypeObject *)result;
5209 bad:
5210 Py_XDECREF(result);
5211 return NULL;
5212 }
5213 #endif
5214
5215 /* GetVTable */
__Pyx_GetVtable(PyObject * dict)5216 static void* __Pyx_GetVtable(PyObject *dict) {
5217 void* ptr;
5218 PyObject *ob = PyObject_GetItem(dict, __pyx_n_s_pyx_vtable);
5219 if (!ob)
5220 goto bad;
5221 #if PY_VERSION_HEX >= 0x02070000
5222 ptr = PyCapsule_GetPointer(ob, 0);
5223 #else
5224 ptr = PyCObject_AsVoidPtr(ob);
5225 #endif
5226 if (!ptr && !PyErr_Occurred())
5227 PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type");
5228 Py_DECREF(ob);
5229 return ptr;
5230 bad:
5231 Py_XDECREF(ob);
5232 return NULL;
5233 }
5234
5235 /* PyObject_GenericGetAttrNoDict */
5236 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
__Pyx_RaiseGenericGetAttributeError(PyTypeObject * tp,PyObject * attr_name)5237 static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
5238 PyErr_Format(PyExc_AttributeError,
5239 #if PY_MAJOR_VERSION >= 3
5240 "'%.50s' object has no attribute '%U'",
5241 tp->tp_name, attr_name);
5242 #else
5243 "'%.50s' object has no attribute '%.400s'",
5244 tp->tp_name, PyString_AS_STRING(attr_name));
5245 #endif
5246 return NULL;
5247 }
__Pyx_PyObject_GenericGetAttrNoDict(PyObject * obj,PyObject * attr_name)5248 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
5249 PyObject *descr;
5250 PyTypeObject *tp = Py_TYPE(obj);
5251 if (unlikely(!PyString_Check(attr_name))) {
5252 return PyObject_GenericGetAttr(obj, attr_name);
5253 }
5254 assert(!tp->tp_dictoffset);
5255 descr = _PyType_Lookup(tp, attr_name);
5256 if (unlikely(!descr)) {
5257 return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
5258 }
5259 Py_INCREF(descr);
5260 #if PY_MAJOR_VERSION < 3
5261 if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
5262 #endif
5263 {
5264 descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
5265 if (unlikely(f)) {
5266 PyObject *res = f(descr, obj, (PyObject *)tp);
5267 Py_DECREF(descr);
5268 return res;
5269 }
5270 }
5271 return descr;
5272 }
5273 #endif
5274
5275 /* PyObject_GenericGetAttr */
5276 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
__Pyx_PyObject_GenericGetAttr(PyObject * obj,PyObject * attr_name)5277 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
5278 if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
5279 return PyObject_GenericGetAttr(obj, attr_name);
5280 }
5281 return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
5282 }
5283 #endif
5284
5285 /* SetVTable */
__Pyx_SetVtable(PyObject * dict,void * vtable)5286 static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
5287 #if PY_VERSION_HEX >= 0x02070000
5288 PyObject *ob = PyCapsule_New(vtable, 0, 0);
5289 #else
5290 PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
5291 #endif
5292 if (!ob)
5293 goto bad;
5294 if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
5295 goto bad;
5296 Py_DECREF(ob);
5297 return 0;
5298 bad:
5299 Py_XDECREF(ob);
5300 return -1;
5301 }
5302
5303 /* PyErrExceptionMatches */
5304 #if CYTHON_FAST_THREAD_STATE
__Pyx_PyErr_ExceptionMatchesTuple(PyObject * exc_type,PyObject * tuple)5305 static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
5306 Py_ssize_t i, n;
5307 n = PyTuple_GET_SIZE(tuple);
5308 #if PY_MAJOR_VERSION >= 3
5309 for (i=0; i<n; i++) {
5310 if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
5311 }
5312 #endif
5313 for (i=0; i<n; i++) {
5314 if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
5315 }
5316 return 0;
5317 }
__Pyx_PyErr_ExceptionMatchesInState(PyThreadState * tstate,PyObject * err)5318 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
5319 PyObject *exc_type = tstate->curexc_type;
5320 if (exc_type == err) return 1;
5321 if (unlikely(!exc_type)) return 0;
5322 if (unlikely(PyTuple_Check(err)))
5323 return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
5324 return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
5325 }
5326 #endif
5327
5328 /* PyObjectGetAttrStrNoError */
__Pyx_PyObject_GetAttrStr_ClearAttributeError(void)5329 static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) {
5330 __Pyx_PyThreadState_declare
5331 __Pyx_PyThreadState_assign
5332 if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
5333 __Pyx_PyErr_Clear();
5334 }
__Pyx_PyObject_GetAttrStrNoError(PyObject * obj,PyObject * attr_name)5335 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
5336 PyObject *result;
5337 #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1
5338 PyTypeObject* tp = Py_TYPE(obj);
5339 if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
5340 return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
5341 }
5342 #endif
5343 result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
5344 if (unlikely(!result)) {
5345 __Pyx_PyObject_GetAttrStr_ClearAttributeError();
5346 }
5347 return result;
5348 }
5349
5350 /* SetupReduce */
__Pyx_setup_reduce_is_named(PyObject * meth,PyObject * name)5351 static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
5352 int ret;
5353 PyObject *name_attr;
5354 name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name);
5355 if (likely(name_attr)) {
5356 ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
5357 } else {
5358 ret = -1;
5359 }
5360 if (unlikely(ret < 0)) {
5361 PyErr_Clear();
5362 ret = 0;
5363 }
5364 Py_XDECREF(name_attr);
5365 return ret;
5366 }
__Pyx_setup_reduce(PyObject * type_obj)5367 static int __Pyx_setup_reduce(PyObject* type_obj) {
5368 int ret = 0;
5369 PyObject *object_reduce = NULL;
5370 PyObject *object_reduce_ex = NULL;
5371 PyObject *reduce = NULL;
5372 PyObject *reduce_ex = NULL;
5373 PyObject *reduce_cython = NULL;
5374 PyObject *setstate = NULL;
5375 PyObject *setstate_cython = NULL;
5376 #if CYTHON_USE_PYTYPE_LOOKUP
5377 if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
5378 #else
5379 if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
5380 #endif
5381 #if CYTHON_USE_PYTYPE_LOOKUP
5382 object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
5383 #else
5384 object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
5385 #endif
5386 reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD;
5387 if (reduce_ex == object_reduce_ex) {
5388 #if CYTHON_USE_PYTYPE_LOOKUP
5389 object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
5390 #else
5391 object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
5392 #endif
5393 reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto __PYX_BAD;
5394 if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
5395 reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython);
5396 if (likely(reduce_cython)) {
5397 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
5398 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
5399 } else if (reduce == object_reduce || PyErr_Occurred()) {
5400 goto __PYX_BAD;
5401 }
5402 setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
5403 if (!setstate) PyErr_Clear();
5404 if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
5405 setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython);
5406 if (likely(setstate_cython)) {
5407 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
5408 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
5409 } else if (!setstate || PyErr_Occurred()) {
5410 goto __PYX_BAD;
5411 }
5412 }
5413 PyType_Modified((PyTypeObject*)type_obj);
5414 }
5415 }
5416 goto __PYX_GOOD;
5417 __PYX_BAD:
5418 if (!PyErr_Occurred())
5419 PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
5420 ret = -1;
5421 __PYX_GOOD:
5422 #if !CYTHON_USE_PYTYPE_LOOKUP
5423 Py_XDECREF(object_reduce);
5424 Py_XDECREF(object_reduce_ex);
5425 #endif
5426 Py_XDECREF(reduce);
5427 Py_XDECREF(reduce_ex);
5428 Py_XDECREF(reduce_cython);
5429 Py_XDECREF(setstate);
5430 Py_XDECREF(setstate_cython);
5431 return ret;
5432 }
5433
5434 /* PyDictVersioning */
5435 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
__Pyx_get_tp_dict_version(PyObject * obj)5436 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
5437 PyObject *dict = Py_TYPE(obj)->tp_dict;
5438 return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
5439 }
__Pyx_get_object_dict_version(PyObject * obj)5440 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
5441 PyObject **dictptr = NULL;
5442 Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
5443 if (offset) {
5444 #if CYTHON_COMPILING_IN_CPYTHON
5445 dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
5446 #else
5447 dictptr = _PyObject_GetDictPtr(obj);
5448 #endif
5449 }
5450 return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
5451 }
__Pyx_object_dict_version_matches(PyObject * obj,PY_UINT64_T tp_dict_version,PY_UINT64_T obj_dict_version)5452 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
5453 PyObject *dict = Py_TYPE(obj)->tp_dict;
5454 if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
5455 return 0;
5456 return obj_dict_version == __Pyx_get_object_dict_version(obj);
5457 }
5458 #endif
5459
5460 /* CLineInTraceback */
5461 #ifndef CYTHON_CLINE_IN_TRACEBACK
__Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState * tstate,int c_line)5462 static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) {
5463 PyObject *use_cline;
5464 PyObject *ptype, *pvalue, *ptraceback;
5465 #if CYTHON_COMPILING_IN_CPYTHON
5466 PyObject **cython_runtime_dict;
5467 #endif
5468 if (unlikely(!__pyx_cython_runtime)) {
5469 return c_line;
5470 }
5471 __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
5472 #if CYTHON_COMPILING_IN_CPYTHON
5473 cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
5474 if (likely(cython_runtime_dict)) {
5475 __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
5476 use_cline, *cython_runtime_dict,
5477 __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
5478 } else
5479 #endif
5480 {
5481 PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
5482 if (use_cline_obj) {
5483 use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
5484 Py_DECREF(use_cline_obj);
5485 } else {
5486 PyErr_Clear();
5487 use_cline = NULL;
5488 }
5489 }
5490 if (!use_cline) {
5491 c_line = 0;
5492 PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
5493 }
5494 else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
5495 c_line = 0;
5496 }
5497 __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
5498 return c_line;
5499 }
5500 #endif
5501
5502 /* CodeObjectCache */
__pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry * entries,int count,int code_line)5503 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
5504 int start = 0, mid = 0, end = count - 1;
5505 if (end >= 0 && code_line > entries[end].code_line) {
5506 return count;
5507 }
5508 while (start < end) {
5509 mid = start + (end - start) / 2;
5510 if (code_line < entries[mid].code_line) {
5511 end = mid;
5512 } else if (code_line > entries[mid].code_line) {
5513 start = mid + 1;
5514 } else {
5515 return mid;
5516 }
5517 }
5518 if (code_line <= entries[mid].code_line) {
5519 return mid;
5520 } else {
5521 return mid + 1;
5522 }
5523 }
__pyx_find_code_object(int code_line)5524 static PyCodeObject *__pyx_find_code_object(int code_line) {
5525 PyCodeObject* code_object;
5526 int pos;
5527 if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
5528 return NULL;
5529 }
5530 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
5531 if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
5532 return NULL;
5533 }
5534 code_object = __pyx_code_cache.entries[pos].code_object;
5535 Py_INCREF(code_object);
5536 return code_object;
5537 }
__pyx_insert_code_object(int code_line,PyCodeObject * code_object)5538 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
5539 int pos, i;
5540 __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
5541 if (unlikely(!code_line)) {
5542 return;
5543 }
5544 if (unlikely(!entries)) {
5545 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
5546 if (likely(entries)) {
5547 __pyx_code_cache.entries = entries;
5548 __pyx_code_cache.max_count = 64;
5549 __pyx_code_cache.count = 1;
5550 entries[0].code_line = code_line;
5551 entries[0].code_object = code_object;
5552 Py_INCREF(code_object);
5553 }
5554 return;
5555 }
5556 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
5557 if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
5558 PyCodeObject* tmp = entries[pos].code_object;
5559 entries[pos].code_object = code_object;
5560 Py_DECREF(tmp);
5561 return;
5562 }
5563 if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
5564 int new_max = __pyx_code_cache.max_count + 64;
5565 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
5566 __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
5567 if (unlikely(!entries)) {
5568 return;
5569 }
5570 __pyx_code_cache.entries = entries;
5571 __pyx_code_cache.max_count = new_max;
5572 }
5573 for (i=__pyx_code_cache.count; i>pos; i--) {
5574 entries[i] = entries[i-1];
5575 }
5576 entries[pos].code_line = code_line;
5577 entries[pos].code_object = code_object;
5578 __pyx_code_cache.count++;
5579 Py_INCREF(code_object);
5580 }
5581
5582 /* AddTraceback */
5583 #include "compile.h"
5584 #include "frameobject.h"
5585 #include "traceback.h"
__Pyx_CreateCodeObjectForTraceback(const char * funcname,int c_line,int py_line,const char * filename)5586 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
5587 const char *funcname, int c_line,
5588 int py_line, const char *filename) {
5589 PyCodeObject *py_code = 0;
5590 PyObject *py_srcfile = 0;
5591 PyObject *py_funcname = 0;
5592 #if PY_MAJOR_VERSION < 3
5593 py_srcfile = PyString_FromString(filename);
5594 #else
5595 py_srcfile = PyUnicode_FromString(filename);
5596 #endif
5597 if (!py_srcfile) goto bad;
5598 if (c_line) {
5599 #if PY_MAJOR_VERSION < 3
5600 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
5601 #else
5602 py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
5603 #endif
5604 }
5605 else {
5606 #if PY_MAJOR_VERSION < 3
5607 py_funcname = PyString_FromString(funcname);
5608 #else
5609 py_funcname = PyUnicode_FromString(funcname);
5610 #endif
5611 }
5612 if (!py_funcname) goto bad;
5613 py_code = __Pyx_PyCode_New(
5614 0,
5615 0,
5616 0,
5617 0,
5618 0,
5619 __pyx_empty_bytes, /*PyObject *code,*/
5620 __pyx_empty_tuple, /*PyObject *consts,*/
5621 __pyx_empty_tuple, /*PyObject *names,*/
5622 __pyx_empty_tuple, /*PyObject *varnames,*/
5623 __pyx_empty_tuple, /*PyObject *freevars,*/
5624 __pyx_empty_tuple, /*PyObject *cellvars,*/
5625 py_srcfile, /*PyObject *filename,*/
5626 py_funcname, /*PyObject *name,*/
5627 py_line,
5628 __pyx_empty_bytes /*PyObject *lnotab*/
5629 );
5630 Py_DECREF(py_srcfile);
5631 Py_DECREF(py_funcname);
5632 return py_code;
5633 bad:
5634 Py_XDECREF(py_srcfile);
5635 Py_XDECREF(py_funcname);
5636 return NULL;
5637 }
__Pyx_AddTraceback(const char * funcname,int c_line,int py_line,const char * filename)5638 static void __Pyx_AddTraceback(const char *funcname, int c_line,
5639 int py_line, const char *filename) {
5640 PyCodeObject *py_code = 0;
5641 PyFrameObject *py_frame = 0;
5642 PyThreadState *tstate = __Pyx_PyThreadState_Current;
5643 if (c_line) {
5644 c_line = __Pyx_CLineForTraceback(tstate, c_line);
5645 }
5646 py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
5647 if (!py_code) {
5648 py_code = __Pyx_CreateCodeObjectForTraceback(
5649 funcname, c_line, py_line, filename);
5650 if (!py_code) goto bad;
5651 __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
5652 }
5653 py_frame = PyFrame_New(
5654 tstate, /*PyThreadState *tstate,*/
5655 py_code, /*PyCodeObject *code,*/
5656 __pyx_d, /*PyObject *globals,*/
5657 0 /*PyObject *locals*/
5658 );
5659 if (!py_frame) goto bad;
5660 __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
5661 PyTraceBack_Here(py_frame);
5662 bad:
5663 Py_XDECREF(py_code);
5664 Py_XDECREF(py_frame);
5665 }
5666
5667 /* CIntFromPyVerify */
5668 #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
5669 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
5670 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
5671 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
5672 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
5673 {\
5674 func_type value = func_value;\
5675 if (sizeof(target_type) < sizeof(func_type)) {\
5676 if (unlikely(value != (func_type) (target_type) value)) {\
5677 func_type zero = 0;\
5678 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
5679 return (target_type) -1;\
5680 if (is_unsigned && unlikely(value < zero))\
5681 goto raise_neg_overflow;\
5682 else\
5683 goto raise_overflow;\
5684 }\
5685 }\
5686 return (target_type) value;\
5687 }
5688
5689 /* CIntToPy */
__Pyx_PyInt_From_int(int value)5690 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
5691 const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
5692 const int is_unsigned = neg_one > const_zero;
5693 if (is_unsigned) {
5694 if (sizeof(int) < sizeof(long)) {
5695 return PyInt_FromLong((long) value);
5696 } else if (sizeof(int) <= sizeof(unsigned long)) {
5697 return PyLong_FromUnsignedLong((unsigned long) value);
5698 #ifdef HAVE_LONG_LONG
5699 } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
5700 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
5701 #endif
5702 }
5703 } else {
5704 if (sizeof(int) <= sizeof(long)) {
5705 return PyInt_FromLong((long) value);
5706 #ifdef HAVE_LONG_LONG
5707 } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
5708 return PyLong_FromLongLong((PY_LONG_LONG) value);
5709 #endif
5710 }
5711 }
5712 {
5713 int one = 1; int little = (int)*(unsigned char *)&one;
5714 unsigned char *bytes = (unsigned char *)&value;
5715 return _PyLong_FromByteArray(bytes, sizeof(int),
5716 little, !is_unsigned);
5717 }
5718 }
5719
5720 /* CIntFromPy */
__Pyx_PyInt_As_int(PyObject * x)5721 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
5722 const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
5723 const int is_unsigned = neg_one > const_zero;
5724 #if PY_MAJOR_VERSION < 3
5725 if (likely(PyInt_Check(x))) {
5726 if (sizeof(int) < sizeof(long)) {
5727 __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
5728 } else {
5729 long val = PyInt_AS_LONG(x);
5730 if (is_unsigned && unlikely(val < 0)) {
5731 goto raise_neg_overflow;
5732 }
5733 return (int) val;
5734 }
5735 } else
5736 #endif
5737 if (likely(PyLong_Check(x))) {
5738 if (is_unsigned) {
5739 #if CYTHON_USE_PYLONG_INTERNALS
5740 const digit* digits = ((PyLongObject*)x)->ob_digit;
5741 switch (Py_SIZE(x)) {
5742 case 0: return (int) 0;
5743 case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
5744 case 2:
5745 if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
5746 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
5747 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
5748 } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
5749 return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
5750 }
5751 }
5752 break;
5753 case 3:
5754 if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
5755 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
5756 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
5757 } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
5758 return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
5759 }
5760 }
5761 break;
5762 case 4:
5763 if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
5764 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
5765 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
5766 } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
5767 return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
5768 }
5769 }
5770 break;
5771 }
5772 #endif
5773 #if CYTHON_COMPILING_IN_CPYTHON
5774 if (unlikely(Py_SIZE(x) < 0)) {
5775 goto raise_neg_overflow;
5776 }
5777 #else
5778 {
5779 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
5780 if (unlikely(result < 0))
5781 return (int) -1;
5782 if (unlikely(result == 1))
5783 goto raise_neg_overflow;
5784 }
5785 #endif
5786 if (sizeof(int) <= sizeof(unsigned long)) {
5787 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
5788 #ifdef HAVE_LONG_LONG
5789 } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
5790 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
5791 #endif
5792 }
5793 } else {
5794 #if CYTHON_USE_PYLONG_INTERNALS
5795 const digit* digits = ((PyLongObject*)x)->ob_digit;
5796 switch (Py_SIZE(x)) {
5797 case 0: return (int) 0;
5798 case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
5799 case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0])
5800 case -2:
5801 if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
5802 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
5803 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
5804 } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
5805 return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
5806 }
5807 }
5808 break;
5809 case 2:
5810 if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
5811 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
5812 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
5813 } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
5814 return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
5815 }
5816 }
5817 break;
5818 case -3:
5819 if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
5820 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
5821 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
5822 } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
5823 return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
5824 }
5825 }
5826 break;
5827 case 3:
5828 if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
5829 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
5830 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
5831 } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
5832 return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
5833 }
5834 }
5835 break;
5836 case -4:
5837 if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
5838 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
5839 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
5840 } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
5841 return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
5842 }
5843 }
5844 break;
5845 case 4:
5846 if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
5847 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
5848 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
5849 } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
5850 return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
5851 }
5852 }
5853 break;
5854 }
5855 #endif
5856 if (sizeof(int) <= sizeof(long)) {
5857 __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
5858 #ifdef HAVE_LONG_LONG
5859 } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
5860 __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
5861 #endif
5862 }
5863 }
5864 {
5865 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
5866 PyErr_SetString(PyExc_RuntimeError,
5867 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
5868 #else
5869 int val;
5870 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
5871 #if PY_MAJOR_VERSION < 3
5872 if (likely(v) && !PyLong_Check(v)) {
5873 PyObject *tmp = v;
5874 v = PyNumber_Long(tmp);
5875 Py_DECREF(tmp);
5876 }
5877 #endif
5878 if (likely(v)) {
5879 int one = 1; int is_little = (int)*(unsigned char *)&one;
5880 unsigned char *bytes = (unsigned char *)&val;
5881 int ret = _PyLong_AsByteArray((PyLongObject *)v,
5882 bytes, sizeof(val),
5883 is_little, !is_unsigned);
5884 Py_DECREF(v);
5885 if (likely(!ret))
5886 return val;
5887 }
5888 #endif
5889 return (int) -1;
5890 }
5891 } else {
5892 int val;
5893 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
5894 if (!tmp) return (int) -1;
5895 val = __Pyx_PyInt_As_int(tmp);
5896 Py_DECREF(tmp);
5897 return val;
5898 }
5899 raise_overflow:
5900 PyErr_SetString(PyExc_OverflowError,
5901 "value too large to convert to int");
5902 return (int) -1;
5903 raise_neg_overflow:
5904 PyErr_SetString(PyExc_OverflowError,
5905 "can't convert negative value to int");
5906 return (int) -1;
5907 }
5908
5909 /* CIntToPy */
__Pyx_PyInt_From_long(long value)5910 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
5911 const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
5912 const int is_unsigned = neg_one > const_zero;
5913 if (is_unsigned) {
5914 if (sizeof(long) < sizeof(long)) {
5915 return PyInt_FromLong((long) value);
5916 } else if (sizeof(long) <= sizeof(unsigned long)) {
5917 return PyLong_FromUnsignedLong((unsigned long) value);
5918 #ifdef HAVE_LONG_LONG
5919 } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
5920 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
5921 #endif
5922 }
5923 } else {
5924 if (sizeof(long) <= sizeof(long)) {
5925 return PyInt_FromLong((long) value);
5926 #ifdef HAVE_LONG_LONG
5927 } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
5928 return PyLong_FromLongLong((PY_LONG_LONG) value);
5929 #endif
5930 }
5931 }
5932 {
5933 int one = 1; int little = (int)*(unsigned char *)&one;
5934 unsigned char *bytes = (unsigned char *)&value;
5935 return _PyLong_FromByteArray(bytes, sizeof(long),
5936 little, !is_unsigned);
5937 }
5938 }
5939
5940 /* CIntFromPy */
__Pyx_PyInt_As_long(PyObject * x)5941 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
5942 const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
5943 const int is_unsigned = neg_one > const_zero;
5944 #if PY_MAJOR_VERSION < 3
5945 if (likely(PyInt_Check(x))) {
5946 if (sizeof(long) < sizeof(long)) {
5947 __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
5948 } else {
5949 long val = PyInt_AS_LONG(x);
5950 if (is_unsigned && unlikely(val < 0)) {
5951 goto raise_neg_overflow;
5952 }
5953 return (long) val;
5954 }
5955 } else
5956 #endif
5957 if (likely(PyLong_Check(x))) {
5958 if (is_unsigned) {
5959 #if CYTHON_USE_PYLONG_INTERNALS
5960 const digit* digits = ((PyLongObject*)x)->ob_digit;
5961 switch (Py_SIZE(x)) {
5962 case 0: return (long) 0;
5963 case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
5964 case 2:
5965 if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
5966 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
5967 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
5968 } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
5969 return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
5970 }
5971 }
5972 break;
5973 case 3:
5974 if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
5975 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
5976 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
5977 } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
5978 return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
5979 }
5980 }
5981 break;
5982 case 4:
5983 if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
5984 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
5985 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
5986 } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
5987 return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
5988 }
5989 }
5990 break;
5991 }
5992 #endif
5993 #if CYTHON_COMPILING_IN_CPYTHON
5994 if (unlikely(Py_SIZE(x) < 0)) {
5995 goto raise_neg_overflow;
5996 }
5997 #else
5998 {
5999 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
6000 if (unlikely(result < 0))
6001 return (long) -1;
6002 if (unlikely(result == 1))
6003 goto raise_neg_overflow;
6004 }
6005 #endif
6006 if (sizeof(long) <= sizeof(unsigned long)) {
6007 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
6008 #ifdef HAVE_LONG_LONG
6009 } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
6010 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
6011 #endif
6012 }
6013 } else {
6014 #if CYTHON_USE_PYLONG_INTERNALS
6015 const digit* digits = ((PyLongObject*)x)->ob_digit;
6016 switch (Py_SIZE(x)) {
6017 case 0: return (long) 0;
6018 case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
6019 case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0])
6020 case -2:
6021 if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
6022 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
6023 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6024 } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
6025 return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
6026 }
6027 }
6028 break;
6029 case 2:
6030 if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
6031 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
6032 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6033 } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
6034 return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
6035 }
6036 }
6037 break;
6038 case -3:
6039 if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
6040 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
6041 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6042 } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
6043 return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
6044 }
6045 }
6046 break;
6047 case 3:
6048 if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
6049 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
6050 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6051 } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
6052 return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
6053 }
6054 }
6055 break;
6056 case -4:
6057 if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
6058 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
6059 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6060 } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
6061 return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
6062 }
6063 }
6064 break;
6065 case 4:
6066 if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
6067 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
6068 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
6069 } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
6070 return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
6071 }
6072 }
6073 break;
6074 }
6075 #endif
6076 if (sizeof(long) <= sizeof(long)) {
6077 __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
6078 #ifdef HAVE_LONG_LONG
6079 } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
6080 __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
6081 #endif
6082 }
6083 }
6084 {
6085 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
6086 PyErr_SetString(PyExc_RuntimeError,
6087 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
6088 #else
6089 long val;
6090 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
6091 #if PY_MAJOR_VERSION < 3
6092 if (likely(v) && !PyLong_Check(v)) {
6093 PyObject *tmp = v;
6094 v = PyNumber_Long(tmp);
6095 Py_DECREF(tmp);
6096 }
6097 #endif
6098 if (likely(v)) {
6099 int one = 1; int is_little = (int)*(unsigned char *)&one;
6100 unsigned char *bytes = (unsigned char *)&val;
6101 int ret = _PyLong_AsByteArray((PyLongObject *)v,
6102 bytes, sizeof(val),
6103 is_little, !is_unsigned);
6104 Py_DECREF(v);
6105 if (likely(!ret))
6106 return val;
6107 }
6108 #endif
6109 return (long) -1;
6110 }
6111 } else {
6112 long val;
6113 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
6114 if (!tmp) return (long) -1;
6115 val = __Pyx_PyInt_As_long(tmp);
6116 Py_DECREF(tmp);
6117 return val;
6118 }
6119 raise_overflow:
6120 PyErr_SetString(PyExc_OverflowError,
6121 "value too large to convert to long");
6122 return (long) -1;
6123 raise_neg_overflow:
6124 PyErr_SetString(PyExc_OverflowError,
6125 "can't convert negative value to long");
6126 return (long) -1;
6127 }
6128
6129 /* FastTypeChecks */
6130 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_InBases(PyTypeObject * a,PyTypeObject * b)6131 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
6132 while (a) {
6133 a = a->tp_base;
6134 if (a == b)
6135 return 1;
6136 }
6137 return b == &PyBaseObject_Type;
6138 }
__Pyx_IsSubtype(PyTypeObject * a,PyTypeObject * b)6139 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
6140 PyObject *mro;
6141 if (a == b) return 1;
6142 mro = a->tp_mro;
6143 if (likely(mro)) {
6144 Py_ssize_t i, n;
6145 n = PyTuple_GET_SIZE(mro);
6146 for (i = 0; i < n; i++) {
6147 if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
6148 return 1;
6149 }
6150 return 0;
6151 }
6152 return __Pyx_InBases(a, b);
6153 }
6154 #if PY_MAJOR_VERSION == 2
__Pyx_inner_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)6155 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
6156 PyObject *exception, *value, *tb;
6157 int res;
6158 __Pyx_PyThreadState_declare
6159 __Pyx_PyThreadState_assign
6160 __Pyx_ErrFetch(&exception, &value, &tb);
6161 res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
6162 if (unlikely(res == -1)) {
6163 PyErr_WriteUnraisable(err);
6164 res = 0;
6165 }
6166 if (!res) {
6167 res = PyObject_IsSubclass(err, exc_type2);
6168 if (unlikely(res == -1)) {
6169 PyErr_WriteUnraisable(err);
6170 res = 0;
6171 }
6172 }
6173 __Pyx_ErrRestore(exception, value, tb);
6174 return res;
6175 }
6176 #else
__Pyx_inner_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)6177 static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
6178 int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
6179 if (!res) {
6180 res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
6181 }
6182 return res;
6183 }
6184 #endif
__Pyx_PyErr_GivenExceptionMatchesTuple(PyObject * exc_type,PyObject * tuple)6185 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
6186 Py_ssize_t i, n;
6187 assert(PyExceptionClass_Check(exc_type));
6188 n = PyTuple_GET_SIZE(tuple);
6189 #if PY_MAJOR_VERSION >= 3
6190 for (i=0; i<n; i++) {
6191 if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
6192 }
6193 #endif
6194 for (i=0; i<n; i++) {
6195 PyObject *t = PyTuple_GET_ITEM(tuple, i);
6196 #if PY_MAJOR_VERSION < 3
6197 if (likely(exc_type == t)) return 1;
6198 #endif
6199 if (likely(PyExceptionClass_Check(t))) {
6200 if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
6201 } else {
6202 }
6203 }
6204 return 0;
6205 }
__Pyx_PyErr_GivenExceptionMatches(PyObject * err,PyObject * exc_type)6206 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
6207 if (likely(err == exc_type)) return 1;
6208 if (likely(PyExceptionClass_Check(err))) {
6209 if (likely(PyExceptionClass_Check(exc_type))) {
6210 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
6211 } else if (likely(PyTuple_Check(exc_type))) {
6212 return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
6213 } else {
6214 }
6215 }
6216 return PyErr_GivenExceptionMatches(err, exc_type);
6217 }
__Pyx_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)6218 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
6219 assert(PyExceptionClass_Check(exc_type1));
6220 assert(PyExceptionClass_Check(exc_type2));
6221 if (likely(err == exc_type1 || err == exc_type2)) return 1;
6222 if (likely(PyExceptionClass_Check(err))) {
6223 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
6224 }
6225 return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
6226 }
6227 #endif
6228
6229 /* CheckBinaryVersion */
__Pyx_check_binary_version(void)6230 static int __Pyx_check_binary_version(void) {
6231 char ctversion[4], rtversion[4];
6232 PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
6233 PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
6234 if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
6235 char message[200];
6236 PyOS_snprintf(message, sizeof(message),
6237 "compiletime version %s of module '%.100s' "
6238 "does not match runtime version %s",
6239 ctversion, __Pyx_MODULE_NAME, rtversion);
6240 return PyErr_WarnEx(NULL, message, 1);
6241 }
6242 return 0;
6243 }
6244
6245 /* FunctionImport */
6246 #ifndef __PYX_HAVE_RT_ImportFunction
6247 #define __PYX_HAVE_RT_ImportFunction
__Pyx_ImportFunction(PyObject * module,const char * funcname,void (** f)(void),const char * sig)6248 static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig) {
6249 PyObject *d = 0;
6250 PyObject *cobj = 0;
6251 union {
6252 void (*fp)(void);
6253 void *p;
6254 } tmp;
6255 d = PyObject_GetAttrString(module, (char *)"__pyx_capi__");
6256 if (!d)
6257 goto bad;
6258 cobj = PyDict_GetItemString(d, funcname);
6259 if (!cobj) {
6260 PyErr_Format(PyExc_ImportError,
6261 "%.200s does not export expected C function %.200s",
6262 PyModule_GetName(module), funcname);
6263 goto bad;
6264 }
6265 #if PY_VERSION_HEX >= 0x02070000
6266 if (!PyCapsule_IsValid(cobj, sig)) {
6267 PyErr_Format(PyExc_TypeError,
6268 "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
6269 PyModule_GetName(module), funcname, sig, PyCapsule_GetName(cobj));
6270 goto bad;
6271 }
6272 tmp.p = PyCapsule_GetPointer(cobj, sig);
6273 #else
6274 {const char *desc, *s1, *s2;
6275 desc = (const char *)PyCObject_GetDesc(cobj);
6276 if (!desc)
6277 goto bad;
6278 s1 = desc; s2 = sig;
6279 while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; }
6280 if (*s1 != *s2) {
6281 PyErr_Format(PyExc_TypeError,
6282 "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
6283 PyModule_GetName(module), funcname, sig, desc);
6284 goto bad;
6285 }
6286 tmp.p = PyCObject_AsVoidPtr(cobj);}
6287 #endif
6288 *f = tmp.fp;
6289 if (!(*f))
6290 goto bad;
6291 Py_DECREF(d);
6292 return 0;
6293 bad:
6294 Py_XDECREF(d);
6295 return -1;
6296 }
6297 #endif
6298
6299 /* InitStrings */
__Pyx_InitStrings(__Pyx_StringTabEntry * t)6300 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
6301 while (t->p) {
6302 #if PY_MAJOR_VERSION < 3
6303 if (t->is_unicode) {
6304 *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
6305 } else if (t->intern) {
6306 *t->p = PyString_InternFromString(t->s);
6307 } else {
6308 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
6309 }
6310 #else
6311 if (t->is_unicode | t->is_str) {
6312 if (t->intern) {
6313 *t->p = PyUnicode_InternFromString(t->s);
6314 } else if (t->encoding) {
6315 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
6316 } else {
6317 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
6318 }
6319 } else {
6320 *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
6321 }
6322 #endif
6323 if (!*t->p)
6324 return -1;
6325 if (PyObject_Hash(*t->p) == -1)
6326 return -1;
6327 ++t;
6328 }
6329 return 0;
6330 }
6331
__Pyx_PyUnicode_FromString(const char * c_str)6332 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
6333 return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
6334 }
__Pyx_PyObject_AsString(PyObject * o)6335 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
6336 Py_ssize_t ignore;
6337 return __Pyx_PyObject_AsStringAndSize(o, &ignore);
6338 }
6339 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
6340 #if !CYTHON_PEP393_ENABLED
__Pyx_PyUnicode_AsStringAndSize(PyObject * o,Py_ssize_t * length)6341 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
6342 char* defenc_c;
6343 PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
6344 if (!defenc) return NULL;
6345 defenc_c = PyBytes_AS_STRING(defenc);
6346 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
6347 {
6348 char* end = defenc_c + PyBytes_GET_SIZE(defenc);
6349 char* c;
6350 for (c = defenc_c; c < end; c++) {
6351 if ((unsigned char) (*c) >= 128) {
6352 PyUnicode_AsASCIIString(o);
6353 return NULL;
6354 }
6355 }
6356 }
6357 #endif
6358 *length = PyBytes_GET_SIZE(defenc);
6359 return defenc_c;
6360 }
6361 #else
__Pyx_PyUnicode_AsStringAndSize(PyObject * o,Py_ssize_t * length)6362 static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
6363 if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
6364 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
6365 if (likely(PyUnicode_IS_ASCII(o))) {
6366 *length = PyUnicode_GET_LENGTH(o);
6367 return PyUnicode_AsUTF8(o);
6368 } else {
6369 PyUnicode_AsASCIIString(o);
6370 return NULL;
6371 }
6372 #else
6373 return PyUnicode_AsUTF8AndSize(o, length);
6374 #endif
6375 }
6376 #endif
6377 #endif
__Pyx_PyObject_AsStringAndSize(PyObject * o,Py_ssize_t * length)6378 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
6379 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
6380 if (
6381 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
6382 __Pyx_sys_getdefaultencoding_not_ascii &&
6383 #endif
6384 PyUnicode_Check(o)) {
6385 return __Pyx_PyUnicode_AsStringAndSize(o, length);
6386 } else
6387 #endif
6388 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
6389 if (PyByteArray_Check(o)) {
6390 *length = PyByteArray_GET_SIZE(o);
6391 return PyByteArray_AS_STRING(o);
6392 } else
6393 #endif
6394 {
6395 char* result;
6396 int r = PyBytes_AsStringAndSize(o, &result, length);
6397 if (unlikely(r < 0)) {
6398 return NULL;
6399 } else {
6400 return result;
6401 }
6402 }
6403 }
__Pyx_PyObject_IsTrue(PyObject * x)6404 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
6405 int is_true = x == Py_True;
6406 if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
6407 else return PyObject_IsTrue(x);
6408 }
__Pyx_PyObject_IsTrueAndDecref(PyObject * x)6409 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
6410 int retval;
6411 if (unlikely(!x)) return -1;
6412 retval = __Pyx_PyObject_IsTrue(x);
6413 Py_DECREF(x);
6414 return retval;
6415 }
__Pyx_PyNumber_IntOrLongWrongResultType(PyObject * result,const char * type_name)6416 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
6417 #if PY_MAJOR_VERSION >= 3
6418 if (PyLong_Check(result)) {
6419 if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
6420 "__int__ returned non-int (type %.200s). "
6421 "The ability to return an instance of a strict subclass of int "
6422 "is deprecated, and may be removed in a future version of Python.",
6423 Py_TYPE(result)->tp_name)) {
6424 Py_DECREF(result);
6425 return NULL;
6426 }
6427 return result;
6428 }
6429 #endif
6430 PyErr_Format(PyExc_TypeError,
6431 "__%.4s__ returned non-%.4s (type %.200s)",
6432 type_name, type_name, Py_TYPE(result)->tp_name);
6433 Py_DECREF(result);
6434 return NULL;
6435 }
__Pyx_PyNumber_IntOrLong(PyObject * x)6436 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
6437 #if CYTHON_USE_TYPE_SLOTS
6438 PyNumberMethods *m;
6439 #endif
6440 const char *name = NULL;
6441 PyObject *res = NULL;
6442 #if PY_MAJOR_VERSION < 3
6443 if (likely(PyInt_Check(x) || PyLong_Check(x)))
6444 #else
6445 if (likely(PyLong_Check(x)))
6446 #endif
6447 return __Pyx_NewRef(x);
6448 #if CYTHON_USE_TYPE_SLOTS
6449 m = Py_TYPE(x)->tp_as_number;
6450 #if PY_MAJOR_VERSION < 3
6451 if (m && m->nb_int) {
6452 name = "int";
6453 res = m->nb_int(x);
6454 }
6455 else if (m && m->nb_long) {
6456 name = "long";
6457 res = m->nb_long(x);
6458 }
6459 #else
6460 if (likely(m && m->nb_int)) {
6461 name = "int";
6462 res = m->nb_int(x);
6463 }
6464 #endif
6465 #else
6466 if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
6467 res = PyNumber_Int(x);
6468 }
6469 #endif
6470 if (likely(res)) {
6471 #if PY_MAJOR_VERSION < 3
6472 if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
6473 #else
6474 if (unlikely(!PyLong_CheckExact(res))) {
6475 #endif
6476 return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
6477 }
6478 }
6479 else if (!PyErr_Occurred()) {
6480 PyErr_SetString(PyExc_TypeError,
6481 "an integer is required");
6482 }
6483 return res;
6484 }
6485 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
6486 Py_ssize_t ival;
6487 PyObject *x;
6488 #if PY_MAJOR_VERSION < 3
6489 if (likely(PyInt_CheckExact(b))) {
6490 if (sizeof(Py_ssize_t) >= sizeof(long))
6491 return PyInt_AS_LONG(b);
6492 else
6493 return PyInt_AsSsize_t(b);
6494 }
6495 #endif
6496 if (likely(PyLong_CheckExact(b))) {
6497 #if CYTHON_USE_PYLONG_INTERNALS
6498 const digit* digits = ((PyLongObject*)b)->ob_digit;
6499 const Py_ssize_t size = Py_SIZE(b);
6500 if (likely(__Pyx_sst_abs(size) <= 1)) {
6501 ival = likely(size) ? digits[0] : 0;
6502 if (size == -1) ival = -ival;
6503 return ival;
6504 } else {
6505 switch (size) {
6506 case 2:
6507 if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
6508 return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
6509 }
6510 break;
6511 case -2:
6512 if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
6513 return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
6514 }
6515 break;
6516 case 3:
6517 if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
6518 return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
6519 }
6520 break;
6521 case -3:
6522 if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
6523 return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
6524 }
6525 break;
6526 case 4:
6527 if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
6528 return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
6529 }
6530 break;
6531 case -4:
6532 if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
6533 return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
6534 }
6535 break;
6536 }
6537 }
6538 #endif
6539 return PyLong_AsSsize_t(b);
6540 }
6541 x = PyNumber_Index(b);
6542 if (!x) return -1;
6543 ival = PyInt_AsSsize_t(x);
6544 Py_DECREF(x);
6545 return ival;
6546 }
6547 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
6548 return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
6549 }
6550 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
6551 return PyInt_FromSize_t(ival);
6552 }
6553
6554
6555 #endif /* Py_PYTHON_H */
6556