mirror of
https://github.com/go-gst/go-gst.git
synced 2025-10-06 00:17:00 +08:00
PadProbeInfo in PadProbeCallback must be borrowed
the rust bindings are creating a copy here, that reflects all updates to the C struct after the callback is done, maybe this would be better
This commit is contained in:
12
generator.go
12
generator.go
@@ -74,6 +74,18 @@ var Data = genmain.Data{
|
|||||||
// during init
|
// during init
|
||||||
t.GLibGetType = ""
|
t.GLibGetType = ""
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
// PadProbeInfo must not be freed, so we mark it as borrowed.
|
||||||
|
gir.ModifyCallable("Gst-1.PadProbeCallback", func(c *gir.CallableAttrs) {
|
||||||
|
for _, p := range c.Parameters.Parameters {
|
||||||
|
if p.Name == "info" && p.Type.Name == "PadProbeInfo" {
|
||||||
|
p.TransferOwnership.TransferOwnership = "borrow"
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
panic("PadProbeCallback does not have an info parameter")
|
||||||
|
}),
|
||||||
},
|
},
|
||||||
Config: typesystem.Config{
|
Config: typesystem.Config{
|
||||||
Namespaces: map[string]typesystem.NamespaceConfig{
|
Namespaces: map[string]typesystem.NamespaceConfig{
|
||||||
|
2
go.mod
2
go.mod
@@ -13,4 +13,4 @@ require (
|
|||||||
golang.org/x/sync v0.15.0 // indirect
|
golang.org/x/sync v0.15.0 // indirect
|
||||||
)
|
)
|
||||||
|
|
||||||
replace github.com/diamondburned/gotk4 => github.com/rswilli/gotk4 v0.0.0-20250630082246-7bde21946e67
|
replace github.com/diamondburned/gotk4 => github.com/rswilli/gotk4 v0.0.0-20250701112939-1be8c14e14f9
|
||||||
|
4
go.sum
4
go.sum
@@ -2,8 +2,8 @@ github.com/go-gst/go-glib v1.4.1-0.20241209142714-f53cebf18559 h1:AK60n6W3FLZTp9
|
|||||||
github.com/go-gst/go-glib v1.4.1-0.20241209142714-f53cebf18559/go.mod h1:ZWT4LXOO2PH8lSNu/dR5O2yoNQJKEgmijNa2d7nByK8=
|
github.com/go-gst/go-glib v1.4.1-0.20241209142714-f53cebf18559/go.mod h1:ZWT4LXOO2PH8lSNu/dR5O2yoNQJKEgmijNa2d7nByK8=
|
||||||
github.com/go-gst/go-pointer v0.0.0-20241127163939-ba766f075b4c h1:x8kKRVDmz5BRlolmDZGcsuZ1l+js6TRL3QWBJjGVctM=
|
github.com/go-gst/go-pointer v0.0.0-20241127163939-ba766f075b4c h1:x8kKRVDmz5BRlolmDZGcsuZ1l+js6TRL3QWBJjGVctM=
|
||||||
github.com/go-gst/go-pointer v0.0.0-20241127163939-ba766f075b4c/go.mod h1:qKw5ZZ0U58W6PU/7F/Lopv+14nKYmdXlOd7VnAZ17Mk=
|
github.com/go-gst/go-pointer v0.0.0-20241127163939-ba766f075b4c/go.mod h1:qKw5ZZ0U58W6PU/7F/Lopv+14nKYmdXlOd7VnAZ17Mk=
|
||||||
github.com/rswilli/gotk4 v0.0.0-20250630082246-7bde21946e67 h1:70vQ7g0OISrj+jYJhTCAQsVKXpV49Rz/5urHd2reQKI=
|
github.com/rswilli/gotk4 v0.0.0-20250701112939-1be8c14e14f9 h1:nwcMF9yiEzM3DlK/P4q/nter7+f4nJoe+NnI0AHcc18=
|
||||||
github.com/rswilli/gotk4 v0.0.0-20250630082246-7bde21946e67/go.mod h1:alpfblIRIC6MejV4eBLjWx61VeJvfQ/6dHGQZUkzSYE=
|
github.com/rswilli/gotk4 v0.0.0-20250701112939-1be8c14e14f9/go.mod h1:alpfblIRIC6MejV4eBLjWx61VeJvfQ/6dHGQZUkzSYE=
|
||||||
golang.org/x/exp v0.0.0-20250305212735-054e65f0b394 h1:nDVHiLt8aIbd/VzvPWN6kSOPE7+F/fNFDSXLVYkE/Iw=
|
golang.org/x/exp v0.0.0-20250305212735-054e65f0b394 h1:nDVHiLt8aIbd/VzvPWN6kSOPE7+F/fNFDSXLVYkE/Iw=
|
||||||
golang.org/x/exp v0.0.0-20250305212735-054e65f0b394/go.mod h1:sIifuuw/Yco/y6yb6+bDNfyeQ/MdPUy/hKEMYQV17cM=
|
golang.org/x/exp v0.0.0-20250305212735-054e65f0b394/go.mod h1:sIifuuw/Yco/y6yb6+bDNfyeQ/MdPUy/hKEMYQV17cM=
|
||||||
golang.org/x/sync v0.15.0 h1:KWH3jNZsfyT6xfAfKiz6MRNmd46ByHDYaZ7KSkCtdW8=
|
golang.org/x/sync v0.15.0 h1:KWH3jNZsfyT6xfAfKiz6MRNmd46ByHDYaZ7KSkCtdW8=
|
||||||
|
@@ -279,11 +279,12 @@ func _gotk4_gst1_PadProbeCallback(carg1 *C.GstPad, carg2 *C.GstPadProbeInfo, car
|
|||||||
}
|
}
|
||||||
|
|
||||||
var pad Pad // in, none, converted
|
var pad Pad // in, none, converted
|
||||||
var info *PadProbeInfo // in, none, converted
|
var info *PadProbeInfo // in, borrow, converted
|
||||||
var goret PadProbeReturn // return, none, casted
|
var goret PadProbeReturn // return, none, casted
|
||||||
|
|
||||||
pad = UnsafePadFromGlibNone(unsafe.Pointer(carg1))
|
pad = UnsafePadFromGlibNone(unsafe.Pointer(carg1))
|
||||||
info = UnsafePadProbeInfoFromGlibNone(unsafe.Pointer(carg2))
|
info = UnsafePadProbeInfoFromGlibBorrow(unsafe.Pointer(carg2))
|
||||||
|
// borrow not bound to another value, this requires correct handling by the user
|
||||||
|
|
||||||
goret = fn(pad, info)
|
goret = fn(pad, info)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user