mirror of
https://github.com/asticode/go-astiav.git
synced 2025-10-06 08:37:06 +08:00
feat: create hardware device context with flags (#94)
This commit is contained in:
@@ -133,7 +133,7 @@ func main() {
|
|||||||
|
|
||||||
// Create hardware device context
|
// Create hardware device context
|
||||||
var err error
|
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))
|
log.Fatal(fmt.Errorf("main: creating hardware device context failed: %w", err))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -49,7 +49,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create hardware device context
|
// Create hardware device context
|
||||||
hardwareDeviceContext, err := astiav.CreateHardwareDeviceContext(hardwareDeviceType, *hardwareDeviceName, nil)
|
hardwareDeviceContext, err := astiav.CreateHardwareDeviceContext(hardwareDeviceType, *hardwareDeviceName, nil, 0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(fmt.Errorf("main: creating hardware device context failed: %w", err))
|
log.Fatal(fmt.Errorf("main: creating hardware device context failed: %w", err))
|
||||||
}
|
}
|
||||||
|
@@ -12,7 +12,7 @@ type HardwareDeviceContext struct {
|
|||||||
c *C.AVBufferRef
|
c *C.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{}
|
hdc := HardwareDeviceContext{}
|
||||||
deviceC := (*C.char)(nil)
|
deviceC := (*C.char)(nil)
|
||||||
if device != "" {
|
if device != "" {
|
||||||
@@ -23,7 +23,7 @@ func CreateHardwareDeviceContext(t HardwareDeviceType, device string, options *D
|
|||||||
if options != nil {
|
if options != nil {
|
||||||
optionsC = options.c
|
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 nil, err
|
||||||
}
|
}
|
||||||
return &hdc, nil
|
return &hdc, nil
|
||||||
|
Reference in New Issue
Block a user