Commit d1e22db2 authored by Edward Hervey's avatar Edward Hervey

* bin/pitivi.in:

Use gst-python 0.9
* pitivi/bin.py:
* pitivi/discoverer.py:
* pitivi/effects.py:
* pitivi/pitivi.py:
* pitivi/playground.py:
* pitivi/project.py:
* pitivi/settings.py:
* pitivi/sourcelist.py:
* pitivi/timeline.py:
* pitivi/ui/mainwindow.py:
* pitivi/ui/timeline.py:
* pitivi/ui/viewer.py:
Added some debugging output,
commented out gnonlin-specific parts of PiTiVi, which will have to be
removed once gnonlin is ported


git-svn-id: svn+ssh://svn.gnome.org/svn/pitivi/trunk@658 d3729300-e425-0410-8a4c-d956edccc248
parent 462df4eb
2005-09-22 Edward Hervey <edward@fluendo.com>
* bin/pitivi.in:
Use gst-python 0.9
* pitivi/bin.py:
* pitivi/discoverer.py:
* pitivi/effects.py:
* pitivi/pitivi.py:
* pitivi/playground.py:
* pitivi/project.py:
* pitivi/settings.py:
* pitivi/sourcelist.py:
* pitivi/timeline.py:
* pitivi/ui/mainwindow.py:
* pitivi/ui/timeline.py:
* pitivi/ui/viewer.py:
Added some debugging output,
commented out gnonlin-specific parts of PiTiVi, which will have to be
removed once gnonlin is ported
2005-07-23 Edward Hervey <edward@fluendo.com>
On our way to a gstreamer 0.9 pitivi :)
......
......@@ -52,6 +52,9 @@ def _init_gobject_gtk_gst():
raise SystemExit("PyGTK couldn't be found !")
try:
import pygst
pygst.require('0.9')
import gst
except ImportError:
raise SystemExit("Gst-Python couldn't be found!")
......
......@@ -34,6 +34,7 @@ class SmartBin(gst.Bin):
height = 0
def __init__(self, name, displayname=""):
gst.info('name : %s, displayname : %s' % (name, displayname))
gobject.GObject.__init__(self)
self.name = name
self.displayname = displayname
......@@ -60,7 +61,7 @@ class SmartBin(gst.Bin):
def set_audio_sink_thread(self, asinkthread):
""" set the audio sink thread """
print "setting asinkthread in", self.name
self.debug("asinkthread : %s" % asinkthread)
if self.get_state() > gst.STATE_PAUSED:
print self.name, "is in PAUSED or higher"
return False
......@@ -76,7 +77,7 @@ class SmartBin(gst.Bin):
def set_video_sink_thread(self, vsinkthread):
""" set the video sink thread """
print "setting vsinkthread in ", self.name
self.debug("vsinkthread : %s" % asinkthread)
if self.get_state() > gst.STATE_PAUSED:
return False
if self.vsinkthread:
......@@ -95,7 +96,7 @@ class SmartBin(gst.Bin):
def remove_audio_sink_thread(self):
""" remove the audio sink thread """
print "removing asinkthread in ", self.name
self.debug("asinkthread : %s" % asinkthread)
if self.get_state() > gst.STATE_PAUSED:
return False
if not self.asinkthread:
......@@ -107,7 +108,7 @@ class SmartBin(gst.Bin):
def remove_video_sink_thread(self):
""" remove the videos sink thread """
print "removing vsinkthread in ", self.name
self.debug("vsinkthread : %s" % asinkthread)
if self.get_state() > gst.STATE_PAUSED:
return False
if not self.vsinkthread:
......@@ -125,7 +126,7 @@ class SmartFileBin(SmartBin):
"""
def __init__(self, factory):
print "new SmartFileBin for factory:%s, audio:%s, video:%s" % (factory, factory.is_audio, factory.is_video)
gst.debug("new SmartFileBin for factory:%s, audio:%s, video:%s" % (factory, factory.is_audio, factory.is_video))
self.factory = factory
self.has_video = factory.is_video
self.has_audio = factory.is_audio
......@@ -142,8 +143,7 @@ class SmartFileBin(SmartBin):
self.add(self.source)
def connect_source(self):
print "connect_source for ", self.source.get_pad_list()
print "delayed to 'new-decoded-pad' signal"
self.debug("pad_list %s" % self.source.get_pad_list())
self.source.connect("new-pad", self._bin_new_decoded_pad)
self.source.connect("pad-removed", self._bin_removed_decoded_pad)
## if self.has_video:
......@@ -155,7 +155,7 @@ class SmartFileBin(SmartBin):
def _bin_new_decoded_pad(self, bin, pad):
# connect to good tee
print "SmartFileBin's source has a new pad:", pad , pad.get_caps().to_string()
self.debug("SmartFileBin's source has a new pad: %s %s" % (pad , pad.get_caps().to_string()))
if "audio" in pad.get_caps().to_string():
pad.link(self.atee.get_pad("sink"))
elif "video" in pad.get_caps().to_string():
......@@ -179,7 +179,7 @@ class SmartTimelineBin(SmartBin):
"""
def __init__(self, project):
print "new SmartTimelineBin for project", project
gst.info("new SmartTimelineBin for project %s" % project)
self.project = project
# TODO : change this to use the project settings
......@@ -324,9 +324,10 @@ class SmartDefaultBin(SmartBin):
"""
def __init__(self):
print "Creating new smartdefaultbin"
gst.info("Creating new smartdefaultbin")
self.videotestsrc = gst.element_factory_make("videotestsrc", "vtestsrc")
self.silence = gst.element_factory_make("silence", "silence")
self.silence = gst.element_factory_make("sinesrc", "silence")
self.silence.set_property("volume", 0.0)
self.has_audio = True
self.has_video = True
self.width = 720
......@@ -337,11 +338,11 @@ class SmartDefaultBin(SmartBin):
self.add_many(self.videotestsrc, self.silence)
def connect_source(self):
print "connecting sources"
vcaps = gst.caps_from_string("video/x-raw-yuv,width=320,height=240,framerate=25.0")
self.videotestsrc.get_pad("src").link_filtered(self.vtee.get_pad("sink"), vcaps)
self.debug("connecting sources")
#vcaps = gst.caps_from_string("video/x-raw-yuv,width=320,height=240,framerate=25.0")
self.videotestsrc.get_pad("src").link(self.vtee.get_pad("sink"))
self.silence.get_pad("src").link(self.atee.get_pad("sink"))
print "finished connecting sources"
self.debug("finished connecting sources")
gobject.type_register(SmartDefaultBin)
......
......@@ -52,6 +52,7 @@ class Discoverer(gobject.GObject):
}
def __init__(self, project):
gst.info("new discoverer for project %s" % project)
gobject.GObject.__init__(self)
self.project = project
self.queue = []
......
......@@ -39,6 +39,7 @@ class Magician:
"""
def __init__(self, pitivi):
gst.info("New Magician")
self.pitivi = pitivi
self.simple_video = []
self.simple_audio = []
......@@ -48,7 +49,7 @@ class Magician:
def _get_simple_filters(self):
# go trough the list of element factories and
# add them to the correct list
factlist = gst.registry_pool_feature_list(gst.ElementFactory)
factlist = gst.registry_get_default().get_feature_list(gst.ElementFactory)
for fact in factlist:
if "Filter/Effect/Audio" in fact.get_klass():
self.simple_audio.append(fact)
......
......@@ -21,6 +21,8 @@
import gobject
import gtk
import gst
import sys
from ui import mainwindow
from discoverer import Discoverer
from playground import PlayGround
......@@ -56,9 +58,9 @@ class Pitivi(gobject.GObject):
"""
initialize pitivi with the command line arguments
"""
gst.info("starting up pitivi...")
gobject.GObject.__init__(self)
# TODO parse cmd line arguments
#self.discoverer = Discoverer(self)
self.playground = PlayGround()
self.current = Project("New Project")
self.effects = Magician(self)
......@@ -69,6 +71,7 @@ class Pitivi(gobject.GObject):
def load_project(self, uri=None, filepath=None):
""" Load the given file through it's uri or filepath """
gst.info("uri:%s, filepath:%s" % (uri, filepath))
if not uri and not filepath:
self.emit("not-project", "")
return
......@@ -85,6 +88,7 @@ class Pitivi(gobject.GObject):
def _close_running_project(self):
""" close the current project """
gst.info("closing running project")
if self.current:
if not self.emit("closing-project", self.current):
return False
......
......@@ -59,12 +59,13 @@ class PlayGround(gobject.GObject):
# The rest should only be remembered in the playground itself
def __init__(self):
gst.info("Starting up playground")
gobject.GObject.__init__(self)
# List of used pipelines
self.pipelines = []
self.playthread = gst.Thread("playground-thread")
self.playthread.connect("element-added", self._reset_scheduler_clock)
self.playthread = gst.Bin("playground-thread")
# self.playthread.connect("element-added", self._reset_scheduler_clock)
self.vsinkthread = None
self.asinkthread = None
......@@ -86,7 +87,7 @@ class PlayGround(gobject.GObject):
def add_pipeline(self, pipeline):
""" add a pipeline to the playground """
print "adding pipeline", pipeline, "to playground"
gst.debug("pipeline : %s" % pipeline)
if not isinstance(pipeline, SmartBin):
return
#self.playthread.add(pipeline)
......@@ -95,7 +96,7 @@ class PlayGround(gobject.GObject):
def remove_pipeline(self, pipeline):
""" removes a pipeline from the playground """
print "removing pipeline from playground"
gst.debug("pipeline : %s" % pipeline)
if not pipeline in self.pipelines:
return
pipeline.set_state(gst.STATE_READY)
......@@ -107,7 +108,7 @@ class PlayGround(gobject.GObject):
def switch_to_pipeline(self, pipeline):
""" switch to the given pipeline for play output """
print "switching to another pipeline"
gst.debug("pipeline : %s" % pipeline)
if self.current == pipeline:
return
if not pipeline in self.pipelines and not pipeline == self.default:
......@@ -137,25 +138,26 @@ class PlayGround(gobject.GObject):
self.asinkthread.set_state(gst.STATE_READY)
self.current.set_audio_sink_thread(self.asinkthread)
self.emit("current-changed", self.current)
self.cur_state_signal = self.current.connect("state-change", self._current_state_change_cb)
self.cur_eos_signal = self.current.connect("eos", self._current_eos_cb)
self.cur_state_signal = self.current.connect("state-changed", self._current_state_change_cb)
## FIXME : eos signal doesn't exist anymore
#self.cur_eos_signal = self.current.connect("eos", self._current_eos_cb)
self.current.set_state(gst.STATE_PAUSED)
def switch_to_default(self):
""" switch to the default pipeline """
print "switching to default"
gst.debug("switching to default")
self.switch_to_pipeline(self.default)
#self.default.set_state(gst.STATE_PLAYING)
def _reset_scheduler_clock(self, playthread, element_added):
# hack for 0.8
sched = self.playthread.get_scheduler()
clock = sched.get_clock()
sched.set_clock(clock)
## def _reset_scheduler_clock(self, playthread, element_added):
## # hack for 0.8
## sched = self.playthread.get_scheduler()
## clock = sched.get_clock()
## sched.set_clock(clock)
def set_video_sink_thread(self, vsinkthread):
""" sets the video sink thread """
print "set video sink thread :", vsinkthread
gst.debug("video sink thread :", vsinkthread)
if self.vsinkthread and self.current:
self.current.set_state(gst.STATE_PAUSED)
self.current.remove_video_sink_thread()
......@@ -167,7 +169,7 @@ class PlayGround(gobject.GObject):
def set_audio_sink_thread(self, asinkthread):
""" sets the audio sink thread """
print "set audio sink thread :", asinkthread
gst.debug("set audio sink thread :", asinkthread)
if self.asinkthread and self.current:
self.current.set_state(gst.STATE_PAUSED)
self.current.remove_audio_sink_thread()
......@@ -179,6 +181,7 @@ class PlayGround(gobject.GObject):
def _play_temporary_bin(self, tempbin):
""" temporarely play a smartbin """
gst.debug("tempbin : %s" % tempbin)
self.pause()
self.add_pipeline(tempbin)
self.switch_to_pipeline(tempbin)
......@@ -189,12 +192,14 @@ class PlayGround(gobject.GObject):
def play_temporary_uri(self, uri):
""" plays a uri """
gst.debug("uri : %s" % uri)
tempbin = SmartTempUriBin(uri)
self._play_temporary_bin(tempbin)
pass
def play_temporary_filesourcefactory(self, factory):
""" temporarely play a FileSourceFactory """
gst.debug("factory : %s" % factory)
if isinstance(self.current, SmartFileBin) and self.current.factory == factory:
return
tempbin = SmartFileBin(factory)
......@@ -202,6 +207,7 @@ class PlayGround(gobject.GObject):
def seek_in_current(self, value):
""" seek to the given position in the current playing bin """
gst.debug("value : %s" % value)
if not self.current:
return
## prevstate = self.current.get_state()
......@@ -222,7 +228,7 @@ class PlayGround(gobject.GObject):
## self.current.set_state(prevstate)
def _current_state_change_cb(self, current, prevstate, newstate):
print current, "changed state from", prevstate, "to", newstate
current.debug("changed state from %s to %s" % (prevstate, newstate))
if newstate in [int(gst.STATE_PAUSED), int(gst.STATE_PLAYING)]:
if newstate == int(gst.STATE_PAUSED):
self.state = gst.STATE_PAUSED
......@@ -230,9 +236,9 @@ class PlayGround(gobject.GObject):
self.state = gst.STATE_PLAYING
self.emit("current-state", newstate)
def _current_eos_cb(self, current):
print current, "has EOS!"
self.emit("current-state", gst.STATE_READY)
## def _current_eos_cb(self, current):
## print current, "has EOS!"
## self.emit("current-state", gst.STATE_READY)
#
# playing proxy functions
......@@ -240,7 +246,7 @@ class PlayGround(gobject.GObject):
def play(self):
""" play the current pipeline """
print "setting playground to play"
self.debug("play")
print "self.current, self.asinkthread, self.vsinkthread :", self.current, self.asinkthread, self.vsinkthread
if not self.current or not self.asinkthread or not self.vsinkthread:
print "returning ????"
......@@ -255,7 +261,7 @@ class PlayGround(gobject.GObject):
def pause(self):
""" pause the current pipeline """
print "setting playground to pause"
self.debug("pause")
if not self.current or self.current == self.default:
return
if not self.state == gst.STATE_PAUSED:
......
......@@ -46,6 +46,7 @@ class Project(gobject.GObject):
name : the name of the project
uri : the uri of the project
"""
gst.info("name:%s, uri:%s" % (name, uri))
gobject.GObject.__init__(self)
self.name = name
self.uri = uri
......
......@@ -112,7 +112,7 @@ gobject.type_register(ExportSettings)
def available_muxers():
""" return all available muxers """
flist = gst.registry_pool_feature_list(gst.ElementFactory)
flist = gst.registry_get_default().get_feature_list(gst.ElementFactory)
res = []
for fact in flist:
if "Codec/Muxer" == fact.get_klass():
......@@ -121,7 +121,7 @@ def available_muxers():
def available_video_encoders():
""" returns all available video encoders """
flist = gst.registry_pool_feature_list(gst.ElementFactory)
flist = gst.registry_get_default().get_feature_list(gst.ElementFactory)
res = []
for fact in flist:
if "Codec/Encoder/Video" in fact.get_klass():
......@@ -130,7 +130,7 @@ def available_video_encoders():
def available_audio_encoders():
""" returns all available audio encoders """
flist = gst.registry_pool_feature_list(gst.ElementFactory)
flist = gst.registry_get_default().get_feature_list(gst.ElementFactory)
res = []
for fact in flist:
if "Codec/Encoder/Audio" in fact.get_klass():
......
......@@ -20,6 +20,7 @@
# Boston, MA 02111-1307, USA.
import gobject
import gst
from discoverer import Discoverer
class SourceList(gobject.GObject):
......@@ -43,6 +44,7 @@ class SourceList(gobject.GObject):
}
def __init__(self, project):
gst.info("new sourcelist for project %s" % project)
gobject.GObject.__init__(self)
self.project = project
self.sources = {}
......
......@@ -57,10 +57,15 @@ class Timeline(gobject.GObject):
# for the time being we hardcode an audio and a video composition
def __init__(self, project):
gst.info("new Timeline for project %s" % project)
gobject.GObject.__init__(self)
self.project = project
self.timeline = gst.element_factory_make("gnltimeline", "timeline-" + project.name)
self._fill_contents()
# FIXME : uncomment when we have gnonlin ported
# self.timeline = gst.element_factory_make("gnltimeline", "timeline-" + project.name)
#self._fill_contents()
self.timeline = None
self.project.settings.connect_after("settings-changed", self._settings_changed_cb)
def _fill_contents(self):
......@@ -68,6 +73,7 @@ class Timeline(gobject.GObject):
self.audiocomp = TimelineComposition(media_type = MEDIA_TYPE_AUDIO, name="audiocomp")
self.videocomp = TimelineComposition(media_type = MEDIA_TYPE_VIDEO, name="videocomp")
self.videocomp.link_object(self.audiocomp)
self.timeline.add_many(self.audiocomp.gnlobject,
self.videocomp.gnlobject)
......
......@@ -22,6 +22,7 @@
import os
import gobject
import gtk
import gst
from timeline import TimelineWidget
from sourcefactories import SourceFactoriesWidget
......@@ -36,6 +37,7 @@ class PitiviMainWindow(gtk.Window):
def __init__(self, pitivi):
""" initialize with the Pitivi object """
gst.info("Creating MainWindow")
self.pitivi = pitivi
gtk.Window.__init__(self)
self.maximize()
......
......@@ -22,12 +22,14 @@
import gtk
import gobject
import gst
from timelineobjects import SimpleSourceWidget, SimpleTimeline
class TimelineWidget(gtk.VBox):
""" Widget for reprensenting Pitivi's Timeline """
def __init__(self, pitivi):
gst.info("New Timeline Widget")
self.pitivi = pitivi
gtk.VBox.__init__(self)
self._create_gui()
......@@ -104,11 +106,12 @@ class SimpleTimelineContentWidget(gtk.HBox):
self.twidget.leftsizegroup.add_widget(self.header)
self.pack_start(self.header, expand=False)
self.timeline = SimpleTimeline(self.twidget, self.twidget.pitivi,
hadjustment = self.twidget.hadjustment)
# FIXME : uncomment when gnonlin is ported
#self.timeline = SimpleTimeline(self.twidget, self.twidget.pitivi,
# hadjustment = self.twidget.hadjustment)
layoutframe = gtk.Frame()
layoutframe.add(self.timeline)
#layoutframe.add(self.timeline)
self.pack_start(layoutframe)
gobject.type_register(SimpleTimelineContentWidget)
......
......@@ -46,6 +46,7 @@ class PitiviViewer(gtk.VBox):
""" Pitivi's graphical viewer """
def __init__(self, pitivi):
gst.info("New PitiviViewer")
self.pitivi = pitivi
gtk.VBox.__init__(self)
self.current_time = long(0)
......@@ -64,7 +65,8 @@ class PitiviViewer(gtk.VBox):
self.pitivi.current.settings.connect("settings-changed",
self._settings_changed_cb)
self._add_timeline_to_playground()
# FIXME : uncomment when gnonlin is ported
# self._add_timeline_to_playground()
def _create_gui(self):
""" Creates the Viewer GUI """
......@@ -316,6 +318,7 @@ class PitiviViewer(gtk.VBox):
self.pitivi.current.settings.connect("settings-changed", self._settings_changed_cb)
def _add_timeline_to_playground(self):
gst.info("")
self.pitivi.playground.add_pipeline(self.pitivi.current.get_bin())
def record_cb(self, button):
......
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