Skip to content

Commit 14ea9c1

Browse files
materightWyattBlue
authored andcommitted
Add support for flags in hwaccel
1 parent 6294e28 commit 14ea9c1

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

av/codec/hwaccel.pxd

+1
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ cdef class HWAccel:
1818
cdef lib.AVBufferRef *ptr
1919
cdef public bint allow_software_fallback
2020
cdef public dict options
21+
cdef public int flags

av/codec/hwaccel.pyi

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ class HWAccel:
4242
device: str | None = None,
4343
allow_software_fallback: bool = False,
4444
options: dict[str, object] | None = None,
45+
flags: int | None = None,
4546
) -> None: ...
4647
def create(self, codec: Codec) -> HWAccel: ...
4748

av/codec/hwaccel.pyx

+3-2
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ cpdef hwdevices_available():
9595

9696

9797
cdef class HWAccel:
98-
def __init__(self, device_type, device=None, allow_software_fallback=True, options=None):
98+
def __init__(self, device_type, device=None, allow_software_fallback=True, options=None, flags=None):
9999
if isinstance(device_type, HWDeviceType):
100100
self._device_type = device_type
101101
elif isinstance(device_type, str):
@@ -108,6 +108,7 @@ cdef class HWAccel:
108108
self._device = device
109109
self.allow_software_fallback = allow_software_fallback
110110
self.options = {} if not options else dict(options)
111+
self.flags = 0 if not flags else flags
111112
self.ptr = NULL
112113
self.config = None
113114

@@ -132,7 +133,7 @@ cdef class HWAccel:
132133

133134
err_check(
134135
lib.av_hwdevice_ctx_create(
135-
&self.ptr, config.ptr.device_type, c_device, c_options.ptr, 0
136+
&self.ptr, config.ptr.device_type, c_device, c_options.ptr, self.flags
136137
)
137138
)
138139

0 commit comments

Comments
 (0)