I have a python audio player based on gstreamer and dbus http://sourceforge.net/p/autoradiobc/code/210/tree/trunk/autoradio/autoplayer/player_gstreamer1.py . It works with pygst and I want port it to gstreamer 1. Following this how to https://wiki.ubuntu.com/Novacut/GStreamer1.0 it's going to work but:
File "/home/pat1/svn/autoradio/autoradio/autoplayer/player.py", line 826, in position
except(Gst.QueryError):
File "/usr/lib64/python2.7/site-packages/gi/module.py", line 316, in __getattr__
return getattr(self._introspection_module, name)
File "/usr/lib64/python2.7/site-packages/gi/module.py", line 135, in __getattr__
self.__name__, name))
AttributeError: 'gi.repository.Gst' object has no attribute 'QueryError'
it's in this part of code:
try:
pos_int = self.player.query_position(Gst.Format.TIME, None)[0]
except(Gst.QueryError):
logging.warning( "Gst.QueryError in query_position" )
return None
bypassing this problem after I get :
if ret == Gst.State.CHANGE_FAILURE:
AttributeError: type object 'GstState' has no attribute 'CHANGE_FAILURE'
in this part of code:
ret = self.player.set_state(Gst.State.READY)
if ret == Gst.State.CHANGE_FAILURE:
logging.error( "Unable to set the pipeline to the READY state.")
bypassing this problem too, I get:
File "/home/pat1/svn/autoradio/autoradio/autoplayer/player.py", line 659, in on_message_state_changed
(Gst.element_state_get_name(old_state),
File "/usr/lib64/python2.7/site-packages/gi/module.py", line 316, in __getattr__
return getattr(self._introspection_module, name)
File "/usr/lib64/python2.7/site-packages/gi/module.py", line 135, in __getattr__
self.__name__, name))
AttributeError: 'gi.repository.Gst' object has no attribute 'element_state_get_name'
in this part of code:
logging.debug("Pipeline state changed from %s to %s. Pendig: %s"%
(Gst.element_state_get_name(old_state),
Gst.element_state_get_name (new_state),
Gst.element_state_get_name (pending_state)))
commenting out element_state_get_name the player is going to work ....
How I can migrate to gstreamer 1 the full code without bypass the broken code ?
I cannot find solution to the first problem about QueryError
but :
if ret == Gst.State.CHANGE_FAILURE:
become:
if ret == Gst.StateChangeReturn.FAILURE:
and:
Gst.element_state_get_name(old_state)
become:
Gst.Element.state_get_name(old_state)
and:
self.player.set_new_stream_time(0L)
become:
self.player.set_start_time(0L)
and:
event = Gst.event_new_seek(1.0, Gst.Format.TIME,
Gst.SeekFlags.FLUSH|Gst.SeekFlags.ACCURATE,
Gst.SEEK_TYPE_SET, tnano, Gst.SEEK_TYPE_NONE, 0)
become:
event = Gst.Event.new_seek(1.0, Gst.Format.TIME,
Gst.SeekFlags.FLUSH|Gst.SeekFlags.ACCURATE,
Gst.SeekType.SET, tnano, Gst.SeekType.NONE, 0)
and:
pos_int = self.player.query_duration(Gst.Format.TIME, None)[0]
become:
pos_int = self.player.query_duration(Gst.Format.TIME)[1]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.