[cvs-annodex] commit (/annodex): annoamp/trunk/anxplayer.py
jkivlighn
nobody at lists.annodex.net
Wed Nov 9 08:34:45 EST 2005
Update of /annodex (new revision 1615)
Modified files:
annoamp/trunk/anxplayer.py
Log Message:
Along the lines of the last commit, for simplicity get the duration in the switch_source() function. We can do this now because pause() now blocks until the stream is really paused, meaning we're guaranteed the state is such that we can query for the duration.
Modified: annoamp/trunk/anxplayer.py
===================================================================
--- annoamp/trunk/anxplayer.py 2005-11-08 21:31:14 UTC (rev 1614)
+++ annoamp/trunk/anxplayer.py 2005-11-08 21:34:43 UTC (rev 1615)
@@ -112,18 +112,6 @@
taglist = message.parse_tag()
taglist.foreach(temp)
- elif message.type == gst.MESSAGE_STATE_CHANGED:
- #When in the paused state we can get the duration. We are interested when the pipeline goes to pause and it hasn't already
- #been playing or been paused
- if message.parse_state_changed()[1] == gst.STATE_PAUSED and message.parse_state_changed()[0] < gst.STATE_PAUSED and message.src == self.bin:
- self.debug(str(message.type) + "=>" + str(message))
- print "Update duration."
- try:
- self.duration = self.bin.query_duration(gst.FORMAT_TIME)[0]/gst.SECOND
- self.debug("Update duration: " + str(self.duration) + " sec")
- self.duration_callback(self.duration)
- except:
- self.error("Please get the newest gst-python CVS HEAD.")
elif message.type == gst.MESSAGE_ERROR:
self.error(message.parse_error())
return True
@@ -136,6 +124,12 @@
self.playbin.props.uri = "file://" + filename
self.pause() #we'll be in a state where we can seek, if necessary
+ try:
+ self.duration = self.bin.query_duration(gst.FORMAT_TIME)[0]/gst.SECOND
+ self.debug("Update duration: " + str(self.duration) + " sec")
+ self.duration_callback(self.duration)
+ except:
+ self.error("Please get the newest gst-python CVS HEAD.")
self.pos = -1
self.current = child
--
jkivlighn
More information about the cvs-annodex
mailing list