How to access to GstValueList member from python?

Akihiro TSUKADA tskd2 at yahoo.co.jp
Sun Apr 28 09:44:13 PDT 2013


Hi all,

I have a problem in porting my old python script to gstreamer-1.0 + gi.
It handles "EIT" element messages from tsparse,
and each EIT message contains a GstValueList member in its GstStructure.
When my script accesses to the member, it always crashes with
"TypeError: unknown type GstValueList", just as bug #693168.

I found that GstValueList/Array are defined as fundamental types in gstreamer core,
and this seems to cause the exception at g_value_as_pyobject() in
pygobject/_gobject/pygtype.c.

Replacing GstValueList/Array with GArray was not viable,
because GArray defines its element accessor function as a macro (with type cast),
which is not available from gi.
I could use GValueArray instead but it is deprecated.
Adding get_valuelist() to GstStructure might work in my case,
but GstValueList/Array is not necessarily contained in a GstStructure,
like a GstValueList contained in another GstValueList.

So I made a patch to make those two types as GBoxed derived types
and it worked, but I'm not sure if it is the right way to fix the problem.
Is there a (better) way to access GstValueList/Array from python scripts?

regards,
Akihiro


More information about the gstreamer-devel mailing list