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 "/opt/hostedtoolcache/Python/3.7.9/x64/include/python3.7m/pythread.h",
9 "/tmp/vendor/include/libavcodec/avcodec.h",
10 "/tmp/vendor/include/libavdevice/avdevice.h",
11 "/tmp/vendor/include/libavfilter/avfilter.h",
12 "/tmp/vendor/include/libavfilter/buffersink.h",
13 "/tmp/vendor/include/libavfilter/buffersrc.h",
14 "/tmp/vendor/include/libavformat/avformat.h",
15 "/tmp/vendor/include/libavutil/audio_fifo.h",
16 "/tmp/vendor/include/libavutil/avutil.h",
17 "/tmp/vendor/include/libavutil/channel_layout.h",
18 "/tmp/vendor/include/libavutil/dict.h",
19 "/tmp/vendor/include/libavutil/error.h",
20 "/tmp/vendor/include/libavutil/frame.h",
21 "/tmp/vendor/include/libavutil/imgutils.h",
22 "/tmp/vendor/include/libavutil/log.h",
23 "/tmp/vendor/include/libavutil/mathematics.h",
24 "/tmp/vendor/include/libavutil/motion_vector.h",
25 "/tmp/vendor/include/libavutil/opt.h",
26 "/tmp/vendor/include/libavutil/pixdesc.h",
27 "/tmp/vendor/include/libavutil/rational.h",
28 "/tmp/vendor/include/libavutil/samplefmt.h",
29 "/tmp/vendor/include/libswresample/swresample.h",
30 "/tmp/vendor/include/libswscale/swscale.h",
31 "build/temp.linux-x86_64-3.7/include/pyav/config.h"
32 ],
33 "include_dirs": [
34 "/tmp/vendor/include",
35 "build/temp.linux-x86_64-3.7/include",
36 "/opt/hostedtoolcache/Python/3.7.9/x64/include/python3.7m",
37 "include"
38 ],
39 "libraries": [
40 "avutil",
41 "avcodec",
42 "avdevice",
43 "swscale",
44 "swresample",
45 "avformat",
46 "avfilter"
47 ],
48 "library_dirs": [
49 "/opt/hostedtoolcache/Python/3.7.9/x64/lib",
50 "/tmp/vendor/lib"
51 ],
52 "name": "av.stream",
53 "sources": [
54 "av/stream.pyx"
55 ]
56 },
57 "module_name": "av.stream"
58 }
59 END: Cython Metadata */
60
61 #define PY_SSIZE_T_CLEAN
62 #include "Python.h"
63 #ifndef Py_PYTHON_H
64 #error Python headers needed to compile C extensions, please install development version of Python.
65 #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
66 #error Cython requires Python 2.6+ or Python 3.3+.
67 #else
68 #define CYTHON_ABI "0_29_21"
69 #define CYTHON_HEX_VERSION 0x001D15F0
70 #define CYTHON_FUTURE_DIVISION 0
71 #include <stddef.h>
72 #ifndef offsetof
73 #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
74 #endif
75 #if !defined(WIN32) && !defined(MS_WINDOWS)
76 #ifndef __stdcall
77 #define __stdcall
78 #endif
79 #ifndef __cdecl
80 #define __cdecl
81 #endif
82 #ifndef __fastcall
83 #define __fastcall
84 #endif
85 #endif
86 #ifndef DL_IMPORT
87 #define DL_IMPORT(t) t
88 #endif
89 #ifndef DL_EXPORT
90 #define DL_EXPORT(t) t
91 #endif
92 #define __PYX_COMMA ,
93 #ifndef HAVE_LONG_LONG
94 #if PY_VERSION_HEX >= 0x02070000
95 #define HAVE_LONG_LONG
96 #endif
97 #endif
98 #ifndef PY_LONG_LONG
99 #define PY_LONG_LONG LONG_LONG
100 #endif
101 #ifndef Py_HUGE_VAL
102 #define Py_HUGE_VAL HUGE_VAL
103 #endif
104 #ifdef PYPY_VERSION
105 #define CYTHON_COMPILING_IN_PYPY 1
106 #define CYTHON_COMPILING_IN_PYSTON 0
107 #define CYTHON_COMPILING_IN_CPYTHON 0
108 #undef CYTHON_USE_TYPE_SLOTS
109 #define CYTHON_USE_TYPE_SLOTS 0
110 #undef CYTHON_USE_PYTYPE_LOOKUP
111 #define CYTHON_USE_PYTYPE_LOOKUP 0
112 #if PY_VERSION_HEX < 0x03050000
113 #undef CYTHON_USE_ASYNC_SLOTS
114 #define CYTHON_USE_ASYNC_SLOTS 0
115 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
116 #define CYTHON_USE_ASYNC_SLOTS 1
117 #endif
118 #undef CYTHON_USE_PYLIST_INTERNALS
119 #define CYTHON_USE_PYLIST_INTERNALS 0
120 #undef CYTHON_USE_UNICODE_INTERNALS
121 #define CYTHON_USE_UNICODE_INTERNALS 0
122 #undef CYTHON_USE_UNICODE_WRITER
123 #define CYTHON_USE_UNICODE_WRITER 0
124 #undef CYTHON_USE_PYLONG_INTERNALS
125 #define CYTHON_USE_PYLONG_INTERNALS 0
126 #undef CYTHON_AVOID_BORROWED_REFS
127 #define CYTHON_AVOID_BORROWED_REFS 1
128 #undef CYTHON_ASSUME_SAFE_MACROS
129 #define CYTHON_ASSUME_SAFE_MACROS 0
130 #undef CYTHON_UNPACK_METHODS
131 #define CYTHON_UNPACK_METHODS 0
132 #undef CYTHON_FAST_THREAD_STATE
133 #define CYTHON_FAST_THREAD_STATE 0
134 #undef CYTHON_FAST_PYCALL
135 #define CYTHON_FAST_PYCALL 0
136 #undef CYTHON_PEP489_MULTI_PHASE_INIT
137 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
138 #undef CYTHON_USE_TP_FINALIZE
139 #define CYTHON_USE_TP_FINALIZE 0
140 #undef CYTHON_USE_DICT_VERSIONS
141 #define CYTHON_USE_DICT_VERSIONS 0
142 #undef CYTHON_USE_EXC_INFO_STACK
143 #define CYTHON_USE_EXC_INFO_STACK 0
144 #elif defined(PYSTON_VERSION)
145 #define CYTHON_COMPILING_IN_PYPY 0
146 #define CYTHON_COMPILING_IN_PYSTON 1
147 #define CYTHON_COMPILING_IN_CPYTHON 0
148 #ifndef CYTHON_USE_TYPE_SLOTS
149 #define CYTHON_USE_TYPE_SLOTS 1
150 #endif
151 #undef CYTHON_USE_PYTYPE_LOOKUP
152 #define CYTHON_USE_PYTYPE_LOOKUP 0
153 #undef CYTHON_USE_ASYNC_SLOTS
154 #define CYTHON_USE_ASYNC_SLOTS 0
155 #undef CYTHON_USE_PYLIST_INTERNALS
156 #define CYTHON_USE_PYLIST_INTERNALS 0
157 #ifndef CYTHON_USE_UNICODE_INTERNALS
158 #define CYTHON_USE_UNICODE_INTERNALS 1
159 #endif
160 #undef CYTHON_USE_UNICODE_WRITER
161 #define CYTHON_USE_UNICODE_WRITER 0
162 #undef CYTHON_USE_PYLONG_INTERNALS
163 #define CYTHON_USE_PYLONG_INTERNALS 0
164 #ifndef CYTHON_AVOID_BORROWED_REFS
165 #define CYTHON_AVOID_BORROWED_REFS 0
166 #endif
167 #ifndef CYTHON_ASSUME_SAFE_MACROS
168 #define CYTHON_ASSUME_SAFE_MACROS 1
169 #endif
170 #ifndef CYTHON_UNPACK_METHODS
171 #define CYTHON_UNPACK_METHODS 1
172 #endif
173 #undef CYTHON_FAST_THREAD_STATE
174 #define CYTHON_FAST_THREAD_STATE 0
175 #undef CYTHON_FAST_PYCALL
176 #define CYTHON_FAST_PYCALL 0
177 #undef CYTHON_PEP489_MULTI_PHASE_INIT
178 #define CYTHON_PEP489_MULTI_PHASE_INIT 0
179 #undef CYTHON_USE_TP_FINALIZE
180 #define CYTHON_USE_TP_FINALIZE 0
181 #undef CYTHON_USE_DICT_VERSIONS
182 #define CYTHON_USE_DICT_VERSIONS 0
183 #undef CYTHON_USE_EXC_INFO_STACK
184 #define CYTHON_USE_EXC_INFO_STACK 0
185 #else
186 #define CYTHON_COMPILING_IN_PYPY 0
187 #define CYTHON_COMPILING_IN_PYSTON 0
188 #define CYTHON_COMPILING_IN_CPYTHON 1
189 #ifndef CYTHON_USE_TYPE_SLOTS
190 #define CYTHON_USE_TYPE_SLOTS 1
191 #endif
192 #if PY_VERSION_HEX < 0x02070000
193 #undef CYTHON_USE_PYTYPE_LOOKUP
194 #define CYTHON_USE_PYTYPE_LOOKUP 0
195 #elif !defined(CYTHON_USE_PYTYPE_LOOKUP)
196 #define CYTHON_USE_PYTYPE_LOOKUP 1
197 #endif
198 #if PY_MAJOR_VERSION < 3
199 #undef CYTHON_USE_ASYNC_SLOTS
200 #define CYTHON_USE_ASYNC_SLOTS 0
201 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
202 #define CYTHON_USE_ASYNC_SLOTS 1
203 #endif
204 #if PY_VERSION_HEX < 0x02070000
205 #undef CYTHON_USE_PYLONG_INTERNALS
206 #define CYTHON_USE_PYLONG_INTERNALS 0
207 #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
208 #define CYTHON_USE_PYLONG_INTERNALS 1
209 #endif
210 #ifndef CYTHON_USE_PYLIST_INTERNALS
211 #define CYTHON_USE_PYLIST_INTERNALS 1
212 #endif
213 #ifndef CYTHON_USE_UNICODE_INTERNALS
214 #define CYTHON_USE_UNICODE_INTERNALS 1
215 #endif
216 #if PY_VERSION_HEX < 0x030300F0
217 #undef CYTHON_USE_UNICODE_WRITER
218 #define CYTHON_USE_UNICODE_WRITER 0
219 #elif !defined(CYTHON_USE_UNICODE_WRITER)
220 #define CYTHON_USE_UNICODE_WRITER 1
221 #endif
222 #ifndef CYTHON_AVOID_BORROWED_REFS
223 #define CYTHON_AVOID_BORROWED_REFS 0
224 #endif
225 #ifndef CYTHON_ASSUME_SAFE_MACROS
226 #define CYTHON_ASSUME_SAFE_MACROS 1
227 #endif
228 #ifndef CYTHON_UNPACK_METHODS
229 #define CYTHON_UNPACK_METHODS 1
230 #endif
231 #ifndef CYTHON_FAST_THREAD_STATE
232 #define CYTHON_FAST_THREAD_STATE 1
233 #endif
234 #ifndef CYTHON_FAST_PYCALL
235 #define CYTHON_FAST_PYCALL 1
236 #endif
237 #ifndef CYTHON_PEP489_MULTI_PHASE_INIT
238 #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
239 #endif
240 #ifndef CYTHON_USE_TP_FINALIZE
241 #define CYTHON_USE_TP_FINALIZE (PY_VERSION_HEX >= 0x030400a1)
242 #endif
243 #ifndef CYTHON_USE_DICT_VERSIONS
244 #define CYTHON_USE_DICT_VERSIONS (PY_VERSION_HEX >= 0x030600B1)
245 #endif
246 #ifndef CYTHON_USE_EXC_INFO_STACK
247 #define CYTHON_USE_EXC_INFO_STACK (PY_VERSION_HEX >= 0x030700A3)
248 #endif
249 #endif
250 #if !defined(CYTHON_FAST_PYCCALL)
251 #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
252 #endif
253 #if CYTHON_USE_PYLONG_INTERNALS
254 #include "longintrepr.h"
255 #undef SHIFT
256 #undef BASE
257 #undef MASK
258 #ifdef SIZEOF_VOID_P
259 enum { __pyx_check_sizeof_voidp = 1 / (int)(SIZEOF_VOID_P == sizeof(void*)) };
260 #endif
261 #endif
262 #ifndef __has_attribute
263 #define __has_attribute(x) 0
264 #endif
265 #ifndef __has_cpp_attribute
266 #define __has_cpp_attribute(x) 0
267 #endif
268 #ifndef CYTHON_RESTRICT
269 #if defined(__GNUC__)
270 #define CYTHON_RESTRICT __restrict__
271 #elif defined(_MSC_VER) && _MSC_VER >= 1400
272 #define CYTHON_RESTRICT __restrict
273 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
274 #define CYTHON_RESTRICT restrict
275 #else
276 #define CYTHON_RESTRICT
277 #endif
278 #endif
279 #ifndef CYTHON_UNUSED
280 # if defined(__GNUC__)
281 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
282 # define CYTHON_UNUSED __attribute__ ((__unused__))
283 # else
284 # define CYTHON_UNUSED
285 # endif
286 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
287 # define CYTHON_UNUSED __attribute__ ((__unused__))
288 # else
289 # define CYTHON_UNUSED
290 # endif
291 #endif
292 #ifndef CYTHON_MAYBE_UNUSED_VAR
293 # if defined(__cplusplus)
CYTHON_MAYBE_UNUSED_VAR(const T &)294 template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
295 # else
296 # define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
297 # endif
298 #endif
299 #ifndef CYTHON_NCP_UNUSED
300 # if CYTHON_COMPILING_IN_CPYTHON
301 # define CYTHON_NCP_UNUSED
302 # else
303 # define CYTHON_NCP_UNUSED CYTHON_UNUSED
304 # endif
305 #endif
306 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
307 #ifdef _MSC_VER
308 #ifndef _MSC_STDINT_H_
309 #if _MSC_VER < 1300
310 typedef unsigned char uint8_t;
311 typedef unsigned int uint32_t;
312 #else
313 typedef unsigned __int8 uint8_t;
314 typedef unsigned __int32 uint32_t;
315 #endif
316 #endif
317 #else
318 #include <stdint.h>
319 #endif
320 #ifndef CYTHON_FALLTHROUGH
321 #if defined(__cplusplus) && __cplusplus >= 201103L
322 #if __has_cpp_attribute(fallthrough)
323 #define CYTHON_FALLTHROUGH [[fallthrough]]
324 #elif __has_cpp_attribute(clang::fallthrough)
325 #define CYTHON_FALLTHROUGH [[clang::fallthrough]]
326 #elif __has_cpp_attribute(gnu::fallthrough)
327 #define CYTHON_FALLTHROUGH [[gnu::fallthrough]]
328 #endif
329 #endif
330 #ifndef CYTHON_FALLTHROUGH
331 #if __has_attribute(fallthrough)
332 #define CYTHON_FALLTHROUGH __attribute__((fallthrough))
333 #else
334 #define CYTHON_FALLTHROUGH
335 #endif
336 #endif
337 #if defined(__clang__ ) && defined(__apple_build_version__)
338 #if __apple_build_version__ < 7000000
339 #undef CYTHON_FALLTHROUGH
340 #define CYTHON_FALLTHROUGH
341 #endif
342 #endif
343 #endif
344
345 #ifndef CYTHON_INLINE
346 #if defined(__clang__)
347 #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
348 #elif defined(__GNUC__)
349 #define CYTHON_INLINE __inline__
350 #elif defined(_MSC_VER)
351 #define CYTHON_INLINE __inline
352 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
353 #define CYTHON_INLINE inline
354 #else
355 #define CYTHON_INLINE
356 #endif
357 #endif
358
359 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
360 #define Py_OptimizeFlag 0
361 #endif
362 #define __PYX_BUILD_PY_SSIZE_T "n"
363 #define CYTHON_FORMAT_SSIZE_T "z"
364 #if PY_MAJOR_VERSION < 3
365 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
366 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
367 PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
368 #define __Pyx_DefaultClassType PyClass_Type
369 #else
370 #define __Pyx_BUILTIN_MODULE_NAME "builtins"
371 #if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2
372 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
373 PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
374 #else
375 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
376 PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
377 #endif
378 #define __Pyx_DefaultClassType PyType_Type
379 #endif
380 #ifndef Py_TPFLAGS_CHECKTYPES
381 #define Py_TPFLAGS_CHECKTYPES 0
382 #endif
383 #ifndef Py_TPFLAGS_HAVE_INDEX
384 #define Py_TPFLAGS_HAVE_INDEX 0
385 #endif
386 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
387 #define Py_TPFLAGS_HAVE_NEWBUFFER 0
388 #endif
389 #ifndef Py_TPFLAGS_HAVE_FINALIZE
390 #define Py_TPFLAGS_HAVE_FINALIZE 0
391 #endif
392 #ifndef METH_STACKLESS
393 #define METH_STACKLESS 0
394 #endif
395 #if PY_VERSION_HEX <= 0x030700A3 || !defined(METH_FASTCALL)
396 #ifndef METH_FASTCALL
397 #define METH_FASTCALL 0x80
398 #endif
399 typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject *const *args, Py_ssize_t nargs);
400 typedef PyObject *(*__Pyx_PyCFunctionFastWithKeywords) (PyObject *self, PyObject *const *args,
401 Py_ssize_t nargs, PyObject *kwnames);
402 #else
403 #define __Pyx_PyCFunctionFast _PyCFunctionFast
404 #define __Pyx_PyCFunctionFastWithKeywords _PyCFunctionFastWithKeywords
405 #endif
406 #if CYTHON_FAST_PYCCALL
407 #define __Pyx_PyFastCFunction_Check(func)\
408 ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)))))
409 #else
410 #define __Pyx_PyFastCFunction_Check(func) 0
411 #endif
412 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
413 #define PyObject_Malloc(s) PyMem_Malloc(s)
414 #define PyObject_Free(p) PyMem_Free(p)
415 #define PyObject_Realloc(p) PyMem_Realloc(p)
416 #endif
417 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX < 0x030400A1
418 #define PyMem_RawMalloc(n) PyMem_Malloc(n)
419 #define PyMem_RawRealloc(p, n) PyMem_Realloc(p, n)
420 #define PyMem_RawFree(p) PyMem_Free(p)
421 #endif
422 #if CYTHON_COMPILING_IN_PYSTON
423 #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co)
424 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
425 #else
426 #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
427 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
428 #endif
429 #if !CYTHON_FAST_THREAD_STATE || PY_VERSION_HEX < 0x02070000
430 #define __Pyx_PyThreadState_Current PyThreadState_GET()
431 #elif PY_VERSION_HEX >= 0x03060000
432 #define __Pyx_PyThreadState_Current _PyThreadState_UncheckedGet()
433 #elif PY_VERSION_HEX >= 0x03000000
434 #define __Pyx_PyThreadState_Current PyThreadState_GET()
435 #else
436 #define __Pyx_PyThreadState_Current _PyThreadState_Current
437 #endif
438 #if PY_VERSION_HEX < 0x030700A2 && !defined(PyThread_tss_create) && !defined(Py_tss_NEEDS_INIT)
439 #include "pythread.h"
440 #define Py_tss_NEEDS_INIT 0
441 typedef int Py_tss_t;
PyThread_tss_create(Py_tss_t * key)442 static CYTHON_INLINE int PyThread_tss_create(Py_tss_t *key) {
443 *key = PyThread_create_key();
444 return 0;
445 }
PyThread_tss_alloc(void)446 static CYTHON_INLINE Py_tss_t * PyThread_tss_alloc(void) {
447 Py_tss_t *key = (Py_tss_t *)PyObject_Malloc(sizeof(Py_tss_t));
448 *key = Py_tss_NEEDS_INIT;
449 return key;
450 }
PyThread_tss_free(Py_tss_t * key)451 static CYTHON_INLINE void PyThread_tss_free(Py_tss_t *key) {
452 PyObject_Free(key);
453 }
PyThread_tss_is_created(Py_tss_t * key)454 static CYTHON_INLINE int PyThread_tss_is_created(Py_tss_t *key) {
455 return *key != Py_tss_NEEDS_INIT;
456 }
PyThread_tss_delete(Py_tss_t * key)457 static CYTHON_INLINE void PyThread_tss_delete(Py_tss_t *key) {
458 PyThread_delete_key(*key);
459 *key = Py_tss_NEEDS_INIT;
460 }
PyThread_tss_set(Py_tss_t * key,void * value)461 static CYTHON_INLINE int PyThread_tss_set(Py_tss_t *key, void *value) {
462 return PyThread_set_key_value(*key, value);
463 }
PyThread_tss_get(Py_tss_t * key)464 static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) {
465 return PyThread_get_key_value(*key);
466 }
467 #endif
468 #if CYTHON_COMPILING_IN_CPYTHON || defined(_PyDict_NewPresized)
469 #define __Pyx_PyDict_NewPresized(n) ((n <= 8) ? PyDict_New() : _PyDict_NewPresized(n))
470 #else
471 #define __Pyx_PyDict_NewPresized(n) PyDict_New()
472 #endif
473 #if PY_MAJOR_VERSION >= 3 || CYTHON_FUTURE_DIVISION
474 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
475 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
476 #else
477 #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
478 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
479 #endif
480 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 && CYTHON_USE_UNICODE_INTERNALS
481 #define __Pyx_PyDict_GetItemStr(dict, name) _PyDict_GetItem_KnownHash(dict, name, ((PyASCIIObject *) name)->hash)
482 #else
483 #define __Pyx_PyDict_GetItemStr(dict, name) PyDict_GetItem(dict, name)
484 #endif
485 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
486 #define CYTHON_PEP393_ENABLED 1
487 #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
488 0 : _PyUnicode_Ready((PyObject *)(op)))
489 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
490 #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
491 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
492 #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
493 #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
494 #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
495 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch)
496 #if defined(PyUnicode_IS_READY) && defined(PyUnicode_GET_SIZE)
497 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
498 #else
499 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u))
500 #endif
501 #else
502 #define CYTHON_PEP393_ENABLED 0
503 #define PyUnicode_1BYTE_KIND 1
504 #define PyUnicode_2BYTE_KIND 2
505 #define PyUnicode_4BYTE_KIND 4
506 #define __Pyx_PyUnicode_READY(op) (0)
507 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
508 #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
509 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
510 #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
511 #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
512 #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
513 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
514 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u))
515 #endif
516 #if CYTHON_COMPILING_IN_PYPY
517 #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
518 #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
519 #else
520 #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
521 #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
522 PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
523 #endif
524 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
525 #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
526 #endif
527 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
528 #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
529 #endif
530 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
531 #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
532 #endif
533 #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))
534 #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None || (PyUnicode_Check(b) && !PyUnicode_CheckExact(b)))) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
535 #if PY_MAJOR_VERSION >= 3
536 #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
537 #else
538 #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
539 #endif
540 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
541 #define PyObject_ASCII(o) PyObject_Repr(o)
542 #endif
543 #if PY_MAJOR_VERSION >= 3
544 #define PyBaseString_Type PyUnicode_Type
545 #define PyStringObject PyUnicodeObject
546 #define PyString_Type PyUnicode_Type
547 #define PyString_Check PyUnicode_Check
548 #define PyString_CheckExact PyUnicode_CheckExact
549 #ifndef PyObject_Unicode
550 #define PyObject_Unicode PyObject_Str
551 #endif
552 #endif
553 #if PY_MAJOR_VERSION >= 3
554 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
555 #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
556 #else
557 #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
558 #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
559 #endif
560 #ifndef PySet_CheckExact
561 #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
562 #endif
563 #if PY_VERSION_HEX >= 0x030900A4
564 #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt)
565 #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size)
566 #else
567 #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt)
568 #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size)
569 #endif
570 #if CYTHON_ASSUME_SAFE_MACROS
571 #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq)
572 #else
573 #define __Pyx_PySequence_SIZE(seq) PySequence_Size(seq)
574 #endif
575 #if PY_MAJOR_VERSION >= 3
576 #define PyIntObject PyLongObject
577 #define PyInt_Type PyLong_Type
578 #define PyInt_Check(op) PyLong_Check(op)
579 #define PyInt_CheckExact(op) PyLong_CheckExact(op)
580 #define PyInt_FromString PyLong_FromString
581 #define PyInt_FromUnicode PyLong_FromUnicode
582 #define PyInt_FromLong PyLong_FromLong
583 #define PyInt_FromSize_t PyLong_FromSize_t
584 #define PyInt_FromSsize_t PyLong_FromSsize_t
585 #define PyInt_AsLong PyLong_AsLong
586 #define PyInt_AS_LONG PyLong_AS_LONG
587 #define PyInt_AsSsize_t PyLong_AsSsize_t
588 #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
589 #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
590 #define PyNumber_Int PyNumber_Long
591 #endif
592 #if PY_MAJOR_VERSION >= 3
593 #define PyBoolObject PyLongObject
594 #endif
595 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
596 #ifndef PyUnicode_InternFromString
597 #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
598 #endif
599 #endif
600 #if PY_VERSION_HEX < 0x030200A4
601 typedef long Py_hash_t;
602 #define __Pyx_PyInt_FromHash_t PyInt_FromLong
603 #define __Pyx_PyInt_AsHash_t PyInt_AsLong
604 #else
605 #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
606 #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
607 #endif
608 #if PY_MAJOR_VERSION >= 3
609 #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func))
610 #else
611 #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
612 #endif
613 #if CYTHON_USE_ASYNC_SLOTS
614 #if PY_VERSION_HEX >= 0x030500B1
615 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
616 #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
617 #else
618 #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
619 #endif
620 #else
621 #define __Pyx_PyType_AsAsync(obj) NULL
622 #endif
623 #ifndef __Pyx_PyAsyncMethodsStruct
624 typedef struct {
625 unaryfunc am_await;
626 unaryfunc am_aiter;
627 unaryfunc am_anext;
628 } __Pyx_PyAsyncMethodsStruct;
629 #endif
630
631 #if defined(WIN32) || defined(MS_WINDOWS)
632 #define _USE_MATH_DEFINES
633 #endif
634 #include <math.h>
635 #ifdef NAN
636 #define __PYX_NAN() ((float) NAN)
637 #else
__PYX_NAN()638 static CYTHON_INLINE float __PYX_NAN() {
639 float value;
640 memset(&value, 0xFF, sizeof(value));
641 return value;
642 }
643 #endif
644 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
645 #define __Pyx_truncl trunc
646 #else
647 #define __Pyx_truncl truncl
648 #endif
649
650 #define __PYX_MARK_ERR_POS(f_index, lineno) \
651 { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; }
652 #define __PYX_ERR(f_index, lineno, Ln_error) \
653 { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; }
654
655 #ifndef __PYX_EXTERN_C
656 #ifdef __cplusplus
657 #define __PYX_EXTERN_C extern "C"
658 #else
659 #define __PYX_EXTERN_C extern
660 #endif
661 #endif
662
663 #define __PYX_HAVE__av__stream
664 #define __PYX_HAVE_API__av__stream
665 /* Early includes */
666 #include <stdint.h>
667 #include "pyav/config.h"
668 #include "libavutil/mathematics.h"
669 #include "libavutil/rational.h"
670 #include "libavutil/avutil.h"
671 #include "libavutil/pixdesc.h"
672 #include "libavutil/channel_layout.h"
673 #include "libavutil/audio_fifo.h"
674 #include "stdarg.h"
675 #include "libavutil/opt.h"
676 #include "libavutil/imgutils.h"
677 #include "libavutil/log.h"
678 #include "libavutil/dict.h"
679 #include "libavutil/error.h"
680 #include "libavutil/frame.h"
681 #include "libavutil/samplefmt.h"
682 #include "libavutil/motion_vector.h"
683 #include "libavcodec/avcodec.h"
684 #include "libavdevice/avdevice.h"
685 #include "libavformat/avformat.h"
686 #include "libswresample/swresample.h"
687 #include "libswscale/swscale.h"
688 #include "libavfilter/avfilter.h"
689 #include "libavfilter/buffersink.h"
690 #include "libavfilter/buffersrc.h"
691 #include "stdio.h"
692 #include <string.h>
693 #include <stdio.h>
694 #include "pythread.h"
695 #ifdef _OPENMP
696 #include <omp.h>
697 #endif /* _OPENMP */
698
699 #if defined(PYREX_WITHOUT_ASSERTIONS) && !defined(CYTHON_WITHOUT_ASSERTIONS)
700 #define CYTHON_WITHOUT_ASSERTIONS
701 #endif
702
703 typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
704 const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
705
706 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 1
707 #define __PYX_DEFAULT_STRING_ENCODING_IS_UTF8 0
708 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT (PY_MAJOR_VERSION >= 3 && __PYX_DEFAULT_STRING_ENCODING_IS_UTF8)
709 #define __PYX_DEFAULT_STRING_ENCODING "ascii"
710 #define __Pyx_PyObject_FromString __Pyx_PyStr_FromString
711 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyStr_FromStringAndSize
712 #define __Pyx_uchar_cast(c) ((unsigned char)c)
713 #define __Pyx_long_cast(x) ((long)x)
714 #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
715 (sizeof(type) < sizeof(Py_ssize_t)) ||\
716 (sizeof(type) > sizeof(Py_ssize_t) &&\
717 likely(v < (type)PY_SSIZE_T_MAX ||\
718 v == (type)PY_SSIZE_T_MAX) &&\
719 (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
720 v == (type)PY_SSIZE_T_MIN))) ||\
721 (sizeof(type) == sizeof(Py_ssize_t) &&\
722 (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
723 v == (type)PY_SSIZE_T_MAX))) )
__Pyx_is_valid_index(Py_ssize_t i,Py_ssize_t limit)724 static CYTHON_INLINE int __Pyx_is_valid_index(Py_ssize_t i, Py_ssize_t limit) {
725 return (size_t) i < (size_t) limit;
726 }
727 #if defined (__cplusplus) && __cplusplus >= 201103L
728 #include <cstdlib>
729 #define __Pyx_sst_abs(value) std::abs(value)
730 #elif SIZEOF_INT >= SIZEOF_SIZE_T
731 #define __Pyx_sst_abs(value) abs(value)
732 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
733 #define __Pyx_sst_abs(value) labs(value)
734 #elif defined (_MSC_VER)
735 #define __Pyx_sst_abs(value) ((Py_ssize_t)_abs64(value))
736 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
737 #define __Pyx_sst_abs(value) llabs(value)
738 #elif defined (__GNUC__)
739 #define __Pyx_sst_abs(value) __builtin_llabs(value)
740 #else
741 #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
742 #endif
743 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject*);
744 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
745 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
746 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
747 #define __Pyx_PyBytes_FromString PyBytes_FromString
748 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
749 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
750 #if PY_MAJOR_VERSION < 3
751 #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
752 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
753 #else
754 #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
755 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
756 #endif
757 #define __Pyx_PyBytes_AsWritableString(s) ((char*) PyBytes_AS_STRING(s))
758 #define __Pyx_PyBytes_AsWritableSString(s) ((signed char*) PyBytes_AS_STRING(s))
759 #define __Pyx_PyBytes_AsWritableUString(s) ((unsigned char*) PyBytes_AS_STRING(s))
760 #define __Pyx_PyBytes_AsString(s) ((const char*) PyBytes_AS_STRING(s))
761 #define __Pyx_PyBytes_AsSString(s) ((const signed char*) PyBytes_AS_STRING(s))
762 #define __Pyx_PyBytes_AsUString(s) ((const unsigned char*) PyBytes_AS_STRING(s))
763 #define __Pyx_PyObject_AsWritableString(s) ((char*) __Pyx_PyObject_AsString(s))
764 #define __Pyx_PyObject_AsWritableSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
765 #define __Pyx_PyObject_AsWritableUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
766 #define __Pyx_PyObject_AsSString(s) ((const signed char*) __Pyx_PyObject_AsString(s))
767 #define __Pyx_PyObject_AsUString(s) ((const unsigned char*) __Pyx_PyObject_AsString(s))
768 #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
769 #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
770 #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
771 #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
772 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
__Pyx_Py_UNICODE_strlen(const Py_UNICODE * u)773 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) {
774 const Py_UNICODE *u_end = u;
775 while (*u_end++) ;
776 return (size_t)(u_end - u - 1);
777 }
778 #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
779 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
780 #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
781 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
782 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
783 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b);
784 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
785 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject*);
786 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
787 #define __Pyx_PySequence_Tuple(obj)\
788 (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj))
789 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
790 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
791 #if CYTHON_ASSUME_SAFE_MACROS
792 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
793 #else
794 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
795 #endif
796 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
797 #if PY_MAJOR_VERSION >= 3
798 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
799 #else
800 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
801 #endif
802 #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
803 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
804 static int __Pyx_sys_getdefaultencoding_not_ascii;
__Pyx_init_sys_getdefaultencoding_params(void)805 static int __Pyx_init_sys_getdefaultencoding_params(void) {
806 PyObject* sys;
807 PyObject* default_encoding = NULL;
808 PyObject* ascii_chars_u = NULL;
809 PyObject* ascii_chars_b = NULL;
810 const char* default_encoding_c;
811 sys = PyImport_ImportModule("sys");
812 if (!sys) goto bad;
813 default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
814 Py_DECREF(sys);
815 if (!default_encoding) goto bad;
816 default_encoding_c = PyBytes_AsString(default_encoding);
817 if (!default_encoding_c) goto bad;
818 if (strcmp(default_encoding_c, "ascii") == 0) {
819 __Pyx_sys_getdefaultencoding_not_ascii = 0;
820 } else {
821 char ascii_chars[128];
822 int c;
823 for (c = 0; c < 128; c++) {
824 ascii_chars[c] = c;
825 }
826 __Pyx_sys_getdefaultencoding_not_ascii = 1;
827 ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
828 if (!ascii_chars_u) goto bad;
829 ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
830 if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
831 PyErr_Format(
832 PyExc_ValueError,
833 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
834 default_encoding_c);
835 goto bad;
836 }
837 Py_DECREF(ascii_chars_u);
838 Py_DECREF(ascii_chars_b);
839 }
840 Py_DECREF(default_encoding);
841 return 0;
842 bad:
843 Py_XDECREF(default_encoding);
844 Py_XDECREF(ascii_chars_u);
845 Py_XDECREF(ascii_chars_b);
846 return -1;
847 }
848 #endif
849 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
850 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
851 #else
852 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
853 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
854 static char* __PYX_DEFAULT_STRING_ENCODING;
__Pyx_init_sys_getdefaultencoding_params(void)855 static int __Pyx_init_sys_getdefaultencoding_params(void) {
856 PyObject* sys;
857 PyObject* default_encoding = NULL;
858 char* default_encoding_c;
859 sys = PyImport_ImportModule("sys");
860 if (!sys) goto bad;
861 default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
862 Py_DECREF(sys);
863 if (!default_encoding) goto bad;
864 default_encoding_c = PyBytes_AsString(default_encoding);
865 if (!default_encoding_c) goto bad;
866 __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c) + 1);
867 if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
868 strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
869 Py_DECREF(default_encoding);
870 return 0;
871 bad:
872 Py_XDECREF(default_encoding);
873 return -1;
874 }
875 #endif
876 #endif
877
878
879 /* Test for GCC > 2.95 */
880 #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
881 #define likely(x) __builtin_expect(!!(x), 1)
882 #define unlikely(x) __builtin_expect(!!(x), 0)
883 #else /* !__GNUC__ or GCC < 2.95 */
884 #define likely(x) (x)
885 #define unlikely(x) (x)
886 #endif /* __GNUC__ */
__Pyx_pretend_to_initialize(void * ptr)887 static CYTHON_INLINE void __Pyx_pretend_to_initialize(void* ptr) { (void)ptr; }
888
889 static PyObject *__pyx_m = NULL;
890 static PyObject *__pyx_d;
891 static PyObject *__pyx_b;
892 static PyObject *__pyx_cython_runtime = NULL;
893 static PyObject *__pyx_empty_tuple;
894 static PyObject *__pyx_empty_bytes;
895 static PyObject *__pyx_empty_unicode;
896 static int __pyx_lineno;
897 static int __pyx_clineno = 0;
898 static const char * __pyx_cfilenm= __FILE__;
899 static const char *__pyx_filename;
900
901
902 static const char *__pyx_f[] = {
903 "av/stream.pyx",
904 "stringsource",
905 "av/bytesource.pxd",
906 "av/codec/codec.pxd",
907 "av/buffer.pxd",
908 "av/packet.pxd",
909 "av/dictionary.pxd",
910 "av/sidedata/sidedata.pxd",
911 "av/frame.pxd",
912 "av/codec/context.pxd",
913 "av/container/streams.pxd",
914 "av/format.pxd",
915 "av/container/core.pxd",
916 "type.pxd",
917 "bool.pxd",
918 "complex.pxd",
919 };
920
921 /*--- Type declarations ---*/
922 struct __pyx_obj_2av_10bytesource_ByteSource;
923 struct __pyx_obj_2av_5codec_5codec_Codec;
924 struct __pyx_obj_2av_6buffer_Buffer;
925 struct __pyx_obj_2av_6packet_Packet;
926 struct __pyx_obj_2av_10dictionary__Dictionary;
927 struct __pyx_obj_2av_8sidedata_8sidedata_SideData;
928 struct __pyx_obj_2av_8sidedata_8sidedata__SideDataContainer;
929 struct __pyx_obj_2av_5frame_Frame;
930 struct __pyx_obj_2av_5codec_7context_CodecContext;
931 struct __pyx_obj_2av_9container_7streams_StreamContainer;
932 struct __pyx_obj_2av_6format_ContainerFormat;
933 struct __pyx_obj_2av_9container_4core_Container;
934 struct __pyx_obj_2av_6stream_Stream;
935 struct __pyx_opt_args_2av_10bytesource_bytesource;
936
937 /* "av/bytesource.pxd":14
938 * cdef size_t length
939 *
940 * cdef ByteSource bytesource(object, bint allow_none=*) # <<<<<<<<<<<<<<
941 */
942 struct __pyx_opt_args_2av_10bytesource_bytesource {
943 int __pyx_n;
944 int allow_none;
945 };
946 struct __pyx_opt_args_2av_5codec_5codec_5Codec__init;
947
948 /* "av/codec/codec.pxd":10
949 * cdef readonly bint is_encoder
950 *
951 * cdef _init(self, name=?) # <<<<<<<<<<<<<<
952 *
953 *
954 */
955 struct __pyx_opt_args_2av_5codec_5codec_5Codec__init {
956 int __pyx_n;
957 PyObject *name;
958 };
959 struct __pyx_opt_args_2av_5frame_5Frame__copy_internal_attributes;
960
961 /* "av/frame.pxd":19
962 * cdef readonly int index
963 *
964 * cdef _copy_internal_attributes(self, Frame source, bint data_layout=?) # <<<<<<<<<<<<<<
965 *
966 * cdef _init_user_attributes(self)
967 */
968 struct __pyx_opt_args_2av_5frame_5Frame__copy_internal_attributes {
969 int __pyx_n;
970 int data_layout;
971 };
972 struct __pyx_opt_args_2av_5codec_7context_12CodecContext_open;
973 struct __pyx_opt_args_2av_5codec_7context_12CodecContext_close;
974 struct __pyx_opt_args_2av_5codec_7context_12CodecContext_encode;
975 struct __pyx_opt_args_2av_5codec_7context_12CodecContext_decode;
976
977 /* "av/codec/context.pxd":34
978 *
979 * # Public API.
980 * cpdef open(self, bint strict=?) # <<<<<<<<<<<<<<
981 * cpdef close(self, bint strict=?)
982 *
983 */
984 struct __pyx_opt_args_2av_5codec_7context_12CodecContext_open {
985 int __pyx_n;
986 int strict;
987 };
988
989 /* "av/codec/context.pxd":35
990 * # Public API.
991 * cpdef open(self, bint strict=?)
992 * cpdef close(self, bint strict=?) # <<<<<<<<<<<<<<
993 *
994 * cdef _set_default_time_base(self)
995 */
996 struct __pyx_opt_args_2av_5codec_7context_12CodecContext_close {
997 int __pyx_n;
998 int strict;
999 };
1000
1001 /* "av/codec/context.pxd":40
1002 *
1003 * # Wraps both versions of the transcode API, returning lists.
1004 * cpdef encode(self, Frame frame=?) # <<<<<<<<<<<<<<
1005 * cpdef decode(self, Packet packet=?)
1006 *
1007 */
1008 struct __pyx_opt_args_2av_5codec_7context_12CodecContext_encode {
1009 int __pyx_n;
1010 struct __pyx_obj_2av_5frame_Frame *frame;
1011 };
1012
1013 /* "av/codec/context.pxd":41
1014 * # Wraps both versions of the transcode API, returning lists.
1015 * cpdef encode(self, Frame frame=?)
1016 * cpdef decode(self, Packet packet=?) # <<<<<<<<<<<<<<
1017 *
1018 * # Used by both transcode APIs to setup user-land objects.
1019 */
1020 struct __pyx_opt_args_2av_5codec_7context_12CodecContext_decode {
1021 int __pyx_n;
1022 struct __pyx_obj_2av_6packet_Packet *packet;
1023 };
1024 struct __pyx_t_2av_9container_4core_timeout_info;
1025 typedef struct __pyx_t_2av_9container_4core_timeout_info __pyx_t_2av_9container_4core_timeout_info;
1026
1027 /* "av/container/core.pxd":10
1028 *
1029 * # Interrupt callback information, times are in seconds.
1030 * ctypedef struct timeout_info: # <<<<<<<<<<<<<<
1031 * double start_time
1032 * double timeout
1033 */
1034 struct __pyx_t_2av_9container_4core_timeout_info {
1035 double start_time;
1036 double timeout;
1037 };
1038 struct __pyx_opt_args_2av_5error_stash_exception;
1039 struct __pyx_opt_args_2av_5error_err_check;
1040 struct __pyx_opt_args_2av_5error_make_error;
1041
1042 /* "av/error.pxd":2
1043 *
1044 * cdef int stash_exception(exc_info=*) # <<<<<<<<<<<<<<
1045 *
1046 * cpdef int err_check(int res, filename=*) except -1
1047 */
1048 struct __pyx_opt_args_2av_5error_stash_exception {
1049 int __pyx_n;
1050 PyObject *exc_info;
1051 };
1052
1053 /* "av/error.pxd":4
1054 * cdef int stash_exception(exc_info=*)
1055 *
1056 * cpdef int err_check(int res, filename=*) except -1 # <<<<<<<<<<<<<<
1057 * cpdef make_error(int res, filename=*, log=*)
1058 */
1059 struct __pyx_opt_args_2av_5error_err_check {
1060 int __pyx_n;
1061 PyObject *filename;
1062 };
1063
1064 /* "av/error.pxd":5
1065 *
1066 * cpdef int err_check(int res, filename=*) except -1
1067 * cpdef make_error(int res, filename=*, log=*) # <<<<<<<<<<<<<<
1068 */
1069 struct __pyx_opt_args_2av_5error_make_error {
1070 int __pyx_n;
1071 PyObject *filename;
1072 PyObject *log;
1073 };
1074
1075 /* "av/bytesource.pxd":4
1076 *
1077 *
1078 * cdef class ByteSource(object): # <<<<<<<<<<<<<<
1079 *
1080 * cdef object owner
1081 */
1082 struct __pyx_obj_2av_10bytesource_ByteSource {
1083 PyObject_HEAD
1084 PyObject *owner;
1085 int has_view;
1086 Py_buffer view;
1087 unsigned char *ptr;
1088 size_t length;
1089 };
1090
1091
1092 /* "av/codec/codec.pxd":4
1093 *
1094 *
1095 * cdef class Codec(object): # <<<<<<<<<<<<<<
1096 *
1097 * cdef const lib.AVCodec *ptr
1098 */
1099 struct __pyx_obj_2av_5codec_5codec_Codec {
1100 PyObject_HEAD
1101 struct __pyx_vtabstruct_2av_5codec_5codec_Codec *__pyx_vtab;
1102 struct AVCodec const *ptr;
1103 struct AVCodecDescriptor const *desc;
1104 int is_encoder;
1105 };
1106
1107
1108 /* "av/buffer.pxd":2
1109 *
1110 * cdef class Buffer(object): # <<<<<<<<<<<<<<
1111 *
1112 * cdef size_t _buffer_size(self)
1113 */
1114 struct __pyx_obj_2av_6buffer_Buffer {
1115 PyObject_HEAD
1116 struct __pyx_vtabstruct_2av_6buffer_Buffer *__pyx_vtab;
1117 };
1118
1119
1120 /* "av/packet.pxd":8
1121 *
1122 *
1123 * cdef class Packet(Buffer): # <<<<<<<<<<<<<<
1124 *
1125 * cdef lib.AVPacket struct
1126 */
1127 struct __pyx_obj_2av_6packet_Packet {
1128 struct __pyx_obj_2av_6buffer_Buffer __pyx_base;
1129 struct AVPacket __pyx_struct;
1130 struct __pyx_obj_2av_6stream_Stream *_stream;
1131 AVRational _time_base;
1132 struct __pyx_obj_2av_10bytesource_ByteSource *source;
1133 };
1134
1135
1136 /* "av/dictionary.pxd":4
1137 *
1138 *
1139 * cdef class _Dictionary(object): # <<<<<<<<<<<<<<
1140 *
1141 * cdef lib.AVDictionary *ptr
1142 */
1143 struct __pyx_obj_2av_10dictionary__Dictionary {
1144 PyObject_HEAD
1145 struct __pyx_vtabstruct_2av_10dictionary__Dictionary *__pyx_vtab;
1146 AVDictionary *ptr;
1147 };
1148
1149
1150 /* "av/sidedata/sidedata.pxd":9
1151 *
1152 *
1153 * cdef class SideData(Buffer): # <<<<<<<<<<<<<<
1154 *
1155 * cdef Frame frame
1156 */
1157 struct __pyx_obj_2av_8sidedata_8sidedata_SideData {
1158 struct __pyx_obj_2av_6buffer_Buffer __pyx_base;
1159 struct __pyx_obj_2av_5frame_Frame *frame;
1160 struct AVFrameSideData *ptr;
1161 struct __pyx_obj_2av_10dictionary__Dictionary *metadata;
1162 };
1163
1164
1165 /* "av/sidedata/sidedata.pxd":18
1166 * cdef SideData wrap_side_data(Frame frame, int index)
1167 *
1168 * cdef class _SideDataContainer(object): # <<<<<<<<<<<<<<
1169 *
1170 * cdef Frame frame
1171 */
1172 struct __pyx_obj_2av_8sidedata_8sidedata__SideDataContainer {
1173 PyObject_HEAD
1174 struct __pyx_obj_2av_5frame_Frame *frame;
1175 PyObject *_by_index;
1176 PyObject *_by_type;
1177 };
1178
1179
1180 /* "av/frame.pxd":7
1181 *
1182 *
1183 * cdef class Frame(object): # <<<<<<<<<<<<<<
1184 *
1185 * cdef lib.AVFrame *ptr
1186 */
1187 struct __pyx_obj_2av_5frame_Frame {
1188 PyObject_HEAD
1189 struct __pyx_vtabstruct_2av_5frame_Frame *__pyx_vtab;
1190 struct AVFrame *ptr;
1191 AVRational _time_base;
1192 struct __pyx_obj_2av_8sidedata_8sidedata__SideDataContainer *_side_data;
1193 int index;
1194 };
1195
1196
1197 /* "av/codec/context.pxd":10
1198 *
1199 *
1200 * cdef class CodecContext(object): # <<<<<<<<<<<<<<
1201 *
1202 * cdef lib.AVCodecContext *ptr
1203 */
1204 struct __pyx_obj_2av_5codec_7context_CodecContext {
1205 PyObject_HEAD
1206 struct __pyx_vtabstruct_2av_5codec_7context_CodecContext *__pyx_vtab;
1207 struct AVCodecContext *ptr;
1208 int allocated;
1209 int stream_index;
1210 struct AVCodecParserContext *parser;
1211 struct __pyx_obj_2av_10bytesource_ByteSource *extradata_source;
1212 struct __pyx_obj_2av_5codec_5codec_Codec *codec;
1213 PyObject *options;
1214 struct __pyx_obj_2av_5frame_Frame *_next_frame;
1215 };
1216
1217
1218 /* "av/container/streams.pxd":4
1219 *
1220 *
1221 * cdef class StreamContainer(object): # <<<<<<<<<<<<<<
1222 *
1223 * cdef list _streams
1224 */
1225 struct __pyx_obj_2av_9container_7streams_StreamContainer {
1226 PyObject_HEAD
1227 struct __pyx_vtabstruct_2av_9container_7streams_StreamContainer *__pyx_vtab;
1228 PyObject *_streams;
1229 PyObject *video;
1230 PyObject *audio;
1231 PyObject *subtitles;
1232 PyObject *data;
1233 PyObject *other;
1234 };
1235
1236
1237 /* "av/format.pxd":4
1238 *
1239 *
1240 * cdef class ContainerFormat(object): # <<<<<<<<<<<<<<
1241 *
1242 * cdef readonly str name
1243 */
1244 struct __pyx_obj_2av_6format_ContainerFormat {
1245 PyObject_HEAD
1246 PyObject *name;
1247 struct AVInputFormat *iptr;
1248 struct AVOutputFormat *optr;
1249 };
1250
1251
1252 /* "av/container/core.pxd":15
1253 *
1254 *
1255 * cdef class Container(object): # <<<<<<<<<<<<<<
1256 *
1257 * cdef readonly bint writeable
1258 */
1259 struct __pyx_obj_2av_9container_4core_Container {
1260 PyObject_HEAD
1261 struct __pyx_vtabstruct_2av_9container_4core_Container *__pyx_vtab;
1262 int writeable;
1263 struct AVFormatContext *ptr;
1264 PyObject *name;
1265 PyObject *metadata_encoding;
1266 PyObject *metadata_errors;
1267 PyObject *file;
1268 PyObject *fread;
1269 PyObject *fwrite;
1270 PyObject *fseek;
1271 PyObject *ftell;
1272 struct AVIOContext *iocontext;
1273 unsigned char *buffer;
1274 long pos;
1275 int pos_is_valid;
1276 int input_was_opened;
1277 struct __pyx_obj_2av_6format_ContainerFormat *format;
1278 PyObject *options;
1279 PyObject *container_options;
1280 PyObject *stream_options;
1281 struct __pyx_obj_2av_9container_7streams_StreamContainer *streams;
1282 PyObject *metadata;
1283 PyObject *open_timeout;
1284 PyObject *read_timeout;
1285 __pyx_t_2av_9container_4core_timeout_info interrupt_callback_info;
1286 };
1287
1288
1289 /* "av/stream.pxd":10
1290 *
1291 *
1292 * cdef class Stream(object): # <<<<<<<<<<<<<<
1293 *
1294 * # Stream attributes.
1295 */
1296 struct __pyx_obj_2av_6stream_Stream {
1297 PyObject_HEAD
1298 struct __pyx_vtabstruct_2av_6stream_Stream *__pyx_vtab;
1299 struct __pyx_obj_2av_9container_4core_Container *container;
1300 struct AVStream *_stream;
1301 PyObject *metadata;
1302 struct AVCodecContext *_codec_context;
1303 struct AVCodec const *_codec;
1304 struct __pyx_obj_2av_5codec_7context_CodecContext *codec_context;
1305 };
1306
1307
1308
1309 /* "av/codec/codec.pxd":4
1310 *
1311 *
1312 * cdef class Codec(object): # <<<<<<<<<<<<<<
1313 *
1314 * cdef const lib.AVCodec *ptr
1315 */
1316
1317 struct __pyx_vtabstruct_2av_5codec_5codec_Codec {
1318 PyObject *(*_init)(struct __pyx_obj_2av_5codec_5codec_Codec *, struct __pyx_opt_args_2av_5codec_5codec_5Codec__init *__pyx_optional_args);
1319 };
1320 static struct __pyx_vtabstruct_2av_5codec_5codec_Codec *__pyx_vtabptr_2av_5codec_5codec_Codec;
1321
1322
1323 /* "av/buffer.pxd":2
1324 *
1325 * cdef class Buffer(object): # <<<<<<<<<<<<<<
1326 *
1327 * cdef size_t _buffer_size(self)
1328 */
1329
1330 struct __pyx_vtabstruct_2av_6buffer_Buffer {
1331 size_t (*_buffer_size)(struct __pyx_obj_2av_6buffer_Buffer *);
1332 void *(*_buffer_ptr)(struct __pyx_obj_2av_6buffer_Buffer *);
1333 int (*_buffer_writable)(struct __pyx_obj_2av_6buffer_Buffer *);
1334 };
1335 static struct __pyx_vtabstruct_2av_6buffer_Buffer *__pyx_vtabptr_2av_6buffer_Buffer;
1336
1337
1338 /* "av/packet.pxd":8
1339 *
1340 *
1341 * cdef class Packet(Buffer): # <<<<<<<<<<<<<<
1342 *
1343 * cdef lib.AVPacket struct
1344 */
1345
1346 struct __pyx_vtabstruct_2av_6packet_Packet {
1347 struct __pyx_vtabstruct_2av_6buffer_Buffer __pyx_base;
1348 PyObject *(*_rebase_time)(struct __pyx_obj_2av_6packet_Packet *, AVRational);
1349 };
1350 static struct __pyx_vtabstruct_2av_6packet_Packet *__pyx_vtabptr_2av_6packet_Packet;
1351
1352
1353 /* "av/dictionary.pxd":4
1354 *
1355 *
1356 * cdef class _Dictionary(object): # <<<<<<<<<<<<<<
1357 *
1358 * cdef lib.AVDictionary *ptr
1359 */
1360
1361 struct __pyx_vtabstruct_2av_10dictionary__Dictionary {
1362 struct __pyx_obj_2av_10dictionary__Dictionary *(*copy)(struct __pyx_obj_2av_10dictionary__Dictionary *, int __pyx_skip_dispatch);
1363 };
1364 static struct __pyx_vtabstruct_2av_10dictionary__Dictionary *__pyx_vtabptr_2av_10dictionary__Dictionary;
1365
1366
1367 /* "av/sidedata/sidedata.pxd":9
1368 *
1369 *
1370 * cdef class SideData(Buffer): # <<<<<<<<<<<<<<
1371 *
1372 * cdef Frame frame
1373 */
1374
1375 struct __pyx_vtabstruct_2av_8sidedata_8sidedata_SideData {
1376 struct __pyx_vtabstruct_2av_6buffer_Buffer __pyx_base;
1377 };
1378 static struct __pyx_vtabstruct_2av_8sidedata_8sidedata_SideData *__pyx_vtabptr_2av_8sidedata_8sidedata_SideData;
1379
1380
1381 /* "av/frame.pxd":7
1382 *
1383 *
1384 * cdef class Frame(object): # <<<<<<<<<<<<<<
1385 *
1386 * cdef lib.AVFrame *ptr
1387 */
1388
1389 struct __pyx_vtabstruct_2av_5frame_Frame {
1390 PyObject *(*_rebase_time)(struct __pyx_obj_2av_5frame_Frame *, AVRational);
1391 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);
1392 PyObject *(*_init_user_attributes)(struct __pyx_obj_2av_5frame_Frame *);
1393 };
1394 static struct __pyx_vtabstruct_2av_5frame_Frame *__pyx_vtabptr_2av_5frame_Frame;
1395
1396
1397 /* "av/codec/context.pxd":10
1398 *
1399 *
1400 * cdef class CodecContext(object): # <<<<<<<<<<<<<<
1401 *
1402 * cdef lib.AVCodecContext *ptr
1403 */
1404
1405 struct __pyx_vtabstruct_2av_5codec_7context_CodecContext {
1406 PyObject *(*_init)(struct __pyx_obj_2av_5codec_7context_CodecContext *, struct AVCodecContext *, struct AVCodec const *);
1407 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);
1408 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);
1409 PyObject *(*_set_default_time_base)(struct __pyx_obj_2av_5codec_7context_CodecContext *);
1410 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);
1411 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);
1412 PyObject *(*_prepare_frames_for_encode)(struct __pyx_obj_2av_5codec_7context_CodecContext *, struct __pyx_obj_2av_5frame_Frame *);
1413 PyObject *(*_setup_encoded_packet)(struct __pyx_obj_2av_5codec_7context_CodecContext *, struct __pyx_obj_2av_6packet_Packet *);
1414 PyObject *(*_setup_decoded_frame)(struct __pyx_obj_2av_5codec_7context_CodecContext *, struct __pyx_obj_2av_5frame_Frame *, struct __pyx_obj_2av_6packet_Packet *);
1415 PyObject *(*_send_frame_and_recv)(struct __pyx_obj_2av_5codec_7context_CodecContext *, struct __pyx_obj_2av_5frame_Frame *);
1416 PyObject *(*_recv_packet)(struct __pyx_obj_2av_5codec_7context_CodecContext *);
1417 PyObject *(*_send_packet_and_recv)(struct __pyx_obj_2av_5codec_7context_CodecContext *, struct __pyx_obj_2av_6packet_Packet *);
1418 PyObject *(*_recv_frame)(struct __pyx_obj_2av_5codec_7context_CodecContext *);
1419 struct __pyx_obj_2av_5frame_Frame *(*_alloc_next_frame)(struct __pyx_obj_2av_5codec_7context_CodecContext *);
1420 };
1421 static struct __pyx_vtabstruct_2av_5codec_7context_CodecContext *__pyx_vtabptr_2av_5codec_7context_CodecContext;
1422
1423
1424 /* "av/container/streams.pxd":4
1425 *
1426 *
1427 * cdef class StreamContainer(object): # <<<<<<<<<<<<<<
1428 *
1429 * cdef list _streams
1430 */
1431
1432 struct __pyx_vtabstruct_2av_9container_7streams_StreamContainer {
1433 PyObject *(*add_stream)(struct __pyx_obj_2av_9container_7streams_StreamContainer *, struct __pyx_obj_2av_6stream_Stream *);
1434 };
1435 static struct __pyx_vtabstruct_2av_9container_7streams_StreamContainer *__pyx_vtabptr_2av_9container_7streams_StreamContainer;
1436
1437
1438 /* "av/container/core.pxd":15
1439 *
1440 *
1441 * cdef class Container(object): # <<<<<<<<<<<<<<
1442 *
1443 * cdef readonly bint writeable
1444 */
1445
1446 struct __pyx_vtabstruct_2av_9container_4core_Container {
1447 int (*err_check)(struct __pyx_obj_2av_9container_4core_Container *, int);
1448 PyObject *(*set_timeout)(struct __pyx_obj_2av_9container_4core_Container *, PyObject *);
1449 PyObject *(*start_timeout)(struct __pyx_obj_2av_9container_4core_Container *);
1450 };
1451 static struct __pyx_vtabstruct_2av_9container_4core_Container *__pyx_vtabptr_2av_9container_4core_Container;
1452
1453
1454 /* "av/stream.pyx":54
1455 *
1456 *
1457 * cdef class Stream(object): # <<<<<<<<<<<<<<
1458 * """
1459 * A single stream of audio, video or subtitles within a :class:`.Container`.
1460 */
1461
1462 struct __pyx_vtabstruct_2av_6stream_Stream {
1463 PyObject *(*_init)(struct __pyx_obj_2av_6stream_Stream *, struct __pyx_obj_2av_9container_4core_Container *, struct AVStream *);
1464 PyObject *(*_finalize_for_output)(struct __pyx_obj_2av_6stream_Stream *);
1465 };
1466 static struct __pyx_vtabstruct_2av_6stream_Stream *__pyx_vtabptr_2av_6stream_Stream;
1467
1468 /* --- Runtime support code (head) --- */
1469 /* Refnanny.proto */
1470 #ifndef CYTHON_REFNANNY
1471 #define CYTHON_REFNANNY 0
1472 #endif
1473 #if CYTHON_REFNANNY
1474 typedef struct {
1475 void (*INCREF)(void*, PyObject*, int);
1476 void (*DECREF)(void*, PyObject*, int);
1477 void (*GOTREF)(void*, PyObject*, int);
1478 void (*GIVEREF)(void*, PyObject*, int);
1479 void* (*SetupContext)(const char*, int, const char*);
1480 void (*FinishContext)(void**);
1481 } __Pyx_RefNannyAPIStruct;
1482 static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
1483 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
1484 #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
1485 #ifdef WITH_THREAD
1486 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1487 if (acquire_gil) {\
1488 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1489 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1490 PyGILState_Release(__pyx_gilstate_save);\
1491 } else {\
1492 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1493 }
1494 #else
1495 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1496 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
1497 #endif
1498 #define __Pyx_RefNannyFinishContext()\
1499 __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
1500 #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1501 #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1502 #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1503 #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1504 #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
1505 #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
1506 #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
1507 #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
1508 #else
1509 #define __Pyx_RefNannyDeclarations
1510 #define __Pyx_RefNannySetupContext(name, acquire_gil)
1511 #define __Pyx_RefNannyFinishContext()
1512 #define __Pyx_INCREF(r) Py_INCREF(r)
1513 #define __Pyx_DECREF(r) Py_DECREF(r)
1514 #define __Pyx_GOTREF(r)
1515 #define __Pyx_GIVEREF(r)
1516 #define __Pyx_XINCREF(r) Py_XINCREF(r)
1517 #define __Pyx_XDECREF(r) Py_XDECREF(r)
1518 #define __Pyx_XGOTREF(r)
1519 #define __Pyx_XGIVEREF(r)
1520 #endif
1521 #define __Pyx_XDECREF_SET(r, v) do {\
1522 PyObject *tmp = (PyObject *) r;\
1523 r = v; __Pyx_XDECREF(tmp);\
1524 } while (0)
1525 #define __Pyx_DECREF_SET(r, v) do {\
1526 PyObject *tmp = (PyObject *) r;\
1527 r = v; __Pyx_DECREF(tmp);\
1528 } while (0)
1529 #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
1530 #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
1531
1532 /* PyObjectGetAttrStr.proto */
1533 #if CYTHON_USE_TYPE_SLOTS
1534 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name);
1535 #else
1536 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1537 #endif
1538
1539 /* GetBuiltinName.proto */
1540 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
1541
1542 /* Import.proto */
1543 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
1544
1545 /* ImportFrom.proto */
1546 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);
1547
1548 /* PyFunctionFastCall.proto */
1549 #if CYTHON_FAST_PYCALL
1550 #define __Pyx_PyFunction_FastCall(func, args, nargs)\
1551 __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
1552 #if 1 || PY_VERSION_HEX < 0x030600B1
1553 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs);
1554 #else
1555 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
1556 #endif
1557 #define __Pyx_BUILD_ASSERT_EXPR(cond)\
1558 (sizeof(char [1 - 2*!(cond)]) - 1)
1559 #ifndef Py_MEMBER_SIZE
1560 #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member)
1561 #endif
1562 static size_t __pyx_pyframe_localsplus_offset = 0;
1563 #include "frameobject.h"
1564 #define __Pxy_PyFrame_Initialize_Offsets()\
1565 ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\
1566 (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus)))
1567 #define __Pyx_PyFrame_GetLocalsplus(frame)\
1568 (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset))
1569 #endif
1570
1571 /* PyCFunctionFastCall.proto */
1572 #if CYTHON_FAST_PYCCALL
1573 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
1574 #else
1575 #define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL)
1576 #endif
1577
1578 /* PyObjectCall.proto */
1579 #if CYTHON_COMPILING_IN_CPYTHON
1580 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1581 #else
1582 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1583 #endif
1584
1585 /* ExtTypeTest.proto */
1586 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
1587
1588 /* RaiseDoubleKeywords.proto */
1589 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
1590
1591 /* ParseKeywords.proto */
1592 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
1593 PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
1594 const char* function_name);
1595
1596 /* RaiseArgTupleInvalid.proto */
1597 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
1598 Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
1599
1600 /* PyThreadStateGet.proto */
1601 #if CYTHON_FAST_THREAD_STATE
1602 #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
1603 #define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current;
1604 #define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type
1605 #else
1606 #define __Pyx_PyThreadState_declare
1607 #define __Pyx_PyThreadState_assign
1608 #define __Pyx_PyErr_Occurred() PyErr_Occurred()
1609 #endif
1610
1611 /* PyErrFetchRestore.proto */
1612 #if CYTHON_FAST_THREAD_STATE
1613 #define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL)
1614 #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1615 #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1616 #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1617 #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1618 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1619 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1620 #if CYTHON_COMPILING_IN_CPYTHON
1621 #define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL))
1622 #else
1623 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1624 #endif
1625 #else
1626 #define __Pyx_PyErr_Clear() PyErr_Clear()
1627 #define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc)
1628 #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
1629 #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
1630 #define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb)
1631 #define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb)
1632 #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
1633 #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
1634 #endif
1635
1636 /* RaiseException.proto */
1637 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1638
1639 /* PyObjectCallMethO.proto */
1640 #if CYTHON_COMPILING_IN_CPYTHON
1641 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1642 #endif
1643
1644 /* PyObjectCallOneArg.proto */
1645 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
1646
1647 /* GetAttr.proto */
1648 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *);
1649
1650 /* GetTopmostException.proto */
1651 #if CYTHON_USE_EXC_INFO_STACK
1652 static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate);
1653 #endif
1654
1655 /* SaveResetException.proto */
1656 #if CYTHON_FAST_THREAD_STATE
1657 #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
1658 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1659 #define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
1660 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1661 #else
1662 #define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb)
1663 #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb)
1664 #endif
1665
1666 /* PyErrExceptionMatches.proto */
1667 #if CYTHON_FAST_THREAD_STATE
1668 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
1669 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
1670 #else
1671 #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
1672 #endif
1673
1674 /* GetException.proto */
1675 #if CYTHON_FAST_THREAD_STATE
1676 #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb)
1677 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1678 #else
1679 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
1680 #endif
1681
1682 /* IterFinish.proto */
1683 static CYTHON_INLINE int __Pyx_IterFinish(void);
1684
1685 /* PyObjectCallNoArg.proto */
1686 #if CYTHON_COMPILING_IN_CPYTHON
1687 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
1688 #else
1689 #define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
1690 #endif
1691
1692 /* PyObjectGetMethod.proto */
1693 static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method);
1694
1695 /* PyObjectCallMethod0.proto */
1696 static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name);
1697
1698 /* RaiseNeedMoreValuesToUnpack.proto */
1699 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
1700
1701 /* RaiseTooManyValuesToUnpack.proto */
1702 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
1703
1704 /* UnpackItemEndCheck.proto */
1705 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);
1706
1707 /* RaiseNoneIterError.proto */
1708 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
1709
1710 /* UnpackTupleError.proto */
1711 static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index);
1712
1713 /* UnpackTuple2.proto */
1714 #define __Pyx_unpack_tuple2(tuple, value1, value2, is_tuple, has_known_size, decref_tuple)\
1715 (likely(is_tuple || PyTuple_Check(tuple)) ?\
1716 (likely(has_known_size || PyTuple_GET_SIZE(tuple) == 2) ?\
1717 __Pyx_unpack_tuple2_exact(tuple, value1, value2, decref_tuple) :\
1718 (__Pyx_UnpackTupleError(tuple, 2), -1)) :\
1719 __Pyx_unpack_tuple2_generic(tuple, value1, value2, has_known_size, decref_tuple))
1720 static CYTHON_INLINE int __Pyx_unpack_tuple2_exact(
1721 PyObject* tuple, PyObject** value1, PyObject** value2, int decref_tuple);
1722 static int __Pyx_unpack_tuple2_generic(
1723 PyObject* tuple, PyObject** value1, PyObject** value2, int has_known_size, int decref_tuple);
1724
1725 /* dict_iter.proto */
1726 static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* dict, int is_dict, PyObject* method_name,
1727 Py_ssize_t* p_orig_length, int* p_is_dict);
1728 static CYTHON_INLINE int __Pyx_dict_iter_next(PyObject* dict_or_iter, Py_ssize_t orig_length, Py_ssize_t* ppos,
1729 PyObject** pkey, PyObject** pvalue, PyObject** pitem, int is_dict);
1730
1731 /* MergeKeywords.proto */
1732 static int __Pyx_MergeKeywords(PyObject *kwdict, PyObject *source_mapping);
1733
1734 /* dict_getitem_default.proto */
1735 static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value);
1736
1737 /* UnpackUnboundCMethod.proto */
1738 typedef struct {
1739 PyObject *type;
1740 PyObject **method_name;
1741 PyCFunction func;
1742 PyObject *method;
1743 int flag;
1744 } __Pyx_CachedCFunction;
1745
1746 /* CallUnboundCMethod1.proto */
1747 static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg);
1748 #if CYTHON_COMPILING_IN_CPYTHON
1749 static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg);
1750 #else
1751 #define __Pyx_CallUnboundCMethod1(cfunc, self, arg) __Pyx__CallUnboundCMethod1(cfunc, self, arg)
1752 #endif
1753
1754 /* CallUnboundCMethod2.proto */
1755 static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2);
1756 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030600B1
1757 static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2);
1758 #else
1759 #define __Pyx_CallUnboundCMethod2(cfunc, self, arg1, arg2) __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2)
1760 #endif
1761
1762 /* PyObject_GenericGetAttrNoDict.proto */
1763 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1764 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name);
1765 #else
1766 #define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr
1767 #endif
1768
1769 /* PyObject_GenericGetAttr.proto */
1770 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
1771 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name);
1772 #else
1773 #define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr
1774 #endif
1775
1776 /* SetVTable.proto */
1777 static int __Pyx_SetVtable(PyObject *dict, void *vtable);
1778
1779 /* PyObjectGetAttrStrNoError.proto */
1780 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name);
1781
1782 /* SetupReduce.proto */
1783 static int __Pyx_setup_reduce(PyObject* type_obj);
1784
1785 /* TypeImport.proto */
1786 #ifndef __PYX_HAVE_RT_ImportType_proto
1787 #define __PYX_HAVE_RT_ImportType_proto
1788 enum __Pyx_ImportType_CheckSize {
1789 __Pyx_ImportType_CheckSize_Error = 0,
1790 __Pyx_ImportType_CheckSize_Warn = 1,
1791 __Pyx_ImportType_CheckSize_Ignore = 2
1792 };
1793 static PyTypeObject *__Pyx_ImportType(PyObject* module, const char *module_name, const char *class_name, size_t size, enum __Pyx_ImportType_CheckSize check_size);
1794 #endif
1795
1796 /* GetVTable.proto */
1797 static void* __Pyx_GetVtable(PyObject *dict);
1798
1799 /* PyDictVersioning.proto */
1800 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
1801 #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1)
1802 #define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag)
1803 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\
1804 (version_var) = __PYX_GET_DICT_VERSION(dict);\
1805 (cache_var) = (value);
1806 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\
1807 static PY_UINT64_T __pyx_dict_version = 0;\
1808 static PyObject *__pyx_dict_cached_value = NULL;\
1809 if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\
1810 (VAR) = __pyx_dict_cached_value;\
1811 } else {\
1812 (VAR) = __pyx_dict_cached_value = (LOOKUP);\
1813 __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\
1814 }\
1815 }
1816 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj);
1817 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj);
1818 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version);
1819 #else
1820 #define __PYX_GET_DICT_VERSION(dict) (0)
1821 #define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)
1822 #define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP);
1823 #endif
1824
1825 /* GetModuleGlobalName.proto */
1826 #if CYTHON_USE_DICT_VERSIONS
1827 #define __Pyx_GetModuleGlobalName(var, name) {\
1828 static PY_UINT64_T __pyx_dict_version = 0;\
1829 static PyObject *__pyx_dict_cached_value = NULL;\
1830 (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\
1831 (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\
1832 __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1833 }
1834 #define __Pyx_GetModuleGlobalNameUncached(var, name) {\
1835 PY_UINT64_T __pyx_dict_version;\
1836 PyObject *__pyx_dict_cached_value;\
1837 (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\
1838 }
1839 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value);
1840 #else
1841 #define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1842 #define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name)
1843 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name);
1844 #endif
1845
1846 /* GetNameInClass.proto */
1847 #define __Pyx_GetNameInClass(var, nmspace, name) (var) = __Pyx__GetNameInClass(nmspace, name)
1848 static PyObject *__Pyx__GetNameInClass(PyObject *nmspace, PyObject *name);
1849
1850 /* PyObjectCall2Args.proto */
1851 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2);
1852
1853 /* CLineInTraceback.proto */
1854 #ifdef CYTHON_CLINE_IN_TRACEBACK
1855 #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0)
1856 #else
1857 static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line);
1858 #endif
1859
1860 /* CodeObjectCache.proto */
1861 typedef struct {
1862 PyCodeObject* code_object;
1863 int code_line;
1864 } __Pyx_CodeObjectCacheEntry;
1865 struct __Pyx_CodeObjectCache {
1866 int count;
1867 int max_count;
1868 __Pyx_CodeObjectCacheEntry* entries;
1869 };
1870 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
1871 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
1872 static PyCodeObject *__pyx_find_code_object(int code_line);
1873 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
1874
1875 /* AddTraceback.proto */
1876 static void __Pyx_AddTraceback(const char *funcname, int c_line,
1877 int py_line, const char *filename);
1878
1879 /* CIntToPy.proto */
1880 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
1881
1882 /* CIntToPy.proto */
1883 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int64_t(int64_t value);
1884
1885 /* CIntFromPy.proto */
1886 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
1887
1888 /* CIntToPy.proto */
1889 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
1890
1891 /* CIntFromPy.proto */
1892 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
1893
1894 /* FastTypeChecks.proto */
1895 #if CYTHON_COMPILING_IN_CPYTHON
1896 #define __Pyx_TypeCheck(obj, type) __Pyx_IsSubtype(Py_TYPE(obj), (PyTypeObject *)type)
1897 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b);
1898 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject *type);
1899 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *type1, PyObject *type2);
1900 #else
1901 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
1902 #define __Pyx_PyErr_GivenExceptionMatches(err, type) PyErr_GivenExceptionMatches(err, type)
1903 #define __Pyx_PyErr_GivenExceptionMatches2(err, type1, type2) (PyErr_GivenExceptionMatches(err, type1) || PyErr_GivenExceptionMatches(err, type2))
1904 #endif
1905 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
1906
1907 /* CheckBinaryVersion.proto */
1908 static int __Pyx_check_binary_version(void);
1909
1910 /* FunctionExport.proto */
1911 static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig);
1912
1913 /* FunctionImport.proto */
1914 static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig);
1915
1916 /* InitStrings.proto */
1917 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
1918
1919 static PyObject *__pyx_f_2av_6stream_6Stream__init(struct __pyx_obj_2av_6stream_Stream *__pyx_v_self, struct __pyx_obj_2av_9container_4core_Container *__pyx_v_container, struct AVStream *__pyx_v_stream); /* proto*/
1920 static PyObject *__pyx_f_2av_6stream_6Stream__finalize_for_output(struct __pyx_obj_2av_6stream_Stream *__pyx_v_self); /* proto*/
1921
1922 /* Module declarations from 'libc.stdint' */
1923
1924 /* Module declarations from 'libav' */
1925
1926 /* Module declarations from 'cpython.buffer' */
1927
1928 /* Module declarations from 'av.bytesource' */
1929 static PyTypeObject *__pyx_ptype_2av_10bytesource_ByteSource = 0;
1930
1931 /* Module declarations from 'av.codec.codec' */
1932 static PyTypeObject *__pyx_ptype_2av_5codec_5codec_Codec = 0;
1933
1934 /* Module declarations from 'av.buffer' */
1935 static PyTypeObject *__pyx_ptype_2av_6buffer_Buffer = 0;
1936
1937 /* Module declarations from 'av.packet' */
1938 static PyTypeObject *__pyx_ptype_2av_6packet_Packet = 0;
1939
1940 /* Module declarations from 'av.dictionary' */
1941 static PyTypeObject *__pyx_ptype_2av_10dictionary__Dictionary = 0;
1942 static struct __pyx_obj_2av_10dictionary__Dictionary *(*__pyx_f_2av_10dictionary_wrap_dictionary)(AVDictionary *); /*proto*/
1943
1944 /* Module declarations from 'av.sidedata.sidedata' */
1945 static PyTypeObject *__pyx_ptype_2av_8sidedata_8sidedata_SideData = 0;
1946 static PyTypeObject *__pyx_ptype_2av_8sidedata_8sidedata__SideDataContainer = 0;
1947
1948 /* Module declarations from 'av.frame' */
1949 static PyTypeObject *__pyx_ptype_2av_5frame_Frame = 0;
1950
1951 /* Module declarations from 'av.codec.context' */
1952 static PyTypeObject *__pyx_ptype_2av_5codec_7context_CodecContext = 0;
1953 static struct __pyx_obj_2av_5codec_7context_CodecContext *(*__pyx_f_2av_5codec_7context_wrap_codec_context)(struct AVCodecContext *, struct AVCodec const *, int); /*proto*/
1954
1955 /* Module declarations from 'av.container.streams' */
1956 static PyTypeObject *__pyx_ptype_2av_9container_7streams_StreamContainer = 0;
1957
1958 /* Module declarations from 'av.format' */
1959 static PyTypeObject *__pyx_ptype_2av_6format_ContainerFormat = 0;
1960
1961 /* Module declarations from 'av.container.core' */
1962 static PyTypeObject *__pyx_ptype_2av_9container_4core_Container = 0;
1963
1964 /* Module declarations from 'cpython.version' */
1965
1966 /* Module declarations from '__builtin__' */
1967
1968 /* Module declarations from 'cpython.type' */
1969 static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
1970
1971 /* Module declarations from 'libc.string' */
1972
1973 /* Module declarations from 'libc.stdio' */
1974
1975 /* Module declarations from 'cpython.object' */
1976
1977 /* Module declarations from 'cpython.ref' */
1978
1979 /* Module declarations from 'cpython.exc' */
1980
1981 /* Module declarations from 'cpython.module' */
1982
1983 /* Module declarations from 'cpython.mem' */
1984
1985 /* Module declarations from 'cpython.tuple' */
1986
1987 /* Module declarations from 'cpython.list' */
1988
1989 /* Module declarations from 'cpython.sequence' */
1990
1991 /* Module declarations from 'cpython.mapping' */
1992
1993 /* Module declarations from 'cpython.iterator' */
1994
1995 /* Module declarations from 'cpython.number' */
1996
1997 /* Module declarations from 'cpython.int' */
1998
1999 /* Module declarations from '__builtin__' */
2000
2001 /* Module declarations from 'cpython.bool' */
2002 static PyTypeObject *__pyx_ptype_7cpython_4bool_bool = 0;
2003
2004 /* Module declarations from 'cpython.long' */
2005
2006 /* Module declarations from 'cpython.float' */
2007
2008 /* Module declarations from '__builtin__' */
2009
2010 /* Module declarations from 'cpython.complex' */
2011 static PyTypeObject *__pyx_ptype_7cpython_7complex_complex = 0;
2012
2013 /* Module declarations from 'cpython.string' */
2014
2015 /* Module declarations from 'cpython.unicode' */
2016
2017 /* Module declarations from 'cpython.dict' */
2018
2019 /* Module declarations from 'cpython.instance' */
2020
2021 /* Module declarations from 'cpython.function' */
2022
2023 /* Module declarations from 'cpython.method' */
2024
2025 /* Module declarations from 'cpython.weakref' */
2026
2027 /* Module declarations from 'cpython.getargs' */
2028
2029 /* Module declarations from 'cpython.pythread' */
2030
2031 /* Module declarations from 'cpython.pystate' */
2032
2033 /* Module declarations from 'cpython.cobject' */
2034
2035 /* Module declarations from 'cpython.oldbuffer' */
2036
2037 /* Module declarations from 'cpython.set' */
2038
2039 /* Module declarations from 'cpython.bytes' */
2040
2041 /* Module declarations from 'cpython.pycapsule' */
2042
2043 /* Module declarations from 'cpython' */
2044
2045 /* Module declarations from 'av.error' */
2046 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*/
2047
2048 /* Module declarations from 'av.utils' */
2049 static PyObject *(*__pyx_f_2av_5utils_avdict_to_dict)(AVDictionary *, PyObject *, PyObject *); /*proto*/
2050 static PyObject *(*__pyx_f_2av_5utils_dict_to_avdict)(AVDictionary **, PyObject *, PyObject *, PyObject *); /*proto*/
2051 static PyObject *(*__pyx_f_2av_5utils_avrational_to_fraction)(AVRational const *); /*proto*/
2052 static PyObject *(*__pyx_f_2av_5utils_to_avrational)(PyObject *, AVRational *); /*proto*/
2053
2054 /* Module declarations from 'av.stream' */
2055 static PyTypeObject *__pyx_ptype_2av_6stream_Stream = 0;
2056 static PyObject *__pyx_v_2av_6stream__cinit_bypass_sentinel = 0;
2057 #define __Pyx_MODULE_NAME "av.stream"
2058 extern int __pyx_module_is_main_av__stream;
2059 int __pyx_module_is_main_av__stream = 0;
2060
2061 /* Implementation of 'av.stream' */
2062 static PyObject *__pyx_builtin_object;
2063 static PyObject *__pyx_builtin_RuntimeError;
2064 static PyObject *__pyx_builtin_id;
2065 static PyObject *__pyx_builtin_AttributeError;
2066 static PyObject *__pyx_builtin_TypeError;
2067 static const char __pyx_k_av[] = "av";
2068 static const char __pyx_k_id[] = "id";
2069 static const char __pyx_k_get[] = "get";
2070 static const char __pyx_k_new[] = "__new__";
2071 static const char __pyx_k_main[] = "__main__";
2072 static const char __pyx_k_name[] = "name";
2073 static const char __pyx_k_seek[] = "seek";
2074 static const char __pyx_k_test[] = "__test__";
2075 static const char __pyx_k_type[] = "type";
2076 static const char __pyx_k_class[] = "__class__";
2077 static const char __pyx_k_frame[] = "frame";
2078 static const char __pyx_k_index[] = "index";
2079 static const char __pyx_k_items[] = "items";
2080 static const char __pyx_k_Stream[] = "Stream";
2081 static const char __pyx_k_import[] = "__import__";
2082 static const char __pyx_k_method[] = "method";
2083 static const char __pyx_k_name_2[] = "__name__";
2084 static const char __pyx_k_notype[] = "<notype>";
2085 static const char __pyx_k_object[] = "object";
2086 static const char __pyx_k_offset[] = "offset";
2087 static const char __pyx_k_packet[] = "packet";
2088 static const char __pyx_k_reduce[] = "__reduce__";
2089 static const char __pyx_k_stream[] = "stream";
2090 static const char __pyx_k_nocodec[] = "<nocodec>";
2091 static const char __pyx_k_getstate[] = "__getstate__";
2092 static const char __pyx_k_language[] = "language";
2093 static const char __pyx_k_setstate[] = "__setstate__";
2094 static const char __pyx_k_TypeError[] = "TypeError";
2095 static const char __pyx_k_reduce_ex[] = "__reduce_ex__";
2096 static const char __pyx_k_DataStream[] = "DataStream";
2097 static const char __pyx_k_pyx_vtable[] = "__pyx_vtable__";
2098 static const char __pyx_k_AudioStream[] = "AudioStream";
2099 static const char __pyx_k_VideoStream[] = "VideoStream";
2100 static const char __pyx_k_deprecation[] = "deprecation";
2101 static const char __pyx_k_RuntimeError[] = "RuntimeError";
2102 static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
2103 static const char __pyx_k_AttributeError[] = "AttributeError";
2104 static const char __pyx_k_SubtitleStream[] = "SubtitleStream";
2105 static const char __pyx_k_av_data_stream[] = "av.data.stream";
2106 static const char __pyx_k_av_audio_stream[] = "av.audio.stream";
2107 static const char __pyx_k_av_video_stream[] = "av.video.stream";
2108 static const char __pyx_k_setstate_cython[] = "__setstate_cython__";
2109 static const char __pyx_k_av_s_d_s_s_at_0x_x[] = "<av.%s #%d %s/%s at 0x%x>";
2110 static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback";
2111 static const char __pyx_k_av_subtitles_stream[] = "av.subtitles.stream";
2112 static const char __pyx_k_cannot_manually_instatiate_Strea[] = "cannot manually instatiate Stream";
2113 static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __reduce__ due to non-trivial __cinit__";
2114 static PyObject *__pyx_n_s_AttributeError;
2115 static PyObject *__pyx_n_s_AudioStream;
2116 static PyObject *__pyx_n_s_DataStream;
2117 static PyObject *__pyx_n_s_RuntimeError;
2118 static PyObject *__pyx_n_s_Stream;
2119 static PyObject *__pyx_n_s_SubtitleStream;
2120 static PyObject *__pyx_n_s_TypeError;
2121 static PyObject *__pyx_n_s_VideoStream;
2122 static PyObject *__pyx_n_s_av;
2123 static PyObject *__pyx_n_s_av_audio_stream;
2124 static PyObject *__pyx_n_s_av_data_stream;
2125 static PyObject *__pyx_kp_s_av_s_d_s_s_at_0x_x;
2126 static PyObject *__pyx_n_s_av_subtitles_stream;
2127 static PyObject *__pyx_n_s_av_video_stream;
2128 static PyObject *__pyx_kp_s_cannot_manually_instatiate_Strea;
2129 static PyObject *__pyx_n_s_class;
2130 static PyObject *__pyx_n_s_cline_in_traceback;
2131 static PyObject *__pyx_n_s_deprecation;
2132 static PyObject *__pyx_n_s_frame;
2133 static PyObject *__pyx_n_s_get;
2134 static PyObject *__pyx_n_s_getstate;
2135 static PyObject *__pyx_n_s_id;
2136 static PyObject *__pyx_n_s_import;
2137 static PyObject *__pyx_n_s_index;
2138 static PyObject *__pyx_n_s_items;
2139 static PyObject *__pyx_n_s_language;
2140 static PyObject *__pyx_n_s_main;
2141 static PyObject *__pyx_n_s_method;
2142 static PyObject *__pyx_n_s_name;
2143 static PyObject *__pyx_n_s_name_2;
2144 static PyObject *__pyx_n_s_new;
2145 static PyObject *__pyx_kp_s_no_default___reduce___due_to_non;
2146 static PyObject *__pyx_kp_s_nocodec;
2147 static PyObject *__pyx_kp_s_notype;
2148 static PyObject *__pyx_n_s_object;
2149 static PyObject *__pyx_n_s_offset;
2150 static PyObject *__pyx_n_s_packet;
2151 static PyObject *__pyx_n_s_pyx_vtable;
2152 static PyObject *__pyx_n_s_reduce;
2153 static PyObject *__pyx_n_s_reduce_cython;
2154 static PyObject *__pyx_n_s_reduce_ex;
2155 static PyObject *__pyx_n_s_seek;
2156 static PyObject *__pyx_n_s_setstate;
2157 static PyObject *__pyx_n_s_setstate_cython;
2158 static PyObject *__pyx_n_s_stream;
2159 static PyObject *__pyx_n_s_test;
2160 static PyObject *__pyx_n_s_type;
2161 static int __pyx_pf_2av_6stream_6Stream___cinit__(CYTHON_UNUSED struct __pyx_obj_2av_6stream_Stream *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
2162 static PyObject *__pyx_pf_2av_6stream_6Stream_2__repr__(struct __pyx_obj_2av_6stream_Stream *__pyx_v_self); /* proto */
2163 static PyObject *__pyx_pf_2av_6stream_6Stream_4__getattr__(struct __pyx_obj_2av_6stream_Stream *__pyx_v_self, PyObject *__pyx_v_name); /* proto */
2164 static int __pyx_pf_2av_6stream_6Stream_6__setattr__(struct __pyx_obj_2av_6stream_Stream *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_value); /* proto */
2165 static PyObject *__pyx_pf_2av_6stream_6Stream_8encode(struct __pyx_obj_2av_6stream_Stream *__pyx_v_self, PyObject *__pyx_v_frame); /* proto */
2166 static PyObject *__pyx_pf_2av_6stream_6Stream_10decode(struct __pyx_obj_2av_6stream_Stream *__pyx_v_self, PyObject *__pyx_v_packet); /* proto */
2167 static PyObject *__pyx_pf_2av_6stream_6Stream_12seek(struct __pyx_obj_2av_6stream_Stream *__pyx_v_self, PyObject *__pyx_v_offset, PyObject *__pyx_v_kwargs); /* proto */
2168 static PyObject *__pyx_pf_2av_6stream_6Stream_2id___get__(struct __pyx_obj_2av_6stream_Stream *__pyx_v_self); /* proto */
2169 static int __pyx_pf_2av_6stream_6Stream_2id_2__set__(struct __pyx_obj_2av_6stream_Stream *__pyx_v_self, PyObject *__pyx_v_v); /* proto */
2170 static PyObject *__pyx_pf_2av_6stream_6Stream_7profile___get__(struct __pyx_obj_2av_6stream_Stream *__pyx_v_self); /* proto */
2171 static PyObject *__pyx_pf_2av_6stream_6Stream_5index___get__(struct __pyx_obj_2av_6stream_Stream *__pyx_v_self); /* proto */
2172 static PyObject *__pyx_pf_2av_6stream_6Stream_9time_base___get__(struct __pyx_obj_2av_6stream_Stream *__pyx_v_self); /* proto */
2173 static int __pyx_pf_2av_6stream_6Stream_9time_base_2__set__(struct __pyx_obj_2av_6stream_Stream *__pyx_v_self, PyObject *__pyx_v_value); /* proto */
2174 static PyObject *__pyx_pf_2av_6stream_6Stream_12average_rate___get__(struct __pyx_obj_2av_6stream_Stream *__pyx_v_self); /* proto */
2175 static PyObject *__pyx_pf_2av_6stream_6Stream_9base_rate___get__(struct __pyx_obj_2av_6stream_Stream *__pyx_v_self); /* proto */
2176 static PyObject *__pyx_pf_2av_6stream_6Stream_12guessed_rate___get__(struct __pyx_obj_2av_6stream_Stream *__pyx_v_self); /* proto */
2177 static PyObject *__pyx_pf_2av_6stream_6Stream_10start_time___get__(struct __pyx_obj_2av_6stream_Stream *__pyx_v_self); /* proto */
2178 static PyObject *__pyx_pf_2av_6stream_6Stream_8duration___get__(struct __pyx_obj_2av_6stream_Stream *__pyx_v_self); /* proto */
2179 static PyObject *__pyx_pf_2av_6stream_6Stream_6frames___get__(struct __pyx_obj_2av_6stream_Stream *__pyx_v_self); /* proto */
2180 static PyObject *__pyx_pf_2av_6stream_6Stream_8language___get__(struct __pyx_obj_2av_6stream_Stream *__pyx_v_self); /* proto */
2181 static PyObject *__pyx_pf_2av_6stream_6Stream_4type___get__(struct __pyx_obj_2av_6stream_Stream *__pyx_v_self); /* proto */
2182 static PyObject *__pyx_pf_2av_6stream_6Stream_9container___get__(struct __pyx_obj_2av_6stream_Stream *__pyx_v_self); /* proto */
2183 static PyObject *__pyx_pf_2av_6stream_6Stream_8metadata___get__(struct __pyx_obj_2av_6stream_Stream *__pyx_v_self); /* proto */
2184 static PyObject *__pyx_pf_2av_6stream_6Stream_13codec_context___get__(struct __pyx_obj_2av_6stream_Stream *__pyx_v_self); /* proto */
2185 static PyObject *__pyx_pf_2av_6stream_6Stream_14__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_2av_6stream_Stream *__pyx_v_self); /* proto */
2186 static PyObject *__pyx_pf_2av_6stream_6Stream_16__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_2av_6stream_Stream *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */
2187 static PyObject *__pyx_tp_new_2av_6stream_Stream(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
2188 static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_get = {0, &__pyx_n_s_get, 0, 0, 0};
2189 static PyObject *__pyx_tuple_;
2190 static PyObject *__pyx_tuple__2;
2191 static PyObject *__pyx_tuple__3;
2192 /* Late includes */
2193
2194 /* "av/stream.pyx":22
2195 *
2196 *
2197 * cdef Stream wrap_stream(Container container, lib.AVStream *c_stream): # <<<<<<<<<<<<<<
2198 * """Build an av.Stream for an existing AVStream.
2199 *
2200 */
2201
__pyx_f_2av_6stream_wrap_stream(struct __pyx_obj_2av_9container_4core_Container * __pyx_v_container,struct AVStream * __pyx_v_c_stream)2202 static struct __pyx_obj_2av_6stream_Stream *__pyx_f_2av_6stream_wrap_stream(struct __pyx_obj_2av_9container_4core_Container *__pyx_v_container, struct AVStream *__pyx_v_c_stream) {
2203 struct __pyx_obj_2av_6stream_Stream *__pyx_v_py_stream = 0;
2204 PyObject *__pyx_v_VideoStream = NULL;
2205 PyObject *__pyx_v_AudioStream = NULL;
2206 PyObject *__pyx_v_SubtitleStream = NULL;
2207 PyObject *__pyx_v_DataStream = NULL;
2208 struct __pyx_obj_2av_6stream_Stream *__pyx_r = NULL;
2209 __Pyx_RefNannyDeclarations
2210 PyObject *__pyx_t_1 = NULL;
2211 PyObject *__pyx_t_2 = NULL;
2212 PyObject *__pyx_t_3 = NULL;
2213 int __pyx_t_4;
2214 PyObject *__pyx_t_5 = NULL;
2215 int __pyx_lineno = 0;
2216 const char *__pyx_filename = NULL;
2217 int __pyx_clineno = 0;
2218 __Pyx_RefNannySetupContext("wrap_stream", 0);
2219
2220 /* "av/stream.pyx":31
2221 *
2222 * # This better be the right one...
2223 * assert container.ptr.streams[c_stream.index] == c_stream # <<<<<<<<<<<<<<
2224 *
2225 * cdef Stream py_stream
2226 */
2227 #ifndef CYTHON_WITHOUT_ASSERTIONS
2228 if (unlikely(!Py_OptimizeFlag)) {
2229 if (unlikely(!(((__pyx_v_container->ptr->streams[__pyx_v_c_stream->index]) == __pyx_v_c_stream) != 0))) {
2230 PyErr_SetNone(PyExc_AssertionError);
2231 __PYX_ERR(0, 31, __pyx_L1_error)
2232 }
2233 }
2234 #endif
2235
2236 /* "av/stream.pyx":35
2237 * cdef Stream py_stream
2238 *
2239 * if c_stream.codec.codec_type == lib.AVMEDIA_TYPE_VIDEO: # <<<<<<<<<<<<<<
2240 * from av.video.stream import VideoStream
2241 * py_stream = VideoStream.__new__(VideoStream, _cinit_bypass_sentinel)
2242 */
2243 switch (__pyx_v_c_stream->codec->codec_type) {
2244 case AVMEDIA_TYPE_VIDEO:
2245
2246 /* "av/stream.pyx":36
2247 *
2248 * if c_stream.codec.codec_type == lib.AVMEDIA_TYPE_VIDEO:
2249 * from av.video.stream import VideoStream # <<<<<<<<<<<<<<
2250 * py_stream = VideoStream.__new__(VideoStream, _cinit_bypass_sentinel)
2251 * elif c_stream.codec.codec_type == lib.AVMEDIA_TYPE_AUDIO:
2252 */
2253 __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 36, __pyx_L1_error)
2254 __Pyx_GOTREF(__pyx_t_1);
2255 __Pyx_INCREF(__pyx_n_s_VideoStream);
2256 __Pyx_GIVEREF(__pyx_n_s_VideoStream);
2257 PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_VideoStream);
2258 __pyx_t_2 = __Pyx_Import(__pyx_n_s_av_video_stream, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 36, __pyx_L1_error)
2259 __Pyx_GOTREF(__pyx_t_2);
2260 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2261 __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_VideoStream); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 36, __pyx_L1_error)
2262 __Pyx_GOTREF(__pyx_t_1);
2263 __Pyx_INCREF(__pyx_t_1);
2264 __pyx_v_VideoStream = __pyx_t_1;
2265 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2266 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2267
2268 /* "av/stream.pyx":37
2269 * if c_stream.codec.codec_type == lib.AVMEDIA_TYPE_VIDEO:
2270 * from av.video.stream import VideoStream
2271 * py_stream = VideoStream.__new__(VideoStream, _cinit_bypass_sentinel) # <<<<<<<<<<<<<<
2272 * elif c_stream.codec.codec_type == lib.AVMEDIA_TYPE_AUDIO:
2273 * from av.audio.stream import AudioStream
2274 */
2275 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_VideoStream, __pyx_n_s_new); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 37, __pyx_L1_error)
2276 __Pyx_GOTREF(__pyx_t_1);
2277 __pyx_t_3 = NULL;
2278 __pyx_t_4 = 0;
2279 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
2280 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
2281 if (likely(__pyx_t_3)) {
2282 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
2283 __Pyx_INCREF(__pyx_t_3);
2284 __Pyx_INCREF(function);
2285 __Pyx_DECREF_SET(__pyx_t_1, function);
2286 __pyx_t_4 = 1;
2287 }
2288 }
2289 #if CYTHON_FAST_PYCALL
2290 if (PyFunction_Check(__pyx_t_1)) {
2291 PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_VideoStream, __pyx_v_2av_6stream__cinit_bypass_sentinel};
2292 __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 37, __pyx_L1_error)
2293 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
2294 __Pyx_GOTREF(__pyx_t_2);
2295 } else
2296 #endif
2297 #if CYTHON_FAST_PYCCALL
2298 if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
2299 PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_VideoStream, __pyx_v_2av_6stream__cinit_bypass_sentinel};
2300 __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 37, __pyx_L1_error)
2301 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
2302 __Pyx_GOTREF(__pyx_t_2);
2303 } else
2304 #endif
2305 {
2306 __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 37, __pyx_L1_error)
2307 __Pyx_GOTREF(__pyx_t_5);
2308 if (__pyx_t_3) {
2309 __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
2310 }
2311 __Pyx_INCREF(__pyx_v_VideoStream);
2312 __Pyx_GIVEREF(__pyx_v_VideoStream);
2313 PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_VideoStream);
2314 __Pyx_INCREF(__pyx_v_2av_6stream__cinit_bypass_sentinel);
2315 __Pyx_GIVEREF(__pyx_v_2av_6stream__cinit_bypass_sentinel);
2316 PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_2av_6stream__cinit_bypass_sentinel);
2317 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 37, __pyx_L1_error)
2318 __Pyx_GOTREF(__pyx_t_2);
2319 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2320 }
2321 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2322 if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_2av_6stream_Stream))))) __PYX_ERR(0, 37, __pyx_L1_error)
2323 __pyx_v_py_stream = ((struct __pyx_obj_2av_6stream_Stream *)__pyx_t_2);
2324 __pyx_t_2 = 0;
2325
2326 /* "av/stream.pyx":35
2327 * cdef Stream py_stream
2328 *
2329 * if c_stream.codec.codec_type == lib.AVMEDIA_TYPE_VIDEO: # <<<<<<<<<<<<<<
2330 * from av.video.stream import VideoStream
2331 * py_stream = VideoStream.__new__(VideoStream, _cinit_bypass_sentinel)
2332 */
2333 break;
2334 case AVMEDIA_TYPE_AUDIO:
2335
2336 /* "av/stream.pyx":39
2337 * py_stream = VideoStream.__new__(VideoStream, _cinit_bypass_sentinel)
2338 * elif c_stream.codec.codec_type == lib.AVMEDIA_TYPE_AUDIO:
2339 * from av.audio.stream import AudioStream # <<<<<<<<<<<<<<
2340 * py_stream = AudioStream.__new__(AudioStream, _cinit_bypass_sentinel)
2341 * elif c_stream.codec.codec_type == lib.AVMEDIA_TYPE_SUBTITLE:
2342 */
2343 __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 39, __pyx_L1_error)
2344 __Pyx_GOTREF(__pyx_t_2);
2345 __Pyx_INCREF(__pyx_n_s_AudioStream);
2346 __Pyx_GIVEREF(__pyx_n_s_AudioStream);
2347 PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_AudioStream);
2348 __pyx_t_1 = __Pyx_Import(__pyx_n_s_av_audio_stream, __pyx_t_2, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 39, __pyx_L1_error)
2349 __Pyx_GOTREF(__pyx_t_1);
2350 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2351 __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_AudioStream); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 39, __pyx_L1_error)
2352 __Pyx_GOTREF(__pyx_t_2);
2353 __Pyx_INCREF(__pyx_t_2);
2354 __pyx_v_AudioStream = __pyx_t_2;
2355 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2356 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2357
2358 /* "av/stream.pyx":40
2359 * elif c_stream.codec.codec_type == lib.AVMEDIA_TYPE_AUDIO:
2360 * from av.audio.stream import AudioStream
2361 * py_stream = AudioStream.__new__(AudioStream, _cinit_bypass_sentinel) # <<<<<<<<<<<<<<
2362 * elif c_stream.codec.codec_type == lib.AVMEDIA_TYPE_SUBTITLE:
2363 * from av.subtitles.stream import SubtitleStream
2364 */
2365 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_AudioStream, __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 40, __pyx_L1_error)
2366 __Pyx_GOTREF(__pyx_t_2);
2367 __pyx_t_5 = NULL;
2368 __pyx_t_4 = 0;
2369 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
2370 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
2371 if (likely(__pyx_t_5)) {
2372 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
2373 __Pyx_INCREF(__pyx_t_5);
2374 __Pyx_INCREF(function);
2375 __Pyx_DECREF_SET(__pyx_t_2, function);
2376 __pyx_t_4 = 1;
2377 }
2378 }
2379 #if CYTHON_FAST_PYCALL
2380 if (PyFunction_Check(__pyx_t_2)) {
2381 PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_AudioStream, __pyx_v_2av_6stream__cinit_bypass_sentinel};
2382 __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 40, __pyx_L1_error)
2383 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
2384 __Pyx_GOTREF(__pyx_t_1);
2385 } else
2386 #endif
2387 #if CYTHON_FAST_PYCCALL
2388 if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
2389 PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_AudioStream, __pyx_v_2av_6stream__cinit_bypass_sentinel};
2390 __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 40, __pyx_L1_error)
2391 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
2392 __Pyx_GOTREF(__pyx_t_1);
2393 } else
2394 #endif
2395 {
2396 __pyx_t_3 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 40, __pyx_L1_error)
2397 __Pyx_GOTREF(__pyx_t_3);
2398 if (__pyx_t_5) {
2399 __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __pyx_t_5 = NULL;
2400 }
2401 __Pyx_INCREF(__pyx_v_AudioStream);
2402 __Pyx_GIVEREF(__pyx_v_AudioStream);
2403 PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_4, __pyx_v_AudioStream);
2404 __Pyx_INCREF(__pyx_v_2av_6stream__cinit_bypass_sentinel);
2405 __Pyx_GIVEREF(__pyx_v_2av_6stream__cinit_bypass_sentinel);
2406 PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_4, __pyx_v_2av_6stream__cinit_bypass_sentinel);
2407 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 40, __pyx_L1_error)
2408 __Pyx_GOTREF(__pyx_t_1);
2409 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2410 }
2411 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2412 if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_2av_6stream_Stream))))) __PYX_ERR(0, 40, __pyx_L1_error)
2413 __pyx_v_py_stream = ((struct __pyx_obj_2av_6stream_Stream *)__pyx_t_1);
2414 __pyx_t_1 = 0;
2415
2416 /* "av/stream.pyx":38
2417 * from av.video.stream import VideoStream
2418 * py_stream = VideoStream.__new__(VideoStream, _cinit_bypass_sentinel)
2419 * elif c_stream.codec.codec_type == lib.AVMEDIA_TYPE_AUDIO: # <<<<<<<<<<<<<<
2420 * from av.audio.stream import AudioStream
2421 * py_stream = AudioStream.__new__(AudioStream, _cinit_bypass_sentinel)
2422 */
2423 break;
2424 case AVMEDIA_TYPE_SUBTITLE:
2425
2426 /* "av/stream.pyx":42
2427 * py_stream = AudioStream.__new__(AudioStream, _cinit_bypass_sentinel)
2428 * elif c_stream.codec.codec_type == lib.AVMEDIA_TYPE_SUBTITLE:
2429 * from av.subtitles.stream import SubtitleStream # <<<<<<<<<<<<<<
2430 * py_stream = SubtitleStream.__new__(SubtitleStream, _cinit_bypass_sentinel)
2431 * elif c_stream.codec.codec_type == lib.AVMEDIA_TYPE_DATA:
2432 */
2433 __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 42, __pyx_L1_error)
2434 __Pyx_GOTREF(__pyx_t_1);
2435 __Pyx_INCREF(__pyx_n_s_SubtitleStream);
2436 __Pyx_GIVEREF(__pyx_n_s_SubtitleStream);
2437 PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_SubtitleStream);
2438 __pyx_t_2 = __Pyx_Import(__pyx_n_s_av_subtitles_stream, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 42, __pyx_L1_error)
2439 __Pyx_GOTREF(__pyx_t_2);
2440 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2441 __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_SubtitleStream); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 42, __pyx_L1_error)
2442 __Pyx_GOTREF(__pyx_t_1);
2443 __Pyx_INCREF(__pyx_t_1);
2444 __pyx_v_SubtitleStream = __pyx_t_1;
2445 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2446 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2447
2448 /* "av/stream.pyx":43
2449 * elif c_stream.codec.codec_type == lib.AVMEDIA_TYPE_SUBTITLE:
2450 * from av.subtitles.stream import SubtitleStream
2451 * py_stream = SubtitleStream.__new__(SubtitleStream, _cinit_bypass_sentinel) # <<<<<<<<<<<<<<
2452 * elif c_stream.codec.codec_type == lib.AVMEDIA_TYPE_DATA:
2453 * from av.data.stream import DataStream
2454 */
2455 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_SubtitleStream, __pyx_n_s_new); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 43, __pyx_L1_error)
2456 __Pyx_GOTREF(__pyx_t_1);
2457 __pyx_t_3 = NULL;
2458 __pyx_t_4 = 0;
2459 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
2460 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1);
2461 if (likely(__pyx_t_3)) {
2462 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
2463 __Pyx_INCREF(__pyx_t_3);
2464 __Pyx_INCREF(function);
2465 __Pyx_DECREF_SET(__pyx_t_1, function);
2466 __pyx_t_4 = 1;
2467 }
2468 }
2469 #if CYTHON_FAST_PYCALL
2470 if (PyFunction_Check(__pyx_t_1)) {
2471 PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_SubtitleStream, __pyx_v_2av_6stream__cinit_bypass_sentinel};
2472 __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 43, __pyx_L1_error)
2473 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
2474 __Pyx_GOTREF(__pyx_t_2);
2475 } else
2476 #endif
2477 #if CYTHON_FAST_PYCCALL
2478 if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
2479 PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_SubtitleStream, __pyx_v_2av_6stream__cinit_bypass_sentinel};
2480 __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 43, __pyx_L1_error)
2481 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
2482 __Pyx_GOTREF(__pyx_t_2);
2483 } else
2484 #endif
2485 {
2486 __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 43, __pyx_L1_error)
2487 __Pyx_GOTREF(__pyx_t_5);
2488 if (__pyx_t_3) {
2489 __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
2490 }
2491 __Pyx_INCREF(__pyx_v_SubtitleStream);
2492 __Pyx_GIVEREF(__pyx_v_SubtitleStream);
2493 PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_SubtitleStream);
2494 __Pyx_INCREF(__pyx_v_2av_6stream__cinit_bypass_sentinel);
2495 __Pyx_GIVEREF(__pyx_v_2av_6stream__cinit_bypass_sentinel);
2496 PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_2av_6stream__cinit_bypass_sentinel);
2497 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 43, __pyx_L1_error)
2498 __Pyx_GOTREF(__pyx_t_2);
2499 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2500 }
2501 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2502 if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_2av_6stream_Stream))))) __PYX_ERR(0, 43, __pyx_L1_error)
2503 __pyx_v_py_stream = ((struct __pyx_obj_2av_6stream_Stream *)__pyx_t_2);
2504 __pyx_t_2 = 0;
2505
2506 /* "av/stream.pyx":41
2507 * from av.audio.stream import AudioStream
2508 * py_stream = AudioStream.__new__(AudioStream, _cinit_bypass_sentinel)
2509 * elif c_stream.codec.codec_type == lib.AVMEDIA_TYPE_SUBTITLE: # <<<<<<<<<<<<<<
2510 * from av.subtitles.stream import SubtitleStream
2511 * py_stream = SubtitleStream.__new__(SubtitleStream, _cinit_bypass_sentinel)
2512 */
2513 break;
2514 case AVMEDIA_TYPE_DATA:
2515
2516 /* "av/stream.pyx":45
2517 * py_stream = SubtitleStream.__new__(SubtitleStream, _cinit_bypass_sentinel)
2518 * elif c_stream.codec.codec_type == lib.AVMEDIA_TYPE_DATA:
2519 * from av.data.stream import DataStream # <<<<<<<<<<<<<<
2520 * py_stream = DataStream.__new__(DataStream, _cinit_bypass_sentinel)
2521 * else:
2522 */
2523 __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 45, __pyx_L1_error)
2524 __Pyx_GOTREF(__pyx_t_2);
2525 __Pyx_INCREF(__pyx_n_s_DataStream);
2526 __Pyx_GIVEREF(__pyx_n_s_DataStream);
2527 PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_DataStream);
2528 __pyx_t_1 = __Pyx_Import(__pyx_n_s_av_data_stream, __pyx_t_2, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __pyx_L1_error)
2529 __Pyx_GOTREF(__pyx_t_1);
2530 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2531 __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_DataStream); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 45, __pyx_L1_error)
2532 __Pyx_GOTREF(__pyx_t_2);
2533 __Pyx_INCREF(__pyx_t_2);
2534 __pyx_v_DataStream = __pyx_t_2;
2535 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2536 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2537
2538 /* "av/stream.pyx":46
2539 * elif c_stream.codec.codec_type == lib.AVMEDIA_TYPE_DATA:
2540 * from av.data.stream import DataStream
2541 * py_stream = DataStream.__new__(DataStream, _cinit_bypass_sentinel) # <<<<<<<<<<<<<<
2542 * else:
2543 * py_stream = Stream.__new__(Stream, _cinit_bypass_sentinel)
2544 */
2545 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_DataStream, __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 46, __pyx_L1_error)
2546 __Pyx_GOTREF(__pyx_t_2);
2547 __pyx_t_5 = NULL;
2548 __pyx_t_4 = 0;
2549 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) {
2550 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2);
2551 if (likely(__pyx_t_5)) {
2552 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
2553 __Pyx_INCREF(__pyx_t_5);
2554 __Pyx_INCREF(function);
2555 __Pyx_DECREF_SET(__pyx_t_2, function);
2556 __pyx_t_4 = 1;
2557 }
2558 }
2559 #if CYTHON_FAST_PYCALL
2560 if (PyFunction_Check(__pyx_t_2)) {
2561 PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_DataStream, __pyx_v_2av_6stream__cinit_bypass_sentinel};
2562 __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 46, __pyx_L1_error)
2563 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
2564 __Pyx_GOTREF(__pyx_t_1);
2565 } else
2566 #endif
2567 #if CYTHON_FAST_PYCCALL
2568 if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
2569 PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_v_DataStream, __pyx_v_2av_6stream__cinit_bypass_sentinel};
2570 __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 46, __pyx_L1_error)
2571 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
2572 __Pyx_GOTREF(__pyx_t_1);
2573 } else
2574 #endif
2575 {
2576 __pyx_t_3 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 46, __pyx_L1_error)
2577 __Pyx_GOTREF(__pyx_t_3);
2578 if (__pyx_t_5) {
2579 __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __pyx_t_5 = NULL;
2580 }
2581 __Pyx_INCREF(__pyx_v_DataStream);
2582 __Pyx_GIVEREF(__pyx_v_DataStream);
2583 PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_4, __pyx_v_DataStream);
2584 __Pyx_INCREF(__pyx_v_2av_6stream__cinit_bypass_sentinel);
2585 __Pyx_GIVEREF(__pyx_v_2av_6stream__cinit_bypass_sentinel);
2586 PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_4, __pyx_v_2av_6stream__cinit_bypass_sentinel);
2587 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 46, __pyx_L1_error)
2588 __Pyx_GOTREF(__pyx_t_1);
2589 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2590 }
2591 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2592 if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_2av_6stream_Stream))))) __PYX_ERR(0, 46, __pyx_L1_error)
2593 __pyx_v_py_stream = ((struct __pyx_obj_2av_6stream_Stream *)__pyx_t_1);
2594 __pyx_t_1 = 0;
2595
2596 /* "av/stream.pyx":44
2597 * from av.subtitles.stream import SubtitleStream
2598 * py_stream = SubtitleStream.__new__(SubtitleStream, _cinit_bypass_sentinel)
2599 * elif c_stream.codec.codec_type == lib.AVMEDIA_TYPE_DATA: # <<<<<<<<<<<<<<
2600 * from av.data.stream import DataStream
2601 * py_stream = DataStream.__new__(DataStream, _cinit_bypass_sentinel)
2602 */
2603 break;
2604 default:
2605
2606 /* "av/stream.pyx":48
2607 * py_stream = DataStream.__new__(DataStream, _cinit_bypass_sentinel)
2608 * else:
2609 * py_stream = Stream.__new__(Stream, _cinit_bypass_sentinel) # <<<<<<<<<<<<<<
2610 *
2611 * py_stream._init(container, c_stream)
2612 */
2613 __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 48, __pyx_L1_error)
2614 __Pyx_GOTREF(__pyx_t_1);
2615 __Pyx_INCREF(__pyx_v_2av_6stream__cinit_bypass_sentinel);
2616 __Pyx_GIVEREF(__pyx_v_2av_6stream__cinit_bypass_sentinel);
2617 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_2av_6stream__cinit_bypass_sentinel);
2618 __pyx_t_2 = ((PyObject *)__pyx_tp_new_2av_6stream_Stream(((PyTypeObject *)__pyx_ptype_2av_6stream_Stream), __pyx_t_1, NULL)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 48, __pyx_L1_error)
2619 __Pyx_GOTREF(((PyObject *)__pyx_t_2));
2620 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2621 __pyx_v_py_stream = ((struct __pyx_obj_2av_6stream_Stream *)__pyx_t_2);
2622 __pyx_t_2 = 0;
2623 break;
2624 }
2625
2626 /* "av/stream.pyx":50
2627 * py_stream = Stream.__new__(Stream, _cinit_bypass_sentinel)
2628 *
2629 * py_stream._init(container, c_stream) # <<<<<<<<<<<<<<
2630 * return py_stream
2631 *
2632 */
2633 __pyx_t_2 = ((struct __pyx_vtabstruct_2av_6stream_Stream *)__pyx_v_py_stream->__pyx_vtab)->_init(__pyx_v_py_stream, __pyx_v_container, __pyx_v_c_stream); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 50, __pyx_L1_error)
2634 __Pyx_GOTREF(__pyx_t_2);
2635 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2636
2637 /* "av/stream.pyx":51
2638 *
2639 * py_stream._init(container, c_stream)
2640 * return py_stream # <<<<<<<<<<<<<<
2641 *
2642 *
2643 */
2644 __Pyx_XDECREF(((PyObject *)__pyx_r));
2645 __Pyx_INCREF(((PyObject *)__pyx_v_py_stream));
2646 __pyx_r = __pyx_v_py_stream;
2647 goto __pyx_L0;
2648
2649 /* "av/stream.pyx":22
2650 *
2651 *
2652 * cdef Stream wrap_stream(Container container, lib.AVStream *c_stream): # <<<<<<<<<<<<<<
2653 * """Build an av.Stream for an existing AVStream.
2654 *
2655 */
2656
2657 /* function exit code */
2658 __pyx_L1_error:;
2659 __Pyx_XDECREF(__pyx_t_1);
2660 __Pyx_XDECREF(__pyx_t_2);
2661 __Pyx_XDECREF(__pyx_t_3);
2662 __Pyx_XDECREF(__pyx_t_5);
2663 __Pyx_AddTraceback("av.stream.wrap_stream", __pyx_clineno, __pyx_lineno, __pyx_filename);
2664 __pyx_r = 0;
2665 __pyx_L0:;
2666 __Pyx_XDECREF((PyObject *)__pyx_v_py_stream);
2667 __Pyx_XDECREF(__pyx_v_VideoStream);
2668 __Pyx_XDECREF(__pyx_v_AudioStream);
2669 __Pyx_XDECREF(__pyx_v_SubtitleStream);
2670 __Pyx_XDECREF(__pyx_v_DataStream);
2671 __Pyx_XGIVEREF((PyObject *)__pyx_r);
2672 __Pyx_RefNannyFinishContext();
2673 return __pyx_r;
2674 }
2675
2676 /* "av/stream.pyx":71
2677 * """
2678 *
2679 * def __cinit__(self, name): # <<<<<<<<<<<<<<
2680 * if name is _cinit_bypass_sentinel:
2681 * return
2682 */
2683
2684 /* Python wrapper */
2685 static int __pyx_pw_2av_6stream_6Stream_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
__pyx_pw_2av_6stream_6Stream_1__cinit__(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)2686 static int __pyx_pw_2av_6stream_6Stream_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2687 PyObject *__pyx_v_name = 0;
2688 int __pyx_lineno = 0;
2689 const char *__pyx_filename = NULL;
2690 int __pyx_clineno = 0;
2691 int __pyx_r;
2692 __Pyx_RefNannyDeclarations
2693 __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
2694 {
2695 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,0};
2696 PyObject* values[1] = {0};
2697 if (unlikely(__pyx_kwds)) {
2698 Py_ssize_t kw_args;
2699 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2700 switch (pos_args) {
2701 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2702 CYTHON_FALLTHROUGH;
2703 case 0: break;
2704 default: goto __pyx_L5_argtuple_error;
2705 }
2706 kw_args = PyDict_Size(__pyx_kwds);
2707 switch (pos_args) {
2708 case 0:
2709 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--;
2710 else goto __pyx_L5_argtuple_error;
2711 }
2712 if (unlikely(kw_args > 0)) {
2713 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 71, __pyx_L3_error)
2714 }
2715 } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
2716 goto __pyx_L5_argtuple_error;
2717 } else {
2718 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2719 }
2720 __pyx_v_name = values[0];
2721 }
2722 goto __pyx_L4_argument_unpacking_done;
2723 __pyx_L5_argtuple_error:;
2724 __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 71, __pyx_L3_error)
2725 __pyx_L3_error:;
2726 __Pyx_AddTraceback("av.stream.Stream.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2727 __Pyx_RefNannyFinishContext();
2728 return -1;
2729 __pyx_L4_argument_unpacking_done:;
2730 __pyx_r = __pyx_pf_2av_6stream_6Stream___cinit__(((struct __pyx_obj_2av_6stream_Stream *)__pyx_v_self), __pyx_v_name);
2731
2732 /* function exit code */
2733 __Pyx_RefNannyFinishContext();
2734 return __pyx_r;
2735 }
2736
__pyx_pf_2av_6stream_6Stream___cinit__(CYTHON_UNUSED struct __pyx_obj_2av_6stream_Stream * __pyx_v_self,PyObject * __pyx_v_name)2737 static int __pyx_pf_2av_6stream_6Stream___cinit__(CYTHON_UNUSED struct __pyx_obj_2av_6stream_Stream *__pyx_v_self, PyObject *__pyx_v_name) {
2738 int __pyx_r;
2739 __Pyx_RefNannyDeclarations
2740 int __pyx_t_1;
2741 int __pyx_t_2;
2742 PyObject *__pyx_t_3 = NULL;
2743 int __pyx_lineno = 0;
2744 const char *__pyx_filename = NULL;
2745 int __pyx_clineno = 0;
2746 __Pyx_RefNannySetupContext("__cinit__", 0);
2747
2748 /* "av/stream.pyx":72
2749 *
2750 * def __cinit__(self, name):
2751 * if name is _cinit_bypass_sentinel: # <<<<<<<<<<<<<<
2752 * return
2753 * raise RuntimeError('cannot manually instatiate Stream')
2754 */
2755 __pyx_t_1 = (__pyx_v_name == __pyx_v_2av_6stream__cinit_bypass_sentinel);
2756 __pyx_t_2 = (__pyx_t_1 != 0);
2757 if (__pyx_t_2) {
2758
2759 /* "av/stream.pyx":73
2760 * def __cinit__(self, name):
2761 * if name is _cinit_bypass_sentinel:
2762 * return # <<<<<<<<<<<<<<
2763 * raise RuntimeError('cannot manually instatiate Stream')
2764 *
2765 */
2766 __pyx_r = 0;
2767 goto __pyx_L0;
2768
2769 /* "av/stream.pyx":72
2770 *
2771 * def __cinit__(self, name):
2772 * if name is _cinit_bypass_sentinel: # <<<<<<<<<<<<<<
2773 * return
2774 * raise RuntimeError('cannot manually instatiate Stream')
2775 */
2776 }
2777
2778 /* "av/stream.pyx":74
2779 * if name is _cinit_bypass_sentinel:
2780 * return
2781 * raise RuntimeError('cannot manually instatiate Stream') # <<<<<<<<<<<<<<
2782 *
2783 * cdef _init(self, Container container, lib.AVStream *stream):
2784 */
2785 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 74, __pyx_L1_error)
2786 __Pyx_GOTREF(__pyx_t_3);
2787 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
2788 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2789 __PYX_ERR(0, 74, __pyx_L1_error)
2790
2791 /* "av/stream.pyx":71
2792 * """
2793 *
2794 * def __cinit__(self, name): # <<<<<<<<<<<<<<
2795 * if name is _cinit_bypass_sentinel:
2796 * return
2797 */
2798
2799 /* function exit code */
2800 __pyx_L1_error:;
2801 __Pyx_XDECREF(__pyx_t_3);
2802 __Pyx_AddTraceback("av.stream.Stream.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2803 __pyx_r = -1;
2804 __pyx_L0:;
2805 __Pyx_RefNannyFinishContext();
2806 return __pyx_r;
2807 }
2808
2809 /* "av/stream.pyx":76
2810 * raise RuntimeError('cannot manually instatiate Stream')
2811 *
2812 * cdef _init(self, Container container, lib.AVStream *stream): # <<<<<<<<<<<<<<
2813 *
2814 * self.container = container
2815 */
2816
__pyx_f_2av_6stream_6Stream__init(struct __pyx_obj_2av_6stream_Stream * __pyx_v_self,struct __pyx_obj_2av_9container_4core_Container * __pyx_v_container,struct AVStream * __pyx_v_stream)2817 static PyObject *__pyx_f_2av_6stream_6Stream__init(struct __pyx_obj_2av_6stream_Stream *__pyx_v_self, struct __pyx_obj_2av_9container_4core_Container *__pyx_v_container, struct AVStream *__pyx_v_stream) {
2818 PyObject *__pyx_r = NULL;
2819 __Pyx_RefNannyDeclarations
2820 struct AVCodecContext *__pyx_t_1;
2821 PyObject *__pyx_t_2 = NULL;
2822 PyObject *__pyx_t_3 = NULL;
2823 PyObject *__pyx_t_4 = NULL;
2824 int __pyx_t_5;
2825 struct AVCodec *__pyx_t_6;
2826 int __pyx_t_7;
2827 int __pyx_lineno = 0;
2828 const char *__pyx_filename = NULL;
2829 int __pyx_clineno = 0;
2830 __Pyx_RefNannySetupContext("_init", 0);
2831
2832 /* "av/stream.pyx":78
2833 * cdef _init(self, Container container, lib.AVStream *stream):
2834 *
2835 * self.container = container # <<<<<<<<<<<<<<
2836 * self._stream = stream
2837 *
2838 */
2839 __Pyx_INCREF(((PyObject *)__pyx_v_container));
2840 __Pyx_GIVEREF(((PyObject *)__pyx_v_container));
2841 __Pyx_GOTREF(__pyx_v_self->container);
2842 __Pyx_DECREF(((PyObject *)__pyx_v_self->container));
2843 __pyx_v_self->container = __pyx_v_container;
2844
2845 /* "av/stream.pyx":79
2846 *
2847 * self.container = container
2848 * self._stream = stream # <<<<<<<<<<<<<<
2849 *
2850 * self._codec_context = stream.codec
2851 */
2852 __pyx_v_self->_stream = __pyx_v_stream;
2853
2854 /* "av/stream.pyx":81
2855 * self._stream = stream
2856 *
2857 * self._codec_context = stream.codec # <<<<<<<<<<<<<<
2858 *
2859 * self.metadata = avdict_to_dict(
2860 */
2861 __pyx_t_1 = __pyx_v_stream->codec;
2862 __pyx_v_self->_codec_context = __pyx_t_1;
2863
2864 /* "av/stream.pyx":85
2865 * self.metadata = avdict_to_dict(
2866 * stream.metadata,
2867 * encoding=self.container.metadata_encoding, # <<<<<<<<<<<<<<
2868 * errors=self.container.metadata_errors,
2869 * )
2870 */
2871 __pyx_t_2 = __pyx_v_self->container->metadata_encoding;
2872 __Pyx_INCREF(__pyx_t_2);
2873
2874 /* "av/stream.pyx":86
2875 * stream.metadata,
2876 * encoding=self.container.metadata_encoding,
2877 * errors=self.container.metadata_errors, # <<<<<<<<<<<<<<
2878 * )
2879 *
2880 */
2881 __pyx_t_3 = __pyx_v_self->container->metadata_errors;
2882 __Pyx_INCREF(__pyx_t_3);
2883
2884 /* "av/stream.pyx":83
2885 * self._codec_context = stream.codec
2886 *
2887 * self.metadata = avdict_to_dict( # <<<<<<<<<<<<<<
2888 * stream.metadata,
2889 * encoding=self.container.metadata_encoding,
2890 */
2891 __pyx_t_4 = __pyx_f_2av_5utils_avdict_to_dict(__pyx_v_stream->metadata, ((PyObject*)__pyx_t_2), ((PyObject*)__pyx_t_3)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 83, __pyx_L1_error)
2892 __Pyx_GOTREF(__pyx_t_4);
2893 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2894 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2895 __Pyx_GIVEREF(__pyx_t_4);
2896 __Pyx_GOTREF(__pyx_v_self->metadata);
2897 __Pyx_DECREF(__pyx_v_self->metadata);
2898 __pyx_v_self->metadata = ((PyObject*)__pyx_t_4);
2899 __pyx_t_4 = 0;
2900
2901 /* "av/stream.pyx":90
2902 *
2903 * # This is an input container!
2904 * if self.container.ptr.iformat: # <<<<<<<<<<<<<<
2905 *
2906 * # Find the codec.
2907 */
2908 __pyx_t_5 = (__pyx_v_self->container->ptr->iformat != 0);
2909 if (__pyx_t_5) {
2910
2911 /* "av/stream.pyx":93
2912 *
2913 * # Find the codec.
2914 * self._codec = lib.avcodec_find_decoder(self._codec_context.codec_id) # <<<<<<<<<<<<<<
2915 * if not self._codec:
2916 * # TODO: Setup a dummy CodecContext.
2917 */
2918 __pyx_v_self->_codec = avcodec_find_decoder(__pyx_v_self->_codec_context->codec_id);
2919
2920 /* "av/stream.pyx":94
2921 * # Find the codec.
2922 * self._codec = lib.avcodec_find_decoder(self._codec_context.codec_id)
2923 * if not self._codec: # <<<<<<<<<<<<<<
2924 * # TODO: Setup a dummy CodecContext.
2925 * self.codec_context = None
2926 */
2927 __pyx_t_5 = ((!(__pyx_v_self->_codec != 0)) != 0);
2928 if (__pyx_t_5) {
2929
2930 /* "av/stream.pyx":96
2931 * if not self._codec:
2932 * # TODO: Setup a dummy CodecContext.
2933 * self.codec_context = None # <<<<<<<<<<<<<<
2934 * return
2935 *
2936 */
2937 __Pyx_INCREF(Py_None);
2938 __Pyx_GIVEREF(Py_None);
2939 __Pyx_GOTREF(__pyx_v_self->codec_context);
2940 __Pyx_DECREF(((PyObject *)__pyx_v_self->codec_context));
2941 __pyx_v_self->codec_context = ((struct __pyx_obj_2av_5codec_7context_CodecContext *)Py_None);
2942
2943 /* "av/stream.pyx":97
2944 * # TODO: Setup a dummy CodecContext.
2945 * self.codec_context = None
2946 * return # <<<<<<<<<<<<<<
2947 *
2948 * # This is an output container!
2949 */
2950 __Pyx_XDECREF(__pyx_r);
2951 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
2952 goto __pyx_L0;
2953
2954 /* "av/stream.pyx":94
2955 * # Find the codec.
2956 * self._codec = lib.avcodec_find_decoder(self._codec_context.codec_id)
2957 * if not self._codec: # <<<<<<<<<<<<<<
2958 * # TODO: Setup a dummy CodecContext.
2959 * self.codec_context = None
2960 */
2961 }
2962
2963 /* "av/stream.pyx":90
2964 *
2965 * # This is an input container!
2966 * if self.container.ptr.iformat: # <<<<<<<<<<<<<<
2967 *
2968 * # Find the codec.
2969 */
2970 goto __pyx_L3;
2971 }
2972
2973 /* "av/stream.pyx":101
2974 * # This is an output container!
2975 * else:
2976 * self._codec = self._codec_context.codec # <<<<<<<<<<<<<<
2977 *
2978 * self.codec_context = wrap_codec_context(self._codec_context, self._codec, False)
2979 */
2980 /*else*/ {
2981 __pyx_t_6 = __pyx_v_self->_codec_context->codec;
2982 __pyx_v_self->_codec = __pyx_t_6;
2983 }
2984 __pyx_L3:;
2985
2986 /* "av/stream.pyx":103
2987 * self._codec = self._codec_context.codec
2988 *
2989 * self.codec_context = wrap_codec_context(self._codec_context, self._codec, False) # <<<<<<<<<<<<<<
2990 * self.codec_context.stream_index = stream.index
2991 *
2992 */
2993 __pyx_t_4 = ((PyObject *)__pyx_f_2av_5codec_7context_wrap_codec_context(__pyx_v_self->_codec_context, __pyx_v_self->_codec, 0)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 103, __pyx_L1_error)
2994 __Pyx_GOTREF(__pyx_t_4);
2995 __Pyx_GIVEREF(__pyx_t_4);
2996 __Pyx_GOTREF(__pyx_v_self->codec_context);
2997 __Pyx_DECREF(((PyObject *)__pyx_v_self->codec_context));
2998 __pyx_v_self->codec_context = ((struct __pyx_obj_2av_5codec_7context_CodecContext *)__pyx_t_4);
2999 __pyx_t_4 = 0;
3000
3001 /* "av/stream.pyx":104
3002 *
3003 * self.codec_context = wrap_codec_context(self._codec_context, self._codec, False)
3004 * self.codec_context.stream_index = stream.index # <<<<<<<<<<<<<<
3005 *
3006 * def __repr__(self):
3007 */
3008 __pyx_t_7 = __pyx_v_stream->index;
3009 __pyx_v_self->codec_context->stream_index = __pyx_t_7;
3010
3011 /* "av/stream.pyx":76
3012 * raise RuntimeError('cannot manually instatiate Stream')
3013 *
3014 * cdef _init(self, Container container, lib.AVStream *stream): # <<<<<<<<<<<<<<
3015 *
3016 * self.container = container
3017 */
3018
3019 /* function exit code */
3020 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3021 goto __pyx_L0;
3022 __pyx_L1_error:;
3023 __Pyx_XDECREF(__pyx_t_2);
3024 __Pyx_XDECREF(__pyx_t_3);
3025 __Pyx_XDECREF(__pyx_t_4);
3026 __Pyx_AddTraceback("av.stream.Stream._init", __pyx_clineno, __pyx_lineno, __pyx_filename);
3027 __pyx_r = 0;
3028 __pyx_L0:;
3029 __Pyx_XGIVEREF(__pyx_r);
3030 __Pyx_RefNannyFinishContext();
3031 return __pyx_r;
3032 }
3033
3034 /* "av/stream.pyx":106
3035 * self.codec_context.stream_index = stream.index
3036 *
3037 * def __repr__(self): # <<<<<<<<<<<<<<
3038 * return '<av.%s #%d %s/%s at 0x%x>' % (
3039 * self.__class__.__name__,
3040 */
3041
3042 /* Python wrapper */
3043 static PyObject *__pyx_pw_2av_6stream_6Stream_3__repr__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_2av_6stream_6Stream_3__repr__(PyObject * __pyx_v_self)3044 static PyObject *__pyx_pw_2av_6stream_6Stream_3__repr__(PyObject *__pyx_v_self) {
3045 PyObject *__pyx_r = 0;
3046 __Pyx_RefNannyDeclarations
3047 __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0);
3048 __pyx_r = __pyx_pf_2av_6stream_6Stream_2__repr__(((struct __pyx_obj_2av_6stream_Stream *)__pyx_v_self));
3049
3050 /* function exit code */
3051 __Pyx_RefNannyFinishContext();
3052 return __pyx_r;
3053 }
3054
__pyx_pf_2av_6stream_6Stream_2__repr__(struct __pyx_obj_2av_6stream_Stream * __pyx_v_self)3055 static PyObject *__pyx_pf_2av_6stream_6Stream_2__repr__(struct __pyx_obj_2av_6stream_Stream *__pyx_v_self) {
3056 PyObject *__pyx_r = NULL;
3057 __Pyx_RefNannyDeclarations
3058 PyObject *__pyx_t_1 = NULL;
3059 PyObject *__pyx_t_2 = NULL;
3060 PyObject *__pyx_t_3 = NULL;
3061 PyObject *__pyx_t_4 = NULL;
3062 int __pyx_t_5;
3063 PyObject *__pyx_t_6 = NULL;
3064 PyObject *__pyx_t_7 = NULL;
3065 int __pyx_lineno = 0;
3066 const char *__pyx_filename = NULL;
3067 int __pyx_clineno = 0;
3068 __Pyx_RefNannySetupContext("__repr__", 0);
3069
3070 /* "av/stream.pyx":107
3071 *
3072 * def __repr__(self):
3073 * return '<av.%s #%d %s/%s at 0x%x>' % ( # <<<<<<<<<<<<<<
3074 * self.__class__.__name__,
3075 * self.index,
3076 */
3077 __Pyx_XDECREF(__pyx_r);
3078
3079 /* "av/stream.pyx":108
3080 * def __repr__(self):
3081 * return '<av.%s #%d %s/%s at 0x%x>' % (
3082 * self.__class__.__name__, # <<<<<<<<<<<<<<
3083 * self.index,
3084 * self.type or '<notype>',
3085 */
3086 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_class); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 108, __pyx_L1_error)
3087 __Pyx_GOTREF(__pyx_t_1);
3088 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_name_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 108, __pyx_L1_error)
3089 __Pyx_GOTREF(__pyx_t_2);
3090 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3091
3092 /* "av/stream.pyx":109
3093 * return '<av.%s #%d %s/%s at 0x%x>' % (
3094 * self.__class__.__name__,
3095 * self.index, # <<<<<<<<<<<<<<
3096 * self.type or '<notype>',
3097 * self.name or '<nocodec>',
3098 */
3099 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 109, __pyx_L1_error)
3100 __Pyx_GOTREF(__pyx_t_1);
3101
3102 /* "av/stream.pyx":110
3103 * self.__class__.__name__,
3104 * self.index,
3105 * self.type or '<notype>', # <<<<<<<<<<<<<<
3106 * self.name or '<nocodec>',
3107 * id(self),
3108 */
3109 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_type); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 110, __pyx_L1_error)
3110 __Pyx_GOTREF(__pyx_t_4);
3111 __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 110, __pyx_L1_error)
3112 if (!__pyx_t_5) {
3113 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3114 } else {
3115 __Pyx_INCREF(__pyx_t_4);
3116 __pyx_t_3 = __pyx_t_4;
3117 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3118 goto __pyx_L3_bool_binop_done;
3119 }
3120 __Pyx_INCREF(__pyx_kp_s_notype);
3121 __pyx_t_3 = __pyx_kp_s_notype;
3122 __pyx_L3_bool_binop_done:;
3123
3124 /* "av/stream.pyx":111
3125 * self.index,
3126 * self.type or '<notype>',
3127 * self.name or '<nocodec>', # <<<<<<<<<<<<<<
3128 * id(self),
3129 * )
3130 */
3131 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_name); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 111, __pyx_L1_error)
3132 __Pyx_GOTREF(__pyx_t_6);
3133 __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 111, __pyx_L1_error)
3134 if (!__pyx_t_5) {
3135 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3136 } else {
3137 __Pyx_INCREF(__pyx_t_6);
3138 __pyx_t_4 = __pyx_t_6;
3139 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3140 goto __pyx_L5_bool_binop_done;
3141 }
3142 __Pyx_INCREF(__pyx_kp_s_nocodec);
3143 __pyx_t_4 = __pyx_kp_s_nocodec;
3144 __pyx_L5_bool_binop_done:;
3145
3146 /* "av/stream.pyx":112
3147 * self.type or '<notype>',
3148 * self.name or '<nocodec>',
3149 * id(self), # <<<<<<<<<<<<<<
3150 * )
3151 *
3152 */
3153 __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_id, ((PyObject *)__pyx_v_self)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 112, __pyx_L1_error)
3154 __Pyx_GOTREF(__pyx_t_6);
3155
3156 /* "av/stream.pyx":108
3157 * def __repr__(self):
3158 * return '<av.%s #%d %s/%s at 0x%x>' % (
3159 * self.__class__.__name__, # <<<<<<<<<<<<<<
3160 * self.index,
3161 * self.type or '<notype>',
3162 */
3163 __pyx_t_7 = PyTuple_New(5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 108, __pyx_L1_error)
3164 __Pyx_GOTREF(__pyx_t_7);
3165 __Pyx_GIVEREF(__pyx_t_2);
3166 PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2);
3167 __Pyx_GIVEREF(__pyx_t_1);
3168 PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_1);
3169 __Pyx_GIVEREF(__pyx_t_3);
3170 PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_3);
3171 __Pyx_GIVEREF(__pyx_t_4);
3172 PyTuple_SET_ITEM(__pyx_t_7, 3, __pyx_t_4);
3173 __Pyx_GIVEREF(__pyx_t_6);
3174 PyTuple_SET_ITEM(__pyx_t_7, 4, __pyx_t_6);
3175 __pyx_t_2 = 0;
3176 __pyx_t_1 = 0;
3177 __pyx_t_3 = 0;
3178 __pyx_t_4 = 0;
3179 __pyx_t_6 = 0;
3180
3181 /* "av/stream.pyx":107
3182 *
3183 * def __repr__(self):
3184 * return '<av.%s #%d %s/%s at 0x%x>' % ( # <<<<<<<<<<<<<<
3185 * self.__class__.__name__,
3186 * self.index,
3187 */
3188 __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_av_s_d_s_s_at_0x_x, __pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 107, __pyx_L1_error)
3189 __Pyx_GOTREF(__pyx_t_6);
3190 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
3191 __pyx_r = __pyx_t_6;
3192 __pyx_t_6 = 0;
3193 goto __pyx_L0;
3194
3195 /* "av/stream.pyx":106
3196 * self.codec_context.stream_index = stream.index
3197 *
3198 * def __repr__(self): # <<<<<<<<<<<<<<
3199 * return '<av.%s #%d %s/%s at 0x%x>' % (
3200 * self.__class__.__name__,
3201 */
3202
3203 /* function exit code */
3204 __pyx_L1_error:;
3205 __Pyx_XDECREF(__pyx_t_1);
3206 __Pyx_XDECREF(__pyx_t_2);
3207 __Pyx_XDECREF(__pyx_t_3);
3208 __Pyx_XDECREF(__pyx_t_4);
3209 __Pyx_XDECREF(__pyx_t_6);
3210 __Pyx_XDECREF(__pyx_t_7);
3211 __Pyx_AddTraceback("av.stream.Stream.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3212 __pyx_r = NULL;
3213 __pyx_L0:;
3214 __Pyx_XGIVEREF(__pyx_r);
3215 __Pyx_RefNannyFinishContext();
3216 return __pyx_r;
3217 }
3218
3219 /* "av/stream.pyx":115
3220 * )
3221 *
3222 * def __getattr__(self, name): # <<<<<<<<<<<<<<
3223 * # avoid an infinite loop for unsupported codecs
3224 * if self.codec_context is None:
3225 */
3226
3227 /* Python wrapper */
3228 static PyObject *__pyx_pw_2av_6stream_6Stream_5__getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_name); /*proto*/
__pyx_pw_2av_6stream_6Stream_5__getattr__(PyObject * __pyx_v_self,PyObject * __pyx_v_name)3229 static PyObject *__pyx_pw_2av_6stream_6Stream_5__getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_name) {
3230 PyObject *__pyx_r = 0;
3231 __Pyx_RefNannyDeclarations
3232 __Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0);
3233 __pyx_r = __pyx_pf_2av_6stream_6Stream_4__getattr__(((struct __pyx_obj_2av_6stream_Stream *)__pyx_v_self), ((PyObject *)__pyx_v_name));
3234
3235 /* function exit code */
3236 __Pyx_RefNannyFinishContext();
3237 return __pyx_r;
3238 }
3239
__pyx_pf_2av_6stream_6Stream_4__getattr__(struct __pyx_obj_2av_6stream_Stream * __pyx_v_self,PyObject * __pyx_v_name)3240 static PyObject *__pyx_pf_2av_6stream_6Stream_4__getattr__(struct __pyx_obj_2av_6stream_Stream *__pyx_v_self, PyObject *__pyx_v_name) {
3241 PyObject *__pyx_r = NULL;
3242 __Pyx_RefNannyDeclarations
3243 int __pyx_t_1;
3244 int __pyx_t_2;
3245 PyObject *__pyx_t_3 = NULL;
3246 PyObject *__pyx_t_4 = NULL;
3247 PyObject *__pyx_t_5 = NULL;
3248 PyObject *__pyx_t_6 = NULL;
3249 PyObject *__pyx_t_7 = NULL;
3250 int __pyx_t_8;
3251 PyObject *__pyx_t_9 = NULL;
3252 PyObject *__pyx_t_10 = NULL;
3253 PyObject *__pyx_t_11 = NULL;
3254 PyObject *__pyx_t_12 = NULL;
3255 PyObject *__pyx_t_13 = NULL;
3256 PyObject *__pyx_t_14 = NULL;
3257 PyObject *__pyx_t_15 = NULL;
3258 PyObject *__pyx_t_16 = NULL;
3259 int __pyx_lineno = 0;
3260 const char *__pyx_filename = NULL;
3261 int __pyx_clineno = 0;
3262 __Pyx_RefNannySetupContext("__getattr__", 0);
3263
3264 /* "av/stream.pyx":117
3265 * def __getattr__(self, name):
3266 * # avoid an infinite loop for unsupported codecs
3267 * if self.codec_context is None: # <<<<<<<<<<<<<<
3268 * return
3269 *
3270 */
3271 __pyx_t_1 = (((PyObject *)__pyx_v_self->codec_context) == Py_None);
3272 __pyx_t_2 = (__pyx_t_1 != 0);
3273 if (__pyx_t_2) {
3274
3275 /* "av/stream.pyx":118
3276 * # avoid an infinite loop for unsupported codecs
3277 * if self.codec_context is None:
3278 * return # <<<<<<<<<<<<<<
3279 *
3280 * try:
3281 */
3282 __Pyx_XDECREF(__pyx_r);
3283 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3284 goto __pyx_L0;
3285
3286 /* "av/stream.pyx":117
3287 * def __getattr__(self, name):
3288 * # avoid an infinite loop for unsupported codecs
3289 * if self.codec_context is None: # <<<<<<<<<<<<<<
3290 * return
3291 *
3292 */
3293 }
3294
3295 /* "av/stream.pyx":120
3296 * return
3297 *
3298 * try: # <<<<<<<<<<<<<<
3299 * return getattr(self.codec_context, name)
3300 * except AttributeError:
3301 */
3302 {
3303 __Pyx_PyThreadState_declare
3304 __Pyx_PyThreadState_assign
3305 __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5);
3306 __Pyx_XGOTREF(__pyx_t_3);
3307 __Pyx_XGOTREF(__pyx_t_4);
3308 __Pyx_XGOTREF(__pyx_t_5);
3309 /*try:*/ {
3310
3311 /* "av/stream.pyx":121
3312 *
3313 * try:
3314 * return getattr(self.codec_context, name) # <<<<<<<<<<<<<<
3315 * except AttributeError:
3316 * try:
3317 */
3318 __Pyx_XDECREF(__pyx_r);
3319 __pyx_t_6 = ((PyObject *)__pyx_v_self->codec_context);
3320 __Pyx_INCREF(__pyx_t_6);
3321 __pyx_t_7 = __Pyx_GetAttr(__pyx_t_6, __pyx_v_name); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 121, __pyx_L4_error)
3322 __Pyx_GOTREF(__pyx_t_7);
3323 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3324 __pyx_r = __pyx_t_7;
3325 __pyx_t_7 = 0;
3326 goto __pyx_L8_try_return;
3327
3328 /* "av/stream.pyx":120
3329 * return
3330 *
3331 * try: # <<<<<<<<<<<<<<
3332 * return getattr(self.codec_context, name)
3333 * except AttributeError:
3334 */
3335 }
3336 __pyx_L4_error:;
3337 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
3338 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
3339
3340 /* "av/stream.pyx":122
3341 * try:
3342 * return getattr(self.codec_context, name)
3343 * except AttributeError: # <<<<<<<<<<<<<<
3344 * try:
3345 * return getattr(self.codec_context.codec, name)
3346 */
3347 __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
3348 if (__pyx_t_8) {
3349 __Pyx_AddTraceback("av.stream.Stream.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3350 if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_6, &__pyx_t_9) < 0) __PYX_ERR(0, 122, __pyx_L6_except_error)
3351 __Pyx_GOTREF(__pyx_t_7);
3352 __Pyx_GOTREF(__pyx_t_6);
3353 __Pyx_GOTREF(__pyx_t_9);
3354
3355 /* "av/stream.pyx":123
3356 * return getattr(self.codec_context, name)
3357 * except AttributeError:
3358 * try: # <<<<<<<<<<<<<<
3359 * return getattr(self.codec_context.codec, name)
3360 * except AttributeError:
3361 */
3362 {
3363 __Pyx_PyThreadState_declare
3364 __Pyx_PyThreadState_assign
3365 __Pyx_ExceptionSave(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
3366 __Pyx_XGOTREF(__pyx_t_10);
3367 __Pyx_XGOTREF(__pyx_t_11);
3368 __Pyx_XGOTREF(__pyx_t_12);
3369 /*try:*/ {
3370
3371 /* "av/stream.pyx":124
3372 * except AttributeError:
3373 * try:
3374 * return getattr(self.codec_context.codec, name) # <<<<<<<<<<<<<<
3375 * except AttributeError:
3376 * raise AttributeError(name)
3377 */
3378 __Pyx_XDECREF(__pyx_r);
3379 __pyx_t_13 = ((PyObject *)__pyx_v_self->codec_context->codec);
3380 __Pyx_INCREF(__pyx_t_13);
3381 __pyx_t_14 = __Pyx_GetAttr(__pyx_t_13, __pyx_v_name); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 124, __pyx_L12_error)
3382 __Pyx_GOTREF(__pyx_t_14);
3383 __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
3384 __pyx_r = __pyx_t_14;
3385 __pyx_t_14 = 0;
3386 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
3387 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
3388 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
3389 goto __pyx_L16_try_return;
3390
3391 /* "av/stream.pyx":123
3392 * return getattr(self.codec_context, name)
3393 * except AttributeError:
3394 * try: # <<<<<<<<<<<<<<
3395 * return getattr(self.codec_context.codec, name)
3396 * except AttributeError:
3397 */
3398 }
3399 __pyx_L12_error:;
3400 __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0;
3401 __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0;
3402
3403 /* "av/stream.pyx":125
3404 * try:
3405 * return getattr(self.codec_context.codec, name)
3406 * except AttributeError: # <<<<<<<<<<<<<<
3407 * raise AttributeError(name)
3408 *
3409 */
3410 __pyx_t_8 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_AttributeError);
3411 if (__pyx_t_8) {
3412 __Pyx_AddTraceback("av.stream.Stream.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3413 if (__Pyx_GetException(&__pyx_t_14, &__pyx_t_13, &__pyx_t_15) < 0) __PYX_ERR(0, 125, __pyx_L14_except_error)
3414 __Pyx_GOTREF(__pyx_t_14);
3415 __Pyx_GOTREF(__pyx_t_13);
3416 __Pyx_GOTREF(__pyx_t_15);
3417
3418 /* "av/stream.pyx":126
3419 * return getattr(self.codec_context.codec, name)
3420 * except AttributeError:
3421 * raise AttributeError(name) # <<<<<<<<<<<<<<
3422 *
3423 * def __setattr__(self, name, value):
3424 */
3425 __pyx_t_16 = __Pyx_PyObject_CallOneArg(__pyx_builtin_AttributeError, __pyx_v_name); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 126, __pyx_L14_except_error)
3426 __Pyx_GOTREF(__pyx_t_16);
3427 __Pyx_Raise(__pyx_t_16, 0, 0, 0);
3428 __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
3429 __PYX_ERR(0, 126, __pyx_L14_except_error)
3430 }
3431 goto __pyx_L14_except_error;
3432 __pyx_L14_except_error:;
3433
3434 /* "av/stream.pyx":123
3435 * return getattr(self.codec_context, name)
3436 * except AttributeError:
3437 * try: # <<<<<<<<<<<<<<
3438 * return getattr(self.codec_context.codec, name)
3439 * except AttributeError:
3440 */
3441 __Pyx_XGIVEREF(__pyx_t_10);
3442 __Pyx_XGIVEREF(__pyx_t_11);
3443 __Pyx_XGIVEREF(__pyx_t_12);
3444 __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
3445 goto __pyx_L6_except_error;
3446 __pyx_L16_try_return:;
3447 __Pyx_XGIVEREF(__pyx_t_10);
3448 __Pyx_XGIVEREF(__pyx_t_11);
3449 __Pyx_XGIVEREF(__pyx_t_12);
3450 __Pyx_ExceptionReset(__pyx_t_10, __pyx_t_11, __pyx_t_12);
3451 goto __pyx_L7_except_return;
3452 }
3453 }
3454 goto __pyx_L6_except_error;
3455 __pyx_L6_except_error:;
3456
3457 /* "av/stream.pyx":120
3458 * return
3459 *
3460 * try: # <<<<<<<<<<<<<<
3461 * return getattr(self.codec_context, name)
3462 * except AttributeError:
3463 */
3464 __Pyx_XGIVEREF(__pyx_t_3);
3465 __Pyx_XGIVEREF(__pyx_t_4);
3466 __Pyx_XGIVEREF(__pyx_t_5);
3467 __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
3468 goto __pyx_L1_error;
3469 __pyx_L8_try_return:;
3470 __Pyx_XGIVEREF(__pyx_t_3);
3471 __Pyx_XGIVEREF(__pyx_t_4);
3472 __Pyx_XGIVEREF(__pyx_t_5);
3473 __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
3474 goto __pyx_L0;
3475 __pyx_L7_except_return:;
3476 __Pyx_XGIVEREF(__pyx_t_3);
3477 __Pyx_XGIVEREF(__pyx_t_4);
3478 __Pyx_XGIVEREF(__pyx_t_5);
3479 __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5);
3480 goto __pyx_L0;
3481 }
3482
3483 /* "av/stream.pyx":115
3484 * )
3485 *
3486 * def __getattr__(self, name): # <<<<<<<<<<<<<<
3487 * # avoid an infinite loop for unsupported codecs
3488 * if self.codec_context is None:
3489 */
3490
3491 /* function exit code */
3492 __pyx_L1_error:;
3493 __Pyx_XDECREF(__pyx_t_6);
3494 __Pyx_XDECREF(__pyx_t_7);
3495 __Pyx_XDECREF(__pyx_t_9);
3496 __Pyx_XDECREF(__pyx_t_13);
3497 __Pyx_XDECREF(__pyx_t_14);
3498 __Pyx_XDECREF(__pyx_t_15);
3499 __Pyx_XDECREF(__pyx_t_16);
3500 __Pyx_AddTraceback("av.stream.Stream.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3501 __pyx_r = NULL;
3502 __pyx_L0:;
3503 __Pyx_XGIVEREF(__pyx_r);
3504 __Pyx_RefNannyFinishContext();
3505 return __pyx_r;
3506 }
3507
3508 /* "av/stream.pyx":128
3509 * raise AttributeError(name)
3510 *
3511 * def __setattr__(self, name, value): # <<<<<<<<<<<<<<
3512 * setattr(self.codec_context, name, value)
3513 *
3514 */
3515
3516 /* Python wrapper */
3517 static int __pyx_pw_2av_6stream_6Stream_7__setattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_value); /*proto*/
__pyx_pw_2av_6stream_6Stream_7__setattr__(PyObject * __pyx_v_self,PyObject * __pyx_v_name,PyObject * __pyx_v_value)3518 static int __pyx_pw_2av_6stream_6Stream_7__setattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_value) {
3519 int __pyx_r;
3520 __Pyx_RefNannyDeclarations
3521 __Pyx_RefNannySetupContext("__setattr__ (wrapper)", 0);
3522 __pyx_r = __pyx_pf_2av_6stream_6Stream_6__setattr__(((struct __pyx_obj_2av_6stream_Stream *)__pyx_v_self), ((PyObject *)__pyx_v_name), ((PyObject *)__pyx_v_value));
3523
3524 /* function exit code */
3525 __Pyx_RefNannyFinishContext();
3526 return __pyx_r;
3527 }
3528
__pyx_pf_2av_6stream_6Stream_6__setattr__(struct __pyx_obj_2av_6stream_Stream * __pyx_v_self,PyObject * __pyx_v_name,PyObject * __pyx_v_value)3529 static int __pyx_pf_2av_6stream_6Stream_6__setattr__(struct __pyx_obj_2av_6stream_Stream *__pyx_v_self, PyObject *__pyx_v_name, PyObject *__pyx_v_value) {
3530 int __pyx_r;
3531 __Pyx_RefNannyDeclarations
3532 PyObject *__pyx_t_1 = NULL;
3533 int __pyx_t_2;
3534 int __pyx_lineno = 0;
3535 const char *__pyx_filename = NULL;
3536 int __pyx_clineno = 0;
3537 __Pyx_RefNannySetupContext("__setattr__", 0);
3538
3539 /* "av/stream.pyx":129
3540 *
3541 * def __setattr__(self, name, value):
3542 * setattr(self.codec_context, name, value) # <<<<<<<<<<<<<<
3543 *
3544 * cdef _finalize_for_output(self):
3545 */
3546 __pyx_t_1 = ((PyObject *)__pyx_v_self->codec_context);
3547 __Pyx_INCREF(__pyx_t_1);
3548 __pyx_t_2 = PyObject_SetAttr(__pyx_t_1, __pyx_v_name, __pyx_v_value); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 129, __pyx_L1_error)
3549 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3550
3551 /* "av/stream.pyx":128
3552 * raise AttributeError(name)
3553 *
3554 * def __setattr__(self, name, value): # <<<<<<<<<<<<<<
3555 * setattr(self.codec_context, name, value)
3556 *
3557 */
3558
3559 /* function exit code */
3560 __pyx_r = 0;
3561 goto __pyx_L0;
3562 __pyx_L1_error:;
3563 __Pyx_XDECREF(__pyx_t_1);
3564 __Pyx_AddTraceback("av.stream.Stream.__setattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
3565 __pyx_r = -1;
3566 __pyx_L0:;
3567 __Pyx_RefNannyFinishContext();
3568 return __pyx_r;
3569 }
3570
3571 /* "av/stream.pyx":131
3572 * setattr(self.codec_context, name, value)
3573 *
3574 * cdef _finalize_for_output(self): # <<<<<<<<<<<<<<
3575 *
3576 * dict_to_avdict(
3577 */
3578
__pyx_f_2av_6stream_6Stream__finalize_for_output(struct __pyx_obj_2av_6stream_Stream * __pyx_v_self)3579 static PyObject *__pyx_f_2av_6stream_6Stream__finalize_for_output(struct __pyx_obj_2av_6stream_Stream *__pyx_v_self) {
3580 PyObject *__pyx_r = NULL;
3581 __Pyx_RefNannyDeclarations
3582 PyObject *__pyx_t_1 = NULL;
3583 PyObject *__pyx_t_2 = NULL;
3584 PyObject *__pyx_t_3 = NULL;
3585 PyObject *__pyx_t_4 = NULL;
3586 int __pyx_t_5;
3587 AVRational __pyx_t_6;
3588 int __pyx_t_7;
3589 int __pyx_lineno = 0;
3590 const char *__pyx_filename = NULL;
3591 int __pyx_clineno = 0;
3592 __Pyx_RefNannySetupContext("_finalize_for_output", 0);
3593
3594 /* "av/stream.pyx":134
3595 *
3596 * dict_to_avdict(
3597 * &self._stream.metadata, self.metadata, # <<<<<<<<<<<<<<
3598 * encoding=self.container.metadata_encoding,
3599 * errors=self.container.metadata_errors,
3600 */
3601 __pyx_t_1 = __pyx_v_self->metadata;
3602 __Pyx_INCREF(__pyx_t_1);
3603
3604 /* "av/stream.pyx":135
3605 * dict_to_avdict(
3606 * &self._stream.metadata, self.metadata,
3607 * encoding=self.container.metadata_encoding, # <<<<<<<<<<<<<<
3608 * errors=self.container.metadata_errors,
3609 * )
3610 */
3611 __pyx_t_2 = __pyx_v_self->container->metadata_encoding;
3612 __Pyx_INCREF(__pyx_t_2);
3613
3614 /* "av/stream.pyx":136
3615 * &self._stream.metadata, self.metadata,
3616 * encoding=self.container.metadata_encoding,
3617 * errors=self.container.metadata_errors, # <<<<<<<<<<<<<<
3618 * )
3619 *
3620 */
3621 __pyx_t_3 = __pyx_v_self->container->metadata_errors;
3622 __Pyx_INCREF(__pyx_t_3);
3623
3624 /* "av/stream.pyx":133
3625 * cdef _finalize_for_output(self):
3626 *
3627 * dict_to_avdict( # <<<<<<<<<<<<<<
3628 * &self._stream.metadata, self.metadata,
3629 * encoding=self.container.metadata_encoding,
3630 */
3631 __pyx_t_4 = __pyx_f_2av_5utils_dict_to_avdict((&__pyx_v_self->_stream->metadata), ((PyObject*)__pyx_t_1), ((PyObject*)__pyx_t_2), ((PyObject*)__pyx_t_3)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 133, __pyx_L1_error)
3632 __Pyx_GOTREF(__pyx_t_4);
3633 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3634 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3635 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3636 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3637
3638 /* "av/stream.pyx":139
3639 * )
3640 *
3641 * if not self._stream.time_base.num: # <<<<<<<<<<<<<<
3642 * self._stream.time_base = self._codec_context.time_base
3643 *
3644 */
3645 __pyx_t_5 = ((!(__pyx_v_self->_stream->time_base.num != 0)) != 0);
3646 if (__pyx_t_5) {
3647
3648 /* "av/stream.pyx":140
3649 *
3650 * if not self._stream.time_base.num:
3651 * self._stream.time_base = self._codec_context.time_base # <<<<<<<<<<<<<<
3652 *
3653 * # It prefers if we pass it parameters via this other object.
3654 */
3655 __pyx_t_6 = __pyx_v_self->_codec_context->time_base;
3656 __pyx_v_self->_stream->time_base = __pyx_t_6;
3657
3658 /* "av/stream.pyx":139
3659 * )
3660 *
3661 * if not self._stream.time_base.num: # <<<<<<<<<<<<<<
3662 * self._stream.time_base = self._codec_context.time_base
3663 *
3664 */
3665 }
3666
3667 /* "av/stream.pyx":144
3668 * # It prefers if we pass it parameters via this other object.
3669 * # Lets just copy what we want.
3670 * err_check(lib.avcodec_parameters_from_context(self._stream.codecpar, self._stream.codec)) # <<<<<<<<<<<<<<
3671 *
3672 * def encode(self, frame=None):
3673 */
3674 __pyx_t_7 = __pyx_f_2av_5error_err_check(avcodec_parameters_from_context(__pyx_v_self->_stream->codecpar, __pyx_v_self->_stream->codec), 0, NULL); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 144, __pyx_L1_error)
3675
3676 /* "av/stream.pyx":131
3677 * setattr(self.codec_context, name, value)
3678 *
3679 * cdef _finalize_for_output(self): # <<<<<<<<<<<<<<
3680 *
3681 * dict_to_avdict(
3682 */
3683
3684 /* function exit code */
3685 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
3686 goto __pyx_L0;
3687 __pyx_L1_error:;
3688 __Pyx_XDECREF(__pyx_t_1);
3689 __Pyx_XDECREF(__pyx_t_2);
3690 __Pyx_XDECREF(__pyx_t_3);
3691 __Pyx_XDECREF(__pyx_t_4);
3692 __Pyx_AddTraceback("av.stream.Stream._finalize_for_output", __pyx_clineno, __pyx_lineno, __pyx_filename);
3693 __pyx_r = 0;
3694 __pyx_L0:;
3695 __Pyx_XGIVEREF(__pyx_r);
3696 __Pyx_RefNannyFinishContext();
3697 return __pyx_r;
3698 }
3699
3700 /* "av/stream.pyx":146
3701 * err_check(lib.avcodec_parameters_from_context(self._stream.codecpar, self._stream.codec))
3702 *
3703 * def encode(self, frame=None): # <<<<<<<<<<<<<<
3704 * """
3705 * Encode an :class:`.AudioFrame` or :class:`.VideoFrame` and return a list
3706 */
3707
3708 /* Python wrapper */
3709 static PyObject *__pyx_pw_2av_6stream_6Stream_9encode(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3710 static char __pyx_doc_2av_6stream_6Stream_8encode[] = "Stream.encode(frame=None)\n\n Encode an :class:`.AudioFrame` or :class:`.VideoFrame` and return a list\n of :class:`.Packet`.\n\n :return: :class:`list` of :class:`.Packet`.\n\n .. seealso:: This is mostly a passthrough to :meth:`.CodecContext.encode`.\n ";
__pyx_pw_2av_6stream_6Stream_9encode(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)3711 static PyObject *__pyx_pw_2av_6stream_6Stream_9encode(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3712 PyObject *__pyx_v_frame = 0;
3713 int __pyx_lineno = 0;
3714 const char *__pyx_filename = NULL;
3715 int __pyx_clineno = 0;
3716 PyObject *__pyx_r = 0;
3717 __Pyx_RefNannyDeclarations
3718 __Pyx_RefNannySetupContext("encode (wrapper)", 0);
3719 {
3720 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_frame,0};
3721 PyObject* values[1] = {0};
3722 values[0] = ((PyObject *)Py_None);
3723 if (unlikely(__pyx_kwds)) {
3724 Py_ssize_t kw_args;
3725 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3726 switch (pos_args) {
3727 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3728 CYTHON_FALLTHROUGH;
3729 case 0: break;
3730 default: goto __pyx_L5_argtuple_error;
3731 }
3732 kw_args = PyDict_Size(__pyx_kwds);
3733 switch (pos_args) {
3734 case 0:
3735 if (kw_args > 0) {
3736 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_frame);
3737 if (value) { values[0] = value; kw_args--; }
3738 }
3739 }
3740 if (unlikely(kw_args > 0)) {
3741 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "encode") < 0)) __PYX_ERR(0, 146, __pyx_L3_error)
3742 }
3743 } else {
3744 switch (PyTuple_GET_SIZE(__pyx_args)) {
3745 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3746 CYTHON_FALLTHROUGH;
3747 case 0: break;
3748 default: goto __pyx_L5_argtuple_error;
3749 }
3750 }
3751 __pyx_v_frame = values[0];
3752 }
3753 goto __pyx_L4_argument_unpacking_done;
3754 __pyx_L5_argtuple_error:;
3755 __Pyx_RaiseArgtupleInvalid("encode", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 146, __pyx_L3_error)
3756 __pyx_L3_error:;
3757 __Pyx_AddTraceback("av.stream.Stream.encode", __pyx_clineno, __pyx_lineno, __pyx_filename);
3758 __Pyx_RefNannyFinishContext();
3759 return NULL;
3760 __pyx_L4_argument_unpacking_done:;
3761 __pyx_r = __pyx_pf_2av_6stream_6Stream_8encode(((struct __pyx_obj_2av_6stream_Stream *)__pyx_v_self), __pyx_v_frame);
3762
3763 /* function exit code */
3764 __Pyx_RefNannyFinishContext();
3765 return __pyx_r;
3766 }
3767
__pyx_pf_2av_6stream_6Stream_8encode(struct __pyx_obj_2av_6stream_Stream * __pyx_v_self,PyObject * __pyx_v_frame)3768 static PyObject *__pyx_pf_2av_6stream_6Stream_8encode(struct __pyx_obj_2av_6stream_Stream *__pyx_v_self, PyObject *__pyx_v_frame) {
3769 PyObject *__pyx_v_packets = NULL;
3770 struct __pyx_obj_2av_6packet_Packet *__pyx_v_packet = 0;
3771 PyObject *__pyx_r = NULL;
3772 __Pyx_RefNannyDeclarations
3773 PyObject *__pyx_t_1 = NULL;
3774 struct __pyx_opt_args_2av_5codec_7context_12CodecContext_encode __pyx_t_2;
3775 Py_ssize_t __pyx_t_3;
3776 PyObject *(*__pyx_t_4)(PyObject *);
3777 PyObject *__pyx_t_5 = NULL;
3778 int __pyx_t_6;
3779 int __pyx_lineno = 0;
3780 const char *__pyx_filename = NULL;
3781 int __pyx_clineno = 0;
3782 __Pyx_RefNannySetupContext("encode", 0);
3783
3784 /* "av/stream.pyx":155
3785 * .. seealso:: This is mostly a passthrough to :meth:`.CodecContext.encode`.
3786 * """
3787 * packets = self.codec_context.encode(frame) # <<<<<<<<<<<<<<
3788 * cdef Packet packet
3789 * for packet in packets:
3790 */
3791 if (!(likely(((__pyx_v_frame) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_frame, __pyx_ptype_2av_5frame_Frame))))) __PYX_ERR(0, 155, __pyx_L1_error)
3792 __pyx_t_2.__pyx_n = 1;
3793 __pyx_t_2.frame = ((struct __pyx_obj_2av_5frame_Frame *)__pyx_v_frame);
3794 __pyx_t_1 = ((struct __pyx_vtabstruct_2av_5codec_7context_CodecContext *)__pyx_v_self->codec_context->__pyx_vtab)->encode(__pyx_v_self->codec_context, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 155, __pyx_L1_error)
3795 __Pyx_GOTREF(__pyx_t_1);
3796 __pyx_v_packets = __pyx_t_1;
3797 __pyx_t_1 = 0;
3798
3799 /* "av/stream.pyx":157
3800 * packets = self.codec_context.encode(frame)
3801 * cdef Packet packet
3802 * for packet in packets: # <<<<<<<<<<<<<<
3803 * packet._stream = self
3804 * packet.struct.stream_index = self._stream.index
3805 */
3806 if (likely(PyList_CheckExact(__pyx_v_packets)) || PyTuple_CheckExact(__pyx_v_packets)) {
3807 __pyx_t_1 = __pyx_v_packets; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
3808 __pyx_t_4 = NULL;
3809 } else {
3810 __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_packets); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 157, __pyx_L1_error)
3811 __Pyx_GOTREF(__pyx_t_1);
3812 __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 157, __pyx_L1_error)
3813 }
3814 for (;;) {
3815 if (likely(!__pyx_t_4)) {
3816 if (likely(PyList_CheckExact(__pyx_t_1))) {
3817 if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
3818 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3819 __pyx_t_5 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 157, __pyx_L1_error)
3820 #else
3821 __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 157, __pyx_L1_error)
3822 __Pyx_GOTREF(__pyx_t_5);
3823 #endif
3824 } else {
3825 if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
3826 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
3827 __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_5); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 157, __pyx_L1_error)
3828 #else
3829 __pyx_t_5 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 157, __pyx_L1_error)
3830 __Pyx_GOTREF(__pyx_t_5);
3831 #endif
3832 }
3833 } else {
3834 __pyx_t_5 = __pyx_t_4(__pyx_t_1);
3835 if (unlikely(!__pyx_t_5)) {
3836 PyObject* exc_type = PyErr_Occurred();
3837 if (exc_type) {
3838 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
3839 else __PYX_ERR(0, 157, __pyx_L1_error)
3840 }
3841 break;
3842 }
3843 __Pyx_GOTREF(__pyx_t_5);
3844 }
3845 if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_2av_6packet_Packet))))) __PYX_ERR(0, 157, __pyx_L1_error)
3846 __Pyx_XDECREF_SET(__pyx_v_packet, ((struct __pyx_obj_2av_6packet_Packet *)__pyx_t_5));
3847 __pyx_t_5 = 0;
3848
3849 /* "av/stream.pyx":158
3850 * cdef Packet packet
3851 * for packet in packets:
3852 * packet._stream = self # <<<<<<<<<<<<<<
3853 * packet.struct.stream_index = self._stream.index
3854 * return packets
3855 */
3856 __Pyx_INCREF(((PyObject *)__pyx_v_self));
3857 __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
3858 __Pyx_GOTREF(__pyx_v_packet->_stream);
3859 __Pyx_DECREF(((PyObject *)__pyx_v_packet->_stream));
3860 __pyx_v_packet->_stream = __pyx_v_self;
3861
3862 /* "av/stream.pyx":159
3863 * for packet in packets:
3864 * packet._stream = self
3865 * packet.struct.stream_index = self._stream.index # <<<<<<<<<<<<<<
3866 * return packets
3867 *
3868 */
3869 __pyx_t_6 = __pyx_v_self->_stream->index;
3870 __pyx_v_packet->__pyx_struct.stream_index = __pyx_t_6;
3871
3872 /* "av/stream.pyx":157
3873 * packets = self.codec_context.encode(frame)
3874 * cdef Packet packet
3875 * for packet in packets: # <<<<<<<<<<<<<<
3876 * packet._stream = self
3877 * packet.struct.stream_index = self._stream.index
3878 */
3879 }
3880 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3881
3882 /* "av/stream.pyx":160
3883 * packet._stream = self
3884 * packet.struct.stream_index = self._stream.index
3885 * return packets # <<<<<<<<<<<<<<
3886 *
3887 * def decode(self, packet=None):
3888 */
3889 __Pyx_XDECREF(__pyx_r);
3890 __Pyx_INCREF(__pyx_v_packets);
3891 __pyx_r = __pyx_v_packets;
3892 goto __pyx_L0;
3893
3894 /* "av/stream.pyx":146
3895 * err_check(lib.avcodec_parameters_from_context(self._stream.codecpar, self._stream.codec))
3896 *
3897 * def encode(self, frame=None): # <<<<<<<<<<<<<<
3898 * """
3899 * Encode an :class:`.AudioFrame` or :class:`.VideoFrame` and return a list
3900 */
3901
3902 /* function exit code */
3903 __pyx_L1_error:;
3904 __Pyx_XDECREF(__pyx_t_1);
3905 __Pyx_XDECREF(__pyx_t_5);
3906 __Pyx_AddTraceback("av.stream.Stream.encode", __pyx_clineno, __pyx_lineno, __pyx_filename);
3907 __pyx_r = NULL;
3908 __pyx_L0:;
3909 __Pyx_XDECREF(__pyx_v_packets);
3910 __Pyx_XDECREF((PyObject *)__pyx_v_packet);
3911 __Pyx_XGIVEREF(__pyx_r);
3912 __Pyx_RefNannyFinishContext();
3913 return __pyx_r;
3914 }
3915
3916 /* "av/stream.pyx":162
3917 * return packets
3918 *
3919 * def decode(self, packet=None): # <<<<<<<<<<<<<<
3920 * """
3921 * Decode a :class:`.Packet` and return a list of :class:`.AudioFrame`
3922 */
3923
3924 /* Python wrapper */
3925 static PyObject *__pyx_pw_2av_6stream_6Stream_11decode(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3926 static char __pyx_doc_2av_6stream_6Stream_10decode[] = "Stream.decode(packet=None)\n\n Decode a :class:`.Packet` and return a list of :class:`.AudioFrame`\n or :class:`.VideoFrame`.\n\n :return: :class:`list` of :class:`.Frame` subclasses.\n\n .. seealso:: This is mostly a passthrough to :meth:`.CodecContext.decode`.\n ";
__pyx_pw_2av_6stream_6Stream_11decode(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)3927 static PyObject *__pyx_pw_2av_6stream_6Stream_11decode(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3928 PyObject *__pyx_v_packet = 0;
3929 int __pyx_lineno = 0;
3930 const char *__pyx_filename = NULL;
3931 int __pyx_clineno = 0;
3932 PyObject *__pyx_r = 0;
3933 __Pyx_RefNannyDeclarations
3934 __Pyx_RefNannySetupContext("decode (wrapper)", 0);
3935 {
3936 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_packet,0};
3937 PyObject* values[1] = {0};
3938 values[0] = ((PyObject *)Py_None);
3939 if (unlikely(__pyx_kwds)) {
3940 Py_ssize_t kw_args;
3941 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3942 switch (pos_args) {
3943 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3944 CYTHON_FALLTHROUGH;
3945 case 0: break;
3946 default: goto __pyx_L5_argtuple_error;
3947 }
3948 kw_args = PyDict_Size(__pyx_kwds);
3949 switch (pos_args) {
3950 case 0:
3951 if (kw_args > 0) {
3952 PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_packet);
3953 if (value) { values[0] = value; kw_args--; }
3954 }
3955 }
3956 if (unlikely(kw_args > 0)) {
3957 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "decode") < 0)) __PYX_ERR(0, 162, __pyx_L3_error)
3958 }
3959 } else {
3960 switch (PyTuple_GET_SIZE(__pyx_args)) {
3961 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3962 CYTHON_FALLTHROUGH;
3963 case 0: break;
3964 default: goto __pyx_L5_argtuple_error;
3965 }
3966 }
3967 __pyx_v_packet = values[0];
3968 }
3969 goto __pyx_L4_argument_unpacking_done;
3970 __pyx_L5_argtuple_error:;
3971 __Pyx_RaiseArgtupleInvalid("decode", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 162, __pyx_L3_error)
3972 __pyx_L3_error:;
3973 __Pyx_AddTraceback("av.stream.Stream.decode", __pyx_clineno, __pyx_lineno, __pyx_filename);
3974 __Pyx_RefNannyFinishContext();
3975 return NULL;
3976 __pyx_L4_argument_unpacking_done:;
3977 __pyx_r = __pyx_pf_2av_6stream_6Stream_10decode(((struct __pyx_obj_2av_6stream_Stream *)__pyx_v_self), __pyx_v_packet);
3978
3979 /* function exit code */
3980 __Pyx_RefNannyFinishContext();
3981 return __pyx_r;
3982 }
3983
__pyx_pf_2av_6stream_6Stream_10decode(struct __pyx_obj_2av_6stream_Stream * __pyx_v_self,PyObject * __pyx_v_packet)3984 static PyObject *__pyx_pf_2av_6stream_6Stream_10decode(struct __pyx_obj_2av_6stream_Stream *__pyx_v_self, PyObject *__pyx_v_packet) {
3985 PyObject *__pyx_r = NULL;
3986 __Pyx_RefNannyDeclarations
3987 PyObject *__pyx_t_1 = NULL;
3988 struct __pyx_opt_args_2av_5codec_7context_12CodecContext_decode __pyx_t_2;
3989 int __pyx_lineno = 0;
3990 const char *__pyx_filename = NULL;
3991 int __pyx_clineno = 0;
3992 __Pyx_RefNannySetupContext("decode", 0);
3993
3994 /* "av/stream.pyx":171
3995 * .. seealso:: This is mostly a passthrough to :meth:`.CodecContext.decode`.
3996 * """
3997 * return self.codec_context.decode(packet) # <<<<<<<<<<<<<<
3998 *
3999 * @deprecation.method
4000 */
4001 __Pyx_XDECREF(__pyx_r);
4002 if (!(likely(((__pyx_v_packet) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_packet, __pyx_ptype_2av_6packet_Packet))))) __PYX_ERR(0, 171, __pyx_L1_error)
4003 __pyx_t_2.__pyx_n = 1;
4004 __pyx_t_2.packet = ((struct __pyx_obj_2av_6packet_Packet *)__pyx_v_packet);
4005 __pyx_t_1 = ((struct __pyx_vtabstruct_2av_5codec_7context_CodecContext *)__pyx_v_self->codec_context->__pyx_vtab)->decode(__pyx_v_self->codec_context, 0, &__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 171, __pyx_L1_error)
4006 __Pyx_GOTREF(__pyx_t_1);
4007 __pyx_r = __pyx_t_1;
4008 __pyx_t_1 = 0;
4009 goto __pyx_L0;
4010
4011 /* "av/stream.pyx":162
4012 * return packets
4013 *
4014 * def decode(self, packet=None): # <<<<<<<<<<<<<<
4015 * """
4016 * Decode a :class:`.Packet` and return a list of :class:`.AudioFrame`
4017 */
4018
4019 /* function exit code */
4020 __pyx_L1_error:;
4021 __Pyx_XDECREF(__pyx_t_1);
4022 __Pyx_AddTraceback("av.stream.Stream.decode", __pyx_clineno, __pyx_lineno, __pyx_filename);
4023 __pyx_r = NULL;
4024 __pyx_L0:;
4025 __Pyx_XGIVEREF(__pyx_r);
4026 __Pyx_RefNannyFinishContext();
4027 return __pyx_r;
4028 }
4029
4030 /* "av/stream.pyx":174
4031 *
4032 * @deprecation.method
4033 * def seek(self, offset, **kwargs): # <<<<<<<<<<<<<<
4034 * """
4035 * .. seealso:: :meth:`.InputContainer.seek` for documentation on parameters.
4036 */
4037
4038 /* Python wrapper */
4039 static PyObject *__pyx_pw_2av_6stream_6Stream_13seek(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
4040 static char __pyx_doc_2av_6stream_6Stream_12seek[] = "Stream.seek(offset, **kwargs)\n\n .. seealso:: :meth:`.InputContainer.seek` for documentation on parameters.\n The only difference is that ``offset`` will be interpreted in\n :attr:`.Stream.time_base` when ``whence == 'time'``.\n\n .. deprecated:: 6.1.0\n Use :meth:`.InputContainer.seek` with ``stream`` argument instead.\n\n ";
__pyx_pw_2av_6stream_6Stream_13seek(PyObject * __pyx_v_self,PyObject * __pyx_args,PyObject * __pyx_kwds)4041 static PyObject *__pyx_pw_2av_6stream_6Stream_13seek(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
4042 PyObject *__pyx_v_offset = 0;
4043 PyObject *__pyx_v_kwargs = 0;
4044 int __pyx_lineno = 0;
4045 const char *__pyx_filename = NULL;
4046 int __pyx_clineno = 0;
4047 PyObject *__pyx_r = 0;
4048 __Pyx_RefNannyDeclarations
4049 __Pyx_RefNannySetupContext("seek (wrapper)", 0);
4050 __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return NULL;
4051 __Pyx_GOTREF(__pyx_v_kwargs);
4052 {
4053 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_offset,0};
4054 PyObject* values[1] = {0};
4055 if (unlikely(__pyx_kwds)) {
4056 Py_ssize_t kw_args;
4057 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4058 switch (pos_args) {
4059 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4060 CYTHON_FALLTHROUGH;
4061 case 0: break;
4062 default: goto __pyx_L5_argtuple_error;
4063 }
4064 kw_args = PyDict_Size(__pyx_kwds);
4065 switch (pos_args) {
4066 case 0:
4067 if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_offset)) != 0)) kw_args--;
4068 else goto __pyx_L5_argtuple_error;
4069 }
4070 if (unlikely(kw_args > 0)) {
4071 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "seek") < 0)) __PYX_ERR(0, 174, __pyx_L3_error)
4072 }
4073 } else if (PyTuple_GET_SIZE(__pyx_args) != 1) {
4074 goto __pyx_L5_argtuple_error;
4075 } else {
4076 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4077 }
4078 __pyx_v_offset = values[0];
4079 }
4080 goto __pyx_L4_argument_unpacking_done;
4081 __pyx_L5_argtuple_error:;
4082 __Pyx_RaiseArgtupleInvalid("seek", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 174, __pyx_L3_error)
4083 __pyx_L3_error:;
4084 __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0;
4085 __Pyx_AddTraceback("av.stream.Stream.seek", __pyx_clineno, __pyx_lineno, __pyx_filename);
4086 __Pyx_RefNannyFinishContext();
4087 return NULL;
4088 __pyx_L4_argument_unpacking_done:;
4089 __pyx_r = __pyx_pf_2av_6stream_6Stream_12seek(((struct __pyx_obj_2av_6stream_Stream *)__pyx_v_self), __pyx_v_offset, __pyx_v_kwargs);
4090
4091 /* function exit code */
4092 __Pyx_XDECREF(__pyx_v_kwargs);
4093 __Pyx_RefNannyFinishContext();
4094 return __pyx_r;
4095 }
4096
__pyx_pf_2av_6stream_6Stream_12seek(struct __pyx_obj_2av_6stream_Stream * __pyx_v_self,PyObject * __pyx_v_offset,PyObject * __pyx_v_kwargs)4097 static PyObject *__pyx_pf_2av_6stream_6Stream_12seek(struct __pyx_obj_2av_6stream_Stream *__pyx_v_self, PyObject *__pyx_v_offset, PyObject *__pyx_v_kwargs) {
4098 PyObject *__pyx_r = NULL;
4099 __Pyx_RefNannyDeclarations
4100 PyObject *__pyx_t_1 = NULL;
4101 PyObject *__pyx_t_2 = NULL;
4102 PyObject *__pyx_t_3 = NULL;
4103 PyObject *__pyx_t_4 = NULL;
4104 int __pyx_lineno = 0;
4105 const char *__pyx_filename = NULL;
4106 int __pyx_clineno = 0;
4107 __Pyx_RefNannySetupContext("seek", 0);
4108
4109 /* "av/stream.pyx":184
4110 *
4111 * """
4112 * self.container.seek(offset, stream=self, **kwargs) # <<<<<<<<<<<<<<
4113 *
4114 * property id:
4115 */
4116 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->container), __pyx_n_s_seek); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 184, __pyx_L1_error)
4117 __Pyx_GOTREF(__pyx_t_1);
4118 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 184, __pyx_L1_error)
4119 __Pyx_GOTREF(__pyx_t_2);
4120 __Pyx_INCREF(__pyx_v_offset);
4121 __Pyx_GIVEREF(__pyx_v_offset);
4122 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_offset);
4123 __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 184, __pyx_L1_error)
4124 __Pyx_GOTREF(__pyx_t_4);
4125 if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_stream, ((PyObject *)__pyx_v_self)) < 0) __PYX_ERR(0, 184, __pyx_L1_error)
4126 __pyx_t_3 = __pyx_t_4;
4127 __pyx_t_4 = 0;
4128 if (__Pyx_MergeKeywords(__pyx_t_3, __pyx_v_kwargs) < 0) __PYX_ERR(0, 184, __pyx_L1_error)
4129 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 184, __pyx_L1_error)
4130 __Pyx_GOTREF(__pyx_t_4);
4131 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4132 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
4133 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4134 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4135
4136 /* "av/stream.pyx":174
4137 *
4138 * @deprecation.method
4139 * def seek(self, offset, **kwargs): # <<<<<<<<<<<<<<
4140 * """
4141 * .. seealso:: :meth:`.InputContainer.seek` for documentation on parameters.
4142 */
4143
4144 /* function exit code */
4145 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4146 goto __pyx_L0;
4147 __pyx_L1_error:;
4148 __Pyx_XDECREF(__pyx_t_1);
4149 __Pyx_XDECREF(__pyx_t_2);
4150 __Pyx_XDECREF(__pyx_t_3);
4151 __Pyx_XDECREF(__pyx_t_4);
4152 __Pyx_AddTraceback("av.stream.Stream.seek", __pyx_clineno, __pyx_lineno, __pyx_filename);
4153 __pyx_r = NULL;
4154 __pyx_L0:;
4155 __Pyx_XGIVEREF(__pyx_r);
4156 __Pyx_RefNannyFinishContext();
4157 return __pyx_r;
4158 }
4159
4160 /* "av/stream.pyx":193
4161 *
4162 * """
4163 * def __get__(self): # <<<<<<<<<<<<<<
4164 * return self._stream.id
4165 *
4166 */
4167
4168 /* Python wrapper */
4169 static PyObject *__pyx_pw_2av_6stream_6Stream_2id_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_2av_6stream_6Stream_2id_1__get__(PyObject * __pyx_v_self)4170 static PyObject *__pyx_pw_2av_6stream_6Stream_2id_1__get__(PyObject *__pyx_v_self) {
4171 PyObject *__pyx_r = 0;
4172 __Pyx_RefNannyDeclarations
4173 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
4174 __pyx_r = __pyx_pf_2av_6stream_6Stream_2id___get__(((struct __pyx_obj_2av_6stream_Stream *)__pyx_v_self));
4175
4176 /* function exit code */
4177 __Pyx_RefNannyFinishContext();
4178 return __pyx_r;
4179 }
4180
__pyx_pf_2av_6stream_6Stream_2id___get__(struct __pyx_obj_2av_6stream_Stream * __pyx_v_self)4181 static PyObject *__pyx_pf_2av_6stream_6Stream_2id___get__(struct __pyx_obj_2av_6stream_Stream *__pyx_v_self) {
4182 PyObject *__pyx_r = NULL;
4183 __Pyx_RefNannyDeclarations
4184 PyObject *__pyx_t_1 = NULL;
4185 int __pyx_lineno = 0;
4186 const char *__pyx_filename = NULL;
4187 int __pyx_clineno = 0;
4188 __Pyx_RefNannySetupContext("__get__", 0);
4189
4190 /* "av/stream.pyx":194
4191 * """
4192 * def __get__(self):
4193 * return self._stream.id # <<<<<<<<<<<<<<
4194 *
4195 * def __set__(self, v):
4196 */
4197 __Pyx_XDECREF(__pyx_r);
4198 __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->_stream->id); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 194, __pyx_L1_error)
4199 __Pyx_GOTREF(__pyx_t_1);
4200 __pyx_r = __pyx_t_1;
4201 __pyx_t_1 = 0;
4202 goto __pyx_L0;
4203
4204 /* "av/stream.pyx":193
4205 *
4206 * """
4207 * def __get__(self): # <<<<<<<<<<<<<<
4208 * return self._stream.id
4209 *
4210 */
4211
4212 /* function exit code */
4213 __pyx_L1_error:;
4214 __Pyx_XDECREF(__pyx_t_1);
4215 __Pyx_AddTraceback("av.stream.Stream.id.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4216 __pyx_r = NULL;
4217 __pyx_L0:;
4218 __Pyx_XGIVEREF(__pyx_r);
4219 __Pyx_RefNannyFinishContext();
4220 return __pyx_r;
4221 }
4222
4223 /* "av/stream.pyx":196
4224 * return self._stream.id
4225 *
4226 * def __set__(self, v): # <<<<<<<<<<<<<<
4227 * if v is None:
4228 * self._stream.id = 0
4229 */
4230
4231 /* Python wrapper */
4232 static int __pyx_pw_2av_6stream_6Stream_2id_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_v); /*proto*/
__pyx_pw_2av_6stream_6Stream_2id_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_v_v)4233 static int __pyx_pw_2av_6stream_6Stream_2id_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_v) {
4234 int __pyx_r;
4235 __Pyx_RefNannyDeclarations
4236 __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
4237 __pyx_r = __pyx_pf_2av_6stream_6Stream_2id_2__set__(((struct __pyx_obj_2av_6stream_Stream *)__pyx_v_self), ((PyObject *)__pyx_v_v));
4238
4239 /* function exit code */
4240 __Pyx_RefNannyFinishContext();
4241 return __pyx_r;
4242 }
4243
__pyx_pf_2av_6stream_6Stream_2id_2__set__(struct __pyx_obj_2av_6stream_Stream * __pyx_v_self,PyObject * __pyx_v_v)4244 static int __pyx_pf_2av_6stream_6Stream_2id_2__set__(struct __pyx_obj_2av_6stream_Stream *__pyx_v_self, PyObject *__pyx_v_v) {
4245 int __pyx_r;
4246 __Pyx_RefNannyDeclarations
4247 int __pyx_t_1;
4248 int __pyx_t_2;
4249 int __pyx_t_3;
4250 int __pyx_lineno = 0;
4251 const char *__pyx_filename = NULL;
4252 int __pyx_clineno = 0;
4253 __Pyx_RefNannySetupContext("__set__", 0);
4254
4255 /* "av/stream.pyx":197
4256 *
4257 * def __set__(self, v):
4258 * if v is None: # <<<<<<<<<<<<<<
4259 * self._stream.id = 0
4260 * else:
4261 */
4262 __pyx_t_1 = (__pyx_v_v == Py_None);
4263 __pyx_t_2 = (__pyx_t_1 != 0);
4264 if (__pyx_t_2) {
4265
4266 /* "av/stream.pyx":198
4267 * def __set__(self, v):
4268 * if v is None:
4269 * self._stream.id = 0 # <<<<<<<<<<<<<<
4270 * else:
4271 * self._stream.id = v
4272 */
4273 __pyx_v_self->_stream->id = 0;
4274
4275 /* "av/stream.pyx":197
4276 *
4277 * def __set__(self, v):
4278 * if v is None: # <<<<<<<<<<<<<<
4279 * self._stream.id = 0
4280 * else:
4281 */
4282 goto __pyx_L3;
4283 }
4284
4285 /* "av/stream.pyx":200
4286 * self._stream.id = 0
4287 * else:
4288 * self._stream.id = v # <<<<<<<<<<<<<<
4289 *
4290 * property profile:
4291 */
4292 /*else*/ {
4293 __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_v_v); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 200, __pyx_L1_error)
4294 __pyx_v_self->_stream->id = __pyx_t_3;
4295 }
4296 __pyx_L3:;
4297
4298 /* "av/stream.pyx":196
4299 * return self._stream.id
4300 *
4301 * def __set__(self, v): # <<<<<<<<<<<<<<
4302 * if v is None:
4303 * self._stream.id = 0
4304 */
4305
4306 /* function exit code */
4307 __pyx_r = 0;
4308 goto __pyx_L0;
4309 __pyx_L1_error:;
4310 __Pyx_AddTraceback("av.stream.Stream.id.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4311 __pyx_r = -1;
4312 __pyx_L0:;
4313 __Pyx_RefNannyFinishContext();
4314 return __pyx_r;
4315 }
4316
4317 /* "av/stream.pyx":208
4318 * :type: str
4319 * """
4320 * def __get__(self): # <<<<<<<<<<<<<<
4321 * if self._codec and lib.av_get_profile_name(self._codec, self._codec_context.profile):
4322 * return lib.av_get_profile_name(self._codec, self._codec_context.profile)
4323 */
4324
4325 /* Python wrapper */
4326 static PyObject *__pyx_pw_2av_6stream_6Stream_7profile_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_2av_6stream_6Stream_7profile_1__get__(PyObject * __pyx_v_self)4327 static PyObject *__pyx_pw_2av_6stream_6Stream_7profile_1__get__(PyObject *__pyx_v_self) {
4328 PyObject *__pyx_r = 0;
4329 __Pyx_RefNannyDeclarations
4330 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
4331 __pyx_r = __pyx_pf_2av_6stream_6Stream_7profile___get__(((struct __pyx_obj_2av_6stream_Stream *)__pyx_v_self));
4332
4333 /* function exit code */
4334 __Pyx_RefNannyFinishContext();
4335 return __pyx_r;
4336 }
4337
__pyx_pf_2av_6stream_6Stream_7profile___get__(struct __pyx_obj_2av_6stream_Stream * __pyx_v_self)4338 static PyObject *__pyx_pf_2av_6stream_6Stream_7profile___get__(struct __pyx_obj_2av_6stream_Stream *__pyx_v_self) {
4339 PyObject *__pyx_r = NULL;
4340 __Pyx_RefNannyDeclarations
4341 int __pyx_t_1;
4342 int __pyx_t_2;
4343 PyObject *__pyx_t_3 = NULL;
4344 int __pyx_lineno = 0;
4345 const char *__pyx_filename = NULL;
4346 int __pyx_clineno = 0;
4347 __Pyx_RefNannySetupContext("__get__", 0);
4348
4349 /* "av/stream.pyx":209
4350 * """
4351 * def __get__(self):
4352 * if self._codec and lib.av_get_profile_name(self._codec, self._codec_context.profile): # <<<<<<<<<<<<<<
4353 * return lib.av_get_profile_name(self._codec, self._codec_context.profile)
4354 * else:
4355 */
4356 __pyx_t_2 = (__pyx_v_self->_codec != 0);
4357 if (__pyx_t_2) {
4358 } else {
4359 __pyx_t_1 = __pyx_t_2;
4360 goto __pyx_L4_bool_binop_done;
4361 }
4362 __pyx_t_2 = (av_get_profile_name(__pyx_v_self->_codec, __pyx_v_self->_codec_context->profile) != 0);
4363 __pyx_t_1 = __pyx_t_2;
4364 __pyx_L4_bool_binop_done:;
4365 if (__pyx_t_1) {
4366
4367 /* "av/stream.pyx":210
4368 * def __get__(self):
4369 * if self._codec and lib.av_get_profile_name(self._codec, self._codec_context.profile):
4370 * return lib.av_get_profile_name(self._codec, self._codec_context.profile) # <<<<<<<<<<<<<<
4371 * else:
4372 * return None
4373 */
4374 __Pyx_XDECREF(__pyx_r);
4375 __pyx_t_3 = __Pyx_PyStr_FromString(av_get_profile_name(__pyx_v_self->_codec, __pyx_v_self->_codec_context->profile)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 210, __pyx_L1_error)
4376 __Pyx_GOTREF(__pyx_t_3);
4377 __pyx_r = __pyx_t_3;
4378 __pyx_t_3 = 0;
4379 goto __pyx_L0;
4380
4381 /* "av/stream.pyx":209
4382 * """
4383 * def __get__(self):
4384 * if self._codec and lib.av_get_profile_name(self._codec, self._codec_context.profile): # <<<<<<<<<<<<<<
4385 * return lib.av_get_profile_name(self._codec, self._codec_context.profile)
4386 * else:
4387 */
4388 }
4389
4390 /* "av/stream.pyx":212
4391 * return lib.av_get_profile_name(self._codec, self._codec_context.profile)
4392 * else:
4393 * return None # <<<<<<<<<<<<<<
4394 *
4395 * property index:
4396 */
4397 /*else*/ {
4398 __Pyx_XDECREF(__pyx_r);
4399 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4400 goto __pyx_L0;
4401 }
4402
4403 /* "av/stream.pyx":208
4404 * :type: str
4405 * """
4406 * def __get__(self): # <<<<<<<<<<<<<<
4407 * if self._codec and lib.av_get_profile_name(self._codec, self._codec_context.profile):
4408 * return lib.av_get_profile_name(self._codec, self._codec_context.profile)
4409 */
4410
4411 /* function exit code */
4412 __pyx_L1_error:;
4413 __Pyx_XDECREF(__pyx_t_3);
4414 __Pyx_AddTraceback("av.stream.Stream.profile.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4415 __pyx_r = NULL;
4416 __pyx_L0:;
4417 __Pyx_XGIVEREF(__pyx_r);
4418 __Pyx_RefNannyFinishContext();
4419 return __pyx_r;
4420 }
4421
4422 /* "av/stream.pyx":220
4423 * :type: int
4424 * """
4425 * def __get__(self): return self._stream.index # <<<<<<<<<<<<<<
4426 *
4427 * property time_base:
4428 */
4429
4430 /* Python wrapper */
4431 static PyObject *__pyx_pw_2av_6stream_6Stream_5index_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_2av_6stream_6Stream_5index_1__get__(PyObject * __pyx_v_self)4432 static PyObject *__pyx_pw_2av_6stream_6Stream_5index_1__get__(PyObject *__pyx_v_self) {
4433 PyObject *__pyx_r = 0;
4434 __Pyx_RefNannyDeclarations
4435 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
4436 __pyx_r = __pyx_pf_2av_6stream_6Stream_5index___get__(((struct __pyx_obj_2av_6stream_Stream *)__pyx_v_self));
4437
4438 /* function exit code */
4439 __Pyx_RefNannyFinishContext();
4440 return __pyx_r;
4441 }
4442
__pyx_pf_2av_6stream_6Stream_5index___get__(struct __pyx_obj_2av_6stream_Stream * __pyx_v_self)4443 static PyObject *__pyx_pf_2av_6stream_6Stream_5index___get__(struct __pyx_obj_2av_6stream_Stream *__pyx_v_self) {
4444 PyObject *__pyx_r = NULL;
4445 __Pyx_RefNannyDeclarations
4446 PyObject *__pyx_t_1 = NULL;
4447 int __pyx_lineno = 0;
4448 const char *__pyx_filename = NULL;
4449 int __pyx_clineno = 0;
4450 __Pyx_RefNannySetupContext("__get__", 0);
4451 __Pyx_XDECREF(__pyx_r);
4452 __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->_stream->index); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 220, __pyx_L1_error)
4453 __Pyx_GOTREF(__pyx_t_1);
4454 __pyx_r = __pyx_t_1;
4455 __pyx_t_1 = 0;
4456 goto __pyx_L0;
4457
4458 /* function exit code */
4459 __pyx_L1_error:;
4460 __Pyx_XDECREF(__pyx_t_1);
4461 __Pyx_AddTraceback("av.stream.Stream.index.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4462 __pyx_r = NULL;
4463 __pyx_L0:;
4464 __Pyx_XGIVEREF(__pyx_r);
4465 __Pyx_RefNannyFinishContext();
4466 return __pyx_r;
4467 }
4468
4469 /* "av/stream.pyx":229
4470 *
4471 * """
4472 * def __get__(self): # <<<<<<<<<<<<<<
4473 * return avrational_to_fraction(&self._stream.time_base)
4474 *
4475 */
4476
4477 /* Python wrapper */
4478 static PyObject *__pyx_pw_2av_6stream_6Stream_9time_base_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_2av_6stream_6Stream_9time_base_1__get__(PyObject * __pyx_v_self)4479 static PyObject *__pyx_pw_2av_6stream_6Stream_9time_base_1__get__(PyObject *__pyx_v_self) {
4480 PyObject *__pyx_r = 0;
4481 __Pyx_RefNannyDeclarations
4482 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
4483 __pyx_r = __pyx_pf_2av_6stream_6Stream_9time_base___get__(((struct __pyx_obj_2av_6stream_Stream *)__pyx_v_self));
4484
4485 /* function exit code */
4486 __Pyx_RefNannyFinishContext();
4487 return __pyx_r;
4488 }
4489
__pyx_pf_2av_6stream_6Stream_9time_base___get__(struct __pyx_obj_2av_6stream_Stream * __pyx_v_self)4490 static PyObject *__pyx_pf_2av_6stream_6Stream_9time_base___get__(struct __pyx_obj_2av_6stream_Stream *__pyx_v_self) {
4491 PyObject *__pyx_r = NULL;
4492 __Pyx_RefNannyDeclarations
4493 PyObject *__pyx_t_1 = NULL;
4494 int __pyx_lineno = 0;
4495 const char *__pyx_filename = NULL;
4496 int __pyx_clineno = 0;
4497 __Pyx_RefNannySetupContext("__get__", 0);
4498
4499 /* "av/stream.pyx":230
4500 * """
4501 * def __get__(self):
4502 * return avrational_to_fraction(&self._stream.time_base) # <<<<<<<<<<<<<<
4503 *
4504 * def __set__(self, value):
4505 */
4506 __Pyx_XDECREF(__pyx_r);
4507 __pyx_t_1 = __pyx_f_2av_5utils_avrational_to_fraction((&__pyx_v_self->_stream->time_base)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 230, __pyx_L1_error)
4508 __Pyx_GOTREF(__pyx_t_1);
4509 __pyx_r = __pyx_t_1;
4510 __pyx_t_1 = 0;
4511 goto __pyx_L0;
4512
4513 /* "av/stream.pyx":229
4514 *
4515 * """
4516 * def __get__(self): # <<<<<<<<<<<<<<
4517 * return avrational_to_fraction(&self._stream.time_base)
4518 *
4519 */
4520
4521 /* function exit code */
4522 __pyx_L1_error:;
4523 __Pyx_XDECREF(__pyx_t_1);
4524 __Pyx_AddTraceback("av.stream.Stream.time_base.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4525 __pyx_r = NULL;
4526 __pyx_L0:;
4527 __Pyx_XGIVEREF(__pyx_r);
4528 __Pyx_RefNannyFinishContext();
4529 return __pyx_r;
4530 }
4531
4532 /* "av/stream.pyx":232
4533 * return avrational_to_fraction(&self._stream.time_base)
4534 *
4535 * def __set__(self, value): # <<<<<<<<<<<<<<
4536 * to_avrational(value, &self._stream.time_base)
4537 *
4538 */
4539
4540 /* Python wrapper */
4541 static int __pyx_pw_2av_6stream_6Stream_9time_base_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value); /*proto*/
__pyx_pw_2av_6stream_6Stream_9time_base_3__set__(PyObject * __pyx_v_self,PyObject * __pyx_v_value)4542 static int __pyx_pw_2av_6stream_6Stream_9time_base_3__set__(PyObject *__pyx_v_self, PyObject *__pyx_v_value) {
4543 int __pyx_r;
4544 __Pyx_RefNannyDeclarations
4545 __Pyx_RefNannySetupContext("__set__ (wrapper)", 0);
4546 __pyx_r = __pyx_pf_2av_6stream_6Stream_9time_base_2__set__(((struct __pyx_obj_2av_6stream_Stream *)__pyx_v_self), ((PyObject *)__pyx_v_value));
4547
4548 /* function exit code */
4549 __Pyx_RefNannyFinishContext();
4550 return __pyx_r;
4551 }
4552
__pyx_pf_2av_6stream_6Stream_9time_base_2__set__(struct __pyx_obj_2av_6stream_Stream * __pyx_v_self,PyObject * __pyx_v_value)4553 static int __pyx_pf_2av_6stream_6Stream_9time_base_2__set__(struct __pyx_obj_2av_6stream_Stream *__pyx_v_self, PyObject *__pyx_v_value) {
4554 int __pyx_r;
4555 __Pyx_RefNannyDeclarations
4556 PyObject *__pyx_t_1 = NULL;
4557 int __pyx_lineno = 0;
4558 const char *__pyx_filename = NULL;
4559 int __pyx_clineno = 0;
4560 __Pyx_RefNannySetupContext("__set__", 0);
4561
4562 /* "av/stream.pyx":233
4563 *
4564 * def __set__(self, value):
4565 * to_avrational(value, &self._stream.time_base) # <<<<<<<<<<<<<<
4566 *
4567 * property average_rate:
4568 */
4569 __pyx_t_1 = __pyx_f_2av_5utils_to_avrational(__pyx_v_value, (&__pyx_v_self->_stream->time_base)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 233, __pyx_L1_error)
4570 __Pyx_GOTREF(__pyx_t_1);
4571 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
4572
4573 /* "av/stream.pyx":232
4574 * return avrational_to_fraction(&self._stream.time_base)
4575 *
4576 * def __set__(self, value): # <<<<<<<<<<<<<<
4577 * to_avrational(value, &self._stream.time_base)
4578 *
4579 */
4580
4581 /* function exit code */
4582 __pyx_r = 0;
4583 goto __pyx_L0;
4584 __pyx_L1_error:;
4585 __Pyx_XDECREF(__pyx_t_1);
4586 __Pyx_AddTraceback("av.stream.Stream.time_base.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4587 __pyx_r = -1;
4588 __pyx_L0:;
4589 __Pyx_RefNannyFinishContext();
4590 return __pyx_r;
4591 }
4592
4593 /* "av/stream.pyx":246
4594 *
4595 * """
4596 * def __get__(self): # <<<<<<<<<<<<<<
4597 * return avrational_to_fraction(&self._stream.avg_frame_rate)
4598 *
4599 */
4600
4601 /* Python wrapper */
4602 static PyObject *__pyx_pw_2av_6stream_6Stream_12average_rate_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_2av_6stream_6Stream_12average_rate_1__get__(PyObject * __pyx_v_self)4603 static PyObject *__pyx_pw_2av_6stream_6Stream_12average_rate_1__get__(PyObject *__pyx_v_self) {
4604 PyObject *__pyx_r = 0;
4605 __Pyx_RefNannyDeclarations
4606 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
4607 __pyx_r = __pyx_pf_2av_6stream_6Stream_12average_rate___get__(((struct __pyx_obj_2av_6stream_Stream *)__pyx_v_self));
4608
4609 /* function exit code */
4610 __Pyx_RefNannyFinishContext();
4611 return __pyx_r;
4612 }
4613
__pyx_pf_2av_6stream_6Stream_12average_rate___get__(struct __pyx_obj_2av_6stream_Stream * __pyx_v_self)4614 static PyObject *__pyx_pf_2av_6stream_6Stream_12average_rate___get__(struct __pyx_obj_2av_6stream_Stream *__pyx_v_self) {
4615 PyObject *__pyx_r = NULL;
4616 __Pyx_RefNannyDeclarations
4617 PyObject *__pyx_t_1 = NULL;
4618 int __pyx_lineno = 0;
4619 const char *__pyx_filename = NULL;
4620 int __pyx_clineno = 0;
4621 __Pyx_RefNannySetupContext("__get__", 0);
4622
4623 /* "av/stream.pyx":247
4624 * """
4625 * def __get__(self):
4626 * return avrational_to_fraction(&self._stream.avg_frame_rate) # <<<<<<<<<<<<<<
4627 *
4628 * property base_rate:
4629 */
4630 __Pyx_XDECREF(__pyx_r);
4631 __pyx_t_1 = __pyx_f_2av_5utils_avrational_to_fraction((&__pyx_v_self->_stream->avg_frame_rate)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 247, __pyx_L1_error)
4632 __Pyx_GOTREF(__pyx_t_1);
4633 __pyx_r = __pyx_t_1;
4634 __pyx_t_1 = 0;
4635 goto __pyx_L0;
4636
4637 /* "av/stream.pyx":246
4638 *
4639 * """
4640 * def __get__(self): # <<<<<<<<<<<<<<
4641 * return avrational_to_fraction(&self._stream.avg_frame_rate)
4642 *
4643 */
4644
4645 /* function exit code */
4646 __pyx_L1_error:;
4647 __Pyx_XDECREF(__pyx_t_1);
4648 __Pyx_AddTraceback("av.stream.Stream.average_rate.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4649 __pyx_r = NULL;
4650 __pyx_L0:;
4651 __Pyx_XGIVEREF(__pyx_r);
4652 __Pyx_RefNannyFinishContext();
4653 return __pyx_r;
4654 }
4655
4656 /* "av/stream.pyx":260
4657 *
4658 * """
4659 * def __get__(self): # <<<<<<<<<<<<<<
4660 * return avrational_to_fraction(&self._stream.r_frame_rate)
4661 *
4662 */
4663
4664 /* Python wrapper */
4665 static PyObject *__pyx_pw_2av_6stream_6Stream_9base_rate_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_2av_6stream_6Stream_9base_rate_1__get__(PyObject * __pyx_v_self)4666 static PyObject *__pyx_pw_2av_6stream_6Stream_9base_rate_1__get__(PyObject *__pyx_v_self) {
4667 PyObject *__pyx_r = 0;
4668 __Pyx_RefNannyDeclarations
4669 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
4670 __pyx_r = __pyx_pf_2av_6stream_6Stream_9base_rate___get__(((struct __pyx_obj_2av_6stream_Stream *)__pyx_v_self));
4671
4672 /* function exit code */
4673 __Pyx_RefNannyFinishContext();
4674 return __pyx_r;
4675 }
4676
__pyx_pf_2av_6stream_6Stream_9base_rate___get__(struct __pyx_obj_2av_6stream_Stream * __pyx_v_self)4677 static PyObject *__pyx_pf_2av_6stream_6Stream_9base_rate___get__(struct __pyx_obj_2av_6stream_Stream *__pyx_v_self) {
4678 PyObject *__pyx_r = NULL;
4679 __Pyx_RefNannyDeclarations
4680 PyObject *__pyx_t_1 = NULL;
4681 int __pyx_lineno = 0;
4682 const char *__pyx_filename = NULL;
4683 int __pyx_clineno = 0;
4684 __Pyx_RefNannySetupContext("__get__", 0);
4685
4686 /* "av/stream.pyx":261
4687 * """
4688 * def __get__(self):
4689 * return avrational_to_fraction(&self._stream.r_frame_rate) # <<<<<<<<<<<<<<
4690 *
4691 * property guessed_rate:
4692 */
4693 __Pyx_XDECREF(__pyx_r);
4694 __pyx_t_1 = __pyx_f_2av_5utils_avrational_to_fraction((&__pyx_v_self->_stream->r_frame_rate)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 261, __pyx_L1_error)
4695 __Pyx_GOTREF(__pyx_t_1);
4696 __pyx_r = __pyx_t_1;
4697 __pyx_t_1 = 0;
4698 goto __pyx_L0;
4699
4700 /* "av/stream.pyx":260
4701 *
4702 * """
4703 * def __get__(self): # <<<<<<<<<<<<<<
4704 * return avrational_to_fraction(&self._stream.r_frame_rate)
4705 *
4706 */
4707
4708 /* function exit code */
4709 __pyx_L1_error:;
4710 __Pyx_XDECREF(__pyx_t_1);
4711 __Pyx_AddTraceback("av.stream.Stream.base_rate.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4712 __pyx_r = NULL;
4713 __pyx_L0:;
4714 __Pyx_XGIVEREF(__pyx_r);
4715 __Pyx_RefNannyFinishContext();
4716 return __pyx_r;
4717 }
4718
4719 /* "av/stream.pyx":272
4720 *
4721 * """
4722 * def __get__(self): # <<<<<<<<<<<<<<
4723 * # The two NULL arguments aren't used in FFmpeg >= 4.0
4724 * cdef lib.AVRational val = lib.av_guess_frame_rate(NULL, self._stream, NULL)
4725 */
4726
4727 /* Python wrapper */
4728 static PyObject *__pyx_pw_2av_6stream_6Stream_12guessed_rate_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_2av_6stream_6Stream_12guessed_rate_1__get__(PyObject * __pyx_v_self)4729 static PyObject *__pyx_pw_2av_6stream_6Stream_12guessed_rate_1__get__(PyObject *__pyx_v_self) {
4730 PyObject *__pyx_r = 0;
4731 __Pyx_RefNannyDeclarations
4732 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
4733 __pyx_r = __pyx_pf_2av_6stream_6Stream_12guessed_rate___get__(((struct __pyx_obj_2av_6stream_Stream *)__pyx_v_self));
4734
4735 /* function exit code */
4736 __Pyx_RefNannyFinishContext();
4737 return __pyx_r;
4738 }
4739
__pyx_pf_2av_6stream_6Stream_12guessed_rate___get__(struct __pyx_obj_2av_6stream_Stream * __pyx_v_self)4740 static PyObject *__pyx_pf_2av_6stream_6Stream_12guessed_rate___get__(struct __pyx_obj_2av_6stream_Stream *__pyx_v_self) {
4741 AVRational __pyx_v_val;
4742 PyObject *__pyx_r = NULL;
4743 __Pyx_RefNannyDeclarations
4744 PyObject *__pyx_t_1 = NULL;
4745 int __pyx_lineno = 0;
4746 const char *__pyx_filename = NULL;
4747 int __pyx_clineno = 0;
4748 __Pyx_RefNannySetupContext("__get__", 0);
4749
4750 /* "av/stream.pyx":274
4751 * def __get__(self):
4752 * # The two NULL arguments aren't used in FFmpeg >= 4.0
4753 * cdef lib.AVRational val = lib.av_guess_frame_rate(NULL, self._stream, NULL) # <<<<<<<<<<<<<<
4754 * return avrational_to_fraction(&val)
4755 *
4756 */
4757 __pyx_v_val = av_guess_frame_rate(NULL, __pyx_v_self->_stream, NULL);
4758
4759 /* "av/stream.pyx":275
4760 * # The two NULL arguments aren't used in FFmpeg >= 4.0
4761 * cdef lib.AVRational val = lib.av_guess_frame_rate(NULL, self._stream, NULL)
4762 * return avrational_to_fraction(&val) # <<<<<<<<<<<<<<
4763 *
4764 * property start_time:
4765 */
4766 __Pyx_XDECREF(__pyx_r);
4767 __pyx_t_1 = __pyx_f_2av_5utils_avrational_to_fraction((&__pyx_v_val)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 275, __pyx_L1_error)
4768 __Pyx_GOTREF(__pyx_t_1);
4769 __pyx_r = __pyx_t_1;
4770 __pyx_t_1 = 0;
4771 goto __pyx_L0;
4772
4773 /* "av/stream.pyx":272
4774 *
4775 * """
4776 * def __get__(self): # <<<<<<<<<<<<<<
4777 * # The two NULL arguments aren't used in FFmpeg >= 4.0
4778 * cdef lib.AVRational val = lib.av_guess_frame_rate(NULL, self._stream, NULL)
4779 */
4780
4781 /* function exit code */
4782 __pyx_L1_error:;
4783 __Pyx_XDECREF(__pyx_t_1);
4784 __Pyx_AddTraceback("av.stream.Stream.guessed_rate.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4785 __pyx_r = NULL;
4786 __pyx_L0:;
4787 __Pyx_XGIVEREF(__pyx_r);
4788 __Pyx_RefNannyFinishContext();
4789 return __pyx_r;
4790 }
4791
4792 /* "av/stream.pyx":284
4793 * :type: :class:`int` or ``None``
4794 * """
4795 * def __get__(self): # <<<<<<<<<<<<<<
4796 * if self._stream.start_time != lib.AV_NOPTS_VALUE:
4797 * return self._stream.start_time
4798 */
4799
4800 /* Python wrapper */
4801 static PyObject *__pyx_pw_2av_6stream_6Stream_10start_time_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_2av_6stream_6Stream_10start_time_1__get__(PyObject * __pyx_v_self)4802 static PyObject *__pyx_pw_2av_6stream_6Stream_10start_time_1__get__(PyObject *__pyx_v_self) {
4803 PyObject *__pyx_r = 0;
4804 __Pyx_RefNannyDeclarations
4805 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
4806 __pyx_r = __pyx_pf_2av_6stream_6Stream_10start_time___get__(((struct __pyx_obj_2av_6stream_Stream *)__pyx_v_self));
4807
4808 /* function exit code */
4809 __Pyx_RefNannyFinishContext();
4810 return __pyx_r;
4811 }
4812
__pyx_pf_2av_6stream_6Stream_10start_time___get__(struct __pyx_obj_2av_6stream_Stream * __pyx_v_self)4813 static PyObject *__pyx_pf_2av_6stream_6Stream_10start_time___get__(struct __pyx_obj_2av_6stream_Stream *__pyx_v_self) {
4814 PyObject *__pyx_r = NULL;
4815 __Pyx_RefNannyDeclarations
4816 int __pyx_t_1;
4817 PyObject *__pyx_t_2 = NULL;
4818 int __pyx_lineno = 0;
4819 const char *__pyx_filename = NULL;
4820 int __pyx_clineno = 0;
4821 __Pyx_RefNannySetupContext("__get__", 0);
4822
4823 /* "av/stream.pyx":285
4824 * """
4825 * def __get__(self):
4826 * if self._stream.start_time != lib.AV_NOPTS_VALUE: # <<<<<<<<<<<<<<
4827 * return self._stream.start_time
4828 *
4829 */
4830 __pyx_t_1 = ((__pyx_v_self->_stream->start_time != AV_NOPTS_VALUE) != 0);
4831 if (__pyx_t_1) {
4832
4833 /* "av/stream.pyx":286
4834 * def __get__(self):
4835 * if self._stream.start_time != lib.AV_NOPTS_VALUE:
4836 * return self._stream.start_time # <<<<<<<<<<<<<<
4837 *
4838 * property duration:
4839 */
4840 __Pyx_XDECREF(__pyx_r);
4841 __pyx_t_2 = __Pyx_PyInt_From_int64_t(__pyx_v_self->_stream->start_time); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 286, __pyx_L1_error)
4842 __Pyx_GOTREF(__pyx_t_2);
4843 __pyx_r = __pyx_t_2;
4844 __pyx_t_2 = 0;
4845 goto __pyx_L0;
4846
4847 /* "av/stream.pyx":285
4848 * """
4849 * def __get__(self):
4850 * if self._stream.start_time != lib.AV_NOPTS_VALUE: # <<<<<<<<<<<<<<
4851 * return self._stream.start_time
4852 *
4853 */
4854 }
4855
4856 /* "av/stream.pyx":284
4857 * :type: :class:`int` or ``None``
4858 * """
4859 * def __get__(self): # <<<<<<<<<<<<<<
4860 * if self._stream.start_time != lib.AV_NOPTS_VALUE:
4861 * return self._stream.start_time
4862 */
4863
4864 /* function exit code */
4865 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4866 goto __pyx_L0;
4867 __pyx_L1_error:;
4868 __Pyx_XDECREF(__pyx_t_2);
4869 __Pyx_AddTraceback("av.stream.Stream.start_time.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4870 __pyx_r = NULL;
4871 __pyx_L0:;
4872 __Pyx_XGIVEREF(__pyx_r);
4873 __Pyx_RefNannyFinishContext();
4874 return __pyx_r;
4875 }
4876
4877 /* "av/stream.pyx":295
4878 *
4879 * """
4880 * def __get__(self): # <<<<<<<<<<<<<<
4881 * if self._stream.duration != lib.AV_NOPTS_VALUE:
4882 * return self._stream.duration
4883 */
4884
4885 /* Python wrapper */
4886 static PyObject *__pyx_pw_2av_6stream_6Stream_8duration_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_2av_6stream_6Stream_8duration_1__get__(PyObject * __pyx_v_self)4887 static PyObject *__pyx_pw_2av_6stream_6Stream_8duration_1__get__(PyObject *__pyx_v_self) {
4888 PyObject *__pyx_r = 0;
4889 __Pyx_RefNannyDeclarations
4890 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
4891 __pyx_r = __pyx_pf_2av_6stream_6Stream_8duration___get__(((struct __pyx_obj_2av_6stream_Stream *)__pyx_v_self));
4892
4893 /* function exit code */
4894 __Pyx_RefNannyFinishContext();
4895 return __pyx_r;
4896 }
4897
__pyx_pf_2av_6stream_6Stream_8duration___get__(struct __pyx_obj_2av_6stream_Stream * __pyx_v_self)4898 static PyObject *__pyx_pf_2av_6stream_6Stream_8duration___get__(struct __pyx_obj_2av_6stream_Stream *__pyx_v_self) {
4899 PyObject *__pyx_r = NULL;
4900 __Pyx_RefNannyDeclarations
4901 int __pyx_t_1;
4902 PyObject *__pyx_t_2 = NULL;
4903 int __pyx_lineno = 0;
4904 const char *__pyx_filename = NULL;
4905 int __pyx_clineno = 0;
4906 __Pyx_RefNannySetupContext("__get__", 0);
4907
4908 /* "av/stream.pyx":296
4909 * """
4910 * def __get__(self):
4911 * if self._stream.duration != lib.AV_NOPTS_VALUE: # <<<<<<<<<<<<<<
4912 * return self._stream.duration
4913 *
4914 */
4915 __pyx_t_1 = ((__pyx_v_self->_stream->duration != AV_NOPTS_VALUE) != 0);
4916 if (__pyx_t_1) {
4917
4918 /* "av/stream.pyx":297
4919 * def __get__(self):
4920 * if self._stream.duration != lib.AV_NOPTS_VALUE:
4921 * return self._stream.duration # <<<<<<<<<<<<<<
4922 *
4923 * property frames:
4924 */
4925 __Pyx_XDECREF(__pyx_r);
4926 __pyx_t_2 = __Pyx_PyInt_From_int64_t(__pyx_v_self->_stream->duration); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 297, __pyx_L1_error)
4927 __Pyx_GOTREF(__pyx_t_2);
4928 __pyx_r = __pyx_t_2;
4929 __pyx_t_2 = 0;
4930 goto __pyx_L0;
4931
4932 /* "av/stream.pyx":296
4933 * """
4934 * def __get__(self):
4935 * if self._stream.duration != lib.AV_NOPTS_VALUE: # <<<<<<<<<<<<<<
4936 * return self._stream.duration
4937 *
4938 */
4939 }
4940
4941 /* "av/stream.pyx":295
4942 *
4943 * """
4944 * def __get__(self): # <<<<<<<<<<<<<<
4945 * if self._stream.duration != lib.AV_NOPTS_VALUE:
4946 * return self._stream.duration
4947 */
4948
4949 /* function exit code */
4950 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
4951 goto __pyx_L0;
4952 __pyx_L1_error:;
4953 __Pyx_XDECREF(__pyx_t_2);
4954 __Pyx_AddTraceback("av.stream.Stream.duration.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
4955 __pyx_r = NULL;
4956 __pyx_L0:;
4957 __Pyx_XGIVEREF(__pyx_r);
4958 __Pyx_RefNannyFinishContext();
4959 return __pyx_r;
4960 }
4961
4962 /* "av/stream.pyx":307
4963 * :type: int
4964 * """
4965 * def __get__(self): return self._stream.nb_frames # <<<<<<<<<<<<<<
4966 *
4967 * property language:
4968 */
4969
4970 /* Python wrapper */
4971 static PyObject *__pyx_pw_2av_6stream_6Stream_6frames_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_2av_6stream_6Stream_6frames_1__get__(PyObject * __pyx_v_self)4972 static PyObject *__pyx_pw_2av_6stream_6Stream_6frames_1__get__(PyObject *__pyx_v_self) {
4973 PyObject *__pyx_r = 0;
4974 __Pyx_RefNannyDeclarations
4975 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
4976 __pyx_r = __pyx_pf_2av_6stream_6Stream_6frames___get__(((struct __pyx_obj_2av_6stream_Stream *)__pyx_v_self));
4977
4978 /* function exit code */
4979 __Pyx_RefNannyFinishContext();
4980 return __pyx_r;
4981 }
4982
__pyx_pf_2av_6stream_6Stream_6frames___get__(struct __pyx_obj_2av_6stream_Stream * __pyx_v_self)4983 static PyObject *__pyx_pf_2av_6stream_6Stream_6frames___get__(struct __pyx_obj_2av_6stream_Stream *__pyx_v_self) {
4984 PyObject *__pyx_r = NULL;
4985 __Pyx_RefNannyDeclarations
4986 PyObject *__pyx_t_1 = NULL;
4987 int __pyx_lineno = 0;
4988 const char *__pyx_filename = NULL;
4989 int __pyx_clineno = 0;
4990 __Pyx_RefNannySetupContext("__get__", 0);
4991 __Pyx_XDECREF(__pyx_r);
4992 __pyx_t_1 = __Pyx_PyInt_From_int64_t(__pyx_v_self->_stream->nb_frames); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 307, __pyx_L1_error)
4993 __Pyx_GOTREF(__pyx_t_1);
4994 __pyx_r = __pyx_t_1;
4995 __pyx_t_1 = 0;
4996 goto __pyx_L0;
4997
4998 /* function exit code */
4999 __pyx_L1_error:;
5000 __Pyx_XDECREF(__pyx_t_1);
5001 __Pyx_AddTraceback("av.stream.Stream.frames.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5002 __pyx_r = NULL;
5003 __pyx_L0:;
5004 __Pyx_XGIVEREF(__pyx_r);
5005 __Pyx_RefNannyFinishContext();
5006 return __pyx_r;
5007 }
5008
5009 /* "av/stream.pyx":315
5010 * :type: :class:``str`` or ``None``
5011 * """
5012 * def __get__(self): # <<<<<<<<<<<<<<
5013 * return self.metadata.get('language')
5014 *
5015 */
5016
5017 /* Python wrapper */
5018 static PyObject *__pyx_pw_2av_6stream_6Stream_8language_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_2av_6stream_6Stream_8language_1__get__(PyObject * __pyx_v_self)5019 static PyObject *__pyx_pw_2av_6stream_6Stream_8language_1__get__(PyObject *__pyx_v_self) {
5020 PyObject *__pyx_r = 0;
5021 __Pyx_RefNannyDeclarations
5022 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
5023 __pyx_r = __pyx_pf_2av_6stream_6Stream_8language___get__(((struct __pyx_obj_2av_6stream_Stream *)__pyx_v_self));
5024
5025 /* function exit code */
5026 __Pyx_RefNannyFinishContext();
5027 return __pyx_r;
5028 }
5029
__pyx_pf_2av_6stream_6Stream_8language___get__(struct __pyx_obj_2av_6stream_Stream * __pyx_v_self)5030 static PyObject *__pyx_pf_2av_6stream_6Stream_8language___get__(struct __pyx_obj_2av_6stream_Stream *__pyx_v_self) {
5031 PyObject *__pyx_r = NULL;
5032 __Pyx_RefNannyDeclarations
5033 PyObject *__pyx_t_1 = NULL;
5034 int __pyx_lineno = 0;
5035 const char *__pyx_filename = NULL;
5036 int __pyx_clineno = 0;
5037 __Pyx_RefNannySetupContext("__get__", 0);
5038
5039 /* "av/stream.pyx":316
5040 * """
5041 * def __get__(self):
5042 * return self.metadata.get('language') # <<<<<<<<<<<<<<
5043 *
5044 * @property
5045 */
5046 __Pyx_XDECREF(__pyx_r);
5047 if (unlikely(__pyx_v_self->metadata == Py_None)) {
5048 PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "get");
5049 __PYX_ERR(0, 316, __pyx_L1_error)
5050 }
5051 __pyx_t_1 = __Pyx_PyDict_GetItemDefault(__pyx_v_self->metadata, __pyx_n_s_language, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 316, __pyx_L1_error)
5052 __Pyx_GOTREF(__pyx_t_1);
5053 __pyx_r = __pyx_t_1;
5054 __pyx_t_1 = 0;
5055 goto __pyx_L0;
5056
5057 /* "av/stream.pyx":315
5058 * :type: :class:``str`` or ``None``
5059 * """
5060 * def __get__(self): # <<<<<<<<<<<<<<
5061 * return self.metadata.get('language')
5062 *
5063 */
5064
5065 /* function exit code */
5066 __pyx_L1_error:;
5067 __Pyx_XDECREF(__pyx_t_1);
5068 __Pyx_AddTraceback("av.stream.Stream.language.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5069 __pyx_r = NULL;
5070 __pyx_L0:;
5071 __Pyx_XGIVEREF(__pyx_r);
5072 __Pyx_RefNannyFinishContext();
5073 return __pyx_r;
5074 }
5075
5076 /* "av/stream.pyx":319
5077 *
5078 * @property
5079 * def type(self): # <<<<<<<<<<<<<<
5080 * """
5081 * The type of the stream.
5082 */
5083
5084 /* Python wrapper */
5085 static PyObject *__pyx_pw_2av_6stream_6Stream_4type_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_2av_6stream_6Stream_4type_1__get__(PyObject * __pyx_v_self)5086 static PyObject *__pyx_pw_2av_6stream_6Stream_4type_1__get__(PyObject *__pyx_v_self) {
5087 PyObject *__pyx_r = 0;
5088 __Pyx_RefNannyDeclarations
5089 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
5090 __pyx_r = __pyx_pf_2av_6stream_6Stream_4type___get__(((struct __pyx_obj_2av_6stream_Stream *)__pyx_v_self));
5091
5092 /* function exit code */
5093 __Pyx_RefNannyFinishContext();
5094 return __pyx_r;
5095 }
5096
__pyx_pf_2av_6stream_6Stream_4type___get__(struct __pyx_obj_2av_6stream_Stream * __pyx_v_self)5097 static PyObject *__pyx_pf_2av_6stream_6Stream_4type___get__(struct __pyx_obj_2av_6stream_Stream *__pyx_v_self) {
5098 PyObject *__pyx_r = NULL;
5099 __Pyx_RefNannyDeclarations
5100 PyObject *__pyx_t_1 = NULL;
5101 int __pyx_lineno = 0;
5102 const char *__pyx_filename = NULL;
5103 int __pyx_clineno = 0;
5104 __Pyx_RefNannySetupContext("__get__", 0);
5105
5106 /* "av/stream.pyx":327
5107 * :type: str
5108 * """
5109 * return lib.av_get_media_type_string(self._codec_context.codec_type) # <<<<<<<<<<<<<<
5110 */
5111 __Pyx_XDECREF(__pyx_r);
5112 __pyx_t_1 = __Pyx_PyStr_FromString(av_get_media_type_string(__pyx_v_self->_codec_context->codec_type)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 327, __pyx_L1_error)
5113 __Pyx_GOTREF(__pyx_t_1);
5114 __pyx_r = __pyx_t_1;
5115 __pyx_t_1 = 0;
5116 goto __pyx_L0;
5117
5118 /* "av/stream.pyx":319
5119 *
5120 * @property
5121 * def type(self): # <<<<<<<<<<<<<<
5122 * """
5123 * The type of the stream.
5124 */
5125
5126 /* function exit code */
5127 __pyx_L1_error:;
5128 __Pyx_XDECREF(__pyx_t_1);
5129 __Pyx_AddTraceback("av.stream.Stream.type.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5130 __pyx_r = NULL;
5131 __pyx_L0:;
5132 __Pyx_XGIVEREF(__pyx_r);
5133 __Pyx_RefNannyFinishContext();
5134 return __pyx_r;
5135 }
5136
5137 /* "av/stream.pxd":13
5138 *
5139 * # Stream attributes.
5140 * cdef readonly Container container # <<<<<<<<<<<<<<
5141 *
5142 * cdef lib.AVStream *_stream
5143 */
5144
5145 /* Python wrapper */
5146 static PyObject *__pyx_pw_2av_6stream_6Stream_9container_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_2av_6stream_6Stream_9container_1__get__(PyObject * __pyx_v_self)5147 static PyObject *__pyx_pw_2av_6stream_6Stream_9container_1__get__(PyObject *__pyx_v_self) {
5148 PyObject *__pyx_r = 0;
5149 __Pyx_RefNannyDeclarations
5150 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
5151 __pyx_r = __pyx_pf_2av_6stream_6Stream_9container___get__(((struct __pyx_obj_2av_6stream_Stream *)__pyx_v_self));
5152
5153 /* function exit code */
5154 __Pyx_RefNannyFinishContext();
5155 return __pyx_r;
5156 }
5157
__pyx_pf_2av_6stream_6Stream_9container___get__(struct __pyx_obj_2av_6stream_Stream * __pyx_v_self)5158 static PyObject *__pyx_pf_2av_6stream_6Stream_9container___get__(struct __pyx_obj_2av_6stream_Stream *__pyx_v_self) {
5159 PyObject *__pyx_r = NULL;
5160 __Pyx_RefNannyDeclarations
5161 __Pyx_RefNannySetupContext("__get__", 0);
5162 __Pyx_XDECREF(__pyx_r);
5163 __Pyx_INCREF(((PyObject *)__pyx_v_self->container));
5164 __pyx_r = ((PyObject *)__pyx_v_self->container);
5165 goto __pyx_L0;
5166
5167 /* function exit code */
5168 __pyx_L0:;
5169 __Pyx_XGIVEREF(__pyx_r);
5170 __Pyx_RefNannyFinishContext();
5171 return __pyx_r;
5172 }
5173
5174 /* "av/stream.pxd":16
5175 *
5176 * cdef lib.AVStream *_stream
5177 * cdef readonly dict metadata # <<<<<<<<<<<<<<
5178 *
5179 * # CodecContext attributes.
5180 */
5181
5182 /* Python wrapper */
5183 static PyObject *__pyx_pw_2av_6stream_6Stream_8metadata_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_2av_6stream_6Stream_8metadata_1__get__(PyObject * __pyx_v_self)5184 static PyObject *__pyx_pw_2av_6stream_6Stream_8metadata_1__get__(PyObject *__pyx_v_self) {
5185 PyObject *__pyx_r = 0;
5186 __Pyx_RefNannyDeclarations
5187 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
5188 __pyx_r = __pyx_pf_2av_6stream_6Stream_8metadata___get__(((struct __pyx_obj_2av_6stream_Stream *)__pyx_v_self));
5189
5190 /* function exit code */
5191 __Pyx_RefNannyFinishContext();
5192 return __pyx_r;
5193 }
5194
__pyx_pf_2av_6stream_6Stream_8metadata___get__(struct __pyx_obj_2av_6stream_Stream * __pyx_v_self)5195 static PyObject *__pyx_pf_2av_6stream_6Stream_8metadata___get__(struct __pyx_obj_2av_6stream_Stream *__pyx_v_self) {
5196 PyObject *__pyx_r = NULL;
5197 __Pyx_RefNannyDeclarations
5198 __Pyx_RefNannySetupContext("__get__", 0);
5199 __Pyx_XDECREF(__pyx_r);
5200 __Pyx_INCREF(__pyx_v_self->metadata);
5201 __pyx_r = __pyx_v_self->metadata;
5202 goto __pyx_L0;
5203
5204 /* function exit code */
5205 __pyx_L0:;
5206 __Pyx_XGIVEREF(__pyx_r);
5207 __Pyx_RefNannyFinishContext();
5208 return __pyx_r;
5209 }
5210
5211 /* "av/stream.pxd":22
5212 * cdef const lib.AVCodec *_codec
5213 *
5214 * cdef readonly CodecContext codec_context # <<<<<<<<<<<<<<
5215 *
5216 * # Private API.
5217 */
5218
5219 /* Python wrapper */
5220 static PyObject *__pyx_pw_2av_6stream_6Stream_13codec_context_1__get__(PyObject *__pyx_v_self); /*proto*/
__pyx_pw_2av_6stream_6Stream_13codec_context_1__get__(PyObject * __pyx_v_self)5221 static PyObject *__pyx_pw_2av_6stream_6Stream_13codec_context_1__get__(PyObject *__pyx_v_self) {
5222 PyObject *__pyx_r = 0;
5223 __Pyx_RefNannyDeclarations
5224 __Pyx_RefNannySetupContext("__get__ (wrapper)", 0);
5225 __pyx_r = __pyx_pf_2av_6stream_6Stream_13codec_context___get__(((struct __pyx_obj_2av_6stream_Stream *)__pyx_v_self));
5226
5227 /* function exit code */
5228 __Pyx_RefNannyFinishContext();
5229 return __pyx_r;
5230 }
5231
__pyx_pf_2av_6stream_6Stream_13codec_context___get__(struct __pyx_obj_2av_6stream_Stream * __pyx_v_self)5232 static PyObject *__pyx_pf_2av_6stream_6Stream_13codec_context___get__(struct __pyx_obj_2av_6stream_Stream *__pyx_v_self) {
5233 PyObject *__pyx_r = NULL;
5234 __Pyx_RefNannyDeclarations
5235 __Pyx_RefNannySetupContext("__get__", 0);
5236 __Pyx_XDECREF(__pyx_r);
5237 __Pyx_INCREF(((PyObject *)__pyx_v_self->codec_context));
5238 __pyx_r = ((PyObject *)__pyx_v_self->codec_context);
5239 goto __pyx_L0;
5240
5241 /* function exit code */
5242 __pyx_L0:;
5243 __Pyx_XGIVEREF(__pyx_r);
5244 __Pyx_RefNannyFinishContext();
5245 return __pyx_r;
5246 }
5247
5248 /* "(tree fragment)":1
5249 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
5250 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
5251 * def __setstate_cython__(self, __pyx_state):
5252 */
5253
5254 /* Python wrapper */
5255 static PyObject *__pyx_pw_2av_6stream_6Stream_15__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
5256 static char __pyx_doc_2av_6stream_6Stream_14__reduce_cython__[] = "Stream.__reduce_cython__()";
__pyx_pw_2av_6stream_6Stream_15__reduce_cython__(PyObject * __pyx_v_self,CYTHON_UNUSED PyObject * unused)5257 static PyObject *__pyx_pw_2av_6stream_6Stream_15__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
5258 PyObject *__pyx_r = 0;
5259 __Pyx_RefNannyDeclarations
5260 __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0);
5261 __pyx_r = __pyx_pf_2av_6stream_6Stream_14__reduce_cython__(((struct __pyx_obj_2av_6stream_Stream *)__pyx_v_self));
5262
5263 /* function exit code */
5264 __Pyx_RefNannyFinishContext();
5265 return __pyx_r;
5266 }
5267
__pyx_pf_2av_6stream_6Stream_14__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_2av_6stream_Stream * __pyx_v_self)5268 static PyObject *__pyx_pf_2av_6stream_6Stream_14__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_2av_6stream_Stream *__pyx_v_self) {
5269 PyObject *__pyx_r = NULL;
5270 __Pyx_RefNannyDeclarations
5271 PyObject *__pyx_t_1 = NULL;
5272 int __pyx_lineno = 0;
5273 const char *__pyx_filename = NULL;
5274 int __pyx_clineno = 0;
5275 __Pyx_RefNannySetupContext("__reduce_cython__", 0);
5276
5277 /* "(tree fragment)":2
5278 * def __reduce_cython__(self):
5279 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
5280 * def __setstate_cython__(self, __pyx_state):
5281 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
5282 */
5283 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error)
5284 __Pyx_GOTREF(__pyx_t_1);
5285 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
5286 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5287 __PYX_ERR(1, 2, __pyx_L1_error)
5288
5289 /* "(tree fragment)":1
5290 * def __reduce_cython__(self): # <<<<<<<<<<<<<<
5291 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
5292 * def __setstate_cython__(self, __pyx_state):
5293 */
5294
5295 /* function exit code */
5296 __pyx_L1_error:;
5297 __Pyx_XDECREF(__pyx_t_1);
5298 __Pyx_AddTraceback("av.stream.Stream.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5299 __pyx_r = NULL;
5300 __Pyx_XGIVEREF(__pyx_r);
5301 __Pyx_RefNannyFinishContext();
5302 return __pyx_r;
5303 }
5304
5305 /* "(tree fragment)":3
5306 * def __reduce_cython__(self):
5307 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
5308 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
5309 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
5310 */
5311
5312 /* Python wrapper */
5313 static PyObject *__pyx_pw_2av_6stream_6Stream_17__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/
5314 static char __pyx_doc_2av_6stream_6Stream_16__setstate_cython__[] = "Stream.__setstate_cython__(__pyx_state)";
__pyx_pw_2av_6stream_6Stream_17__setstate_cython__(PyObject * __pyx_v_self,PyObject * __pyx_v___pyx_state)5315 static PyObject *__pyx_pw_2av_6stream_6Stream_17__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) {
5316 PyObject *__pyx_r = 0;
5317 __Pyx_RefNannyDeclarations
5318 __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0);
5319 __pyx_r = __pyx_pf_2av_6stream_6Stream_16__setstate_cython__(((struct __pyx_obj_2av_6stream_Stream *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state));
5320
5321 /* function exit code */
5322 __Pyx_RefNannyFinishContext();
5323 return __pyx_r;
5324 }
5325
__pyx_pf_2av_6stream_6Stream_16__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_2av_6stream_Stream * __pyx_v_self,CYTHON_UNUSED PyObject * __pyx_v___pyx_state)5326 static PyObject *__pyx_pf_2av_6stream_6Stream_16__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_2av_6stream_Stream *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) {
5327 PyObject *__pyx_r = NULL;
5328 __Pyx_RefNannyDeclarations
5329 PyObject *__pyx_t_1 = NULL;
5330 int __pyx_lineno = 0;
5331 const char *__pyx_filename = NULL;
5332 int __pyx_clineno = 0;
5333 __Pyx_RefNannySetupContext("__setstate_cython__", 0);
5334
5335 /* "(tree fragment)":4
5336 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
5337 * def __setstate_cython__(self, __pyx_state):
5338 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
5339 */
5340 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error)
5341 __Pyx_GOTREF(__pyx_t_1);
5342 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
5343 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5344 __PYX_ERR(1, 4, __pyx_L1_error)
5345
5346 /* "(tree fragment)":3
5347 * def __reduce_cython__(self):
5348 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
5349 * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<<
5350 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
5351 */
5352
5353 /* function exit code */
5354 __pyx_L1_error:;
5355 __Pyx_XDECREF(__pyx_t_1);
5356 __Pyx_AddTraceback("av.stream.Stream.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename);
5357 __pyx_r = NULL;
5358 __Pyx_XGIVEREF(__pyx_r);
5359 __Pyx_RefNannyFinishContext();
5360 return __pyx_r;
5361 }
5362 static struct __pyx_vtabstruct_2av_6stream_Stream __pyx_vtable_2av_6stream_Stream;
5363
__pyx_tp_new_2av_6stream_Stream(PyTypeObject * t,PyObject * a,PyObject * k)5364 static PyObject *__pyx_tp_new_2av_6stream_Stream(PyTypeObject *t, PyObject *a, PyObject *k) {
5365 struct __pyx_obj_2av_6stream_Stream *p;
5366 PyObject *o;
5367 if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
5368 o = (*t->tp_alloc)(t, 0);
5369 } else {
5370 o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
5371 }
5372 if (unlikely(!o)) return 0;
5373 p = ((struct __pyx_obj_2av_6stream_Stream *)o);
5374 p->__pyx_vtab = __pyx_vtabptr_2av_6stream_Stream;
5375 p->container = ((struct __pyx_obj_2av_9container_4core_Container *)Py_None); Py_INCREF(Py_None);
5376 p->metadata = ((PyObject*)Py_None); Py_INCREF(Py_None);
5377 p->codec_context = ((struct __pyx_obj_2av_5codec_7context_CodecContext *)Py_None); Py_INCREF(Py_None);
5378 if (unlikely(__pyx_pw_2av_6stream_6Stream_1__cinit__(o, a, k) < 0)) goto bad;
5379 return o;
5380 bad:
5381 Py_DECREF(o); o = 0;
5382 return NULL;
5383 }
5384
__pyx_tp_dealloc_2av_6stream_Stream(PyObject * o)5385 static void __pyx_tp_dealloc_2av_6stream_Stream(PyObject *o) {
5386 struct __pyx_obj_2av_6stream_Stream *p = (struct __pyx_obj_2av_6stream_Stream *)o;
5387 #if CYTHON_USE_TP_FINALIZE
5388 if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) {
5389 if (PyObject_CallFinalizerFromDealloc(o)) return;
5390 }
5391 #endif
5392 PyObject_GC_UnTrack(o);
5393 Py_CLEAR(p->container);
5394 Py_CLEAR(p->metadata);
5395 Py_CLEAR(p->codec_context);
5396 (*Py_TYPE(o)->tp_free)(o);
5397 }
5398
__pyx_tp_traverse_2av_6stream_Stream(PyObject * o,visitproc v,void * a)5399 static int __pyx_tp_traverse_2av_6stream_Stream(PyObject *o, visitproc v, void *a) {
5400 int e;
5401 struct __pyx_obj_2av_6stream_Stream *p = (struct __pyx_obj_2av_6stream_Stream *)o;
5402 if (p->container) {
5403 e = (*v)(((PyObject *)p->container), a); if (e) return e;
5404 }
5405 if (p->metadata) {
5406 e = (*v)(p->metadata, a); if (e) return e;
5407 }
5408 if (p->codec_context) {
5409 e = (*v)(((PyObject *)p->codec_context), a); if (e) return e;
5410 }
5411 return 0;
5412 }
5413
__pyx_tp_clear_2av_6stream_Stream(PyObject * o)5414 static int __pyx_tp_clear_2av_6stream_Stream(PyObject *o) {
5415 PyObject* tmp;
5416 struct __pyx_obj_2av_6stream_Stream *p = (struct __pyx_obj_2av_6stream_Stream *)o;
5417 tmp = ((PyObject*)p->container);
5418 p->container = ((struct __pyx_obj_2av_9container_4core_Container *)Py_None); Py_INCREF(Py_None);
5419 Py_XDECREF(tmp);
5420 tmp = ((PyObject*)p->metadata);
5421 p->metadata = ((PyObject*)Py_None); Py_INCREF(Py_None);
5422 Py_XDECREF(tmp);
5423 tmp = ((PyObject*)p->codec_context);
5424 p->codec_context = ((struct __pyx_obj_2av_5codec_7context_CodecContext *)Py_None); Py_INCREF(Py_None);
5425 Py_XDECREF(tmp);
5426 return 0;
5427 }
5428
__pyx_tp_getattro_2av_6stream_Stream(PyObject * o,PyObject * n)5429 static PyObject *__pyx_tp_getattro_2av_6stream_Stream(PyObject *o, PyObject *n) {
5430 PyObject *v = __Pyx_PyObject_GenericGetAttr(o, n);
5431 if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) {
5432 PyErr_Clear();
5433 v = __pyx_pw_2av_6stream_6Stream_5__getattr__(o, n);
5434 }
5435 return v;
5436 }
5437
__pyx_tp_setattro_2av_6stream_Stream(PyObject * o,PyObject * n,PyObject * v)5438 static int __pyx_tp_setattro_2av_6stream_Stream(PyObject *o, PyObject *n, PyObject *v) {
5439 if (v) {
5440 return __pyx_pw_2av_6stream_6Stream_7__setattr__(o, n, v);
5441 }
5442 else {
5443 return PyObject_GenericSetAttr(o, n, 0);
5444 }
5445 }
5446
__pyx_getprop_2av_6stream_6Stream_id(PyObject * o,CYTHON_UNUSED void * x)5447 static PyObject *__pyx_getprop_2av_6stream_6Stream_id(PyObject *o, CYTHON_UNUSED void *x) {
5448 return __pyx_pw_2av_6stream_6Stream_2id_1__get__(o);
5449 }
5450
__pyx_setprop_2av_6stream_6Stream_id(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)5451 static int __pyx_setprop_2av_6stream_6Stream_id(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
5452 if (v) {
5453 return __pyx_pw_2av_6stream_6Stream_2id_3__set__(o, v);
5454 }
5455 else {
5456 PyErr_SetString(PyExc_NotImplementedError, "__del__");
5457 return -1;
5458 }
5459 }
5460
__pyx_getprop_2av_6stream_6Stream_profile(PyObject * o,CYTHON_UNUSED void * x)5461 static PyObject *__pyx_getprop_2av_6stream_6Stream_profile(PyObject *o, CYTHON_UNUSED void *x) {
5462 return __pyx_pw_2av_6stream_6Stream_7profile_1__get__(o);
5463 }
5464
__pyx_getprop_2av_6stream_6Stream_index(PyObject * o,CYTHON_UNUSED void * x)5465 static PyObject *__pyx_getprop_2av_6stream_6Stream_index(PyObject *o, CYTHON_UNUSED void *x) {
5466 return __pyx_pw_2av_6stream_6Stream_5index_1__get__(o);
5467 }
5468
__pyx_getprop_2av_6stream_6Stream_time_base(PyObject * o,CYTHON_UNUSED void * x)5469 static PyObject *__pyx_getprop_2av_6stream_6Stream_time_base(PyObject *o, CYTHON_UNUSED void *x) {
5470 return __pyx_pw_2av_6stream_6Stream_9time_base_1__get__(o);
5471 }
5472
__pyx_setprop_2av_6stream_6Stream_time_base(PyObject * o,PyObject * v,CYTHON_UNUSED void * x)5473 static int __pyx_setprop_2av_6stream_6Stream_time_base(PyObject *o, PyObject *v, CYTHON_UNUSED void *x) {
5474 if (v) {
5475 return __pyx_pw_2av_6stream_6Stream_9time_base_3__set__(o, v);
5476 }
5477 else {
5478 PyErr_SetString(PyExc_NotImplementedError, "__del__");
5479 return -1;
5480 }
5481 }
5482
__pyx_getprop_2av_6stream_6Stream_average_rate(PyObject * o,CYTHON_UNUSED void * x)5483 static PyObject *__pyx_getprop_2av_6stream_6Stream_average_rate(PyObject *o, CYTHON_UNUSED void *x) {
5484 return __pyx_pw_2av_6stream_6Stream_12average_rate_1__get__(o);
5485 }
5486
__pyx_getprop_2av_6stream_6Stream_base_rate(PyObject * o,CYTHON_UNUSED void * x)5487 static PyObject *__pyx_getprop_2av_6stream_6Stream_base_rate(PyObject *o, CYTHON_UNUSED void *x) {
5488 return __pyx_pw_2av_6stream_6Stream_9base_rate_1__get__(o);
5489 }
5490
__pyx_getprop_2av_6stream_6Stream_guessed_rate(PyObject * o,CYTHON_UNUSED void * x)5491 static PyObject *__pyx_getprop_2av_6stream_6Stream_guessed_rate(PyObject *o, CYTHON_UNUSED void *x) {
5492 return __pyx_pw_2av_6stream_6Stream_12guessed_rate_1__get__(o);
5493 }
5494
__pyx_getprop_2av_6stream_6Stream_start_time(PyObject * o,CYTHON_UNUSED void * x)5495 static PyObject *__pyx_getprop_2av_6stream_6Stream_start_time(PyObject *o, CYTHON_UNUSED void *x) {
5496 return __pyx_pw_2av_6stream_6Stream_10start_time_1__get__(o);
5497 }
5498
__pyx_getprop_2av_6stream_6Stream_duration(PyObject * o,CYTHON_UNUSED void * x)5499 static PyObject *__pyx_getprop_2av_6stream_6Stream_duration(PyObject *o, CYTHON_UNUSED void *x) {
5500 return __pyx_pw_2av_6stream_6Stream_8duration_1__get__(o);
5501 }
5502
__pyx_getprop_2av_6stream_6Stream_frames(PyObject * o,CYTHON_UNUSED void * x)5503 static PyObject *__pyx_getprop_2av_6stream_6Stream_frames(PyObject *o, CYTHON_UNUSED void *x) {
5504 return __pyx_pw_2av_6stream_6Stream_6frames_1__get__(o);
5505 }
5506
__pyx_getprop_2av_6stream_6Stream_language(PyObject * o,CYTHON_UNUSED void * x)5507 static PyObject *__pyx_getprop_2av_6stream_6Stream_language(PyObject *o, CYTHON_UNUSED void *x) {
5508 return __pyx_pw_2av_6stream_6Stream_8language_1__get__(o);
5509 }
5510
__pyx_getprop_2av_6stream_6Stream_type(PyObject * o,CYTHON_UNUSED void * x)5511 static PyObject *__pyx_getprop_2av_6stream_6Stream_type(PyObject *o, CYTHON_UNUSED void *x) {
5512 return __pyx_pw_2av_6stream_6Stream_4type_1__get__(o);
5513 }
5514
__pyx_getprop_2av_6stream_6Stream_container(PyObject * o,CYTHON_UNUSED void * x)5515 static PyObject *__pyx_getprop_2av_6stream_6Stream_container(PyObject *o, CYTHON_UNUSED void *x) {
5516 return __pyx_pw_2av_6stream_6Stream_9container_1__get__(o);
5517 }
5518
__pyx_getprop_2av_6stream_6Stream_metadata(PyObject * o,CYTHON_UNUSED void * x)5519 static PyObject *__pyx_getprop_2av_6stream_6Stream_metadata(PyObject *o, CYTHON_UNUSED void *x) {
5520 return __pyx_pw_2av_6stream_6Stream_8metadata_1__get__(o);
5521 }
5522
__pyx_getprop_2av_6stream_6Stream_codec_context(PyObject * o,CYTHON_UNUSED void * x)5523 static PyObject *__pyx_getprop_2av_6stream_6Stream_codec_context(PyObject *o, CYTHON_UNUSED void *x) {
5524 return __pyx_pw_2av_6stream_6Stream_13codec_context_1__get__(o);
5525 }
5526
5527 static PyMethodDef __pyx_methods_2av_6stream_Stream[] = {
5528 {"__getattr__", (PyCFunction)__pyx_pw_2av_6stream_6Stream_5__getattr__, METH_O|METH_COEXIST, 0},
5529 {"encode", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2av_6stream_6Stream_9encode, METH_VARARGS|METH_KEYWORDS, __pyx_doc_2av_6stream_6Stream_8encode},
5530 {"decode", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2av_6stream_6Stream_11decode, METH_VARARGS|METH_KEYWORDS, __pyx_doc_2av_6stream_6Stream_10decode},
5531 {"seek", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_2av_6stream_6Stream_13seek, METH_VARARGS|METH_KEYWORDS, __pyx_doc_2av_6stream_6Stream_12seek},
5532 {"__reduce_cython__", (PyCFunction)__pyx_pw_2av_6stream_6Stream_15__reduce_cython__, METH_NOARGS, __pyx_doc_2av_6stream_6Stream_14__reduce_cython__},
5533 {"__setstate_cython__", (PyCFunction)__pyx_pw_2av_6stream_6Stream_17__setstate_cython__, METH_O, __pyx_doc_2av_6stream_6Stream_16__setstate_cython__},
5534 {0, 0, 0, 0}
5535 };
5536
5537 static struct PyGetSetDef __pyx_getsets_2av_6stream_Stream[] = {
5538 {(char *)"id", __pyx_getprop_2av_6stream_6Stream_id, __pyx_setprop_2av_6stream_6Stream_id, (char *)"\n The format-specific ID of this stream.\n\n :type: int\n\n ", 0},
5539 {(char *)"profile", __pyx_getprop_2av_6stream_6Stream_profile, 0, (char *)"\n The profile of this stream.\n\n :type: str\n ", 0},
5540 {(char *)"index", __pyx_getprop_2av_6stream_6Stream_index, 0, (char *)"\n The index of this stream in its :class:`.Container`.\n\n :type: int\n ", 0},
5541 {(char *)"time_base", __pyx_getprop_2av_6stream_6Stream_time_base, __pyx_setprop_2av_6stream_6Stream_time_base, (char *)"\n The unit of time (in fractional seconds) in which timestamps are expressed.\n\n :type: :class:`~fractions.Fraction` or ``None``\n\n ", 0},
5542 {(char *)"average_rate", __pyx_getprop_2av_6stream_6Stream_average_rate, 0, (char *)"\n The average frame rate of this video stream.\n\n This is calculated when the file is opened by looking at the first\n few frames and averaging their rate.\n\n :type: :class:`~fractions.Fraction` or ``None``\n\n\n ", 0},
5543 {(char *)"base_rate", __pyx_getprop_2av_6stream_6Stream_base_rate, 0, (char *)"\n The base frame rate of this stream.\n\n This is calculated as the lowest framerate at which the timestamps of\n frames can be represented accurately. See :ffmpeg:`AVStream.r_frame_rate`\n for more.\n\n :type: :class:`~fractions.Fraction` or ``None``\n\n ", 0},
5544 {(char *)"guessed_rate", __pyx_getprop_2av_6stream_6Stream_guessed_rate, 0, (char *)"The guessed frame rate of this stream.\n\n This is a wrapper around :ffmpeg:`av_guess_frame_rate`, and uses multiple\n huristics to decide what is \"the\" frame rate.\n\n :type: :class:`~fractions.Fraction` or ``None``\n\n ", 0},
5545 {(char *)"start_time", __pyx_getprop_2av_6stream_6Stream_start_time, 0, (char *)"\n The presentation timestamp in :attr:`time_base` units of the first\n frame in this stream.\n\n :type: :class:`int` or ``None``\n ", 0},
5546 {(char *)"duration", __pyx_getprop_2av_6stream_6Stream_duration, 0, (char *)"\n The duration of this stream in :attr:`time_base` units.\n\n :type: :class:`int` or ``None``\n\n ", 0},
5547 {(char *)"frames", __pyx_getprop_2av_6stream_6Stream_frames, 0, (char *)"\n The number of frames this stream contains.\n\n Returns ``0`` if it is not known.\n\n :type: int\n ", 0},
5548 {(char *)"language", __pyx_getprop_2av_6stream_6Stream_language, 0, (char *)"\n The language of the stream.\n\n :type: :class:``str`` or ``None``\n ", 0},
5549 {(char *)"type", __pyx_getprop_2av_6stream_6Stream_type, 0, (char *)"\n The type of the stream.\n\n Examples: ``'audio'``, ``'video'``, ``'subtitle'``.\n\n :type: str\n ", 0},
5550 {(char *)"container", __pyx_getprop_2av_6stream_6Stream_container, 0, (char *)0, 0},
5551 {(char *)"metadata", __pyx_getprop_2av_6stream_6Stream_metadata, 0, (char *)0, 0},
5552 {(char *)"codec_context", __pyx_getprop_2av_6stream_6Stream_codec_context, 0, (char *)0, 0},
5553 {0, 0, 0, 0, 0}
5554 };
5555
5556 static PyTypeObject __pyx_type_2av_6stream_Stream = {
5557 PyVarObject_HEAD_INIT(0, 0)
5558 "av.stream.Stream", /*tp_name*/
5559 sizeof(struct __pyx_obj_2av_6stream_Stream), /*tp_basicsize*/
5560 0, /*tp_itemsize*/
5561 __pyx_tp_dealloc_2av_6stream_Stream, /*tp_dealloc*/
5562 #if PY_VERSION_HEX < 0x030800b4
5563 0, /*tp_print*/
5564 #endif
5565 #if PY_VERSION_HEX >= 0x030800b4
5566 0, /*tp_vectorcall_offset*/
5567 #endif
5568 0, /*tp_getattr*/
5569 0, /*tp_setattr*/
5570 #if PY_MAJOR_VERSION < 3
5571 0, /*tp_compare*/
5572 #endif
5573 #if PY_MAJOR_VERSION >= 3
5574 0, /*tp_as_async*/
5575 #endif
5576 __pyx_pw_2av_6stream_6Stream_3__repr__, /*tp_repr*/
5577 0, /*tp_as_number*/
5578 0, /*tp_as_sequence*/
5579 0, /*tp_as_mapping*/
5580 0, /*tp_hash*/
5581 0, /*tp_call*/
5582 0, /*tp_str*/
5583 __pyx_tp_getattro_2av_6stream_Stream, /*tp_getattro*/
5584 __pyx_tp_setattro_2av_6stream_Stream, /*tp_setattro*/
5585 0, /*tp_as_buffer*/
5586 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
5587 "\n A single stream of audio, video or subtitles within a :class:`.Container`.\n\n ::\n\n >>> fh = av.open(video_path)\n >>> stream = fh.streams.video[0]\n >>> stream\n <av.VideoStream #0 h264, yuv420p 1280x720 at 0x...>\n\n This encapsulates a :class:`.CodecContext`, located at :attr:`Stream.codec_context`.\n Attribute access is passed through to that context when attributes are missing\n on the stream itself. E.g. ``stream.options`` will be the options on the\n context.\n ", /*tp_doc*/
5588 __pyx_tp_traverse_2av_6stream_Stream, /*tp_traverse*/
5589 __pyx_tp_clear_2av_6stream_Stream, /*tp_clear*/
5590 0, /*tp_richcompare*/
5591 0, /*tp_weaklistoffset*/
5592 0, /*tp_iter*/
5593 0, /*tp_iternext*/
5594 __pyx_methods_2av_6stream_Stream, /*tp_methods*/
5595 0, /*tp_members*/
5596 __pyx_getsets_2av_6stream_Stream, /*tp_getset*/
5597 0, /*tp_base*/
5598 0, /*tp_dict*/
5599 0, /*tp_descr_get*/
5600 0, /*tp_descr_set*/
5601 0, /*tp_dictoffset*/
5602 0, /*tp_init*/
5603 0, /*tp_alloc*/
5604 __pyx_tp_new_2av_6stream_Stream, /*tp_new*/
5605 0, /*tp_free*/
5606 0, /*tp_is_gc*/
5607 0, /*tp_bases*/
5608 0, /*tp_mro*/
5609 0, /*tp_cache*/
5610 0, /*tp_subclasses*/
5611 0, /*tp_weaklist*/
5612 0, /*tp_del*/
5613 0, /*tp_version_tag*/
5614 #if PY_VERSION_HEX >= 0x030400a1
5615 0, /*tp_finalize*/
5616 #endif
5617 #if PY_VERSION_HEX >= 0x030800b1
5618 0, /*tp_vectorcall*/
5619 #endif
5620 #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000
5621 0, /*tp_print*/
5622 #endif
5623 };
5624
5625 static PyMethodDef __pyx_methods[] = {
5626 {0, 0, 0, 0}
5627 };
5628
5629 #if PY_MAJOR_VERSION >= 3
5630 #if CYTHON_PEP489_MULTI_PHASE_INIT
5631 static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/
5632 static int __pyx_pymod_exec_stream(PyObject* module); /*proto*/
5633 static PyModuleDef_Slot __pyx_moduledef_slots[] = {
5634 {Py_mod_create, (void*)__pyx_pymod_create},
5635 {Py_mod_exec, (void*)__pyx_pymod_exec_stream},
5636 {0, NULL}
5637 };
5638 #endif
5639
5640 static struct PyModuleDef __pyx_moduledef = {
5641 PyModuleDef_HEAD_INIT,
5642 "stream",
5643 0, /* m_doc */
5644 #if CYTHON_PEP489_MULTI_PHASE_INIT
5645 0, /* m_size */
5646 #else
5647 -1, /* m_size */
5648 #endif
5649 __pyx_methods /* m_methods */,
5650 #if CYTHON_PEP489_MULTI_PHASE_INIT
5651 __pyx_moduledef_slots, /* m_slots */
5652 #else
5653 NULL, /* m_reload */
5654 #endif
5655 NULL, /* m_traverse */
5656 NULL, /* m_clear */
5657 NULL /* m_free */
5658 };
5659 #endif
5660 #ifndef CYTHON_SMALL_CODE
5661 #if defined(__clang__)
5662 #define CYTHON_SMALL_CODE
5663 #elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
5664 #define CYTHON_SMALL_CODE __attribute__((cold))
5665 #else
5666 #define CYTHON_SMALL_CODE
5667 #endif
5668 #endif
5669
5670 static __Pyx_StringTabEntry __pyx_string_tab[] = {
5671 {&__pyx_n_s_AttributeError, __pyx_k_AttributeError, sizeof(__pyx_k_AttributeError), 0, 0, 1, 1},
5672 {&__pyx_n_s_AudioStream, __pyx_k_AudioStream, sizeof(__pyx_k_AudioStream), 0, 0, 1, 1},
5673 {&__pyx_n_s_DataStream, __pyx_k_DataStream, sizeof(__pyx_k_DataStream), 0, 0, 1, 1},
5674 {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1},
5675 {&__pyx_n_s_Stream, __pyx_k_Stream, sizeof(__pyx_k_Stream), 0, 0, 1, 1},
5676 {&__pyx_n_s_SubtitleStream, __pyx_k_SubtitleStream, sizeof(__pyx_k_SubtitleStream), 0, 0, 1, 1},
5677 {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1},
5678 {&__pyx_n_s_VideoStream, __pyx_k_VideoStream, sizeof(__pyx_k_VideoStream), 0, 0, 1, 1},
5679 {&__pyx_n_s_av, __pyx_k_av, sizeof(__pyx_k_av), 0, 0, 1, 1},
5680 {&__pyx_n_s_av_audio_stream, __pyx_k_av_audio_stream, sizeof(__pyx_k_av_audio_stream), 0, 0, 1, 1},
5681 {&__pyx_n_s_av_data_stream, __pyx_k_av_data_stream, sizeof(__pyx_k_av_data_stream), 0, 0, 1, 1},
5682 {&__pyx_kp_s_av_s_d_s_s_at_0x_x, __pyx_k_av_s_d_s_s_at_0x_x, sizeof(__pyx_k_av_s_d_s_s_at_0x_x), 0, 0, 1, 0},
5683 {&__pyx_n_s_av_subtitles_stream, __pyx_k_av_subtitles_stream, sizeof(__pyx_k_av_subtitles_stream), 0, 0, 1, 1},
5684 {&__pyx_n_s_av_video_stream, __pyx_k_av_video_stream, sizeof(__pyx_k_av_video_stream), 0, 0, 1, 1},
5685 {&__pyx_kp_s_cannot_manually_instatiate_Strea, __pyx_k_cannot_manually_instatiate_Strea, sizeof(__pyx_k_cannot_manually_instatiate_Strea), 0, 0, 1, 0},
5686 {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 0, 0, 1, 1},
5687 {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1},
5688 {&__pyx_n_s_deprecation, __pyx_k_deprecation, sizeof(__pyx_k_deprecation), 0, 0, 1, 1},
5689 {&__pyx_n_s_frame, __pyx_k_frame, sizeof(__pyx_k_frame), 0, 0, 1, 1},
5690 {&__pyx_n_s_get, __pyx_k_get, sizeof(__pyx_k_get), 0, 0, 1, 1},
5691 {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1},
5692 {&__pyx_n_s_id, __pyx_k_id, sizeof(__pyx_k_id), 0, 0, 1, 1},
5693 {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
5694 {&__pyx_n_s_index, __pyx_k_index, sizeof(__pyx_k_index), 0, 0, 1, 1},
5695 {&__pyx_n_s_items, __pyx_k_items, sizeof(__pyx_k_items), 0, 0, 1, 1},
5696 {&__pyx_n_s_language, __pyx_k_language, sizeof(__pyx_k_language), 0, 0, 1, 1},
5697 {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
5698 {&__pyx_n_s_method, __pyx_k_method, sizeof(__pyx_k_method), 0, 0, 1, 1},
5699 {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
5700 {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1},
5701 {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1},
5702 {&__pyx_kp_s_no_default___reduce___due_to_non, __pyx_k_no_default___reduce___due_to_non, sizeof(__pyx_k_no_default___reduce___due_to_non), 0, 0, 1, 0},
5703 {&__pyx_kp_s_nocodec, __pyx_k_nocodec, sizeof(__pyx_k_nocodec), 0, 0, 1, 0},
5704 {&__pyx_kp_s_notype, __pyx_k_notype, sizeof(__pyx_k_notype), 0, 0, 1, 0},
5705 {&__pyx_n_s_object, __pyx_k_object, sizeof(__pyx_k_object), 0, 0, 1, 1},
5706 {&__pyx_n_s_offset, __pyx_k_offset, sizeof(__pyx_k_offset), 0, 0, 1, 1},
5707 {&__pyx_n_s_packet, __pyx_k_packet, sizeof(__pyx_k_packet), 0, 0, 1, 1},
5708 {&__pyx_n_s_pyx_vtable, __pyx_k_pyx_vtable, sizeof(__pyx_k_pyx_vtable), 0, 0, 1, 1},
5709 {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1},
5710 {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1},
5711 {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1},
5712 {&__pyx_n_s_seek, __pyx_k_seek, sizeof(__pyx_k_seek), 0, 0, 1, 1},
5713 {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1},
5714 {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1},
5715 {&__pyx_n_s_stream, __pyx_k_stream, sizeof(__pyx_k_stream), 0, 0, 1, 1},
5716 {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
5717 {&__pyx_n_s_type, __pyx_k_type, sizeof(__pyx_k_type), 0, 0, 1, 1},
5718 {0, 0, 0, 0, 0, 0, 0}
5719 };
__Pyx_InitCachedBuiltins(void)5720 static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
5721 __pyx_builtin_object = __Pyx_GetBuiltinName(__pyx_n_s_object); if (!__pyx_builtin_object) __PYX_ERR(0, 19, __pyx_L1_error)
5722 __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(0, 74, __pyx_L1_error)
5723 __pyx_builtin_id = __Pyx_GetBuiltinName(__pyx_n_s_id); if (!__pyx_builtin_id) __PYX_ERR(0, 112, __pyx_L1_error)
5724 __pyx_builtin_AttributeError = __Pyx_GetBuiltinName(__pyx_n_s_AttributeError); if (!__pyx_builtin_AttributeError) __PYX_ERR(0, 122, __pyx_L1_error)
5725 __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(1, 2, __pyx_L1_error)
5726 return 0;
5727 __pyx_L1_error:;
5728 return -1;
5729 }
5730
__Pyx_InitCachedConstants(void)5731 static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
5732 __Pyx_RefNannyDeclarations
5733 __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
5734
5735 /* "av/stream.pyx":74
5736 * if name is _cinit_bypass_sentinel:
5737 * return
5738 * raise RuntimeError('cannot manually instatiate Stream') # <<<<<<<<<<<<<<
5739 *
5740 * cdef _init(self, Container container, lib.AVStream *stream):
5741 */
5742 __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_cannot_manually_instatiate_Strea); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 74, __pyx_L1_error)
5743 __Pyx_GOTREF(__pyx_tuple_);
5744 __Pyx_GIVEREF(__pyx_tuple_);
5745
5746 /* "(tree fragment)":2
5747 * def __reduce_cython__(self):
5748 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
5749 * def __setstate_cython__(self, __pyx_state):
5750 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
5751 */
5752 __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(1, 2, __pyx_L1_error)
5753 __Pyx_GOTREF(__pyx_tuple__2);
5754 __Pyx_GIVEREF(__pyx_tuple__2);
5755
5756 /* "(tree fragment)":4
5757 * raise TypeError("no default __reduce__ due to non-trivial __cinit__")
5758 * def __setstate_cython__(self, __pyx_state):
5759 * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<<
5760 */
5761 __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(1, 4, __pyx_L1_error)
5762 __Pyx_GOTREF(__pyx_tuple__3);
5763 __Pyx_GIVEREF(__pyx_tuple__3);
5764 __Pyx_RefNannyFinishContext();
5765 return 0;
5766 __pyx_L1_error:;
5767 __Pyx_RefNannyFinishContext();
5768 return -1;
5769 }
5770
__Pyx_InitGlobals(void)5771 static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) {
5772 __pyx_umethod_PyDict_Type_get.type = (PyObject*)&PyDict_Type;
5773 if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
5774 return 0;
5775 __pyx_L1_error:;
5776 return -1;
5777 }
5778
5779 static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/
5780 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/
5781 static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/
5782 static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/
5783 static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/
5784 static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/
5785 static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/
5786
__Pyx_modinit_global_init_code(void)5787 static int __Pyx_modinit_global_init_code(void) {
5788 __Pyx_RefNannyDeclarations
5789 __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0);
5790 /*--- Global init code ---*/
5791 __pyx_v_2av_6stream__cinit_bypass_sentinel = Py_None; Py_INCREF(Py_None);
5792 __Pyx_RefNannyFinishContext();
5793 return 0;
5794 }
5795
__Pyx_modinit_variable_export_code(void)5796 static int __Pyx_modinit_variable_export_code(void) {
5797 __Pyx_RefNannyDeclarations
5798 __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0);
5799 /*--- Variable export code ---*/
5800 __Pyx_RefNannyFinishContext();
5801 return 0;
5802 }
5803
__Pyx_modinit_function_export_code(void)5804 static int __Pyx_modinit_function_export_code(void) {
5805 __Pyx_RefNannyDeclarations
5806 int __pyx_lineno = 0;
5807 const char *__pyx_filename = NULL;
5808 int __pyx_clineno = 0;
5809 __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0);
5810 /*--- Function export code ---*/
5811 if (__Pyx_ExportFunction("wrap_stream", (void (*)(void))__pyx_f_2av_6stream_wrap_stream, "struct __pyx_obj_2av_6stream_Stream *(struct __pyx_obj_2av_9container_4core_Container *, struct AVStream *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
5812 __Pyx_RefNannyFinishContext();
5813 return 0;
5814 __pyx_L1_error:;
5815 __Pyx_RefNannyFinishContext();
5816 return -1;
5817 }
5818
__Pyx_modinit_type_init_code(void)5819 static int __Pyx_modinit_type_init_code(void) {
5820 __Pyx_RefNannyDeclarations
5821 int __pyx_lineno = 0;
5822 const char *__pyx_filename = NULL;
5823 int __pyx_clineno = 0;
5824 __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0);
5825 /*--- Type init code ---*/
5826 __pyx_vtabptr_2av_6stream_Stream = &__pyx_vtable_2av_6stream_Stream;
5827 __pyx_vtable_2av_6stream_Stream._init = (PyObject *(*)(struct __pyx_obj_2av_6stream_Stream *, struct __pyx_obj_2av_9container_4core_Container *, struct AVStream *))__pyx_f_2av_6stream_6Stream__init;
5828 __pyx_vtable_2av_6stream_Stream._finalize_for_output = (PyObject *(*)(struct __pyx_obj_2av_6stream_Stream *))__pyx_f_2av_6stream_6Stream__finalize_for_output;
5829 if (PyType_Ready(&__pyx_type_2av_6stream_Stream) < 0) __PYX_ERR(0, 54, __pyx_L1_error)
5830 #if PY_VERSION_HEX < 0x030800B1
5831 __pyx_type_2av_6stream_Stream.tp_print = 0;
5832 #endif
5833 if (__Pyx_SetVtable(__pyx_type_2av_6stream_Stream.tp_dict, __pyx_vtabptr_2av_6stream_Stream) < 0) __PYX_ERR(0, 54, __pyx_L1_error)
5834 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Stream, (PyObject *)&__pyx_type_2av_6stream_Stream) < 0) __PYX_ERR(0, 54, __pyx_L1_error)
5835 if (__Pyx_setup_reduce((PyObject*)&__pyx_type_2av_6stream_Stream) < 0) __PYX_ERR(0, 54, __pyx_L1_error)
5836 __pyx_ptype_2av_6stream_Stream = &__pyx_type_2av_6stream_Stream;
5837 __Pyx_RefNannyFinishContext();
5838 return 0;
5839 __pyx_L1_error:;
5840 __Pyx_RefNannyFinishContext();
5841 return -1;
5842 }
5843
__Pyx_modinit_type_import_code(void)5844 static int __Pyx_modinit_type_import_code(void) {
5845 __Pyx_RefNannyDeclarations
5846 PyObject *__pyx_t_1 = NULL;
5847 int __pyx_lineno = 0;
5848 const char *__pyx_filename = NULL;
5849 int __pyx_clineno = 0;
5850 __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0);
5851 /*--- Type import code ---*/
5852 __pyx_t_1 = PyImport_ImportModule("av.bytesource"); if (unlikely(!__pyx_t_1)) __PYX_ERR(2, 4, __pyx_L1_error)
5853 __Pyx_GOTREF(__pyx_t_1);
5854 __pyx_ptype_2av_10bytesource_ByteSource = __Pyx_ImportType(__pyx_t_1, "av.bytesource", "ByteSource", sizeof(struct __pyx_obj_2av_10bytesource_ByteSource), __Pyx_ImportType_CheckSize_Warn);
5855 if (!__pyx_ptype_2av_10bytesource_ByteSource) __PYX_ERR(2, 4, __pyx_L1_error)
5856 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5857 __pyx_t_1 = PyImport_ImportModule("av.codec.codec"); if (unlikely(!__pyx_t_1)) __PYX_ERR(3, 4, __pyx_L1_error)
5858 __Pyx_GOTREF(__pyx_t_1);
5859 __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);
5860 if (!__pyx_ptype_2av_5codec_5codec_Codec) __PYX_ERR(3, 4, __pyx_L1_error)
5861 __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(3, 4, __pyx_L1_error)
5862 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5863 __pyx_t_1 = PyImport_ImportModule("av.buffer"); if (unlikely(!__pyx_t_1)) __PYX_ERR(4, 2, __pyx_L1_error)
5864 __Pyx_GOTREF(__pyx_t_1);
5865 __pyx_ptype_2av_6buffer_Buffer = __Pyx_ImportType(__pyx_t_1, "av.buffer", "Buffer", sizeof(struct __pyx_obj_2av_6buffer_Buffer), __Pyx_ImportType_CheckSize_Warn);
5866 if (!__pyx_ptype_2av_6buffer_Buffer) __PYX_ERR(4, 2, __pyx_L1_error)
5867 __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)
5868 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5869 __pyx_t_1 = PyImport_ImportModule("av.packet"); if (unlikely(!__pyx_t_1)) __PYX_ERR(5, 8, __pyx_L1_error)
5870 __Pyx_GOTREF(__pyx_t_1);
5871 __pyx_ptype_2av_6packet_Packet = __Pyx_ImportType(__pyx_t_1, "av.packet", "Packet", sizeof(struct __pyx_obj_2av_6packet_Packet), __Pyx_ImportType_CheckSize_Warn);
5872 if (!__pyx_ptype_2av_6packet_Packet) __PYX_ERR(5, 8, __pyx_L1_error)
5873 __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(5, 8, __pyx_L1_error)
5874 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5875 __pyx_t_1 = PyImport_ImportModule("av.dictionary"); if (unlikely(!__pyx_t_1)) __PYX_ERR(6, 4, __pyx_L1_error)
5876 __Pyx_GOTREF(__pyx_t_1);
5877 __pyx_ptype_2av_10dictionary__Dictionary = __Pyx_ImportType(__pyx_t_1, "av.dictionary", "_Dictionary", sizeof(struct __pyx_obj_2av_10dictionary__Dictionary), __Pyx_ImportType_CheckSize_Warn);
5878 if (!__pyx_ptype_2av_10dictionary__Dictionary) __PYX_ERR(6, 4, __pyx_L1_error)
5879 __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(6, 4, __pyx_L1_error)
5880 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5881 __pyx_t_1 = PyImport_ImportModule("av.sidedata.sidedata"); if (unlikely(!__pyx_t_1)) __PYX_ERR(7, 9, __pyx_L1_error)
5882 __Pyx_GOTREF(__pyx_t_1);
5883 __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);
5884 if (!__pyx_ptype_2av_8sidedata_8sidedata_SideData) __PYX_ERR(7, 9, __pyx_L1_error)
5885 __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(7, 9, __pyx_L1_error)
5886 __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);
5887 if (!__pyx_ptype_2av_8sidedata_8sidedata__SideDataContainer) __PYX_ERR(7, 18, __pyx_L1_error)
5888 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5889 __pyx_t_1 = PyImport_ImportModule("av.frame"); if (unlikely(!__pyx_t_1)) __PYX_ERR(8, 7, __pyx_L1_error)
5890 __Pyx_GOTREF(__pyx_t_1);
5891 __pyx_ptype_2av_5frame_Frame = __Pyx_ImportType(__pyx_t_1, "av.frame", "Frame", sizeof(struct __pyx_obj_2av_5frame_Frame), __Pyx_ImportType_CheckSize_Warn);
5892 if (!__pyx_ptype_2av_5frame_Frame) __PYX_ERR(8, 7, __pyx_L1_error)
5893 __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(8, 7, __pyx_L1_error)
5894 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5895 __pyx_t_1 = PyImport_ImportModule("av.codec.context"); if (unlikely(!__pyx_t_1)) __PYX_ERR(9, 10, __pyx_L1_error)
5896 __Pyx_GOTREF(__pyx_t_1);
5897 __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);
5898 if (!__pyx_ptype_2av_5codec_7context_CodecContext) __PYX_ERR(9, 10, __pyx_L1_error)
5899 __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(9, 10, __pyx_L1_error)
5900 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5901 __pyx_t_1 = PyImport_ImportModule("av.container.streams"); if (unlikely(!__pyx_t_1)) __PYX_ERR(10, 4, __pyx_L1_error)
5902 __Pyx_GOTREF(__pyx_t_1);
5903 __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);
5904 if (!__pyx_ptype_2av_9container_7streams_StreamContainer) __PYX_ERR(10, 4, __pyx_L1_error)
5905 __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(10, 4, __pyx_L1_error)
5906 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5907 __pyx_t_1 = PyImport_ImportModule("av.format"); if (unlikely(!__pyx_t_1)) __PYX_ERR(11, 4, __pyx_L1_error)
5908 __Pyx_GOTREF(__pyx_t_1);
5909 __pyx_ptype_2av_6format_ContainerFormat = __Pyx_ImportType(__pyx_t_1, "av.format", "ContainerFormat", sizeof(struct __pyx_obj_2av_6format_ContainerFormat), __Pyx_ImportType_CheckSize_Warn);
5910 if (!__pyx_ptype_2av_6format_ContainerFormat) __PYX_ERR(11, 4, __pyx_L1_error)
5911 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5912 __pyx_t_1 = PyImport_ImportModule("av.container.core"); if (unlikely(!__pyx_t_1)) __PYX_ERR(12, 15, __pyx_L1_error)
5913 __Pyx_GOTREF(__pyx_t_1);
5914 __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);
5915 if (!__pyx_ptype_2av_9container_4core_Container) __PYX_ERR(12, 15, __pyx_L1_error)
5916 __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(12, 15, __pyx_L1_error)
5917 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5918 __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(13, 9, __pyx_L1_error)
5919 __Pyx_GOTREF(__pyx_t_1);
5920 __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "type",
5921 #if defined(PYPY_VERSION_NUM) && PYPY_VERSION_NUM < 0x050B0000
5922 sizeof(PyTypeObject),
5923 #else
5924 sizeof(PyHeapTypeObject),
5925 #endif
5926 __Pyx_ImportType_CheckSize_Warn);
5927 if (!__pyx_ptype_7cpython_4type_type) __PYX_ERR(13, 9, __pyx_L1_error)
5928 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5929 __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(14, 8, __pyx_L1_error)
5930 __Pyx_GOTREF(__pyx_t_1);
5931 __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), __Pyx_ImportType_CheckSize_Warn);
5932 if (!__pyx_ptype_7cpython_4bool_bool) __PYX_ERR(14, 8, __pyx_L1_error)
5933 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5934 __pyx_t_1 = PyImport_ImportModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_t_1)) __PYX_ERR(15, 15, __pyx_L1_error)
5935 __Pyx_GOTREF(__pyx_t_1);
5936 __pyx_ptype_7cpython_7complex_complex = __Pyx_ImportType(__pyx_t_1, __Pyx_BUILTIN_MODULE_NAME, "complex", sizeof(PyComplexObject), __Pyx_ImportType_CheckSize_Warn);
5937 if (!__pyx_ptype_7cpython_7complex_complex) __PYX_ERR(15, 15, __pyx_L1_error)
5938 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5939 __Pyx_RefNannyFinishContext();
5940 return 0;
5941 __pyx_L1_error:;
5942 __Pyx_XDECREF(__pyx_t_1);
5943 __Pyx_RefNannyFinishContext();
5944 return -1;
5945 }
5946
__Pyx_modinit_variable_import_code(void)5947 static int __Pyx_modinit_variable_import_code(void) {
5948 __Pyx_RefNannyDeclarations
5949 __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0);
5950 /*--- Variable import code ---*/
5951 __Pyx_RefNannyFinishContext();
5952 return 0;
5953 }
5954
__Pyx_modinit_function_import_code(void)5955 static int __Pyx_modinit_function_import_code(void) {
5956 __Pyx_RefNannyDeclarations
5957 PyObject *__pyx_t_1 = NULL;
5958 int __pyx_lineno = 0;
5959 const char *__pyx_filename = NULL;
5960 int __pyx_clineno = 0;
5961 __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0);
5962 /*--- Function import code ---*/
5963 __pyx_t_1 = PyImport_ImportModule("av.dictionary"); if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error)
5964 __Pyx_GOTREF(__pyx_t_1);
5965 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(0, 1, __pyx_L1_error)
5966 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5967 __pyx_t_1 = PyImport_ImportModule("av.codec.context"); if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error)
5968 __Pyx_GOTREF(__pyx_t_1);
5969 if (__Pyx_ImportFunction(__pyx_t_1, "wrap_codec_context", (void (**)(void))&__pyx_f_2av_5codec_7context_wrap_codec_context, "struct __pyx_obj_2av_5codec_7context_CodecContext *(struct AVCodecContext *, struct AVCodec const *, int)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
5970 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5971 __pyx_t_1 = PyImport_ImportModule("av.error"); if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error)
5972 __Pyx_GOTREF(__pyx_t_1);
5973 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(0, 1, __pyx_L1_error)
5974 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5975 __pyx_t_1 = PyImport_ImportModule("av.utils"); if (!__pyx_t_1) __PYX_ERR(0, 1, __pyx_L1_error)
5976 __Pyx_GOTREF(__pyx_t_1);
5977 if (__Pyx_ImportFunction(__pyx_t_1, "avdict_to_dict", (void (**)(void))&__pyx_f_2av_5utils_avdict_to_dict, "PyObject *(AVDictionary *, PyObject *, PyObject *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
5978 if (__Pyx_ImportFunction(__pyx_t_1, "dict_to_avdict", (void (**)(void))&__pyx_f_2av_5utils_dict_to_avdict, "PyObject *(AVDictionary **, PyObject *, PyObject *, PyObject *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
5979 if (__Pyx_ImportFunction(__pyx_t_1, "avrational_to_fraction", (void (**)(void))&__pyx_f_2av_5utils_avrational_to_fraction, "PyObject *(AVRational const *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
5980 if (__Pyx_ImportFunction(__pyx_t_1, "to_avrational", (void (**)(void))&__pyx_f_2av_5utils_to_avrational, "PyObject *(PyObject *, AVRational *)") < 0) __PYX_ERR(0, 1, __pyx_L1_error)
5981 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5982 __Pyx_RefNannyFinishContext();
5983 return 0;
5984 __pyx_L1_error:;
5985 __Pyx_XDECREF(__pyx_t_1);
5986 __Pyx_RefNannyFinishContext();
5987 return -1;
5988 }
5989
5990
5991 #ifndef CYTHON_NO_PYINIT_EXPORT
5992 #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
5993 #elif PY_MAJOR_VERSION < 3
5994 #ifdef __cplusplus
5995 #define __Pyx_PyMODINIT_FUNC extern "C" void
5996 #else
5997 #define __Pyx_PyMODINIT_FUNC void
5998 #endif
5999 #else
6000 #ifdef __cplusplus
6001 #define __Pyx_PyMODINIT_FUNC extern "C" PyObject *
6002 #else
6003 #define __Pyx_PyMODINIT_FUNC PyObject *
6004 #endif
6005 #endif
6006
6007
6008 #if PY_MAJOR_VERSION < 3
6009 __Pyx_PyMODINIT_FUNC initstream(void) CYTHON_SMALL_CODE; /*proto*/
initstream(void)6010 __Pyx_PyMODINIT_FUNC initstream(void)
6011 #else
6012 __Pyx_PyMODINIT_FUNC PyInit_stream(void) CYTHON_SMALL_CODE; /*proto*/
6013 __Pyx_PyMODINIT_FUNC PyInit_stream(void)
6014 #if CYTHON_PEP489_MULTI_PHASE_INIT
6015 {
6016 return PyModuleDef_Init(&__pyx_moduledef);
6017 }
6018 static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) {
6019 #if PY_VERSION_HEX >= 0x030700A1
6020 static PY_INT64_T main_interpreter_id = -1;
6021 PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp);
6022 if (main_interpreter_id == -1) {
6023 main_interpreter_id = current_id;
6024 return (unlikely(current_id == -1)) ? -1 : 0;
6025 } else if (unlikely(main_interpreter_id != current_id))
6026 #else
6027 static PyInterpreterState *main_interpreter = NULL;
6028 PyInterpreterState *current_interpreter = PyThreadState_Get()->interp;
6029 if (!main_interpreter) {
6030 main_interpreter = current_interpreter;
6031 } else if (unlikely(main_interpreter != current_interpreter))
6032 #endif
6033 {
6034 PyErr_SetString(
6035 PyExc_ImportError,
6036 "Interpreter change detected - this module can only be loaded into one interpreter per process.");
6037 return -1;
6038 }
6039 return 0;
6040 }
6041 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) {
6042 PyObject *value = PyObject_GetAttrString(spec, from_name);
6043 int result = 0;
6044 if (likely(value)) {
6045 if (allow_none || value != Py_None) {
6046 result = PyDict_SetItemString(moddict, to_name, value);
6047 }
6048 Py_DECREF(value);
6049 } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
6050 PyErr_Clear();
6051 } else {
6052 result = -1;
6053 }
6054 return result;
6055 }
6056 static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) {
6057 PyObject *module = NULL, *moddict, *modname;
6058 if (__Pyx_check_single_interpreter())
6059 return NULL;
6060 if (__pyx_m)
6061 return __Pyx_NewRef(__pyx_m);
6062 modname = PyObject_GetAttrString(spec, "name");
6063 if (unlikely(!modname)) goto bad;
6064 module = PyModule_NewObject(modname);
6065 Py_DECREF(modname);
6066 if (unlikely(!module)) goto bad;
6067 moddict = PyModule_GetDict(module);
6068 if (unlikely(!moddict)) goto bad;
6069 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad;
6070 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad;
6071 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad;
6072 if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad;
6073 return module;
6074 bad:
6075 Py_XDECREF(module);
6076 return NULL;
6077 }
6078
6079
6080 static CYTHON_SMALL_CODE int __pyx_pymod_exec_stream(PyObject *__pyx_pyinit_module)
6081 #endif
6082 #endif
6083 {
6084 PyObject *__pyx_t_1 = NULL;
6085 PyObject *__pyx_t_2 = NULL;
6086 PyObject *__pyx_t_3 = NULL;
6087 PyObject *__pyx_t_4 = NULL;
6088 int __pyx_lineno = 0;
6089 const char *__pyx_filename = NULL;
6090 int __pyx_clineno = 0;
6091 __Pyx_RefNannyDeclarations
6092 #if CYTHON_PEP489_MULTI_PHASE_INIT
6093 if (__pyx_m) {
6094 if (__pyx_m == __pyx_pyinit_module) return 0;
6095 PyErr_SetString(PyExc_RuntimeError, "Module 'stream' has already been imported. Re-initialisation is not supported.");
6096 return -1;
6097 }
6098 #elif PY_MAJOR_VERSION >= 3
6099 if (__pyx_m) return __Pyx_NewRef(__pyx_m);
6100 #endif
6101 #if CYTHON_REFNANNY
6102 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
6103 if (!__Pyx_RefNanny) {
6104 PyErr_Clear();
6105 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
6106 if (!__Pyx_RefNanny)
6107 Py_FatalError("failed to import 'refnanny' module");
6108 }
6109 #endif
6110 __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_stream(void)", 0);
6111 if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6112 #ifdef __Pxy_PyFrame_Initialize_Offsets
6113 __Pxy_PyFrame_Initialize_Offsets();
6114 #endif
6115 __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
6116 __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
6117 __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
6118 #ifdef __Pyx_CyFunction_USED
6119 if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6120 #endif
6121 #ifdef __Pyx_FusedFunction_USED
6122 if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6123 #endif
6124 #ifdef __Pyx_Coroutine_USED
6125 if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6126 #endif
6127 #ifdef __Pyx_Generator_USED
6128 if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6129 #endif
6130 #ifdef __Pyx_AsyncGen_USED
6131 if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6132 #endif
6133 #ifdef __Pyx_StopAsyncIteration_USED
6134 if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6135 #endif
6136 /*--- Library function declarations ---*/
6137 /*--- Threads initialization code ---*/
6138 #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
6139 #ifdef WITH_THREAD /* Python build with threading support? */
6140 PyEval_InitThreads();
6141 #endif
6142 #endif
6143 /*--- Module creation code ---*/
6144 #if CYTHON_PEP489_MULTI_PHASE_INIT
6145 __pyx_m = __pyx_pyinit_module;
6146 Py_INCREF(__pyx_m);
6147 #else
6148 #if PY_MAJOR_VERSION < 3
6149 __pyx_m = Py_InitModule4("stream", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
6150 #else
6151 __pyx_m = PyModule_Create(&__pyx_moduledef);
6152 #endif
6153 if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
6154 #endif
6155 __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
6156 Py_INCREF(__pyx_d);
6157 __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
6158 Py_INCREF(__pyx_b);
6159 __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
6160 Py_INCREF(__pyx_cython_runtime);
6161 if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
6162 /*--- Initialize various global constants etc. ---*/
6163 if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6164 #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
6165 if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6166 #endif
6167 if (__pyx_module_is_main_av__stream) {
6168 if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6169 }
6170 #if PY_MAJOR_VERSION >= 3
6171 {
6172 PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
6173 if (!PyDict_GetItemString(modules, "av.stream")) {
6174 if (unlikely(PyDict_SetItemString(modules, "av.stream", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
6175 }
6176 }
6177 #endif
6178 /*--- Builtin init code ---*/
6179 if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6180 /*--- Constants init code ---*/
6181 if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6182 /*--- Global type/function init code ---*/
6183 (void)__Pyx_modinit_global_init_code();
6184 (void)__Pyx_modinit_variable_export_code();
6185 if (unlikely(__Pyx_modinit_function_export_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
6186 if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
6187 if (unlikely(__Pyx_modinit_type_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
6188 (void)__Pyx_modinit_variable_import_code();
6189 if (unlikely(__Pyx_modinit_function_import_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
6190 /*--- Execution code ---*/
6191 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
6192 if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6193 #endif
6194
6195 /* "av/stream.pyx":16
6196 * )
6197 *
6198 * from av import deprecation # <<<<<<<<<<<<<<
6199 *
6200 *
6201 */
6202 __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error)
6203 __Pyx_GOTREF(__pyx_t_1);
6204 __Pyx_INCREF(__pyx_n_s_deprecation);
6205 __Pyx_GIVEREF(__pyx_n_s_deprecation);
6206 PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_deprecation);
6207 __pyx_t_2 = __Pyx_Import(__pyx_n_s_av, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 16, __pyx_L1_error)
6208 __Pyx_GOTREF(__pyx_t_2);
6209 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6210 __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_deprecation); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error)
6211 __Pyx_GOTREF(__pyx_t_1);
6212 if (PyDict_SetItem(__pyx_d, __pyx_n_s_deprecation, __pyx_t_1) < 0) __PYX_ERR(0, 16, __pyx_L1_error)
6213 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6214 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6215
6216 /* "av/stream.pyx":19
6217 *
6218 *
6219 * cdef object _cinit_bypass_sentinel = object() # <<<<<<<<<<<<<<
6220 *
6221 *
6222 */
6223 __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_builtin_object); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 19, __pyx_L1_error)
6224 __Pyx_GOTREF(__pyx_t_2);
6225 __Pyx_XGOTREF(__pyx_v_2av_6stream__cinit_bypass_sentinel);
6226 __Pyx_DECREF_SET(__pyx_v_2av_6stream__cinit_bypass_sentinel, __pyx_t_2);
6227 __Pyx_GIVEREF(__pyx_t_2);
6228 __pyx_t_2 = 0;
6229
6230 /* "av/stream.pyx":173
6231 * return self.codec_context.decode(packet)
6232 *
6233 * @deprecation.method # <<<<<<<<<<<<<<
6234 * def seek(self, offset, **kwargs):
6235 * """
6236 */
6237 __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_deprecation); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 173, __pyx_L1_error)
6238 __Pyx_GOTREF(__pyx_t_1);
6239 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_method); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 173, __pyx_L1_error)
6240 __Pyx_GOTREF(__pyx_t_3);
6241 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6242
6243 /* "av/stream.pyx":174
6244 *
6245 * @deprecation.method
6246 * def seek(self, offset, **kwargs): # <<<<<<<<<<<<<<
6247 * """
6248 * .. seealso:: :meth:`.InputContainer.seek` for documentation on parameters.
6249 */
6250 __Pyx_GetNameInClass(__pyx_t_1, (PyObject *)__pyx_ptype_2av_6stream_Stream, __pyx_n_s_seek); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 174, __pyx_L1_error)
6251 __Pyx_GOTREF(__pyx_t_1);
6252 __pyx_t_4 = NULL;
6253 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
6254 __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
6255 if (likely(__pyx_t_4)) {
6256 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
6257 __Pyx_INCREF(__pyx_t_4);
6258 __Pyx_INCREF(function);
6259 __Pyx_DECREF_SET(__pyx_t_3, function);
6260 }
6261 }
6262 __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_t_1) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_1);
6263 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
6264 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6265 if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 173, __pyx_L1_error)
6266 __Pyx_GOTREF(__pyx_t_2);
6267 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6268 if (PyDict_SetItem((PyObject *)__pyx_ptype_2av_6stream_Stream->tp_dict, __pyx_n_s_seek, __pyx_t_2) < 0) __PYX_ERR(0, 174, __pyx_L1_error)
6269 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6270 PyType_Modified(__pyx_ptype_2av_6stream_Stream);
6271
6272 /* "av/stream.pyx":1
6273 * from cpython cimport PyWeakref_NewRef # <<<<<<<<<<<<<<
6274 * from libc.stdint cimport int64_t, uint8_t
6275 * from libc.string cimport memcpy
6276 */
6277 __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error)
6278 __Pyx_GOTREF(__pyx_t_2);
6279 if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
6280 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6281
6282 /*--- Wrapped vars code ---*/
6283
6284 goto __pyx_L0;
6285 __pyx_L1_error:;
6286 __Pyx_XDECREF(__pyx_t_1);
6287 __Pyx_XDECREF(__pyx_t_2);
6288 __Pyx_XDECREF(__pyx_t_3);
6289 __Pyx_XDECREF(__pyx_t_4);
6290 if (__pyx_m) {
6291 if (__pyx_d) {
6292 __Pyx_AddTraceback("init av.stream", __pyx_clineno, __pyx_lineno, __pyx_filename);
6293 }
6294 Py_CLEAR(__pyx_m);
6295 } else if (!PyErr_Occurred()) {
6296 PyErr_SetString(PyExc_ImportError, "init av.stream");
6297 }
6298 __pyx_L0:;
6299 __Pyx_RefNannyFinishContext();
6300 #if CYTHON_PEP489_MULTI_PHASE_INIT
6301 return (__pyx_m != NULL) ? 0 : -1;
6302 #elif PY_MAJOR_VERSION >= 3
6303 return __pyx_m;
6304 #else
6305 return;
6306 #endif
6307 }
6308
6309 /* --- Runtime support code --- */
6310 /* Refnanny */
6311 #if CYTHON_REFNANNY
__Pyx_RefNannyImportAPI(const char * modname)6312 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
6313 PyObject *m = NULL, *p = NULL;
6314 void *r = NULL;
6315 m = PyImport_ImportModule(modname);
6316 if (!m) goto end;
6317 p = PyObject_GetAttrString(m, "RefNannyAPI");
6318 if (!p) goto end;
6319 r = PyLong_AsVoidPtr(p);
6320 end:
6321 Py_XDECREF(p);
6322 Py_XDECREF(m);
6323 return (__Pyx_RefNannyAPIStruct *)r;
6324 }
6325 #endif
6326
6327 /* PyObjectGetAttrStr */
6328 #if CYTHON_USE_TYPE_SLOTS
__Pyx_PyObject_GetAttrStr(PyObject * obj,PyObject * attr_name)6329 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
6330 PyTypeObject* tp = Py_TYPE(obj);
6331 if (likely(tp->tp_getattro))
6332 return tp->tp_getattro(obj, attr_name);
6333 #if PY_MAJOR_VERSION < 3
6334 if (likely(tp->tp_getattr))
6335 return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
6336 #endif
6337 return PyObject_GetAttr(obj, attr_name);
6338 }
6339 #endif
6340
6341 /* GetBuiltinName */
__Pyx_GetBuiltinName(PyObject * name)6342 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
6343 PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
6344 if (unlikely(!result)) {
6345 PyErr_Format(PyExc_NameError,
6346 #if PY_MAJOR_VERSION >= 3
6347 "name '%U' is not defined", name);
6348 #else
6349 "name '%.200s' is not defined", PyString_AS_STRING(name));
6350 #endif
6351 }
6352 return result;
6353 }
6354
6355 /* Import */
__Pyx_Import(PyObject * name,PyObject * from_list,int level)6356 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
6357 PyObject *empty_list = 0;
6358 PyObject *module = 0;
6359 PyObject *global_dict = 0;
6360 PyObject *empty_dict = 0;
6361 PyObject *list;
6362 #if PY_MAJOR_VERSION < 3
6363 PyObject *py_import;
6364 py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
6365 if (!py_import)
6366 goto bad;
6367 #endif
6368 if (from_list)
6369 list = from_list;
6370 else {
6371 empty_list = PyList_New(0);
6372 if (!empty_list)
6373 goto bad;
6374 list = empty_list;
6375 }
6376 global_dict = PyModule_GetDict(__pyx_m);
6377 if (!global_dict)
6378 goto bad;
6379 empty_dict = PyDict_New();
6380 if (!empty_dict)
6381 goto bad;
6382 {
6383 #if PY_MAJOR_VERSION >= 3
6384 if (level == -1) {
6385 if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) {
6386 module = PyImport_ImportModuleLevelObject(
6387 name, global_dict, empty_dict, list, 1);
6388 if (!module) {
6389 if (!PyErr_ExceptionMatches(PyExc_ImportError))
6390 goto bad;
6391 PyErr_Clear();
6392 }
6393 }
6394 level = 0;
6395 }
6396 #endif
6397 if (!module) {
6398 #if PY_MAJOR_VERSION < 3
6399 PyObject *py_level = PyInt_FromLong(level);
6400 if (!py_level)
6401 goto bad;
6402 module = PyObject_CallFunctionObjArgs(py_import,
6403 name, global_dict, empty_dict, list, py_level, (PyObject *)NULL);
6404 Py_DECREF(py_level);
6405 #else
6406 module = PyImport_ImportModuleLevelObject(
6407 name, global_dict, empty_dict, list, level);
6408 #endif
6409 }
6410 }
6411 bad:
6412 #if PY_MAJOR_VERSION < 3
6413 Py_XDECREF(py_import);
6414 #endif
6415 Py_XDECREF(empty_list);
6416 Py_XDECREF(empty_dict);
6417 return module;
6418 }
6419
6420 /* ImportFrom */
__Pyx_ImportFrom(PyObject * module,PyObject * name)6421 static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) {
6422 PyObject* value = __Pyx_PyObject_GetAttrStr(module, name);
6423 if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) {
6424 PyErr_Format(PyExc_ImportError,
6425 #if PY_MAJOR_VERSION < 3
6426 "cannot import name %.230s", PyString_AS_STRING(name));
6427 #else
6428 "cannot import name %S", name);
6429 #endif
6430 }
6431 return value;
6432 }
6433
6434 /* PyFunctionFastCall */
6435 #if CYTHON_FAST_PYCALL
__Pyx_PyFunction_FastCallNoKw(PyCodeObject * co,PyObject ** args,Py_ssize_t na,PyObject * globals)6436 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
6437 PyObject *globals) {
6438 PyFrameObject *f;
6439 PyThreadState *tstate = __Pyx_PyThreadState_Current;
6440 PyObject **fastlocals;
6441 Py_ssize_t i;
6442 PyObject *result;
6443 assert(globals != NULL);
6444 /* XXX Perhaps we should create a specialized
6445 PyFrame_New() that doesn't take locals, but does
6446 take builtins without sanity checking them.
6447 */
6448 assert(tstate != NULL);
6449 f = PyFrame_New(tstate, co, globals, NULL);
6450 if (f == NULL) {
6451 return NULL;
6452 }
6453 fastlocals = __Pyx_PyFrame_GetLocalsplus(f);
6454 for (i = 0; i < na; i++) {
6455 Py_INCREF(*args);
6456 fastlocals[i] = *args++;
6457 }
6458 result = PyEval_EvalFrameEx(f,0);
6459 ++tstate->recursion_depth;
6460 Py_DECREF(f);
6461 --tstate->recursion_depth;
6462 return result;
6463 }
6464 #if 1 || PY_VERSION_HEX < 0x030600B1
__Pyx_PyFunction_FastCallDict(PyObject * func,PyObject ** args,Py_ssize_t nargs,PyObject * kwargs)6465 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) {
6466 PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
6467 PyObject *globals = PyFunction_GET_GLOBALS(func);
6468 PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
6469 PyObject *closure;
6470 #if PY_MAJOR_VERSION >= 3
6471 PyObject *kwdefs;
6472 #endif
6473 PyObject *kwtuple, **k;
6474 PyObject **d;
6475 Py_ssize_t nd;
6476 Py_ssize_t nk;
6477 PyObject *result;
6478 assert(kwargs == NULL || PyDict_Check(kwargs));
6479 nk = kwargs ? PyDict_Size(kwargs) : 0;
6480 if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
6481 return NULL;
6482 }
6483 if (
6484 #if PY_MAJOR_VERSION >= 3
6485 co->co_kwonlyargcount == 0 &&
6486 #endif
6487 likely(kwargs == NULL || nk == 0) &&
6488 co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
6489 if (argdefs == NULL && co->co_argcount == nargs) {
6490 result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
6491 goto done;
6492 }
6493 else if (nargs == 0 && argdefs != NULL
6494 && co->co_argcount == Py_SIZE(argdefs)) {
6495 /* function called with no arguments, but all parameters have
6496 a default value: use default values as arguments .*/
6497 args = &PyTuple_GET_ITEM(argdefs, 0);
6498 result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
6499 goto done;
6500 }
6501 }
6502 if (kwargs != NULL) {
6503 Py_ssize_t pos, i;
6504 kwtuple = PyTuple_New(2 * nk);
6505 if (kwtuple == NULL) {
6506 result = NULL;
6507 goto done;
6508 }
6509 k = &PyTuple_GET_ITEM(kwtuple, 0);
6510 pos = i = 0;
6511 while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
6512 Py_INCREF(k[i]);
6513 Py_INCREF(k[i+1]);
6514 i += 2;
6515 }
6516 nk = i / 2;
6517 }
6518 else {
6519 kwtuple = NULL;
6520 k = NULL;
6521 }
6522 closure = PyFunction_GET_CLOSURE(func);
6523 #if PY_MAJOR_VERSION >= 3
6524 kwdefs = PyFunction_GET_KW_DEFAULTS(func);
6525 #endif
6526 if (argdefs != NULL) {
6527 d = &PyTuple_GET_ITEM(argdefs, 0);
6528 nd = Py_SIZE(argdefs);
6529 }
6530 else {
6531 d = NULL;
6532 nd = 0;
6533 }
6534 #if PY_MAJOR_VERSION >= 3
6535 result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
6536 args, (int)nargs,
6537 k, (int)nk,
6538 d, (int)nd, kwdefs, closure);
6539 #else
6540 result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
6541 args, (int)nargs,
6542 k, (int)nk,
6543 d, (int)nd, closure);
6544 #endif
6545 Py_XDECREF(kwtuple);
6546 done:
6547 Py_LeaveRecursiveCall();
6548 return result;
6549 }
6550 #endif
6551 #endif
6552
6553 /* PyCFunctionFastCall */
6554 #if CYTHON_FAST_PYCCALL
__Pyx_PyCFunction_FastCall(PyObject * func_obj,PyObject ** args,Py_ssize_t nargs)6555 static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
6556 PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
6557 PyCFunction meth = PyCFunction_GET_FUNCTION(func);
6558 PyObject *self = PyCFunction_GET_SELF(func);
6559 int flags = PyCFunction_GET_FLAGS(func);
6560 assert(PyCFunction_Check(func));
6561 assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS)));
6562 assert(nargs >= 0);
6563 assert(nargs == 0 || args != NULL);
6564 /* _PyCFunction_FastCallDict() must not be called with an exception set,
6565 because it may clear it (directly or indirectly) and so the
6566 caller loses its exception */
6567 assert(!PyErr_Occurred());
6568 if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) {
6569 return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL);
6570 } else {
6571 return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs);
6572 }
6573 }
6574 #endif
6575
6576 /* PyObjectCall */
6577 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_Call(PyObject * func,PyObject * arg,PyObject * kw)6578 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
6579 PyObject *result;
6580 ternaryfunc call = func->ob_type->tp_call;
6581 if (unlikely(!call))
6582 return PyObject_Call(func, arg, kw);
6583 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
6584 return NULL;
6585 result = (*call)(func, arg, kw);
6586 Py_LeaveRecursiveCall();
6587 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
6588 PyErr_SetString(
6589 PyExc_SystemError,
6590 "NULL result without error in PyObject_Call");
6591 }
6592 return result;
6593 }
6594 #endif
6595
6596 /* ExtTypeTest */
__Pyx_TypeTest(PyObject * obj,PyTypeObject * type)6597 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
6598 if (unlikely(!type)) {
6599 PyErr_SetString(PyExc_SystemError, "Missing type object");
6600 return 0;
6601 }
6602 if (likely(__Pyx_TypeCheck(obj, type)))
6603 return 1;
6604 PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
6605 Py_TYPE(obj)->tp_name, type->tp_name);
6606 return 0;
6607 }
6608
6609 /* RaiseDoubleKeywords */
__Pyx_RaiseDoubleKeywordsError(const char * func_name,PyObject * kw_name)6610 static void __Pyx_RaiseDoubleKeywordsError(
6611 const char* func_name,
6612 PyObject* kw_name)
6613 {
6614 PyErr_Format(PyExc_TypeError,
6615 #if PY_MAJOR_VERSION >= 3
6616 "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
6617 #else
6618 "%s() got multiple values for keyword argument '%s'", func_name,
6619 PyString_AsString(kw_name));
6620 #endif
6621 }
6622
6623 /* ParseKeywords */
__Pyx_ParseOptionalKeywords(PyObject * kwds,PyObject ** argnames[],PyObject * kwds2,PyObject * values[],Py_ssize_t num_pos_args,const char * function_name)6624 static int __Pyx_ParseOptionalKeywords(
6625 PyObject *kwds,
6626 PyObject **argnames[],
6627 PyObject *kwds2,
6628 PyObject *values[],
6629 Py_ssize_t num_pos_args,
6630 const char* function_name)
6631 {
6632 PyObject *key = 0, *value = 0;
6633 Py_ssize_t pos = 0;
6634 PyObject*** name;
6635 PyObject*** first_kw_arg = argnames + num_pos_args;
6636 while (PyDict_Next(kwds, &pos, &key, &value)) {
6637 name = first_kw_arg;
6638 while (*name && (**name != key)) name++;
6639 if (*name) {
6640 values[name-argnames] = value;
6641 continue;
6642 }
6643 name = first_kw_arg;
6644 #if PY_MAJOR_VERSION < 3
6645 if (likely(PyString_Check(key))) {
6646 while (*name) {
6647 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
6648 && _PyString_Eq(**name, key)) {
6649 values[name-argnames] = value;
6650 break;
6651 }
6652 name++;
6653 }
6654 if (*name) continue;
6655 else {
6656 PyObject*** argname = argnames;
6657 while (argname != first_kw_arg) {
6658 if ((**argname == key) || (
6659 (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
6660 && _PyString_Eq(**argname, key))) {
6661 goto arg_passed_twice;
6662 }
6663 argname++;
6664 }
6665 }
6666 } else
6667 #endif
6668 if (likely(PyUnicode_Check(key))) {
6669 while (*name) {
6670 int cmp = (**name == key) ? 0 :
6671 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
6672 (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
6673 #endif
6674 PyUnicode_Compare(**name, key);
6675 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
6676 if (cmp == 0) {
6677 values[name-argnames] = value;
6678 break;
6679 }
6680 name++;
6681 }
6682 if (*name) continue;
6683 else {
6684 PyObject*** argname = argnames;
6685 while (argname != first_kw_arg) {
6686 int cmp = (**argname == key) ? 0 :
6687 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
6688 (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 :
6689 #endif
6690 PyUnicode_Compare(**argname, key);
6691 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
6692 if (cmp == 0) goto arg_passed_twice;
6693 argname++;
6694 }
6695 }
6696 } else
6697 goto invalid_keyword_type;
6698 if (kwds2) {
6699 if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
6700 } else {
6701 goto invalid_keyword;
6702 }
6703 }
6704 return 0;
6705 arg_passed_twice:
6706 __Pyx_RaiseDoubleKeywordsError(function_name, key);
6707 goto bad;
6708 invalid_keyword_type:
6709 PyErr_Format(PyExc_TypeError,
6710 "%.200s() keywords must be strings", function_name);
6711 goto bad;
6712 invalid_keyword:
6713 PyErr_Format(PyExc_TypeError,
6714 #if PY_MAJOR_VERSION < 3
6715 "%.200s() got an unexpected keyword argument '%.200s'",
6716 function_name, PyString_AsString(key));
6717 #else
6718 "%s() got an unexpected keyword argument '%U'",
6719 function_name, key);
6720 #endif
6721 bad:
6722 return -1;
6723 }
6724
6725 /* RaiseArgTupleInvalid */
__Pyx_RaiseArgtupleInvalid(const char * func_name,int exact,Py_ssize_t num_min,Py_ssize_t num_max,Py_ssize_t num_found)6726 static void __Pyx_RaiseArgtupleInvalid(
6727 const char* func_name,
6728 int exact,
6729 Py_ssize_t num_min,
6730 Py_ssize_t num_max,
6731 Py_ssize_t num_found)
6732 {
6733 Py_ssize_t num_expected;
6734 const char *more_or_less;
6735 if (num_found < num_min) {
6736 num_expected = num_min;
6737 more_or_less = "at least";
6738 } else {
6739 num_expected = num_max;
6740 more_or_less = "at most";
6741 }
6742 if (exact) {
6743 more_or_less = "exactly";
6744 }
6745 PyErr_Format(PyExc_TypeError,
6746 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
6747 func_name, more_or_less, num_expected,
6748 (num_expected == 1) ? "" : "s", num_found);
6749 }
6750
6751 /* PyErrFetchRestore */
6752 #if CYTHON_FAST_THREAD_STATE
__Pyx_ErrRestoreInState(PyThreadState * tstate,PyObject * type,PyObject * value,PyObject * tb)6753 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
6754 PyObject *tmp_type, *tmp_value, *tmp_tb;
6755 tmp_type = tstate->curexc_type;
6756 tmp_value = tstate->curexc_value;
6757 tmp_tb = tstate->curexc_traceback;
6758 tstate->curexc_type = type;
6759 tstate->curexc_value = value;
6760 tstate->curexc_traceback = tb;
6761 Py_XDECREF(tmp_type);
6762 Py_XDECREF(tmp_value);
6763 Py_XDECREF(tmp_tb);
6764 }
__Pyx_ErrFetchInState(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)6765 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
6766 *type = tstate->curexc_type;
6767 *value = tstate->curexc_value;
6768 *tb = tstate->curexc_traceback;
6769 tstate->curexc_type = 0;
6770 tstate->curexc_value = 0;
6771 tstate->curexc_traceback = 0;
6772 }
6773 #endif
6774
6775 /* RaiseException */
6776 #if PY_MAJOR_VERSION < 3
__Pyx_Raise(PyObject * type,PyObject * value,PyObject * tb,CYTHON_UNUSED PyObject * cause)6777 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
6778 CYTHON_UNUSED PyObject *cause) {
6779 __Pyx_PyThreadState_declare
6780 Py_XINCREF(type);
6781 if (!value || value == Py_None)
6782 value = NULL;
6783 else
6784 Py_INCREF(value);
6785 if (!tb || tb == Py_None)
6786 tb = NULL;
6787 else {
6788 Py_INCREF(tb);
6789 if (!PyTraceBack_Check(tb)) {
6790 PyErr_SetString(PyExc_TypeError,
6791 "raise: arg 3 must be a traceback or None");
6792 goto raise_error;
6793 }
6794 }
6795 if (PyType_Check(type)) {
6796 #if CYTHON_COMPILING_IN_PYPY
6797 if (!value) {
6798 Py_INCREF(Py_None);
6799 value = Py_None;
6800 }
6801 #endif
6802 PyErr_NormalizeException(&type, &value, &tb);
6803 } else {
6804 if (value) {
6805 PyErr_SetString(PyExc_TypeError,
6806 "instance exception may not have a separate value");
6807 goto raise_error;
6808 }
6809 value = type;
6810 type = (PyObject*) Py_TYPE(type);
6811 Py_INCREF(type);
6812 if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
6813 PyErr_SetString(PyExc_TypeError,
6814 "raise: exception class must be a subclass of BaseException");
6815 goto raise_error;
6816 }
6817 }
6818 __Pyx_PyThreadState_assign
6819 __Pyx_ErrRestore(type, value, tb);
6820 return;
6821 raise_error:
6822 Py_XDECREF(value);
6823 Py_XDECREF(type);
6824 Py_XDECREF(tb);
6825 return;
6826 }
6827 #else
__Pyx_Raise(PyObject * type,PyObject * value,PyObject * tb,PyObject * cause)6828 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
6829 PyObject* owned_instance = NULL;
6830 if (tb == Py_None) {
6831 tb = 0;
6832 } else if (tb && !PyTraceBack_Check(tb)) {
6833 PyErr_SetString(PyExc_TypeError,
6834 "raise: arg 3 must be a traceback or None");
6835 goto bad;
6836 }
6837 if (value == Py_None)
6838 value = 0;
6839 if (PyExceptionInstance_Check(type)) {
6840 if (value) {
6841 PyErr_SetString(PyExc_TypeError,
6842 "instance exception may not have a separate value");
6843 goto bad;
6844 }
6845 value = type;
6846 type = (PyObject*) Py_TYPE(value);
6847 } else if (PyExceptionClass_Check(type)) {
6848 PyObject *instance_class = NULL;
6849 if (value && PyExceptionInstance_Check(value)) {
6850 instance_class = (PyObject*) Py_TYPE(value);
6851 if (instance_class != type) {
6852 int is_subclass = PyObject_IsSubclass(instance_class, type);
6853 if (!is_subclass) {
6854 instance_class = NULL;
6855 } else if (unlikely(is_subclass == -1)) {
6856 goto bad;
6857 } else {
6858 type = instance_class;
6859 }
6860 }
6861 }
6862 if (!instance_class) {
6863 PyObject *args;
6864 if (!value)
6865 args = PyTuple_New(0);
6866 else if (PyTuple_Check(value)) {
6867 Py_INCREF(value);
6868 args = value;
6869 } else
6870 args = PyTuple_Pack(1, value);
6871 if (!args)
6872 goto bad;
6873 owned_instance = PyObject_Call(type, args, NULL);
6874 Py_DECREF(args);
6875 if (!owned_instance)
6876 goto bad;
6877 value = owned_instance;
6878 if (!PyExceptionInstance_Check(value)) {
6879 PyErr_Format(PyExc_TypeError,
6880 "calling %R should have returned an instance of "
6881 "BaseException, not %R",
6882 type, Py_TYPE(value));
6883 goto bad;
6884 }
6885 }
6886 } else {
6887 PyErr_SetString(PyExc_TypeError,
6888 "raise: exception class must be a subclass of BaseException");
6889 goto bad;
6890 }
6891 if (cause) {
6892 PyObject *fixed_cause;
6893 if (cause == Py_None) {
6894 fixed_cause = NULL;
6895 } else if (PyExceptionClass_Check(cause)) {
6896 fixed_cause = PyObject_CallObject(cause, NULL);
6897 if (fixed_cause == NULL)
6898 goto bad;
6899 } else if (PyExceptionInstance_Check(cause)) {
6900 fixed_cause = cause;
6901 Py_INCREF(fixed_cause);
6902 } else {
6903 PyErr_SetString(PyExc_TypeError,
6904 "exception causes must derive from "
6905 "BaseException");
6906 goto bad;
6907 }
6908 PyException_SetCause(value, fixed_cause);
6909 }
6910 PyErr_SetObject(type, value);
6911 if (tb) {
6912 #if CYTHON_COMPILING_IN_PYPY
6913 PyObject *tmp_type, *tmp_value, *tmp_tb;
6914 PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
6915 Py_INCREF(tb);
6916 PyErr_Restore(tmp_type, tmp_value, tb);
6917 Py_XDECREF(tmp_tb);
6918 #else
6919 PyThreadState *tstate = __Pyx_PyThreadState_Current;
6920 PyObject* tmp_tb = tstate->curexc_traceback;
6921 if (tb != tmp_tb) {
6922 Py_INCREF(tb);
6923 tstate->curexc_traceback = tb;
6924 Py_XDECREF(tmp_tb);
6925 }
6926 #endif
6927 }
6928 bad:
6929 Py_XDECREF(owned_instance);
6930 return;
6931 }
6932 #endif
6933
6934 /* PyObjectCallMethO */
6935 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_CallMethO(PyObject * func,PyObject * arg)6936 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
6937 PyObject *self, *result;
6938 PyCFunction cfunc;
6939 cfunc = PyCFunction_GET_FUNCTION(func);
6940 self = PyCFunction_GET_SELF(func);
6941 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
6942 return NULL;
6943 result = cfunc(self, arg);
6944 Py_LeaveRecursiveCall();
6945 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
6946 PyErr_SetString(
6947 PyExc_SystemError,
6948 "NULL result without error in PyObject_Call");
6949 }
6950 return result;
6951 }
6952 #endif
6953
6954 /* PyObjectCallOneArg */
6955 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx__PyObject_CallOneArg(PyObject * func,PyObject * arg)6956 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
6957 PyObject *result;
6958 PyObject *args = PyTuple_New(1);
6959 if (unlikely(!args)) return NULL;
6960 Py_INCREF(arg);
6961 PyTuple_SET_ITEM(args, 0, arg);
6962 result = __Pyx_PyObject_Call(func, args, NULL);
6963 Py_DECREF(args);
6964 return result;
6965 }
__Pyx_PyObject_CallOneArg(PyObject * func,PyObject * arg)6966 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
6967 #if CYTHON_FAST_PYCALL
6968 if (PyFunction_Check(func)) {
6969 return __Pyx_PyFunction_FastCall(func, &arg, 1);
6970 }
6971 #endif
6972 if (likely(PyCFunction_Check(func))) {
6973 if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
6974 return __Pyx_PyObject_CallMethO(func, arg);
6975 #if CYTHON_FAST_PYCCALL
6976 } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
6977 return __Pyx_PyCFunction_FastCall(func, &arg, 1);
6978 #endif
6979 }
6980 }
6981 return __Pyx__PyObject_CallOneArg(func, arg);
6982 }
6983 #else
__Pyx_PyObject_CallOneArg(PyObject * func,PyObject * arg)6984 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
6985 PyObject *result;
6986 PyObject *args = PyTuple_Pack(1, arg);
6987 if (unlikely(!args)) return NULL;
6988 result = __Pyx_PyObject_Call(func, args, NULL);
6989 Py_DECREF(args);
6990 return result;
6991 }
6992 #endif
6993
6994 /* GetAttr */
__Pyx_GetAttr(PyObject * o,PyObject * n)6995 static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) {
6996 #if CYTHON_USE_TYPE_SLOTS
6997 #if PY_MAJOR_VERSION >= 3
6998 if (likely(PyUnicode_Check(n)))
6999 #else
7000 if (likely(PyString_Check(n)))
7001 #endif
7002 return __Pyx_PyObject_GetAttrStr(o, n);
7003 #endif
7004 return PyObject_GetAttr(o, n);
7005 }
7006
7007 /* GetTopmostException */
7008 #if CYTHON_USE_EXC_INFO_STACK
7009 static _PyErr_StackItem *
__Pyx_PyErr_GetTopmostException(PyThreadState * tstate)7010 __Pyx_PyErr_GetTopmostException(PyThreadState *tstate)
7011 {
7012 _PyErr_StackItem *exc_info = tstate->exc_info;
7013 while ((exc_info->exc_type == NULL || exc_info->exc_type == Py_None) &&
7014 exc_info->previous_item != NULL)
7015 {
7016 exc_info = exc_info->previous_item;
7017 }
7018 return exc_info;
7019 }
7020 #endif
7021
7022 /* SaveResetException */
7023 #if CYTHON_FAST_THREAD_STATE
__Pyx__ExceptionSave(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)7024 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
7025 #if CYTHON_USE_EXC_INFO_STACK
7026 _PyErr_StackItem *exc_info = __Pyx_PyErr_GetTopmostException(tstate);
7027 *type = exc_info->exc_type;
7028 *value = exc_info->exc_value;
7029 *tb = exc_info->exc_traceback;
7030 #else
7031 *type = tstate->exc_type;
7032 *value = tstate->exc_value;
7033 *tb = tstate->exc_traceback;
7034 #endif
7035 Py_XINCREF(*type);
7036 Py_XINCREF(*value);
7037 Py_XINCREF(*tb);
7038 }
__Pyx__ExceptionReset(PyThreadState * tstate,PyObject * type,PyObject * value,PyObject * tb)7039 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
7040 PyObject *tmp_type, *tmp_value, *tmp_tb;
7041 #if CYTHON_USE_EXC_INFO_STACK
7042 _PyErr_StackItem *exc_info = tstate->exc_info;
7043 tmp_type = exc_info->exc_type;
7044 tmp_value = exc_info->exc_value;
7045 tmp_tb = exc_info->exc_traceback;
7046 exc_info->exc_type = type;
7047 exc_info->exc_value = value;
7048 exc_info->exc_traceback = tb;
7049 #else
7050 tmp_type = tstate->exc_type;
7051 tmp_value = tstate->exc_value;
7052 tmp_tb = tstate->exc_traceback;
7053 tstate->exc_type = type;
7054 tstate->exc_value = value;
7055 tstate->exc_traceback = tb;
7056 #endif
7057 Py_XDECREF(tmp_type);
7058 Py_XDECREF(tmp_value);
7059 Py_XDECREF(tmp_tb);
7060 }
7061 #endif
7062
7063 /* PyErrExceptionMatches */
7064 #if CYTHON_FAST_THREAD_STATE
__Pyx_PyErr_ExceptionMatchesTuple(PyObject * exc_type,PyObject * tuple)7065 static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
7066 Py_ssize_t i, n;
7067 n = PyTuple_GET_SIZE(tuple);
7068 #if PY_MAJOR_VERSION >= 3
7069 for (i=0; i<n; i++) {
7070 if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
7071 }
7072 #endif
7073 for (i=0; i<n; i++) {
7074 if (__Pyx_PyErr_GivenExceptionMatches(exc_type, PyTuple_GET_ITEM(tuple, i))) return 1;
7075 }
7076 return 0;
7077 }
__Pyx_PyErr_ExceptionMatchesInState(PyThreadState * tstate,PyObject * err)7078 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
7079 PyObject *exc_type = tstate->curexc_type;
7080 if (exc_type == err) return 1;
7081 if (unlikely(!exc_type)) return 0;
7082 if (unlikely(PyTuple_Check(err)))
7083 return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err);
7084 return __Pyx_PyErr_GivenExceptionMatches(exc_type, err);
7085 }
7086 #endif
7087
7088 /* GetException */
7089 #if CYTHON_FAST_THREAD_STATE
__Pyx__GetException(PyThreadState * tstate,PyObject ** type,PyObject ** value,PyObject ** tb)7090 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb)
7091 #else
7092 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb)
7093 #endif
7094 {
7095 PyObject *local_type, *local_value, *local_tb;
7096 #if CYTHON_FAST_THREAD_STATE
7097 PyObject *tmp_type, *tmp_value, *tmp_tb;
7098 local_type = tstate->curexc_type;
7099 local_value = tstate->curexc_value;
7100 local_tb = tstate->curexc_traceback;
7101 tstate->curexc_type = 0;
7102 tstate->curexc_value = 0;
7103 tstate->curexc_traceback = 0;
7104 #else
7105 PyErr_Fetch(&local_type, &local_value, &local_tb);
7106 #endif
7107 PyErr_NormalizeException(&local_type, &local_value, &local_tb);
7108 #if CYTHON_FAST_THREAD_STATE
7109 if (unlikely(tstate->curexc_type))
7110 #else
7111 if (unlikely(PyErr_Occurred()))
7112 #endif
7113 goto bad;
7114 #if PY_MAJOR_VERSION >= 3
7115 if (local_tb) {
7116 if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
7117 goto bad;
7118 }
7119 #endif
7120 Py_XINCREF(local_tb);
7121 Py_XINCREF(local_type);
7122 Py_XINCREF(local_value);
7123 *type = local_type;
7124 *value = local_value;
7125 *tb = local_tb;
7126 #if CYTHON_FAST_THREAD_STATE
7127 #if CYTHON_USE_EXC_INFO_STACK
7128 {
7129 _PyErr_StackItem *exc_info = tstate->exc_info;
7130 tmp_type = exc_info->exc_type;
7131 tmp_value = exc_info->exc_value;
7132 tmp_tb = exc_info->exc_traceback;
7133 exc_info->exc_type = local_type;
7134 exc_info->exc_value = local_value;
7135 exc_info->exc_traceback = local_tb;
7136 }
7137 #else
7138 tmp_type = tstate->exc_type;
7139 tmp_value = tstate->exc_value;
7140 tmp_tb = tstate->exc_traceback;
7141 tstate->exc_type = local_type;
7142 tstate->exc_value = local_value;
7143 tstate->exc_traceback = local_tb;
7144 #endif
7145 Py_XDECREF(tmp_type);
7146 Py_XDECREF(tmp_value);
7147 Py_XDECREF(tmp_tb);
7148 #else
7149 PyErr_SetExcInfo(local_type, local_value, local_tb);
7150 #endif
7151 return 0;
7152 bad:
7153 *type = 0;
7154 *value = 0;
7155 *tb = 0;
7156 Py_XDECREF(local_type);
7157 Py_XDECREF(local_value);
7158 Py_XDECREF(local_tb);
7159 return -1;
7160 }
7161
7162 /* IterFinish */
__Pyx_IterFinish(void)7163 static CYTHON_INLINE int __Pyx_IterFinish(void) {
7164 #if CYTHON_FAST_THREAD_STATE
7165 PyThreadState *tstate = __Pyx_PyThreadState_Current;
7166 PyObject* exc_type = tstate->curexc_type;
7167 if (unlikely(exc_type)) {
7168 if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) {
7169 PyObject *exc_value, *exc_tb;
7170 exc_value = tstate->curexc_value;
7171 exc_tb = tstate->curexc_traceback;
7172 tstate->curexc_type = 0;
7173 tstate->curexc_value = 0;
7174 tstate->curexc_traceback = 0;
7175 Py_DECREF(exc_type);
7176 Py_XDECREF(exc_value);
7177 Py_XDECREF(exc_tb);
7178 return 0;
7179 } else {
7180 return -1;
7181 }
7182 }
7183 return 0;
7184 #else
7185 if (unlikely(PyErr_Occurred())) {
7186 if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) {
7187 PyErr_Clear();
7188 return 0;
7189 } else {
7190 return -1;
7191 }
7192 }
7193 return 0;
7194 #endif
7195 }
7196
7197 /* PyObjectCallNoArg */
7198 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_PyObject_CallNoArg(PyObject * func)7199 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) {
7200 #if CYTHON_FAST_PYCALL
7201 if (PyFunction_Check(func)) {
7202 return __Pyx_PyFunction_FastCall(func, NULL, 0);
7203 }
7204 #endif
7205 #ifdef __Pyx_CyFunction_USED
7206 if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func)))
7207 #else
7208 if (likely(PyCFunction_Check(func)))
7209 #endif
7210 {
7211 if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) {
7212 return __Pyx_PyObject_CallMethO(func, NULL);
7213 }
7214 }
7215 return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL);
7216 }
7217 #endif
7218
7219 /* PyObjectGetMethod */
__Pyx_PyObject_GetMethod(PyObject * obj,PyObject * name,PyObject ** method)7220 static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) {
7221 PyObject *attr;
7222 #if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP
7223 PyTypeObject *tp = Py_TYPE(obj);
7224 PyObject *descr;
7225 descrgetfunc f = NULL;
7226 PyObject **dictptr, *dict;
7227 int meth_found = 0;
7228 assert (*method == NULL);
7229 if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) {
7230 attr = __Pyx_PyObject_GetAttrStr(obj, name);
7231 goto try_unpack;
7232 }
7233 if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) {
7234 return 0;
7235 }
7236 descr = _PyType_Lookup(tp, name);
7237 if (likely(descr != NULL)) {
7238 Py_INCREF(descr);
7239 #if PY_MAJOR_VERSION >= 3
7240 #ifdef __Pyx_CyFunction_USED
7241 if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr)))
7242 #else
7243 if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type)))
7244 #endif
7245 #else
7246 #ifdef __Pyx_CyFunction_USED
7247 if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr)))
7248 #else
7249 if (likely(PyFunction_Check(descr)))
7250 #endif
7251 #endif
7252 {
7253 meth_found = 1;
7254 } else {
7255 f = Py_TYPE(descr)->tp_descr_get;
7256 if (f != NULL && PyDescr_IsData(descr)) {
7257 attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
7258 Py_DECREF(descr);
7259 goto try_unpack;
7260 }
7261 }
7262 }
7263 dictptr = _PyObject_GetDictPtr(obj);
7264 if (dictptr != NULL && (dict = *dictptr) != NULL) {
7265 Py_INCREF(dict);
7266 attr = __Pyx_PyDict_GetItemStr(dict, name);
7267 if (attr != NULL) {
7268 Py_INCREF(attr);
7269 Py_DECREF(dict);
7270 Py_XDECREF(descr);
7271 goto try_unpack;
7272 }
7273 Py_DECREF(dict);
7274 }
7275 if (meth_found) {
7276 *method = descr;
7277 return 1;
7278 }
7279 if (f != NULL) {
7280 attr = f(descr, obj, (PyObject *)Py_TYPE(obj));
7281 Py_DECREF(descr);
7282 goto try_unpack;
7283 }
7284 if (descr != NULL) {
7285 *method = descr;
7286 return 0;
7287 }
7288 PyErr_Format(PyExc_AttributeError,
7289 #if PY_MAJOR_VERSION >= 3
7290 "'%.50s' object has no attribute '%U'",
7291 tp->tp_name, name);
7292 #else
7293 "'%.50s' object has no attribute '%.400s'",
7294 tp->tp_name, PyString_AS_STRING(name));
7295 #endif
7296 return 0;
7297 #else
7298 attr = __Pyx_PyObject_GetAttrStr(obj, name);
7299 goto try_unpack;
7300 #endif
7301 try_unpack:
7302 #if CYTHON_UNPACK_METHODS
7303 if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) {
7304 PyObject *function = PyMethod_GET_FUNCTION(attr);
7305 Py_INCREF(function);
7306 Py_DECREF(attr);
7307 *method = function;
7308 return 1;
7309 }
7310 #endif
7311 *method = attr;
7312 return 0;
7313 }
7314
7315 /* PyObjectCallMethod0 */
__Pyx_PyObject_CallMethod0(PyObject * obj,PyObject * method_name)7316 static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) {
7317 PyObject *method = NULL, *result = NULL;
7318 int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method);
7319 if (likely(is_method)) {
7320 result = __Pyx_PyObject_CallOneArg(method, obj);
7321 Py_DECREF(method);
7322 return result;
7323 }
7324 if (unlikely(!method)) goto bad;
7325 result = __Pyx_PyObject_CallNoArg(method);
7326 Py_DECREF(method);
7327 bad:
7328 return result;
7329 }
7330
7331 /* RaiseNeedMoreValuesToUnpack */
__Pyx_RaiseNeedMoreValuesError(Py_ssize_t index)7332 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
7333 PyErr_Format(PyExc_ValueError,
7334 "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
7335 index, (index == 1) ? "" : "s");
7336 }
7337
7338 /* RaiseTooManyValuesToUnpack */
__Pyx_RaiseTooManyValuesError(Py_ssize_t expected)7339 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
7340 PyErr_Format(PyExc_ValueError,
7341 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
7342 }
7343
7344 /* UnpackItemEndCheck */
__Pyx_IternextUnpackEndCheck(PyObject * retval,Py_ssize_t expected)7345 static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) {
7346 if (unlikely(retval)) {
7347 Py_DECREF(retval);
7348 __Pyx_RaiseTooManyValuesError(expected);
7349 return -1;
7350 } else {
7351 return __Pyx_IterFinish();
7352 }
7353 return 0;
7354 }
7355
7356 /* RaiseNoneIterError */
__Pyx_RaiseNoneNotIterableError(void)7357 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
7358 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
7359 }
7360
7361 /* UnpackTupleError */
__Pyx_UnpackTupleError(PyObject * t,Py_ssize_t index)7362 static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) {
7363 if (t == Py_None) {
7364 __Pyx_RaiseNoneNotIterableError();
7365 } else if (PyTuple_GET_SIZE(t) < index) {
7366 __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t));
7367 } else {
7368 __Pyx_RaiseTooManyValuesError(index);
7369 }
7370 }
7371
7372 /* UnpackTuple2 */
__Pyx_unpack_tuple2_exact(PyObject * tuple,PyObject ** pvalue1,PyObject ** pvalue2,int decref_tuple)7373 static CYTHON_INLINE int __Pyx_unpack_tuple2_exact(
7374 PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2, int decref_tuple) {
7375 PyObject *value1 = NULL, *value2 = NULL;
7376 #if CYTHON_COMPILING_IN_PYPY
7377 value1 = PySequence_ITEM(tuple, 0); if (unlikely(!value1)) goto bad;
7378 value2 = PySequence_ITEM(tuple, 1); if (unlikely(!value2)) goto bad;
7379 #else
7380 value1 = PyTuple_GET_ITEM(tuple, 0); Py_INCREF(value1);
7381 value2 = PyTuple_GET_ITEM(tuple, 1); Py_INCREF(value2);
7382 #endif
7383 if (decref_tuple) {
7384 Py_DECREF(tuple);
7385 }
7386 *pvalue1 = value1;
7387 *pvalue2 = value2;
7388 return 0;
7389 #if CYTHON_COMPILING_IN_PYPY
7390 bad:
7391 Py_XDECREF(value1);
7392 Py_XDECREF(value2);
7393 if (decref_tuple) { Py_XDECREF(tuple); }
7394 return -1;
7395 #endif
7396 }
__Pyx_unpack_tuple2_generic(PyObject * tuple,PyObject ** pvalue1,PyObject ** pvalue2,int has_known_size,int decref_tuple)7397 static int __Pyx_unpack_tuple2_generic(PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2,
7398 int has_known_size, int decref_tuple) {
7399 Py_ssize_t index;
7400 PyObject *value1 = NULL, *value2 = NULL, *iter = NULL;
7401 iternextfunc iternext;
7402 iter = PyObject_GetIter(tuple);
7403 if (unlikely(!iter)) goto bad;
7404 if (decref_tuple) { Py_DECREF(tuple); tuple = NULL; }
7405 iternext = Py_TYPE(iter)->tp_iternext;
7406 value1 = iternext(iter); if (unlikely(!value1)) { index = 0; goto unpacking_failed; }
7407 value2 = iternext(iter); if (unlikely(!value2)) { index = 1; goto unpacking_failed; }
7408 if (!has_known_size && unlikely(__Pyx_IternextUnpackEndCheck(iternext(iter), 2))) goto bad;
7409 Py_DECREF(iter);
7410 *pvalue1 = value1;
7411 *pvalue2 = value2;
7412 return 0;
7413 unpacking_failed:
7414 if (!has_known_size && __Pyx_IterFinish() == 0)
7415 __Pyx_RaiseNeedMoreValuesError(index);
7416 bad:
7417 Py_XDECREF(iter);
7418 Py_XDECREF(value1);
7419 Py_XDECREF(value2);
7420 if (decref_tuple) { Py_XDECREF(tuple); }
7421 return -1;
7422 }
7423
7424 /* dict_iter */
__Pyx_dict_iterator(PyObject * iterable,int is_dict,PyObject * method_name,Py_ssize_t * p_orig_length,int * p_source_is_dict)7425 static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* iterable, int is_dict, PyObject* method_name,
7426 Py_ssize_t* p_orig_length, int* p_source_is_dict) {
7427 is_dict = is_dict || likely(PyDict_CheckExact(iterable));
7428 *p_source_is_dict = is_dict;
7429 if (is_dict) {
7430 #if !CYTHON_COMPILING_IN_PYPY
7431 *p_orig_length = PyDict_Size(iterable);
7432 Py_INCREF(iterable);
7433 return iterable;
7434 #elif PY_MAJOR_VERSION >= 3
7435 static PyObject *py_items = NULL, *py_keys = NULL, *py_values = NULL;
7436 PyObject **pp = NULL;
7437 if (method_name) {
7438 const char *name = PyUnicode_AsUTF8(method_name);
7439 if (strcmp(name, "iteritems") == 0) pp = &py_items;
7440 else if (strcmp(name, "iterkeys") == 0) pp = &py_keys;
7441 else if (strcmp(name, "itervalues") == 0) pp = &py_values;
7442 if (pp) {
7443 if (!*pp) {
7444 *pp = PyUnicode_FromString(name + 4);
7445 if (!*pp)
7446 return NULL;
7447 }
7448 method_name = *pp;
7449 }
7450 }
7451 #endif
7452 }
7453 *p_orig_length = 0;
7454 if (method_name) {
7455 PyObject* iter;
7456 iterable = __Pyx_PyObject_CallMethod0(iterable, method_name);
7457 if (!iterable)
7458 return NULL;
7459 #if !CYTHON_COMPILING_IN_PYPY
7460 if (PyTuple_CheckExact(iterable) || PyList_CheckExact(iterable))
7461 return iterable;
7462 #endif
7463 iter = PyObject_GetIter(iterable);
7464 Py_DECREF(iterable);
7465 return iter;
7466 }
7467 return PyObject_GetIter(iterable);
7468 }
__Pyx_dict_iter_next(PyObject * iter_obj,CYTHON_NCP_UNUSED Py_ssize_t orig_length,CYTHON_NCP_UNUSED Py_ssize_t * ppos,PyObject ** pkey,PyObject ** pvalue,PyObject ** pitem,int source_is_dict)7469 static CYTHON_INLINE int __Pyx_dict_iter_next(
7470 PyObject* iter_obj, CYTHON_NCP_UNUSED Py_ssize_t orig_length, CYTHON_NCP_UNUSED Py_ssize_t* ppos,
7471 PyObject** pkey, PyObject** pvalue, PyObject** pitem, int source_is_dict) {
7472 PyObject* next_item;
7473 #if !CYTHON_COMPILING_IN_PYPY
7474 if (source_is_dict) {
7475 PyObject *key, *value;
7476 if (unlikely(orig_length != PyDict_Size(iter_obj))) {
7477 PyErr_SetString(PyExc_RuntimeError, "dictionary changed size during iteration");
7478 return -1;
7479 }
7480 if (unlikely(!PyDict_Next(iter_obj, ppos, &key, &value))) {
7481 return 0;
7482 }
7483 if (pitem) {
7484 PyObject* tuple = PyTuple_New(2);
7485 if (unlikely(!tuple)) {
7486 return -1;
7487 }
7488 Py_INCREF(key);
7489 Py_INCREF(value);
7490 PyTuple_SET_ITEM(tuple, 0, key);
7491 PyTuple_SET_ITEM(tuple, 1, value);
7492 *pitem = tuple;
7493 } else {
7494 if (pkey) {
7495 Py_INCREF(key);
7496 *pkey = key;
7497 }
7498 if (pvalue) {
7499 Py_INCREF(value);
7500 *pvalue = value;
7501 }
7502 }
7503 return 1;
7504 } else if (PyTuple_CheckExact(iter_obj)) {
7505 Py_ssize_t pos = *ppos;
7506 if (unlikely(pos >= PyTuple_GET_SIZE(iter_obj))) return 0;
7507 *ppos = pos + 1;
7508 next_item = PyTuple_GET_ITEM(iter_obj, pos);
7509 Py_INCREF(next_item);
7510 } else if (PyList_CheckExact(iter_obj)) {
7511 Py_ssize_t pos = *ppos;
7512 if (unlikely(pos >= PyList_GET_SIZE(iter_obj))) return 0;
7513 *ppos = pos + 1;
7514 next_item = PyList_GET_ITEM(iter_obj, pos);
7515 Py_INCREF(next_item);
7516 } else
7517 #endif
7518 {
7519 next_item = PyIter_Next(iter_obj);
7520 if (unlikely(!next_item)) {
7521 return __Pyx_IterFinish();
7522 }
7523 }
7524 if (pitem) {
7525 *pitem = next_item;
7526 } else if (pkey && pvalue) {
7527 if (__Pyx_unpack_tuple2(next_item, pkey, pvalue, source_is_dict, source_is_dict, 1))
7528 return -1;
7529 } else if (pkey) {
7530 *pkey = next_item;
7531 } else {
7532 *pvalue = next_item;
7533 }
7534 return 1;
7535 }
7536
7537 /* MergeKeywords */
__Pyx_MergeKeywords(PyObject * kwdict,PyObject * source_mapping)7538 static int __Pyx_MergeKeywords(PyObject *kwdict, PyObject *source_mapping) {
7539 PyObject *iter, *key = NULL, *value = NULL;
7540 int source_is_dict, result;
7541 Py_ssize_t orig_length, ppos = 0;
7542 iter = __Pyx_dict_iterator(source_mapping, 0, __pyx_n_s_items, &orig_length, &source_is_dict);
7543 if (unlikely(!iter)) {
7544 PyObject *args;
7545 if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
7546 PyErr_Clear();
7547 args = PyTuple_Pack(1, source_mapping);
7548 if (likely(args)) {
7549 PyObject *fallback = PyObject_Call((PyObject*)&PyDict_Type, args, NULL);
7550 Py_DECREF(args);
7551 if (likely(fallback)) {
7552 iter = __Pyx_dict_iterator(fallback, 1, __pyx_n_s_items, &orig_length, &source_is_dict);
7553 Py_DECREF(fallback);
7554 }
7555 }
7556 if (unlikely(!iter)) goto bad;
7557 }
7558 while (1) {
7559 result = __Pyx_dict_iter_next(iter, orig_length, &ppos, &key, &value, NULL, source_is_dict);
7560 if (unlikely(result < 0)) goto bad;
7561 if (!result) break;
7562 if (unlikely(PyDict_Contains(kwdict, key))) {
7563 __Pyx_RaiseDoubleKeywordsError("function", key);
7564 result = -1;
7565 } else {
7566 result = PyDict_SetItem(kwdict, key, value);
7567 }
7568 Py_DECREF(key);
7569 Py_DECREF(value);
7570 if (unlikely(result < 0)) goto bad;
7571 }
7572 Py_XDECREF(iter);
7573 return 0;
7574 bad:
7575 Py_XDECREF(iter);
7576 return -1;
7577 }
7578
7579 /* UnpackUnboundCMethod */
__Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction * target)7580 static int __Pyx_TryUnpackUnboundCMethod(__Pyx_CachedCFunction* target) {
7581 PyObject *method;
7582 method = __Pyx_PyObject_GetAttrStr(target->type, *target->method_name);
7583 if (unlikely(!method))
7584 return -1;
7585 target->method = method;
7586 #if CYTHON_COMPILING_IN_CPYTHON
7587 #if PY_MAJOR_VERSION >= 3
7588 if (likely(__Pyx_TypeCheck(method, &PyMethodDescr_Type)))
7589 #endif
7590 {
7591 PyMethodDescrObject *descr = (PyMethodDescrObject*) method;
7592 target->func = descr->d_method->ml_meth;
7593 target->flag = descr->d_method->ml_flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_STACKLESS);
7594 }
7595 #endif
7596 return 0;
7597 }
7598
7599 /* CallUnboundCMethod1 */
7600 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction * cfunc,PyObject * self,PyObject * arg)7601 static CYTHON_INLINE PyObject* __Pyx_CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg) {
7602 if (likely(cfunc->func)) {
7603 int flag = cfunc->flag;
7604 if (flag == METH_O) {
7605 return (*(cfunc->func))(self, arg);
7606 } else if (PY_VERSION_HEX >= 0x030600B1 && flag == METH_FASTCALL) {
7607 if (PY_VERSION_HEX >= 0x030700A0) {
7608 return (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)cfunc->func)(self, &arg, 1);
7609 } else {
7610 return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL);
7611 }
7612 } else if (PY_VERSION_HEX >= 0x030700A0 && flag == (METH_FASTCALL | METH_KEYWORDS)) {
7613 return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, &arg, 1, NULL);
7614 }
7615 }
7616 return __Pyx__CallUnboundCMethod1(cfunc, self, arg);
7617 }
7618 #endif
__Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction * cfunc,PyObject * self,PyObject * arg)7619 static PyObject* __Pyx__CallUnboundCMethod1(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg){
7620 PyObject *args, *result = NULL;
7621 if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
7622 #if CYTHON_COMPILING_IN_CPYTHON
7623 if (cfunc->func && (cfunc->flag & METH_VARARGS)) {
7624 args = PyTuple_New(1);
7625 if (unlikely(!args)) goto bad;
7626 Py_INCREF(arg);
7627 PyTuple_SET_ITEM(args, 0, arg);
7628 if (cfunc->flag & METH_KEYWORDS)
7629 result = (*(PyCFunctionWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, NULL);
7630 else
7631 result = (*cfunc->func)(self, args);
7632 } else {
7633 args = PyTuple_New(2);
7634 if (unlikely(!args)) goto bad;
7635 Py_INCREF(self);
7636 PyTuple_SET_ITEM(args, 0, self);
7637 Py_INCREF(arg);
7638 PyTuple_SET_ITEM(args, 1, arg);
7639 result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
7640 }
7641 #else
7642 args = PyTuple_Pack(2, self, arg);
7643 if (unlikely(!args)) goto bad;
7644 result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
7645 #endif
7646 bad:
7647 Py_XDECREF(args);
7648 return result;
7649 }
7650
7651 /* CallUnboundCMethod2 */
7652 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030600B1
__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction * cfunc,PyObject * self,PyObject * arg1,PyObject * arg2)7653 static CYTHON_INLINE PyObject *__Pyx_CallUnboundCMethod2(__Pyx_CachedCFunction *cfunc, PyObject *self, PyObject *arg1, PyObject *arg2) {
7654 if (likely(cfunc->func)) {
7655 PyObject *args[2] = {arg1, arg2};
7656 if (cfunc->flag == METH_FASTCALL) {
7657 #if PY_VERSION_HEX >= 0x030700A0
7658 return (*(__Pyx_PyCFunctionFast)(void*)(PyCFunction)cfunc->func)(self, args, 2);
7659 #else
7660 return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, 2, NULL);
7661 #endif
7662 }
7663 #if PY_VERSION_HEX >= 0x030700A0
7664 if (cfunc->flag == (METH_FASTCALL | METH_KEYWORDS))
7665 return (*(__Pyx_PyCFunctionFastWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, 2, NULL);
7666 #endif
7667 }
7668 return __Pyx__CallUnboundCMethod2(cfunc, self, arg1, arg2);
7669 }
7670 #endif
__Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction * cfunc,PyObject * self,PyObject * arg1,PyObject * arg2)7671 static PyObject* __Pyx__CallUnboundCMethod2(__Pyx_CachedCFunction* cfunc, PyObject* self, PyObject* arg1, PyObject* arg2){
7672 PyObject *args, *result = NULL;
7673 if (unlikely(!cfunc->func && !cfunc->method) && unlikely(__Pyx_TryUnpackUnboundCMethod(cfunc) < 0)) return NULL;
7674 #if CYTHON_COMPILING_IN_CPYTHON
7675 if (cfunc->func && (cfunc->flag & METH_VARARGS)) {
7676 args = PyTuple_New(2);
7677 if (unlikely(!args)) goto bad;
7678 Py_INCREF(arg1);
7679 PyTuple_SET_ITEM(args, 0, arg1);
7680 Py_INCREF(arg2);
7681 PyTuple_SET_ITEM(args, 1, arg2);
7682 if (cfunc->flag & METH_KEYWORDS)
7683 result = (*(PyCFunctionWithKeywords)(void*)(PyCFunction)cfunc->func)(self, args, NULL);
7684 else
7685 result = (*cfunc->func)(self, args);
7686 } else {
7687 args = PyTuple_New(3);
7688 if (unlikely(!args)) goto bad;
7689 Py_INCREF(self);
7690 PyTuple_SET_ITEM(args, 0, self);
7691 Py_INCREF(arg1);
7692 PyTuple_SET_ITEM(args, 1, arg1);
7693 Py_INCREF(arg2);
7694 PyTuple_SET_ITEM(args, 2, arg2);
7695 result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
7696 }
7697 #else
7698 args = PyTuple_Pack(3, self, arg1, arg2);
7699 if (unlikely(!args)) goto bad;
7700 result = __Pyx_PyObject_Call(cfunc->method, args, NULL);
7701 #endif
7702 bad:
7703 Py_XDECREF(args);
7704 return result;
7705 }
7706
7707 /* dict_getitem_default */
__Pyx_PyDict_GetItemDefault(PyObject * d,PyObject * key,PyObject * default_value)7708 static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value) {
7709 PyObject* value;
7710 #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
7711 value = PyDict_GetItemWithError(d, key);
7712 if (unlikely(!value)) {
7713 if (unlikely(PyErr_Occurred()))
7714 return NULL;
7715 value = default_value;
7716 }
7717 Py_INCREF(value);
7718 if ((1));
7719 #else
7720 if (PyString_CheckExact(key) || PyUnicode_CheckExact(key) || PyInt_CheckExact(key)) {
7721 value = PyDict_GetItem(d, key);
7722 if (unlikely(!value)) {
7723 value = default_value;
7724 }
7725 Py_INCREF(value);
7726 }
7727 #endif
7728 else {
7729 if (default_value == Py_None)
7730 value = __Pyx_CallUnboundCMethod1(&__pyx_umethod_PyDict_Type_get, d, key);
7731 else
7732 value = __Pyx_CallUnboundCMethod2(&__pyx_umethod_PyDict_Type_get, d, key, default_value);
7733 }
7734 return value;
7735 }
7736
7737 /* PyObject_GenericGetAttrNoDict */
7738 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
__Pyx_RaiseGenericGetAttributeError(PyTypeObject * tp,PyObject * attr_name)7739 static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) {
7740 PyErr_Format(PyExc_AttributeError,
7741 #if PY_MAJOR_VERSION >= 3
7742 "'%.50s' object has no attribute '%U'",
7743 tp->tp_name, attr_name);
7744 #else
7745 "'%.50s' object has no attribute '%.400s'",
7746 tp->tp_name, PyString_AS_STRING(attr_name));
7747 #endif
7748 return NULL;
7749 }
__Pyx_PyObject_GenericGetAttrNoDict(PyObject * obj,PyObject * attr_name)7750 static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) {
7751 PyObject *descr;
7752 PyTypeObject *tp = Py_TYPE(obj);
7753 if (unlikely(!PyString_Check(attr_name))) {
7754 return PyObject_GenericGetAttr(obj, attr_name);
7755 }
7756 assert(!tp->tp_dictoffset);
7757 descr = _PyType_Lookup(tp, attr_name);
7758 if (unlikely(!descr)) {
7759 return __Pyx_RaiseGenericGetAttributeError(tp, attr_name);
7760 }
7761 Py_INCREF(descr);
7762 #if PY_MAJOR_VERSION < 3
7763 if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS)))
7764 #endif
7765 {
7766 descrgetfunc f = Py_TYPE(descr)->tp_descr_get;
7767 if (unlikely(f)) {
7768 PyObject *res = f(descr, obj, (PyObject *)tp);
7769 Py_DECREF(descr);
7770 return res;
7771 }
7772 }
7773 return descr;
7774 }
7775 #endif
7776
7777 /* PyObject_GenericGetAttr */
7778 #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000
__Pyx_PyObject_GenericGetAttr(PyObject * obj,PyObject * attr_name)7779 static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) {
7780 if (unlikely(Py_TYPE(obj)->tp_dictoffset)) {
7781 return PyObject_GenericGetAttr(obj, attr_name);
7782 }
7783 return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name);
7784 }
7785 #endif
7786
7787 /* SetVTable */
__Pyx_SetVtable(PyObject * dict,void * vtable)7788 static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
7789 #if PY_VERSION_HEX >= 0x02070000
7790 PyObject *ob = PyCapsule_New(vtable, 0, 0);
7791 #else
7792 PyObject *ob = PyCObject_FromVoidPtr(vtable, 0);
7793 #endif
7794 if (!ob)
7795 goto bad;
7796 if (PyDict_SetItem(dict, __pyx_n_s_pyx_vtable, ob) < 0)
7797 goto bad;
7798 Py_DECREF(ob);
7799 return 0;
7800 bad:
7801 Py_XDECREF(ob);
7802 return -1;
7803 }
7804
7805 /* PyObjectGetAttrStrNoError */
__Pyx_PyObject_GetAttrStr_ClearAttributeError(void)7806 static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) {
7807 __Pyx_PyThreadState_declare
7808 __Pyx_PyThreadState_assign
7809 if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
7810 __Pyx_PyErr_Clear();
7811 }
__Pyx_PyObject_GetAttrStrNoError(PyObject * obj,PyObject * attr_name)7812 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) {
7813 PyObject *result;
7814 #if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1
7815 PyTypeObject* tp = Py_TYPE(obj);
7816 if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) {
7817 return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1);
7818 }
7819 #endif
7820 result = __Pyx_PyObject_GetAttrStr(obj, attr_name);
7821 if (unlikely(!result)) {
7822 __Pyx_PyObject_GetAttrStr_ClearAttributeError();
7823 }
7824 return result;
7825 }
7826
7827 /* SetupReduce */
__Pyx_setup_reduce_is_named(PyObject * meth,PyObject * name)7828 static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) {
7829 int ret;
7830 PyObject *name_attr;
7831 name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name_2);
7832 if (likely(name_attr)) {
7833 ret = PyObject_RichCompareBool(name_attr, name, Py_EQ);
7834 } else {
7835 ret = -1;
7836 }
7837 if (unlikely(ret < 0)) {
7838 PyErr_Clear();
7839 ret = 0;
7840 }
7841 Py_XDECREF(name_attr);
7842 return ret;
7843 }
__Pyx_setup_reduce(PyObject * type_obj)7844 static int __Pyx_setup_reduce(PyObject* type_obj) {
7845 int ret = 0;
7846 PyObject *object_reduce = NULL;
7847 PyObject *object_reduce_ex = NULL;
7848 PyObject *reduce = NULL;
7849 PyObject *reduce_ex = NULL;
7850 PyObject *reduce_cython = NULL;
7851 PyObject *setstate = NULL;
7852 PyObject *setstate_cython = NULL;
7853 #if CYTHON_USE_PYTYPE_LOOKUP
7854 if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
7855 #else
7856 if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD;
7857 #endif
7858 #if CYTHON_USE_PYTYPE_LOOKUP
7859 object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
7860 #else
7861 object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD;
7862 #endif
7863 reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD;
7864 if (reduce_ex == object_reduce_ex) {
7865 #if CYTHON_USE_PYTYPE_LOOKUP
7866 object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
7867 #else
7868 object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD;
7869 #endif
7870 reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto __PYX_BAD;
7871 if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) {
7872 reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython);
7873 if (likely(reduce_cython)) {
7874 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
7875 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
7876 } else if (reduce == object_reduce || PyErr_Occurred()) {
7877 goto __PYX_BAD;
7878 }
7879 setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate);
7880 if (!setstate) PyErr_Clear();
7881 if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) {
7882 setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython);
7883 if (likely(setstate_cython)) {
7884 ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
7885 ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD;
7886 } else if (!setstate || PyErr_Occurred()) {
7887 goto __PYX_BAD;
7888 }
7889 }
7890 PyType_Modified((PyTypeObject*)type_obj);
7891 }
7892 }
7893 goto __PYX_GOOD;
7894 __PYX_BAD:
7895 if (!PyErr_Occurred())
7896 PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name);
7897 ret = -1;
7898 __PYX_GOOD:
7899 #if !CYTHON_USE_PYTYPE_LOOKUP
7900 Py_XDECREF(object_reduce);
7901 Py_XDECREF(object_reduce_ex);
7902 #endif
7903 Py_XDECREF(reduce);
7904 Py_XDECREF(reduce_ex);
7905 Py_XDECREF(reduce_cython);
7906 Py_XDECREF(setstate);
7907 Py_XDECREF(setstate_cython);
7908 return ret;
7909 }
7910
7911 /* TypeImport */
7912 #ifndef __PYX_HAVE_RT_ImportType
7913 #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)7914 static PyTypeObject *__Pyx_ImportType(PyObject *module, const char *module_name, const char *class_name,
7915 size_t size, enum __Pyx_ImportType_CheckSize check_size)
7916 {
7917 PyObject *result = 0;
7918 char warning[200];
7919 Py_ssize_t basicsize;
7920 #ifdef Py_LIMITED_API
7921 PyObject *py_basicsize;
7922 #endif
7923 result = PyObject_GetAttrString(module, class_name);
7924 if (!result)
7925 goto bad;
7926 if (!PyType_Check(result)) {
7927 PyErr_Format(PyExc_TypeError,
7928 "%.200s.%.200s is not a type object",
7929 module_name, class_name);
7930 goto bad;
7931 }
7932 #ifndef Py_LIMITED_API
7933 basicsize = ((PyTypeObject *)result)->tp_basicsize;
7934 #else
7935 py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
7936 if (!py_basicsize)
7937 goto bad;
7938 basicsize = PyLong_AsSsize_t(py_basicsize);
7939 Py_DECREF(py_basicsize);
7940 py_basicsize = 0;
7941 if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
7942 goto bad;
7943 #endif
7944 if ((size_t)basicsize < size) {
7945 PyErr_Format(PyExc_ValueError,
7946 "%.200s.%.200s size changed, may indicate binary incompatibility. "
7947 "Expected %zd from C header, got %zd from PyObject",
7948 module_name, class_name, size, basicsize);
7949 goto bad;
7950 }
7951 if (check_size == __Pyx_ImportType_CheckSize_Error && (size_t)basicsize != size) {
7952 PyErr_Format(PyExc_ValueError,
7953 "%.200s.%.200s size changed, may indicate binary incompatibility. "
7954 "Expected %zd from C header, got %zd from PyObject",
7955 module_name, class_name, size, basicsize);
7956 goto bad;
7957 }
7958 else if (check_size == __Pyx_ImportType_CheckSize_Warn && (size_t)basicsize > size) {
7959 PyOS_snprintf(warning, sizeof(warning),
7960 "%s.%s size changed, may indicate binary incompatibility. "
7961 "Expected %zd from C header, got %zd from PyObject",
7962 module_name, class_name, size, basicsize);
7963 if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
7964 }
7965 return (PyTypeObject *)result;
7966 bad:
7967 Py_XDECREF(result);
7968 return NULL;
7969 }
7970 #endif
7971
7972 /* GetVTable */
__Pyx_GetVtable(PyObject * dict)7973 static void* __Pyx_GetVtable(PyObject *dict) {
7974 void* ptr;
7975 PyObject *ob = PyObject_GetItem(dict, __pyx_n_s_pyx_vtable);
7976 if (!ob)
7977 goto bad;
7978 #if PY_VERSION_HEX >= 0x02070000
7979 ptr = PyCapsule_GetPointer(ob, 0);
7980 #else
7981 ptr = PyCObject_AsVoidPtr(ob);
7982 #endif
7983 if (!ptr && !PyErr_Occurred())
7984 PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type");
7985 Py_DECREF(ob);
7986 return ptr;
7987 bad:
7988 Py_XDECREF(ob);
7989 return NULL;
7990 }
7991
7992 /* PyDictVersioning */
7993 #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS
__Pyx_get_tp_dict_version(PyObject * obj)7994 static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) {
7995 PyObject *dict = Py_TYPE(obj)->tp_dict;
7996 return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0;
7997 }
__Pyx_get_object_dict_version(PyObject * obj)7998 static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) {
7999 PyObject **dictptr = NULL;
8000 Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset;
8001 if (offset) {
8002 #if CYTHON_COMPILING_IN_CPYTHON
8003 dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj);
8004 #else
8005 dictptr = _PyObject_GetDictPtr(obj);
8006 #endif
8007 }
8008 return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0;
8009 }
__Pyx_object_dict_version_matches(PyObject * obj,PY_UINT64_T tp_dict_version,PY_UINT64_T obj_dict_version)8010 static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) {
8011 PyObject *dict = Py_TYPE(obj)->tp_dict;
8012 if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict)))
8013 return 0;
8014 return obj_dict_version == __Pyx_get_object_dict_version(obj);
8015 }
8016 #endif
8017
8018 /* GetModuleGlobalName */
8019 #if CYTHON_USE_DICT_VERSIONS
__Pyx__GetModuleGlobalName(PyObject * name,PY_UINT64_T * dict_version,PyObject ** dict_cached_value)8020 static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value)
8021 #else
8022 static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name)
8023 #endif
8024 {
8025 PyObject *result;
8026 #if !CYTHON_AVOID_BORROWED_REFS
8027 #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1
8028 result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash);
8029 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
8030 if (likely(result)) {
8031 return __Pyx_NewRef(result);
8032 } else if (unlikely(PyErr_Occurred())) {
8033 return NULL;
8034 }
8035 #else
8036 result = PyDict_GetItem(__pyx_d, name);
8037 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
8038 if (likely(result)) {
8039 return __Pyx_NewRef(result);
8040 }
8041 #endif
8042 #else
8043 result = PyObject_GetItem(__pyx_d, name);
8044 __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version)
8045 if (likely(result)) {
8046 return __Pyx_NewRef(result);
8047 }
8048 PyErr_Clear();
8049 #endif
8050 return __Pyx_GetBuiltinName(name);
8051 }
8052
8053 /* GetNameInClass */
__Pyx_GetGlobalNameAfterAttributeLookup(PyObject * name)8054 static PyObject *__Pyx_GetGlobalNameAfterAttributeLookup(PyObject *name) {
8055 PyObject *result;
8056 __Pyx_PyThreadState_declare
8057 __Pyx_PyThreadState_assign
8058 if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError)))
8059 return NULL;
8060 __Pyx_PyErr_Clear();
8061 __Pyx_GetModuleGlobalNameUncached(result, name);
8062 return result;
8063 }
__Pyx__GetNameInClass(PyObject * nmspace,PyObject * name)8064 static PyObject *__Pyx__GetNameInClass(PyObject *nmspace, PyObject *name) {
8065 PyObject *result;
8066 result = __Pyx_PyObject_GetAttrStr(nmspace, name);
8067 if (!result) {
8068 result = __Pyx_GetGlobalNameAfterAttributeLookup(name);
8069 }
8070 return result;
8071 }
8072
8073 /* PyObjectCall2Args */
__Pyx_PyObject_Call2Args(PyObject * function,PyObject * arg1,PyObject * arg2)8074 static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) {
8075 PyObject *args, *result = NULL;
8076 #if CYTHON_FAST_PYCALL
8077 if (PyFunction_Check(function)) {
8078 PyObject *args[2] = {arg1, arg2};
8079 return __Pyx_PyFunction_FastCall(function, args, 2);
8080 }
8081 #endif
8082 #if CYTHON_FAST_PYCCALL
8083 if (__Pyx_PyFastCFunction_Check(function)) {
8084 PyObject *args[2] = {arg1, arg2};
8085 return __Pyx_PyCFunction_FastCall(function, args, 2);
8086 }
8087 #endif
8088 args = PyTuple_New(2);
8089 if (unlikely(!args)) goto done;
8090 Py_INCREF(arg1);
8091 PyTuple_SET_ITEM(args, 0, arg1);
8092 Py_INCREF(arg2);
8093 PyTuple_SET_ITEM(args, 1, arg2);
8094 Py_INCREF(function);
8095 result = __Pyx_PyObject_Call(function, args, NULL);
8096 Py_DECREF(args);
8097 Py_DECREF(function);
8098 done:
8099 return result;
8100 }
8101
8102 /* CLineInTraceback */
8103 #ifndef CYTHON_CLINE_IN_TRACEBACK
__Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState * tstate,int c_line)8104 static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) {
8105 PyObject *use_cline;
8106 PyObject *ptype, *pvalue, *ptraceback;
8107 #if CYTHON_COMPILING_IN_CPYTHON
8108 PyObject **cython_runtime_dict;
8109 #endif
8110 if (unlikely(!__pyx_cython_runtime)) {
8111 return c_line;
8112 }
8113 __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback);
8114 #if CYTHON_COMPILING_IN_CPYTHON
8115 cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime);
8116 if (likely(cython_runtime_dict)) {
8117 __PYX_PY_DICT_LOOKUP_IF_MODIFIED(
8118 use_cline, *cython_runtime_dict,
8119 __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback))
8120 } else
8121 #endif
8122 {
8123 PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback);
8124 if (use_cline_obj) {
8125 use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True;
8126 Py_DECREF(use_cline_obj);
8127 } else {
8128 PyErr_Clear();
8129 use_cline = NULL;
8130 }
8131 }
8132 if (!use_cline) {
8133 c_line = 0;
8134 PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False);
8135 }
8136 else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) {
8137 c_line = 0;
8138 }
8139 __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback);
8140 return c_line;
8141 }
8142 #endif
8143
8144 /* CodeObjectCache */
__pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry * entries,int count,int code_line)8145 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
8146 int start = 0, mid = 0, end = count - 1;
8147 if (end >= 0 && code_line > entries[end].code_line) {
8148 return count;
8149 }
8150 while (start < end) {
8151 mid = start + (end - start) / 2;
8152 if (code_line < entries[mid].code_line) {
8153 end = mid;
8154 } else if (code_line > entries[mid].code_line) {
8155 start = mid + 1;
8156 } else {
8157 return mid;
8158 }
8159 }
8160 if (code_line <= entries[mid].code_line) {
8161 return mid;
8162 } else {
8163 return mid + 1;
8164 }
8165 }
__pyx_find_code_object(int code_line)8166 static PyCodeObject *__pyx_find_code_object(int code_line) {
8167 PyCodeObject* code_object;
8168 int pos;
8169 if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
8170 return NULL;
8171 }
8172 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
8173 if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
8174 return NULL;
8175 }
8176 code_object = __pyx_code_cache.entries[pos].code_object;
8177 Py_INCREF(code_object);
8178 return code_object;
8179 }
__pyx_insert_code_object(int code_line,PyCodeObject * code_object)8180 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
8181 int pos, i;
8182 __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
8183 if (unlikely(!code_line)) {
8184 return;
8185 }
8186 if (unlikely(!entries)) {
8187 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
8188 if (likely(entries)) {
8189 __pyx_code_cache.entries = entries;
8190 __pyx_code_cache.max_count = 64;
8191 __pyx_code_cache.count = 1;
8192 entries[0].code_line = code_line;
8193 entries[0].code_object = code_object;
8194 Py_INCREF(code_object);
8195 }
8196 return;
8197 }
8198 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
8199 if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
8200 PyCodeObject* tmp = entries[pos].code_object;
8201 entries[pos].code_object = code_object;
8202 Py_DECREF(tmp);
8203 return;
8204 }
8205 if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
8206 int new_max = __pyx_code_cache.max_count + 64;
8207 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
8208 __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry));
8209 if (unlikely(!entries)) {
8210 return;
8211 }
8212 __pyx_code_cache.entries = entries;
8213 __pyx_code_cache.max_count = new_max;
8214 }
8215 for (i=__pyx_code_cache.count; i>pos; i--) {
8216 entries[i] = entries[i-1];
8217 }
8218 entries[pos].code_line = code_line;
8219 entries[pos].code_object = code_object;
8220 __pyx_code_cache.count++;
8221 Py_INCREF(code_object);
8222 }
8223
8224 /* AddTraceback */
8225 #include "compile.h"
8226 #include "frameobject.h"
8227 #include "traceback.h"
__Pyx_CreateCodeObjectForTraceback(const char * funcname,int c_line,int py_line,const char * filename)8228 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
8229 const char *funcname, int c_line,
8230 int py_line, const char *filename) {
8231 PyCodeObject *py_code = 0;
8232 PyObject *py_srcfile = 0;
8233 PyObject *py_funcname = 0;
8234 #if PY_MAJOR_VERSION < 3
8235 py_srcfile = PyString_FromString(filename);
8236 #else
8237 py_srcfile = PyUnicode_FromString(filename);
8238 #endif
8239 if (!py_srcfile) goto bad;
8240 if (c_line) {
8241 #if PY_MAJOR_VERSION < 3
8242 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
8243 #else
8244 py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
8245 #endif
8246 }
8247 else {
8248 #if PY_MAJOR_VERSION < 3
8249 py_funcname = PyString_FromString(funcname);
8250 #else
8251 py_funcname = PyUnicode_FromString(funcname);
8252 #endif
8253 }
8254 if (!py_funcname) goto bad;
8255 py_code = __Pyx_PyCode_New(
8256 0,
8257 0,
8258 0,
8259 0,
8260 0,
8261 __pyx_empty_bytes, /*PyObject *code,*/
8262 __pyx_empty_tuple, /*PyObject *consts,*/
8263 __pyx_empty_tuple, /*PyObject *names,*/
8264 __pyx_empty_tuple, /*PyObject *varnames,*/
8265 __pyx_empty_tuple, /*PyObject *freevars,*/
8266 __pyx_empty_tuple, /*PyObject *cellvars,*/
8267 py_srcfile, /*PyObject *filename,*/
8268 py_funcname, /*PyObject *name,*/
8269 py_line,
8270 __pyx_empty_bytes /*PyObject *lnotab*/
8271 );
8272 Py_DECREF(py_srcfile);
8273 Py_DECREF(py_funcname);
8274 return py_code;
8275 bad:
8276 Py_XDECREF(py_srcfile);
8277 Py_XDECREF(py_funcname);
8278 return NULL;
8279 }
__Pyx_AddTraceback(const char * funcname,int c_line,int py_line,const char * filename)8280 static void __Pyx_AddTraceback(const char *funcname, int c_line,
8281 int py_line, const char *filename) {
8282 PyCodeObject *py_code = 0;
8283 PyFrameObject *py_frame = 0;
8284 PyThreadState *tstate = __Pyx_PyThreadState_Current;
8285 if (c_line) {
8286 c_line = __Pyx_CLineForTraceback(tstate, c_line);
8287 }
8288 py_code = __pyx_find_code_object(c_line ? -c_line : py_line);
8289 if (!py_code) {
8290 py_code = __Pyx_CreateCodeObjectForTraceback(
8291 funcname, c_line, py_line, filename);
8292 if (!py_code) goto bad;
8293 __pyx_insert_code_object(c_line ? -c_line : py_line, py_code);
8294 }
8295 py_frame = PyFrame_New(
8296 tstate, /*PyThreadState *tstate,*/
8297 py_code, /*PyCodeObject *code,*/
8298 __pyx_d, /*PyObject *globals,*/
8299 0 /*PyObject *locals*/
8300 );
8301 if (!py_frame) goto bad;
8302 __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
8303 PyTraceBack_Here(py_frame);
8304 bad:
8305 Py_XDECREF(py_code);
8306 Py_XDECREF(py_frame);
8307 }
8308
8309 /* CIntToPy */
__Pyx_PyInt_From_int(int value)8310 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
8311 const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
8312 const int is_unsigned = neg_one > const_zero;
8313 if (is_unsigned) {
8314 if (sizeof(int) < sizeof(long)) {
8315 return PyInt_FromLong((long) value);
8316 } else if (sizeof(int) <= sizeof(unsigned long)) {
8317 return PyLong_FromUnsignedLong((unsigned long) value);
8318 #ifdef HAVE_LONG_LONG
8319 } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
8320 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
8321 #endif
8322 }
8323 } else {
8324 if (sizeof(int) <= sizeof(long)) {
8325 return PyInt_FromLong((long) value);
8326 #ifdef HAVE_LONG_LONG
8327 } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
8328 return PyLong_FromLongLong((PY_LONG_LONG) value);
8329 #endif
8330 }
8331 }
8332 {
8333 int one = 1; int little = (int)*(unsigned char *)&one;
8334 unsigned char *bytes = (unsigned char *)&value;
8335 return _PyLong_FromByteArray(bytes, sizeof(int),
8336 little, !is_unsigned);
8337 }
8338 }
8339
8340 /* CIntFromPyVerify */
8341 #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
8342 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
8343 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
8344 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
8345 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
8346 {\
8347 func_type value = func_value;\
8348 if (sizeof(target_type) < sizeof(func_type)) {\
8349 if (unlikely(value != (func_type) (target_type) value)) {\
8350 func_type zero = 0;\
8351 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
8352 return (target_type) -1;\
8353 if (is_unsigned && unlikely(value < zero))\
8354 goto raise_neg_overflow;\
8355 else\
8356 goto raise_overflow;\
8357 }\
8358 }\
8359 return (target_type) value;\
8360 }
8361
8362 /* CIntToPy */
__Pyx_PyInt_From_int64_t(int64_t value)8363 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int64_t(int64_t value) {
8364 const int64_t neg_one = (int64_t) ((int64_t) 0 - (int64_t) 1), const_zero = (int64_t) 0;
8365 const int is_unsigned = neg_one > const_zero;
8366 if (is_unsigned) {
8367 if (sizeof(int64_t) < sizeof(long)) {
8368 return PyInt_FromLong((long) value);
8369 } else if (sizeof(int64_t) <= sizeof(unsigned long)) {
8370 return PyLong_FromUnsignedLong((unsigned long) value);
8371 #ifdef HAVE_LONG_LONG
8372 } else if (sizeof(int64_t) <= sizeof(unsigned PY_LONG_LONG)) {
8373 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
8374 #endif
8375 }
8376 } else {
8377 if (sizeof(int64_t) <= sizeof(long)) {
8378 return PyInt_FromLong((long) value);
8379 #ifdef HAVE_LONG_LONG
8380 } else if (sizeof(int64_t) <= sizeof(PY_LONG_LONG)) {
8381 return PyLong_FromLongLong((PY_LONG_LONG) value);
8382 #endif
8383 }
8384 }
8385 {
8386 int one = 1; int little = (int)*(unsigned char *)&one;
8387 unsigned char *bytes = (unsigned char *)&value;
8388 return _PyLong_FromByteArray(bytes, sizeof(int64_t),
8389 little, !is_unsigned);
8390 }
8391 }
8392
8393 /* CIntFromPy */
__Pyx_PyInt_As_int(PyObject * x)8394 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
8395 const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0;
8396 const int is_unsigned = neg_one > const_zero;
8397 #if PY_MAJOR_VERSION < 3
8398 if (likely(PyInt_Check(x))) {
8399 if (sizeof(int) < sizeof(long)) {
8400 __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
8401 } else {
8402 long val = PyInt_AS_LONG(x);
8403 if (is_unsigned && unlikely(val < 0)) {
8404 goto raise_neg_overflow;
8405 }
8406 return (int) val;
8407 }
8408 } else
8409 #endif
8410 if (likely(PyLong_Check(x))) {
8411 if (is_unsigned) {
8412 #if CYTHON_USE_PYLONG_INTERNALS
8413 const digit* digits = ((PyLongObject*)x)->ob_digit;
8414 switch (Py_SIZE(x)) {
8415 case 0: return (int) 0;
8416 case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
8417 case 2:
8418 if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
8419 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
8420 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
8421 } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
8422 return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
8423 }
8424 }
8425 break;
8426 case 3:
8427 if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
8428 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
8429 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
8430 } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
8431 return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
8432 }
8433 }
8434 break;
8435 case 4:
8436 if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
8437 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
8438 __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])))
8439 } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
8440 return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
8441 }
8442 }
8443 break;
8444 }
8445 #endif
8446 #if CYTHON_COMPILING_IN_CPYTHON
8447 if (unlikely(Py_SIZE(x) < 0)) {
8448 goto raise_neg_overflow;
8449 }
8450 #else
8451 {
8452 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
8453 if (unlikely(result < 0))
8454 return (int) -1;
8455 if (unlikely(result == 1))
8456 goto raise_neg_overflow;
8457 }
8458 #endif
8459 if (sizeof(int) <= sizeof(unsigned long)) {
8460 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
8461 #ifdef HAVE_LONG_LONG
8462 } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
8463 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
8464 #endif
8465 }
8466 } else {
8467 #if CYTHON_USE_PYLONG_INTERNALS
8468 const digit* digits = ((PyLongObject*)x)->ob_digit;
8469 switch (Py_SIZE(x)) {
8470 case 0: return (int) 0;
8471 case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
8472 case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0])
8473 case -2:
8474 if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
8475 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
8476 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
8477 } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
8478 return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
8479 }
8480 }
8481 break;
8482 case 2:
8483 if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
8484 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
8485 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
8486 } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
8487 return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
8488 }
8489 }
8490 break;
8491 case -3:
8492 if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
8493 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
8494 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
8495 } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
8496 return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
8497 }
8498 }
8499 break;
8500 case 3:
8501 if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
8502 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
8503 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
8504 } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
8505 return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
8506 }
8507 }
8508 break;
8509 case -4:
8510 if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
8511 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
8512 __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])))
8513 } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
8514 return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
8515 }
8516 }
8517 break;
8518 case 4:
8519 if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
8520 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
8521 __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])))
8522 } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
8523 return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
8524 }
8525 }
8526 break;
8527 }
8528 #endif
8529 if (sizeof(int) <= sizeof(long)) {
8530 __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
8531 #ifdef HAVE_LONG_LONG
8532 } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
8533 __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
8534 #endif
8535 }
8536 }
8537 {
8538 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
8539 PyErr_SetString(PyExc_RuntimeError,
8540 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
8541 #else
8542 int val;
8543 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
8544 #if PY_MAJOR_VERSION < 3
8545 if (likely(v) && !PyLong_Check(v)) {
8546 PyObject *tmp = v;
8547 v = PyNumber_Long(tmp);
8548 Py_DECREF(tmp);
8549 }
8550 #endif
8551 if (likely(v)) {
8552 int one = 1; int is_little = (int)*(unsigned char *)&one;
8553 unsigned char *bytes = (unsigned char *)&val;
8554 int ret = _PyLong_AsByteArray((PyLongObject *)v,
8555 bytes, sizeof(val),
8556 is_little, !is_unsigned);
8557 Py_DECREF(v);
8558 if (likely(!ret))
8559 return val;
8560 }
8561 #endif
8562 return (int) -1;
8563 }
8564 } else {
8565 int val;
8566 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
8567 if (!tmp) return (int) -1;
8568 val = __Pyx_PyInt_As_int(tmp);
8569 Py_DECREF(tmp);
8570 return val;
8571 }
8572 raise_overflow:
8573 PyErr_SetString(PyExc_OverflowError,
8574 "value too large to convert to int");
8575 return (int) -1;
8576 raise_neg_overflow:
8577 PyErr_SetString(PyExc_OverflowError,
8578 "can't convert negative value to int");
8579 return (int) -1;
8580 }
8581
8582 /* CIntToPy */
__Pyx_PyInt_From_long(long value)8583 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
8584 const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
8585 const int is_unsigned = neg_one > const_zero;
8586 if (is_unsigned) {
8587 if (sizeof(long) < sizeof(long)) {
8588 return PyInt_FromLong((long) value);
8589 } else if (sizeof(long) <= sizeof(unsigned long)) {
8590 return PyLong_FromUnsignedLong((unsigned long) value);
8591 #ifdef HAVE_LONG_LONG
8592 } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
8593 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
8594 #endif
8595 }
8596 } else {
8597 if (sizeof(long) <= sizeof(long)) {
8598 return PyInt_FromLong((long) value);
8599 #ifdef HAVE_LONG_LONG
8600 } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
8601 return PyLong_FromLongLong((PY_LONG_LONG) value);
8602 #endif
8603 }
8604 }
8605 {
8606 int one = 1; int little = (int)*(unsigned char *)&one;
8607 unsigned char *bytes = (unsigned char *)&value;
8608 return _PyLong_FromByteArray(bytes, sizeof(long),
8609 little, !is_unsigned);
8610 }
8611 }
8612
8613 /* CIntFromPy */
__Pyx_PyInt_As_long(PyObject * x)8614 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
8615 const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;
8616 const int is_unsigned = neg_one > const_zero;
8617 #if PY_MAJOR_VERSION < 3
8618 if (likely(PyInt_Check(x))) {
8619 if (sizeof(long) < sizeof(long)) {
8620 __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
8621 } else {
8622 long val = PyInt_AS_LONG(x);
8623 if (is_unsigned && unlikely(val < 0)) {
8624 goto raise_neg_overflow;
8625 }
8626 return (long) val;
8627 }
8628 } else
8629 #endif
8630 if (likely(PyLong_Check(x))) {
8631 if (is_unsigned) {
8632 #if CYTHON_USE_PYLONG_INTERNALS
8633 const digit* digits = ((PyLongObject*)x)->ob_digit;
8634 switch (Py_SIZE(x)) {
8635 case 0: return (long) 0;
8636 case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
8637 case 2:
8638 if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
8639 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
8640 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
8641 } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
8642 return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
8643 }
8644 }
8645 break;
8646 case 3:
8647 if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
8648 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
8649 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
8650 } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
8651 return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
8652 }
8653 }
8654 break;
8655 case 4:
8656 if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
8657 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
8658 __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])))
8659 } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
8660 return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
8661 }
8662 }
8663 break;
8664 }
8665 #endif
8666 #if CYTHON_COMPILING_IN_CPYTHON
8667 if (unlikely(Py_SIZE(x) < 0)) {
8668 goto raise_neg_overflow;
8669 }
8670 #else
8671 {
8672 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
8673 if (unlikely(result < 0))
8674 return (long) -1;
8675 if (unlikely(result == 1))
8676 goto raise_neg_overflow;
8677 }
8678 #endif
8679 if (sizeof(long) <= sizeof(unsigned long)) {
8680 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
8681 #ifdef HAVE_LONG_LONG
8682 } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
8683 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
8684 #endif
8685 }
8686 } else {
8687 #if CYTHON_USE_PYLONG_INTERNALS
8688 const digit* digits = ((PyLongObject*)x)->ob_digit;
8689 switch (Py_SIZE(x)) {
8690 case 0: return (long) 0;
8691 case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
8692 case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0])
8693 case -2:
8694 if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
8695 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
8696 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
8697 } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
8698 return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
8699 }
8700 }
8701 break;
8702 case 2:
8703 if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
8704 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
8705 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
8706 } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
8707 return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
8708 }
8709 }
8710 break;
8711 case -3:
8712 if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
8713 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
8714 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
8715 } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
8716 return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
8717 }
8718 }
8719 break;
8720 case 3:
8721 if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
8722 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
8723 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
8724 } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
8725 return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
8726 }
8727 }
8728 break;
8729 case -4:
8730 if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
8731 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
8732 __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])))
8733 } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
8734 return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
8735 }
8736 }
8737 break;
8738 case 4:
8739 if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
8740 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
8741 __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])))
8742 } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
8743 return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
8744 }
8745 }
8746 break;
8747 }
8748 #endif
8749 if (sizeof(long) <= sizeof(long)) {
8750 __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
8751 #ifdef HAVE_LONG_LONG
8752 } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
8753 __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
8754 #endif
8755 }
8756 }
8757 {
8758 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
8759 PyErr_SetString(PyExc_RuntimeError,
8760 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
8761 #else
8762 long val;
8763 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
8764 #if PY_MAJOR_VERSION < 3
8765 if (likely(v) && !PyLong_Check(v)) {
8766 PyObject *tmp = v;
8767 v = PyNumber_Long(tmp);
8768 Py_DECREF(tmp);
8769 }
8770 #endif
8771 if (likely(v)) {
8772 int one = 1; int is_little = (int)*(unsigned char *)&one;
8773 unsigned char *bytes = (unsigned char *)&val;
8774 int ret = _PyLong_AsByteArray((PyLongObject *)v,
8775 bytes, sizeof(val),
8776 is_little, !is_unsigned);
8777 Py_DECREF(v);
8778 if (likely(!ret))
8779 return val;
8780 }
8781 #endif
8782 return (long) -1;
8783 }
8784 } else {
8785 long val;
8786 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
8787 if (!tmp) return (long) -1;
8788 val = __Pyx_PyInt_As_long(tmp);
8789 Py_DECREF(tmp);
8790 return val;
8791 }
8792 raise_overflow:
8793 PyErr_SetString(PyExc_OverflowError,
8794 "value too large to convert to long");
8795 return (long) -1;
8796 raise_neg_overflow:
8797 PyErr_SetString(PyExc_OverflowError,
8798 "can't convert negative value to long");
8799 return (long) -1;
8800 }
8801
8802 /* FastTypeChecks */
8803 #if CYTHON_COMPILING_IN_CPYTHON
__Pyx_InBases(PyTypeObject * a,PyTypeObject * b)8804 static int __Pyx_InBases(PyTypeObject *a, PyTypeObject *b) {
8805 while (a) {
8806 a = a->tp_base;
8807 if (a == b)
8808 return 1;
8809 }
8810 return b == &PyBaseObject_Type;
8811 }
__Pyx_IsSubtype(PyTypeObject * a,PyTypeObject * b)8812 static CYTHON_INLINE int __Pyx_IsSubtype(PyTypeObject *a, PyTypeObject *b) {
8813 PyObject *mro;
8814 if (a == b) return 1;
8815 mro = a->tp_mro;
8816 if (likely(mro)) {
8817 Py_ssize_t i, n;
8818 n = PyTuple_GET_SIZE(mro);
8819 for (i = 0; i < n; i++) {
8820 if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b)
8821 return 1;
8822 }
8823 return 0;
8824 }
8825 return __Pyx_InBases(a, b);
8826 }
8827 #if PY_MAJOR_VERSION == 2
__Pyx_inner_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)8828 static int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject* exc_type2) {
8829 PyObject *exception, *value, *tb;
8830 int res;
8831 __Pyx_PyThreadState_declare
8832 __Pyx_PyThreadState_assign
8833 __Pyx_ErrFetch(&exception, &value, &tb);
8834 res = exc_type1 ? PyObject_IsSubclass(err, exc_type1) : 0;
8835 if (unlikely(res == -1)) {
8836 PyErr_WriteUnraisable(err);
8837 res = 0;
8838 }
8839 if (!res) {
8840 res = PyObject_IsSubclass(err, exc_type2);
8841 if (unlikely(res == -1)) {
8842 PyErr_WriteUnraisable(err);
8843 res = 0;
8844 }
8845 }
8846 __Pyx_ErrRestore(exception, value, tb);
8847 return res;
8848 }
8849 #else
__Pyx_inner_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)8850 static CYTHON_INLINE int __Pyx_inner_PyErr_GivenExceptionMatches2(PyObject *err, PyObject* exc_type1, PyObject *exc_type2) {
8851 int res = exc_type1 ? __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type1) : 0;
8852 if (!res) {
8853 res = __Pyx_IsSubtype((PyTypeObject*)err, (PyTypeObject*)exc_type2);
8854 }
8855 return res;
8856 }
8857 #endif
__Pyx_PyErr_GivenExceptionMatchesTuple(PyObject * exc_type,PyObject * tuple)8858 static int __Pyx_PyErr_GivenExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) {
8859 Py_ssize_t i, n;
8860 assert(PyExceptionClass_Check(exc_type));
8861 n = PyTuple_GET_SIZE(tuple);
8862 #if PY_MAJOR_VERSION >= 3
8863 for (i=0; i<n; i++) {
8864 if (exc_type == PyTuple_GET_ITEM(tuple, i)) return 1;
8865 }
8866 #endif
8867 for (i=0; i<n; i++) {
8868 PyObject *t = PyTuple_GET_ITEM(tuple, i);
8869 #if PY_MAJOR_VERSION < 3
8870 if (likely(exc_type == t)) return 1;
8871 #endif
8872 if (likely(PyExceptionClass_Check(t))) {
8873 if (__Pyx_inner_PyErr_GivenExceptionMatches2(exc_type, NULL, t)) return 1;
8874 } else {
8875 }
8876 }
8877 return 0;
8878 }
__Pyx_PyErr_GivenExceptionMatches(PyObject * err,PyObject * exc_type)8879 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches(PyObject *err, PyObject* exc_type) {
8880 if (likely(err == exc_type)) return 1;
8881 if (likely(PyExceptionClass_Check(err))) {
8882 if (likely(PyExceptionClass_Check(exc_type))) {
8883 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, NULL, exc_type);
8884 } else if (likely(PyTuple_Check(exc_type))) {
8885 return __Pyx_PyErr_GivenExceptionMatchesTuple(err, exc_type);
8886 } else {
8887 }
8888 }
8889 return PyErr_GivenExceptionMatches(err, exc_type);
8890 }
__Pyx_PyErr_GivenExceptionMatches2(PyObject * err,PyObject * exc_type1,PyObject * exc_type2)8891 static CYTHON_INLINE int __Pyx_PyErr_GivenExceptionMatches2(PyObject *err, PyObject *exc_type1, PyObject *exc_type2) {
8892 assert(PyExceptionClass_Check(exc_type1));
8893 assert(PyExceptionClass_Check(exc_type2));
8894 if (likely(err == exc_type1 || err == exc_type2)) return 1;
8895 if (likely(PyExceptionClass_Check(err))) {
8896 return __Pyx_inner_PyErr_GivenExceptionMatches2(err, exc_type1, exc_type2);
8897 }
8898 return (PyErr_GivenExceptionMatches(err, exc_type1) || PyErr_GivenExceptionMatches(err, exc_type2));
8899 }
8900 #endif
8901
8902 /* CheckBinaryVersion */
__Pyx_check_binary_version(void)8903 static int __Pyx_check_binary_version(void) {
8904 char ctversion[4], rtversion[4];
8905 PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
8906 PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
8907 if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
8908 char message[200];
8909 PyOS_snprintf(message, sizeof(message),
8910 "compiletime version %s of module '%.100s' "
8911 "does not match runtime version %s",
8912 ctversion, __Pyx_MODULE_NAME, rtversion);
8913 return PyErr_WarnEx(NULL, message, 1);
8914 }
8915 return 0;
8916 }
8917
8918 /* FunctionExport */
__Pyx_ExportFunction(const char * name,void (* f)(void),const char * sig)8919 static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig) {
8920 PyObject *d = 0;
8921 PyObject *cobj = 0;
8922 union {
8923 void (*fp)(void);
8924 void *p;
8925 } tmp;
8926 d = PyObject_GetAttrString(__pyx_m, (char *)"__pyx_capi__");
8927 if (!d) {
8928 PyErr_Clear();
8929 d = PyDict_New();
8930 if (!d)
8931 goto bad;
8932 Py_INCREF(d);
8933 if (PyModule_AddObject(__pyx_m, (char *)"__pyx_capi__", d) < 0)
8934 goto bad;
8935 }
8936 tmp.fp = f;
8937 #if PY_VERSION_HEX >= 0x02070000
8938 cobj = PyCapsule_New(tmp.p, sig, 0);
8939 #else
8940 cobj = PyCObject_FromVoidPtrAndDesc(tmp.p, (void *)sig, 0);
8941 #endif
8942 if (!cobj)
8943 goto bad;
8944 if (PyDict_SetItemString(d, name, cobj) < 0)
8945 goto bad;
8946 Py_DECREF(cobj);
8947 Py_DECREF(d);
8948 return 0;
8949 bad:
8950 Py_XDECREF(cobj);
8951 Py_XDECREF(d);
8952 return -1;
8953 }
8954
8955 /* FunctionImport */
8956 #ifndef __PYX_HAVE_RT_ImportFunction
8957 #define __PYX_HAVE_RT_ImportFunction
__Pyx_ImportFunction(PyObject * module,const char * funcname,void (** f)(void),const char * sig)8958 static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig) {
8959 PyObject *d = 0;
8960 PyObject *cobj = 0;
8961 union {
8962 void (*fp)(void);
8963 void *p;
8964 } tmp;
8965 d = PyObject_GetAttrString(module, (char *)"__pyx_capi__");
8966 if (!d)
8967 goto bad;
8968 cobj = PyDict_GetItemString(d, funcname);
8969 if (!cobj) {
8970 PyErr_Format(PyExc_ImportError,
8971 "%.200s does not export expected C function %.200s",
8972 PyModule_GetName(module), funcname);
8973 goto bad;
8974 }
8975 #if PY_VERSION_HEX >= 0x02070000
8976 if (!PyCapsule_IsValid(cobj, sig)) {
8977 PyErr_Format(PyExc_TypeError,
8978 "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
8979 PyModule_GetName(module), funcname, sig, PyCapsule_GetName(cobj));
8980 goto bad;
8981 }
8982 tmp.p = PyCapsule_GetPointer(cobj, sig);
8983 #else
8984 {const char *desc, *s1, *s2;
8985 desc = (const char *)PyCObject_GetDesc(cobj);
8986 if (!desc)
8987 goto bad;
8988 s1 = desc; s2 = sig;
8989 while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; }
8990 if (*s1 != *s2) {
8991 PyErr_Format(PyExc_TypeError,
8992 "C function %.200s.%.200s has wrong signature (expected %.500s, got %.500s)",
8993 PyModule_GetName(module), funcname, sig, desc);
8994 goto bad;
8995 }
8996 tmp.p = PyCObject_AsVoidPtr(cobj);}
8997 #endif
8998 *f = tmp.fp;
8999 if (!(*f))
9000 goto bad;
9001 Py_DECREF(d);
9002 return 0;
9003 bad:
9004 Py_XDECREF(d);
9005 return -1;
9006 }
9007 #endif
9008
9009 /* InitStrings */
__Pyx_InitStrings(__Pyx_StringTabEntry * t)9010 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
9011 while (t->p) {
9012 #if PY_MAJOR_VERSION < 3
9013 if (t->is_unicode) {
9014 *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
9015 } else if (t->intern) {
9016 *t->p = PyString_InternFromString(t->s);
9017 } else {
9018 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
9019 }
9020 #else
9021 if (t->is_unicode | t->is_str) {
9022 if (t->intern) {
9023 *t->p = PyUnicode_InternFromString(t->s);
9024 } else if (t->encoding) {
9025 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
9026 } else {
9027 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
9028 }
9029 } else {
9030 *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
9031 }
9032 #endif
9033 if (!*t->p)
9034 return -1;
9035 if (PyObject_Hash(*t->p) == -1)
9036 return -1;
9037 ++t;
9038 }
9039 return 0;
9040 }
9041
__Pyx_PyUnicode_FromString(const char * c_str)9042 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
9043 return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
9044 }
__Pyx_PyObject_AsString(PyObject * o)9045 static CYTHON_INLINE const char* __Pyx_PyObject_AsString(PyObject* o) {
9046 Py_ssize_t ignore;
9047 return __Pyx_PyObject_AsStringAndSize(o, &ignore);
9048 }
9049 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
9050 #if !CYTHON_PEP393_ENABLED
__Pyx_PyUnicode_AsStringAndSize(PyObject * o,Py_ssize_t * length)9051 static const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
9052 char* defenc_c;
9053 PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
9054 if (!defenc) return NULL;
9055 defenc_c = PyBytes_AS_STRING(defenc);
9056 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
9057 {
9058 char* end = defenc_c + PyBytes_GET_SIZE(defenc);
9059 char* c;
9060 for (c = defenc_c; c < end; c++) {
9061 if ((unsigned char) (*c) >= 128) {
9062 PyUnicode_AsASCIIString(o);
9063 return NULL;
9064 }
9065 }
9066 }
9067 #endif
9068 *length = PyBytes_GET_SIZE(defenc);
9069 return defenc_c;
9070 }
9071 #else
__Pyx_PyUnicode_AsStringAndSize(PyObject * o,Py_ssize_t * length)9072 static CYTHON_INLINE const char* __Pyx_PyUnicode_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
9073 if (unlikely(__Pyx_PyUnicode_READY(o) == -1)) return NULL;
9074 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
9075 if (likely(PyUnicode_IS_ASCII(o))) {
9076 *length = PyUnicode_GET_LENGTH(o);
9077 return PyUnicode_AsUTF8(o);
9078 } else {
9079 PyUnicode_AsASCIIString(o);
9080 return NULL;
9081 }
9082 #else
9083 return PyUnicode_AsUTF8AndSize(o, length);
9084 #endif
9085 }
9086 #endif
9087 #endif
__Pyx_PyObject_AsStringAndSize(PyObject * o,Py_ssize_t * length)9088 static CYTHON_INLINE const char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
9089 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
9090 if (
9091 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
9092 __Pyx_sys_getdefaultencoding_not_ascii &&
9093 #endif
9094 PyUnicode_Check(o)) {
9095 return __Pyx_PyUnicode_AsStringAndSize(o, length);
9096 } else
9097 #endif
9098 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
9099 if (PyByteArray_Check(o)) {
9100 *length = PyByteArray_GET_SIZE(o);
9101 return PyByteArray_AS_STRING(o);
9102 } else
9103 #endif
9104 {
9105 char* result;
9106 int r = PyBytes_AsStringAndSize(o, &result, length);
9107 if (unlikely(r < 0)) {
9108 return NULL;
9109 } else {
9110 return result;
9111 }
9112 }
9113 }
__Pyx_PyObject_IsTrue(PyObject * x)9114 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
9115 int is_true = x == Py_True;
9116 if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
9117 else return PyObject_IsTrue(x);
9118 }
__Pyx_PyObject_IsTrueAndDecref(PyObject * x)9119 static CYTHON_INLINE int __Pyx_PyObject_IsTrueAndDecref(PyObject* x) {
9120 int retval;
9121 if (unlikely(!x)) return -1;
9122 retval = __Pyx_PyObject_IsTrue(x);
9123 Py_DECREF(x);
9124 return retval;
9125 }
__Pyx_PyNumber_IntOrLongWrongResultType(PyObject * result,const char * type_name)9126 static PyObject* __Pyx_PyNumber_IntOrLongWrongResultType(PyObject* result, const char* type_name) {
9127 #if PY_MAJOR_VERSION >= 3
9128 if (PyLong_Check(result)) {
9129 if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
9130 "__int__ returned non-int (type %.200s). "
9131 "The ability to return an instance of a strict subclass of int "
9132 "is deprecated, and may be removed in a future version of Python.",
9133 Py_TYPE(result)->tp_name)) {
9134 Py_DECREF(result);
9135 return NULL;
9136 }
9137 return result;
9138 }
9139 #endif
9140 PyErr_Format(PyExc_TypeError,
9141 "__%.4s__ returned non-%.4s (type %.200s)",
9142 type_name, type_name, Py_TYPE(result)->tp_name);
9143 Py_DECREF(result);
9144 return NULL;
9145 }
__Pyx_PyNumber_IntOrLong(PyObject * x)9146 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
9147 #if CYTHON_USE_TYPE_SLOTS
9148 PyNumberMethods *m;
9149 #endif
9150 const char *name = NULL;
9151 PyObject *res = NULL;
9152 #if PY_MAJOR_VERSION < 3
9153 if (likely(PyInt_Check(x) || PyLong_Check(x)))
9154 #else
9155 if (likely(PyLong_Check(x)))
9156 #endif
9157 return __Pyx_NewRef(x);
9158 #if CYTHON_USE_TYPE_SLOTS
9159 m = Py_TYPE(x)->tp_as_number;
9160 #if PY_MAJOR_VERSION < 3
9161 if (m && m->nb_int) {
9162 name = "int";
9163 res = m->nb_int(x);
9164 }
9165 else if (m && m->nb_long) {
9166 name = "long";
9167 res = m->nb_long(x);
9168 }
9169 #else
9170 if (likely(m && m->nb_int)) {
9171 name = "int";
9172 res = m->nb_int(x);
9173 }
9174 #endif
9175 #else
9176 if (!PyBytes_CheckExact(x) && !PyUnicode_CheckExact(x)) {
9177 res = PyNumber_Int(x);
9178 }
9179 #endif
9180 if (likely(res)) {
9181 #if PY_MAJOR_VERSION < 3
9182 if (unlikely(!PyInt_Check(res) && !PyLong_Check(res))) {
9183 #else
9184 if (unlikely(!PyLong_CheckExact(res))) {
9185 #endif
9186 return __Pyx_PyNumber_IntOrLongWrongResultType(res, name);
9187 }
9188 }
9189 else if (!PyErr_Occurred()) {
9190 PyErr_SetString(PyExc_TypeError,
9191 "an integer is required");
9192 }
9193 return res;
9194 }
9195 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
9196 Py_ssize_t ival;
9197 PyObject *x;
9198 #if PY_MAJOR_VERSION < 3
9199 if (likely(PyInt_CheckExact(b))) {
9200 if (sizeof(Py_ssize_t) >= sizeof(long))
9201 return PyInt_AS_LONG(b);
9202 else
9203 return PyInt_AsSsize_t(b);
9204 }
9205 #endif
9206 if (likely(PyLong_CheckExact(b))) {
9207 #if CYTHON_USE_PYLONG_INTERNALS
9208 const digit* digits = ((PyLongObject*)b)->ob_digit;
9209 const Py_ssize_t size = Py_SIZE(b);
9210 if (likely(__Pyx_sst_abs(size) <= 1)) {
9211 ival = likely(size) ? digits[0] : 0;
9212 if (size == -1) ival = -ival;
9213 return ival;
9214 } else {
9215 switch (size) {
9216 case 2:
9217 if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
9218 return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
9219 }
9220 break;
9221 case -2:
9222 if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
9223 return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
9224 }
9225 break;
9226 case 3:
9227 if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
9228 return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
9229 }
9230 break;
9231 case -3:
9232 if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
9233 return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
9234 }
9235 break;
9236 case 4:
9237 if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
9238 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]));
9239 }
9240 break;
9241 case -4:
9242 if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
9243 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]));
9244 }
9245 break;
9246 }
9247 }
9248 #endif
9249 return PyLong_AsSsize_t(b);
9250 }
9251 x = PyNumber_Index(b);
9252 if (!x) return -1;
9253 ival = PyInt_AsSsize_t(x);
9254 Py_DECREF(x);
9255 return ival;
9256 }
9257 static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) {
9258 return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False);
9259 }
9260 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
9261 return PyInt_FromSize_t(ival);
9262 }
9263
9264
9265 #endif /* Py_PYTHON_H */
9266