| 1 |
cimport libav as lib |
| 2 |
from libc.stdint cimport int64_t, uint8_t |
| 3 |
|
| 4 |
|
| 5 |
cdef int pyio_read(void *opaque, uint8_t *buf, int buf_size) noexcept nogil |
| 6 |
cdef int pyio_write(void *opaque, const uint8_t *buf, int buf_size) noexcept nogil |
| 7 |
cdef int64_t pyio_seek(void *opaque, int64_t offset, int whence) noexcept nogil |
| 8 |
cdef int pyio_close_gil(lib.AVIOContext *pb) |
| 9 |
cdef int pyio_close_custom_gil(lib.AVIOContext *pb) |
| 10 |
|
| 11 |
cdef class PyIOFile: |
| 12 |
# File-like source. |
| 13 |
cdef readonly object file |
| 14 |
cdef object fread |
| 15 |
cdef object fwrite |
| 16 |
cdef object fseek |
| 17 |
cdef object ftell |
| 18 |
cdef object fclose |
| 19 |
|
| 20 |
# Custom IO for above. |
| 21 |
cdef lib.AVIOContext *iocontext |
| 22 |
cdef unsigned char *buffer |
| 23 |
cdef long pos |
| 24 |
cdef bint pos_is_valid |