GNOME Bugzilla – Bug 679856
Can't read nested structures from python/gi
Last modified: 2013-08-21 06:20:30 UTC
Some Gst.Structures contain members which are arrays/lists of other structures, for example the dvbsrc element posts messages about the DVB SI, including a "nit" message with a "transports" member which contains a list/array of other structures. With the old (0.10) python bindings I could read this member by using struct["transports"] and iterate over the python list it returned. But in gi there is no get_* method for a list/array. I tried get_value() but it causes an exception: TypeError: unknown type GstValueList I'm also thinking, wouldn't I have the same problem in C? Gst.Structure.foreach() seems not to be working too. If I call it on the entire nit structure with a function that does print(" %s: %s" % (name, value)), it prints, for example: 2168: 12340 2165: 17 2169: 1 2170: True 2171: South 2166: ['@\x05South', '\x7f%\nGBRengGEngland\x01\x85South\x01\x0f\x8aSouth East\x01\x17', '\x7f\n\tGBR\xfa\x01\x0f\xfa\x01\x17', 'J\x0c\x10C#:\x11@\t\x04\x00\x01Z\x00', 'J\x0c\x10L#:\x11@\t\x04\x00\x01Z\x00', 'J\x0c@\x83#:D@\t\x04\x00\x01Z\x00', '\x7f\x9b\x08\xffengNetwork change notification; enhanced network configuration; Version 2.0 Network change notification; enhanced network configuration; Version 2.0'] But if I print the output of the same structure's to_string() method it's completely different: nit, network-id=(uint)12340, version-number=(uint)17, current-next-indicator=(uint)1, actual-network=(boolean)true, network-name=(string)South, descriptors=(GValueArray)NULL, transports=(structure){ "transport-4163\,\ transport-stream-id\=\(uint\)4163\,\ original-network-id\=\(uint\)9018\,\ delivery\=\(structure\)\"terrestrial\\\,\\\ frequency\\\=\\\(uint\\\)498000000\\\,\\\ bandwidth\\\=\\\(uint\\\)8\\\,\\\ constellation\\\=\\\(string\\\)QAM64\\\,\\\ hierarchy\\\=\\\(uint\\\)0\\\,\\\ code-rate-hp\\\=\\\(string\\\)2/3\\\,\\\ code-rate-lp\\\=\\\(string\\\)1/2\\\,\\\ guard-interval\\\=\\\(uint\\\)32\\\,\\\ transmission-mode\\\=\\\(string\\\)8k\\\,\\\ other-frequency\\\=\\\(boolean\\\)true\\\;\"\,\ channels\=\(structure\)\{\ \"channels\\\,\\\ service-id\\\=\\\(uint\\\)4163\\\,\\\ logical-channel-number\\\=\\\(uint\\\)1\\\;\"\,\ \"channels\\\,\\\ service-id\\\=\\\(uint\\\)4288\\\,\\\ logical-channel-number\\\=\\\(uint\\\)7\\\;\"\,\ \"channels\\\,\\\ service-id\\\=\\\(uint\\\)4672\\\,\\\ logical-channel-number\\\=\\\(uint\\\)71\\\;\"\,\ \"channels\\\,\\\ service-id\\\=\\\(uint\\\)6848\\\,\\\ logical-channel-number\\\=\\\(uint\\\)703\\\;\"\,\ \"channels\\\,\\\ service-id\\\=\\\(uint\\\)5760\\\,\\\ logical-channel-number\\\=\\\(uint\\\)707\\\;\"\,\ \"channels\\\,\\\ service-id\\\=\\\(uint\\\)4416\\\,\\\ logical-channel-number\\\=\\\(uint\\\)105\\\;\"\,\ \"channels\\\,\\\ service-id\\\=\\\(uint\\\)4544\\\,\\\ logical-channel-number\\\=\\\(uint\\\)9\\\;\"\,\ \"channels\\\,\\\ service-id\\\=\\\(uint\\\)4736\\\,\\\ logical-channel-number\\\=\\\(uint\\\)81\\\;\"\,\ \"channels\\\,\\\ service-id\\\=\\\(uint\\\)5632\\\,\\\ logical-channel-number\\\=\\\(uint\\\)705\\\;\"\,\ \"channels\\\,\\\ service-id\\\=\\\(uint\\\)5888\\\,\\\ logical-channel-number\\\=\\\(uint\\\)701\\\;\"\,\ \"channels\\\,\\\ service-id\\\=\\\(uint\\\)7168\\\,\\\ logical-channel-number\\\=\\\(uint\\\)301\\\;\"\,\ \"channels\\\,\\\ service-id\\\=\\\(uint\\\)5952\\\,\\\ logical-channel-number\\\=\\\(uint\\\)709\\\;\"\,\ \"channels\\\,\\\ service-id\\\=\\\(uint\\\)4287\\\,\\\ logical-channel-number\\\=\\\(uint\\\)2\\\;\"\,\ \"channels\\\,\\\ service-id\\\=\\\(uint\\\)4608\\\,\\\ logical-channel-number\\\=\\\(uint\\\)70\\\;\"\,\ \"channels\\\,\\\ service-id\\\=\\\(uint\\\)6016\\\,\\\ logical-channel-number\\\=\\\(uint\\\)710\\\;\"\,\ \"channels\\\,\\\ service-id\\\=\\\(uint\\\)6784\\\,\\\ logical-channel-number\\\=\\\(uint\\\)702\\\;\"\,\ \"channels\\\,\\\ service-id\\\=\\\(uint\\\)7232\\\,\\\ logical-channel-number\\\=\\\(uint\\\)302\\\;\"\,\ \"channels\\\,\\\ service-id\\\=\\\(uint\\\)5696\\\,\\\ logical-channel-number\\\=\\\(uint\\\)706\\\;\"\,\ \"channels\\\,\\\ service-id\\\=\\\(uint\\\)4352\\\,\\\ logical-channel-number\\\=\\\(uint\\\)80\\\;\"\,\ \"channels\\\,\\\ service-id\\\=\\\(uint\\\)6912\\\,\\\ logical-channel-number\\\=\\\(uint\\\)704\\\;\"\,\ \"channels\\\,\\\ service-id\\\=\\\(uint\\\)5824\\\,\\\ logical-channel-number\\\=\\\(uint\\\)708\\\;\"\,\ \"channels\\\,\\\ service-id\\\=\\\(uint\\\)6720\\\,\\\ logical-channel-number\\\=\\\(uint\\\)700\\\;\"\ \}\,\ descriptors\=\(GValueArray\)NULL\;", "transport-4172\,\ transport-stream-id\=\(uint\)4172\,\ original-network-id\=\(uint\)9018\,\ delivery\=\(structure\)\"terrestrial\\\,\\\ frequency\\\=\\\(uint\\\)674000000\\\,\\\ bandwidth\\\=\\\(uint\\\)8\\\,\\\ constellation\\\=\\\(string\\\)QAM64\\\,\\\ hierarchy\\\=\\\(uint\\\)0\\\,\\\ code-rate-hp\\\=\\\(string\\\)2/3\\\,\\\ code-rate-lp\\\=\\\(string\\\)1/2\\\,\\\ guard-interval\\\=\\\(uint\\\)32\\\,\\\ transmission-mode\\\=\\\(string\\\)8k\\\,\\\ other-frequency\\\=\\\(boolean\\\)true\\\;\"\,\ channels\=\(structure\)\{\ \"channels\\\,\\\ service-id\\\=\\\(uint\\\)4172\\\,\\\ logical-channel-number\\\=\\\(uint\\\)1\\\;\"\,\ \"channels\\\,\\\ service-id\\\=\\\(uint\\\)4288\\\,\\\ logical-channel-number\\\=\\\(uint\\\)7\\\;\"\,\ \"channels\\\,\\\ service-id\\\=\\\(uint\\\)4672\\\,\\\ logical-channel-number\\\=\\\(uint\\\)71\\\;\"\,\ \"channels\\\,\\\ service-id\\\=\\\(uint\\\)6848\\\,\\\ logical-channel-number\\\=\\\(uint\\\)703\\\;\"\,\ \"channels\\\,\\\ service-id\\\=\\\(uint\\\)5760\\\,\\\ logical-channel-number\\\=\\\(uint\\\)707\\\;\"\,\ \"channels\\\,\\\ service-id\\\=\\\(uint\\\)4416\\\,\\\ logical-channel-number\\\=\\\(uint\\\)105\\\;\"\,\ \"channels\\\,\\\ service-id\\\=\\\(uint\\\)4544\\\,\\\ logical-channel-number\\\=\\\(uint\\\)9\\\;\"\,\ \"channels\\\,\\\ service-id\\\=\\\(uint\\\)4736\\\,\\\ logical-channel-number\\\=\\\(uint\\\)81\\\;\"\,\ \"channels\\\,\\\ service-id\\\=\\\(uint\\\)5632\\\,\\\ logical-channel-number\\\=\\\(uint\\\)705\\\;\"\,\ \"channels\\\,\\\ service-id\\\=\\\(uint\\\)5888\\\,\\\ logical-channel-number\\\=\\\(uint\\\)701\\\;\"\,\ \"channels\\\,\\\ service-id\\\=\\\(uint\\\)7168\\\,\\\ logical-channel-number\\\=\\\(uint\\\)301\\\;\"\,\ \"channels\\\,\\\ service-id\\\=\\\(uint\\\)5952\\\,\\\ logical-channel-number\\\=\\\(uint\\\)709\\\;\"\,\ \"channels\\\,\\\ service-id\\\=\\\(uint\\\)4287\\\,\\\ logical-channel-number\\\=\\\(uint\\\)2\\\;\"\,\ \"channels\\\,\\\ service-id\\\=\\\(uint\\\)4608\\\,\\\ logical-channel-number\\\=\\\(uint\\\)70\\\;\"\,\ \"channels\\\,\\\ service-id\\\=\\\(uint\\\)6016\\\,\\\ logical-channel-number\\\=\\\(uint\\\)710\\\;\"\,\ \"channels\\\,\\\ service-id\\\=\\\(uint\\\)6784\\\,\\\ logical-channel-number\\\=\\\(uint\\\)702\\\;\"\,\ \"channels\\\,\\\ service-id\\\=\\\(uint\\\)7232\\\,\\\ logical-channel-number\\\=\\\(uint\\\)302\\\;\"\,\ \"channels\\\,\\\ service-id\\\=\\\(uint\\\)5696\\\,\\\ logical-channel-number\\\=\\\(uint\\\)706\\\;\"\,\ \"channels\\\,\\\ service-id\\\=\\\(uint\\\)4352\\\,\\\ logical-channel-number\\\=\\\(uint\\\)80\\\;\"\,\ \"channels\\\,\\\ service-id\\\=\\\(uint\\\)6912\\\,\\\ logical-channel-number\\\=\\\(uint\\\)704\\\;\"\,\ \"channels\\\,\\\ service-id\\\=\\\(uint\\\)5824\\\,\\\ logical-channel-number\\\=\\\(uint\\\)708\\\;\"\,\ \"channels\\\,\\\ service-id\\\=\\\(uint\\\)6720\\\,\\\ logical-channel-number\\\=\\\(uint\\\)700\\\;\"\ \}\,\ descriptors\=\(GValueArray\)NULL\;", "transport-8206\,\ transport-stream-id\=\(uint\)8206\,\ original-network-id\=\(uint\)9018\,\ delivery\=\(structure\)\"terrestrial\\\,\\\ frequency\\\=\\\(uint\\\)522000000\\\,\\\ bandwidth\\\=\\\(uint\\\)8\\\,\\\ constellation\\\=\\\(string\\\)QAM64\\\,\\\ hierarchy\\\=\\\(uint\\\)0\\\,\\\ code-rate-hp\\\=\\\(string\\\)2/3\\\,\\\ code-rate-lp\\\=\\\(string\\\)1/2\\\,\\\ guard-interval\\\=\\\(uint\\\)32\\\,\\\ transmission-mode\\\=\\\(string\\\)8k\\\,\\\ other-frequency\\\=\\\(boolean\\\)true\\\;\"\,\ channels\=\(structure\)\{\ \"channels\\\,\\\ service-id\\\=\\\(uint\\\)8577\\\,\\\ logical-channel-number\\\=\\\(uint\\\)103\\\;\"\,\ \"channels\\\,\\\ service-id\\\=\\\(uint\\\)8270\\\,\\\ logical-channel-number\\\=\\\(uint\\\)3\\\;\"\,\ \"channels\\\,\\\ service-id\\\=\\\(uint\\\)8370\\\,\\\ logical-channel-number\\\=\\\(uint\\\)33\\\;\"\,\ \"channels\\\,\\\ service-id\\\=\\\(uint\\\)8452\\\,\\\ logical-channel-number\\\=\\\(uint\\\)13\\\;\"\,\ \"channels\\\,\\\ service-id\\\=\\\(uint\\\)8500\\\,\\\ logical-channel-number\\\=\\\(uint\\\)5\\\;\"\,\ \"channels\\\,\\\ service-id\\\=\\\(uint\\\)8325\\\,\\\ logical-channel-number\\\=\\\(uint\\\)6\\\;\"\,\ \"channels\\\,\\\ service-id\\\=\\\(uint\\\)8634\\\,\\\ logical-channel-number\\\=\\\(uint\\\)102\\\;\"\,\ \"channels\\\,\\\ service-id\\\=\\\(uint\\\)8442\\\,\\\ logical-channel-number\\\=\\\(uint\\\)14\\\;\"\,\ \"channels\\\,\\\ service-id\\\=\\\(uint\\\)8384\\\,\\\ logical-channel-number\\\=\\\(uint\\\)4\\\;\"\,\ \"channels\\\,\\\ service-id\\\=\\\(uint\\\)8448\\\,\\\ logical-channel-number\\\=\\\(uint\\\)28\\\;\"\ \}\,\ descriptors\=\(GValueArray\)NULL\;", "transport-16515\,\ transport-stream-id\=\(uint\)16515\,\ original-network-id\=\(uint\)9018\,\ channels\=\(structure\)\{\ \"channels\\\,\\\ service-id\\\=\\\(uint\\\)17603\\\,\\\ logical-channel-number\\\=\\\(uint\\\)51\\\;\"\,\ \"channels\\\,\\\ service-id\\\=\\\(uint\\\)20288\\\,\\\ logical-channel-number\\\=\\\(uint\\\)117\\\;\"\,\ \"channels\\\,\\\ service-id\\\=\\\(uint\\\)17472\\\,\\\ logical-channel-number\\\=\\\(uint\\\)54\\\;\"\,\ \"channels\\\,\\\ service-id\\\=\\\(uint\\\)17540\\\,\\\ logical-channel-number\\\=\\\(uint\\\)50\\\;\"\,\ \"channels\\\,\\\ service-id\\\=\\\(uint\\\)19648\\\,\\\ logical-channel-number\\\=\\\(uint\\\)304\\\;\"\,\ \"channels\\\,\\\ service-id\\\=\\\(uint\\\)17664\\\,\\\ logical-channel-number\\\=\\\(uint\\\)52\\\;\"\ \}\,\ descriptors\=\(GValueArray\)NULL\;" };
Moving to our overrides module, since I don't think it's a core issue (or is it?)
Closing this bug now, gst-python is only an extension module to pygi now and this bug doesn't make much sense anymore in this context.
I don't get why this was 1) moved to gst-python, 2) closed without explanation. The issue seems to be a type not recognized. So either the element emitting those structures (tsdemux/tsparse) is not using standard types or it's pygobject not handling the type properly.
This should no longer be an issue now that we have the mpegts library. from gi.repository import GstMpegTs Should we close this ?
Closing.