As per this, I think it is not possible to create GArray using python bindings. To overcome this, I am writing a small library that will return a GArray. This library utilizes gobject introspection and exposes a method create_codec_array.
/**
* webrtc_interface_create_codec_array:
* @interface: a #WebrtcInterface
*
* creates codecs_array.
*
* Returns: (element-type GstStructure) (transfer full): a #GArray of #GstStructure
*/
GArray *
webrtc_interface_create_codec_array (WebrtcInterface * interface)
{
WebrtcInterfacePrivate *priv ;
g_return_if_fail (interface != NULL);
priv = WEBRTC_INTERFACE_GET_PRIVATE (interface);
gchar * codecs[] = {priv->codec, NULL};
GArray *a = g_array_new (FALSE, TRUE, sizeof (GValue));
int i;
for (i=0; i < g_strv_length (codecs); i++) {
GValue v = G_VALUE_INIT;
GstStructure *s;
g_value_init (&v, GST_TYPE_STRUCTURE);
s = gst_structure_new (codecs[i], NULL, NULL);
gst_value_set_structure (&v, s);
gst_structure_free (s);
g_array_append_val (a, v);
}
return a;
}
When I run g-ir-scanner, I get the following error:
webrtc_interface.c:149: Warning: Webrtc: webrtc_interface_create_codec_array:
Unknown type: 'GstStructure'
This function is returning a GArray of GstStructure elements, which I am not able to introspect. What should be the element-type annotation in this case?
Many thanks!