Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions av/codec/hwaccel.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ cdef class HWAccel:
cdef lib.AVBufferRef *ptr
cdef public bint allow_software_fallback
cdef public dict options
cdef public int flags
1 change: 1 addition & 0 deletions av/codec/hwaccel.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class HWAccel:
device: str | None = None,
allow_software_fallback: bool = False,
options: dict[str, object] | None = None,
flags: int | None = None,
) -> None: ...
def create(self, codec: Codec) -> HWAccel: ...

Expand Down
5 changes: 3 additions & 2 deletions av/codec/hwaccel.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ cpdef hwdevices_available():


cdef class HWAccel:
def __init__(self, device_type, device=None, allow_software_fallback=True, options=None):
def __init__(self, device_type, device=None, allow_software_fallback=True, options=None, flags=None):
if isinstance(device_type, HWDeviceType):
self._device_type = device_type
elif isinstance(device_type, str):
Expand All @@ -108,6 +108,7 @@ cdef class HWAccel:
self._device = device
self.allow_software_fallback = allow_software_fallback
self.options = {} if not options else dict(options)
self.flags = 0 if not flags else flags
self.ptr = NULL
self.config = None

Expand All @@ -132,7 +133,7 @@ cdef class HWAccel:

err_check(
lib.av_hwdevice_ctx_create(
&self.ptr, config.ptr.device_type, c_device, c_options.ptr, 0
&self.ptr, config.ptr.device_type, c_device, c_options.ptr, self.flags
)
)

Expand Down
Loading