| 1 |
cimport libav as lib |
| 2 |
from libc.stdint cimport uint8_t |
| 3 |
|
| 4 |
from av.frame cimport Frame |
| 5 |
from av.video.format cimport VideoFormat |
| 6 |
from av.video.reformatter cimport VideoReformatter |
| 7 |
|
| 8 |
|
| 9 |
cdef class CudaContext: |
| 10 |
cdef readonly int device_id |
| 11 |
cdef readonly bint primary_ctx |
| 12 |
cdef lib.AVBufferRef* _device_ref |
| 13 |
cdef dict _frames_cache |
| 14 |
cdef lib.AVBufferRef* _get_device_ref(self) |
| 15 |
cdef public lib.AVBufferRef* get_frames_ctx( |
| 16 |
self, lib.AVPixelFormat sw_fmt, int width, int height |
| 17 |
) |
| 18 |
|
| 19 |
cdef class VideoFrame(Frame): |
| 20 |
cdef CudaContext _cuda_ctx |
| 21 |
cdef VideoReformatter reformatter |
| 22 |
cdef readonly VideoFormat format |
| 23 |
cdef readonly int _device_id |
| 24 |
cdef _init(self, lib.AVPixelFormat format, unsigned int width, unsigned int height) |
| 25 |
cdef _init_user_attributes(self) |
| 26 |
cpdef save(self, object filepath) |
| 27 |
|
| 28 |
cdef VideoFrame alloc_video_frame() |