Generated by Cython 0.28.3
Yellow lines hint at Python interaction.
Click on a line that starts with a "+
" to see the C code that Cython generated for it.
Raw output: encoder.c
001: # This file is part of Xpra.
002: # Copyright (C) 2012-2017 Antoine Martin <antoine@devloop.org.uk>
003: # Xpra is released under the terms of the GNU GPL v2, or, at your option, any
004: # later version. See the file COPYING for details.
005:
006: #cython: auto_pickle=False, wraparound=False, cdivision=True
007: from __future__ import absolute_import
008:
+009: import os
__pyx_t_1 = __Pyx_Import(__pyx_n_s_os, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 9, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_os, __pyx_t_1) < 0) __PYX_ERR(0, 9, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
010:
+011: from xpra.log import Logger
__pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 11, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_n_s_Logger); __Pyx_GIVEREF(__pyx_n_s_Logger); PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_Logger); __pyx_t_2 = __Pyx_Import(__pyx_n_s_xpra_log, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 11, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Logger); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 11, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_Logger, __pyx_t_1) < 0) __PYX_ERR(0, 11, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+012: log = Logger("encoder", "x264")
__pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_Logger); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 12, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 12, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_log, __pyx_t_1) < 0) __PYX_ERR(0, 12, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* … */ __pyx_tuple__20 = PyTuple_Pack(2, __pyx_n_s_encoder, __pyx_n_s_x264); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 12, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__20); __Pyx_GIVEREF(__pyx_tuple__20);
013:
+014: from xpra.util import nonl, envint, envbool, typedict, AtomicInteger
__pyx_t_1 = PyList_New(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 14, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_n_s_nonl); __Pyx_GIVEREF(__pyx_n_s_nonl); PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_nonl); __Pyx_INCREF(__pyx_n_s_envint); __Pyx_GIVEREF(__pyx_n_s_envint); PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_envint); __Pyx_INCREF(__pyx_n_s_envbool); __Pyx_GIVEREF(__pyx_n_s_envbool); PyList_SET_ITEM(__pyx_t_1, 2, __pyx_n_s_envbool); __Pyx_INCREF(__pyx_n_s_typedict); __Pyx_GIVEREF(__pyx_n_s_typedict); PyList_SET_ITEM(__pyx_t_1, 3, __pyx_n_s_typedict); __Pyx_INCREF(__pyx_n_s_AtomicInteger); __Pyx_GIVEREF(__pyx_n_s_AtomicInteger); PyList_SET_ITEM(__pyx_t_1, 4, __pyx_n_s_AtomicInteger); __pyx_t_2 = __Pyx_Import(__pyx_n_s_xpra_util, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 14, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_nonl); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 14, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_nonl, __pyx_t_1) < 0) __PYX_ERR(0, 14, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_envint); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 14, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_envint, __pyx_t_1) < 0) __PYX_ERR(0, 14, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_envbool); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 14, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_envbool, __pyx_t_1) < 0) __PYX_ERR(0, 14, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_typedict); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 14, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_typedict, __pyx_t_1) < 0) __PYX_ERR(0, 14, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_AtomicInteger); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 14, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_AtomicInteger, __pyx_t_1) < 0) __PYX_ERR(0, 14, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+015: from xpra.os_util import bytestostr, strtobytes
__pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 15, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_n_s_bytestostr); __Pyx_GIVEREF(__pyx_n_s_bytestostr); PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_bytestostr); __Pyx_INCREF(__pyx_n_s_strtobytes); __Pyx_GIVEREF(__pyx_n_s_strtobytes); PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_strtobytes); __pyx_t_1 = __Pyx_Import(__pyx_n_s_xpra_os_util, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_bytestostr); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 15, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_bytestostr, __pyx_t_2) < 0) __PYX_ERR(0, 15, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_strtobytes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 15, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_strtobytes, __pyx_t_2) < 0) __PYX_ERR(0, 15, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+016: from xpra.codecs.codec_constants import get_subsampling_divs, video_spec
__pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_n_s_get_subsampling_divs); __Pyx_GIVEREF(__pyx_n_s_get_subsampling_divs); PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_get_subsampling_divs); __Pyx_INCREF(__pyx_n_s_video_spec); __Pyx_GIVEREF(__pyx_n_s_video_spec); PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_video_spec); __pyx_t_2 = __Pyx_Import(__pyx_n_s_xpra_codecs_codec_constants, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 16, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_get_subsampling_divs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_subsampling_divs, __pyx_t_1) < 0) __PYX_ERR(0, 16, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_video_spec); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_video_spec, __pyx_t_1) < 0) __PYX_ERR(0, 16, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+017: from collections import deque
__pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 17, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_n_s_deque); __Pyx_GIVEREF(__pyx_n_s_deque); PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_deque); __pyx_t_1 = __Pyx_Import(__pyx_n_s_collections, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 17, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_deque); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 17, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_deque, __pyx_t_2) < 0) __PYX_ERR(0, 17, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
018: from xpra.buffers.membuf cimport object_as_buffer
019:
020: from xpra.monotonic_time cimport monotonic_time
021: from libc.stdint cimport int64_t, uint64_t, uint8_t, uintptr_t
022:
023:
+024: THREADS = envint("XPRA_X264_THREADS")
__pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_envint); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 24, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 24, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_THREADS, __pyx_t_2) < 0) __PYX_ERR(0, 24, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* … */ __pyx_tuple__21 = PyTuple_Pack(1, __pyx_n_s_XPRA_X264_THREADS); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 24, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__21); __Pyx_GIVEREF(__pyx_tuple__21);
+025: SLICED_THREADS = envint("XPRA_X264_SLICED_THREADS", 1)
__pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_envint); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 25, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 25, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_SLICED_THREADS, __pyx_t_1) < 0) __PYX_ERR(0, 25, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* … */ __pyx_tuple__22 = PyTuple_Pack(2, __pyx_n_s_XPRA_X264_SLICED_THREADS, __pyx_int_1); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 25, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__22); __Pyx_GIVEREF(__pyx_tuple__22);
+026: LOGGING = os.environ.get("XPRA_X264_LOGGING", "WARNING")
__pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_os); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 26, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_environ); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 26, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_get); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 26, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 26, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_LOGGING, __pyx_t_2) < 0) __PYX_ERR(0, 26, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* … */ __pyx_tuple__23 = PyTuple_Pack(2, __pyx_n_s_XPRA_X264_LOGGING, __pyx_n_s_WARNING); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 26, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__23); __Pyx_GIVEREF(__pyx_tuple__23);
+027: PROFILE = os.environ.get("XPRA_X264_PROFILE")
__pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_os); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 27, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_environ); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 27, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_get); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 27, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 27, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_PROFILE, __pyx_t_1) < 0) __PYX_ERR(0, 27, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* … */ __pyx_tuple__24 = PyTuple_Pack(1, __pyx_n_s_XPRA_X264_PROFILE); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 27, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__24); __Pyx_GIVEREF(__pyx_tuple__24);
+028: SUPPORT_24BPP = envbool("XPRA_X264_SUPPORT_24BPP")
__pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_envbool); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 28, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 28, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_SUPPORT_24BPP, __pyx_t_2) < 0) __PYX_ERR(0, 28, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* … */ __pyx_tuple__25 = PyTuple_Pack(1, __pyx_n_s_XPRA_X264_SUPPORT_24BPP); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 28, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__25); __Pyx_GIVEREF(__pyx_tuple__25);
+029: TUNE = os.environ.get("XPRA_X264_TUNE")
__pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_os); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 29, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_environ); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 29, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_get); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 29, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__26, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 29, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_TUNE, __pyx_t_1) < 0) __PYX_ERR(0, 29, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* … */ __pyx_tuple__26 = PyTuple_Pack(1, __pyx_n_s_XPRA_X264_TUNE); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(0, 29, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__26); __Pyx_GIVEREF(__pyx_tuple__26);
+030: LOG_NALS = envbool("XPRA_X264_LOG_NALS")
__pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_envbool); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 30, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__27, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 30, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_LOG_NALS, __pyx_t_2) < 0) __PYX_ERR(0, 30, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* … */ __pyx_tuple__27 = PyTuple_Pack(1, __pyx_n_s_XPRA_X264_LOG_NALS); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 30, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__27); __Pyx_GIVEREF(__pyx_tuple__27);
+031: SAVE_TO_FILE = os.environ.get("XPRA_SAVE_TO_FILE")
__pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_os); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 31, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_environ); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 31, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_get); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 31, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__28, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 31, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_SAVE_TO_FILE, __pyx_t_1) < 0) __PYX_ERR(0, 31, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* … */ __pyx_tuple__28 = PyTuple_Pack(1, __pyx_n_s_XPRA_SAVE_TO_FILE); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(0, 31, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__28); __Pyx_GIVEREF(__pyx_tuple__28);
032:
033:
034: cdef extern from "string.h":
035: int vsnprintf(char * s, size_t n, const char * format, va_list arg)
036:
037: cdef extern from "stdint.h":
038: pass
039: cdef extern from "inttypes.h":
040: pass
041:
042: cdef extern from "stdarg.h":
043: ctypedef struct va_list:
044: pass
045: ctypedef struct fake_type:
046: pass
047: void va_start(va_list, void* arg)
048: void* va_arg(va_list, fake_type)
049: void va_end(va_list)
050: fake_type int_type "int"
051:
052: cdef extern from "x264.h":
053: int X264_KEYINT_MAX_INFINITE
054:
055: int X264_BUILD
056:
057: int X264_LOG_DEBUG
058: int X264_LOG_INFO
059: int X264_LOG_WARNING
060: int X264_LOG_ERROR
061:
062: int X264_CSP_I420
063: int X264_CSP_I422
064: int X264_CSP_I444
065: int X264_CSP_BGR
066: int X264_CSP_BGRA
067: int X264_CSP_RGB
068:
069: int X264_B_ADAPT_NONE
070: int X264_B_ADAPT_FAST
071: int X264_B_ADAPT_TRELLIS
072:
073: #enum
074: int X264_ME_DIA
075: int X264_ME_HEX
076: int X264_ME_UMH
077: int X264_ME_ESA
078: int X264_ME_TESA
079:
080: #enum nal_unit_type_e
081: int NAL_UNKNOWN
082: int NAL_SLICE
083: int NAL_SLICE_DPA
084: int NAL_SLICE_DPB
085: int NAL_SLICE_DPC
086: int NAL_SLICE_IDR
087: int NAL_SEI
088: int NAL_SPS
089: int NAL_PPS
090: int NAL_AUD
091: int NAL_FILLER
092:
093: #enum nal_priority_e
094: int NAL_PRIORITY_DISPOSABLE
095: int NAL_PRIORITY_LOW
096: int NAL_PRIORITY_HIGH
097: int NAL_PRIORITY_HIGHEST
098:
099: #frame type
100: int X264_TYPE_AUTO # Let x264 choose the right type
101: int X264_TYPE_KEYFRAME
102: int X264_TYPE_IDR
103: int X264_TYPE_I
104: int X264_TYPE_P
105: int X264_TYPE_BREF
106: int X264_TYPE_B
107:
108: const char * const *x264_preset_names
109:
110: ctypedef struct rc:
111: int i_rc_method
112: int i_qp_constant #0 to (51 + 6*(x264_bit_depth-8)). 0=lossless
113: int i_qp_min #min allowed QP value
114: int i_qp_max #max allowed QP value
115: int i_qp_step #max QP step between frames
116:
117: int i_bitrate
118: float f_rf_constant #1pass VBR, nominal QP
119: float f_rf_constant_max #In CRF mode, maximum CRF as caused by VBV
120: float f_rate_tolerance
121: int i_vbv_max_bitrate
122: int i_vbv_buffer_size
123: float f_vbv_buffer_init #<=1: fraction of buffer_size. >1: kbit
124: float f_ip_factor
125: float f_pb_factor
126:
127: int i_aq_mode #psy adaptive QP. (X264_AQ_*)
128: float f_aq_strength
129: int b_mb_tree #Macroblock-tree ratecontrol
130: int i_lookahead
131:
132: # 2pass
133: int b_stat_write #Enable stat writing in psz_stat_out
134: char *psz_stat_out #output filename (in UTF-8) of the 2pass stats file
135: int b_stat_read #Read stat from psz_stat_in and use it
136: char *psz_stat_in #input filename (in UTF-8) of the 2pass stats file
137:
138: # 2pass params (same as ffmpeg ones)
139: float f_qcompress #0.0 => cbr, 1.0 => constant qp
140: float f_qblur #temporally blur quants
141: float f_complexity_blur #temporally blur complexity
142: #x264_zone_t *zones #ratecontrol overrides
143: int i_zones #number of zone_t's
144: char *psz_zones #alternate method of specifying zones
145:
146: ctypedef struct analyse:
147: int i_me_method # motion estimation algorithm to use (X264_ME_*)
148: int i_me_range # integer pixel motion estimation search range (from predicted mv) */
149: int i_mv_range # maximum length of a mv (in pixels). -1 = auto, based on level */
150: int i_mv_range_thread # minimum space between threads. -1 = auto, based on number of threads. */
151: int i_subpel_refine # subpixel motion estimation quality */
152: int i_weighted_pred # weighting for P-frames
153:
154: ctypedef struct x264_param_t:
155: unsigned int cpu
156: int i_threads #encode multiple frames in parallel
157: int i_lookahead_threads #multiple threads for lookahead analysis
158: int b_sliced_threads #Whether to use slice-based threading
159: int b_deterministic #whether to allow non-deterministic optimizations when threaded
160: int b_cpu_independent #force canonical behavior rather than cpu-dependent optimal algorithms
161: int i_sync_lookahead #threaded lookahead buffer
162:
163: int i_width
164: int i_height
165: int i_csp #CSP of encoded bitstream
166: int i_level_idc
167: int i_frame_total #number of frames to encode if known, else 0
168:
169: int i_log_level
170: void* pf_log
171:
172: #Bitstream parameters
173: int i_frame_reference #Maximum number of reference frames
174: int i_dpb_size #Force a DPB size larger than that implied by B-frames and reference frames
175: #Useful in combination with interactive error resilience.
176: int i_keyint_max #Force an IDR keyframe at this interval
177: int i_keyint_min #Scenecuts closer together than this are coded as I, not IDR.
178: int i_scenecut_threshold#how aggressively to insert extra I frames
179: int b_intra_refresh #Whether or not to use periodic intra refresh instead of IDR frames.
180:
181: int i_bframe #how many b-frame between 2 references pictures
182: int i_bframe_adaptive
183: int i_bframe_bias
184: int i_bframe_pyramid #Keep some B-frames as references: 0=off, 1=strict hierarchical, 2=normal
185: int b_open_gop
186: int b_bluray_compat
187: #older x264 builds do not support this:
188: #int b_opencl #use OpenCL when available
189:
190: int b_cabac
191: int b_deblocking_filter
192: int b_interlaced
193: int b_constrained_intra
194:
195: rc rc #rate control
196: analyse analyse
197:
198: int b_vfr_input #VFR input. If 1, use timebase and timestamps for ratecontrol purposes. If 0, use fps only
199:
200: ctypedef struct x264_t:
201: pass
202: ctypedef struct x264_nal_t:
203: int i_ref_idc
204: int i_type
205: int b_long_startcode
206: int i_first_mb
207: int i_last_mb
208: int i_payload
209: uint8_t *p_payload
210: ctypedef struct x264_image_t:
211: int i_csp #Colorspace
212: int i_plane #Number of image planes
213: int i_stride[4] #Strides for each plane
214: uint8_t *plane[4] #Pointers to each plane
215: ctypedef struct x264_image_properties_t:
216: pass
217: ctypedef struct x264_hrd_t:
218: pass
219: ctypedef struct x264_sei_t:
220: pass
221: ctypedef struct x264_picture_t:
222: int i_type #In: force picture type (if not auto)
223: int i_qpplus1 #In: force quantizer for != X264_QP_AUTO
224: int i_pic_struct #In: pic_struct, for pulldown/doubling/etc...used only if b_pic_struct=1.
225: #use pic_struct_e for pic_struct inputs
226: #Out: pic_struct element associated with frame
227: int b_keyframe #Out: whether this frame is a keyframe. Important when using modes that result in
228: #SEI recovery points being used instead of IDR frames.
229: int64_t i_pts #In: user pts, Out: pts of encoded picture (user)
230: #Out: frame dts. When the pts of the first frame is close to zero,
231: #initial frames may have a negative dts which must be dealt with by any muxer
232: x264_param_t *param #In: custom encoding parameters to be set from this frame forwards (..)
233: x264_image_t img #In: raw image data
234: #Out: Out: reconstructed image data
235: x264_image_properties_t prop #In: optional information to modify encoder decisions for this frame
236: #Out: information about the encoded frame */
237: x264_hrd_t hrd_timing #Out: HRD timing information. Output only when i_nal_hrd is set.
238: x264_sei_t extra_sei#In: arbitrary user SEI (e.g subtitles, AFDs)
239: void *opaque #private user data. copied from input to output frames.
240:
241: void x264_picture_init(x264_picture_t *pic) nogil
242:
243: int x264_param_default_preset(x264_param_t *param, const char *preset, const char *tune)
244: int x264_param_apply_profile(x264_param_t *param, const char *profile)
245: void x264_encoder_parameters(x264_t *context, x264_param_t *param)
246: int x264_encoder_reconfig(x264_t *context, x264_param_t *param)
247:
248: x264_t *x264_encoder_open(x264_param_t *param)
249: void x264_encoder_close(x264_t *context)
250:
251: int x264_encoder_encode(x264_t *context, x264_nal_t **pp_nal, int *pi_nal, x264_picture_t *pic_in, x264_picture_t *pic_out ) nogil
252: int x264_encoder_delayed_frames(x264_t *)
253: int x264_encoder_maximum_delayed_frames(x264_t *h)
254:
255:
+256: cdef set_f_rf(x264_param_t *param, float q):
static PyObject *__pyx_f_4xpra_6codecs_8enc_x264_7encoder_set_f_rf(x264_param_t *__pyx_v_param, float __pyx_v_q) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_f_rf", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+257: param.rc.f_rf_constant = q
__pyx_v_param->rc.f_rf_constant = __pyx_v_q;
258:
+259: cdef const char * const *get_preset_names():
static char const *const *__pyx_f_4xpra_6codecs_8enc_x264_7encoder_get_preset_names(void) { char const *const *__pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_preset_names", 0); /* … */ /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+260: return x264_preset_names;
__pyx_r = x264_preset_names; goto __pyx_L0;
261:
262:
263: #we choose presets from 1 to 7
264: #(we exclude placebo)
+265: cdef int get_preset_for_speed(int speed):
static int __pyx_f_4xpra_6codecs_8enc_x264_7encoder_get_preset_for_speed(int __pyx_v_speed) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_preset_for_speed", 0); /* … */ /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
+266: if speed > 99:
__pyx_t_1 = ((__pyx_v_speed > 99) != 0); if (__pyx_t_1) { /* … */ }
267: #only allow "ultrafast" if pct > 99
+268: return 0
__pyx_r = 0; goto __pyx_L0;
+269: return 7 - max(0, min(6, speed / 15))
__pyx_t_2 = (__pyx_v_speed / 15); __pyx_t_3 = 6; if (((__pyx_t_2 < __pyx_t_3) != 0)) { __pyx_t_4 = __pyx_t_2; } else { __pyx_t_4 = __pyx_t_3; } __pyx_t_2 = __pyx_t_4; __pyx_t_4 = 0; if (((__pyx_t_2 > __pyx_t_4) != 0)) { __pyx_t_3 = __pyx_t_2; } else { __pyx_t_3 = __pyx_t_4; } __pyx_r = (7 - __pyx_t_3); goto __pyx_L0;
270:
271: #the x264 quality option ranges from 0 (best) to 51 (lowest)
+272: cdef float get_x264_quality(int pct, char *profile):
static float __pyx_f_4xpra_6codecs_8enc_x264_7encoder_get_x264_quality(int __pyx_v_pct, char *__pyx_v_profile) { PyObject *__pyx_v_pyiprofile = NULL; PyObject *__pyx_v_pycprofile = NULL; float __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_x264_quality", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_WriteUnraisable("xpra.codecs.enc_x264.encoder.get_x264_quality", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_pyiprofile); __Pyx_XDECREF(__pyx_v_pycprofile); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+273: if pct>=100 and profile:
__pyx_t_2 = ((__pyx_v_pct >= 0x64) != 0); if (__pyx_t_2) { } else { __pyx_t_1 = __pyx_t_2; goto __pyx_L4_bool_binop_done; } __pyx_t_2 = (__pyx_v_profile != 0); __pyx_t_1 = __pyx_t_2; __pyx_L4_bool_binop_done:; if (__pyx_t_1) { /* … */ }
274: #easier to compare as python strings:
+275: pyiprofile = str(profile)
__pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_profile); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 275, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 275, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_pyiprofile = __pyx_t_4; __pyx_t_4 = 0;
+276: pycprofile = str(PROFILE_HIGH444_PREDICTIVE)
__pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_4xpra_6codecs_8enc_x264_7encoder_PROFILE_HIGH444_PREDICTIVE); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 276, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 276, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_v_pycprofile = __pyx_t_3; __pyx_t_3 = 0;
+277: if pycprofile==pyiprofile:
__pyx_t_3 = PyObject_RichCompare(__pyx_v_pycprofile, __pyx_v_pyiprofile, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 277, __pyx_L1_error) __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 277, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_1) { /* … */ }
+278: return 0.0
__pyx_r = 0.0; goto __pyx_L0;
+279: return <float> (50.0 - (min(100, max(0, pct)) * 49.0 / 100.0))
__pyx_t_5 = __pyx_v_pct; __pyx_t_6 = 0; if (((__pyx_t_5 > __pyx_t_6) != 0)) { __pyx_t_7 = __pyx_t_5; } else { __pyx_t_7 = __pyx_t_6; } __pyx_t_6 = __pyx_t_7; __pyx_t_7 = 0x64; if (((__pyx_t_6 < __pyx_t_7) != 0)) { __pyx_t_8 = __pyx_t_6; } else { __pyx_t_8 = __pyx_t_7; } __pyx_r = ((float)(50.0 - ((__pyx_t_8 * 49.0) / 100.0))); goto __pyx_L0;
280:
281: ADAPT_TYPES = {
+282: X264_B_ADAPT_NONE : "NONE",
__pyx_t_1 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 282, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyInt_From_int(X264_B_ADAPT_NONE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 282, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_n_s_NONE) < 0) __PYX_ERR(0, 282, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+283: X264_B_ADAPT_FAST : "FAST",
__pyx_t_2 = __Pyx_PyInt_From_int(X264_B_ADAPT_FAST); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 283, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_n_s_FAST) < 0) __PYX_ERR(0, 282, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+284: X264_B_ADAPT_TRELLIS : "TRELLIS",
__pyx_t_2 = __Pyx_PyInt_From_int(X264_B_ADAPT_TRELLIS); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 284, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_n_s_TRELLIS) < 0) __PYX_ERR(0, 282, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_ADAPT_TYPES, __pyx_t_1) < 0) __PYX_ERR(0, 281, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
285: }
286:
287: SLICE_TYPES = {
+288: X264_TYPE_AUTO : "auto",
__pyx_t_1 = __Pyx_PyDict_NewPresized(7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 288, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyInt_From_int(X264_TYPE_AUTO); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 288, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_n_s_auto) < 0) __PYX_ERR(0, 288, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+289: X264_TYPE_IDR : "IDR",
__pyx_t_2 = __Pyx_PyInt_From_int(X264_TYPE_IDR); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 289, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_n_s_IDR) < 0) __PYX_ERR(0, 288, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+290: X264_TYPE_I : "I",
__pyx_t_2 = __Pyx_PyInt_From_int(X264_TYPE_I); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 290, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_n_s_I) < 0) __PYX_ERR(0, 288, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+291: X264_TYPE_P : "P",
__pyx_t_2 = __Pyx_PyInt_From_int(X264_TYPE_P); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 291, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_n_s_P) < 0) __PYX_ERR(0, 288, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+292: X264_TYPE_BREF : "BREF",
__pyx_t_2 = __Pyx_PyInt_From_int(X264_TYPE_BREF); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 292, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_n_s_BREF) < 0) __PYX_ERR(0, 288, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+293: X264_TYPE_B : "B",
__pyx_t_2 = __Pyx_PyInt_From_int(X264_TYPE_B); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 293, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_n_s_B) < 0) __PYX_ERR(0, 288, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+294: X264_TYPE_KEYFRAME : "KEYFRAME",
__pyx_t_2 = __Pyx_PyInt_From_int(X264_TYPE_KEYFRAME); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 294, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_n_s_KEYFRAME) < 0) __PYX_ERR(0, 288, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_SLICE_TYPES, __pyx_t_1) < 0) __PYX_ERR(0, 287, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
295: }
296:
297: ME_TYPES = {
+298: X264_ME_DIA : "DIA",
__pyx_t_1 = __Pyx_PyDict_NewPresized(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 298, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyInt_From_int(X264_ME_DIA); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 298, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_n_s_DIA) < 0) __PYX_ERR(0, 298, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+299: X264_ME_HEX : "HEX",
__pyx_t_2 = __Pyx_PyInt_From_int(X264_ME_HEX); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 299, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_n_s_HEX) < 0) __PYX_ERR(0, 298, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+300: X264_ME_UMH : "UMH",
__pyx_t_2 = __Pyx_PyInt_From_int(X264_ME_UMH); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 300, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_n_s_UMH) < 0) __PYX_ERR(0, 298, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+301: X264_ME_ESA : "ESA",
__pyx_t_2 = __Pyx_PyInt_From_int(X264_ME_ESA); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 301, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_n_s_ESA) < 0) __PYX_ERR(0, 298, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+302: X264_ME_TESA : "TESA",
__pyx_t_2 = __Pyx_PyInt_From_int(X264_ME_TESA); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 302, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_n_s_TESA) < 0) __PYX_ERR(0, 298, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_ME_TYPES, __pyx_t_1) < 0) __PYX_ERR(0, 297, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
303: }
304:
305: NAL_TYPES = {
+306: NAL_UNKNOWN : "unknown",
__pyx_t_1 = __Pyx_PyDict_NewPresized(11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 306, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyInt_From_int(NAL_UNKNOWN); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 306, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_n_s_unknown) < 0) __PYX_ERR(0, 306, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+307: NAL_SLICE : "slice",
__pyx_t_2 = __Pyx_PyInt_From_int(NAL_SLICE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 307, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_n_s_slice) < 0) __PYX_ERR(0, 306, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+308: NAL_SLICE_DPA : "slice-dpa",
__pyx_t_2 = __Pyx_PyInt_From_int(NAL_SLICE_DPA); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 308, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_kp_s_slice_dpa) < 0) __PYX_ERR(0, 306, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+309: NAL_SLICE_DPB : "slice-dpb",
__pyx_t_2 = __Pyx_PyInt_From_int(NAL_SLICE_DPB); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 309, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_kp_s_slice_dpb) < 0) __PYX_ERR(0, 306, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+310: NAL_SLICE_DPC : "slice-dpc",
__pyx_t_2 = __Pyx_PyInt_From_int(NAL_SLICE_DPC); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 310, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_kp_s_slice_dpc) < 0) __PYX_ERR(0, 306, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+311: NAL_SLICE_IDR : "slice-idr",
__pyx_t_2 = __Pyx_PyInt_From_int(NAL_SLICE_IDR); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 311, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_kp_s_slice_idr) < 0) __PYX_ERR(0, 306, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+312: NAL_SEI : "sei",
__pyx_t_2 = __Pyx_PyInt_From_int(NAL_SEI); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 312, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_n_s_sei) < 0) __PYX_ERR(0, 306, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+313: NAL_SPS : "sps",
__pyx_t_2 = __Pyx_PyInt_From_int(NAL_SPS); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 313, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_n_s_sps) < 0) __PYX_ERR(0, 306, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+314: NAL_PPS : "pps",
__pyx_t_2 = __Pyx_PyInt_From_int(NAL_PPS); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 314, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_n_s_pps) < 0) __PYX_ERR(0, 306, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+315: NAL_AUD : "aud",
__pyx_t_2 = __Pyx_PyInt_From_int(NAL_AUD); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 315, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_n_s_aud) < 0) __PYX_ERR(0, 306, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+316: NAL_FILLER : "filler",
__pyx_t_2 = __Pyx_PyInt_From_int(NAL_FILLER); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 316, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_n_s_filler) < 0) __PYX_ERR(0, 306, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_NAL_TYPES, __pyx_t_1) < 0) __PYX_ERR(0, 305, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
317: }
318:
319: NAL_PRIORITIES = {
+320: NAL_PRIORITY_DISPOSABLE : "disposable",
__pyx_t_1 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 320, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyInt_From_int(NAL_PRIORITY_DISPOSABLE); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 320, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_n_s_disposable) < 0) __PYX_ERR(0, 320, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+321: NAL_PRIORITY_LOW : "low",
__pyx_t_2 = __Pyx_PyInt_From_int(NAL_PRIORITY_LOW); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 321, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_n_s_low) < 0) __PYX_ERR(0, 320, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+322: NAL_PRIORITY_HIGH : "high",
__pyx_t_2 = __Pyx_PyInt_From_int(NAL_PRIORITY_HIGH); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 322, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_n_s_high) < 0) __PYX_ERR(0, 320, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+323: NAL_PRIORITY_HIGHEST : "highest",
__pyx_t_2 = __Pyx_PyInt_From_int(NAL_PRIORITY_HIGHEST); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 323, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_1, __pyx_t_2, __pyx_n_s_highest) < 0) __PYX_ERR(0, 320, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_NAL_PRIORITIES, __pyx_t_1) < 0) __PYX_ERR(0, 319, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
324: }
325:
326:
+327: cdef char *PROFILE_BASELINE = "baseline"
__pyx_v_4xpra_6codecs_8enc_x264_7encoder_PROFILE_BASELINE = ((char *)"baseline");
+328: cdef char *PROFILE_MAIN = "main"
__pyx_v_4xpra_6codecs_8enc_x264_7encoder_PROFILE_MAIN = ((char *)"main");
+329: cdef char *PROFILE_HIGH = "high"
__pyx_v_4xpra_6codecs_8enc_x264_7encoder_PROFILE_HIGH = ((char *)"high");
+330: cdef char *PROFILE_HIGH10 = "high10"
__pyx_v_4xpra_6codecs_8enc_x264_7encoder_PROFILE_HIGH10 = ((char *)"high10");
+331: cdef char *PROFILE_HIGH422 = "high422"
__pyx_v_4xpra_6codecs_8enc_x264_7encoder_PROFILE_HIGH422 = ((char *)"high422");
+332: cdef char *PROFILE_HIGH444_PREDICTIVE = "high444"
__pyx_v_4xpra_6codecs_8enc_x264_7encoder_PROFILE_HIGH444_PREDICTIVE = ((char *)"high444");
+333: I420_PROFILES = [PROFILE_BASELINE, PROFILE_MAIN, PROFILE_HIGH, PROFILE_HIGH10, PROFILE_HIGH422, PROFILE_HIGH444_PREDICTIVE]
__pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_4xpra_6codecs_8enc_x264_7encoder_PROFILE_BASELINE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 333, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyBytes_FromString(__pyx_v_4xpra_6codecs_8enc_x264_7encoder_PROFILE_MAIN); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 333, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_4xpra_6codecs_8enc_x264_7encoder_PROFILE_HIGH); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 333, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_4xpra_6codecs_8enc_x264_7encoder_PROFILE_HIGH10); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 333, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_4xpra_6codecs_8enc_x264_7encoder_PROFILE_HIGH422); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 333, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_4xpra_6codecs_8enc_x264_7encoder_PROFILE_HIGH444_PREDICTIVE); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 333, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = PyList_New(6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 333, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_GIVEREF(__pyx_t_1); PyList_SET_ITEM(__pyx_t_7, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_2); PyList_SET_ITEM(__pyx_t_7, 1, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_3); PyList_SET_ITEM(__pyx_t_7, 2, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_4); PyList_SET_ITEM(__pyx_t_7, 3, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_5); PyList_SET_ITEM(__pyx_t_7, 4, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_6); PyList_SET_ITEM(__pyx_t_7, 5, __pyx_t_6); __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_3 = 0; __pyx_t_4 = 0; __pyx_t_5 = 0; __pyx_t_6 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_I420_PROFILES, __pyx_t_7) < 0) __PYX_ERR(0, 333, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+334: I422_PROFILES = [PROFILE_HIGH422, PROFILE_HIGH444_PREDICTIVE]
__pyx_t_7 = __Pyx_PyBytes_FromString(__pyx_v_4xpra_6codecs_8enc_x264_7encoder_PROFILE_HIGH422); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 334, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_4xpra_6codecs_8enc_x264_7encoder_PROFILE_HIGH444_PREDICTIVE); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 334, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_5 = PyList_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 334, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_7); PyList_SET_ITEM(__pyx_t_5, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_6); PyList_SET_ITEM(__pyx_t_5, 1, __pyx_t_6); __pyx_t_7 = 0; __pyx_t_6 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_I422_PROFILES, __pyx_t_5) < 0) __PYX_ERR(0, 334, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+335: I444_PROFILES = [PROFILE_HIGH444_PREDICTIVE]
__pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_4xpra_6codecs_8enc_x264_7encoder_PROFILE_HIGH444_PREDICTIVE); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 335, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = PyList_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 335, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_GIVEREF(__pyx_t_5); PyList_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_I444_PROFILES, __pyx_t_6) < 0) __PYX_ERR(0, 335, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+336: RGB_PROFILES = [PROFILE_HIGH444_PREDICTIVE]
__pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_4xpra_6codecs_8enc_x264_7encoder_PROFILE_HIGH444_PREDICTIVE); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 336, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_5 = PyList_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 336, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_6); PyList_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); __pyx_t_6 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_RGB_PROFILES, __pyx_t_5) < 0) __PYX_ERR(0, 336, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
337:
338: COLORSPACE_FORMATS = {
+339: "YUV420P" : (X264_CSP_I420, PROFILE_HIGH, I420_PROFILES),
__pyx_t_5 = __Pyx_PyDict_NewPresized(5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 339, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = __Pyx_PyInt_From_int(X264_CSP_I420); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 339, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = __Pyx_PyBytes_FromString(__pyx_v_4xpra_6codecs_8enc_x264_7encoder_PROFILE_HIGH); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 339, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_I420_PROFILES); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 339, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 339, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_4); __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_4 = 0; if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_YUV420P, __pyx_t_3) < 0) __PYX_ERR(0, 339, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+340: "YUV422P" : (X264_CSP_I422, PROFILE_HIGH422, I422_PROFILES),
__pyx_t_3 = __Pyx_PyInt_From_int(X264_CSP_I422); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 340, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_4xpra_6codecs_8enc_x264_7encoder_PROFILE_HIGH422); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 340, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_I422_PROFILES); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 340, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 340, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_7); __pyx_t_3 = 0; __pyx_t_4 = 0; __pyx_t_7 = 0; if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_YUV422P, __pyx_t_6) < 0) __PYX_ERR(0, 339, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+341: "YUV444P" : (X264_CSP_I444, PROFILE_HIGH444_PREDICTIVE, I444_PROFILES),
__pyx_t_6 = __Pyx_PyInt_From_int(X264_CSP_I444); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 341, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = __Pyx_PyBytes_FromString(__pyx_v_4xpra_6codecs_8enc_x264_7encoder_PROFILE_HIGH444_PREDICTIVE); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 341, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_I444_PROFILES); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 341, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 341, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_4); __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_4 = 0; if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_YUV444P, __pyx_t_3) < 0) __PYX_ERR(0, 339, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+342: "BGRA" : (X264_CSP_BGRA, PROFILE_HIGH444_PREDICTIVE, RGB_PROFILES),
__pyx_t_3 = __Pyx_PyInt_From_int(X264_CSP_BGRA); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 342, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_4xpra_6codecs_8enc_x264_7encoder_PROFILE_HIGH444_PREDICTIVE); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 342, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_RGB_PROFILES); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 342, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 342, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_7); __pyx_t_3 = 0; __pyx_t_4 = 0; __pyx_t_7 = 0; if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_BGRA, __pyx_t_6) < 0) __PYX_ERR(0, 339, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+343: "BGRX" : (X264_CSP_BGRA, PROFILE_HIGH444_PREDICTIVE, RGB_PROFILES),
__pyx_t_6 = __Pyx_PyInt_From_int(X264_CSP_BGRA); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 343, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = __Pyx_PyBytes_FromString(__pyx_v_4xpra_6codecs_8enc_x264_7encoder_PROFILE_HIGH444_PREDICTIVE); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 343, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_RGB_PROFILES); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 343, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 343, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_4); __pyx_t_6 = 0; __pyx_t_7 = 0; __pyx_t_4 = 0; if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_BGRX, __pyx_t_3) < 0) __PYX_ERR(0, 339, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_COLORSPACE_FORMATS, __pyx_t_5) < 0) __PYX_ERR(0, 338, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
344: }
+345: if SUPPORT_24BPP:
__pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_SUPPORT_24BPP); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 345, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 345, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_8) { /* … */ }
+346: COLORSPACE_FORMATS.update({
__pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_COLORSPACE_FORMATS); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 346, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_update); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 346, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; /* … */ __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 346, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+347: "BGR" : (X264_CSP_BGR, PROFILE_HIGH444_PREDICTIVE, RGB_PROFILES),
__pyx_t_5 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 347, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = __Pyx_PyInt_From_int(X264_CSP_BGR); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 347, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_7 = __Pyx_PyBytes_FromString(__pyx_v_4xpra_6codecs_8enc_x264_7encoder_PROFILE_HIGH444_PREDICTIVE); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 347, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_RGB_PROFILES); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 347, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 347, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_6); __pyx_t_4 = 0; __pyx_t_7 = 0; __pyx_t_6 = 0; if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_BGR, __pyx_t_2) < 0) __PYX_ERR(0, 347, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+348: "RGB" : (X264_CSP_RGB, PROFILE_HIGH444_PREDICTIVE, RGB_PROFILES),
__pyx_t_2 = __Pyx_PyInt_From_int(X264_CSP_RGB); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 348, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_6 = __Pyx_PyBytes_FromString(__pyx_v_4xpra_6codecs_8enc_x264_7encoder_PROFILE_HIGH444_PREDICTIVE); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 348, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_RGB_PROFILES); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 348, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 348, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_7); __pyx_t_2 = 0; __pyx_t_6 = 0; __pyx_t_7 = 0; if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_RGB, __pyx_t_4) < 0) __PYX_ERR(0, 347, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
349: })
350:
351: COLORSPACES = {
+352: "YUV420P" : ("YUV420P",),
__pyx_t_4 = __Pyx_PyDict_NewPresized(5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 352, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_YUV420P, __pyx_tuple__29) < 0) __PYX_ERR(0, 352, __pyx_L1_error) /* … */ __pyx_tuple__29 = PyTuple_Pack(1, __pyx_n_s_YUV420P); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 352, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__29); __Pyx_GIVEREF(__pyx_tuple__29);
+353: "YUV422P" : ("YUV422P",),
if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_YUV422P, __pyx_tuple__30) < 0) __PYX_ERR(0, 352, __pyx_L1_error) /* … */ __pyx_tuple__30 = PyTuple_Pack(1, __pyx_n_s_YUV422P); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(0, 353, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__30); __Pyx_GIVEREF(__pyx_tuple__30);
+354: "YUV444P" : ("YUV444P",),
if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_YUV444P, __pyx_tuple__31) < 0) __PYX_ERR(0, 352, __pyx_L1_error) /* … */ __pyx_tuple__31 = PyTuple_Pack(1, __pyx_n_s_YUV444P); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 354, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__31); __Pyx_GIVEREF(__pyx_tuple__31);
+355: "BGRA" : ("BGRA",),
if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_BGRA, __pyx_tuple__32) < 0) __PYX_ERR(0, 352, __pyx_L1_error) /* … */ __pyx_tuple__32 = PyTuple_Pack(1, __pyx_n_s_BGRA); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 355, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__32); __Pyx_GIVEREF(__pyx_tuple__32);
+356: "BGRX" : ("BGRX",),
if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_BGRX, __pyx_tuple__33) < 0) __PYX_ERR(0, 352, __pyx_L1_error) if (PyDict_SetItem(__pyx_d, __pyx_n_s_COLORSPACES, __pyx_t_4) < 0) __PYX_ERR(0, 351, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* … */ __pyx_tuple__33 = PyTuple_Pack(1, __pyx_n_s_BGRX); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 356, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__33); __Pyx_GIVEREF(__pyx_tuple__33);
357: }
+358: if SUPPORT_24BPP:
__pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_SUPPORT_24BPP); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 358, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 358, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_8) { /* … */ }
+359: COLORSPACES.update({
__pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_COLORSPACES); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 359, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_update); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 359, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* … */ __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 359, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+360: "BGR" : ("BGR",),
__pyx_t_4 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 360, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_BGR, __pyx_tuple__34) < 0) __PYX_ERR(0, 360, __pyx_L1_error) /* … */ __pyx_tuple__34 = PyTuple_Pack(1, __pyx_n_s_BGR); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(0, 360, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__34); __Pyx_GIVEREF(__pyx_tuple__34);
+361: "RGB" : ("RGB",),
if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_RGB, __pyx_tuple__35) < 0) __PYX_ERR(0, 360, __pyx_L1_error) /* … */ __pyx_tuple__35 = PyTuple_Pack(1, __pyx_n_s_RGB); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 361, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__35); __Pyx_GIVEREF(__pyx_tuple__35);
362: })
363:
364:
+365: def init_module():
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_8enc_x264_7encoder_1init_module(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyMethodDef __pyx_mdef_4xpra_6codecs_8enc_x264_7encoder_1init_module = {"init_module", (PyCFunction)__pyx_pw_4xpra_6codecs_8enc_x264_7encoder_1init_module, METH_NOARGS, 0}; static PyObject *__pyx_pw_4xpra_6codecs_8enc_x264_7encoder_1init_module(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("init_module (wrapper)", 0); __pyx_r = __pyx_pf_4xpra_6codecs_8enc_x264_7encoder_init_module(__pyx_self); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_8enc_x264_7encoder_init_module(CYTHON_UNUSED PyObject *__pyx_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("init_module", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("xpra.codecs.enc_x264.encoder.init_module", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_4xpra_6codecs_8enc_x264_7encoder_1init_module, NULL, __pyx_n_s_xpra_codecs_enc_x264_encoder); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 365, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_d, __pyx_n_s_init_module, __pyx_t_3) < 0) __PYX_ERR(0, 365, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* … */ __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_xpra_codecs_enc_x264_encoder_pyx, __pyx_n_s_init_module, 365, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) __PYX_ERR(0, 365, __pyx_L1_error)
+366: log("enc_x264.init_module()")
__pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 366, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 366, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* … */ __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_enc_x264_init_module); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 366, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple_); __Pyx_GIVEREF(__pyx_tuple_);
367:
+368: def cleanup_module():
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_8enc_x264_7encoder_3cleanup_module(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyMethodDef __pyx_mdef_4xpra_6codecs_8enc_x264_7encoder_3cleanup_module = {"cleanup_module", (PyCFunction)__pyx_pw_4xpra_6codecs_8enc_x264_7encoder_3cleanup_module, METH_NOARGS, 0}; static PyObject *__pyx_pw_4xpra_6codecs_8enc_x264_7encoder_3cleanup_module(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("cleanup_module (wrapper)", 0); __pyx_r = __pyx_pf_4xpra_6codecs_8enc_x264_7encoder_2cleanup_module(__pyx_self); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_8enc_x264_7encoder_2cleanup_module(CYTHON_UNUSED PyObject *__pyx_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("cleanup_module", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("xpra.codecs.enc_x264.encoder.cleanup_module", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_4xpra_6codecs_8enc_x264_7encoder_3cleanup_module, NULL, __pyx_n_s_xpra_codecs_enc_x264_encoder); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 368, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_d, __pyx_n_s_cleanup_module, __pyx_t_3) < 0) __PYX_ERR(0, 368, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* … */ __pyx_codeobj__37 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_xpra_codecs_enc_x264_encoder_pyx, __pyx_n_s_cleanup_module, 368, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__37)) __PYX_ERR(0, 368, __pyx_L1_error)
+369: log("enc_x264.cleanup_module()")
__pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 369, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 369, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* … */ __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_enc_x264_cleanup_module); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 369, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__2); __Pyx_GIVEREF(__pyx_tuple__2);
370:
+371: def get_version():
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_8enc_x264_7encoder_5get_version(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyMethodDef __pyx_mdef_4xpra_6codecs_8enc_x264_7encoder_5get_version = {"get_version", (PyCFunction)__pyx_pw_4xpra_6codecs_8enc_x264_7encoder_5get_version, METH_NOARGS, 0}; static PyObject *__pyx_pw_4xpra_6codecs_8enc_x264_7encoder_5get_version(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_version (wrapper)", 0); __pyx_r = __pyx_pf_4xpra_6codecs_8enc_x264_7encoder_4get_version(__pyx_self); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_8enc_x264_7encoder_4get_version(CYTHON_UNUSED PyObject *__pyx_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_version", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("xpra.codecs.enc_x264.encoder.get_version", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_4xpra_6codecs_8enc_x264_7encoder_5get_version, NULL, __pyx_n_s_xpra_codecs_enc_x264_encoder); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 371, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_version, __pyx_t_3) < 0) __PYX_ERR(0, 371, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* … */ __pyx_codeobj__38 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_xpra_codecs_enc_x264_encoder_pyx, __pyx_n_s_get_version, 371, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__38)) __PYX_ERR(0, 371, __pyx_L1_error)
+372: return X264_BUILD
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_From_int(X264_BUILD); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 372, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
373:
+374: def get_type():
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_8enc_x264_7encoder_7get_type(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyMethodDef __pyx_mdef_4xpra_6codecs_8enc_x264_7encoder_7get_type = {"get_type", (PyCFunction)__pyx_pw_4xpra_6codecs_8enc_x264_7encoder_7get_type, METH_NOARGS, 0}; static PyObject *__pyx_pw_4xpra_6codecs_8enc_x264_7encoder_7get_type(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_type (wrapper)", 0); __pyx_r = __pyx_pf_4xpra_6codecs_8enc_x264_7encoder_6get_type(__pyx_self); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_8enc_x264_7encoder_6get_type(CYTHON_UNUSED PyObject *__pyx_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_type", 0); /* … */ /* function exit code */ __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_4xpra_6codecs_8enc_x264_7encoder_7get_type, NULL, __pyx_n_s_xpra_codecs_enc_x264_encoder); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 374, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_type, __pyx_t_3) < 0) __PYX_ERR(0, 374, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* … */ __pyx_codeobj__39 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_xpra_codecs_enc_x264_encoder_pyx, __pyx_n_s_get_type, 374, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__39)) __PYX_ERR(0, 374, __pyx_L1_error)
+375: return "x264"
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_n_s_x264); __pyx_r = __pyx_n_s_x264; goto __pyx_L0;
376:
+377: generation = AtomicInteger()
__pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_AtomicInteger); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 377, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 377, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_generation, __pyx_t_4) < 0) __PYX_ERR(0, 377, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+378: def get_info():
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_8enc_x264_7encoder_9get_info(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyMethodDef __pyx_mdef_4xpra_6codecs_8enc_x264_7encoder_9get_info = {"get_info", (PyCFunction)__pyx_pw_4xpra_6codecs_8enc_x264_7encoder_9get_info, METH_NOARGS, 0}; static PyObject *__pyx_pw_4xpra_6codecs_8enc_x264_7encoder_9get_info(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_info (wrapper)", 0); __pyx_r = __pyx_pf_4xpra_6codecs_8enc_x264_7encoder_8get_info(__pyx_self); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_8enc_x264_7encoder_8get_info(CYTHON_UNUSED PyObject *__pyx_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_info", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("xpra.codecs.enc_x264.encoder.get_info", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_t_4 = PyCFunction_NewEx(&__pyx_mdef_4xpra_6codecs_8enc_x264_7encoder_9get_info, NULL, __pyx_n_s_xpra_codecs_enc_x264_encoder); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 378, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_info, __pyx_t_4) < 0) __PYX_ERR(0, 378, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* … */ __pyx_codeobj__40 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_xpra_codecs_enc_x264_encoder_pyx, __pyx_n_s_get_info, 378, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__40)) __PYX_ERR(0, 378, __pyx_L1_error)
379: global COLORSPACES, MAX_WIDTH, MAX_HEIGHT
+380: return {
__Pyx_XDECREF(__pyx_r);
+381: "version" : get_version(),
__pyx_t_1 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 381, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_get_version); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 381, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } if (__pyx_t_4) { __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 381, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else { __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 381, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_version, __pyx_t_2) < 0) __PYX_ERR(0, 381, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+382: "max-size" : (MAX_WIDTH, MAX_HEIGHT),
__pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_MAX_WIDTH); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 382, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_MAX_HEIGHT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 382, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 382, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); __pyx_t_2 = 0; __pyx_t_3 = 0; if (PyDict_SetItem(__pyx_t_1, __pyx_kp_s_max_size, __pyx_t_4) < 0) __PYX_ERR(0, 381, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+383: "generation": generation.get(),
__pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_generation); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 383, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_get); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 383, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } if (__pyx_t_3) { __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 383, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else { __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 383, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_generation, __pyx_t_4) < 0) __PYX_ERR(0, 381, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+384: "formats" : tuple(COLORSPACES.keys()),
__pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_COLORSPACES); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 384, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_keys); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 384, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_2)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } if (__pyx_t_2) { __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 384, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else { __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 384, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PySequence_Tuple(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 384, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_formats, __pyx_t_3) < 0) __PYX_ERR(0, 381, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
385: }
386:
+387: def get_encodings():
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_8enc_x264_7encoder_11get_encodings(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyMethodDef __pyx_mdef_4xpra_6codecs_8enc_x264_7encoder_11get_encodings = {"get_encodings", (PyCFunction)__pyx_pw_4xpra_6codecs_8enc_x264_7encoder_11get_encodings, METH_NOARGS, 0}; static PyObject *__pyx_pw_4xpra_6codecs_8enc_x264_7encoder_11get_encodings(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_encodings (wrapper)", 0); __pyx_r = __pyx_pf_4xpra_6codecs_8enc_x264_7encoder_10get_encodings(__pyx_self); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_8enc_x264_7encoder_10get_encodings(CYTHON_UNUSED PyObject *__pyx_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_encodings", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("xpra.codecs.enc_x264.encoder.get_encodings", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_t_4 = PyCFunction_NewEx(&__pyx_mdef_4xpra_6codecs_8enc_x264_7encoder_11get_encodings, NULL, __pyx_n_s_xpra_codecs_enc_x264_encoder); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 387, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_encodings, __pyx_t_4) < 0) __PYX_ERR(0, 387, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* … */ __pyx_codeobj__41 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_xpra_codecs_enc_x264_encoder_pyx, __pyx_n_s_get_encodings, 387, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__41)) __PYX_ERR(0, 387, __pyx_L1_error)
+388: return ["h264"]
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 388, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_n_s_h264); __Pyx_GIVEREF(__pyx_n_s_h264); PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_h264); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
389:
+390: def get_input_colorspaces(encoding):
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_8enc_x264_7encoder_13get_input_colorspaces(PyObject *__pyx_self, PyObject *__pyx_v_encoding); /*proto*/ static PyMethodDef __pyx_mdef_4xpra_6codecs_8enc_x264_7encoder_13get_input_colorspaces = {"get_input_colorspaces", (PyCFunction)__pyx_pw_4xpra_6codecs_8enc_x264_7encoder_13get_input_colorspaces, METH_O, 0}; static PyObject *__pyx_pw_4xpra_6codecs_8enc_x264_7encoder_13get_input_colorspaces(PyObject *__pyx_self, PyObject *__pyx_v_encoding) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_input_colorspaces (wrapper)", 0); __pyx_r = __pyx_pf_4xpra_6codecs_8enc_x264_7encoder_12get_input_colorspaces(__pyx_self, ((PyObject *)__pyx_v_encoding)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_8enc_x264_7encoder_12get_input_colorspaces(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_encoding) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_input_colorspaces", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("xpra.codecs.enc_x264.encoder.get_input_colorspaces", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__42 = PyTuple_Pack(1, __pyx_n_s_encoding); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(0, 390, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__42); __Pyx_GIVEREF(__pyx_tuple__42); /* … */ __pyx_t_4 = PyCFunction_NewEx(&__pyx_mdef_4xpra_6codecs_8enc_x264_7encoder_13get_input_colorspaces, NULL, __pyx_n_s_xpra_codecs_enc_x264_encoder); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 390, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_input_colorspaces, __pyx_t_4) < 0) __PYX_ERR(0, 390, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_codeobj__43 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__42, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_xpra_codecs_enc_x264_encoder_pyx, __pyx_n_s_get_input_colorspaces, 390, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__43)) __PYX_ERR(0, 390, __pyx_L1_error)
+391: assert encoding in get_encodings()
#ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_get_encodings); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 391, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } if (__pyx_t_3) { __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 391, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else { __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 391, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = (__Pyx_PySequence_ContainsTF(__pyx_v_encoding, __pyx_t_1, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 391, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(!(__pyx_t_4 != 0))) { PyErr_SetNone(PyExc_AssertionError); __PYX_ERR(0, 391, __pyx_L1_error) } } #endif
+392: return COLORSPACES.keys()
__Pyx_XDECREF(__pyx_r); __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_COLORSPACES); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 392, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_keys); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 392, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_2)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } if (__pyx_t_2) { __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 392, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else { __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 392, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
393:
+394: def get_output_colorspaces(encoding, input_colorspace):
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_8enc_x264_7encoder_15get_output_colorspaces(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyMethodDef __pyx_mdef_4xpra_6codecs_8enc_x264_7encoder_15get_output_colorspaces = {"get_output_colorspaces", (PyCFunction)__pyx_pw_4xpra_6codecs_8enc_x264_7encoder_15get_output_colorspaces, METH_VARARGS|METH_KEYWORDS, 0}; static PyObject *__pyx_pw_4xpra_6codecs_8enc_x264_7encoder_15get_output_colorspaces(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_encoding = 0; PyObject *__pyx_v_input_colorspace = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_output_colorspaces (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_encoding,&__pyx_n_s_input_colorspace,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_encoding)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_input_colorspace)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("get_output_colorspaces", 1, 2, 2, 1); __PYX_ERR(0, 394, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_output_colorspaces") < 0)) __PYX_ERR(0, 394, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_encoding = values[0]; __pyx_v_input_colorspace = values[1]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("get_output_colorspaces", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 394, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("xpra.codecs.enc_x264.encoder.get_output_colorspaces", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_4xpra_6codecs_8enc_x264_7encoder_14get_output_colorspaces(__pyx_self, __pyx_v_encoding, __pyx_v_input_colorspace); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_8enc_x264_7encoder_14get_output_colorspaces(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_encoding, PyObject *__pyx_v_input_colorspace) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_output_colorspaces", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("xpra.codecs.enc_x264.encoder.get_output_colorspaces", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__44 = PyTuple_Pack(2, __pyx_n_s_encoding, __pyx_n_s_input_colorspace); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(0, 394, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__44); __Pyx_GIVEREF(__pyx_tuple__44); /* … */ __pyx_t_4 = PyCFunction_NewEx(&__pyx_mdef_4xpra_6codecs_8enc_x264_7encoder_15get_output_colorspaces, NULL, __pyx_n_s_xpra_codecs_enc_x264_encoder); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 394, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_output_colorspaces, __pyx_t_4) < 0) __PYX_ERR(0, 394, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_codeobj__45 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__44, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_xpra_codecs_enc_x264_encoder_pyx, __pyx_n_s_get_output_colorspaces, 394, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__45)) __PYX_ERR(0, 394, __pyx_L1_error)
+395: assert encoding in get_encodings()
#ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_get_encodings); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 395, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } if (__pyx_t_3) { __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 395, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else { __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 395, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = (__Pyx_PySequence_ContainsTF(__pyx_v_encoding, __pyx_t_1, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 395, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(!(__pyx_t_4 != 0))) { PyErr_SetNone(PyExc_AssertionError); __PYX_ERR(0, 395, __pyx_L1_error) } } #endif
+396: assert input_colorspace in COLORSPACES
#ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_COLORSPACES); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 396, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = (__Pyx_PySequence_ContainsTF(__pyx_v_input_colorspace, __pyx_t_1, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 396, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(!(__pyx_t_4 != 0))) { PyErr_SetNone(PyExc_AssertionError); __PYX_ERR(0, 396, __pyx_L1_error) } } #endif
+397: return COLORSPACES[input_colorspace]
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_COLORSPACES); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 397, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_input_colorspace); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 397, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0;
398:
+399: if X264_BUILD<146:
__pyx_t_8 = ((X264_BUILD < 0x92) != 0); if (__pyx_t_8) { /* … */ goto __pyx_L4; }
400: #untested, but should be OK for 4k:
+401: MAX_WIDTH, MAX_HEIGHT = 4096, 4096
__pyx_t_4 = __pyx_int_4096; __Pyx_INCREF(__pyx_t_4); __pyx_t_3 = __pyx_int_4096; __Pyx_INCREF(__pyx_t_3); if (PyDict_SetItem(__pyx_d, __pyx_n_s_MAX_WIDTH, __pyx_t_4) < 0) __PYX_ERR(0, 401, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_MAX_HEIGHT, __pyx_t_3) < 0) __PYX_ERR(0, 401, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
402: else:
403: #actual limits (which we cannot reach because we hit OOM):
404: #MAX_WIDTH, MAX_HEIGHT = 16384, 16384
+405: MAX_WIDTH, MAX_HEIGHT = 8192, 4096
/*else*/ { __pyx_t_3 = __pyx_int_8192; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = __pyx_int_4096; __Pyx_INCREF(__pyx_t_4); if (PyDict_SetItem(__pyx_d, __pyx_n_s_MAX_WIDTH, __pyx_t_3) < 0) __PYX_ERR(0, 405, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_MAX_HEIGHT, __pyx_t_4) < 0) __PYX_ERR(0, 405, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } __pyx_L4:;
406:
+407: def get_spec(encoding, colorspace):
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_8enc_x264_7encoder_17get_spec(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyMethodDef __pyx_mdef_4xpra_6codecs_8enc_x264_7encoder_17get_spec = {"get_spec", (PyCFunction)__pyx_pw_4xpra_6codecs_8enc_x264_7encoder_17get_spec, METH_VARARGS|METH_KEYWORDS, 0}; static PyObject *__pyx_pw_4xpra_6codecs_8enc_x264_7encoder_17get_spec(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_encoding = 0; PyObject *__pyx_v_colorspace = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_spec (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_encoding,&__pyx_n_s_colorspace,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_encoding)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_colorspace)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("get_spec", 1, 2, 2, 1); __PYX_ERR(0, 407, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_spec") < 0)) __PYX_ERR(0, 407, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_encoding = values[0]; __pyx_v_colorspace = values[1]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("get_spec", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 407, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("xpra.codecs.enc_x264.encoder.get_spec", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_4xpra_6codecs_8enc_x264_7encoder_16get_spec(__pyx_self, __pyx_v_encoding, __pyx_v_colorspace); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_8enc_x264_7encoder_16get_spec(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_encoding, PyObject *__pyx_v_colorspace) { int __pyx_v_has_lossless_mode; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_spec", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("xpra.codecs.enc_x264.encoder.get_spec", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__46 = PyTuple_Pack(3, __pyx_n_s_encoding, __pyx_n_s_colorspace, __pyx_n_s_has_lossless_mode); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(0, 407, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__46); __Pyx_GIVEREF(__pyx_tuple__46); /* … */ __pyx_t_4 = PyCFunction_NewEx(&__pyx_mdef_4xpra_6codecs_8enc_x264_7encoder_17get_spec, NULL, __pyx_n_s_xpra_codecs_enc_x264_encoder); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 407, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_d, __pyx_n_s_get_spec, __pyx_t_4) < 0) __PYX_ERR(0, 407, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_codeobj__47 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__46, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_xpra_codecs_enc_x264_encoder_pyx, __pyx_n_s_get_spec, 407, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__47)) __PYX_ERR(0, 407, __pyx_L1_error)
+408: assert encoding in get_encodings(), "invalid encoding: %s (must be one of %s" % (encoding, get_encodings())
#ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_get_encodings); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 408, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } if (__pyx_t_3) { __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 408, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else { __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 408, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = (__Pyx_PySequence_ContainsTF(__pyx_v_encoding, __pyx_t_1, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 408, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(!(__pyx_t_4 != 0))) { __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_get_encodings); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 408, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } if (__pyx_t_3) { __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 408, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else { __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 408, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 408, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_encoding); __Pyx_GIVEREF(__pyx_v_encoding); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_encoding); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_invalid_encoding_s_must_be_one_o, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 408, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyErr_SetObject(PyExc_AssertionError, __pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 408, __pyx_L1_error) } } #endif
+409: assert colorspace in COLORSPACES, "invalid colorspace: %s (must be one of %s)" % (colorspace, COLORSPACES.keys())
#ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_COLORSPACES); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 409, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = (__Pyx_PySequence_ContainsTF(__pyx_v_colorspace, __pyx_t_1, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 409, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(!(__pyx_t_4 != 0))) { __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_COLORSPACES); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 409, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_keys); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 409, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_2)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } if (__pyx_t_2) { __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 409, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else { __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 409, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 409, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_colorspace); __Pyx_GIVEREF(__pyx_v_colorspace); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_colorspace); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_invalid_colorspace_s_must_be_one, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 409, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; PyErr_SetObject(PyExc_AssertionError, __pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 409, __pyx_L1_error) } } #endif
410: #we can handle high quality and any speed
411: #setup cost is moderate (about 10ms)
+412: has_lossless_mode = colorspace in ("YUV444P", "BGR", "BGRA", "BGRX", "RGB")
__Pyx_INCREF(__pyx_v_colorspace); __pyx_t_1 = __pyx_v_colorspace; __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_t_1, __pyx_n_s_YUV444P, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 412, __pyx_L1_error) if (!__pyx_t_5) { } else { __pyx_t_4 = __pyx_t_5; goto __pyx_L3_bool_binop_done; } __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_t_1, __pyx_n_s_BGR, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 412, __pyx_L1_error) if (!__pyx_t_5) { } else { __pyx_t_4 = __pyx_t_5; goto __pyx_L3_bool_binop_done; } __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_t_1, __pyx_n_s_BGRA, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 412, __pyx_L1_error) if (!__pyx_t_5) { } else { __pyx_t_4 = __pyx_t_5; goto __pyx_L3_bool_binop_done; } __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_t_1, __pyx_n_s_BGRX, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 412, __pyx_L1_error) if (!__pyx_t_5) { } else { __pyx_t_4 = __pyx_t_5; goto __pyx_L3_bool_binop_done; } __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_t_1, __pyx_n_s_RGB, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 412, __pyx_L1_error) __pyx_t_4 = __pyx_t_5; __pyx_L3_bool_binop_done:; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_has_lossless_mode = __pyx_t_4;
+413: return video_spec(encoding=encoding, output_colorspaces=COLORSPACES[colorspace], has_lossless_mode=has_lossless_mode,
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_video_spec); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 413, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __Pyx_PyDict_NewPresized(13); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 413, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_encoding, __pyx_v_encoding) < 0) __PYX_ERR(0, 413, __pyx_L1_error) __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_COLORSPACES); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 413, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_v_colorspace); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 413, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_output_colorspaces, __pyx_t_6) < 0) __PYX_ERR(0, 413, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = __Pyx_PyBool_FromLong(__pyx_v_has_lossless_mode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 413, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_has_lossless_mode, __pyx_t_6) < 0) __PYX_ERR(0, 413, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; /* … */ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 413, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0;
+414: codec_class=Encoder, codec_type=get_type(),
if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_codec_class, ((PyObject *)__pyx_ptype_4xpra_6codecs_8enc_x264_7encoder_Encoder)) < 0) __PYX_ERR(0, 413, __pyx_L1_error) __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_get_type); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 414, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_7 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_7)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } if (__pyx_t_7) { __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 414, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } else { __pyx_t_6 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 414, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_codec_type, __pyx_t_6) < 0) __PYX_ERR(0, 413, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+415: quality=60+40*int(has_lossless_mode), speed=60,
__pyx_t_6 = __Pyx_PyBool_FromLong(__pyx_v_has_lossless_mode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 415, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_2 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyInt_Type)), __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 415, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = PyNumber_Multiply(__pyx_int_40, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 415, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyInt_AddCObj(__pyx_int_60, __pyx_t_6, 60, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 415, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_quality, __pyx_t_2) < 0) __PYX_ERR(0, 413, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_speed, __pyx_int_60) < 0) __PYX_ERR(0, 413, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_size_efficiency, __pyx_int_40) < 0) __PYX_ERR(0, 413, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_setup_cost, __pyx_int_20) < 0) __PYX_ERR(0, 413, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_width_mask, __pyx_int_65534) < 0) __PYX_ERR(0, 413, __pyx_L1_error) if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_height_mask, __pyx_int_65534) < 0) __PYX_ERR(0, 413, __pyx_L1_error)
416: size_efficiency=40,
+417: setup_cost=20, width_mask=0xFFFE, height_mask=0xFFFE, max_w=MAX_WIDTH, max_h=MAX_HEIGHT)
__pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_MAX_WIDTH); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 417, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_max_w, __pyx_t_2) < 0) __PYX_ERR(0, 413, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_MAX_HEIGHT); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 417, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_max_h, __pyx_t_2) < 0) __PYX_ERR(0, 413, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
418:
419:
420: #maps a log level to one of our logger functions:
421: LOGGERS = {
+422: X264_LOG_ERROR : log.error,
__pyx_t_4 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 422, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = __Pyx_PyInt_From_int(X264_LOG_ERROR); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 422, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 422, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_error); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 422, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (PyDict_SetItem(__pyx_t_4, __pyx_t_3, __pyx_t_7) < 0) __PYX_ERR(0, 422, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+423: X264_LOG_WARNING : log.warn,
__pyx_t_7 = __Pyx_PyInt_From_int(X264_LOG_WARNING); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 423, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 423, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_warn); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 423, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (PyDict_SetItem(__pyx_t_4, __pyx_t_7, __pyx_t_5) < 0) __PYX_ERR(0, 422, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+424: X264_LOG_INFO : log.info,
__pyx_t_5 = __Pyx_PyInt_From_int(X264_LOG_INFO); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 424, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 424, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_info); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 424, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (PyDict_SetItem(__pyx_t_4, __pyx_t_5, __pyx_t_3) < 0) __PYX_ERR(0, 422, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+425: X264_LOG_DEBUG : log.debug,
__pyx_t_3 = __Pyx_PyInt_From_int(X264_LOG_DEBUG); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 425, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 425, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_debug); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 425, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (PyDict_SetItem(__pyx_t_4, __pyx_t_3, __pyx_t_7) < 0) __PYX_ERR(0, 422, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_LOGGERS, __pyx_t_4) < 0) __PYX_ERR(0, 421, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
426: }
427:
428: #maps a log level string to the actual constant:
429: LOG_LEVEL = {
+430: "ERROR" : X264_LOG_ERROR,
__pyx_t_4 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 430, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_7 = __Pyx_PyInt_From_int(X264_LOG_ERROR); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 430, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_ERROR, __pyx_t_7) < 0) __PYX_ERR(0, 430, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+431: "WARNING" : X264_LOG_WARNING,
__pyx_t_7 = __Pyx_PyInt_From_int(X264_LOG_WARNING); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 431, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_WARNING, __pyx_t_7) < 0) __PYX_ERR(0, 430, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+432: "WARN" : X264_LOG_WARNING,
__pyx_t_7 = __Pyx_PyInt_From_int(X264_LOG_WARNING); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 432, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_WARN, __pyx_t_7) < 0) __PYX_ERR(0, 430, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+433: "INFO" : X264_LOG_INFO,
__pyx_t_7 = __Pyx_PyInt_From_int(X264_LOG_INFO); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 433, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_INFO, __pyx_t_7) < 0) __PYX_ERR(0, 430, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
434: #getting segfaults with "DEBUG" level logging...
435: #so this is currently disabled
436: #"DEBUG" : X264_LOG_DEBUG,
+437: }.get(LOGGING.upper(), X264_LOG_WARNING)
__pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_LOGGING); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 437, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_upper); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 437, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 437, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyInt_From_int(X264_LOG_WARNING); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 437, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = __Pyx_PyDict_GetItemDefault(__pyx_t_4, __pyx_t_7, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 437, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_LOG_LEVEL, __pyx_t_5) < 0) __PYX_ERR(0, 429, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
438:
439:
440: #the static logging function we want x264 to use:
+441: cdef void X264_log(void *p_unused, int level, const char *psz_fmt, va_list arg) with gil:
static void __pyx_f_4xpra_6codecs_8enc_x264_7encoder_X264_log(CYTHON_UNUSED void *__pyx_v_p_unused, int __pyx_v_level, char const *__pyx_v_psz_fmt, va_list __pyx_v_arg) { char __pyx_v_buffer[0x100]; int __pyx_v_r; PyObject *__pyx_v_s = NULL; PyObject *__pyx_v_logger = NULL; #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("X264_log", 0); /* … */ /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_9); __Pyx_WriteUnraisable("xpra.codecs.enc_x264.encoder.X264_log", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_L0:; __Pyx_XDECREF(__pyx_v_s); __Pyx_XDECREF(__pyx_v_logger); __Pyx_RefNannyFinishContext(); #ifdef WITH_THREAD __Pyx_PyGILState_Release(__pyx_gilstate_save); #endif }
442: cdef char buffer[256]
443: cdef int r
+444: r = vsnprintf(buffer, 256, psz_fmt, arg)
__pyx_v_r = vsnprintf(__pyx_v_buffer, 0x100, __pyx_v_psz_fmt, __pyx_v_arg);
+445: if r<0:
__pyx_t_1 = ((__pyx_v_r < 0) != 0); if (__pyx_t_1) { /* … */ }
+446: log.error("X264_log: vsnprintf returned %s on format string '%s'", r, psz_fmt)
__pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 446, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_error); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 446, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_r); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 446, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_psz_fmt); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 446, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = NULL; __pyx_t_7 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_6)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); __pyx_t_7 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_4)) { PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_kp_s_X264_log_vsnprintf_returned_s_on, __pyx_t_3, __pyx_t_5}; __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 446, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_kp_s_X264_log_vsnprintf_returned_s_on, __pyx_t_3, __pyx_t_5}; __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 446, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } else #endif { __pyx_t_8 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 446, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); if (__pyx_t_6) { __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL; } __Pyx_INCREF(__pyx_kp_s_X264_log_vsnprintf_returned_s_on); __Pyx_GIVEREF(__pyx_kp_s_X264_log_vsnprintf_returned_s_on); PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_kp_s_X264_log_vsnprintf_returned_s_on); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 2+__pyx_t_7, __pyx_t_5); __pyx_t_3 = 0; __pyx_t_5 = 0; __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 446, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+447: return
goto __pyx_L0;
+448: s = nonl(bytestostr(buffer[:r]).rstrip("\n\r"))
__pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_nonl); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 448, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_bytestostr); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 448, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = __Pyx_PyBytes_FromStringAndSize(((const char*)__pyx_v_buffer) + 0, __pyx_v_r - 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 448, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_6 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_6)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); } } if (!__pyx_t_6) { __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 448, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_8); } else { #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_5)) { PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_3}; __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 448, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_3}; __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 448, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else #endif { __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 448, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_6); __pyx_t_6 = NULL; __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_t_3); __pyx_t_3 = 0; __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 448, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } } __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_rstrip); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 448, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 448, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); } } if (!__pyx_t_5) { __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 448, __pyx_L1_error) __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_GOTREF(__pyx_t_2); } else { #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_4)) { PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_8}; __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 448, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_8}; __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 448, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } else #endif { __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 448, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_5); __pyx_t_5 = NULL; __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_t_8); __pyx_t_8 = 0; __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 448, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_v_s = __pyx_t_2; __pyx_t_2 = 0; /* … */ __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s__3); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 448, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__4); __Pyx_GIVEREF(__pyx_tuple__4);
+449: logger = LOGGERS.get(level, log.info)
__pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_LOGGERS); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 449, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_get); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 449, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_level); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 449, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 449, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_info); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 449, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_8 = NULL; __pyx_t_7 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) { __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_9); if (likely(__pyx_t_8)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); __Pyx_INCREF(__pyx_t_8); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_9, function); __pyx_t_7 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_9)) { PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_t_4, __pyx_t_5}; __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 449, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) { PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_t_4, __pyx_t_5}; __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 449, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } else #endif { __pyx_t_3 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 449, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (__pyx_t_8) { __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_8); __pyx_t_8 = NULL; } __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_7, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_7, __pyx_t_5); __pyx_t_4 = 0; __pyx_t_5 = 0; __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 449, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_v_logger = __pyx_t_2; __pyx_t_2 = 0;
+450: logger("X264: %s", s)
__Pyx_INCREF(__pyx_v_logger); __pyx_t_9 = __pyx_v_logger; __pyx_t_3 = NULL; __pyx_t_7 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_9); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_9, function); __pyx_t_7 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_9)) { PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_kp_s_X264_s, __pyx_v_s}; __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 450, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_2); } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) { PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_kp_s_X264_s, __pyx_v_s}; __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 450, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_2); } else #endif { __pyx_t_5 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 450, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); if (__pyx_t_3) { __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL; } __Pyx_INCREF(__pyx_kp_s_X264_s); __Pyx_GIVEREF(__pyx_kp_s_X264_s); PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_7, __pyx_kp_s_X264_s); __Pyx_INCREF(__pyx_v_s); __Pyx_GIVEREF(__pyx_v_s); PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_7, __pyx_v_s); __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 450, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
451:
452:
+453: cdef class Encoder:
struct __pyx_obj_4xpra_6codecs_8enc_x264_7encoder_Encoder { PyObject_HEAD struct __pyx_vtabstruct_4xpra_6codecs_8enc_x264_7encoder_Encoder *__pyx_vtab; unsigned long frames; x264_t *context; int width; int height; PyObject *src_format; PyObject *source; PyObject *profile; PyObject *tune; double time; int colorspace; int preset; int quality; int speed; int b_frames; int delayed_frames; int export_nals; unsigned PY_LONG_LONG bytes_in; unsigned PY_LONG_LONG bytes_out; PyObject *last_frame_times; PyObject *file; PyObject *frame_types; uint64_t first_frame_timestamp; PyObject *__weakref__; }; /* … */ struct __pyx_vtabstruct_4xpra_6codecs_8enc_x264_7encoder_Encoder { PyObject *(*init_encoder)(struct __pyx_obj_4xpra_6codecs_8enc_x264_7encoder_Encoder *, struct __pyx_opt_args_4xpra_6codecs_8enc_x264_7encoder_7Encoder_init_encoder *__pyx_optional_args); PyObject *(*tune_param)(struct __pyx_obj_4xpra_6codecs_8enc_x264_7encoder_Encoder *, x264_param_t *); PyObject *(*_get_profile)(struct __pyx_obj_4xpra_6codecs_8enc_x264_7encoder_Encoder *, PyObject *, PyObject *); PyObject *(*do_compress_image)(struct __pyx_obj_4xpra_6codecs_8enc_x264_7encoder_Encoder *, x264_picture_t *, struct __pyx_opt_args_4xpra_6codecs_8enc_x264_7encoder_7Encoder_do_compress_image *__pyx_optional_args); PyObject *(*do_reconfig_tune)(struct __pyx_obj_4xpra_6codecs_8enc_x264_7encoder_Encoder *, x264_param_t *); }; static struct __pyx_vtabstruct_4xpra_6codecs_8enc_x264_7encoder_Encoder *__pyx_vtabptr_4xpra_6codecs_8enc_x264_7encoder_Encoder;
454: cdef unsigned long frames
455: cdef x264_t *context
456: cdef int width
457: cdef int height
458: #cdef int opencl
459: cdef object src_format
460: cdef object source
461: cdef object profile
462: cdef object tune
463: cdef double time
464: cdef int colorspace
465: cdef int preset
466: cdef int quality
467: cdef int speed
468: cdef int b_frames
469: cdef int delayed_frames
470: cdef int export_nals
471: cdef unsigned long long bytes_in
472: cdef unsigned long long bytes_out
473: cdef object last_frame_times
474: cdef object file
475: cdef object frame_types
476: cdef uint64_t first_frame_timestamp
477:
478: cdef object __weakref__
479:
+480: def init_context(self, int width, int height, src_format, dst_formats, encoding, int quality, int speed, scaling, options={}):
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_8enc_x264_7encoder_7Encoder_1init_context(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyObject *__pyx_pw_4xpra_6codecs_8enc_x264_7encoder_7Encoder_1init_context(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { int __pyx_v_width; int __pyx_v_height; PyObject *__pyx_v_src_format = 0; CYTHON_UNUSED PyObject *__pyx_v_dst_formats = 0; PyObject *__pyx_v_encoding = 0; int __pyx_v_quality; int __pyx_v_speed; PyObject *__pyx_v_scaling = 0; PyObject *__pyx_v_options = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("init_context (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_width,&__pyx_n_s_height,&__pyx_n_s_src_format,&__pyx_n_s_dst_formats,&__pyx_n_s_encoding,&__pyx_n_s_quality,&__pyx_n_s_speed,&__pyx_n_s_scaling,&__pyx_n_s_options,0}; PyObject* values[9] = {0,0,0,0,0,0,0,0,0}; values[8] = __pyx_k__5; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); CYTHON_FALLTHROUGH; case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); CYTHON_FALLTHROUGH; case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); CYTHON_FALLTHROUGH; case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); CYTHON_FALLTHROUGH; case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); CYTHON_FALLTHROUGH; case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); CYTHON_FALLTHROUGH; case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_width)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_height)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("init_context", 0, 8, 9, 1); __PYX_ERR(0, 480, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_src_format)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("init_context", 0, 8, 9, 2); __PYX_ERR(0, 480, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dst_formats)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("init_context", 0, 8, 9, 3); __PYX_ERR(0, 480, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_encoding)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("init_context", 0, 8, 9, 4); __PYX_ERR(0, 480, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 5: if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_quality)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("init_context", 0, 8, 9, 5); __PYX_ERR(0, 480, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 6: if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_speed)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("init_context", 0, 8, 9, 6); __PYX_ERR(0, 480, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 7: if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_scaling)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("init_context", 0, 8, 9, 7); __PYX_ERR(0, 480, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 8: if (kw_args > 0) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options); if (value) { values[8] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "init_context") < 0)) __PYX_ERR(0, 480, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); CYTHON_FALLTHROUGH; case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); values[6] = PyTuple_GET_ITEM(__pyx_args, 6); values[5] = PyTuple_GET_ITEM(__pyx_args, 5); values[4] = PyTuple_GET_ITEM(__pyx_args, 4); values[3] = PyTuple_GET_ITEM(__pyx_args, 3); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[0] = PyTuple_GET_ITEM(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_width = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_width == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 480, __pyx_L3_error) __pyx_v_height = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_height == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 480, __pyx_L3_error) __pyx_v_src_format = values[2]; __pyx_v_dst_formats = values[3]; __pyx_v_encoding = values[4]; __pyx_v_quality = __Pyx_PyInt_As_int(values[5]); if (unlikely((__pyx_v_quality == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 480, __pyx_L3_error) __pyx_v_speed = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_speed == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 480, __pyx_L3_error) __pyx_v_scaling = values[7]; __pyx_v_options = values[8]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("init_context", 0, 8, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 480, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("xpra.codecs.enc_x264.encoder.Encoder.init_context", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_4xpra_6codecs_8enc_x264_7encoder_7Encoder_init_context(((struct __pyx_obj_4xpra_6codecs_8enc_x264_7encoder_Encoder *)__pyx_v_self), __pyx_v_width, __pyx_v_height, __pyx_v_src_format, __pyx_v_dst_formats, __pyx_v_encoding, __pyx_v_quality, __pyx_v_speed, __pyx_v_scaling, __pyx_v_options); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_8enc_x264_7encoder_7Encoder_init_context(struct __pyx_obj_4xpra_6codecs_8enc_x264_7encoder_Encoder *__pyx_v_self, int __pyx_v_width, int __pyx_v_height, PyObject *__pyx_v_src_format, CYTHON_UNUSED PyObject *__pyx_v_dst_formats, PyObject *__pyx_v_encoding, int __pyx_v_quality, int __pyx_v_speed, PyObject *__pyx_v_scaling, PyObject *__pyx_v_options) { PyObject *__pyx_v_cs_info = NULL; PyObject *__pyx_v_gen = NULL; PyObject *__pyx_v_filename = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("init_context", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_9); __Pyx_AddTraceback("xpra.codecs.enc_x264.encoder.Encoder.init_context", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_cs_info); __Pyx_XDECREF(__pyx_v_gen); __Pyx_XDECREF(__pyx_v_filename); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_t_5 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 480, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_k__5 = __pyx_t_5; __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = 0;
481: global COLORSPACE_FORMATS, generation
+482: cs_info = COLORSPACE_FORMATS.get(src_format)
__pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_COLORSPACE_FORMATS); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 482, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_get); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 482, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_2)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } if (!__pyx_t_2) { __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_src_format); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 482, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); } else { #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_v_src_format}; __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 482, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_GOTREF(__pyx_t_1); } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[2] = {__pyx_t_2, __pyx_v_src_format}; __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 482, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_GOTREF(__pyx_t_1); } else #endif { __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 482, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL; __Pyx_INCREF(__pyx_v_src_format); __Pyx_GIVEREF(__pyx_v_src_format); PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_src_format); __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 482, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_cs_info = __pyx_t_1; __pyx_t_1 = 0;
+483: assert cs_info is not None, "invalid source format: %s, must be one of: %s" % (src_format, COLORSPACE_FORMATS.keys())
#ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { __pyx_t_5 = (__pyx_v_cs_info != Py_None); if (unlikely(!(__pyx_t_5 != 0))) { __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_COLORSPACE_FORMATS); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 483, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_keys); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 483, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); } } if (__pyx_t_3) { __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 483, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else { __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 483, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 483, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_v_src_format); __Pyx_GIVEREF(__pyx_v_src_format); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_src_format); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_invalid_source_format_s_must_be, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 483, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; PyErr_SetObject(PyExc_AssertionError, __pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 483, __pyx_L1_error) } } #endif
+484: assert encoding=="h264", "invalid encoding: %s" % encoding
#ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_v_encoding, __pyx_n_s_h264, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 484, __pyx_L1_error) if (unlikely(!__pyx_t_5)) { __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_invalid_encoding_s, __pyx_v_encoding); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 484, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); PyErr_SetObject(PyExc_AssertionError, __pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __PYX_ERR(0, 484, __pyx_L1_error) } } #endif
+485: assert scaling==(1,1), "x264 does not handle scaling"
#ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { __pyx_t_1 = PyObject_RichCompare(__pyx_v_scaling, __pyx_tuple__6, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 485, __pyx_L1_error) __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 485, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(!__pyx_t_5)) { PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_x264_does_not_handle_scaling); __PYX_ERR(0, 485, __pyx_L1_error) } } #endif /* … */ __pyx_tuple__6 = PyTuple_Pack(2, __pyx_int_1, __pyx_int_1); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 485, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__6); __Pyx_GIVEREF(__pyx_tuple__6);
+486: self.width = width
__pyx_v_self->width = __pyx_v_width;
+487: self.height = height
__pyx_v_self->height = __pyx_v_height;
+488: self.quality = quality
__pyx_v_self->quality = __pyx_v_quality;
+489: self.speed = speed
__pyx_v_self->speed = __pyx_v_speed;
490: #self.opencl = USE_OPENCL and width>=32 and height>=32
+491: self.preset = get_preset_for_speed(speed)
__pyx_v_self->preset = __pyx_f_4xpra_6codecs_8enc_x264_7encoder_get_preset_for_speed(__pyx_v_speed);
+492: self.src_format = src_format
__Pyx_INCREF(__pyx_v_src_format); __Pyx_GIVEREF(__pyx_v_src_format); __Pyx_GOTREF(__pyx_v_self->src_format); __Pyx_DECREF(__pyx_v_self->src_format); __pyx_v_self->src_format = __pyx_v_src_format;
+493: self.colorspace = cs_info[0]
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_cs_info, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 493, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 493, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->colorspace = __pyx_t_6;
+494: self.source = options.get("source", "unknown") #ie: "video"
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_get); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 494, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 494, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_GIVEREF(__pyx_t_4); __Pyx_GOTREF(__pyx_v_self->source); __Pyx_DECREF(__pyx_v_self->source); __pyx_v_self->source = __pyx_t_4; __pyx_t_4 = 0; /* … */ __pyx_tuple__7 = PyTuple_Pack(2, __pyx_n_s_source, __pyx_n_s_unknown); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 494, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__7); __Pyx_GIVEREF(__pyx_tuple__7);
+495: self.b_frames = options.get("b-frames", 0)
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_get); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 495, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 495, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 495, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->b_frames = __pyx_t_6; /* … */ __pyx_tuple__8 = PyTuple_Pack(2, __pyx_kp_s_b_frames, __pyx_int_0); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 495, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__8); __Pyx_GIVEREF(__pyx_tuple__8);
+496: self.frames = 0
__pyx_v_self->frames = 0;
+497: self.frame_types = {}
__pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 497, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->frame_types); __Pyx_DECREF(__pyx_v_self->frame_types); __pyx_v_self->frame_types = __pyx_t_1; __pyx_t_1 = 0;
+498: self.last_frame_times = deque(maxlen=200)
__pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_deque); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 498, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 498, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_maxlen, __pyx_int_200) < 0) __PYX_ERR(0, 498, __pyx_L1_error) __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 498, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GIVEREF(__pyx_t_3); __Pyx_GOTREF(__pyx_v_self->last_frame_times); __Pyx_DECREF(__pyx_v_self->last_frame_times); __pyx_v_self->last_frame_times = __pyx_t_3; __pyx_t_3 = 0;
+499: self.time = 0
__pyx_v_self->time = 0.0;
+500: self.first_frame_timestamp = 0
__pyx_v_self->first_frame_timestamp = 0;
+501: self.profile = self._get_profile(options, self.src_format)
__pyx_t_3 = __pyx_v_self->src_format; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = ((struct __pyx_vtabstruct_4xpra_6codecs_8enc_x264_7encoder_Encoder *)__pyx_v_self->__pyx_vtab)->_get_profile(__pyx_v_self, __pyx_v_options, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 501, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GIVEREF(__pyx_t_4); __Pyx_GOTREF(__pyx_v_self->profile); __Pyx_DECREF(__pyx_v_self->profile); __pyx_v_self->profile = __pyx_t_4; __pyx_t_4 = 0;
+502: self.export_nals = typedict(options).intget("h264.export-nals", 0)
__pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_typedict); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 502, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_1)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } if (!__pyx_t_1) { __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_options); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 502, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); } else { #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_v_options}; __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 502, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_GOTREF(__pyx_t_4); } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_v_options}; __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 502, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_GOTREF(__pyx_t_4); } else #endif { __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 502, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __pyx_t_1 = NULL; __Pyx_INCREF(__pyx_v_options); __Pyx_GIVEREF(__pyx_v_options); PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_v_options); __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 502, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_intget); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 502, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 502, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_4); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 502, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_v_self->export_nals = __pyx_t_6; /* … */ __pyx_tuple__9 = PyTuple_Pack(2, __pyx_kp_s_h264_export_nals, __pyx_int_0); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 502, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__9); __Pyx_GIVEREF(__pyx_tuple__9);
+503: if self.profile is not None and self.profile not in cs_info[2]:
__pyx_t_7 = (__pyx_v_self->profile != Py_None); __pyx_t_8 = (__pyx_t_7 != 0); if (__pyx_t_8) { } else { __pyx_t_5 = __pyx_t_8; goto __pyx_L4_bool_binop_done; } __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_cs_info, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 503, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_8 = (__Pyx_PySequence_ContainsTF(__pyx_v_self->profile, __pyx_t_4, Py_NE)); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 503, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_7 = (__pyx_t_8 != 0); __pyx_t_5 = __pyx_t_7; __pyx_L4_bool_binop_done:; if (__pyx_t_5) { /* … */ }
+504: log.warn("invalid profile specified for %s: %s (must be one of: %s)" % (src_format, self.profile, cs_info[2]))
__pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 504, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_warn); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 504, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_cs_info, 2, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 504, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 504, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_src_format); __Pyx_GIVEREF(__pyx_v_src_format); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_src_format); __Pyx_INCREF(__pyx_v_self->profile); __Pyx_GIVEREF(__pyx_v_self->profile); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_self->profile); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_invalid_profile_specified_for_s, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 504, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_1)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_1); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } if (!__pyx_t_1) { __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 504, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_4); } else { #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_3}; __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 504, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[2] = {__pyx_t_1, __pyx_t_3}; __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 504, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else #endif { __pyx_t_9 = PyTuple_New(1+1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 504, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_1); __pyx_t_1 = NULL; __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_9, 0+1, __pyx_t_3); __pyx_t_3 = 0; __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_9, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 504, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+505: self.profile = None
__Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GOTREF(__pyx_v_self->profile); __Pyx_DECREF(__pyx_v_self->profile); __pyx_v_self->profile = Py_None;
+506: if self.profile is None:
__pyx_t_5 = (__pyx_v_self->profile == Py_None); __pyx_t_7 = (__pyx_t_5 != 0); if (__pyx_t_7) { /* … */ }
+507: self.profile = cs_info[1]
__pyx_t_4 = __Pyx_GetItemInt(__pyx_v_cs_info, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 507, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __Pyx_GOTREF(__pyx_v_self->profile); __Pyx_DECREF(__pyx_v_self->profile); __pyx_v_self->profile = __pyx_t_4; __pyx_t_4 = 0;
+508: log("using default profile=%s", self.profile)
__pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 508, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_9 = NULL; __pyx_t_6 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_9)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_9); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_6 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_kp_s_using_default_profile_s, __pyx_v_self->profile}; __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 508, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_GOTREF(__pyx_t_4); } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_9, __pyx_kp_s_using_default_profile_s, __pyx_v_self->profile}; __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 508, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_GOTREF(__pyx_t_4); } else #endif { __pyx_t_3 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 508, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (__pyx_t_9) { __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_9); __pyx_t_9 = NULL; } __Pyx_INCREF(__pyx_kp_s_using_default_profile_s); __Pyx_GIVEREF(__pyx_kp_s_using_default_profile_s); PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_6, __pyx_kp_s_using_default_profile_s); __Pyx_INCREF(__pyx_v_self->profile); __Pyx_GIVEREF(__pyx_v_self->profile); PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_6, __pyx_v_self->profile); __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 508, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+509: self.init_encoder(options)
__pyx_t_10.__pyx_n = 1; __pyx_t_10.options_dict = __pyx_v_options; __pyx_t_4 = ((struct __pyx_vtabstruct_4xpra_6codecs_8enc_x264_7encoder_Encoder *)__pyx_v_self->__pyx_vtab)->init_encoder(__pyx_v_self, &__pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 509, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+510: gen = generation.increase()
__pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_generation); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 510, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_increase); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 510, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_2)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } if (__pyx_t_2) { __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 510, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else { __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 510, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_gen = __pyx_t_4; __pyx_t_4 = 0;
+511: if SAVE_TO_FILE is not None:
__pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_SAVE_TO_FILE); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 511, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_7 = (__pyx_t_4 != Py_None); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_5 = (__pyx_t_7 != 0); if (__pyx_t_5) { /* … */ }
+512: filename = SAVE_TO_FILE+"x264-"+str(gen)+".%s" % encoding
__pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_SAVE_TO_FILE); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 512, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyNumber_Add(__pyx_t_4, __pyx_kp_s_x264_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 512, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyString_Type)), __pyx_v_gen); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 512, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_2 = PyNumber_Add(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 512, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_s, __pyx_v_encoding); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 512, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 512, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_v_filename = __pyx_t_3; __pyx_t_3 = 0;
+513: self.file = open(filename, 'wb')
__pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 513, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_filename); __Pyx_GIVEREF(__pyx_v_filename); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_filename); __Pyx_INCREF(__pyx_n_s_wb); __Pyx_GIVEREF(__pyx_n_s_wb); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_n_s_wb); __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 513, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GIVEREF(__pyx_t_4); __Pyx_GOTREF(__pyx_v_self->file); __Pyx_DECREF(__pyx_v_self->file); __pyx_v_self->file = __pyx_t_4; __pyx_t_4 = 0;
+514: log.info("saving %s stream to %s", encoding, filename)
__pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 514, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_info); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 514, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; __pyx_t_6 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_6 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_kp_s_saving_s_stream_to_s, __pyx_v_encoding, __pyx_v_filename}; __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 514, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_4); } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_kp_s_saving_s_stream_to_s, __pyx_v_encoding, __pyx_v_filename}; __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 3+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 514, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_4); } else #endif { __pyx_t_9 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 514, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); if (__pyx_t_3) { __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_3); __pyx_t_3 = NULL; } __Pyx_INCREF(__pyx_kp_s_saving_s_stream_to_s); __Pyx_GIVEREF(__pyx_kp_s_saving_s_stream_to_s); PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_6, __pyx_kp_s_saving_s_stream_to_s); __Pyx_INCREF(__pyx_v_encoding); __Pyx_GIVEREF(__pyx_v_encoding); PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_6, __pyx_v_encoding); __Pyx_INCREF(__pyx_v_filename); __Pyx_GIVEREF(__pyx_v_filename); PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_6, __pyx_v_filename); __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_9, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 514, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
515:
+516: def get_tune(self):
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_8enc_x264_7encoder_7Encoder_3get_tune(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw_4xpra_6codecs_8enc_x264_7encoder_7Encoder_3get_tune(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_tune (wrapper)", 0); __pyx_r = __pyx_pf_4xpra_6codecs_8enc_x264_7encoder_7Encoder_2get_tune(((struct __pyx_obj_4xpra_6codecs_8enc_x264_7encoder_Encoder *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_8enc_x264_7encoder_7Encoder_2get_tune(struct __pyx_obj_4xpra_6codecs_8enc_x264_7encoder_Encoder *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_tune", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("xpra.codecs.enc_x264.encoder.Encoder.get_tune", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+517: if TUNE:
__pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_TUNE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 517, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 517, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { /* … */ }
+518: return TUNE
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_TUNE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 518, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
+519: if self.source=="video":
__pyx_t_2 = (__Pyx_PyString_Equals(__pyx_v_self->source, __pyx_n_s_video, Py_EQ)); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 519, __pyx_L1_error) if (__pyx_t_2) { /* … */ }
+520: return b"film"
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_n_b_film); __pyx_r = __pyx_n_b_film; goto __pyx_L0;
521: #return "animation"
+522: return b"zerolatency"
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_n_b_zerolatency); __pyx_r = __pyx_n_b_zerolatency; goto __pyx_L0;
523:
+524: cdef init_encoder(self, options_dict={}):
static PyObject *__pyx_f_4xpra_6codecs_8enc_x264_7encoder_7Encoder_init_encoder(struct __pyx_obj_4xpra_6codecs_8enc_x264_7encoder_Encoder *__pyx_v_self, struct __pyx_opt_args_4xpra_6codecs_8enc_x264_7encoder_7Encoder_init_encoder *__pyx_optional_args) { PyObject *__pyx_v_options_dict = __pyx_k__10; x264_param_t __pyx_v_param; char const *__pyx_v_preset; PyObject *__pyx_v_options = NULL; int __pyx_v_maxd; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("init_encoder", 0); if (__pyx_optional_args) { if (__pyx_optional_args->__pyx_n > 0) { __pyx_v_options_dict = __pyx_optional_args->options_dict; } } /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_11); __Pyx_XDECREF(__pyx_t_12); __Pyx_XDECREF(__pyx_t_13); __Pyx_XDECREF(__pyx_t_14); __Pyx_XDECREF(__pyx_t_16); __Pyx_XDECREF(__pyx_t_17); __Pyx_XDECREF(__pyx_t_18); __Pyx_AddTraceback("xpra.codecs.enc_x264.encoder.Encoder.init_encoder", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_options); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_t_5 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 524, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_k__10 = __pyx_t_5; __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = 0; /* … */ struct __pyx_opt_args_4xpra_6codecs_8enc_x264_7encoder_7Encoder_init_encoder { int __pyx_n; PyObject *options_dict; };
525: cdef x264_param_t param
526: cdef const char *preset
+527: preset = get_preset_names()[self.preset]
__pyx_v_preset = (__pyx_f_4xpra_6codecs_8enc_x264_7encoder_get_preset_names()[__pyx_v_self->preset]);
+528: self.tune = self.get_tune()
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_tune); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 528, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } if (__pyx_t_3) { __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 528, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else { __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 528, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->tune); __Pyx_DECREF(__pyx_v_self->tune); __pyx_v_self->tune = __pyx_t_1; __pyx_t_1 = 0;
+529: x264_param_default_preset(¶m, strtobytes(preset), strtobytes(self.tune))
__pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_strtobytes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 529, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_preset); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 529, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } if (!__pyx_t_4) { __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 529, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_1); } else { #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3}; __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 529, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_3}; __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 529, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else #endif { __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 529, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL; __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_3); __pyx_t_3 = 0; __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 529, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_6 = __Pyx_PyObject_AsString(__pyx_t_1); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(0, 529, __pyx_L1_error) __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_strtobytes); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 529, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); } } if (!__pyx_t_3) { __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_self->tune); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 529, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } else { #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_5)) { PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_self->tune}; __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 529, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_2); } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_self->tune}; __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 529, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_2); } else #endif { __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 529, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL; __Pyx_INCREF(__pyx_v_self->tune); __Pyx_GIVEREF(__pyx_v_self->tune); PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_self->tune); __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 529, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } } __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = __Pyx_PyObject_AsString(__pyx_t_2); if (unlikely((!__pyx_t_7) && PyErr_Occurred())) __PYX_ERR(0, 529, __pyx_L1_error) (void)(x264_param_default_preset((&__pyx_v_param), __pyx_t_6, __pyx_t_7)); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+530: param.i_width = self.width
__pyx_t_8 = __pyx_v_self->width; __pyx_v_param.i_width = __pyx_t_8;
+531: param.i_height = self.height
__pyx_t_8 = __pyx_v_self->height; __pyx_v_param.i_height = __pyx_t_8;
+532: param.i_csp = self.colorspace
__pyx_t_8 = __pyx_v_self->colorspace; __pyx_v_param.i_csp = __pyx_t_8;
+533: set_f_rf(¶m, get_x264_quality(self.quality, self.profile))
__pyx_t_9 = __Pyx_PyObject_AsWritableString(__pyx_v_self->profile); if (unlikely((!__pyx_t_9) && PyErr_Occurred())) __PYX_ERR(0, 533, __pyx_L1_error) __pyx_t_2 = __pyx_f_4xpra_6codecs_8enc_x264_7encoder_set_f_rf((&__pyx_v_param), __pyx_f_4xpra_6codecs_8enc_x264_7encoder_get_x264_quality(__pyx_v_self->quality, __pyx_t_9)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 533, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+534: self.tune_param(¶m)
__pyx_t_2 = ((struct __pyx_vtabstruct_4xpra_6codecs_8enc_x264_7encoder_Encoder *)__pyx_v_self->__pyx_vtab)->tune_param(__pyx_v_self, (&__pyx_v_param)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 534, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+535: x264_param_apply_profile(¶m, self.profile)
__pyx_t_10 = __Pyx_PyObject_AsString(__pyx_v_self->profile); if (unlikely((!__pyx_t_10) && PyErr_Occurred())) __PYX_ERR(0, 535, __pyx_L1_error) (void)(x264_param_apply_profile((&__pyx_v_param), __pyx_t_10));
+536: param.pf_log = <void *> X264_log
__pyx_v_param.pf_log = ((void *)__pyx_f_4xpra_6codecs_8enc_x264_7encoder_X264_log);
+537: param.i_log_level = LOG_LEVEL
__pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_LOG_LEVEL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 537, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 537, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_param.i_log_level = __pyx_t_8;
538: #client can tune these options:
+539: options = typedict(options_dict)
__pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_typedict); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 539, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_1, function); } } if (!__pyx_t_5) { __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_v_options_dict); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 539, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); } else { #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_1)) { PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_options_dict}; __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 539, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_2); } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_options_dict}; __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 539, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_2); } else #endif { __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 539, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __pyx_t_5 = NULL; __Pyx_INCREF(__pyx_v_options_dict); __Pyx_GIVEREF(__pyx_v_options_dict); PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_options_dict); __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 539, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_options = __pyx_t_2; __pyx_t_2 = 0;
+540: param.b_open_gop =options.boolget("h264.open-gop", param.b_open_gop)
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_boolget); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 540, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_param.b_open_gop); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 540, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = NULL; __pyx_t_8 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_1, function); __pyx_t_8 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_1)) { PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_kp_s_h264_open_gop, __pyx_t_4}; __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 540, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_kp_s_h264_open_gop, __pyx_t_4}; __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 540, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else #endif { __pyx_t_3 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 540, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (__pyx_t_5) { __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __pyx_t_5 = NULL; } __Pyx_INCREF(__pyx_kp_s_h264_open_gop); __Pyx_GIVEREF(__pyx_kp_s_h264_open_gop); PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_8, __pyx_kp_s_h264_open_gop); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_8, __pyx_t_4); __pyx_t_4 = 0; __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 540, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 540, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_param.b_open_gop = __pyx_t_8;
+541: param.b_deblocking_filter = options.boolget("h264.deblocking-filter", param.b_deblocking_filter)
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_boolget); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 541, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_param.b_deblocking_filter); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 541, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; __pyx_t_8 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_1, function); __pyx_t_8 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_1)) { PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_kp_s_h264_deblocking_filter, __pyx_t_3}; __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 541, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_kp_s_h264_deblocking_filter, __pyx_t_3}; __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 541, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else #endif { __pyx_t_5 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 541, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); if (__pyx_t_4) { __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL; } __Pyx_INCREF(__pyx_kp_s_h264_deblocking_filter); __Pyx_GIVEREF(__pyx_kp_s_h264_deblocking_filter); PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_8, __pyx_kp_s_h264_deblocking_filter); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_8, __pyx_t_3); __pyx_t_3 = 0; __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 541, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 541, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_param.b_deblocking_filter = __pyx_t_8;
+542: param.b_bluray_compat = options.boolget("h264.bluray-compat", param.b_bluray_compat)
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_boolget); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 542, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_param.b_bluray_compat); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 542, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = NULL; __pyx_t_8 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_1, function); __pyx_t_8 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_1)) { PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_kp_s_h264_bluray_compat, __pyx_t_5}; __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 542, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_kp_s_h264_bluray_compat, __pyx_t_5}; __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 542, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } else #endif { __pyx_t_4 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 542, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (__pyx_t_3) { __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL; } __Pyx_INCREF(__pyx_kp_s_h264_bluray_compat); __Pyx_GIVEREF(__pyx_kp_s_h264_bluray_compat); PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_8, __pyx_kp_s_h264_bluray_compat); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_8, __pyx_t_5); __pyx_t_5 = 0; __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 542, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 542, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_param.b_bluray_compat = __pyx_t_8;
+543: param.b_cabac = options.boolget("h264.cabac", param.b_cabac)
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_boolget); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 543, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_param.b_cabac); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 543, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = NULL; __pyx_t_8 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_1, function); __pyx_t_8 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_1)) { PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_kp_s_h264_cabac, __pyx_t_4}; __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 543, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_kp_s_h264_cabac, __pyx_t_4}; __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 543, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else #endif { __pyx_t_3 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 543, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (__pyx_t_5) { __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __pyx_t_5 = NULL; } __Pyx_INCREF(__pyx_kp_s_h264_cabac); __Pyx_GIVEREF(__pyx_kp_s_h264_cabac); PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_8, __pyx_kp_s_h264_cabac); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_8, __pyx_t_4); __pyx_t_4 = 0; __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 543, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 543, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_param.b_cabac = __pyx_t_8;
544:
+545: self.context = x264_encoder_open(¶m)
__pyx_v_self->context = x264_encoder_open((&__pyx_v_param));
+546: cdef int maxd = x264_encoder_maximum_delayed_frames(self.context)
__pyx_v_maxd = x264_encoder_maximum_delayed_frames(__pyx_v_self->context);
+547: log("x264 context=%#x, %7s %4ix%-4i quality=%i, speed=%i, source=%s", <uintptr_t> self.context, self.src_format, self.width, self.height, self.quality, self.speed, self.source)
__pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 547, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __Pyx_PyInt_FromSize_t(((uintptr_t)__pyx_v_self->context)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 547, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_self->width); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 547, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_self->height); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 547, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_11 = __Pyx_PyInt_From_int(__pyx_v_self->quality); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 547, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __pyx_t_12 = __Pyx_PyInt_From_int(__pyx_v_self->speed); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 547, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); __pyx_t_13 = NULL; __pyx_t_8 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_1); if (likely(__pyx_t_13)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); __Pyx_INCREF(__pyx_t_13); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_1, function); __pyx_t_8 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_1)) { PyObject *__pyx_temp[9] = {__pyx_t_13, __pyx_kp_s_x264_context_x_7s_4ix_4i_quality, __pyx_t_3, __pyx_v_self->src_format, __pyx_t_4, __pyx_t_5, __pyx_t_11, __pyx_t_12, __pyx_v_self->source}; __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 8+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 547, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { PyObject *__pyx_temp[9] = {__pyx_t_13, __pyx_kp_s_x264_context_x_7s_4ix_4i_quality, __pyx_t_3, __pyx_v_self->src_format, __pyx_t_4, __pyx_t_5, __pyx_t_11, __pyx_t_12, __pyx_v_self->source}; __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 8+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 547, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; } else #endif { __pyx_t_14 = PyTuple_New(8+__pyx_t_8); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 547, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_14); if (__pyx_t_13) { __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_13); __pyx_t_13 = NULL; } __Pyx_INCREF(__pyx_kp_s_x264_context_x_7s_4ix_4i_quality); __Pyx_GIVEREF(__pyx_kp_s_x264_context_x_7s_4ix_4i_quality); PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_8, __pyx_kp_s_x264_context_x_7s_4ix_4i_quality); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_8, __pyx_t_3); __Pyx_INCREF(__pyx_v_self->src_format); __Pyx_GIVEREF(__pyx_v_self->src_format); PyTuple_SET_ITEM(__pyx_t_14, 2+__pyx_t_8, __pyx_v_self->src_format); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_14, 3+__pyx_t_8, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_14, 4+__pyx_t_8, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_14, 5+__pyx_t_8, __pyx_t_11); __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_14, 6+__pyx_t_8, __pyx_t_12); __Pyx_INCREF(__pyx_v_self->source); __Pyx_GIVEREF(__pyx_v_self->source); PyTuple_SET_ITEM(__pyx_t_14, 7+__pyx_t_8, __pyx_v_self->source); __pyx_t_3 = 0; __pyx_t_4 = 0; __pyx_t_5 = 0; __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_14, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 547, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+548: log(" preset=%s, profile=%s, tune=%s", preset, self.profile, self.tune)
__pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 548, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_14 = __Pyx_PyBytes_FromString(__pyx_v_preset); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 548, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_14); __pyx_t_12 = NULL; __pyx_t_8 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_1); if (likely(__pyx_t_12)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); __Pyx_INCREF(__pyx_t_12); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_1, function); __pyx_t_8 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_1)) { PyObject *__pyx_temp[5] = {__pyx_t_12, __pyx_kp_s_preset_s_profile_s_tune_s, __pyx_t_14, __pyx_v_self->profile, __pyx_v_self->tune}; __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 548, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { PyObject *__pyx_temp[5] = {__pyx_t_12, __pyx_kp_s_preset_s_profile_s_tune_s, __pyx_t_14, __pyx_v_self->profile, __pyx_v_self->tune}; __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 548, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; } else #endif { __pyx_t_11 = PyTuple_New(4+__pyx_t_8); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 548, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); if (__pyx_t_12) { __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_12); __pyx_t_12 = NULL; } __Pyx_INCREF(__pyx_kp_s_preset_s_profile_s_tune_s); __Pyx_GIVEREF(__pyx_kp_s_preset_s_profile_s_tune_s); PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_8, __pyx_kp_s_preset_s_profile_s_tune_s); __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_8, __pyx_t_14); __Pyx_INCREF(__pyx_v_self->profile); __Pyx_GIVEREF(__pyx_v_self->profile); PyTuple_SET_ITEM(__pyx_t_11, 2+__pyx_t_8, __pyx_v_self->profile); __Pyx_INCREF(__pyx_v_self->tune); __Pyx_GIVEREF(__pyx_v_self->tune); PyTuple_SET_ITEM(__pyx_t_11, 3+__pyx_t_8, __pyx_v_self->tune); __pyx_t_14 = 0; __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_11, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 548, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+549: log(" me=%s, me_range=%s, mv_range=%s, weighted-pred=%i",
__pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 549, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1);
+550: ME_TYPES.get(param.analyse.i_me_method, param.analyse.i_me_method), param.analyse.i_me_range, param.analyse.i_mv_range, param.analyse.i_weighted_pred)
__pyx_t_14 = __Pyx_GetModuleGlobalName(__pyx_n_s_ME_TYPES); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 550, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_14); __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_get); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 550, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_param.analyse.i_me_method); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 550, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_14); __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_param.analyse.i_me_method); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 550, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = NULL; __pyx_t_8 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_12); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_12, function); __pyx_t_8 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_12)) { PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_14, __pyx_t_5}; __pyx_t_11 = __Pyx_PyFunction_FastCall(__pyx_t_12, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 550, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_12)) { PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_14, __pyx_t_5}; __pyx_t_11 = __Pyx_PyCFunction_FastCall(__pyx_t_12, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 550, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } else #endif { __pyx_t_3 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 550, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (__pyx_t_4) { __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __pyx_t_4 = NULL; } __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_8, __pyx_t_14); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_8, __pyx_t_5); __pyx_t_14 = 0; __pyx_t_5 = 0; __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_3, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 550, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __pyx_t_12 = __Pyx_PyInt_From_int(__pyx_v_param.analyse.i_me_range); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 550, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_param.analyse.i_mv_range); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 550, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_param.analyse.i_weighted_pred); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 550, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_14 = NULL; __pyx_t_8 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { __pyx_t_14 = PyMethod_GET_SELF(__pyx_t_1); if (likely(__pyx_t_14)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); __Pyx_INCREF(__pyx_t_14); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_1, function); __pyx_t_8 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_1)) { PyObject *__pyx_temp[6] = {__pyx_t_14, __pyx_kp_s_me_s_me_range_s_mv_range_s_weig, __pyx_t_11, __pyx_t_12, __pyx_t_3, __pyx_t_5}; __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 5+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 549, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { PyObject *__pyx_temp[6] = {__pyx_t_14, __pyx_kp_s_me_s_me_range_s_mv_range_s_weig, __pyx_t_11, __pyx_t_12, __pyx_t_3, __pyx_t_5}; __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 5+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 549, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } else #endif { __pyx_t_4 = PyTuple_New(5+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 549, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (__pyx_t_14) { __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_14); __pyx_t_14 = NULL; } __Pyx_INCREF(__pyx_kp_s_me_s_me_range_s_mv_range_s_weig); __Pyx_GIVEREF(__pyx_kp_s_me_s_me_range_s_mv_range_s_weig); PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_8, __pyx_kp_s_me_s_me_range_s_mv_range_s_weig); __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_8, __pyx_t_11); __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_4, 2+__pyx_t_8, __pyx_t_12); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 3+__pyx_t_8, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_4, 4+__pyx_t_8, __pyx_t_5); __pyx_t_11 = 0; __pyx_t_12 = 0; __pyx_t_3 = 0; __pyx_t_5 = 0; __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 549, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+551: log(" b-frames=%i, max delayed frames=%i", self.b_frames, maxd)
__pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 551, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_self->b_frames); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 551, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_maxd); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 551, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = NULL; __pyx_t_8 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_1, function); __pyx_t_8 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_1)) { PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_kp_s_b_frames_i_max_delayed_frames_i, __pyx_t_4, __pyx_t_5}; __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 551, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_kp_s_b_frames_i_max_delayed_frames_i, __pyx_t_4, __pyx_t_5}; __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 551, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } else #endif { __pyx_t_12 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 551, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); if (__pyx_t_3) { __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_3); __pyx_t_3 = NULL; } __Pyx_INCREF(__pyx_kp_s_b_frames_i_max_delayed_frames_i); __Pyx_GIVEREF(__pyx_kp_s_b_frames_i_max_delayed_frames_i); PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_8, __pyx_kp_s_b_frames_i_max_delayed_frames_i); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_8, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_12, 2+__pyx_t_8, __pyx_t_5); __pyx_t_4 = 0; __pyx_t_5 = 0; __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_12, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 551, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+552: log(" vfr-input=%s, lookahead=%i, sync-lookahead=%i, mb-tree=%s, bframe-adaptive=%s",
__pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 552, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1);
+553: bool(param.b_vfr_input), param.rc.i_lookahead, param.i_sync_lookahead, bool(param.rc.b_mb_tree), ADAPT_TYPES.get(param.i_bframe_adaptive, param.i_bframe_adaptive))
__pyx_t_12 = __Pyx_PyInt_From_int(__pyx_v_param.b_vfr_input); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 553, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_15 < 0)) __PYX_ERR(0, 553, __pyx_L1_error) __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __pyx_t_12 = __Pyx_PyBool_FromLong((!(!__pyx_t_15))); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 553, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_param.rc.i_lookahead); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 553, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_param.i_sync_lookahead); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 553, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_param.rc.b_mb_tree); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 553, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_15 < 0)) __PYX_ERR(0, 553, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyBool_FromLong((!(!__pyx_t_15))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 553, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_14 = __Pyx_GetModuleGlobalName(__pyx_n_s_ADAPT_TYPES); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 553, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_14); __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s_get); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 553, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_param.i_bframe_adaptive); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 553, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_14); __pyx_t_16 = __Pyx_PyInt_From_int(__pyx_v_param.i_bframe_adaptive); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 553, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_16); __pyx_t_17 = NULL; __pyx_t_8 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_13))) { __pyx_t_17 = PyMethod_GET_SELF(__pyx_t_13); if (likely(__pyx_t_17)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13); __Pyx_INCREF(__pyx_t_17); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_13, function); __pyx_t_8 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_13)) { PyObject *__pyx_temp[3] = {__pyx_t_17, __pyx_t_14, __pyx_t_16}; __pyx_t_11 = __Pyx_PyFunction_FastCall(__pyx_t_13, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 553, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0; __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_13)) { PyObject *__pyx_temp[3] = {__pyx_t_17, __pyx_t_14, __pyx_t_16}; __pyx_t_11 = __Pyx_PyCFunction_FastCall(__pyx_t_13, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 553, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0; __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; } else #endif { __pyx_t_18 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 553, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_18); if (__pyx_t_17) { __Pyx_GIVEREF(__pyx_t_17); PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_17); __pyx_t_17 = NULL; } __Pyx_GIVEREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_18, 0+__pyx_t_8, __pyx_t_14); __Pyx_GIVEREF(__pyx_t_16); PyTuple_SET_ITEM(__pyx_t_18, 1+__pyx_t_8, __pyx_t_16); __pyx_t_14 = 0; __pyx_t_16 = 0; __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_t_18, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 553, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; } __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __pyx_t_13 = NULL; __pyx_t_8 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_1); if (likely(__pyx_t_13)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); __Pyx_INCREF(__pyx_t_13); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_1, function); __pyx_t_8 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_1)) { PyObject *__pyx_temp[7] = {__pyx_t_13, __pyx_kp_s_vfr_input_s_lookahead_i_sync_lo, __pyx_t_12, __pyx_t_5, __pyx_t_4, __pyx_t_3, __pyx_t_11}; __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 6+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 552, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { PyObject *__pyx_temp[7] = {__pyx_t_13, __pyx_kp_s_vfr_input_s_lookahead_i_sync_lo, __pyx_t_12, __pyx_t_5, __pyx_t_4, __pyx_t_3, __pyx_t_11}; __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 6+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 552, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; } else #endif { __pyx_t_18 = PyTuple_New(6+__pyx_t_8); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 552, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_18); if (__pyx_t_13) { __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_13); __pyx_t_13 = NULL; } __Pyx_INCREF(__pyx_kp_s_vfr_input_s_lookahead_i_sync_lo); __Pyx_GIVEREF(__pyx_kp_s_vfr_input_s_lookahead_i_sync_lo); PyTuple_SET_ITEM(__pyx_t_18, 0+__pyx_t_8, __pyx_kp_s_vfr_input_s_lookahead_i_sync_lo); __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_18, 1+__pyx_t_8, __pyx_t_12); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_18, 2+__pyx_t_8, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_18, 3+__pyx_t_8, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_18, 4+__pyx_t_8, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_18, 5+__pyx_t_8, __pyx_t_11); __pyx_t_12 = 0; __pyx_t_5 = 0; __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_11 = 0; __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_18, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 552, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+554: log(" open-gop=%s, bluray-compat=%s, cabac=%s, deblocking-filter=%s", bool(param.b_open_gop), bool(param.b_bluray_compat), bool(param.b_cabac), bool(param.b_deblocking_filter))
__pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 554, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_18 = __Pyx_PyInt_From_int(__pyx_v_param.b_open_gop); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 554, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_18); __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_18); if (unlikely(__pyx_t_15 < 0)) __PYX_ERR(0, 554, __pyx_L1_error) __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; __pyx_t_18 = __Pyx_PyBool_FromLong((!(!__pyx_t_15))); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 554, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_18); __pyx_t_11 = __Pyx_PyInt_From_int(__pyx_v_param.b_bluray_compat); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 554, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_11); if (unlikely(__pyx_t_15 < 0)) __PYX_ERR(0, 554, __pyx_L1_error) __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __pyx_t_11 = __Pyx_PyBool_FromLong((!(!__pyx_t_15))); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 554, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_param.b_cabac); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 554, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_15 < 0)) __PYX_ERR(0, 554, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyBool_FromLong((!(!__pyx_t_15))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 554, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_param.b_deblocking_filter); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 554, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_15 < 0)) __PYX_ERR(0, 554, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = __Pyx_PyBool_FromLong((!(!__pyx_t_15))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 554, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = NULL; __pyx_t_8 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_1); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_1, function); __pyx_t_8 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_1)) { PyObject *__pyx_temp[6] = {__pyx_t_5, __pyx_kp_s_open_gop_s_bluray_compat_s_caba, __pyx_t_18, __pyx_t_11, __pyx_t_3, __pyx_t_4}; __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 5+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 554, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { PyObject *__pyx_temp[6] = {__pyx_t_5, __pyx_kp_s_open_gop_s_bluray_compat_s_caba, __pyx_t_18, __pyx_t_11, __pyx_t_3, __pyx_t_4}; __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 5+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 554, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else #endif { __pyx_t_12 = PyTuple_New(5+__pyx_t_8); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 554, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); if (__pyx_t_5) { __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_5); __pyx_t_5 = NULL; } __Pyx_INCREF(__pyx_kp_s_open_gop_s_bluray_compat_s_caba); __Pyx_GIVEREF(__pyx_kp_s_open_gop_s_bluray_compat_s_caba); PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_8, __pyx_kp_s_open_gop_s_bluray_compat_s_caba); __Pyx_GIVEREF(__pyx_t_18); PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_8, __pyx_t_18); __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_12, 2+__pyx_t_8, __pyx_t_11); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_12, 3+__pyx_t_8, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_12, 4+__pyx_t_8, __pyx_t_4); __pyx_t_18 = 0; __pyx_t_11 = 0; __pyx_t_3 = 0; __pyx_t_4 = 0; __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_12, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 554, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+555: log(" intra-refresh=%s, interlaced=%s, constrained_intra=%s", bool(param.b_intra_refresh), bool(param.b_interlaced), bool(param.b_constrained_intra))
__pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 555, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_12 = __Pyx_PyInt_From_int(__pyx_v_param.b_intra_refresh); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 555, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_15 < 0)) __PYX_ERR(0, 555, __pyx_L1_error) __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __pyx_t_12 = __Pyx_PyBool_FromLong((!(!__pyx_t_15))); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 555, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_param.b_interlaced); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 555, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_15 < 0)) __PYX_ERR(0, 555, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = __Pyx_PyBool_FromLong((!(!__pyx_t_15))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 555, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_param.b_constrained_intra); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 555, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_15 < 0)) __PYX_ERR(0, 555, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyBool_FromLong((!(!__pyx_t_15))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 555, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_11 = NULL; __pyx_t_8 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_1); if (likely(__pyx_t_11)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); __Pyx_INCREF(__pyx_t_11); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_1, function); __pyx_t_8 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_1)) { PyObject *__pyx_temp[5] = {__pyx_t_11, __pyx_kp_s_intra_refresh_s_interlaced_s_co, __pyx_t_12, __pyx_t_4, __pyx_t_3}; __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 555, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { PyObject *__pyx_temp[5] = {__pyx_t_11, __pyx_kp_s_intra_refresh_s_interlaced_s_co, __pyx_t_12, __pyx_t_4, __pyx_t_3}; __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 4+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 555, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else #endif { __pyx_t_18 = PyTuple_New(4+__pyx_t_8); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 555, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_18); if (__pyx_t_11) { __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_11); __pyx_t_11 = NULL; } __Pyx_INCREF(__pyx_kp_s_intra_refresh_s_interlaced_s_co); __Pyx_GIVEREF(__pyx_kp_s_intra_refresh_s_interlaced_s_co); PyTuple_SET_ITEM(__pyx_t_18, 0+__pyx_t_8, __pyx_kp_s_intra_refresh_s_interlaced_s_co); __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_18, 1+__pyx_t_8, __pyx_t_12); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_18, 2+__pyx_t_8, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_18, 3+__pyx_t_8, __pyx_t_3); __pyx_t_12 = 0; __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_18, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 555, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+556: log(" threads=%s, sliced-threads=%s",
__pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 556, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1);
+557: {0 : "auto"}.get(param.i_threads, param.i_threads), bool(param.b_sliced_threads))
__pyx_t_18 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 557, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_18); if (PyDict_SetItem(__pyx_t_18, __pyx_int_0, __pyx_n_s_auto) < 0) __PYX_ERR(0, 557, __pyx_L1_error) __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_param.i_threads); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 557, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_param.i_threads); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 557, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_12 = __Pyx_PyDict_GetItemDefault(__pyx_t_18, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 557, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_param.b_sliced_threads); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 557, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_15 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_15 < 0)) __PYX_ERR(0, 557, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = __Pyx_PyBool_FromLong((!(!__pyx_t_15))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 557, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = NULL; __pyx_t_8 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_1, function); __pyx_t_8 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_1)) { PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_kp_s_threads_s_sliced_threads_s, __pyx_t_12, __pyx_t_4}; __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 556, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { PyObject *__pyx_temp[4] = {__pyx_t_3, __pyx_kp_s_threads_s_sliced_threads_s, __pyx_t_12, __pyx_t_4}; __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 556, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else #endif { __pyx_t_18 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 556, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_18); if (__pyx_t_3) { __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_3); __pyx_t_3 = NULL; } __Pyx_INCREF(__pyx_kp_s_threads_s_sliced_threads_s); __Pyx_GIVEREF(__pyx_kp_s_threads_s_sliced_threads_s); PyTuple_SET_ITEM(__pyx_t_18, 0+__pyx_t_8, __pyx_kp_s_threads_s_sliced_threads_s); __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_18, 1+__pyx_t_8, __pyx_t_12); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_18, 2+__pyx_t_8, __pyx_t_4); __pyx_t_12 = 0; __pyx_t_4 = 0; __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_18, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 556, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+558: assert self.context!=NULL, "context initialization failed for format %s" % self.src_format
#ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { if (unlikely(!((__pyx_v_self->context != NULL) != 0))) { __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_context_initialization_failed_fo, __pyx_v_self->src_format); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 558, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); PyErr_SetObject(PyExc_AssertionError, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 558, __pyx_L1_error) } } #endif
559:
+560: cdef tune_param(self, x264_param_t *param):
static PyObject *__pyx_f_4xpra_6codecs_8enc_x264_7encoder_7Encoder_tune_param(struct __pyx_obj_4xpra_6codecs_8enc_x264_7encoder_Encoder *__pyx_v_self, x264_param_t *__pyx_v_param) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("tune_param", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("xpra.codecs.enc_x264.encoder.Encoder.tune_param", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+561: param.i_threads = THREADS
__pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_THREADS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 561, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 561, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_param->i_threads = __pyx_t_2;
+562: param.b_sliced_threads = SLICED_THREADS
__pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_SLICED_THREADS); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 562, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 562, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_param->b_sliced_threads = __pyx_t_2;
563: #we never lose frames or use seeking, so no need for regular I-frames:
+564: param.i_keyint_max = X264_KEYINT_MAX_INFINITE
__pyx_v_param->i_keyint_max = X264_KEYINT_MAX_INFINITE;
565: #we don't want IDR frames either:
+566: param.i_keyint_min = X264_KEYINT_MAX_INFINITE
__pyx_v_param->i_keyint_min = X264_KEYINT_MAX_INFINITE;
+567: param.b_intra_refresh = 0 #no intra refresh
__pyx_v_param->b_intra_refresh = 0;
+568: param.b_open_gop = 1 #allow open gop
__pyx_v_param->b_open_gop = 1;
569: #param.b_opencl = self.opencl
+570: param.i_bframe = self.b_frames
__pyx_t_2 = __pyx_v_self->b_frames; __pyx_v_param->i_bframe = __pyx_t_2;
+571: param.rc.i_lookahead = min(param.rc.i_lookahead, self.b_frames-1)
__pyx_t_3 = (__pyx_v_self->b_frames - 1); __pyx_t_2 = __pyx_v_param->rc.i_lookahead; if (((__pyx_t_3 < __pyx_t_2) != 0)) { __pyx_t_4 = __pyx_t_3; } else { __pyx_t_4 = __pyx_t_2; } __pyx_v_param->rc.i_lookahead = __pyx_t_4;
+572: param.b_vfr_input = 0
__pyx_v_param->b_vfr_input = 0;
+573: if not self.b_frames:
__pyx_t_5 = ((!(__pyx_v_self->b_frames != 0)) != 0); if (__pyx_t_5) { /* … */ goto __pyx_L3; }
+574: param.i_sync_lookahead = 0
__pyx_v_param->i_sync_lookahead = 0;
+575: param.rc.b_mb_tree = 0
__pyx_v_param->rc.b_mb_tree = 0;
576: else:
+577: if param.i_bframe_adaptive==X264_B_ADAPT_TRELLIS:
/*else*/ { __pyx_t_5 = ((__pyx_v_param->i_bframe_adaptive == X264_B_ADAPT_TRELLIS) != 0); if (__pyx_t_5) { /* … */ } } __pyx_L3:;
+578: param.i_bframe_adaptive = X264_B_ADAPT_FAST
__pyx_v_param->i_bframe_adaptive = X264_B_ADAPT_FAST;
+579: if self.source!="video":
__pyx_t_5 = (__Pyx_PyString_Equals(__pyx_v_self->source, __pyx_n_s_video, Py_NE)); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 579, __pyx_L1_error) if (__pyx_t_5) { /* … */ }
580: #specifically told this is not video,
581: #so use a simple motion search:
+582: param.analyse.i_me_method = X264_ME_DIA
__pyx_v_param->analyse.i_me_method = X264_ME_DIA;
583:
584:
+585: def clean(self): #@DuplicatedSignature
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_8enc_x264_7encoder_7Encoder_5clean(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw_4xpra_6codecs_8enc_x264_7encoder_7Encoder_5clean(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("clean (wrapper)", 0); __pyx_r = __pyx_pf_4xpra_6codecs_8enc_x264_7encoder_7Encoder_4clean(((struct __pyx_obj_4xpra_6codecs_8enc_x264_7encoder_Encoder *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_8enc_x264_7encoder_7Encoder_4clean(struct __pyx_obj_4xpra_6codecs_8enc_x264_7encoder_Encoder *__pyx_v_self) { x264_t *__pyx_v_context; PyObject *__pyx_v_f = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("clean", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("xpra.codecs.enc_x264.encoder.Encoder.clean", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_f); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+586: log("x264 close context %#x", <uintptr_t> self.context)
__pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 586, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyInt_FromSize_t(((uintptr_t)__pyx_v_self->context)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 586, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; __pyx_t_5 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_5 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_kp_s_x264_close_context_x, __pyx_t_3}; __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 586, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_kp_s_x264_close_context_x, __pyx_t_3}; __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_5, 2+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 586, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else #endif { __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 586, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (__pyx_t_4) { __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL; } __Pyx_INCREF(__pyx_kp_s_x264_close_context_x); __Pyx_GIVEREF(__pyx_kp_s_x264_close_context_x); PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_kp_s_x264_close_context_x); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_t_3); __pyx_t_3 = 0; __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 586, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+587: cdef x264_t *context = self.context
__pyx_t_7 = __pyx_v_self->context; __pyx_v_context = __pyx_t_7;
+588: if context!=NULL:
__pyx_t_8 = ((__pyx_v_context != NULL) != 0); if (__pyx_t_8) { /* … */ }
+589: self.context = NULL
__pyx_v_self->context = NULL;
+590: x264_encoder_close(context)
x264_encoder_close(__pyx_v_context);
+591: self.frames = 0
__pyx_v_self->frames = 0;
+592: self.width = 0
__pyx_v_self->width = 0;
+593: self.height = 0
__pyx_v_self->height = 0;
+594: self.src_format = ""
__Pyx_INCREF(__pyx_kp_s__11); __Pyx_GIVEREF(__pyx_kp_s__11); __Pyx_GOTREF(__pyx_v_self->src_format); __Pyx_DECREF(__pyx_v_self->src_format); __pyx_v_self->src_format = __pyx_kp_s__11;
+595: self.source = None
__Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GOTREF(__pyx_v_self->source); __Pyx_DECREF(__pyx_v_self->source); __pyx_v_self->source = Py_None;
+596: self.profile = None
__Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GOTREF(__pyx_v_self->profile); __Pyx_DECREF(__pyx_v_self->profile); __pyx_v_self->profile = Py_None;
+597: self.time = 0
__pyx_v_self->time = 0.0;
+598: self.colorspace = 0
__pyx_v_self->colorspace = 0;
+599: self.preset = 0
__pyx_v_self->preset = 0;
+600: self.quality = 0
__pyx_v_self->quality = 0;
+601: self.speed = 0
__pyx_v_self->speed = 0;
+602: self.bytes_in = 0
__pyx_v_self->bytes_in = 0;
+603: self.bytes_out = 0
__pyx_v_self->bytes_out = 0;
+604: self.last_frame_times = []
__pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 604, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->last_frame_times); __Pyx_DECREF(__pyx_v_self->last_frame_times); __pyx_v_self->last_frame_times = __pyx_t_1; __pyx_t_1 = 0;
+605: self.first_frame_timestamp = 0
__pyx_v_self->first_frame_timestamp = 0;
+606: f = self.file
__pyx_t_1 = __pyx_v_self->file;
__Pyx_INCREF(__pyx_t_1);
__pyx_v_f = __pyx_t_1;
__pyx_t_1 = 0;
+607: if f:
__pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_f); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 607, __pyx_L1_error) if (__pyx_t_8) { /* … */ }
+608: self.file = None
__Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); __Pyx_GOTREF(__pyx_v_self->file); __Pyx_DECREF(__pyx_v_self->file); __pyx_v_self->file = Py_None;
+609: f.close()
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_f, __pyx_n_s_close); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 609, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_6 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_6)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } if (__pyx_t_6) { __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 609, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } else { __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 609, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
610:
611:
+612: def get_info(self): #@DuplicatedSignature
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_8enc_x264_7encoder_7Encoder_7get_info(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw_4xpra_6codecs_8enc_x264_7encoder_7Encoder_7get_info(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_info (wrapper)", 0); __pyx_r = __pyx_pf_4xpra_6codecs_8enc_x264_7encoder_7Encoder_6get_info(((struct __pyx_obj_4xpra_6codecs_8enc_x264_7encoder_Encoder *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_8enc_x264_7encoder_7Encoder_6get_info(struct __pyx_obj_4xpra_6codecs_8enc_x264_7encoder_Encoder *__pyx_v_self) { double __pyx_v_pps; PyObject *__pyx_v_info = NULL; unsigned int __pyx_v_f; double __pyx_v_now; double __pyx_v_last_time; double __pyx_v_cut_off; double __pyx_v_ms_per_frame; PyObject *__pyx_v_start = NULL; PyObject *__pyx_v_end = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_info", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); __Pyx_AddTraceback("xpra.codecs.enc_x264.encoder.Encoder.get_info", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_info); __Pyx_XDECREF(__pyx_v_start); __Pyx_XDECREF(__pyx_v_end); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
613: cdef double pps
+614: if self.profile is None:
__pyx_t_1 = (__pyx_v_self->profile == Py_None); __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { /* … */ }
+615: return {}
__Pyx_XDECREF(__pyx_r); __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 615, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0;
+616: info = get_info()
__pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_get_info); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 616, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); } } if (__pyx_t_5) { __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 616, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } else { __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 616, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_v_info = __pyx_t_3; __pyx_t_3 = 0;
+617: info.update({
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_info, __pyx_n_s_update); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 617, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4);
+618: "profile" : self.profile,
__pyx_t_5 = __Pyx_PyDict_NewPresized(15); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 618, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_profile, __pyx_v_self->profile) < 0) __PYX_ERR(0, 618, __pyx_L1_error)
+619: "preset" : get_preset_names()[self.preset],
__pyx_t_6 = __Pyx_PyBytes_FromString((__pyx_f_4xpra_6codecs_8enc_x264_7encoder_get_preset_names()[__pyx_v_self->preset])); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 619, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_preset, __pyx_t_6) < 0) __PYX_ERR(0, 618, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+620: "b-frames" : self.b_frames,
__pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_self->b_frames); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 620, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem(__pyx_t_5, __pyx_kp_s_b_frames, __pyx_t_6) < 0) __PYX_ERR(0, 618, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+621: "tune" : self.tune or "",
__pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_self->tune); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 621, __pyx_L1_error) if (!__pyx_t_2) { } else { __Pyx_INCREF(__pyx_v_self->tune); __pyx_t_6 = __pyx_v_self->tune; goto __pyx_L4_bool_binop_done; } __Pyx_INCREF(__pyx_kp_s__11); __pyx_t_6 = __pyx_kp_s__11; __pyx_L4_bool_binop_done:; if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_tune, __pyx_t_6) < 0) __PYX_ERR(0, 618, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+622: "frames" : int(self.frames),
__pyx_t_6 = __Pyx_PyInt_From_unsigned_long(__pyx_v_self->frames); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 622, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyInt_Type)), __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 622, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_frames, __pyx_t_7) < 0) __PYX_ERR(0, 618, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+623: "width" : self.width,
__pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_self->width); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 623, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_width, __pyx_t_7) < 0) __PYX_ERR(0, 618, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+624: "height" : self.height,
__pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_self->height); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 624, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_height, __pyx_t_7) < 0) __PYX_ERR(0, 618, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
625: #"opencl" : bool(self.opencl),
+626: "speed" : self.speed,
__pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_self->speed); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 626, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_speed, __pyx_t_7) < 0) __PYX_ERR(0, 618, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+627: "quality" : self.quality,
__pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_self->quality); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 627, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_quality, __pyx_t_7) < 0) __PYX_ERR(0, 618, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+628: "lossless" : self.quality==100,
__pyx_t_7 = __Pyx_PyBool_FromLong((__pyx_v_self->quality == 0x64)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 628, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_lossless, __pyx_t_7) < 0) __PYX_ERR(0, 618, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+629: "src_format" : self.src_format,
if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_src_format, __pyx_v_self->src_format) < 0) __PYX_ERR(0, 618, __pyx_L1_error)
+630: "source" : self.source,
if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_source, __pyx_v_self->source) < 0) __PYX_ERR(0, 618, __pyx_L1_error)
+631: "version" : get_version(),
__pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_get_version); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 631, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_8 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6); if (likely(__pyx_t_8)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); __Pyx_INCREF(__pyx_t_8); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_6, function); } } if (__pyx_t_8) { __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 631, __pyx_L1_error) __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } else { __pyx_t_7 = __Pyx_PyObject_CallNoArg(__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 631, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_version, __pyx_t_7) < 0) __PYX_ERR(0, 618, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
+632: "frame-types" : self.frame_types,
if (PyDict_SetItem(__pyx_t_5, __pyx_kp_s_frame_types, __pyx_v_self->frame_types) < 0) __PYX_ERR(0, 618, __pyx_L1_error)
+633: "delayed" : self.delayed_frames,
__pyx_t_7 = __Pyx_PyInt_From_int(__pyx_v_self->delayed_frames); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 633, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_delayed, __pyx_t_7) < 0) __PYX_ERR(0, 618, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_7)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); } } if (!__pyx_t_7) { __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 617, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_3); } else { #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_4)) { PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_5}; __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 617, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_5}; __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 617, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } else #endif { __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 617, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7); __pyx_t_7 = NULL; __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_5); __pyx_t_5 = 0; __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 617, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
634: })
+635: if self.bytes_in>0 and self.bytes_out>0:
__pyx_t_1 = ((__pyx_v_self->bytes_in > 0) != 0); if (__pyx_t_1) { } else { __pyx_t_2 = __pyx_t_1; goto __pyx_L7_bool_binop_done; } __pyx_t_1 = ((__pyx_v_self->bytes_out > 0) != 0); __pyx_t_2 = __pyx_t_1; __pyx_L7_bool_binop_done:; if (__pyx_t_2) { /* … */ }
+636: info.update({
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_info, __pyx_n_s_update); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 636, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4);
+637: "bytes_in" : self.bytes_in,
__pyx_t_6 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 637, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_5 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_v_self->bytes_in); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 637, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_bytes_in, __pyx_t_5) < 0) __PYX_ERR(0, 637, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+638: "bytes_out" : self.bytes_out,
__pyx_t_5 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_v_self->bytes_out); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 638, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_bytes_out, __pyx_t_5) < 0) __PYX_ERR(0, 637, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+639: "ratio_pct" : int(100.0 * self.bytes_out / self.bytes_in),
__pyx_t_5 = __Pyx_PyInt_FromDouble(((100.0 * __pyx_v_self->bytes_out) / __pyx_v_self->bytes_in)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 639, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_ratio_pct, __pyx_t_5) < 0) __PYX_ERR(0, 637, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); } } if (!__pyx_t_5) { __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 636, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_GOTREF(__pyx_t_3); } else { #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_4)) { PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_6}; __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 636, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_6}; __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 636, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } else #endif { __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 636, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL; __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_6); __pyx_t_6 = 0; __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 636, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
640: })
+641: if self.frames>0 and self.time>0:
__pyx_t_1 = ((__pyx_v_self->frames > 0) != 0); if (__pyx_t_1) { } else { __pyx_t_2 = __pyx_t_1; goto __pyx_L10_bool_binop_done; } __pyx_t_1 = ((__pyx_v_self->time > 0.0) != 0); __pyx_t_2 = __pyx_t_1; __pyx_L10_bool_binop_done:; if (__pyx_t_2) { /* … */ }
+642: pps = float(self.width) * float(self.height) * float(self.frames) / self.time
__pyx_v_pps = (((((double)__pyx_v_self->width) * ((double)__pyx_v_self->height)) * ((double)__pyx_v_self->frames)) / __pyx_v_self->time);
+643: info.update({
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_info, __pyx_n_s_update); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 643, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4);
+644: "total_time_ms" : int(self.time*1000.0),
__pyx_t_7 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 644, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_6 = __Pyx_PyInt_FromDouble((__pyx_v_self->time * 1000.0)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 644, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_total_time_ms, __pyx_t_6) < 0) __PYX_ERR(0, 644, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+645: "pixels_per_second" : int(pps),
__pyx_t_6 = __Pyx_PyInt_FromDouble(__pyx_v_pps); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 645, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_pixels_per_second, __pyx_t_6) < 0) __PYX_ERR(0, 644, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) { __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_6)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); } } if (!__pyx_t_6) { __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_7); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 643, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_GOTREF(__pyx_t_3); } else { #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_4)) { PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_7}; __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 643, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_7}; __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 643, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } else #endif { __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 643, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); __pyx_t_6 = NULL; __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_7); __pyx_t_7 = 0; __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 643, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
646: })
647: #calculate fps:
+648: cdef unsigned int f = 0
__pyx_v_f = 0;
+649: cdef double now = monotonic_time()
__pyx_v_now = __pyx_f_4xpra_14monotonic_time_monotonic_time();
+650: cdef double last_time = now
__pyx_v_last_time = __pyx_v_now;
+651: cdef double cut_off = now-10.0
__pyx_v_cut_off = (__pyx_v_now - 10.0);
+652: cdef double ms_per_frame = 0
__pyx_v_ms_per_frame = 0.0;
+653: for start,end in tuple(self.last_frame_times):
__pyx_t_3 = __Pyx_PySequence_Tuple(__pyx_v_self->last_frame_times); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 653, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; for (;;) { if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_4)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_9); __Pyx_INCREF(__pyx_t_3); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 653, __pyx_L1_error) #else __pyx_t_3 = PySequence_ITEM(__pyx_t_4, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 653, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #endif if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) { PyObject* sequence = __pyx_t_3; Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); __PYX_ERR(0, 653, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { __pyx_t_5 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_7 = PyTuple_GET_ITEM(sequence, 1); } else { __pyx_t_5 = PyList_GET_ITEM(sequence, 0); __pyx_t_7 = PyList_GET_ITEM(sequence, 1); } __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(__pyx_t_7); #else __pyx_t_5 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 653, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 653, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); #endif __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else { Py_ssize_t index = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 653, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_10 = Py_TYPE(__pyx_t_6)->tp_iternext; index = 0; __pyx_t_5 = __pyx_t_10(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L14_unpacking_failed; __Pyx_GOTREF(__pyx_t_5); index = 1; __pyx_t_7 = __pyx_t_10(__pyx_t_6); if (unlikely(!__pyx_t_7)) goto __pyx_L14_unpacking_failed; __Pyx_GOTREF(__pyx_t_7); if (__Pyx_IternextUnpackEndCheck(__pyx_t_10(__pyx_t_6), 2) < 0) __PYX_ERR(0, 653, __pyx_L1_error) __pyx_t_10 = NULL; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; goto __pyx_L15_unpacking_done; __pyx_L14_unpacking_failed:; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_10 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); __PYX_ERR(0, 653, __pyx_L1_error) __pyx_L15_unpacking_done:; } __Pyx_XDECREF_SET(__pyx_v_start, __pyx_t_5); __pyx_t_5 = 0; __Pyx_XDECREF_SET(__pyx_v_end, __pyx_t_7); __pyx_t_7 = 0; /* … */ } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+654: if end>cut_off:
__pyx_t_3 = PyFloat_FromDouble(__pyx_v_cut_off); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 654, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_7 = PyObject_RichCompare(__pyx_v_end, __pyx_t_3, Py_GT); __Pyx_XGOTREF(__pyx_t_7); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 654, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 654, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; if (__pyx_t_2) { /* … */ }
+655: f += 1
__pyx_v_f = (__pyx_v_f + 1);
+656: last_time = min(last_time, end)
__Pyx_INCREF(__pyx_v_end); __pyx_t_7 = __pyx_v_end; __pyx_t_11 = __pyx_v_last_time; __pyx_t_5 = PyFloat_FromDouble(__pyx_t_11); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 656, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = PyObject_RichCompare(__pyx_t_7, __pyx_t_5, Py_LT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 656, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 656, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (__pyx_t_2) { __Pyx_INCREF(__pyx_t_7); __pyx_t_3 = __pyx_t_7; } else { __pyx_t_6 = PyFloat_FromDouble(__pyx_t_11); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 656, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_3 = __pyx_t_6; __pyx_t_6 = 0; } __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_11 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_11 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 656, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_last_time = __pyx_t_11;
+657: ms_per_frame += (end-start)
__pyx_t_3 = PyFloat_FromDouble(__pyx_v_ms_per_frame); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 657, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_7 = PyNumber_Subtract(__pyx_v_end, __pyx_v_start); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 657, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_6 = PyNumber_InPlaceAdd(__pyx_t_3, __pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 657, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_11 = __pyx_PyFloat_AsDouble(__pyx_t_6); if (unlikely((__pyx_t_11 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 657, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_v_ms_per_frame = __pyx_t_11;
+658: if f>0 and last_time<now:
__pyx_t_1 = ((__pyx_v_f > 0) != 0); if (__pyx_t_1) { } else { __pyx_t_2 = __pyx_t_1; goto __pyx_L18_bool_binop_done; } __pyx_t_1 = ((__pyx_v_last_time < __pyx_v_now) != 0); __pyx_t_2 = __pyx_t_1; __pyx_L18_bool_binop_done:; if (__pyx_t_2) { /* … */ }
+659: info.update({
__pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_info, __pyx_n_s_update); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 659, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6);
+660: "fps" : int(0.5+f/(now-last_time)),
__pyx_t_7 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 660, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_3 = __Pyx_PyInt_FromDouble((0.5 + (__pyx_v_f / (__pyx_v_now - __pyx_v_last_time)))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 660, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_fps, __pyx_t_3) < 0) __PYX_ERR(0, 660, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+661: "ms_per_frame" : int(1000.0*ms_per_frame/f),
__pyx_t_3 = __Pyx_PyInt_FromDouble(((1000.0 * __pyx_v_ms_per_frame) / __pyx_v_f)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 661, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_ms_per_frame, __pyx_t_3) < 0) __PYX_ERR(0, 660, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_6); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_6, function); } } if (!__pyx_t_3) { __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 659, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_GOTREF(__pyx_t_4); } else { #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_6)) { PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_7}; __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 659, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_t_7}; __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 659, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } else #endif { __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 659, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL; __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_7); __pyx_t_7 = 0; __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 659, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } } __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
662: })
+663: return info
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_info); __pyx_r = __pyx_v_info; goto __pyx_L0;
664:
+665: def __repr__(self):
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_8enc_x264_7encoder_7Encoder_9__repr__(PyObject *__pyx_v_self); /*proto*/ static PyObject *__pyx_pw_4xpra_6codecs_8enc_x264_7encoder_7Encoder_9__repr__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); __pyx_r = __pyx_pf_4xpra_6codecs_8enc_x264_7encoder_7Encoder_8__repr__(((struct __pyx_obj_4xpra_6codecs_8enc_x264_7encoder_Encoder *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_8enc_x264_7encoder_7Encoder_8__repr__(struct __pyx_obj_4xpra_6codecs_8enc_x264_7encoder_Encoder *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__repr__", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("xpra.codecs.enc_x264.encoder.Encoder.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+666: if self.src_format is None:
__pyx_t_1 = (__pyx_v_self->src_format == Py_None); __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { /* … */ }
+667: return "x264_encoder(uninitialized)"
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_kp_s_x264_encoder_uninitialized); __pyx_r = __pyx_kp_s_x264_encoder_uninitialized; goto __pyx_L0;
+668: return "x264_encoder(%s - %sx%s)" % (self.src_format, self.width, self.height)
__Pyx_XDECREF(__pyx_r); __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_self->width); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 668, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_self->height); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 668, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 668, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_v_self->src_format); __Pyx_GIVEREF(__pyx_v_self->src_format); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_self->src_format); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_4); __pyx_t_3 = 0; __pyx_t_4 = 0; __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_x264_encoder_s_sx_s, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 668, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_r = __pyx_t_4; __pyx_t_4 = 0; goto __pyx_L0;
669:
+670: def is_closed(self):
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_8enc_x264_7encoder_7Encoder_11is_closed(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw_4xpra_6codecs_8enc_x264_7encoder_7Encoder_11is_closed(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("is_closed (wrapper)", 0); __pyx_r = __pyx_pf_4xpra_6codecs_8enc_x264_7encoder_7Encoder_10is_closed(((struct __pyx_obj_4xpra_6codecs_8enc_x264_7encoder_Encoder *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_8enc_x264_7encoder_7Encoder_10is_closed(struct __pyx_obj_4xpra_6codecs_8enc_x264_7encoder_Encoder *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("is_closed", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("xpra.codecs.enc_x264.encoder.Encoder.is_closed", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+671: return self.context==NULL
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyBool_FromLong((__pyx_v_self->context == NULL)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 671, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
672:
+673: def get_encoding(self):
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_8enc_x264_7encoder_7Encoder_13get_encoding(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw_4xpra_6codecs_8enc_x264_7encoder_7Encoder_13get_encoding(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_encoding (wrapper)", 0); __pyx_r = __pyx_pf_4xpra_6codecs_8enc_x264_7encoder_7Encoder_12get_encoding(((struct __pyx_obj_4xpra_6codecs_8enc_x264_7encoder_Encoder *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_8enc_x264_7encoder_7Encoder_12get_encoding(CYTHON_UNUSED struct __pyx_obj_4xpra_6codecs_8enc_x264_7encoder_Encoder *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_encoding", 0); /* … */ /* function exit code */ __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+674: return "h264"
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_n_s_h264); __pyx_r = __pyx_n_s_h264; goto __pyx_L0;
675:
+676: def __dealloc__(self):
/* Python wrapper */ static void __pyx_pw_4xpra_6codecs_8enc_x264_7encoder_7Encoder_15__dealloc__(PyObject *__pyx_v_self); /*proto*/ static void __pyx_pw_4xpra_6codecs_8enc_x264_7encoder_7Encoder_15__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); __pyx_pf_4xpra_6codecs_8enc_x264_7encoder_7Encoder_14__dealloc__(((struct __pyx_obj_4xpra_6codecs_8enc_x264_7encoder_Encoder *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); } static void __pyx_pf_4xpra_6codecs_8enc_x264_7encoder_7Encoder_14__dealloc__(struct __pyx_obj_4xpra_6codecs_8enc_x264_7encoder_Encoder *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); /* … */ /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_WriteUnraisable("xpra.codecs.enc_x264.encoder.Encoder.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_L0:; __Pyx_RefNannyFinishContext(); }
+677: self.clean()
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_clean); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 677, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } if (__pyx_t_3) { __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 677, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else { __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 677, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
678:
+679: def get_width(self):
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_8enc_x264_7encoder_7Encoder_17get_width(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw_4xpra_6codecs_8enc_x264_7encoder_7Encoder_17get_width(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_width (wrapper)", 0); __pyx_r = __pyx_pf_4xpra_6codecs_8enc_x264_7encoder_7Encoder_16get_width(((struct __pyx_obj_4xpra_6codecs_8enc_x264_7encoder_Encoder *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_8enc_x264_7encoder_7Encoder_16get_width(struct __pyx_obj_4xpra_6codecs_8enc_x264_7encoder_Encoder *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_width", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("xpra.codecs.enc_x264.encoder.Encoder.get_width", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+680: return self.width
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->width); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 680, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
681:
+682: def get_height(self):
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_8enc_x264_7encoder_7Encoder_19get_height(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw_4xpra_6codecs_8enc_x264_7encoder_7Encoder_19get_height(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_height (wrapper)", 0); __pyx_r = __pyx_pf_4xpra_6codecs_8enc_x264_7encoder_7Encoder_18get_height(((struct __pyx_obj_4xpra_6codecs_8enc_x264_7encoder_Encoder *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_8enc_x264_7encoder_7Encoder_18get_height(struct __pyx_obj_4xpra_6codecs_8enc_x264_7encoder_Encoder *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_height", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("xpra.codecs.enc_x264.encoder.Encoder.get_height", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+683: return self.height
__Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->height); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 683, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
684:
+685: def get_type(self): #@DuplicatedSignature
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_8enc_x264_7encoder_7Encoder_21get_type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw_4xpra_6codecs_8enc_x264_7encoder_7Encoder_21get_type(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_type (wrapper)", 0); __pyx_r = __pyx_pf_4xpra_6codecs_8enc_x264_7encoder_7Encoder_20get_type(((struct __pyx_obj_4xpra_6codecs_8enc_x264_7encoder_Encoder *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_8enc_x264_7encoder_7Encoder_20get_type(CYTHON_UNUSED struct __pyx_obj_4xpra_6codecs_8enc_x264_7encoder_Encoder *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_type", 0); /* … */ /* function exit code */ __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+686: return "x264"
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_n_s_x264); __pyx_r = __pyx_n_s_x264; goto __pyx_L0;
687:
+688: def get_src_format(self):
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_8enc_x264_7encoder_7Encoder_23get_src_format(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw_4xpra_6codecs_8enc_x264_7encoder_7Encoder_23get_src_format(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_src_format (wrapper)", 0); __pyx_r = __pyx_pf_4xpra_6codecs_8enc_x264_7encoder_7Encoder_22get_src_format(((struct __pyx_obj_4xpra_6codecs_8enc_x264_7encoder_Encoder *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_8enc_x264_7encoder_7Encoder_22get_src_format(struct __pyx_obj_4xpra_6codecs_8enc_x264_7encoder_Encoder *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_src_format", 0); /* … */ /* function exit code */ __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+689: return self.src_format
__Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_self->src_format); __pyx_r = __pyx_v_self->src_format; goto __pyx_L0;
690:
+691: cdef _get_profile(self, options, csc_mode):
static PyObject *__pyx_f_4xpra_6codecs_8enc_x264_7encoder_7Encoder__get_profile(CYTHON_UNUSED struct __pyx_obj_4xpra_6codecs_8enc_x264_7encoder_Encoder *__pyx_v_self, PyObject *__pyx_v_options, PyObject *__pyx_v_csc_mode) { PyObject *__pyx_v_profile = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_get_profile", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("xpra.codecs.enc_x264.encoder.Encoder._get_profile", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_profile); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
692: #use the environment as default if present:
+693: profile = os.environ.get("XPRA_X264_%s_PROFILE" % csc_mode, PROFILE)
__pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_os); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 693, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_environ); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 693, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_get); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 693, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_XPRA_X264__s_PROFILE, __pyx_v_csc_mode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 693, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_PROFILE); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 693, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = NULL; __pyx_t_6 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_6 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_3, __pyx_t_4}; __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 693, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_3, __pyx_t_4}; __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 693, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else #endif { __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 693, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); if (__pyx_t_5) { __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL; } __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_4); __pyx_t_3 = 0; __pyx_t_4 = 0; __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 693, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_profile = __pyx_t_1; __pyx_t_1 = 0;
694: #now see if the client has requested a different value:
+695: profile = options.get("h264.%s.profile" % csc_mode, profile)
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_get); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 695, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_7 = __Pyx_PyString_Format(__pyx_kp_s_h264_s_profile, __pyx_v_csc_mode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 695, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_4 = NULL; __pyx_t_6 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_6 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_7, __pyx_v_profile}; __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 695, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_7, __pyx_v_profile}; __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 695, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } else #endif { __pyx_t_3 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 695, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (__pyx_t_4) { __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __pyx_t_4 = NULL; } __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_6, __pyx_t_7); __Pyx_INCREF(__pyx_v_profile); __Pyx_GIVEREF(__pyx_v_profile); PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_6, __pyx_v_profile); __pyx_t_7 = 0; __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 695, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF_SET(__pyx_v_profile, __pyx_t_1); __pyx_t_1 = 0;
+696: return options.get("x264.%s.profile" % csc_mode, profile)
__Pyx_XDECREF(__pyx_r); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_get); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 696, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_x264_s_profile, __pyx_v_csc_mode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 696, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_7 = NULL; __pyx_t_6 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_7)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_6 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_3, __pyx_v_profile}; __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 696, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_3, __pyx_v_profile}; __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 696, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else #endif { __pyx_t_4 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 696, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (__pyx_t_7) { __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_7); __pyx_t_7 = NULL; } __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_6, __pyx_t_3); __Pyx_INCREF(__pyx_v_profile); __Pyx_GIVEREF(__pyx_v_profile); PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_6, __pyx_v_profile); __pyx_t_3 = 0; __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 696, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0;
697:
698:
+699: def compress_image(self, image, int quality=-1, int speed=-1, options={}):
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_8enc_x264_7encoder_7Encoder_25compress_image(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyObject *__pyx_pw_4xpra_6codecs_8enc_x264_7encoder_7Encoder_25compress_image(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_image = 0; int __pyx_v_quality; int __pyx_v_speed; PyObject *__pyx_v_options = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("compress_image (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_image,&__pyx_n_s_quality,&__pyx_n_s_speed,&__pyx_n_s_options,0}; PyObject* values[4] = {0,0,0,0}; values[3] = __pyx_k__12; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); CYTHON_FALLTHROUGH; case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_image)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (kw_args > 0) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_quality); if (value) { values[1] = value; kw_args--; } } CYTHON_FALLTHROUGH; case 2: if (kw_args > 0) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_speed); if (value) { values[2] = value; kw_args--; } } CYTHON_FALLTHROUGH; case 3: if (kw_args > 0) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_options); if (value) { values[3] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "compress_image") < 0)) __PYX_ERR(0, 699, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); CYTHON_FALLTHROUGH; case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_image = values[0]; if (values[1]) { __pyx_v_quality = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_quality == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 699, __pyx_L3_error) } else { __pyx_v_quality = ((int)-1); } if (values[2]) { __pyx_v_speed = __Pyx_PyInt_As_int(values[2]); if (unlikely((__pyx_v_speed == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 699, __pyx_L3_error) } else { __pyx_v_speed = ((int)-1); } __pyx_v_options = values[3]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("compress_image", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 699, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("xpra.codecs.enc_x264.encoder.Encoder.compress_image", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_4xpra_6codecs_8enc_x264_7encoder_7Encoder_24compress_image(((struct __pyx_obj_4xpra_6codecs_8enc_x264_7encoder_Encoder *)__pyx_v_self), __pyx_v_image, __pyx_v_quality, __pyx_v_speed, __pyx_v_options); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_8enc_x264_7encoder_7Encoder_24compress_image(struct __pyx_obj_4xpra_6codecs_8enc_x264_7encoder_Encoder *__pyx_v_self, PyObject *__pyx_v_image, int __pyx_v_quality, int __pyx_v_speed, PyObject *__pyx_v_options) { x264_picture_t __pyx_v_pic_in; uint8_t *__pyx_v_pic_buf; Py_ssize_t __pyx_v_pic_buf_len; int __pyx_v_i; PyObject *__pyx_v_source = NULL; PyObject *__pyx_v_b_frames = NULL; PyObject *__pyx_v_pixels = NULL; PyObject *__pyx_v_istrides = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("compress_image", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_9); __Pyx_AddTraceback("xpra.codecs.enc_x264.encoder.Encoder.compress_image", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_source); __Pyx_XDECREF(__pyx_v_b_frames); __Pyx_XDECREF(__pyx_v_pixels); __Pyx_XDECREF(__pyx_v_istrides); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_t_5 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 699, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_k__12 = __pyx_t_5; __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = 0;
700: cdef x264_picture_t pic_in
701: cdef uint8_t *pic_buf
+702: cdef Py_ssize_t pic_buf_len = 0
__pyx_v_pic_buf_len = 0;
703: cdef char *out
704: cdef int i #@DuplicatedSignature
705:
+706: if self.first_frame_timestamp==0:
__pyx_t_1 = ((__pyx_v_self->first_frame_timestamp == 0) != 0); if (__pyx_t_1) { /* … */ }
+707: self.first_frame_timestamp = image.get_timestamp()
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_image, __pyx_n_s_get_timestamp); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 707, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } if (__pyx_t_4) { __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 707, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else { __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 707, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = __Pyx_PyInt_As_uint64_t(__pyx_t_2); if (unlikely((__pyx_t_5 == ((uint64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 707, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_self->first_frame_timestamp = __pyx_t_5;
708:
+709: source = options.get("source", "unknown")
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_get); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 709, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 709, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_source = __pyx_t_3; __pyx_t_3 = 0; /* … */ __pyx_tuple__13 = PyTuple_Pack(2, __pyx_n_s_source, __pyx_n_s_unknown); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 709, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__13); __Pyx_GIVEREF(__pyx_tuple__13);
+710: b_frames = options.get("b-frames", 0)
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_options, __pyx_n_s_get); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 710, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 710, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_b_frames = __pyx_t_2; __pyx_t_2 = 0; /* … */ __pyx_tuple__14 = PyTuple_Pack(2, __pyx_kp_s_b_frames, __pyx_int_0); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 710, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__14); __Pyx_GIVEREF(__pyx_tuple__14);
+711: if source!=self.source or self.b_frames!=b_frames:
__pyx_t_2 = PyObject_RichCompare(__pyx_v_source, __pyx_v_self->source, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 711, __pyx_L1_error) __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 711, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (!__pyx_t_6) { } else { __pyx_t_1 = __pyx_t_6; goto __pyx_L5_bool_binop_done; } __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_self->b_frames); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 711, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_v_b_frames, Py_NE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 711, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 711, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_1 = __pyx_t_6; __pyx_L5_bool_binop_done:; if (__pyx_t_1) { /* … */ }
712: #some options have changed:
+713: log("compress_image: reconfig b-frames=%s, source=%s (from %s, %s)", b_frames, source, self.b_frames, self.source)
__pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 713, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_self->b_frames); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 713, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_7 = NULL; __pyx_t_8 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_7)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_8 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[6] = {__pyx_t_7, __pyx_kp_s_compress_image_reconfig_b_frames, __pyx_v_b_frames, __pyx_v_source, __pyx_t_4, __pyx_v_self->source}; __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 5+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 713, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[6] = {__pyx_t_7, __pyx_kp_s_compress_image_reconfig_b_frames, __pyx_v_b_frames, __pyx_v_source, __pyx_t_4, __pyx_v_self->source}; __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 5+__pyx_t_8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 713, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else #endif { __pyx_t_9 = PyTuple_New(5+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 713, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); if (__pyx_t_7) { __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL; } __Pyx_INCREF(__pyx_kp_s_compress_image_reconfig_b_frames); __Pyx_GIVEREF(__pyx_kp_s_compress_image_reconfig_b_frames); PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_kp_s_compress_image_reconfig_b_frames); __Pyx_INCREF(__pyx_v_b_frames); __Pyx_GIVEREF(__pyx_v_b_frames); PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_b_frames); __Pyx_INCREF(__pyx_v_source); __Pyx_GIVEREF(__pyx_v_source); PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_v_source); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_9, 3+__pyx_t_8, __pyx_t_4); __Pyx_INCREF(__pyx_v_self->source); __Pyx_GIVEREF(__pyx_v_self->source); PyTuple_SET_ITEM(__pyx_t_9, 4+__pyx_t_8, __pyx_v_self->source); __pyx_t_4 = 0; __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_9, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 713, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+714: self.source = source
__Pyx_INCREF(__pyx_v_source); __Pyx_GIVEREF(__pyx_v_source); __Pyx_GOTREF(__pyx_v_self->source); __Pyx_DECREF(__pyx_v_self->source); __pyx_v_self->source = __pyx_v_source;
+715: self.b_frames = b_frames
__pyx_t_8 = __Pyx_PyInt_As_int(__pyx_v_b_frames); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 715, __pyx_L1_error) __pyx_v_self->b_frames = __pyx_t_8;
+716: self.reconfig_tune()
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reconfig_tune); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 716, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_9 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_9)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_9); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } if (__pyx_t_9) { __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 716, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } else { __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 716, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
717:
+718: pixels = image.get_pixels()
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_image, __pyx_n_s_get_pixels); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 718, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_9 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_9)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_9); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } if (__pyx_t_9) { __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 718, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } else { __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 718, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_pixels = __pyx_t_3; __pyx_t_3 = 0;
+719: istrides = image.get_rowstride()
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_image, __pyx_n_s_get_rowstride); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 719, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_9 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_9)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_9); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } if (__pyx_t_9) { __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 719, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } else { __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 719, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_istrides = __pyx_t_3; __pyx_t_3 = 0;
+720: assert pixels, "failed to get pixels from %s" % image
#ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_pixels); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 720, __pyx_L1_error) if (unlikely(!__pyx_t_1)) { __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_failed_to_get_pixels_from_s, __pyx_v_image); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 720, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); PyErr_SetObject(PyExc_AssertionError, __pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 720, __pyx_L1_error) } } #endif
721:
+722: x264_picture_init(&pic_in)
x264_picture_init((&__pyx_v_pic_in));
723:
+724: if self.src_format.find("RGB")>=0 or self.src_format.find("BGR")>=0:
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->src_format, __pyx_n_s_find); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 724, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 724, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_GE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 724, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 724, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (!__pyx_t_6) { } else { __pyx_t_1 = __pyx_t_6; goto __pyx_L8_bool_binop_done; } __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->src_format, __pyx_n_s_find); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 724, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); /* … */ __pyx_tuple__15 = PyTuple_Pack(1, __pyx_n_s_RGB); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 724, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__15); __Pyx_GIVEREF(__pyx_tuple__15); __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 724, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_GE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 724, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 724, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_1 = __pyx_t_6; __pyx_L8_bool_binop_done:; if (__pyx_t_1) { /* … */ goto __pyx_L7; } __pyx_tuple__16 = PyTuple_Pack(1, __pyx_n_s_BGR); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 724, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__16); __Pyx_GIVEREF(__pyx_tuple__16);
+725: assert len(pixels)>0
#ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { __pyx_t_10 = PyObject_Length(__pyx_v_pixels); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 725, __pyx_L1_error) if (unlikely(!((__pyx_t_10 > 0) != 0))) { PyErr_SetNone(PyExc_AssertionError); __PYX_ERR(0, 725, __pyx_L1_error) } } #endif
+726: assert istrides>0
#ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { __pyx_t_3 = PyObject_RichCompare(__pyx_v_istrides, __pyx_int_0, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 726, __pyx_L1_error) __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 726, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_1)) { PyErr_SetNone(PyExc_AssertionError); __PYX_ERR(0, 726, __pyx_L1_error) } } #endif
+727: assert object_as_buffer(pixels, <const void**> &pic_buf, &pic_buf_len)==0, "unable to convert %s to a buffer" % type(pixels)
#ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { if (unlikely(!((__pyx_f_4xpra_7buffers_6membuf_object_as_buffer(__pyx_v_pixels, ((void const **)(&__pyx_v_pic_buf)), (&__pyx_v_pic_buf_len)) == 0) != 0))) { __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_unable_to_convert_s_to_a_buffer, ((PyObject *)Py_TYPE(__pyx_v_pixels))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 727, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); PyErr_SetObject(PyExc_AssertionError, __pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 727, __pyx_L1_error) } } #endif
+728: for i in range(3):
for (__pyx_t_8 = 0; __pyx_t_8 < 3; __pyx_t_8+=1) { __pyx_v_i = __pyx_t_8;
+729: pic_in.img.plane[i] = pic_buf
(__pyx_v_pic_in.img.plane[__pyx_v_i]) = __pyx_v_pic_buf;
+730: pic_in.img.i_stride[i] = istrides
__pyx_t_11 = __Pyx_PyInt_As_int(__pyx_v_istrides); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 730, __pyx_L1_error) (__pyx_v_pic_in.img.i_stride[__pyx_v_i]) = __pyx_t_11; }
+731: self.bytes_in += pic_buf_len
__pyx_v_self->bytes_in = (__pyx_v_self->bytes_in + __pyx_v_pic_buf_len);
732: else:
+733: assert len(pixels)==3, "image pixels does not have 3 planes! (found %s)" % len(pixels)
/*else*/ { #ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { __pyx_t_10 = PyObject_Length(__pyx_v_pixels); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 733, __pyx_L1_error) if (unlikely(!((__pyx_t_10 == 3) != 0))) { __pyx_t_12 = PyObject_Length(__pyx_v_pixels); if (unlikely(__pyx_t_12 == ((Py_ssize_t)-1))) __PYX_ERR(0, 733, __pyx_L1_error) __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_12); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 733, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_image_pixels_does_not_have_3_pla, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 733, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; PyErr_SetObject(PyExc_AssertionError, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 733, __pyx_L1_error) } } #endif
+734: assert len(istrides)==3, "image strides does not have 3 values! (found %s)" % len(istrides)
#ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { __pyx_t_10 = PyObject_Length(__pyx_v_istrides); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 734, __pyx_L1_error) if (unlikely(!((__pyx_t_10 == 3) != 0))) { __pyx_t_12 = PyObject_Length(__pyx_v_istrides); if (unlikely(__pyx_t_12 == ((Py_ssize_t)-1))) __PYX_ERR(0, 734, __pyx_L1_error) __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_12); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 734, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_image_strides_does_not_have_3_va, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 734, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyErr_SetObject(PyExc_AssertionError, __pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 734, __pyx_L1_error) } } #endif
+735: for i in range(3):
for (__pyx_t_8 = 0; __pyx_t_8 < 3; __pyx_t_8+=1) { __pyx_v_i = __pyx_t_8;
+736: assert object_as_buffer(pixels[i], <const void**> &pic_buf, &pic_buf_len)==0, "unable to convert %s to a buffer (plane=%s)" % (type(pixels[i]), i)
#ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_pixels, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 736, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (unlikely(!((__pyx_f_4xpra_7buffers_6membuf_object_as_buffer(__pyx_t_3, ((void const **)(&__pyx_v_pic_buf)), (&__pyx_v_pic_buf_len)) == 0) != 0))) { __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_pixels, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 736, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 736, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 736, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_t_2))); __Pyx_GIVEREF(((PyObject *)Py_TYPE(__pyx_t_2))); PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)Py_TYPE(__pyx_t_2))); __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_9); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_9 = 0; __pyx_t_9 = __Pyx_PyString_Format(__pyx_kp_s_unable_to_convert_s_to_a_buffer_2, __pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 736, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; PyErr_SetObject(PyExc_AssertionError, __pyx_t_9); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __PYX_ERR(0, 736, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } #endif
+737: pic_in.img.plane[i] = pic_buf
(__pyx_v_pic_in.img.plane[__pyx_v_i]) = __pyx_v_pic_buf;
+738: pic_in.img.i_stride[i] = istrides[i]
__pyx_t_3 = __Pyx_GetItemInt(__pyx_v_istrides, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 738, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_11 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 738, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; (__pyx_v_pic_in.img.i_stride[__pyx_v_i]) = __pyx_t_11; } } __pyx_L7:;
739:
+740: pic_in.img.i_csp = self.colorspace
__pyx_t_8 = __pyx_v_self->colorspace; __pyx_v_pic_in.img.i_csp = __pyx_t_8;
+741: pic_in.img.i_plane = 3
__pyx_v_pic_in.img.i_plane = 3;
+742: pic_in.i_pts = image.get_timestamp()-self.first_frame_timestamp
__pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_image, __pyx_n_s_get_timestamp); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 742, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_9); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_9, function); } } if (__pyx_t_4) { __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 742, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else { __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_9); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 742, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_9 = __Pyx_PyInt_From_uint64_t(__pyx_v_self->first_frame_timestamp); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 742, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_4 = PyNumber_Subtract(__pyx_t_3, __pyx_t_9); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 742, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_13 = __Pyx_PyInt_As_int64_t(__pyx_t_4); if (unlikely((__pyx_t_13 == ((int64_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 742, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_v_pic_in.i_pts = __pyx_t_13;
+743: return self.do_compress_image(&pic_in, quality, speed)
__Pyx_XDECREF(__pyx_r); __pyx_t_14.__pyx_n = 2; __pyx_t_14.quality = __pyx_v_quality; __pyx_t_14.speed = __pyx_v_speed; __pyx_t_4 = ((struct __pyx_vtabstruct_4xpra_6codecs_8enc_x264_7encoder_Encoder *)__pyx_v_self->__pyx_vtab)->do_compress_image(__pyx_v_self, (&__pyx_v_pic_in), &__pyx_t_14); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 743, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_r = __pyx_t_4; __pyx_t_4 = 0; goto __pyx_L0;
744:
+745: cdef do_compress_image(self, x264_picture_t *pic_in, int quality=-1, int speed=-1):
static PyObject *__pyx_f_4xpra_6codecs_8enc_x264_7encoder_7Encoder_do_compress_image(struct __pyx_obj_4xpra_6codecs_8enc_x264_7encoder_Encoder *__pyx_v_self, x264_picture_t *__pyx_v_pic_in, struct __pyx_opt_args_4xpra_6codecs_8enc_x264_7encoder_7Encoder_do_compress_image *__pyx_optional_args) { int __pyx_v_quality = ((int)-1); int __pyx_v_speed = ((int)-1); x264_nal_t *__pyx_v_nals; int __pyx_v_i_nals; x264_picture_t __pyx_v_pic_out; int __pyx_v_frame_size; double __pyx_v_start; PyObject *__pyx_v_slice_type = NULL; PyObject *__pyx_v_bnals = NULL; PyObject *__pyx_v_nal_indexes = NULL; unsigned int __pyx_v_index; int __pyx_v_i; char *__pyx_v_out; PyObject *__pyx_v_cdata = NULL; PyObject *__pyx_v_client_options = NULL; double __pyx_v_end; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("do_compress_image", 0); if (__pyx_optional_args) { if (__pyx_optional_args->__pyx_n > 0) { __pyx_v_quality = __pyx_optional_args->quality; if (__pyx_optional_args->__pyx_n > 1) { __pyx_v_speed = __pyx_optional_args->speed; } } } /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_9); __Pyx_XDECREF(__pyx_t_10); __Pyx_XDECREF(__pyx_t_11); __Pyx_XDECREF(__pyx_t_12); __Pyx_XDECREF(__pyx_t_17); __Pyx_AddTraceback("xpra.codecs.enc_x264.encoder.Encoder.do_compress_image", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_slice_type); __Pyx_XDECREF(__pyx_v_bnals); __Pyx_XDECREF(__pyx_v_nal_indexes); __Pyx_XDECREF(__pyx_v_cdata); __Pyx_XDECREF(__pyx_v_client_options); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ struct __pyx_opt_args_4xpra_6codecs_8enc_x264_7encoder_7Encoder_do_compress_image { int __pyx_n; int quality; int speed; };
+746: cdef x264_nal_t *nals = NULL
__pyx_v_nals = NULL;
+747: cdef int i_nals = 0
__pyx_v_i_nals = 0;
748: cdef x264_picture_t pic_out
+749: cdef int frame_size = 0
__pyx_v_frame_size = 0;
+750: assert self.context!=NULL
#ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { if (unlikely(!((__pyx_v_self->context != NULL) != 0))) { PyErr_SetNone(PyExc_AssertionError); __PYX_ERR(0, 750, __pyx_L1_error) } } #endif
+751: cdef double start = monotonic_time()
__pyx_v_start = __pyx_f_4xpra_14monotonic_time_monotonic_time();
752:
+753: if speed>=0:
__pyx_t_1 = ((__pyx_v_speed >= 0) != 0); if (__pyx_t_1) { /* … */ goto __pyx_L3; }
+754: self.set_encoding_speed(speed)
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_encoding_speed); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 754, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_speed); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 754, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } if (!__pyx_t_5) { __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 754, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_2); } else { #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4}; __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 754, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_4}; __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 754, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else #endif { __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 754, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __pyx_t_5 = NULL; __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_t_4); __pyx_t_4 = 0; __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 754, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
755: else:
+756: speed = self.speed
/*else*/ { __pyx_t_7 = __pyx_v_self->speed; __pyx_v_speed = __pyx_t_7; } __pyx_L3:;
+757: if quality>=0:
__pyx_t_1 = ((__pyx_v_quality >= 0) != 0); if (__pyx_t_1) { /* … */ goto __pyx_L4; }
+758: self.set_encoding_quality(quality)
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_encoding_quality); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 758, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_quality); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 758, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } if (!__pyx_t_4) { __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 758, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_GOTREF(__pyx_t_2); } else { #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_6}; __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 758, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_6}; __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 758, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } else #endif { __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 758, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL; __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_6); __pyx_t_6 = 0; __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 758, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
759: else:
+760: quality = self.quality
/*else*/ { __pyx_t_7 = __pyx_v_self->quality; __pyx_v_quality = __pyx_t_7; } __pyx_L4:;
761:
+762: with nogil:
{ #ifdef WITH_THREAD PyThreadState *_save; Py_UNBLOCK_THREADS __Pyx_FastGIL_Remember(); #endif /*try:*/ { /* … */ /*finally:*/ { /*normal exit:*/{ #ifdef WITH_THREAD __Pyx_FastGIL_Forget(); Py_BLOCK_THREADS #endif goto __pyx_L7; } __pyx_L7:; } }
+763: x264_picture_init(&pic_out)
x264_picture_init((&__pyx_v_pic_out));
+764: frame_size = x264_encoder_encode(self.context, &nals, &i_nals, pic_in, &pic_out)
__pyx_v_frame_size = x264_encoder_encode(__pyx_v_self->context, (&__pyx_v_nals), (&__pyx_v_i_nals), __pyx_v_pic_in, (&__pyx_v_pic_out)); }
+765: if frame_size < 0:
__pyx_t_1 = ((__pyx_v_frame_size < 0) != 0); if (__pyx_t_1) { /* … */ }
+766: log.error("x264 encoding error: frame_size is invalid!")
__pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 766, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_error); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 766, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 766, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* … */ __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_x264_encoding_error_frame_size_i); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 766, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__17); __Pyx_GIVEREF(__pyx_tuple__17);
+767: return None
__Pyx_XDECREF(__pyx_r); __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0;
+768: self.delayed_frames = x264_encoder_delayed_frames(self.context)
__pyx_v_self->delayed_frames = x264_encoder_delayed_frames(__pyx_v_self->context);
+769: if i_nals==0:
__pyx_t_1 = ((__pyx_v_i_nals == 0) != 0); if (__pyx_t_1) { /* … */ }
+770: if self.b_frames and self.delayed_frames>0:
__pyx_t_8 = (__pyx_v_self->b_frames != 0); if (__pyx_t_8) { } else { __pyx_t_1 = __pyx_t_8; goto __pyx_L11_bool_binop_done; } __pyx_t_8 = ((__pyx_v_self->delayed_frames > 0) != 0); __pyx_t_1 = __pyx_t_8; __pyx_L11_bool_binop_done:; if (__pyx_t_1) { /* … */ }
+771: log("x264 encode %i delayed frames after %i", self.delayed_frames, self.frames)
__pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 771, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_self->delayed_frames); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 771, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = __Pyx_PyInt_From_unsigned_long(__pyx_v_self->frames); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 771, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_4 = NULL; __pyx_t_7 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_7 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_kp_s_x264_encode_i_delayed_frames_aft, __pyx_t_5, __pyx_t_6}; __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 771, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_kp_s_x264_encode_i_delayed_frames_aft, __pyx_t_5, __pyx_t_6}; __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_7, 3+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 771, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } else #endif { __pyx_t_9 = PyTuple_New(3+__pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 771, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); if (__pyx_t_4) { __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_4); __pyx_t_4 = NULL; } __Pyx_INCREF(__pyx_kp_s_x264_encode_i_delayed_frames_aft); __Pyx_GIVEREF(__pyx_kp_s_x264_encode_i_delayed_frames_aft); PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_7, __pyx_kp_s_x264_encode_i_delayed_frames_aft); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_7, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_7, __pyx_t_6); __pyx_t_5 = 0; __pyx_t_6 = 0; __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 771, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+772: return None, {
__Pyx_XDECREF(__pyx_r); /* … */ __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 772, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0;
+773: "delayed" : self.delayed_frames,
__pyx_t_2 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 773, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_self->delayed_frames); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 773, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_delayed, __pyx_t_3) < 0) __PYX_ERR(0, 773, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+774: "frame" : self.frames,
__pyx_t_3 = __Pyx_PyInt_From_unsigned_long(__pyx_v_self->frames); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 774, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_frame, __pyx_t_3) < 0) __PYX_ERR(0, 773, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
775: }
+776: raise Exception("x264_encoder_encode produced no data (frame=%i, frame-size=%i, b-frames=%s, delayed-frames=%i)" % (self.frames, frame_size, self.b_frames, self.delayed_frames))
__pyx_t_3 = __Pyx_PyInt_From_unsigned_long(__pyx_v_self->frames); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 776, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_frame_size); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 776, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_self->b_frames); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 776, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_self->delayed_frames); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 776, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 776, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_9); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_6); __pyx_t_3 = 0; __pyx_t_2 = 0; __pyx_t_9 = 0; __pyx_t_6 = 0; __pyx_t_6 = __Pyx_PyString_Format(__pyx_kp_s_x264_encoder_encode_produced_no, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 776, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = __Pyx_PyObject_CallOneArg(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 776, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __PYX_ERR(0, 776, __pyx_L1_error)
+777: slice_type = SLICE_TYPES.get(pic_out.i_type, pic_out.i_type)
__pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_SLICE_TYPES); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 777, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_get); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 777, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_pic_out.i_type); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 777, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_pic_out.i_type); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 777, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; __pyx_t_7 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_9))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_9); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_9, function); __pyx_t_7 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_9)) { PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_6, __pyx_t_2}; __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 777, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) { PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_t_6, __pyx_t_2}; __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 777, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } else #endif { __pyx_t_4 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 777, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (__pyx_t_3) { __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL; } __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_7, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_7, __pyx_t_2); __pyx_t_6 = 0; __pyx_t_2 = 0; __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 777, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_v_slice_type = __pyx_t_5; __pyx_t_5 = 0;
+778: self.frame_types[slice_type] = self.frame_types.get(slice_type, 0)+1
__pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->frame_types, __pyx_n_s_get); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 778, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_4 = NULL; __pyx_t_7 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_9))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_9); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_9, function); __pyx_t_7 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_9)) { PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_slice_type, __pyx_int_0}; __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 778, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_5); } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_9)) { PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_slice_type, __pyx_int_0}; __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_9, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 778, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_5); } else #endif { __pyx_t_2 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 778, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (__pyx_t_4) { __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); __pyx_t_4 = NULL; } __Pyx_INCREF(__pyx_v_slice_type); __Pyx_GIVEREF(__pyx_v_slice_type); PyTuple_SET_ITEM(__pyx_t_2, 0+__pyx_t_7, __pyx_v_slice_type); __Pyx_INCREF(__pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_t_2, 1+__pyx_t_7, __pyx_int_0); __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 778, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_9 = __Pyx_PyInt_AddObjC(__pyx_t_5, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 778, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (unlikely(PyObject_SetItem(__pyx_v_self->frame_types, __pyx_v_slice_type, __pyx_t_9) < 0)) __PYX_ERR(0, 778, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+779: log("x264 encode %7s frame %5i as %4s slice with %i nals, tune=%s, total %7i bytes, keyframe=%-5s, delayed=%i", self.src_format, self.frames, slice_type, i_nals, self.tune, frame_size, bool(pic_out.b_keyframe), self.delayed_frames)
__pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 779, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_2 = __Pyx_PyInt_From_unsigned_long(__pyx_v_self->frames); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 779, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_i_nals); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 779, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_frame_size); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 779, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_pic_out.b_keyframe); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 779, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 779, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyBool_FromLong((!(!__pyx_t_1))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 779, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_10 = __Pyx_PyInt_From_int(__pyx_v_self->delayed_frames); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 779, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __pyx_t_11 = NULL; __pyx_t_7 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_11)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); __Pyx_INCREF(__pyx_t_11); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); __pyx_t_7 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_5)) { PyObject *__pyx_temp[10] = {__pyx_t_11, __pyx_kp_s_x264_encode_7s_frame_5i_as_4s_sl, __pyx_v_self->src_format, __pyx_t_2, __pyx_v_slice_type, __pyx_t_4, __pyx_v_self->tune, __pyx_t_6, __pyx_t_3, __pyx_t_10}; __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 9+__pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 779, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { PyObject *__pyx_temp[10] = {__pyx_t_11, __pyx_kp_s_x264_encode_7s_frame_5i_as_4s_sl, __pyx_v_self->src_format, __pyx_t_2, __pyx_v_slice_type, __pyx_t_4, __pyx_v_self->tune, __pyx_t_6, __pyx_t_3, __pyx_t_10}; __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 9+__pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 779, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; } else #endif { __pyx_t_12 = PyTuple_New(9+__pyx_t_7); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 779, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); if (__pyx_t_11) { __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_11); __pyx_t_11 = NULL; } __Pyx_INCREF(__pyx_kp_s_x264_encode_7s_frame_5i_as_4s_sl); __Pyx_GIVEREF(__pyx_kp_s_x264_encode_7s_frame_5i_as_4s_sl); PyTuple_SET_ITEM(__pyx_t_12, 0+__pyx_t_7, __pyx_kp_s_x264_encode_7s_frame_5i_as_4s_sl); __Pyx_INCREF(__pyx_v_self->src_format); __Pyx_GIVEREF(__pyx_v_self->src_format); PyTuple_SET_ITEM(__pyx_t_12, 1+__pyx_t_7, __pyx_v_self->src_format); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_12, 2+__pyx_t_7, __pyx_t_2); __Pyx_INCREF(__pyx_v_slice_type); __Pyx_GIVEREF(__pyx_v_slice_type); PyTuple_SET_ITEM(__pyx_t_12, 3+__pyx_t_7, __pyx_v_slice_type); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_12, 4+__pyx_t_7, __pyx_t_4); __Pyx_INCREF(__pyx_v_self->tune); __Pyx_GIVEREF(__pyx_v_self->tune); PyTuple_SET_ITEM(__pyx_t_12, 5+__pyx_t_7, __pyx_v_self->tune); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_12, 6+__pyx_t_7, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_12, 7+__pyx_t_7, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_12, 8+__pyx_t_7, __pyx_t_10); __pyx_t_2 = 0; __pyx_t_4 = 0; __pyx_t_6 = 0; __pyx_t_3 = 0; __pyx_t_10 = 0; __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_12, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 779, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; } __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+780: bnals = []
__pyx_t_9 = PyList_New(0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 780, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_v_bnals = ((PyObject*)__pyx_t_9); __pyx_t_9 = 0;
+781: nal_indexes = []
__pyx_t_9 = PyList_New(0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 781, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_v_nal_indexes = ((PyObject*)__pyx_t_9); __pyx_t_9 = 0;
+782: cdef unsigned int index = 0
__pyx_v_index = 0;
+783: for i in range(i_nals):
__pyx_t_7 = __pyx_v_i_nals; __pyx_t_13 = __pyx_t_7; for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) { __pyx_v_i = __pyx_t_14;
+784: out = <char *>nals[i].p_payload
__pyx_v_out = ((char *)(__pyx_v_nals[__pyx_v_i]).p_payload);
+785: cdata = out[:nals[i].i_payload]
__pyx_t_9 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_out + 0, (__pyx_v_nals[__pyx_v_i]).i_payload - 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 785, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_XDECREF_SET(__pyx_v_cdata, __pyx_t_9); __pyx_t_9 = 0;
+786: bnals.append(cdata)
__pyx_t_15 = __Pyx_PyList_Append(__pyx_v_bnals, __pyx_v_cdata); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 786, __pyx_L1_error)
+787: index += nals[i].i_payload
__pyx_v_index = (__pyx_v_index + (__pyx_v_nals[__pyx_v_i]).i_payload);
+788: nal_indexes.append(index)
__pyx_t_9 = __Pyx_PyInt_From_unsigned_int(__pyx_v_index); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 788, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_15 = __Pyx_PyList_Append(__pyx_v_nal_indexes, __pyx_t_9); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 788, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+789: if LOG_NALS:
__pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_LOG_NALS); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 789, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_9); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 789, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; if (__pyx_t_1) { /* … */ } }
+790: log.info(" nal %s priority:%10s, type:%10s, payload=%#x, payload size=%i",
__pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 790, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_info); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 790, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+791: i, NAL_PRIORITIES.get(nals[i].i_ref_idc, nals[i].i_ref_idc), NAL_TYPES.get(nals[i].i_type, nals[i].i_type), <uintptr_t> nals[i].p_payload, nals[i].i_payload)
__pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_i); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 791, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_NAL_PRIORITIES); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 791, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_get); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 791, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_nals[__pyx_v_i]).i_ref_idc); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 791, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_nals[__pyx_v_i]).i_ref_idc); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 791, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_2 = NULL; __pyx_t_16 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_6); if (likely(__pyx_t_2)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_6, function); __pyx_t_16 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_6)) { PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_t_3, __pyx_t_4}; __pyx_t_10 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_16, 2+__pyx_t_16); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 791, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_t_3, __pyx_t_4}; __pyx_t_10 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_16, 2+__pyx_t_16); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 791, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else #endif { __pyx_t_11 = PyTuple_New(2+__pyx_t_16); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 791, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); if (__pyx_t_2) { __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_2); __pyx_t_2 = NULL; } __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_16, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_16, __pyx_t_4); __pyx_t_3 = 0; __pyx_t_4 = 0; __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_11, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 791, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; } __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s_NAL_TYPES); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 791, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_get); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 791, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __pyx_t_11 = __Pyx_PyInt_From_int((__pyx_v_nals[__pyx_v_i]).i_type); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 791, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_nals[__pyx_v_i]).i_type); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 791, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = NULL; __pyx_t_16 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_2)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); __pyx_t_16 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_4)) { PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_t_11, __pyx_t_3}; __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_16, 2+__pyx_t_16); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 791, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) { PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_t_11, __pyx_t_3}; __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-__pyx_t_16, 2+__pyx_t_16); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 791, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } else #endif { __pyx_t_17 = PyTuple_New(2+__pyx_t_16); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 791, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_17); if (__pyx_t_2) { __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_17, 0, __pyx_t_2); __pyx_t_2 = NULL; } __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_17, 0+__pyx_t_16, __pyx_t_11); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_17, 1+__pyx_t_16, __pyx_t_3); __pyx_t_11 = 0; __pyx_t_3 = 0; __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_17, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 791, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = __Pyx_PyInt_FromSize_t(((uintptr_t)(__pyx_v_nals[__pyx_v_i]).p_payload)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 791, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_17 = __Pyx_PyInt_From_int((__pyx_v_nals[__pyx_v_i]).i_payload); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 791, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_17); __pyx_t_3 = NULL; __pyx_t_16 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_12); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_12, function); __pyx_t_16 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_12)) { PyObject *__pyx_temp[7] = {__pyx_t_3, __pyx_kp_s_nal_s_priority_10s_type_10s_pay, __pyx_t_5, __pyx_t_10, __pyx_t_6, __pyx_t_4, __pyx_t_17}; __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_12, __pyx_temp+1-__pyx_t_16, 6+__pyx_t_16); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 790, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_12)) { PyObject *__pyx_temp[7] = {__pyx_t_3, __pyx_kp_s_nal_s_priority_10s_type_10s_pay, __pyx_t_5, __pyx_t_10, __pyx_t_6, __pyx_t_4, __pyx_t_17}; __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_12, __pyx_temp+1-__pyx_t_16, 6+__pyx_t_16); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 790, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; } else #endif { __pyx_t_11 = PyTuple_New(6+__pyx_t_16); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 790, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); if (__pyx_t_3) { __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_3); __pyx_t_3 = NULL; } __Pyx_INCREF(__pyx_kp_s_nal_s_priority_10s_type_10s_pay); __Pyx_GIVEREF(__pyx_kp_s_nal_s_priority_10s_type_10s_pay); PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_16, __pyx_kp_s_nal_s_priority_10s_type_10s_pay); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_16, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_11, 2+__pyx_t_16, __pyx_t_10); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_11, 3+__pyx_t_16, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_11, 4+__pyx_t_16, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_17); PyTuple_SET_ITEM(__pyx_t_11, 5+__pyx_t_16, __pyx_t_17); __pyx_t_5 = 0; __pyx_t_10 = 0; __pyx_t_6 = 0; __pyx_t_4 = 0; __pyx_t_17 = 0; __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_11, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 790, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; } __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+792: cdata = b"".join(bnals)
__pyx_t_9 = __Pyx_PyBytes_Join(__pyx_kp_b__11, __pyx_v_bnals); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 792, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_XDECREF_SET(__pyx_v_cdata, __pyx_t_9); __pyx_t_9 = 0;
+793: if len(cdata)!=frame_size:
__pyx_t_18 = PyObject_Length(__pyx_v_cdata); if (unlikely(__pyx_t_18 == ((Py_ssize_t)-1))) __PYX_ERR(0, 793, __pyx_L1_error) __pyx_t_1 = ((__pyx_t_18 != __pyx_v_frame_size) != 0); if (__pyx_t_1) { /* … */ }
+794: log.warn("Warning: h264 nals do not match frame size")
__pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 794, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_warn); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 794, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 794, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; /* … */ __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_Warning_h264_nals_do_not_match_f); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 794, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__18); __Pyx_GIVEREF(__pyx_tuple__18);
+795: log.warn(" expected %i bytes, but got %i nals and %i bytes", frame_size, len(bnals), len(cdata))
__pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 795, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_warn); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 795, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __pyx_t_12 = __Pyx_PyInt_From_int(__pyx_v_frame_size); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 795, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); __pyx_t_18 = PyList_GET_SIZE(__pyx_v_bnals); if (unlikely(__pyx_t_18 == ((Py_ssize_t)-1))) __PYX_ERR(0, 795, __pyx_L1_error) __pyx_t_17 = PyInt_FromSsize_t(__pyx_t_18); if (unlikely(!__pyx_t_17)) __PYX_ERR(0, 795, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_17); __pyx_t_18 = PyObject_Length(__pyx_v_cdata); if (unlikely(__pyx_t_18 == ((Py_ssize_t)-1))) __PYX_ERR(0, 795, __pyx_L1_error) __pyx_t_4 = PyInt_FromSsize_t(__pyx_t_18); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 795, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_6 = NULL; __pyx_t_7 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_11))) { __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_11); if (likely(__pyx_t_6)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11); __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_11, function); __pyx_t_7 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_11)) { PyObject *__pyx_temp[5] = {__pyx_t_6, __pyx_kp_s_expected_i_bytes_but_got_i_nals, __pyx_t_12, __pyx_t_17, __pyx_t_4}; __pyx_t_9 = __Pyx_PyFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_7, 4+__pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 795, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_11)) { PyObject *__pyx_temp[5] = {__pyx_t_6, __pyx_kp_s_expected_i_bytes_but_got_i_nals, __pyx_t_12, __pyx_t_17, __pyx_t_4}; __pyx_t_9 = __Pyx_PyCFunction_FastCall(__pyx_t_11, __pyx_temp+1-__pyx_t_7, 4+__pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 795, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else #endif { __pyx_t_10 = PyTuple_New(4+__pyx_t_7); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 795, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); if (__pyx_t_6) { __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_6); __pyx_t_6 = NULL; } __Pyx_INCREF(__pyx_kp_s_expected_i_bytes_but_got_i_nals); __Pyx_GIVEREF(__pyx_kp_s_expected_i_bytes_but_got_i_nals); PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_7, __pyx_kp_s_expected_i_bytes_but_got_i_nals); __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_7, __pyx_t_12); __Pyx_GIVEREF(__pyx_t_17); PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_7, __pyx_t_17); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_10, 3+__pyx_t_7, __pyx_t_4); __pyx_t_12 = 0; __pyx_t_17 = 0; __pyx_t_4 = 0; __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_11, __pyx_t_10, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 795, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; } __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+796: self.bytes_out += frame_size
__pyx_v_self->bytes_out = (__pyx_v_self->bytes_out + __pyx_v_frame_size);
797: #info for client:
798: client_options = {
+799: "frame" : int(self.frames),
__pyx_t_9 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 799, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_11 = __Pyx_PyInt_From_unsigned_long(__pyx_v_self->frames); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 799, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __pyx_t_10 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyInt_Type)), __pyx_t_11); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 799, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_frame, __pyx_t_10) < 0) __PYX_ERR(0, 799, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+800: "pts" : pic_out.i_pts,
__pyx_t_10 = __Pyx_PyInt_From_int64_t(__pyx_v_pic_out.i_pts); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 800, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_pts, __pyx_t_10) < 0) __PYX_ERR(0, 799, __pyx_L1_error) __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
801: #"quality" : max(0, min(100, quality)),
802: #"speed" : max(0, min(100, speed)),
+803: "type" : slice_type,
if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_type, __pyx_v_slice_type) < 0) __PYX_ERR(0, 799, __pyx_L1_error) __pyx_v_client_options = ((PyObject*)__pyx_t_9); __pyx_t_9 = 0;
804: }
+805: if self.delayed_frames>0:
__pyx_t_1 = ((__pyx_v_self->delayed_frames > 0) != 0); if (__pyx_t_1) { /* … */ }
+806: client_options["delayed"] = self.delayed_frames
__pyx_t_9 = __Pyx_PyInt_From_int(__pyx_v_self->delayed_frames); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 806, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); if (unlikely(PyDict_SetItem(__pyx_v_client_options, __pyx_n_s_delayed, __pyx_t_9) < 0)) __PYX_ERR(0, 806, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+807: if self.export_nals:
__pyx_t_1 = (__pyx_v_self->export_nals != 0); if (__pyx_t_1) { /* … */ }
+808: client_options["nals"] = nal_indexes
if (unlikely(PyDict_SetItem(__pyx_v_client_options, __pyx_n_s_nals, __pyx_v_nal_indexes) < 0)) __PYX_ERR(0, 808, __pyx_L1_error)
809: #accounting:
+810: cdef double end = monotonic_time()
__pyx_v_end = __pyx_f_4xpra_14monotonic_time_monotonic_time();
+811: self.time += end-start
__pyx_v_self->time = (__pyx_v_self->time + (__pyx_v_end - __pyx_v_start));
+812: self.frames += 1
__pyx_v_self->frames = (__pyx_v_self->frames + 1);
+813: self.last_frame_times.append((start, end))
__pyx_t_9 = PyFloat_FromDouble(__pyx_v_start); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 813, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_10 = PyFloat_FromDouble(__pyx_v_end); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 813, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 813, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_9); __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_10); __pyx_t_9 = 0; __pyx_t_10 = 0; __pyx_t_15 = __Pyx_PyObject_Append(__pyx_v_self->last_frame_times, __pyx_t_11); if (unlikely(__pyx_t_15 == ((int)-1))) __PYX_ERR(0, 813, __pyx_L1_error) __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+814: assert self.context!=NULL
#ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { if (unlikely(!((__pyx_v_self->context != NULL) != 0))) { PyErr_SetNone(PyExc_AssertionError); __PYX_ERR(0, 814, __pyx_L1_error) } } #endif
+815: if self.file and frame_size>0:
__pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_self->file); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 815, __pyx_L1_error) if (__pyx_t_8) { } else { __pyx_t_1 = __pyx_t_8; goto __pyx_L20_bool_binop_done; } __pyx_t_8 = ((__pyx_v_frame_size > 0) != 0); __pyx_t_1 = __pyx_t_8; __pyx_L20_bool_binop_done:; if (__pyx_t_1) { /* … */ }
+816: self.file.write(cdata)
__pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->file, __pyx_n_s_write); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 816, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __pyx_t_9 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) { __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_10); if (likely(__pyx_t_9)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10); __Pyx_INCREF(__pyx_t_9); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_10, function); } } if (!__pyx_t_9) { __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_v_cdata); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 816, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); } else { #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_10)) { PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_v_cdata}; __pyx_t_11 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 816, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_GOTREF(__pyx_t_11); } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) { PyObject *__pyx_temp[2] = {__pyx_t_9, __pyx_v_cdata}; __pyx_t_11 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 816, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_GOTREF(__pyx_t_11); } else #endif { __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 816, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_9); __pyx_t_9 = NULL; __Pyx_INCREF(__pyx_v_cdata); __Pyx_GIVEREF(__pyx_v_cdata); PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_cdata); __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_4, NULL); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 816, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } } __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+817: self.file.flush()
__pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_self->file, __pyx_n_s_flush); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 817, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_10); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_10, function); } } if (__pyx_t_4) { __pyx_t_11 = __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_4); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 817, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else { __pyx_t_11 = __Pyx_PyObject_CallNoArg(__pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 817, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
+818: return cdata, client_options
__Pyx_XDECREF(__pyx_r); __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 818, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __Pyx_INCREF(__pyx_v_cdata); __Pyx_GIVEREF(__pyx_v_cdata); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v_cdata); __Pyx_INCREF(__pyx_v_client_options); __Pyx_GIVEREF(__pyx_v_client_options); PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_v_client_options); __pyx_r = __pyx_t_11; __pyx_t_11 = 0; goto __pyx_L0;
819:
+820: def flush(self, unsigned long frame_no):
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_8enc_x264_7encoder_7Encoder_27flush(PyObject *__pyx_v_self, PyObject *__pyx_arg_frame_no); /*proto*/ static PyObject *__pyx_pw_4xpra_6codecs_8enc_x264_7encoder_7Encoder_27flush(PyObject *__pyx_v_self, PyObject *__pyx_arg_frame_no) { unsigned long __pyx_v_frame_no; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("flush (wrapper)", 0); assert(__pyx_arg_frame_no); { __pyx_v_frame_no = __Pyx_PyInt_As_unsigned_long(__pyx_arg_frame_no); if (unlikely((__pyx_v_frame_no == (unsigned long)-1) && PyErr_Occurred())) __PYX_ERR(0, 820, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; __Pyx_AddTraceback("xpra.codecs.enc_x264.encoder.Encoder.flush", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_4xpra_6codecs_8enc_x264_7encoder_7Encoder_26flush(((struct __pyx_obj_4xpra_6codecs_8enc_x264_7encoder_Encoder *)__pyx_v_self), ((unsigned long)__pyx_v_frame_no)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_8enc_x264_7encoder_7Encoder_26flush(struct __pyx_obj_4xpra_6codecs_8enc_x264_7encoder_Encoder *__pyx_v_self, unsigned long __pyx_v_frame_no) { CYTHON_UNUSED x264_nal_t *__pyx_v_nals; CYTHON_UNUSED int __pyx_v_i_nals; x264_picture_t __pyx_v_pic_out; CYTHON_UNUSED int __pyx_v_frame_size; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("flush", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_9); __Pyx_AddTraceback("xpra.codecs.enc_x264.encoder.Encoder.flush", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+821: if self.frames>frame_no or self.context==NULL:
__pyx_t_2 = ((__pyx_v_self->frames > __pyx_v_frame_no) != 0); if (!__pyx_t_2) { } else { __pyx_t_1 = __pyx_t_2; goto __pyx_L4_bool_binop_done; } __pyx_t_2 = ((__pyx_v_self->context == NULL) != 0); __pyx_t_1 = __pyx_t_2; __pyx_L4_bool_binop_done:; if (__pyx_t_1) { /* … */ }
+822: return None, {}
__Pyx_XDECREF(__pyx_r); __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 822, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 822, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); PyTuple_SET_ITEM(__pyx_t_4, 0, Py_None); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_4; __pyx_t_4 = 0; goto __pyx_L0;
+823: self.delayed_frames = x264_encoder_delayed_frames(self.context)
__pyx_v_self->delayed_frames = x264_encoder_delayed_frames(__pyx_v_self->context);
+824: log("x264 flush(%i) %i delayed frames", frame_no, self.delayed_frames)
__pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 824, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = __Pyx_PyInt_From_unsigned_long(__pyx_v_frame_no); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 824, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_self->delayed_frames); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 824, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = NULL; __pyx_t_8 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_7)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); __pyx_t_8 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_kp_s_x264_flush_i_i_delayed_frames, __pyx_t_5, __pyx_t_6}; __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 824, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_kp_s_x264_flush_i_i_delayed_frames, __pyx_t_5, __pyx_t_6}; __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 824, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } else #endif { __pyx_t_9 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 824, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); if (__pyx_t_7) { __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL; } __Pyx_INCREF(__pyx_kp_s_x264_flush_i_i_delayed_frames); __Pyx_GIVEREF(__pyx_kp_s_x264_flush_i_i_delayed_frames); PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_kp_s_x264_flush_i_i_delayed_frames); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_t_6); __pyx_t_5 = 0; __pyx_t_6 = 0; __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_9, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 824, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+825: if self.delayed_frames<=0:
__pyx_t_1 = ((__pyx_v_self->delayed_frames <= 0) != 0); if (__pyx_t_1) { /* … */ }
+826: return None, {}
__Pyx_XDECREF(__pyx_r); __pyx_t_4 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 826, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 826, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); PyTuple_SET_ITEM(__pyx_t_3, 0, Py_None); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4); __pyx_t_4 = 0; __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0;
+827: cdef x264_nal_t *nals = NULL
__pyx_v_nals = NULL;
+828: cdef int i_nals = 0
__pyx_v_i_nals = 0;
829: cdef x264_picture_t pic_out
+830: cdef int frame_size = 0
__pyx_v_frame_size = 0;
+831: x264_picture_init(&pic_out)
x264_picture_init((&__pyx_v_pic_out));
+832: return self.do_compress_image(NULL)
__Pyx_XDECREF(__pyx_r); __pyx_t_3 = ((struct __pyx_vtabstruct_4xpra_6codecs_8enc_x264_7encoder_Encoder *)__pyx_v_self->__pyx_vtab)->do_compress_image(__pyx_v_self, NULL, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 832, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0;
833:
834:
+835: def set_encoding_speed(self, int pct):
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_8enc_x264_7encoder_7Encoder_29set_encoding_speed(PyObject *__pyx_v_self, PyObject *__pyx_arg_pct); /*proto*/ static PyObject *__pyx_pw_4xpra_6codecs_8enc_x264_7encoder_7Encoder_29set_encoding_speed(PyObject *__pyx_v_self, PyObject *__pyx_arg_pct) { int __pyx_v_pct; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_encoding_speed (wrapper)", 0); assert(__pyx_arg_pct); { __pyx_v_pct = __Pyx_PyInt_As_int(__pyx_arg_pct); if (unlikely((__pyx_v_pct == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 835, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; __Pyx_AddTraceback("xpra.codecs.enc_x264.encoder.Encoder.set_encoding_speed", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_4xpra_6codecs_8enc_x264_7encoder_7Encoder_28set_encoding_speed(((struct __pyx_obj_4xpra_6codecs_8enc_x264_7encoder_Encoder *)__pyx_v_self), ((int)__pyx_v_pct)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_8enc_x264_7encoder_7Encoder_28set_encoding_speed(struct __pyx_obj_4xpra_6codecs_8enc_x264_7encoder_Encoder *__pyx_v_self, int __pyx_v_pct) { x264_param_t __pyx_v_param; int __pyx_v_new_preset; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_encoding_speed", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("xpra.codecs.enc_x264.encoder.Encoder.set_encoding_speed", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+836: assert pct>=0 and pct<=100, "invalid percentage: %s" % pct
#ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { __pyx_t_2 = ((__pyx_v_pct >= 0) != 0); if (__pyx_t_2) { } else { __pyx_t_1 = __pyx_t_2; goto __pyx_L3_bool_binop_done; } __pyx_t_2 = ((__pyx_v_pct <= 0x64) != 0); __pyx_t_1 = __pyx_t_2; __pyx_L3_bool_binop_done:; if (unlikely(!__pyx_t_1)) { __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_pct); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 836, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_invalid_percentage_s, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 836, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; PyErr_SetObject(PyExc_AssertionError, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __PYX_ERR(0, 836, __pyx_L1_error) } } #endif
+837: assert self.context!=NULL, "context is closed!"
#ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { if (unlikely(!((__pyx_v_self->context != NULL) != 0))) { PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_context_is_closed); __PYX_ERR(0, 837, __pyx_L1_error) } } #endif
838: cdef x264_param_t param #@DuplicatedSignature
+839: cdef int new_preset = get_preset_for_speed(pct)
__pyx_v_new_preset = __pyx_f_4xpra_6codecs_8enc_x264_7encoder_get_preset_for_speed(__pyx_v_pct);
+840: if new_preset == self.preset:
__pyx_t_1 = ((__pyx_v_new_preset == __pyx_v_self->preset) != 0); if (__pyx_t_1) { /* … */ }
+841: return
__Pyx_XDECREF(__pyx_r); __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0;
+842: self.speed = pct
__pyx_v_self->speed = __pyx_v_pct;
843: #retrieve current parameters:
+844: x264_encoder_parameters(self.context, ¶m)
x264_encoder_parameters(__pyx_v_self->context, (&__pyx_v_param));
845: #apply new preset:
+846: self.tune = self.get_tune()
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_tune); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 846, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } if (__pyx_t_5) { __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 846, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } else { __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 846, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GIVEREF(__pyx_t_4); __Pyx_GOTREF(__pyx_v_self->tune); __Pyx_DECREF(__pyx_v_self->tune); __pyx_v_self->tune = __pyx_t_4; __pyx_t_4 = 0;
+847: x264_param_default_preset(¶m, get_preset_names()[new_preset], self.tune)
__pyx_t_6 = __Pyx_PyObject_AsString(__pyx_v_self->tune); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(0, 847, __pyx_L1_error) (void)(x264_param_default_preset((&__pyx_v_param), (__pyx_f_4xpra_6codecs_8enc_x264_7encoder_get_preset_names()[__pyx_v_new_preset]), __pyx_t_6));
848: #ensure quality remains what it was:
+849: self.do_reconfig_tune(¶m)
__pyx_t_4 = ((struct __pyx_vtabstruct_4xpra_6codecs_8enc_x264_7encoder_Encoder *)__pyx_v_self->__pyx_vtab)->do_reconfig_tune(__pyx_v_self, (&__pyx_v_param)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 849, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+850: self.preset = new_preset
__pyx_v_self->preset = __pyx_v_new_preset;
851:
+852: def set_encoding_quality(self, int pct):
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_8enc_x264_7encoder_7Encoder_31set_encoding_quality(PyObject *__pyx_v_self, PyObject *__pyx_arg_pct); /*proto*/ static PyObject *__pyx_pw_4xpra_6codecs_8enc_x264_7encoder_7Encoder_31set_encoding_quality(PyObject *__pyx_v_self, PyObject *__pyx_arg_pct) { int __pyx_v_pct; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_encoding_quality (wrapper)", 0); assert(__pyx_arg_pct); { __pyx_v_pct = __Pyx_PyInt_As_int(__pyx_arg_pct); if (unlikely((__pyx_v_pct == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 852, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; __Pyx_AddTraceback("xpra.codecs.enc_x264.encoder.Encoder.set_encoding_quality", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_4xpra_6codecs_8enc_x264_7encoder_7Encoder_30set_encoding_quality(((struct __pyx_obj_4xpra_6codecs_8enc_x264_7encoder_Encoder *)__pyx_v_self), ((int)__pyx_v_pct)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_8enc_x264_7encoder_7Encoder_30set_encoding_quality(struct __pyx_obj_4xpra_6codecs_8enc_x264_7encoder_Encoder *__pyx_v_self, int __pyx_v_pct) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_encoding_quality", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("xpra.codecs.enc_x264.encoder.Encoder.set_encoding_quality", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+853: assert pct>=0 and pct<=100, "invalid percentage: %s" % pct
#ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { __pyx_t_2 = ((__pyx_v_pct >= 0) != 0); if (__pyx_t_2) { } else { __pyx_t_1 = __pyx_t_2; goto __pyx_L3_bool_binop_done; } __pyx_t_2 = ((__pyx_v_pct <= 0x64) != 0); __pyx_t_1 = __pyx_t_2; __pyx_L3_bool_binop_done:; if (unlikely(!__pyx_t_1)) { __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_pct); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 853, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_invalid_percentage_s, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 853, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; PyErr_SetObject(PyExc_AssertionError, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __PYX_ERR(0, 853, __pyx_L1_error) } } #endif
+854: if self.quality==pct:
__pyx_t_1 = ((__pyx_v_self->quality == __pyx_v_pct) != 0); if (__pyx_t_1) { /* … */ }
+855: return
__Pyx_XDECREF(__pyx_r); __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0;
+856: if abs(self.quality - pct)<=4 and pct!=100 and self.quality!=100:
__pyx_t_5 = abs((__pyx_v_self->quality - __pyx_v_pct)); if (unlikely(__pyx_t_5 == ((int)-1))) __PYX_ERR(0, 856, __pyx_L1_error)
__pyx_t_2 = ((__pyx_t_5 <= 4) != 0);
if (__pyx_t_2) {
} else {
__pyx_t_1 = __pyx_t_2;
goto __pyx_L7_bool_binop_done;
}
__pyx_t_2 = ((__pyx_v_pct != 0x64) != 0);
if (__pyx_t_2) {
} else {
__pyx_t_1 = __pyx_t_2;
goto __pyx_L7_bool_binop_done;
}
__pyx_t_2 = ((__pyx_v_self->quality != 0x64) != 0);
__pyx_t_1 = __pyx_t_2;
__pyx_L7_bool_binop_done:;
if (__pyx_t_1) {
/* … */
}
857: #not enough of a change to bother (but always change to/from 100)
+858: return
__Pyx_XDECREF(__pyx_r); __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0;
859: #adjust quality:
+860: self.quality = pct
__pyx_v_self->quality = __pyx_v_pct;
+861: self.reconfig_tune()
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_reconfig_tune); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 861, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_6 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_6)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } if (__pyx_t_6) { __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 861, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } else { __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 861, __pyx_L1_error) } __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
862:
+863: def reconfig_tune(self):
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_8enc_x264_7encoder_7Encoder_33reconfig_tune(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyObject *__pyx_pw_4xpra_6codecs_8enc_x264_7encoder_7Encoder_33reconfig_tune(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("reconfig_tune (wrapper)", 0); __pyx_r = __pyx_pf_4xpra_6codecs_8enc_x264_7encoder_7Encoder_32reconfig_tune(((struct __pyx_obj_4xpra_6codecs_8enc_x264_7encoder_Encoder *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_8enc_x264_7encoder_7Encoder_32reconfig_tune(struct __pyx_obj_4xpra_6codecs_8enc_x264_7encoder_Encoder *__pyx_v_self) { x264_param_t __pyx_v_param; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("reconfig_tune", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("xpra.codecs.enc_x264.encoder.Encoder.reconfig_tune", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
864: cdef x264_param_t param
+865: x264_encoder_parameters(self.context, ¶m)
x264_encoder_parameters(__pyx_v_self->context, (&__pyx_v_param));
+866: self.do_reconfig_tune(¶m)
__pyx_t_1 = ((struct __pyx_vtabstruct_4xpra_6codecs_8enc_x264_7encoder_Encoder *)__pyx_v_self->__pyx_vtab)->do_reconfig_tune(__pyx_v_self, (&__pyx_v_param)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 866, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
867:
+868: cdef do_reconfig_tune(self, x264_param_t *param):
static PyObject *__pyx_f_4xpra_6codecs_8enc_x264_7encoder_7Encoder_do_reconfig_tune(struct __pyx_obj_4xpra_6codecs_8enc_x264_7encoder_Encoder *__pyx_v_self, x264_param_t *__pyx_v_param) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("do_reconfig_tune", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("xpra.codecs.enc_x264.encoder.Encoder.do_reconfig_tune", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
+869: assert self.context!=NULL, "context is closed!"
#ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { if (unlikely(!((__pyx_v_self->context != NULL) != 0))) { PyErr_SetObject(PyExc_AssertionError, __pyx_kp_s_context_is_closed); __PYX_ERR(0, 869, __pyx_L1_error) } } #endif
870: #adjust quality:
+871: set_f_rf(param, get_x264_quality(self.quality, self.profile))
__pyx_t_1 = __Pyx_PyObject_AsWritableString(__pyx_v_self->profile); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 871, __pyx_L1_error) __pyx_t_2 = __pyx_f_4xpra_6codecs_8enc_x264_7encoder_set_f_rf(__pyx_v_param, __pyx_f_4xpra_6codecs_8enc_x264_7encoder_get_x264_quality(__pyx_v_self->quality, __pyx_t_1)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 871, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+872: self.tune_param(param)
__pyx_t_2 = ((struct __pyx_vtabstruct_4xpra_6codecs_8enc_x264_7encoder_Encoder *)__pyx_v_self->__pyx_vtab)->tune_param(__pyx_v_self, __pyx_v_param); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 872, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
873: #apply it:
+874: if x264_encoder_reconfig(self.context, param)!=0:
__pyx_t_3 = ((x264_encoder_reconfig(__pyx_v_self->context, __pyx_v_param) != 0) != 0); if (unlikely(__pyx_t_3)) { /* … */ }
+875: raise Exception("x264_encoder_reconfig failed")
__pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 875, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __PYX_ERR(0, 875, __pyx_L1_error) /* … */ __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_x264_encoder_reconfig_failed); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 875, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__19); __Pyx_GIVEREF(__pyx_tuple__19);
876:
877:
+878: def selftest(full=False):
/* Python wrapper */ static PyObject *__pyx_pw_4xpra_6codecs_8enc_x264_7encoder_19selftest(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyMethodDef __pyx_mdef_4xpra_6codecs_8enc_x264_7encoder_19selftest = {"selftest", (PyCFunction)__pyx_pw_4xpra_6codecs_8enc_x264_7encoder_19selftest, METH_VARARGS|METH_KEYWORDS, 0}; static PyObject *__pyx_pw_4xpra_6codecs_8enc_x264_7encoder_19selftest(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_full = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("selftest (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_full,0}; PyObject* values[1] = {0}; values[0] = ((PyObject *)Py_False); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (kw_args > 0) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_full); if (value) { values[0] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "selftest") < 0)) __PYX_ERR(0, 878, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_full = values[0]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("selftest", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 878, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("xpra.codecs.enc_x264.encoder.selftest", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_4xpra_6codecs_8enc_x264_7encoder_18selftest(__pyx_self, __pyx_v_full); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_4xpra_6codecs_8enc_x264_7encoder_18selftest(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_full) { PyObject *__pyx_v_testencoder = NULL; PyObject *__pyx_v_get_encoder_max_sizes = NULL; PyObject *__pyx_v_encoder = NULL; PyObject *__pyx_v_temp = NULL; PyObject *__pyx_v_maxw = NULL; PyObject *__pyx_v_maxh = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("selftest", 0); /* … */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_9); __Pyx_XDECREF(__pyx_t_10); __Pyx_AddTraceback("xpra.codecs.enc_x264.encoder.selftest", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_testencoder); __Pyx_XDECREF(__pyx_v_get_encoder_max_sizes); __Pyx_XDECREF(__pyx_v_encoder); __Pyx_XDECREF(__pyx_v_temp); __Pyx_XDECREF(__pyx_v_maxw); __Pyx_XDECREF(__pyx_v_maxh); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* … */ __pyx_tuple__48 = PyTuple_Pack(7, __pyx_n_s_full, __pyx_n_s_testencoder, __pyx_n_s_get_encoder_max_sizes, __pyx_n_s_encoder, __pyx_n_s_temp, __pyx_n_s_maxw, __pyx_n_s_maxh); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(0, 878, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__48); __Pyx_GIVEREF(__pyx_tuple__48); /* … */ __pyx_t_5 = PyCFunction_NewEx(&__pyx_mdef_4xpra_6codecs_8enc_x264_7encoder_19selftest, NULL, __pyx_n_s_xpra_codecs_enc_x264_encoder); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 878, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); if (PyDict_SetItem(__pyx_d, __pyx_n_s_selftest, __pyx_t_5) < 0) __PYX_ERR(0, 878, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
879: global SAVE_TO_FILE
+880: from xpra.codecs.codec_checks import testencoder, get_encoder_max_sizes
__pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 880, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_n_s_testencoder); __Pyx_GIVEREF(__pyx_n_s_testencoder); PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_testencoder); __Pyx_INCREF(__pyx_n_s_get_encoder_max_sizes); __Pyx_GIVEREF(__pyx_n_s_get_encoder_max_sizes); PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_get_encoder_max_sizes); __pyx_t_2 = __Pyx_Import(__pyx_n_s_xpra_codecs_codec_checks, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 880, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_testencoder); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 880, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_t_1); __pyx_v_testencoder = __pyx_t_1; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_get_encoder_max_sizes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 880, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_t_1); __pyx_v_get_encoder_max_sizes = __pyx_t_1; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+881: from xpra.codecs.enc_x264 import encoder
__pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 881, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_n_s_encoder); __Pyx_GIVEREF(__pyx_n_s_encoder); PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_encoder); __pyx_t_1 = __Pyx_Import(__pyx_n_s_xpra_codecs_enc_x264, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 881, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_encoder); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 881, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_t_2); __pyx_v_encoder = __pyx_t_2; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+882: temp = SAVE_TO_FILE
__pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_SAVE_TO_FILE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 882, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_temp = __pyx_t_1; __pyx_t_1 = 0;
+883: try:
/*try:*/ {
+884: SAVE_TO_FILE = None
if (PyDict_SetItem(__pyx_d, __pyx_n_s_SAVE_TO_FILE, Py_None) < 0) __PYX_ERR(0, 884, __pyx_L4_error)
+885: assert testencoder(encoder, full)
#ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { __Pyx_INCREF(__pyx_v_testencoder); __pyx_t_2 = __pyx_v_testencoder; __pyx_t_3 = NULL; __pyx_t_4 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); __pyx_t_4 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_encoder, __pyx_v_full}; __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, 885, __pyx_L4_error) __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_1); } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[3] = {__pyx_t_3, __pyx_v_encoder, __pyx_v_full}; __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, 885, __pyx_L4_error) __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_GOTREF(__pyx_t_1); } else #endif { __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 885, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_5); if (__pyx_t_3) { __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL; } __Pyx_INCREF(__pyx_v_encoder); __Pyx_GIVEREF(__pyx_v_encoder); PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_encoder); __Pyx_INCREF(__pyx_v_full); __Pyx_GIVEREF(__pyx_v_full); PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_full); __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 885, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 885, __pyx_L4_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(!__pyx_t_6)) { PyErr_SetNone(PyExc_AssertionError); __PYX_ERR(0, 885, __pyx_L4_error) } } #endif
886: #this is expensive, so don't run it unless "full" is set:
+887: if full:
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_full); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 887, __pyx_L4_error) if (__pyx_t_6) { /* … */ } }
888: global MAX_WIDTH, MAX_HEIGHT
+889: maxw, maxh = get_encoder_max_sizes(encoder)
__Pyx_INCREF(__pyx_v_get_encoder_max_sizes); __pyx_t_2 = __pyx_v_get_encoder_max_sizes; __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); } } if (!__pyx_t_5) { __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_encoder); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 889, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_1); } else { #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_encoder}; __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 889, __pyx_L4_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_1); } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_encoder}; __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 889, __pyx_L4_error) __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_GOTREF(__pyx_t_1); } else #endif { __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 889, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __pyx_t_5 = NULL; __Pyx_INCREF(__pyx_v_encoder); __Pyx_GIVEREF(__pyx_v_encoder); PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_encoder); __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 889, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { PyObject* sequence = __pyx_t_1; Py_ssize_t size = __Pyx_PySequence_SIZE(sequence); if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); __PYX_ERR(0, 889, __pyx_L4_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_3 = PyTuple_GET_ITEM(sequence, 1); } else { __pyx_t_2 = PyList_GET_ITEM(sequence, 0); __pyx_t_3 = PyList_GET_ITEM(sequence, 1); } __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); #else __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 889, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 889, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_3); #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } else { Py_ssize_t index = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 889, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_7 = Py_TYPE(__pyx_t_5)->tp_iternext; index = 0; __pyx_t_2 = __pyx_t_7(__pyx_t_5); if (unlikely(!__pyx_t_2)) goto __pyx_L7_unpacking_failed; __Pyx_GOTREF(__pyx_t_2); index = 1; __pyx_t_3 = __pyx_t_7(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L7_unpacking_failed; __Pyx_GOTREF(__pyx_t_3); if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_5), 2) < 0) __PYX_ERR(0, 889, __pyx_L4_error) __pyx_t_7 = NULL; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; goto __pyx_L8_unpacking_done; __pyx_L7_unpacking_failed:; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_7 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); __PYX_ERR(0, 889, __pyx_L4_error) __pyx_L8_unpacking_done:; } __pyx_v_maxw = __pyx_t_2; __pyx_t_2 = 0; __pyx_v_maxh = __pyx_t_3; __pyx_t_3 = 0;
+890: assert maxw>=MAX_WIDTH and maxh>=MAX_HEIGHT, "%s is limited to %ix%i and not %ix%i" % (encoder, maxw, maxh, MAX_WIDTH, MAX_HEIGHT)
#ifndef CYTHON_WITHOUT_ASSERTIONS if (unlikely(!Py_OptimizeFlag)) { __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_MAX_WIDTH); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 890, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = PyObject_RichCompare(__pyx_v_maxw, __pyx_t_1, Py_GE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 890, __pyx_L4_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 890, __pyx_L4_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_8) { } else { __pyx_t_6 = __pyx_t_8; goto __pyx_L9_bool_binop_done; } __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_MAX_HEIGHT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 890, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = PyObject_RichCompare(__pyx_v_maxh, __pyx_t_3, Py_GE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 890, __pyx_L4_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 890, __pyx_L4_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = __pyx_t_8; __pyx_L9_bool_binop_done:; if (unlikely(!__pyx_t_6)) { __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_MAX_WIDTH); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 890, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_MAX_HEIGHT); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 890, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 890, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_encoder); __Pyx_GIVEREF(__pyx_v_encoder); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_encoder); __Pyx_INCREF(__pyx_v_maxw); __Pyx_GIVEREF(__pyx_v_maxw); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_maxw); __Pyx_INCREF(__pyx_v_maxh); __Pyx_GIVEREF(__pyx_v_maxh); PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_maxh); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_t_3); __pyx_t_1 = 0; __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_s_is_limited_to_ix_i_and_not_ix, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 890, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; PyErr_SetObject(PyExc_AssertionError, __pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __PYX_ERR(0, 890, __pyx_L4_error) } } #endif
+891: MAX_WIDTH, MAX_HEIGHT = maxw, maxh
__pyx_t_3 = __pyx_v_maxw; __Pyx_INCREF(__pyx_t_3); __pyx_t_2 = __pyx_v_maxh; __Pyx_INCREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_MAX_WIDTH, __pyx_t_3) < 0) __PYX_ERR(0, 891, __pyx_L4_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s_MAX_HEIGHT, __pyx_t_2) < 0) __PYX_ERR(0, 891, __pyx_L4_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+892: log.info("%s max dimensions: %ix%i", encoder, MAX_WIDTH, MAX_HEIGHT)
__pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_log); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 892, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_info); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 892, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_MAX_WIDTH); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 892, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_MAX_HEIGHT); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 892, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_9 = NULL; __pyx_t_4 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_1); if (likely(__pyx_t_9)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); __Pyx_INCREF(__pyx_t_9); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_1, function); __pyx_t_4 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_1)) { PyObject *__pyx_temp[5] = {__pyx_t_9, __pyx_kp_s_s_max_dimensions_ix_i, __pyx_v_encoder, __pyx_t_3, __pyx_t_5}; __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_4, 4+__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 892, __pyx_L4_error) __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { PyObject *__pyx_temp[5] = {__pyx_t_9, __pyx_kp_s_s_max_dimensions_ix_i, __pyx_v_encoder, __pyx_t_3, __pyx_t_5}; __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_4, 4+__pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 892, __pyx_L4_error) __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } else #endif { __pyx_t_10 = PyTuple_New(4+__pyx_t_4); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 892, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_10); if (__pyx_t_9) { __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); __pyx_t_9 = NULL; } __Pyx_INCREF(__pyx_kp_s_s_max_dimensions_ix_i); __Pyx_GIVEREF(__pyx_kp_s_s_max_dimensions_ix_i); PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_4, __pyx_kp_s_s_max_dimensions_ix_i); __Pyx_INCREF(__pyx_v_encoder); __Pyx_GIVEREF(__pyx_v_encoder); PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_4, __pyx_v_encoder); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_4, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_10, 3+__pyx_t_4, __pyx_t_5); __pyx_t_3 = 0; __pyx_t_5 = 0; __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_10, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 892, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
893: finally:
+894: SAVE_TO_FILE = temp
/*finally:*/ { /*normal exit:*/{ if (PyDict_SetItem(__pyx_d, __pyx_n_s_SAVE_TO_FILE, __pyx_v_temp) < 0) __PYX_ERR(0, 894, __pyx_L1_error) goto __pyx_L5; } __pyx_L4_error:; /*exception exit:*/{ __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; if (PY_MAJOR_VERSION >= 3) __Pyx_ExceptionSwap(&__pyx_t_16, &__pyx_t_17, &__pyx_t_18); if ((PY_MAJOR_VERSION < 3) || unlikely(__Pyx_GetException(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15) < 0)) __Pyx_ErrFetch(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15); __Pyx_XGOTREF(__pyx_t_13); __Pyx_XGOTREF(__pyx_t_14); __Pyx_XGOTREF(__pyx_t_15); __Pyx_XGOTREF(__pyx_t_16); __Pyx_XGOTREF(__pyx_t_17); __Pyx_XGOTREF(__pyx_t_18); __pyx_t_4 = __pyx_lineno; __pyx_t_11 = __pyx_clineno; __pyx_t_12 = __pyx_filename; { if (PyDict_SetItem(__pyx_d, __pyx_n_s_SAVE_TO_FILE, __pyx_v_temp) < 0) __PYX_ERR(0, 894, __pyx_L12_error) } if (PY_MAJOR_VERSION >= 3) { __Pyx_XGIVEREF(__pyx_t_16); __Pyx_XGIVEREF(__pyx_t_17); __Pyx_XGIVEREF(__pyx_t_18); __Pyx_ExceptionReset(__pyx_t_16, __pyx_t_17, __pyx_t_18); } __Pyx_XGIVEREF(__pyx_t_13); __Pyx_XGIVEREF(__pyx_t_14); __Pyx_XGIVEREF(__pyx_t_15); __Pyx_ErrRestore(__pyx_t_13, __pyx_t_14, __pyx_t_15); __pyx_t_13 = 0; __pyx_t_14 = 0; __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; __pyx_lineno = __pyx_t_4; __pyx_clineno = __pyx_t_11; __pyx_filename = __pyx_t_12; goto __pyx_L1_error; __pyx_L12_error:; if (PY_MAJOR_VERSION >= 3) { __Pyx_XGIVEREF(__pyx_t_16); __Pyx_XGIVEREF(__pyx_t_17); __Pyx_XGIVEREF(__pyx_t_18); __Pyx_ExceptionReset(__pyx_t_16, __pyx_t_17, __pyx_t_18); } __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_XDECREF(__pyx_t_14); __pyx_t_14 = 0; __Pyx_XDECREF(__pyx_t_15); __pyx_t_15 = 0; __pyx_t_16 = 0; __pyx_t_17 = 0; __pyx_t_18 = 0; goto __pyx_L1_error; } __pyx_L5:; }