Changeset 1615

Show
Ignore:
Timestamp:
2005-11-08 13:34:43 (3 years ago)
Author:
jkivlighn
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.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • annoamp/trunk/anxplayer.py

    r1614 r1615  
    113113            taglist = message.parse_tag() 
    114114            taglist.foreach(temp) 
    115         elif message.type == gst.MESSAGE_STATE_CHANGED: 
    116             #When in the paused state we can get the duration.  We are interested when the pipeline goes to pause and it hasn't already 
    117             #been playing or been paused 
    118             if message.parse_state_changed()[1] == gst.STATE_PAUSED and message.parse_state_changed()[0] < gst.STATE_PAUSED and message.src == self.bin: 
    119                 self.debug(str(message.type) + "=>" + str(message)) 
    120                 print "Update duration." 
    121                 try: 
    122                     self.duration = self.bin.query_duration(gst.FORMAT_TIME)[0]/gst.SECOND 
    123                     self.debug("Update duration: " + str(self.duration) + " sec") 
    124                     self.duration_callback(self.duration) 
    125                 except: 
    126                     self.error("Please get the newest gst-python CVS HEAD.") 
    127115        elif message.type == gst.MESSAGE_ERROR: 
    128116            self.error(message.parse_error()) 
     
    137125         
    138126        self.pause() #we'll be in a state where we can seek, if necessary 
     127        try: 
     128            self.duration = self.bin.query_duration(gst.FORMAT_TIME)[0]/gst.SECOND 
     129            self.debug("Update duration: " + str(self.duration) + " sec") 
     130            self.duration_callback(self.duration) 
     131        except: 
     132            self.error("Please get the newest gst-python CVS HEAD.") 
    139133 
    140134        self.pos = -1