Skip to content

Commit

Permalink
Register GstSample marshaling functions (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
biglittlebigben authored Feb 10, 2023
1 parent 14cc79f commit 8fc9f59
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
7 changes: 7 additions & 0 deletions gst/gst.go.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,13 @@ gboolean gstObjectFlagIsSet (GstObject * obj, GstElementFlags flags)
GstTocSetter * toTocSetter (GstElement * elem) { return GST_TOC_SETTER(elem); }
GstTagSetter * toTagSetter (GstElement *elem) { return GST_TAG_SETTER(elem); }

/* Sample Utilities */

GstSample * getSampleValue (GValue * val)
{
return gst_value_get_sample(val);
}


/* Misc */

Expand Down
4 changes: 4 additions & 0 deletions gst/gst.go.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,8 @@ extern gpointer glistNext (GList * list);

extern int sizeOfGCharArray (gchar ** arr);

/* Sample Utilities */

extern GstSample * getSampleValue (GValue * val);

#endif
9 changes: 9 additions & 0 deletions gst/gst_wrappers.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,10 @@ func registerMarshalers() {
T: TypeValueList,
F: marshalValueList,
},
{
T: glib.Type(C.gst_sample_get_type()),
F: marshalSample,
},
}

glib.RegisterGValueMarshalers(tm)
Expand Down Expand Up @@ -500,3 +504,8 @@ func marshalQuery(p uintptr) (interface{}, error) {
obj := (*C.GstQuery)(unsafe.Pointer(c))
return wrapQuery(obj), nil
}

func marshalSample(p uintptr) (interface{}, error) {
c := C.getSampleValue(toGValue(p))
return wrapSample(c), nil
}

0 comments on commit 8fc9f59

Please sign in to comment.