Development Team/Almanac/GStreamer: Difference between revisions

Newacct (talk | contribs)
mNo edit summary
 
(3 intermediate revisions by 2 users not shown)
Line 50: Line 50:
def setFile(self, path):
def setFile(self, path):
uri = "file://" + str( path )
uri = "file://" + str( path )
if (self.player.get_property('uri') == uri):
if self.player.get_property('uri') == uri:
self.seek(gst.SECOND*0)
self.seek(gst.SECOND*0)
return
return
Line 57: Line 57:
self.player.set_property('uri', uri)
self.player.set_property('uri', uri)
ext = uri[len(uri)-3:]
ext = uri[len(uri)-3:]
if (ext == "jpg"):
if ext == "jpg":
self.pause()
self.pause()
else:
else:
Line 119: Line 119:


def set_sink(self, sink):
def set_sink(self, sink):
if (self.imagesink != None):
if self.imagesink != None:
assert self.window.xid
assert self.window.xid
self.imagesink = None
self.imagesink = None
Line 240: Line 240:


def removeCallbacks( self ):
def removeCallbacks( self ):
if (self.UPDATE_SCALE_ID != 0):
if self.UPDATE_SCALE_ID != 0:
gobject.source_remove(self.UPDATE_SCALE_ID)
gobject.source_remove(self.UPDATE_SCALE_ID)
self.UPDATE_SCALE_ID = 0
self.UPDATE_SCALE_ID = 0
if (self.CHANGED_ID != 0):
if self.CHANGED_ID != 0:
gobject.source_remove(self.CHANGED_ID)
gobject.source_remove(self.CHANGED_ID)
self.CHANGED_ID = 0
self.CHANGED_ID = 0
Line 266: Line 266:
def play_toggled(self):
def play_toggled(self):
self.p_position, self.p_duration = self._gplay.queryPosition()
self.p_position, self.p_duration = self._gplay.queryPosition()
if (self.p_position == self.p_duration):
if self.p_position == self.p_duration:
self._gplay.seek(0)
self._gplay.seek(0)
self._gplay.pause()
self._gplay.pause()
Line 331: Line 331:
if self.p_position != gst.CLOCK_TIME_NONE:
if self.p_position != gst.CLOCK_TIME_NONE:
value = self.p_position * 100.0 / self.p_duration
value = self.p_position * 100.0 / self.p_duration
if (value > 99):
if value > 99:
value = 99
value = 99
elif (value < 0):
elif value < 0:
value = 0
value = 0


self.adjustment.set_value(value)
self.adjustment.set_value(value)


if self._gplay.is_playing() and (self.p_position == self.p_duration):
if self._gplay.is_playing() and self.p_position == self.p_duration:
self._gplay.pause()
self._gplay.pause()
self.set_button_play()
self.set_button_play()