Skip to content

Commit

Permalink
Merge pull request go-gst#66 from go-gst/gst-element-properties
Browse files Browse the repository at this point in the history
allow for gst.Element as properties to other gst.Elements
  • Loading branch information
RSWilli authored Feb 7, 2024
2 parents 7f6bb5a + 4074ae0 commit 04ec17f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions gst/gst_element.go
Original file line number Diff line number Diff line change
Expand Up @@ -625,3 +625,15 @@ func (e *Element) SeekTime(position time.Duration, flag SeekFlags) bool {
func (e *Element) SeekDefault(position int64, flag SeekFlags) bool {
return e.SeekSimple(position, FormatDefault, flag)
}

// this prevents go pointers in cgo when setting a gst.Element to a property
// see (https://github.com/go-gst/go-gst/issues/65)
// ToGValue implements glib.ValueTransformer.
func (e *Element) ToGValue() (*glib.Value, error) {
val, err := glib.ValueInit(glib.Type(C.GST_TYPE_ELEMENT))
if err != nil {
return nil, err
}
val.SetInstance(unsafe.Pointer(e.Instance()))
return val, nil
}

0 comments on commit 04ec17f

Please sign in to comment.