From 8df7d52fe6701b903f930ececc9687cfcb444431 Mon Sep 17 00:00:00 2001 From: l0rem1psum Date: Mon, 4 Nov 2024 08:02:21 +0000 Subject: [PATCH] feat: create hardware device context with flags --- examples/hardware_decoding/main.go | 2 +- hardware_device_context.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/hardware_decoding/main.go b/examples/hardware_decoding/main.go index 5d15f93..d41e184 100644 --- a/examples/hardware_decoding/main.go +++ b/examples/hardware_decoding/main.go @@ -133,7 +133,7 @@ func main() { // Create hardware device context var err error - if s.hardwareDeviceContext, err = astiav.CreateHardwareDeviceContext(hardwareDeviceType, *hardwareDeviceName, nil); err != nil { + if s.hardwareDeviceContext, err = astiav.CreateHardwareDeviceContext(hardwareDeviceType, *hardwareDeviceName, nil, 0); err != nil { log.Fatal(fmt.Errorf("main: creating hardware device context failed: %w", err)) } diff --git a/hardware_device_context.go b/hardware_device_context.go index ee97fe0..cac896b 100644 --- a/hardware_device_context.go +++ b/hardware_device_context.go @@ -13,7 +13,7 @@ type HardwareDeviceContext struct { c *C.struct_AVBufferRef } -func CreateHardwareDeviceContext(t HardwareDeviceType, device string, options *Dictionary) (*HardwareDeviceContext, error) { +func CreateHardwareDeviceContext(t HardwareDeviceType, device string, options *Dictionary, flags int) (*HardwareDeviceContext, error) { hdc := HardwareDeviceContext{} deviceC := (*C.char)(nil) if device != "" { @@ -24,7 +24,7 @@ func CreateHardwareDeviceContext(t HardwareDeviceType, device string, options *D if options != nil { optionsC = options.c } - if err := newError(C.av_hwdevice_ctx_create(&hdc.c, (C.enum_AVHWDeviceType)(t), deviceC, optionsC, 0)); err != nil { + if err := newError(C.av_hwdevice_ctx_create(&hdc.c, (C.enum_AVHWDeviceType)(t), deviceC, optionsC, C.int(flags))); err != nil { return nil, err } return &hdc, nil