Commits

Zakhar Zibarov committed 5985823 Draft

applied patch from zakhar/ffvideo issue #1

Comments (0)

Files changed (3)

ffvideo/ffmpeg.pxd

     int64_t av_rescale(int64_t a, int64_t b, int64_t c)
     int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
 
-
-
 cdef extern from "libavutil/avutil.h":
     cdef enum PixelFormat:
         PIX_FMT_NONE= -1,
         PIX_FMT_UYVY411,   #< Packed pixel, Cb Y0 Y1 Cr Y2 Y3
         PIX_FMT_NB,
 
-cdef extern from "libavutil/avutil.h":
+    struct AVDictionaryEntry:
+        char *key
+        char *value
+
+    struct AVDictionary:
+        int count
+        AVDictionaryEntry *elems
+
     void av_free(void *) nogil
     void av_freep(void *) nogil
 
         AVDISCARD_NONKEY =  32 # discard all frames except keyframes
         AVDISCARD_ALL    =  48 # discard all
 
+    enum AVMediaType:
+        AVMEDIA_TYPE_UNKNOWN = -1
+        AVMEDIA_TYPE_VIDEO = 0
+        AVMEDIA_TYPE_AUDIO = 1
+        AVMEDIA_TYPE_DATA = 2
+        AVMEDIA_TYPE_SUBTITLE = 3
+        AVMEDIA_TYPE_ATTACHMENT = 4
+        AVMEDIA_TYPE_NB = 5
 
     struct AVCodecContext:
         int max_b_frames
         int skip_idct
         int skip_frame
         AVRational time_base
-        
-    enum CodecType:
-        CODEC_TYPE_UNKNOWN = -1
-        CODEC_TYPE_VIDEO = 0
-        CODEC_TYPE_AUDIO = 1
-        CODEC_TYPE_DATA = 2
-        CODEC_TYPE_SUBTITLE = 3
 
     struct AVCodec:
         char *name
         int linesize[4]
 
     AVCodec *avcodec_find_decoder(int id)
-    int avcodec_open(AVCodecContext *avctx, AVCodec *codec)
-    int avcodec_decode_video(AVCodecContext *avctx, AVFrame *picture,
-                         int *got_picture_ptr, char *buf, int buf_size) nogil
+    int avcodec_open2(AVCodecContext *avctx, AVCodec *codec, AVDictionary **options)
+    int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture,
+                         int *got_picture_ptr, AVPacket *avpkt) nogil
     int avpicture_fill(AVPicture *picture, void *ptr, int pix_fmt, int width, int height) nogil
     AVFrame *avcodec_alloc_frame()
     int avpicture_get_size(int pix_fmt, int width, int height)
     void avcodec_flush_buffers(AVCodecContext *avctx)
     int avcodec_close (AVCodecContext *avctx)
 
-
-
 cdef extern from "libavformat/avformat.h":
     struct AVFrac:
         int64_t val, num, den
         # approximately 3600 or 1800 timer ticks then r_frame_rate will be 50/1
         AVRational r_frame_rate
         void *priv_data
-        # internal data used in av_find_stream_info()
+        # internal data used in avformat_find_stream_info()
         int64_t codec_info_duration
         int codec_info_nb_frames
         # encoding: PTS generation when outputing stream
         int index_built
         int flags
 
+    int avformat_open_input(AVFormatContext **ic_ptr, char *filename,
+                       AVInputFormat *fmt,
+                       AVDictionary **options)
+    int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
 
-    struct AVFormatParameters:
-        pass
-
-    int av_open_input_file(AVFormatContext **ic_ptr, char *filename,
-                       AVInputFormat *fmt,
-                       int buf_size,
-                       AVFormatParameters *ap)
-    int av_find_stream_info(AVFormatContext *ic)
-
-    void dump_format(AVFormatContext *ic,
+    void av_dump_format(AVFormatContext *ic,
                  int index,
                  char *url,
                  int is_output)
     void av_parser_close(AVCodecParserContext *s)
 
     int av_index_search_timestamp(AVStream *st, int64_t timestamp, int flags)
-    void av_close_input_file(AVFormatContext *s)
-
+    void avformat_close_input(AVFormatContext **s)
 
 cdef extern from "libavformat/avio.h":
     int url_ferror(ByteIOContext *s)
     int url_feof(ByteIOContext *s)
 
-
 cdef extern from "libswscale/swscale.h":
     int SWS_FAST_BILINEAR
     int SWS_BILINEAR
     struct SwsVector:
         double *coeff
         int length
+
     struct SwsFilter:
         SwsVector *lumH
         SwsVector *lumV
         SwsVector *chrH
         SwsVector *chrV
+
     struct SwsContext:
         pass
 
 
     int sws_scale(SwsContext *context, uint8_t* src[], int srcStride[], int srcSliceY,
                     int srcSliceH, uint8_t* dst[], int dstStride[]) nogil
-
-

ffvideo/ffvideo.c

-/* Generated by Cython 0.12.1 on Sat Sep 10 03:31:04 2011 */
+/* Generated by Cython 0.15.1 on Fri Feb 22 22:05:16 2013 */
 
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"
-#include "structmember.h"
 #ifndef Py_PYTHON_H
     #error Python headers needed to compile C extensions, please install development version of Python.
 #else
 
-#ifndef PY_LONG_LONG
-  #define PY_LONG_LONG LONG_LONG
+#include <stddef.h> /* For offsetof */
+#ifndef offsetof
+#define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
+#endif
+
+#if !defined(WIN32) && !defined(MS_WINDOWS)
+  #ifndef __stdcall
+    #define __stdcall
+  #endif
+  #ifndef __cdecl
+    #define __cdecl
+  #endif
+  #ifndef __fastcall
+    #define __fastcall
+  #endif
+#endif
+
+#ifndef DL_IMPORT
+  #define DL_IMPORT(t) t
 #endif
 #ifndef DL_EXPORT
   #define DL_EXPORT(t) t
 #endif
+
+#ifndef PY_LONG_LONG
+  #define PY_LONG_LONG LONG_LONG
+#endif
+
 #if PY_VERSION_HEX < 0x02040000
   #define METH_COEXIST 0
   #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type)
   #define PY_SSIZE_T_MIN INT_MIN
   #define PY_FORMAT_SIZE_T ""
   #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
-  #define PyInt_AsSsize_t(o)   PyInt_AsLong(o)
+  #define PyInt_AsSsize_t(o)   __Pyx_PyInt_AsInt(o)
   #define PyNumber_Index(o)    PyNumber_Int(o)
   #define PyIndex_Check(o)     PyNumber_Check(o)
   #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message)
 
 #if PY_MAJOR_VERSION >= 3
   #define PyBaseString_Type            PyUnicode_Type
+  #define PyStringObject               PyUnicodeObject
   #define PyString_Type                PyUnicode_Type
+  #define PyString_Check               PyUnicode_Check
   #define PyString_CheckExact          PyUnicode_CheckExact
-#else
+#endif
+
+#if PY_VERSION_HEX < 0x02060000
+  #define PyBytesObject                PyStringObject
   #define PyBytes_Type                 PyString_Type
+  #define PyBytes_Check                PyString_Check
   #define PyBytes_CheckExact           PyString_CheckExact
+  #define PyBytes_FromString           PyString_FromString
+  #define PyBytes_FromStringAndSize    PyString_FromStringAndSize
+  #define PyBytes_FromFormat           PyString_FromFormat
+  #define PyBytes_DecodeEscape         PyString_DecodeEscape
+  #define PyBytes_AsString             PyString_AsString
+  #define PyBytes_AsStringAndSize      PyString_AsStringAndSize
+  #define PyBytes_Size                 PyString_Size
+  #define PyBytes_AS_STRING            PyString_AS_STRING
+  #define PyBytes_GET_SIZE             PyString_GET_SIZE
+  #define PyBytes_Repr                 PyString_Repr
+  #define PyBytes_Concat               PyString_Concat
+  #define PyBytes_ConcatAndDel         PyString_ConcatAndDel
 #endif
 
+#if PY_VERSION_HEX < 0x02060000
+  #define PySet_Check(obj)             PyObject_TypeCheck(obj, &PySet_Type)
+  #define PyFrozenSet_Check(obj)       PyObject_TypeCheck(obj, &PyFrozenSet_Type)
+#endif
+#ifndef PySet_CheckExact
+  #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
+#endif
+
+#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
+
 #if PY_MAJOR_VERSION >= 3
+  #define PyIntObject                  PyLongObject
   #define PyInt_Type                   PyLong_Type
   #define PyInt_Check(op)              PyLong_Check(op)
   #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
   #define PyInt_AsSsize_t              PyLong_AsSsize_t
   #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
   #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
+#endif
+
+#if PY_MAJOR_VERSION >= 3
+  #define PyBoolObject                 PyLongObject
+#endif
+
+#if PY_VERSION_HEX < 0x03020000
+  typedef long Py_hash_t;
+  #define __Pyx_PyInt_FromHash_t PyInt_FromLong
+  #define __Pyx_PyInt_AsHash_t   PyInt_AsLong
+#else
+  #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
+  #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
+#endif
+
+
+#if PY_MAJOR_VERSION >= 3
   #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
   #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
 #else
   #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
   #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
-
 #endif
 
+#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300)
+  #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b)
+  #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value)
+  #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b)
+#else
+  #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \
+        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \
+        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \
+            (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0)))
+  #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \
+        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
+        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \
+            (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1)))
+  #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \
+        (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \
+        (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \
+            (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1)))
+#endif
+
 #if PY_MAJOR_VERSION >= 3
-  #define PyMethod_New(func, self, klass) PyInstanceMethod_New(func)
-#endif
-
-#if !defined(WIN32) && !defined(MS_WINDOWS)
-  #ifndef __stdcall
-    #define __stdcall
-  #endif
-  #ifndef __cdecl
-    #define __cdecl
-  #endif
-  #ifndef __fastcall
-    #define __fastcall
-  #endif
-#else
-  #define _USE_MATH_DEFINES
+  #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
 #endif
 
 #if PY_VERSION_HEX < 0x02050000
   #define __Pyx_NAMESTR(n) (n)
   #define __Pyx_DOCSTR(n)  (n)
 #endif
-#ifdef __cplusplus
-#define __PYX_EXTERN_C extern "C"
-#else
-#define __PYX_EXTERN_C extern
+
+#ifndef __PYX_EXTERN_C
+  #ifdef __cplusplus
+    #define __PYX_EXTERN_C extern "C"
+  #else
+    #define __PYX_EXTERN_C extern
+  #endif
+#endif
+
+#if defined(WIN32) || defined(MS_WINDOWS)
+#define _USE_MATH_DEFINES
 #endif
 #include <math.h>
+#define __PYX_HAVE__ffvideo
 #define __PYX_HAVE_API__ffvideo
 #include "libavutil/rational.h"
 #include "libavutil/mathematics.h"
 #include "libavformat/avformat.h"
 #include "libavformat/avio.h"
 #include "libswscale/swscale.h"
-
+#ifdef _OPENMP
+#include <omp.h>
+#endif /* _OPENMP */
+
+#ifdef PYREX_WITHOUT_ASSERTIONS
+#define CYTHON_WITHOUT_ASSERTIONS
+#endif
+
+
+/* inline attribute */
 #ifndef CYTHON_INLINE
   #if defined(__GNUC__)
     #define CYTHON_INLINE __inline__
   #elif defined(_MSC_VER)
     #define CYTHON_INLINE __inline
+  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+    #define CYTHON_INLINE inline
   #else
-    #define CYTHON_INLINE 
+    #define CYTHON_INLINE
   #endif
 #endif
 
+/* unused attribute */
+#ifndef CYTHON_UNUSED
+# if defined(__GNUC__)
+#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
+#     define CYTHON_UNUSED __attribute__ ((__unused__))
+#   else
+#     define CYTHON_UNUSED
+#   endif
+# elif defined(__ICC) || defined(__INTEL_COMPILER)
+#   define CYTHON_UNUSED __attribute__ ((__unused__))
+# else
+#   define CYTHON_UNUSED
+# endif
+#endif
+
 typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/
 
 
 /* Type Conversion Predeclarations */
 
-#if PY_MAJOR_VERSION < 3
-#define __Pyx_PyBytes_FromString          PyString_FromString
-#define __Pyx_PyBytes_FromStringAndSize   PyString_FromStringAndSize
-#define __Pyx_PyBytes_AsString            PyString_AsString
-#else
-#define __Pyx_PyBytes_FromString          PyBytes_FromString
-#define __Pyx_PyBytes_FromStringAndSize   PyBytes_FromStringAndSize
-#define __Pyx_PyBytes_AsString            PyBytes_AsString
-#endif
-
-#define __Pyx_PyBytes_FromUString(s)      __Pyx_PyBytes_FromString((char*)s)
-#define __Pyx_PyBytes_AsUString(s)        ((unsigned char*) __Pyx_PyBytes_AsString(s))
-
+#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s)
+#define __Pyx_PyBytes_AsUString(s)   ((unsigned char*) PyBytes_AsString(s))
+
+#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None)
 #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False))
 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
 static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x);
 
-#if !defined(T_PYSSIZET)
-#if PY_VERSION_HEX < 0x02050000
-#define T_PYSSIZET T_INT
-#elif !defined(T_LONGLONG)
-#define T_PYSSIZET \
-        ((sizeof(Py_ssize_t) == sizeof(int))  ? T_INT  : \
-        ((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG : -1))
-#else
-#define T_PYSSIZET \
-        ((sizeof(Py_ssize_t) == sizeof(int))          ? T_INT      : \
-        ((sizeof(Py_ssize_t) == sizeof(long))         ? T_LONG     : \
-        ((sizeof(Py_ssize_t) == sizeof(PY_LONG_LONG)) ? T_LONGLONG : -1)))
-#endif
-#endif
-
-
-#if !defined(T_ULONGLONG)
-#define __Pyx_T_UNSIGNED_INT(x) \
-        ((sizeof(x) == sizeof(unsigned char))  ? T_UBYTE : \
-        ((sizeof(x) == sizeof(unsigned short)) ? T_USHORT : \
-        ((sizeof(x) == sizeof(unsigned int))   ? T_UINT : \
-        ((sizeof(x) == sizeof(unsigned long))  ? T_ULONG : -1))))
-#else
-#define __Pyx_T_UNSIGNED_INT(x) \
-        ((sizeof(x) == sizeof(unsigned char))  ? T_UBYTE : \
-        ((sizeof(x) == sizeof(unsigned short)) ? T_USHORT : \
-        ((sizeof(x) == sizeof(unsigned int))   ? T_UINT : \
-        ((sizeof(x) == sizeof(unsigned long))  ? T_ULONG : \
-        ((sizeof(x) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1)))))
-#endif
-#if !defined(T_LONGLONG)
-#define __Pyx_T_SIGNED_INT(x) \
-        ((sizeof(x) == sizeof(char))  ? T_BYTE : \
-        ((sizeof(x) == sizeof(short)) ? T_SHORT : \
-        ((sizeof(x) == sizeof(int))   ? T_INT : \
-        ((sizeof(x) == sizeof(long))  ? T_LONG : -1))))
-#else
-#define __Pyx_T_SIGNED_INT(x) \
-        ((sizeof(x) == sizeof(char))  ? T_BYTE : \
-        ((sizeof(x) == sizeof(short)) ? T_SHORT : \
-        ((sizeof(x) == sizeof(int))   ? T_INT : \
-        ((sizeof(x) == sizeof(long))  ? T_LONG : \
-        ((sizeof(x) == sizeof(PY_LONG_LONG))   ? T_LONGLONG : -1)))))
-#endif
-
-#define __Pyx_T_FLOATING(x) \
-        ((sizeof(x) == sizeof(float)) ? T_FLOAT : \
-        ((sizeof(x) == sizeof(double)) ? T_DOUBLE : -1))
-
-#if !defined(T_SIZET)
-#if !defined(T_ULONGLONG)
-#define T_SIZET \
-        ((sizeof(size_t) == sizeof(unsigned int))  ? T_UINT  : \
-        ((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG : -1))
-#else
-#define T_SIZET \
-        ((sizeof(size_t) == sizeof(unsigned int))          ? T_UINT      : \
-        ((sizeof(size_t) == sizeof(unsigned long))         ? T_ULONG     : \
-        ((sizeof(size_t) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1)))
-#endif
-#endif
-
 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
 static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*);
 
 
 #ifdef __GNUC__
-/* Test for GCC > 2.95 */
-#if __GNUC__ > 2 ||               (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) 
-#define likely(x)   __builtin_expect(!!(x), 1)
-#define unlikely(x) __builtin_expect(!!(x), 0)
-#else /* __GNUC__ > 2 ... */
-#define likely(x)   (x)
-#define unlikely(x) (x)
-#endif /* __GNUC__ > 2 ... */
+  /* Test for GCC > 2.95 */
+  #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
+    #define likely(x)   __builtin_expect(!!(x), 1)
+    #define unlikely(x) __builtin_expect(!!(x), 0)
+  #else /* __GNUC__ > 2 ... */
+    #define likely(x)   (x)
+    #define unlikely(x) (x)
+  #endif /* __GNUC__ > 2 ... */
 #else /* __GNUC__ */
-#define likely(x)   (x)
-#define unlikely(x) (x)
+  #define likely(x)   (x)
+  #define unlikely(x) (x)
 #endif /* __GNUC__ */
     
 static PyObject *__pyx_m;
 static int __pyx_clineno = 0;
 static const char * __pyx_cfilenm= __FILE__;
 static const char *__pyx_filename;
-static const char **__pyx_f;
-
-
+
+
+static const char *__pyx_f[] = {
+  "ffvideo.pyx",
+};
+
+/* "ffmpeg.pxd":1
+ * ctypedef signed long long int64_t             # <<<<<<<<<<<<<<
+ * ctypedef unsigned char uint8_t
+ * 
+ */
 typedef signed PY_LONG_LONG __pyx_t_6ffmpeg_int64_t;
 
+/* "ffmpeg.pxd":2
+ * ctypedef signed long long int64_t
+ * ctypedef unsigned char uint8_t             # <<<<<<<<<<<<<<
+ * 
+ * cdef enum:
+ */
 typedef unsigned char __pyx_t_6ffmpeg_uint8_t;
 
-/* Type declarations */
-
-/* "/home/zakhar/workspace/ffvideo/src/ffvideo/ffmpeg.pxd":4
+/*--- Type declarations ---*/
+struct __pyx_obj_7ffvideo_VideoStream;
+struct __pyx_obj_7ffvideo_VideoFrame;
+
+/* "ffmpeg.pxd":4
  * ctypedef unsigned char uint8_t
  * 
  * cdef enum:             # <<<<<<<<<<<<<<
  *     SEEK_SET = 0
  *     SEEK_CUR = 1
  */
-
 enum  {
   __pyx_e_6ffmpeg_SEEK_SET = 0,
   __pyx_e_6ffmpeg_SEEK_CUR = 1,
   __pyx_e_6ffmpeg_SEEK_END = 2
 };
 
-/* "/home/zakhar/workspace/ffvideo/src/ffvideo/ffvideo.pyx":53
+/* "ffvideo.pyx":53
  * }
  * 
  * cdef class VideoStream:             # <<<<<<<<<<<<<<
  *     """Class represents video stream"""
  * 
  */
-
 struct __pyx_obj_7ffvideo_VideoStream {
   PyObject_HEAD
   struct AVFormatContext *format_ctx;
   int scale_mode;
 };
 
-/* "/home/zakhar/workspace/ffvideo/src/ffvideo/ffvideo.pyx":354
+
+/* "ffvideo.pyx":352
  * 
  * 
  * cdef class VideoFrame:             # <<<<<<<<<<<<<<
  *     cdef readonly int width
  *     cdef readonly int height
  */
-
 struct __pyx_obj_7ffvideo_VideoFrame {
   PyObject_HEAD
   int width;
   PyObject *data;
 };
 
+
 #ifndef CYTHON_REFNANNY
   #define CYTHON_REFNANNY 0
 #endif
     void (*FinishContext)(void**);
   } __Pyx_RefNannyAPIStruct;
   static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
-  static __Pyx_RefNannyAPIStruct * __Pyx_RefNannyImportAPI(const char *modname) {
-    PyObject *m = NULL, *p = NULL;
-    void *r = NULL;
-    m = PyImport_ImportModule((char *)modname);
-    if (!m) goto end;
-    p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
-    if (!p) goto end;
-    r = PyLong_AsVoidPtr(p);
-  end:
-    Py_XDECREF(p);
-    Py_XDECREF(m);
-    return (__Pyx_RefNannyAPIStruct *)r;
-  }
-  #define __Pyx_RefNannySetupContext(name)           void *__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
+  static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/
+  #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
+  #define __Pyx_RefNannySetupContext(name)           __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
   #define __Pyx_RefNannyFinishContext()           __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
-  #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
-  #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
-  #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
+  #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
+  #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
+  #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
   #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
-  #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r);} } while(0)
+  #define __Pyx_XINCREF(r)  do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
+  #define __Pyx_XDECREF(r)  do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
+  #define __Pyx_XGOTREF(r)  do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
+  #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
 #else
+  #define __Pyx_RefNannyDeclarations
   #define __Pyx_RefNannySetupContext(name)
   #define __Pyx_RefNannyFinishContext()
   #define __Pyx_INCREF(r) Py_INCREF(r)
   #define __Pyx_DECREF(r) Py_DECREF(r)
   #define __Pyx_GOTREF(r)
   #define __Pyx_GIVEREF(r)
+  #define __Pyx_XINCREF(r) Py_XINCREF(r)
   #define __Pyx_XDECREF(r) Py_XDECREF(r)
+  #define __Pyx_XGOTREF(r)
+  #define __Pyx_XGIVEREF(r)
 #endif /* CYTHON_REFNANNY */
-#define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);} } while(0)
-#define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r);} } while(0)
-
-static CYTHON_INLINE long __Pyx_NegateNonNeg(long b) { return unlikely(b < 0) ? b : !b; }
+
+static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
+
+static CYTHON_INLINE int __Pyx_NegateNonNeg(int b) { 
+    return unlikely(b < 0) ? b : !b; 
+}
 static CYTHON_INLINE PyObject* __Pyx_PyBoolOrNull_FromLong(long b) {
     return unlikely(b < 0) ? NULL : __Pyx_PyBool_FromLong(b);
 }
 
+static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
+static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
+
+static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/
+
 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
 
-static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(void);
-
-static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/
-static int __Pyx_EndUnpack(PyObject *); /*proto*/
+static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
+
+static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/
 
 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
 
 static void __Pyx_RaiseDoubleKeywordsError(
     const char* func_name, PyObject* kw_name); /*proto*/
 
+static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],     PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,     const char* function_name); /*proto*/
+
 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
     Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/
 
-static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],     PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,     const char* function_name); /*proto*/
+static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);
 
 static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
 static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
 
-static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
-
-static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name, const char *modname); /*proto*/
-
-static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
-static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
-
-static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
-
-static int __Pyx_Print(PyObject *, int); /*proto*/
+static PyObject *__Pyx_FindPy2Metaclass(PyObject *bases); /*proto*/
+
+static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name,
+                                   PyObject *modname); /*proto*/
+
+#include <string.h>
+
+static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/
+
+static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/
+
+#if PY_MAJOR_VERSION >= 3
+#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
+#else
+#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
+#endif
+
+static int __Pyx_Print(PyObject*, PyObject *, int); /*proto*/
 #if PY_MAJOR_VERSION >= 3
 static PyObject* __pyx_print = 0;
 static PyObject* __pyx_print_kwargs = 0;
 #endif
 
-static int __Pyx_PrintOne(PyObject *o); /*proto*/
+static int __Pyx_PrintOne(PyObject* stream, PyObject *o); /*proto*/
 
 #ifndef __PYX_FORCE_INIT_THREADS
   #if PY_VERSION_HEX < 0x02040200
   #endif
 #endif
 
-static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/
+static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/
 
 static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *);
 
 
 static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *);
 
+static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *);
+
 static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *);
 
 static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *);
 
 static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *);
 
-static void __Pyx_AddTraceback(const char *funcname); /*proto*/
+static int __Pyx_check_binary_version(void);
+
+static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno,
+                               int __pyx_lineno, const char *__pyx_filename); /*proto*/
 
 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
-/* Module declarations from ffmpeg */
-
-/* Module declarations from ffvideo */
-
+
+/* Module declarations from 'ffmpeg' */
+
+/* Module declarations from 'ffvideo' */
 static PyTypeObject *__pyx_ptype_7ffvideo_VideoStream = 0;
 static PyTypeObject *__pyx_ptype_7ffvideo_VideoFrame = 0;
 #define __Pyx_MODULE_NAME "ffvideo"
 int __pyx_module_is_main_ffvideo = 0;
 
-/* Implementation of ffvideo */
+/* Implementation of 'ffvideo' */
 static PyObject *__pyx_builtin_Exception;
 static PyObject *__pyx_builtin_ValueError;
 static PyObject *__pyx_builtin_StopIteration;
 static PyObject *__pyx_builtin_MemoryError;
 static PyObject *__pyx_builtin_ImportError;
 static char __pyx_k_1[] = "Not supported frame mode";
-static char __pyx_k_2[] = "frame_size must be a tuple (int, int)";
-static char __pyx_k_3[] = "both width and height cannot be None";
-static char __pyx_k_6[] = "Unable to open file %s";
-static char __pyx_k_7[] = "Unable to find stream info: %d";
-static char __pyx_k_8[] = "Unable to find video stream";
-static char __pyx_k_9[] = "Unable to get decoder";
-static char __pyx_k_10[] = "Unable to open codec";
-static char __pyx_k_11[] = "Video width/height is 0; cannot decode";
-static char __pyx_k_12[] = "max_b_frames=%s";
-static char __pyx_k_13[] = "Unable to read frame. [%d]";
-static char __pyx_k_14[] = "Unable to decode video picture: %d";
-static char __pyx_k_15[] = "display_picture_number";
-static char __pyx_k_16[] = "pts=%d, frameno=%d";
-static char __pyx_k_17[] = "f.pts=%s, ";
-static char __pyx_k_18[] = "codec_ctx.frame_number=%s";
-static char __pyx_k_19[] = "f.coded_picture_number=%s, f.display_picture_number=%s";
-static char __pyx_k_20[] = "coded_picture_number";
-static char __pyx_k_21[] = "Unable to allocate new frame";
-static char __pyx_k_22[] = "Unable to seek: %d";
-static char __pyx_k_23[] = "Unable to rewind: %d";
-static char __pyx_k_24[] = "<VideoStream '%s':%.4f>";
-static char __pyx_k_25[] = "Cannot represent this color mode into PIL Image";
+static char __pyx_k_3[] = "frame_size must be a tuple (int, int)";
+static char __pyx_k_5[] = "both width and height cannot be None";
+static char __pyx_k_9[] = "Unable to open file %s";
+static char __pyx_k_10[] = "Unable to find stream info: %d";
+static char __pyx_k_11[] = "Unable to find video stream";
+static char __pyx_k_13[] = "Unable to get decoder";
+static char __pyx_k_15[] = "Unable to open codec";
+static char __pyx_k_17[] = "Video width/height is 0; cannot decode";
+static char __pyx_k_19[] = "max_b_frames=%s";
+static char __pyx_k_20[] = "Unable to read frame. [%d]";
+static char __pyx_k_21[] = "Unable to decode video picture: %d";
+static char __pyx_k_22[] = "pts=%d, frameno=%d";
+static char __pyx_k_23[] = "f.pts=%s, ";
+static char __pyx_k_24[] = "codec_ctx.frame_number=%s";
+static char __pyx_k_25[] = "f.coded_picture_number=%s, f.display_picture_number=%s";
+static char __pyx_k_26[] = "Unable to allocate new frame";
+static char __pyx_k_28[] = "Unable to seek: %d";
+static char __pyx_k_29[] = "Unable to rewind: %d";
+static char __pyx_k_30[] = "<VideoStream '%s':%.4f>";
+static char __pyx_k_31[] = "Cannot represent this color mode into PIL Image";
 static char __pyx_k__F[] = "F";
 static char __pyx_k__L[] = "L";
 static char __pyx_k__PIL[] = "PIL";
 static char __pyx_k__RGB[] = "RGB";
 static char __pyx_k__den[] = "den";
-static char __pyx_k__dts[] = "dts";
 static char __pyx_k__num[] = "num";
-static char __pyx_k__pts[] = "pts";
 static char __pyx_k__raw[] = "raw";
 static char __pyx_k__data[] = "data";
 static char __pyx_k__mode[] = "mode";
-static char __pyx_k__name[] = "name";
 static char __pyx_k__size[] = "size";
 static char __pyx_k__Image[] = "Image";
-static char __pyx_k__codec[] = "codec";
 static char __pyx_k__dtype[] = "dtype";
-static char __pyx_k__flags[] = "flags";
-static char __pyx_k__frame[] = "frame";
 static char __pyx_k__numpy[] = "numpy";
 static char __pyx_k__range[] = "range";
 static char __pyx_k__round[] = "round";
 static char __pyx_k__shape[] = "shape";
 static char __pyx_k__uint8[] = "uint8";
-static char __pyx_k__width[] = "width";
 static char __pyx_k__buffer[] = "buffer";
-static char __pyx_k__height[] = "height";
-static char __pyx_k__packet[] = "packet";
-static char __pyx_k__stream[] = "stream";
 static char __pyx_k__xrange[] = "xrange";
 static char __pyx_k__BICUBIC[] = "BICUBIC";
 static char __pyx_k__IOError[] = "IOError";
 static char __pyx_k__YUV420P[] = "YUV420P";
 static char __pyx_k__current[] = "current";
+static char __pyx_k__ffvideo[] = "ffvideo";
 static char __pyx_k__frameno[] = "frameno";
 static char __pyx_k__ndarray[] = "ndarray";
-static char __pyx_k__pix_fmt[] = "pix_fmt";
-static char __pyx_k__streams[] = "streams";
 static char __pyx_k__BILINEAR[] = "BILINEAR";
 static char __pyx_k____main__[] = "__main__";
-static char __pyx_k__codec_id[] = "codec_id";
-static char __pyx_k__duration[] = "duration";
+static char __pyx_k____test__[] = "__test__";
 static char __pyx_k__filename[] = "filename";
-static char __pyx_k__linesize[] = "linesize";
-static char __pyx_k__streamno[] = "streamno";
 static char __pyx_k__Exception[] = "Exception";
 static char __pyx_k__TypeError[] = "TypeError";
-static char __pyx_k__codec_ctx[] = "codec_ctx";
-static char __pyx_k__framerate[] = "framerate";
-static char __pyx_k__skip_idct[] = "skip_idct";
-static char __pyx_k__time_base[] = "time_base";
 static char __pyx_k__timestamp[] = "timestamp";
 static char __pyx_k__NoMoreData[] = "NoMoreData";
 static char __pyx_k__ValueError[] = "ValueError";
-static char __pyx_k__codec_name[] = "codec_name";
-static char __pyx_k__codec_type[] = "codec_type";
-static char __pyx_k__format_ctx[] = "format_ctx";
 static char __pyx_k__frame_mode[] = "frame_mode";
 static char __pyx_k__frame_size[] = "frame_size";
 static char __pyx_k__frombuffer[] = "frombuffer";
-static char __pyx_k__nb_streams[] = "nb_streams";
 static char __pyx_k__scale_mode[] = "scale_mode";
-static char __pyx_k__skip_frame[] = "skip_frame";
-static char __pyx_k__start_time[] = "start_time";
 static char __pyx_k__FRAME_MODES[] = "FRAME_MODES";
 static char __pyx_k__ImportError[] = "ImportError";
 static char __pyx_k__MemoryError[] = "MemoryError";
-static char __pyx_k__frame_width[] = "frame_width";
 static char __pyx_k__DecoderError[] = "DecoderError";
 static char __pyx_k__FFVideoError[] = "FFVideoError";
-static char __pyx_k____frame_mode[] = "__frame_mode";
-static char __pyx_k__frame_height[] = "frame_height";
-static char __pyx_k__frame_number[] = "frame_number";
 static char __pyx_k__get_frame_no[] = "get_frame_no";
-static char __pyx_k__max_b_frames[] = "max_b_frames";
-static char __pyx_k__r_frame_rate[] = "r_frame_rate";
-static char __pyx_k__stream_index[] = "stream_index";
 static char __pyx_k__FAST_BILINEAR[] = "FAST_BILINEAR";
 static char __pyx_k__StopIteration[] = "StopIteration";
 static char __pyx_k__get_frame_at_pts[] = "get_frame_at_pts";
 static char __pyx_k__FFVideoValueError[] = "FFVideoValueError";
-static char __pyx_k__ffmpeg_frame_mode[] = "ffmpeg_frame_mode";
 static char __pyx_k____decode_next_frame[] = "__decode_next_frame";
 static PyObject *__pyx_kp_s_1;
 static PyObject *__pyx_kp_s_10;
 static PyObject *__pyx_kp_s_11;
-static PyObject *__pyx_kp_s_12;
 static PyObject *__pyx_kp_s_13;
-static PyObject *__pyx_kp_s_14;
-static PyObject *__pyx_n_s_15;
-static PyObject *__pyx_kp_s_16;
+static PyObject *__pyx_kp_s_15;
 static PyObject *__pyx_kp_s_17;
-static PyObject *__pyx_kp_s_18;
 static PyObject *__pyx_kp_s_19;
-static PyObject *__pyx_kp_s_2;
-static PyObject *__pyx_n_s_20;
+static PyObject *__pyx_kp_s_20;
 static PyObject *__pyx_kp_s_21;
 static PyObject *__pyx_kp_s_22;
 static PyObject *__pyx_kp_s_23;
 static PyObject *__pyx_kp_s_24;
 static PyObject *__pyx_kp_s_25;
+static PyObject *__pyx_kp_s_26;
+static PyObject *__pyx_kp_s_28;
+static PyObject *__pyx_kp_s_29;
 static PyObject *__pyx_kp_s_3;
-static PyObject *__pyx_kp_s_6;
-static PyObject *__pyx_kp_s_7;
-static PyObject *__pyx_kp_s_8;
+static PyObject *__pyx_kp_s_30;
+static PyObject *__pyx_kp_s_31;
+static PyObject *__pyx_kp_s_5;
 static PyObject *__pyx_kp_s_9;
 static PyObject *__pyx_n_s__BICUBIC;
 static PyObject *__pyx_n_s__BILINEAR;
 static PyObject *__pyx_n_s__ValueError;
 static PyObject *__pyx_n_s__YUV420P;
 static PyObject *__pyx_n_s____decode_next_frame;
-static PyObject *__pyx_n_s____frame_mode;
 static PyObject *__pyx_n_s____main__;
+static PyObject *__pyx_n_s____test__;
 static PyObject *__pyx_n_s__buffer;
-static PyObject *__pyx_n_s__codec;
-static PyObject *__pyx_n_s__codec_ctx;
-static PyObject *__pyx_n_s__codec_id;
-static PyObject *__pyx_n_s__codec_name;
-static PyObject *__pyx_n_s__codec_type;
 static PyObject *__pyx_n_s__current;
 static PyObject *__pyx_n_s__data;
 static PyObject *__pyx_n_s__den;
-static PyObject *__pyx_n_s__dts;
 static PyObject *__pyx_n_s__dtype;
-static PyObject *__pyx_n_s__duration;
-static PyObject *__pyx_n_s__ffmpeg_frame_mode;
+static PyObject *__pyx_n_s__ffvideo;
 static PyObject *__pyx_n_s__filename;
-static PyObject *__pyx_n_s__flags;
-static PyObject *__pyx_n_s__format_ctx;
-static PyObject *__pyx_n_s__frame;
-static PyObject *__pyx_n_s__frame_height;
 static PyObject *__pyx_n_s__frame_mode;
-static PyObject *__pyx_n_s__frame_number;
 static PyObject *__pyx_n_s__frame_size;
-static PyObject *__pyx_n_s__frame_width;
 static PyObject *__pyx_n_s__frameno;
-static PyObject *__pyx_n_s__framerate;
 static PyObject *__pyx_n_s__frombuffer;
 static PyObject *__pyx_n_s__get_frame_at_pts;
 static PyObject *__pyx_n_s__get_frame_no;
-static PyObject *__pyx_n_s__height;
-static PyObject *__pyx_n_s__linesize;
-static PyObject *__pyx_n_s__max_b_frames;
 static PyObject *__pyx_n_s__mode;
-static PyObject *__pyx_n_s__name;
-static PyObject *__pyx_n_s__nb_streams;
 static PyObject *__pyx_n_s__ndarray;
 static PyObject *__pyx_n_s__num;
 static PyObject *__pyx_n_s__numpy;
-static PyObject *__pyx_n_s__packet;
-static PyObject *__pyx_n_s__pix_fmt;
-static PyObject *__pyx_n_s__pts;
-static PyObject *__pyx_n_s__r_frame_rate;
 static PyObject *__pyx_n_s__range;
 static PyObject *__pyx_n_s__raw;
 static PyObject *__pyx_n_s__round;
 static PyObject *__pyx_n_s__scale_mode;
 static PyObject *__pyx_n_s__shape;
 static PyObject *__pyx_n_s__size;
-static PyObject *__pyx_n_s__skip_frame;
-static PyObject *__pyx_n_s__skip_idct;
-static PyObject *__pyx_n_s__start_time;
-static PyObject *__pyx_n_s__stream;
-static PyObject *__pyx_n_s__stream_index;
-static PyObject *__pyx_n_s__streamno;
-static PyObject *__pyx_n_s__streams;
-static PyObject *__pyx_n_s__time_base;
 static PyObject *__pyx_n_s__timestamp;
 static PyObject *__pyx_n_s__uint8;
-static PyObject *__pyx_n_s__width;
 static PyObject *__pyx_n_s__xrange;
 static PyObject *__pyx_int_0;
 static PyObject *__pyx_int_1;
 static PyObject *__pyx_int_2;
 static PyObject *__pyx_int_3;
-static PyObject *__pyx_k_4;
-static PyObject *__pyx_k_5;
-
-/* "/home/zakhar/workspace/ffvideo/src/ffvideo/ffvideo.pyx":86
+static PyObject *__pyx_k_7;
+static PyObject *__pyx_k_8;
+static PyObject *__pyx_k_tuple_2;
+static PyObject *__pyx_k_tuple_4;
+static PyObject *__pyx_k_tuple_6;
+static PyObject *__pyx_k_tuple_12;
+static PyObject *__pyx_k_tuple_14;
+static PyObject *__pyx_k_tuple_16;
+static PyObject *__pyx_k_tuple_18;
+static PyObject *__pyx_k_tuple_27;
+static PyObject *__pyx_k_tuple_32;
+static PyObject *__pyx_k_tuple_33;
+
+/* "ffvideo.pyx":86
  * 
  *     property frame_mode:
  *         def __set__(self, mode):             # <<<<<<<<<<<<<<
 static int __pyx_pf_7ffvideo_11VideoStream_10frame_mode___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_mode); /*proto*/
 static int __pyx_pf_7ffvideo_11VideoStream_10frame_mode___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_mode) {
   int __pyx_r;
+  __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
   int __pyx_t_2;
   PyObject *__pyx_t_3 = NULL;
-  PyObject *__pyx_t_4 = NULL;
-  int __pyx_t_5;
+  int __pyx_t_4;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__set__");
-  __Pyx_INCREF((PyObject *)__pyx_v_self);
-  __Pyx_INCREF(__pyx_v_mode);
-
-  /* "/home/zakhar/workspace/ffvideo/src/ffvideo/ffvideo.pyx":87
+
+  /* "ffvideo.pyx":87
  *     property frame_mode:
  *         def __set__(self, mode):
  *             if mode not in FRAME_MODES:             # <<<<<<<<<<<<<<
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   if (__pyx_t_2) {
 
-    /* "/home/zakhar/workspace/ffvideo/src/ffvideo/ffvideo.pyx":88
+    /* "ffvideo.pyx":88
  *         def __set__(self, mode):
  *             if mode not in FRAME_MODES:
  *                 raise FFVideoValueError("Not supported frame mode")             # <<<<<<<<<<<<<<
  */
     __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__FFVideoValueError); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_1);
-    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_1));
-    PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_1));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1));
-    __pyx_t_4 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_4);
     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __Pyx_Raise(__pyx_t_3, 0, 0, 0);
     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __Pyx_Raise(__pyx_t_4, 0, 0);
-    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
     goto __pyx_L5;
   }
   __pyx_L5:;
 
-  /* "/home/zakhar/workspace/ffvideo/src/ffvideo/ffvideo.pyx":89
+  /* "ffvideo.pyx":89
  *             if mode not in FRAME_MODES:
  *                 raise FFVideoValueError("Not supported frame mode")
  *             self.__frame_mode = mode             # <<<<<<<<<<<<<<
   __Pyx_DECREF(((struct __pyx_obj_7ffvideo_VideoStream *)__pyx_v_self)->__pyx___frame_mode);
   ((struct __pyx_obj_7ffvideo_VideoStream *)__pyx_v_self)->__pyx___frame_mode = __pyx_v_mode;
 
-  /* "/home/zakhar/workspace/ffvideo/src/ffvideo/ffvideo.pyx":90
+  /* "ffvideo.pyx":90
  *                 raise FFVideoValueError("Not supported frame mode")
  *             self.__frame_mode = mode
  *             self.ffmpeg_frame_mode = FRAME_MODES[mode]             # <<<<<<<<<<<<<<
  * 
  *         def __get__(self):
  */
-  __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__FRAME_MODES); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_3 = PyObject_GetItem(__pyx_t_4, __pyx_v_mode); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__FRAME_MODES); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_3);
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
-  __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetItem(__pyx_t_3, __pyx_v_mode); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_1);
   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-  ((struct __pyx_obj_7ffvideo_VideoStream *)__pyx_v_self)->ffmpeg_frame_mode = __pyx_t_5;
+  __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  ((struct __pyx_obj_7ffvideo_VideoStream *)__pyx_v_self)->ffmpeg_frame_mode = __pyx_t_4;
 
   __pyx_r = 0;
   goto __pyx_L0;
   __pyx_L1_error:;
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_3);
-  __Pyx_XDECREF(__pyx_t_4);
-  __Pyx_AddTraceback("ffvideo.VideoStream.frame_mode.__set__");
+  __Pyx_AddTraceback("ffvideo.VideoStream.frame_mode.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = -1;
   __pyx_L0:;
-  __Pyx_DECREF((PyObject *)__pyx_v_self);
-  __Pyx_DECREF(__pyx_v_mode);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "/home/zakhar/workspace/ffvideo/src/ffvideo/ffvideo.pyx":92
+/* "ffvideo.pyx":92
  *             self.ffmpeg_frame_mode = FRAME_MODES[mode]
  * 
  *         def __get__(self):             # <<<<<<<<<<<<<<
  * 
  */
 
-static PyObject *__pyx_pf_7ffvideo_11VideoStream_10frame_mode___get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pf_7ffvideo_11VideoStream_10frame_mode___get__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pf_7ffvideo_11VideoStream_10frame_mode_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_7ffvideo_11VideoStream_10frame_mode_1__get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
+  __Pyx_RefNannyDeclarations
   __Pyx_RefNannySetupContext("__get__");
 
-  /* "/home/zakhar/workspace/ffvideo/src/ffvideo/ffvideo.pyx":93
+  /* "ffvideo.pyx":93
  * 
  *         def __get__(self):
  *             return self.__frame_mode             # <<<<<<<<<<<<<<
   return __pyx_r;
 }
 
-/* "/home/zakhar/workspace/ffvideo/src/ffvideo/ffvideo.pyx":96
+/* "ffvideo.pyx":96
  * 
  *     property frame_size:
  *         def __set__(self, size):             # <<<<<<<<<<<<<<
 
 static int __pyx_pf_7ffvideo_11VideoStream_10frame_size___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_size); /*proto*/
 static int __pyx_pf_7ffvideo_11VideoStream_10frame_size___set__(PyObject *__pyx_v_self, PyObject *__pyx_v_size) {
-  PyObject *__pyx_v_fw;
-  PyObject *__pyx_v_fh;
-  PyObject *__pyx_v_e;
+  PyObject *__pyx_v_fw = NULL;
+  PyObject *__pyx_v_fh = NULL;
+  PyObject *__pyx_v_e = NULL;
   int __pyx_r;
+  __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
   PyObject *__pyx_t_2 = NULL;
   PyObject *__pyx_t_3 = NULL;
-  int __pyx_t_4;
+  PyObject *__pyx_t_4 = NULL;
   PyObject *__pyx_t_5 = NULL;
   PyObject *__pyx_t_6 = NULL;
-  PyObject *__pyx_t_7 = NULL;
+  PyObject *(*__pyx_t_7)(PyObject *);
   int __pyx_t_8;
-  int __pyx_t_9;
-  int __pyx_t_10;
+  PyObject *__pyx_t_9 = NULL;
+  PyObject *__pyx_t_10 = NULL;
+  int __pyx_t_11;
+  int __pyx_t_12;
+  int __pyx_t_13;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__set__");
-  __Pyx_INCREF((PyObject *)__pyx_v_self);
-  __Pyx_INCREF(__pyx_v_size);
-  __pyx_v_fw = Py_None; __Pyx_INCREF(Py_None);
-  __pyx_v_fh = Py_None; __Pyx_INCREF(Py_None);
-  __pyx_v_e = Py_None; __Pyx_INCREF(Py_None);
-
-  /* "/home/zakhar/workspace/ffvideo/src/ffvideo/ffvideo.pyx":97
+
+  /* "ffvideo.pyx":97
  *     property frame_size:
  *         def __set__(self, size):
  *             try:             # <<<<<<<<<<<<<<
  *             except (TypeError, ValueError), e:
  */
   {
-    PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb;
-    __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb);
-    __Pyx_XGOTREF(__pyx_save_exc_type);
-    __Pyx_XGOTREF(__pyx_save_exc_value);
-    __Pyx_XGOTREF(__pyx_save_exc_tb);
+    __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
+    __Pyx_XGOTREF(__pyx_t_1);
+    __Pyx_XGOTREF(__pyx_t_2);
+    __Pyx_XGOTREF(__pyx_t_3);
     /*try:*/ {
 
-      /* "/home/zakhar/workspace/ffvideo/src/ffvideo/ffvideo.pyx":98
+      /* "ffvideo.pyx":98
  *         def __set__(self, size):
  *             try:
  *                 fw, fh = size             # <<<<<<<<<<<<<<
  *             except (TypeError, ValueError), e:
  *                 raise FFVideoValueError("frame_size must be a tuple (int, int)")
  */
-      if (PyTuple_CheckExact(__pyx_v_size) && likely(PyTuple_GET_SIZE(__pyx_v_size) == 2)) {
-        PyObject* tuple = __pyx_v_size;
-        __pyx_t_1 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_1);
-        __pyx_t_2 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_2);
-        __Pyx_DECREF(__pyx_v_fw);
-        __pyx_v_fw = __pyx_t_1;
-        __pyx_t_1 = 0;
-        __Pyx_DECREF(__pyx_v_fh);
-        __pyx_v_fh = __pyx_t_2;
-        __pyx_t_2 = 0;
+      if ((likely(PyTuple_CheckExact(__pyx_v_size))) || (PyList_CheckExact(__pyx_v_size))) {
+        PyObject* sequence = __pyx_v_size;
+        if (likely(PyTuple_CheckExact(sequence))) {
+          if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) {
+            if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
+            else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence));
+            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
+          }
+          __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); 
+          __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); 
+        } else {
+          if (unlikely(PyList_GET_SIZE(sequence) != 2)) {
+            if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2);
+            else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence));
+            {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
+          }
+          __pyx_t_4 = PyList_GET_ITEM(sequence, 0); 
+          __pyx_t_5 = PyList_GET_ITEM(sequence, 1); 
+        }
+        __Pyx_INCREF(__pyx_t_4);
+        __Pyx_INCREF(__pyx_t_5);
       } else {
-        __pyx_t_3 = PyObject_GetIter(__pyx_v_size); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
-        __Pyx_GOTREF(__pyx_t_3);
-        __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_3, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
-        __Pyx_GOTREF(__pyx_t_1);
-        __pyx_t_2 = __Pyx_UnpackItem(__pyx_t_3, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
-        __Pyx_GOTREF(__pyx_t_2);
-        if (__Pyx_EndUnpack(__pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
-        __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
-        __Pyx_DECREF(__pyx_v_fw);
-        __pyx_v_fw = __pyx_t_1;
-        __pyx_t_1 = 0;
-        __Pyx_DECREF(__pyx_v_fh);
-        __pyx_v_fh = __pyx_t_2;
-        __pyx_t_2 = 0;
+        Py_ssize_t index = -1;
+        __pyx_t_6 = PyObject_GetIter(__pyx_v_size); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
+        __Pyx_GOTREF(__pyx_t_6);
+        __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext;
+        index = 0; __pyx_t_4 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_4)) goto __pyx_L13_unpacking_failed;
+        __Pyx_GOTREF(__pyx_t_4);
+        index = 1; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L13_unpacking_failed;
+        __Pyx_GOTREF(__pyx_t_5);
+        if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
+        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+        goto __pyx_L14_unpacking_done;
+        __pyx_L13_unpacking_failed:;
+        __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+        if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear();
+        if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index);
+        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L5_error;}
+        __pyx_L14_unpacking_done:;
       }
+      __pyx_v_fw = __pyx_t_4;
+      __pyx_t_4 = 0;
+      __pyx_v_fh = __pyx_t_5;
+      __pyx_t_5 = 0;
     }
-    __Pyx_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0;
-    __Pyx_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0;
-    __Pyx_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0;
+    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
+    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
     goto __pyx_L12_try_end;
     __pyx_L5_error:;
-    __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
-    __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
-
-    /* "/home/zakhar/workspace/ffvideo/src/ffvideo/ffvideo.pyx":99
+    __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
+
+    /* "ffvideo.pyx":99
  *             try:
  *                 fw, fh = size
  *             except (TypeError, ValueError), e:             # <<<<<<<<<<<<<<
  *                 raise FFVideoValueError("frame_size must be a tuple (int, int)")
  *             if fw is None and fh is None:
  */
-    __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_INCREF(__pyx_builtin_TypeError);
-    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_builtin_TypeError);
-    __Pyx_GIVEREF(__pyx_builtin_TypeError);
-    __Pyx_INCREF(__pyx_builtin_ValueError);
-    PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_builtin_ValueError);
-    __Pyx_GIVEREF(__pyx_builtin_ValueError);
-    __pyx_t_4 = PyErr_ExceptionMatches(__pyx_t_2);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    if (__pyx_t_4) {
-      __Pyx_AddTraceback("ffvideo.VideoStream.frame_size.__set__");
-      if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
-      __Pyx_GOTREF(__pyx_t_2);
-      __Pyx_GOTREF(__pyx_t_1);
-      __Pyx_GOTREF(__pyx_t_3);
-      __Pyx_INCREF(__pyx_t_1);
-      __Pyx_DECREF(__pyx_v_e);
-      __pyx_v_e = __pyx_t_1;
-
-      /* "/home/zakhar/workspace/ffvideo/src/ffvideo/ffvideo.pyx":100
+    __pyx_t_8 = PyErr_ExceptionMatches(__pyx_builtin_TypeError) || PyErr_ExceptionMatches(__pyx_builtin_ValueError);
+    if (__pyx_t_8) {
+      __Pyx_AddTraceback("ffvideo.VideoStream.frame_size.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+      if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_4, &__pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
+      __Pyx_GOTREF(__pyx_t_5);
+      __Pyx_GOTREF(__pyx_t_4);
+      __Pyx_GOTREF(__pyx_t_6);
+      __Pyx_INCREF(__pyx_t_4);
+      __pyx_v_e = __pyx_t_4;
+
+      /* "ffvideo.pyx":100
  *                 fw, fh = size
  *             except (TypeError, ValueError), e:
  *                 raise FFVideoValueError("frame_size must be a tuple (int, int)")             # <<<<<<<<<<<<<<
  *             if fw is None and fh is None:
  *                 raise FFVideoValueError("both width and height cannot be None")
  */
-      __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__FFVideoValueError); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
-      __Pyx_GOTREF(__pyx_t_5);
-      __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
-      __Pyx_GOTREF(__pyx_t_6);
-      __Pyx_INCREF(((PyObject *)__pyx_kp_s_2));
-      PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_kp_s_2));
-      __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_2));
-      __pyx_t_7 = PyObject_Call(__pyx_t_5, __pyx_t_6, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
-      __Pyx_GOTREF(__pyx_t_7);
+      __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__FFVideoValueError); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
+      __Pyx_GOTREF(__pyx_t_9);
+      __pyx_t_10 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
+      __Pyx_GOTREF(__pyx_t_10);
+      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
+      __Pyx_Raise(__pyx_t_10, 0, 0, 0);
+      __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
       __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
       __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
-      __Pyx_Raise(__pyx_t_7, 0, 0);
-      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L7_except_error;}
-      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
       goto __pyx_L6_exception_handled;
     }
     __pyx_L7_except_error:;
-    __Pyx_XGIVEREF(__pyx_save_exc_type);
-    __Pyx_XGIVEREF(__pyx_save_exc_value);
-    __Pyx_XGIVEREF(__pyx_save_exc_tb);
-    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
+    __Pyx_XGIVEREF(__pyx_t_1);
+    __Pyx_XGIVEREF(__pyx_t_2);
+    __Pyx_XGIVEREF(__pyx_t_3);
+    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
     goto __pyx_L1_error;
     __pyx_L6_exception_handled:;
-    __Pyx_XGIVEREF(__pyx_save_exc_type);
-    __Pyx_XGIVEREF(__pyx_save_exc_value);
-    __Pyx_XGIVEREF(__pyx_save_exc_tb);
-    __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb);
+    __Pyx_XGIVEREF(__pyx_t_1);
+    __Pyx_XGIVEREF(__pyx_t_2);
+    __Pyx_XGIVEREF(__pyx_t_3);
+    __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
     __pyx_L12_try_end:;
   }
 
-  /* "/home/zakhar/workspace/ffvideo/src/ffvideo/ffvideo.pyx":101
+  /* "ffvideo.pyx":101
  *             except (TypeError, ValueError), e:
  *                 raise FFVideoValueError("frame_size must be a tuple (int, int)")
  *             if fw is None and fh is None:             # <<<<<<<<<<<<<<
  *                 raise FFVideoValueError("both width and height cannot be None")
  * 
  */
-  __pyx_t_8 = (__pyx_v_fw == Py_None);
-  if (__pyx_t_8) {
-    __pyx_t_9 = (__pyx_v_fh == Py_None);
-    __pyx_t_10 = __pyx_t_9;
+  __pyx_t_11 = (__pyx_v_fw == Py_None);
+  if (__pyx_t_11) {
+    __pyx_t_12 = (__pyx_v_fh == Py_None);
+    __pyx_t_13 = __pyx_t_12;
   } else {
-    __pyx_t_10 = __pyx_t_8;
+    __pyx_t_13 = __pyx_t_11;
   }
-  if (__pyx_t_10) {
-
-    /* "/home/zakhar/workspace/ffvideo/src/ffvideo/ffvideo.pyx":102
+  if (__pyx_t_13) {
+
+    /* "ffvideo.pyx":102
  *                 raise FFVideoValueError("frame_size must be a tuple (int, int)")
  *             if fw is None and fh is None:
  *                 raise FFVideoValueError("both width and height cannot be None")             # <<<<<<<<<<<<<<
  * 
  *             if fw is None:
  */
-    __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__FFVideoValueError); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_INCREF(((PyObject *)__pyx_kp_s_3));
-    PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_3));
-    __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3));
-    __pyx_t_2 = PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __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_Raise(__pyx_t_2, 0, 0);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
+    __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__FFVideoValueError); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __pyx_t_4 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __Pyx_Raise(__pyx_t_4, 0, 0, 0);
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
     {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    goto __pyx_L15;
+    goto __pyx_L17;
   }
-  __pyx_L15:;
-
-  /* "/home/zakhar/workspace/ffvideo/src/ffvideo/ffvideo.pyx":104
+  __pyx_L17:;
+
+  /* "ffvideo.pyx":104
  *                 raise FFVideoValueError("both width and height cannot be None")
  * 
  *             if fw is None:             # <<<<<<<<<<<<<<
  *                 self.frame_width = round(fh * <float>self.width / self.height / 2.0) * 2
  *                 self.frame_height = round(fh / 2.0) * 2
  */
-  __pyx_t_10 = (__pyx_v_fw == Py_None);
-  if (__pyx_t_10) {
-
-    /* "/home/zakhar/workspace/ffvideo/src/ffvideo/ffvideo.pyx":105
+  __pyx_t_13 = (__pyx_v_fw == Py_None);
+  if (__pyx_t_13) {
+
+    /* "ffvideo.pyx":105
  * 
  *             if fw is None:
  *                 self.frame_width = round(fh * <float>self.width / self.height / 2.0) * 2             # <<<<<<<<<<<<<<
  *                 self.frame_height = round(fh / 2.0) * 2
  *             elif fh is None:
  */
-    __pyx_t_2 = PyFloat_FromDouble(((float)((struct __pyx_obj_7ffvideo_VideoStream *)__pyx_v_self)->width)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_1 = PyNumber_Multiply(__pyx_v_fh, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_t_2 = PyInt_FromLong(((struct __pyx_obj_7ffvideo_VideoStream *)__pyx_v_self)->height); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_t_2 = PyFloat_FromDouble(2.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __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_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
-    __Pyx_GIVEREF(__pyx_t_1);
-    __pyx_t_1 = 0;
-    __pyx_t_1 = PyObject_Call(__pyx_builtin_round, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_t_2 = PyNumber_Multiply(__pyx_t_1, __pyx_int_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    ((struct __pyx_obj_7ffvideo_VideoStream *)__pyx_v_self)->frame_width = __pyx_t_4;
-
-    /* "/home/zakhar/workspace/ffvideo/src/ffvideo/ffvideo.pyx":106
+    __pyx_t_4 = PyFloat_FromDouble(((float)((struct __pyx_obj_7ffvideo_VideoStream *)__pyx_v_self)->width)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_6 = PyNumber_Multiply(__pyx_v_fh, __pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __pyx_t_4 = PyInt_FromLong(((struct __pyx_obj_7ffvideo_VideoStream *)__pyx_v_self)->height); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_5 = __Pyx_PyNumber_Divide(__pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __pyx_t_4 = PyFloat_FromDouble(2.0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_6 = __Pyx_PyNumber_Divide(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6);
+    __Pyx_GIVEREF(__pyx_t_6);
+    __pyx_t_6 = 0;
+    __pyx_t_6 = PyObject_Call(__pyx_builtin_round, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+    __pyx_t_4 = PyNumber_Multiply(__pyx_t_6, __pyx_int_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    ((struct __pyx_obj_7ffvideo_VideoStream *)__pyx_v_self)->frame_width = __pyx_t_8;
+
+    /* "ffvideo.pyx":106
  *             if fw is None:
  *                 self.frame_width = round(fh * <float>self.width / self.height / 2.0) * 2
  *                 self.frame_height = round(fh / 2.0) * 2             # <<<<<<<<<<<<<<
  *             elif fh is None:
  *                 self.frame_width = round(fw / 2.0) * 2
  */
-    __pyx_t_2 = PyFloat_FromDouble(2.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_v_fh, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
-    __Pyx_GIVEREF(__pyx_t_1);
-    __pyx_t_1 = 0;
-    __pyx_t_1 = PyObject_Call(__pyx_builtin_round, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_t_2 = PyNumber_Multiply(__pyx_t_1, __pyx_int_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    ((struct __pyx_obj_7ffvideo_VideoStream *)__pyx_v_self)->frame_height = __pyx_t_4;
-    goto __pyx_L16;
+    __pyx_t_4 = PyFloat_FromDouble(2.0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_6 = __Pyx_PyNumber_Divide(__pyx_v_fh, __pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6);
+    __Pyx_GIVEREF(__pyx_t_6);
+    __pyx_t_6 = 0;
+    __pyx_t_6 = PyObject_Call(__pyx_builtin_round, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+    __pyx_t_4 = PyNumber_Multiply(__pyx_t_6, __pyx_int_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    ((struct __pyx_obj_7ffvideo_VideoStream *)__pyx_v_self)->frame_height = __pyx_t_8;
+    goto __pyx_L18;
   }
 
-  /* "/home/zakhar/workspace/ffvideo/src/ffvideo/ffvideo.pyx":107
+  /* "ffvideo.pyx":107
  *                 self.frame_width = round(fh * <float>self.width / self.height / 2.0) * 2
  *                 self.frame_height = round(fh / 2.0) * 2
  *             elif fh is None:             # <<<<<<<<<<<<<<
  *                 self.frame_width = round(fw / 2.0) * 2
  *                 self.frame_height = round(fw * <float>self.height / self.width / 2.0) * 2
  */
-  __pyx_t_10 = (__pyx_v_fh == Py_None);
-  if (__pyx_t_10) {
-
-    /* "/home/zakhar/workspace/ffvideo/src/ffvideo/ffvideo.pyx":108
+  __pyx_t_13 = (__pyx_v_fh == Py_None);
+  if (__pyx_t_13) {
+
+    /* "ffvideo.pyx":108
  *                 self.frame_height = round(fh / 2.0) * 2
  *             elif fh is None:
  *                 self.frame_width = round(fw / 2.0) * 2             # <<<<<<<<<<<<<<
  *                 self.frame_height = round(fw * <float>self.height / self.width / 2.0) * 2
  *             else:
  */
-    __pyx_t_2 = PyFloat_FromDouble(2.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_v_fw, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
-    __Pyx_GIVEREF(__pyx_t_1);
-    __pyx_t_1 = 0;
-    __pyx_t_1 = PyObject_Call(__pyx_builtin_round, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_t_2 = PyNumber_Multiply(__pyx_t_1, __pyx_int_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    ((struct __pyx_obj_7ffvideo_VideoStream *)__pyx_v_self)->frame_width = __pyx_t_4;
-
-    /* "/home/zakhar/workspace/ffvideo/src/ffvideo/ffvideo.pyx":109
+    __pyx_t_4 = PyFloat_FromDouble(2.0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_6 = __Pyx_PyNumber_Divide(__pyx_v_fw, __pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6);
+    __Pyx_GIVEREF(__pyx_t_6);
+    __pyx_t_6 = 0;
+    __pyx_t_6 = PyObject_Call(__pyx_builtin_round, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+    __pyx_t_4 = PyNumber_Multiply(__pyx_t_6, __pyx_int_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    ((struct __pyx_obj_7ffvideo_VideoStream *)__pyx_v_self)->frame_width = __pyx_t_8;
+
+    /* "ffvideo.pyx":109
  *             elif fh is None:
  *                 self.frame_width = round(fw / 2.0) * 2
  *                 self.frame_height = round(fw * <float>self.height / self.width / 2.0) * 2             # <<<<<<<<<<<<<<
  *             else:
  *                 self.frame_width = round(fw / 2.0) * 2
  */
-    __pyx_t_2 = PyFloat_FromDouble(((float)((struct __pyx_obj_7ffvideo_VideoStream *)__pyx_v_self)->height)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_1 = PyNumber_Multiply(__pyx_v_fw, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_t_2 = PyInt_FromLong(((struct __pyx_obj_7ffvideo_VideoStream *)__pyx_v_self)->width); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_3);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_t_2 = PyFloat_FromDouble(2.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __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_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
-    __Pyx_GIVEREF(__pyx_t_1);
-    __pyx_t_1 = 0;
-    __pyx_t_1 = PyObject_Call(__pyx_builtin_round, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_t_2 = PyNumber_Multiply(__pyx_t_1, __pyx_int_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    ((struct __pyx_obj_7ffvideo_VideoStream *)__pyx_v_self)->frame_height = __pyx_t_4;
-    goto __pyx_L16;
+    __pyx_t_4 = PyFloat_FromDouble(((float)((struct __pyx_obj_7ffvideo_VideoStream *)__pyx_v_self)->height)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_6 = PyNumber_Multiply(__pyx_v_fw, __pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __pyx_t_4 = PyInt_FromLong(((struct __pyx_obj_7ffvideo_VideoStream *)__pyx_v_self)->width); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_5 = __Pyx_PyNumber_Divide(__pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __pyx_t_4 = PyFloat_FromDouble(2.0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_6 = __Pyx_PyNumber_Divide(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6);
+    __Pyx_GIVEREF(__pyx_t_6);
+    __pyx_t_6 = 0;
+    __pyx_t_6 = PyObject_Call(__pyx_builtin_round, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+    __pyx_t_4 = PyNumber_Multiply(__pyx_t_6, __pyx_int_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    ((struct __pyx_obj_7ffvideo_VideoStream *)__pyx_v_self)->frame_height = __pyx_t_8;
+    goto __pyx_L18;
   }
   /*else*/ {
 
-    /* "/home/zakhar/workspace/ffvideo/src/ffvideo/ffvideo.pyx":111
+    /* "ffvideo.pyx":111
  *                 self.frame_height = round(fw * <float>self.height / self.width / 2.0) * 2
  *             else:
  *                 self.frame_width = round(fw / 2.0) * 2             # <<<<<<<<<<<<<<
  *                 self.frame_height = round(fh / 2.0) * 2
  * 
  */
-    __pyx_t_2 = PyFloat_FromDouble(2.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_v_fw, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
-    __Pyx_GIVEREF(__pyx_t_1);
-    __pyx_t_1 = 0;
-    __pyx_t_1 = PyObject_Call(__pyx_builtin_round, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_t_2 = PyNumber_Multiply(__pyx_t_1, __pyx_int_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    ((struct __pyx_obj_7ffvideo_VideoStream *)__pyx_v_self)->frame_width = __pyx_t_4;
-
-    /* "/home/zakhar/workspace/ffvideo/src/ffvideo/ffvideo.pyx":112
+    __pyx_t_4 = PyFloat_FromDouble(2.0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_6 = __Pyx_PyNumber_Divide(__pyx_v_fw, __pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6);
+    __Pyx_GIVEREF(__pyx_t_6);
+    __pyx_t_6 = 0;
+    __pyx_t_6 = PyObject_Call(__pyx_builtin_round, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+    __pyx_t_4 = PyNumber_Multiply(__pyx_t_6, __pyx_int_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    ((struct __pyx_obj_7ffvideo_VideoStream *)__pyx_v_self)->frame_width = __pyx_t_8;
+
+    /* "ffvideo.pyx":112
  *             else:
  *                 self.frame_width = round(fw / 2.0) * 2
  *                 self.frame_height = round(fh / 2.0) * 2             # <<<<<<<<<<<<<<
  * 
  *         def __get__(self):
  */
-    __pyx_t_2 = PyFloat_FromDouble(2.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_v_fh, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
-    __Pyx_GIVEREF(__pyx_t_1);
-    __pyx_t_1 = 0;
-    __pyx_t_1 = PyObject_Call(__pyx_builtin_round, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_1);
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    __pyx_t_2 = PyNumber_Multiply(__pyx_t_1, __pyx_int_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_GOTREF(__pyx_t_2);
-    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
-    __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
-    ((struct __pyx_obj_7ffvideo_VideoStream *)__pyx_v_self)->frame_height = __pyx_t_4;
+    __pyx_t_4 = PyFloat_FromDouble(2.0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __pyx_t_6 = __Pyx_PyNumber_Divide(__pyx_v_fh, __pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(((PyObject *)__pyx_t_4));
+    PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6);
+    __Pyx_GIVEREF(__pyx_t_6);
+    __pyx_t_6 = 0;
+    __pyx_t_6 = PyObject_Call(__pyx_builtin_round, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_6);
+    __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+    __pyx_t_4 = PyNumber_Multiply(__pyx_t_6, __pyx_int_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_4);
+    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+    __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_4); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+    ((struct __pyx_obj_7ffvideo_VideoStream *)__pyx_v_self)->frame_height = __pyx_t_8;
   }
-  __pyx_L16:;
+  __pyx_L18:;
 
   __pyx_r = 0;
   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_6);
-  __Pyx_XDECREF(__pyx_t_7);
-  __Pyx_AddTraceback("ffvideo.VideoStream.frame_size.__set__");
+  __Pyx_XDECREF(__pyx_t_9);
+  __Pyx_XDECREF(__pyx_t_10);
+  __Pyx_AddTraceback("ffvideo.VideoStream.frame_size.__set__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = -1;
   __pyx_L0:;
-  __Pyx_DECREF(__pyx_v_fw);
-  __Pyx_DECREF(__pyx_v_fh);
-  __Pyx_DECREF(__pyx_v_e);
-  __Pyx_DECREF((PyObject *)__pyx_v_self);
-  __Pyx_DECREF(__pyx_v_size);
+  __Pyx_XDECREF(__pyx_v_fw);
+  __Pyx_XDECREF(__pyx_v_fh);
+  __Pyx_XDECREF(__pyx_v_e);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
 }
 
-/* "/home/zakhar/workspace/ffvideo/src/ffvideo/ffvideo.pyx":114
+/* "ffvideo.pyx":114
  *                 self.frame_height = round(fh / 2.0) * 2
  * 
  *         def __get__(self):             # <<<<<<<<<<<<<<
  * 
  */
 
-static PyObject *__pyx_pf_7ffvideo_11VideoStream_10frame_size___get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_pf_7ffvideo_11VideoStream_10frame_size___get__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_pf_7ffvideo_11VideoStream_10frame_size_1__get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_pf_7ffvideo_11VideoStream_10frame_size_1__get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r = NULL;
+  __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
   PyObject *__pyx_t_2 = NULL;
   PyObject *__pyx_t_3 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__get__");
 
-  /* "/home/zakhar/workspace/ffvideo/src/ffvideo/ffvideo.pyx":115
+  /* "ffvideo.pyx":115
  * 
  *         def __get__(self):
  *             return (self.frame_width, self.frame_height)             # <<<<<<<<<<<<<<
   __pyx_t_2 = PyInt_FromLong(((struct __pyx_obj_7ffvideo_VideoStream *)__pyx_v_self)->frame_height); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_3);
+  __Pyx_GOTREF(((PyObject *)__pyx_t_3));
   PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
   __Pyx_GIVEREF(__pyx_t_1);
   PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
   __Pyx_GIVEREF(__pyx_t_2);
   __pyx_t_1 = 0;
   __pyx_t_2 = 0;
-  __pyx_r = __pyx_t_3;
+  __pyx_r = ((PyObject *)__pyx_t_3);
   __pyx_t_3 = 0;
   goto __pyx_L0;
 
   __Pyx_XDECREF(__pyx_t_1);
   __Pyx_XDECREF(__pyx_t_2);
   __Pyx_XDECREF(__pyx_t_3);
-  __Pyx_AddTraceback("ffvideo.VideoStream.frame_size.__get__");
+  __Pyx_AddTraceback("ffvideo.VideoStream.frame_size.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
   __Pyx_XGIVEREF(__pyx_r);
   return __pyx_r;
 }
 
-/* "/home/zakhar/workspace/ffvideo/src/ffvideo/ffvideo.pyx":117
+/* "ffvideo.pyx":117
  *             return (self.frame_width, self.frame_height)
  * 
  *     def __cinit__(self, filename, frame_size=None, frame_mode='RGB',             # <<<<<<<<<<<<<<
   PyObject *__pyx_v_frame_mode = 0;
   PyObject *__pyx_v_scale_mode = 0;
   int __pyx_r;
+  __Pyx_RefNannyDeclarations
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
   static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__filename,&__pyx_n_s__frame_size,&__pyx_n_s__frame_mode,&__pyx_n_s__scale_mode,0};
   __Pyx_RefNannySetupContext("__cinit__");
-  if (unlikely(__pyx_kwds)) {
-    Py_ssize_t kw_args = PyDict_Size(__pyx_kwds);
+  {
     PyObject* values[4] = {0,0,0,0};
     values[1] = ((PyObject *)Py_None);
     values[2] = ((PyObject *)__pyx_n_s__RGB);
-    values[3] = __pyx_k_4;
-    switch (PyTuple_GET_SIZE(__pyx_args)) {
-      case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
-      case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
-      case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
-      case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
-      case  0: break;
-      default: goto __pyx_L5_argtuple_error;
-    }
-    switch (PyTuple_GET_SIZE(__pyx_args)) {
-      case  0:
-      values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename);
-      if (likely(values[0])) kw_args--;
-      else goto __pyx_L5_argtuple_error;
-      case  1:
-      if (kw_args > 1) {
-        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__frame_size);
-        if (unlikely(value)) { values[1] = value; kw_args--; }
+    values[3] = __pyx_k_7;
+    if (unlikely(__pyx_kwds)) {
+      Py_ssize_t kw_args;
+      switch (PyTuple_GET_SIZE(__pyx_args)) {
+        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
+        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+        case  0: break;
+        default: goto __pyx_L5_argtuple_error;
       }
-      case  2:
-      if (kw_args > 1) {
-        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__frame_mode);
-        if (unlikely(value)) { values[2] = value; kw_args--; }
+      kw_args = PyDict_Size(__pyx_kwds);
+      switch (PyTuple_GET_SIZE(__pyx_args)) {
+        case  0:
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename);
+        if (likely(values[0])) kw_args--;
+        else goto __pyx_L5_argtuple_error;
+        case  1:
+        if (kw_args > 0) {
+          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__frame_size);
+          if (value) { values[1] = value; kw_args--; }
+        }
+        case  2:
+        if (kw_args > 0) {
+          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__frame_mode);
+          if (value) { values[2] = value; kw_args--; }
+        }
+        case  3:
+        if (kw_args > 0) {
+          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__scale_mode);
+          if (value) { values[3] = value; kw_args--; }
+        }
       }
-      case  3:
-      if (kw_args > 1) {
-        PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__scale_mode);
-        if (unlikely(value)) { values[3] = value; kw_args--; }
+      if (unlikely(kw_args > 0)) {
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
       }
-    }
-    if (unlikely(kw_args > 0)) {
-      if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__cinit__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+    } else {
+      switch (PyTuple_GET_SIZE(__pyx_args)) {
+        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
+        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
+        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+        break;
+        default: goto __pyx_L5_argtuple_error;
+      }
     }
     __pyx_v_filename = values[0];
     __pyx_v_frame_size = values[1];
     __pyx_v_frame_mode = values[2];
     __pyx_v_scale_mode = values[3];
-  } else {
-    __pyx_v_frame_size = ((PyObject *)Py_None);
-    __pyx_v_frame_mode = ((PyObject *)__pyx_n_s__RGB);
-    __pyx_v_scale_mode = __pyx_k_4;
-    switch (PyTuple_GET_SIZE(__pyx_args)) {
-      case  4: __pyx_v_scale_mode = PyTuple_GET_ITEM(__pyx_args, 3);
-      case  3: __pyx_v_frame_mode = PyTuple_GET_ITEM(__pyx_args, 2);
-      case  2: __pyx_v_frame_size = PyTuple_GET_ITEM(__pyx_args, 1);
-      case  1: __pyx_v_filename = PyTuple_GET_ITEM(__pyx_args, 0);
-      break;
-      default: goto __pyx_L5_argtuple_error;
-    }
   }
   goto __pyx_L4_argument_unpacking_done;
   __pyx_L5_argtuple_error:;
   __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
   __pyx_L3_error:;
-  __Pyx_AddTraceback("ffvideo.VideoStream.__cinit__");
+  __Pyx_AddTraceback("ffvideo.VideoStream.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_RefNannyFinishContext();
   return -1;
   __pyx_L4_argument_unpacking_done:;
 
-  /* "/home/zakhar/workspace/ffvideo/src/ffvideo/ffvideo.pyx":119
+  /* "ffvideo.pyx":119
  *     def __cinit__(self, filename, frame_size=None, frame_mode='RGB',
  *                   scale_mode=BICUBIC):
  *         self.format_ctx = NULL             # <<<<<<<<<<<<<<
  */
   ((struct __pyx_obj_7ffvideo_VideoStream *)__pyx_v_self)->format_ctx = NULL;
 
-  /* "/home/zakhar/workspace/ffvideo/src/ffvideo/ffvideo.pyx":120
+  /* "ffvideo.pyx":120
  *                   scale_mode=BICUBIC):
  *         self.format_ctx = NULL
  *         self.codec_ctx = NULL             # <<<<<<<<<<<<<<
  */
   ((struct __pyx_obj_7ffvideo_VideoStream *)__pyx_v_self)->codec_ctx = NULL;
 
-  /* "/home/zakhar/workspace/ffvideo/src/ffvideo/ffvideo.pyx":121
+  /* "ffvideo.pyx":121
  *         self.format_ctx = NULL
  *         self.codec_ctx = NULL
  *         self.frame = avcodec_alloc_frame()             # <<<<<<<<<<<<<<
  */
   ((struct __pyx_obj_7ffvideo_VideoStream *)__pyx_v_self)->frame = avcodec_alloc_frame();
 
-  /* "/home/zakhar/workspace/ffvideo/src/ffvideo/ffvideo.pyx":122
+  /* "ffvideo.pyx":122
  *         self.codec_ctx = NULL
  *         self.frame = avcodec_alloc_frame()
  *         self.duration = 0             # <<<<<<<<<<<<<<
  *         self.width = 0
  *         self.height = 0
  */
-  ((struct __pyx_obj_7ffvideo_VideoStream *)__pyx_v_self)->duration = 0;
-
-  /* "/home/zakhar/workspace/ffvideo/src/ffvideo/ffvideo.pyx":123
+  ((struct __pyx_obj_7ffvideo_VideoStream *)__pyx_v_self)->duration = 0.0;
+
+  /* "ffvideo.pyx":123
  *         self.frame = avcodec_alloc_frame()
  *         self.duration = 0
  *         self.width = 0             # <<<<<<<<<<<<<<
  */
   ((struct __pyx_obj_7ffvideo_VideoStream *)__pyx_v_self)->width = 0;
 
-  /* "/home/zakhar/workspace/ffvideo/src/ffvideo/ffvideo.pyx":124
+  /* "ffvideo.pyx":124
  *         self.duration = 0
  *         self.width = 0
  *         self.height = 0             # <<<<<<<<<<<<<<
  */
   ((struct __pyx_obj_7ffvideo_VideoStream *)__pyx_v_self)->height = 0;
 
-  /* "/home/zakhar/workspace/ffvideo/src/ffvideo/ffvideo.pyx":125
+  /* "ffvideo.pyx":125
  *         self.width = 0
  *         self.height = 0
  *         self.frameno = 0             # <<<<<<<<<<<<<<
  */
   ((struct __pyx_obj_7ffvideo_VideoStream *)__pyx_v_self)->frameno = 0;
 
-  /* "/home/zakhar/workspace/ffvideo/src/ffvideo/ffvideo.pyx":126
+  /* "ffvideo.pyx":126
  *         self.height = 0
  *         self.frameno = 0
  *         self.streamno = -1             # <<<<<<<<<<<<<<
   return __pyx_r;
 }
 
-/* "/home/zakhar/workspace/ffvideo/src/ffvideo/ffvideo.pyx":128
+/* "ffvideo.pyx":128
  *         self.streamno = -1
  * 
  *     def __init__(self, filename, frame_size=None, frame_mode='RGB',             # <<<<<<<<<<<<<<
  *         cdef int ret
  */
 
-static int __pyx_pf_7ffvideo_11VideoStream___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static int __pyx_pf_7ffvideo_11VideoStream___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static int __pyx_pf_7ffvideo_11VideoStream_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static int __pyx_pf_7ffvideo_11VideoStream_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_filename = 0;
   PyObject *__pyx_v_frame_size = 0;