Commit f6025c7b authored by Edward Hervey's avatar Edward Hervey

* pitivi/bin.py:

Fixed recording for tee -> identity conversion/hack.
We remove audio/video sink when encoding and put them back when finished.
* pitivi/playground.py:
added debug for position signal emission.
* pitivi/ui/complextimeline.py:
don't send a negative frame value to toplayer's timelinePositionChanged
* pitivi/ui/encodingdialog.glade:
Better order for buttons.
Cancel button becomes close button.
* pitivi/ui/viewer.py:
Grey-out (set_sensitive()) the main window when the encoding dialog is showing.
Lots of fixes with the EncodingDialog:
_ Close button becomes cancel when encoding
_ Show Time Left in progressbar
_ Use playground's 'position' signal


git-svn-id: svn+ssh://svn.gnome.org/svn/pitivi/trunk@779 d3729300-e425-0410-8a4c-d956edccc248
parent 8ec571b2
2006-05-16 Edward Hervey <edward@fluendo.com>
* pitivi/bin.py:
Fixed recording for tee -> identity conversion/hack.
We remove audio/video sink when encoding and put them back when finished.
* pitivi/playground.py:
added debug for position signal emission.
* pitivi/ui/complextimeline.py:
don't send a negative frame value to toplayer's timelinePositionChanged
* pitivi/ui/encodingdialog.glade:
Better order for buttons.
Cancel button becomes close button.
* pitivi/ui/viewer.py:
Grey-out (set_sensitive()) the main window when the encoding dialog is showing.
Lots of fixes with the EncodingDialog:
_ Close button becomes cancel when encoding
_ Show Time Left in progressbar
_ Use playground's 'position' signal
2006-05-16 Edward Hervey <edward@fluendo.com>
* pitivi/ui/viewer.py:
......
......@@ -65,6 +65,7 @@ class SmartBin(gst.Pipeline):
self.vsinkthread = None
self.encthread = None
self.tmpasink = None
self.tmpvsink = None
def _addSource(self):
""" add the source to self """
......@@ -174,6 +175,12 @@ class SmartBin(gst.Pipeline):
if not self.removeAudioSinkThread():
return False
# FIXME : remove this once BaseTransform is fixed
# Also temporarily remove the videosinkthread
self.tmpvsink = self.vsinkthread
if not self.removeVideoSinkThread():
return False
self.debug("creating and adding encoding thread")
self.encthread = self._makeEncThread(uri, settings)
if not self.encthread:
......@@ -183,17 +190,17 @@ class SmartBin(gst.Pipeline):
self.debug("encoding thread added")
# set sync=false on the videosink
self.getRealVideoSink().set_property("sync", False)
#self.getRealVideoSink().set_property("sync", False)
self.debug("linking vtee to ecnthread:vsink")
try:
self.vtee.get_pad("src%d").link(self.encthread.get_pad("vsink"))
self.vtee.get_pad("src").link(self.encthread.get_pad("vsink"))
except:
return False
self.debug("linking atee to encthread:asink")
try:
self.atee.get_pad("src%d").link(self.encthread.get_pad("asink"))
self.atee.get_pad("src").link(self.encthread.get_pad("asink"))
except:
return False
......@@ -214,10 +221,13 @@ class SmartBin(gst.Pipeline):
apad = self.encthread.get_pad("asink")
apad.get_peer().unlink(apad)
self.remove(self.encthread)
self.encthread.set_state(gst.STATE_NULL)
del self.encthread
self.encthread = None
self.setAudioSinkThread(self.tmpasink)
self.setVideoSinkThread(self.tmpvsink)
self.tmpasink = None
self.tmpvsink = None
self.getRealVideoSink().set_property("sync", True)
......
......@@ -287,6 +287,7 @@ class PlayGround(gobject.GObject):
except:
self.current.warning("Couldn't get position in time")
cur = 0
gst.log("emitting 'position' with value %s" % gst.TIME_ARGS(cur))
self.emit('position', self.current, cur)
# hit me !
......
......@@ -183,4 +183,4 @@ class ComplexTimelineWidget(gtk.VBox, ZoomableWidgetInterface):
def _playgroundPositionCb(self, unused_playground, smartbin, value):
if isinstance(smartbin, SmartTimelineBin):
# for the time being we only inform the ruler
self.topLayer.timelinePositionChanged(value, frame=-1)
self.topLayer.timelinePositionChanged(value, 0)
......@@ -32,32 +32,32 @@
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="recordbutton">
<widget class="GtkButton" id="cancelbutton">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-media-record</property>
<property name="label">gtk-close</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">-5</property>
<signal name="clicked" handler="_recordButtonClickedCb" last_modification_time="Tue, 24 May 2005 21:41:00 GMT"/>
<property name="response_id">-6</property>
<signal name="clicked" handler="_cancelButtonClickedCb" last_modification_time="Tue, 24 May 2005 21:41:09 GMT"/>
</widget>
</child>
<child>
<widget class="GtkButton" id="cancelbutton">
<widget class="GtkButton" id="recordbutton">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-cancel</property>
<property name="label">gtk-media-record</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">-6</property>
<signal name="clicked" handler="_cancelButtonClickedCb" last_modification_time="Tue, 24 May 2005 21:41:09 GMT"/>
<property name="response_id">-5</property>
<signal name="clicked" handler="_recordButtonClickedCb" last_modification_time="Tue, 24 May 2005 21:41:00 GMT"/>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
......
......@@ -22,6 +22,7 @@
import os.path
import gobject
import time
import gtk
import gst
import gst.interfaces
......@@ -365,9 +366,14 @@ class PitiviViewer(gtk.VBox):
## Control gtk.Button callbacks
def _encodingDialogDestroyCb(self, unused_dialog):
instance.PiTiVi.gui.set_sensitive(True)
def _recordCb(self, unused_button):
win = EncodingDialog(instance.PiTiVi.current)
win.window.connect("destroy", self._encodingDialogDestroyCb)
instance.PiTiVi.gui.set_sensitive(False)
win.show()
def _rewindCb(self, unused_button):
......@@ -395,7 +401,6 @@ class PitiviViewer(gtk.VBox):
def _playgroundPositionCb(self, playground, smartbin, pos):
self._newTime(pos)
print smartbin, pos
def _currentPlaygroundChangedCb(self, playground, smartbin):
if not smartbin == playground.default:
......@@ -523,9 +528,11 @@ class EncodingDialog(GladeWindow):
self.eosid = self.bus.connect("message::eos", self._eosCb)
self.outfile = None
self.progressbar = self.widgets["progressbar"]
self.timeoutid = None
self.cancelbutton = self.widgets["cancelbutton"]
self.positionhandler = 0
self.rendering = False
self.settings = project.settings
self.timestarted = 0
def _fileButtonClickedCb(self, button):
......@@ -543,11 +550,23 @@ class EncodingDialog(GladeWindow):
button.set_label(os.path.basename(self.outfile))
dialog.destroy()
def _positionCb(self, playground, smartbin, position):
timediff = time.time() - self.timestarted
self.progressbar.set_fraction(float(position) / float(self.bin.length))
if timediff > 5.0:
# only display ETA after 5s in order to have enough averaging
totaltime = (timediff * float(self.bin.length) / float(position)) - timediff
self.progressbar.set_text("Finished in %dm%ds" % (int(totaltime) / 60,
int(totaltime) % 60))
def _recordButtonClickedCb(self, unused_button):
if self.outfile and not self.rendering:
if self.bin.record(self.outfile, self.settings):
self.timeoutid = gobject.timeout_add(400, self._timeoutCb)
self.timestarted = time.time()
self.positionhandler = instance.PiTiVi.playground.connect('position', self._positionCb)
self.rendering = True
self.cancelbutton.set_label("gtk-cancel")
self.progressbar.set_text("Rendering")
else:
self.progressbar.set_text("Couldn't start rendering")
......@@ -559,20 +578,6 @@ class EncodingDialog(GladeWindow):
self.settings = dialog.getSettings()
dialog.destroy()
def _timeoutCb(self):
result, state, pending = self.bin.get_state(0)
if state == gst.STATE_PLAYING and self.rendering:
# check time
value, format = self.bin.query_position(gst.FORMAT_TIME)
# set progresbar to percentage
self.progressbar.set_fraction(float(value) / float(self.bin.length))
# display current time in progressbar
self.progressbar.set_text(time_to_string(value))
return True
self.timeoutid = False
return False
def do_destroy(self):
gst.debug("cleaning up...")
self.bus.remove_signal_watch()
......@@ -580,14 +585,18 @@ class EncodingDialog(GladeWindow):
def _eosCb(self, unused_bus, unused_message):
self.rendering = False
self.progressbar.set_text("Rendering Finished")
if self.positionhandler:
instance.PiTiVi.playground.disconnect(self.positionhandler)
self.positionhandler = 0
self.progressbar.set_text("Rendering Complete")
self.progressbar.set_fraction(1.0)
gobject.source_remove(self.timeoutid)
self.cancelbutton.set_label("gtk-close")
def _cancelButtonClickedCb(self, unused_button):
self.bin.stopRecording()
if self.timeoutid:
gobject.source_remove(self.timeoutid)
self.timeoutid = None
if self.positionhandler:
instance.PiTiVi.playground.disconnect(self.positionhandler)
self.positionhandler = 0
instance.PiTiVi.playground.pause()
self.destroy()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment