After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 677918 - g-i: GstPlayBin raises RuntimeError accesing to property element
g-i: GstPlayBin raises RuntimeError accesing to property element
Status: RESOLVED NOTABUG
Product: GStreamer
Classification: Platform
Component: gst-plugins-base
0.11.x
Other Linux
: Normal normal
: NONE
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2012-06-12 05:08 UTC by Ángel Guzmán Maeso (shakaran)
Modified: 2012-06-12 09:21 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Ángel Guzmán Maeso (shakaran) 2012-06-12 05:08:05 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):
  • File "/home/shakaran/gst_player_element.py", line 28 in <module>
    print 'Player element', player.element
RuntimeError: unable to get the value

Comment 1 Ángel Guzmán Maeso (shakaran) 2012-06-12 05:09:54 UTC
Same for player.bin (access to Gst.Bin)
Comment 2 Tim-Philipp Müller 2012-06-12 08:28:33 UTC
> 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?
Comment 3 Ángel Guzmán Maeso (shakaran) 2012-06-12 08:43:30 UTC
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.
Comment 4 Tim-Philipp Müller 2012-06-12 09:21:14 UTC
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.