Skip to content

Commit

Permalink
feat: create hardware device context with flags
Browse files Browse the repository at this point in the history
  • Loading branch information
l0rem1psum committed Nov 4, 2024
1 parent 33d572d commit 8df7d52
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion examples/hardware_decoding/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}

Expand Down
4 changes: 2 additions & 2 deletions hardware_device_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 != "" {
Expand All @@ -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
Expand Down

0 comments on commit 8df7d52

Please sign in to comment.