go-gst / go-gst

Gstreamer bindings and utilities for golang
GNU Lesser General Public License v2.1
129 stars 57 forks source link

How parse GO types from message bug #121

Open Xeue opened 2 weeks ago

Xeue commented 2 weeks ago

Hey, we are trying to use the level element which produces messages as described here: https://gstreamer.freedesktop.org/documentation/level/index.html?gi-language=c

There is no parser for this built in and we are struggling to work out how to access the GValueArrays. The [GstClockTime] types are converted but the GetValues and Values functions. But the [GValueArray of doubles] is serialised.

We have tried messing around with go glib and havn't really got anywhere other than a few SIGSEGV violations and other such nasty things...

Is there a way to parse these values and if not how can we go about writing a parser?

Thanks!

RSWilli commented 2 weeks ago

The "parsers" are actually called marshalers and are defined here: https://github.com/go-gst/go-glib/blob/main/glib/gvalue.go#L326 in go-glib. Additional marshalers can be registered by other libraries like this: https://github.com/go-gst/go-gst/blob/main/gst/gstwebrtc/session_description.go#L13-L20

The two functions ToGValue and marshalXXX work as follows:


Since the GValueArray is located in glib, the bindings should be added to go-glib.

Oftentimes the gtk rust bindings are also a good place for reference, since they do similar things.