mirror of
https://github.com/asticode/go-astiav.git
synced 2025-10-06 16:46:52 +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
|
||||
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))
|
||||
}
|
||||
|
||||
|
@@ -49,7 +49,7 @@ func main() {
|
||||
}
|
||||
|
||||
// Create hardware device context
|
||||
hardwareDeviceContext, err := astiav.CreateHardwareDeviceContext(hardwareDeviceType, *hardwareDeviceName, nil)
|
||||
hardwareDeviceContext, err := astiav.CreateHardwareDeviceContext(hardwareDeviceType, *hardwareDeviceName, nil, 0)
|
||||
if err != nil {
|
||||
log.Fatal(fmt.Errorf("main: creating hardware device context failed: %w", err))
|
||||
}
|
||||
|
@@ -12,7 +12,7 @@ type HardwareDeviceContext struct {
|
||||
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{}
|
||||
deviceC := (*C.char)(nil)
|
||||
if device != "" {
|
||||
@@ -23,7 +23,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
|
||||
|
Reference in New Issue
Block a user