GNOME Bugzilla – Bug 677918
g-i: GstPlayBin raises RuntimeError accesing to property element
Last modified: 2012-06-12 09:21:14 UTC
Using the object GstPlayBin function causes a RuntimeError exception on python. I am using Ubuntu 12.10 with Gstreamer 0.11.91-2. This is the exaple code: #!/usr/bin/env python # -*- coding: utf-8; tab-width: 4; mode: python -*- # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: t -*- # vi: set ft=python sts=4 ts=4 sw=4 noet import sys import gi try: gi.require_version('Gst', '1.0') from gi.repository import Gst except ValueError: print 'Could not find required Gstreamer 1.0 library.' sys.exit(1) # Setup GStreamer Gst.init(None) Gst.init_check(None) print Gst.version_string(), Gst.version() if Gst.ElementFactory.find('playbin'): # filesrc player = Gst.ElementFactory.make('playbin', 'MultimediaPlayer') if player == None: print 'Error: could not create the player' sys.exit(1) else: print 'Player element', player.element else: print 'Error: could not find the playbin plugin for gstreamer' sys.exit(1) Running the example shows this traceback GStreamer 1.0.0 (1L, 0L, 0L, 0L) Player element Traceback (most recent call last):
+ Trace 230347
print 'Player element', player.element
Same for player.bin (access to Gst.Bin)
> print 'Player element', player.element > Same for player.bin (access to Gst.Bin) Why do you think this should work? There is no "element" property, nor a "bin" property. What does the corresponding C code look like?
They are public member attributes on class, so you can access. It should not be exposed or it should be private on python if no reason to show or use it. On .gir file appears Pipeline class: <class name="Pipeline" c:symbol-prefix="pipeline" c:type="GstPipeline" parent="Bin" glib:type-name="GstPipeline" glib:get-type="gst_pipeline_get_type" glib:type-struct="PipelineClass"> The are a field "bin": <field name="bin"> <type name="Bin" c:type="GstBin"/> </field> The same for element, probably inherit by GstBin.
These are not GObject properties. They are fields in the object structure, but you most definitely should not access them from bindings like python. Please stop looking for stuff in the XML file and instead look at the API reference and our object hierarchy.