pitivi r1349 - in trunk/pitivi: . timeline
- From: edwardrv svn gnome org
- To: svn-commits-list gnome org
- Subject: pitivi r1349 - in trunk/pitivi: . timeline
- Date: Mon, 3 Nov 2008 12:28:06 +0000 (UTC)
Author: edwardrv
Date: Mon Nov 3 12:28:05 2008
New Revision: 1349
URL: http://svn.gnome.org/viewvc/pitivi?rev=1349&view=rev
Log:
sources : Make TimelineFileSource properly use ObjectFactory information
Modified:
trunk/pitivi/objectfactory.py
trunk/pitivi/timeline/source.py
Modified: trunk/pitivi/objectfactory.py
==============================================================================
--- trunk/pitivi/objectfactory.py (original)
+++ trunk/pitivi/objectfactory.py Mon Nov 3 12:28:05 2008
@@ -37,6 +37,8 @@
from gettext import gettext as _
+from elements.singledecodebin import SingleDecodeBin
+
class ObjectFactory(Serializable):
"""
base class for object factories which provide elements to use
@@ -206,7 +208,6 @@
""" returns a video only bin """
raise NotImplementedError
-
# FIXME : ALL the following methods will die once we switch to a saner
# FIXME : and more flexible way of doing file save/load
# Serializable methods
@@ -302,13 +303,6 @@
# FIXME : It might not just be files (network sources ?) !
# FIMXE : It might not even had a URI ! (audio/video generators for ex)
-
-
-
-# FIXME : Figure out everything which is Source specific and put it here
-# FIXME : It might not just be files (network sources ?) !
-# FIMXE : It might not even had a URI ! (audio/video generators for ex)
-
class SourceFactory(ObjectFactory):
"""
Provides sources usable in a timeline
@@ -348,12 +342,6 @@
return self._getDuration()
-
-# FIXME : What about non-file sources ???
-
-
-
-
# FIXME : What about non-file sources ???
class FileSourceFactory(SourceFactory):
@@ -408,13 +396,13 @@
bin.add(src, dbin)
src.link(dbin)
- dbin.connect("new-decoded-pad", self._binNewDecodedPadCb, bin )
- dbin.connect("removed-decoded-pad", self._binRemovedDecodedPadCb, bin)
+ dbin.connect("new-decoded-pad", self.__binNewDecodedPadCb, bin )
+ dbin.connect("removed-decoded-pad", self.__binRemovedDecodedPadCb, bin)
self.instances.append(bin)
return bin
- def _binNewDecodedPadCb(self, unused_dbin, pad, unused_is_last, bin):
+ def __binNewDecodedPadCb(self, unused_dbin, pad, unused_is_last, bin):
gst.info(pad.get_caps().to_string())
# add it as ghost_pad to the bin
if "audio" in pad.get_caps().to_string():
@@ -436,7 +424,7 @@
else:
return
- def _binRemovedDecodedPadCb(self, unused_dbin, pad, bin):
+ def __binRemovedDecodedPadCb(self, unused_dbin, pad, bin):
gst.info("pad %s was removed" % pad)
if "audio" in pad.get_caps().to_string():
mypad = bin.get_pad("asrc")
@@ -446,6 +434,17 @@
return
bin.remove_pad(mypad)
+ def makeAudioBin(self):
+ caps = gst.caps_from_string("audio/x-raw-int;audio/x-raw-float")
+ return self.__makeSingleDecodeBin(caps)
+
+ def makeVideoBin(self):
+ caps = gst.caps_from_string("video/x-raw-yuv;video/x-raw-rgb")
+ return self.__makeSingleDecodeBin(caps)
+
+ def __makeSingleDecodeBin(self, caps):
+ return SingleDecodeBin(caps=caps, uri=self.name)
+
# WTF, code used nowhere ???
def binIsDestroyed(self, bin):
""" Remove the given bin from the list of instances """
Modified: trunk/pitivi/timeline/source.py
==============================================================================
--- trunk/pitivi/timeline/source.py (original)
+++ trunk/pitivi/timeline/source.py Mon Nov 3 12:28:05 2008
@@ -24,7 +24,6 @@
"""
import gst
-from pitivi.elements.singledecodebin import SingleDecodeBin
from objects import TimelineObject, MEDIA_TYPE_AUDIO, MEDIA_TYPE_VIDEO, MEDIA_TYPE_NONE
class TimelineSource(TimelineObject):
@@ -91,6 +90,8 @@
Sub-classes not implementing this method will need to override
the _makeGnlObject() method.
"""
+ #FIXME : Maybe the default implementation should be to call
+ # the factory's make*bin() method !
raise NotImplementedError
def _setMediaStartDurationTime(self, start=gst.CLOCK_TIME_NONE,
@@ -205,12 +206,12 @@
def makeGnlSourceContents(self):
if self.isaudio:
- caps = gst.caps_from_string("audio/x-raw-int;audio/x-raw-float")
+ self.decodebin = self.factory.makeAudioBin()
elif self.isvideo:
- caps = gst.caps_from_string("video/x-raw-yuv;video/x-raw-rgb")
+ self.decodebin = self.factory.makeVideoBin()
else:
raise NameError, "media type is NONE !"
- self.decodebin = SingleDecodeBin(caps=caps, uri=self.factory.name)
+
if self.isaudio:
self.volume_element = gst.element_factory_make("volume", "internal-volume")
self.audioconv = gst.element_factory_make("audioconvert", "audioconv")
@@ -257,29 +258,33 @@
""" make the brother element """
self.gnlobject.info("making filesource brother")
# find out if the factory provides the other element type
+
+ # FIXME : this is atrociously complicated code for such a simple
+ # thing. We should just figure out the brother stream and then ask
+ # To create the object for the same factory by the other stream
+
+ # FIXME : The factory knows which stream is the brother of another !!!
+
if self.media_type == MEDIA_TYPE_NONE:
return None
- if self.isvideo:
- if not self.factory.is_audio:
- return None
- brother = TimelineFileSource(media_start=self.media_start,
- media_duration=self.media_duration,
- factory=self.factory, start=self.start,
- duration=self.duration,
- media_type=MEDIA_TYPE_AUDIO,
- name=self.name + "-brother")
- elif self.isaudio:
- if not self.factory.is_video:
- return None
- brother = TimelineFileSource(media_start=self.media_start,
- media_duration=self.media_duration,
- factory=self.factory, start=self.start,
- duration=self.duration,
- media_type=MEDIA_TYPE_VIDEO,
- name=self.name + "-brother")
+ if not self.isaudio and not self.isvideo:
+ return None
+ # handle blank cases
+ classtype = TimelineFileSource
+ if self.isvideo and not self.factory.is_audio:
+ classtype = TimelineBlankSource
+ if self.isaudio and not self.factory.is_video:
+ classtype = TimelineBlankSource
+ if self.isaudio:
+ mtype = MEDIA_TYPE_VIDEO
else:
- brother = None
- return brother
+ mtype = MEDIA_TYPE_AUDIO
+ return classtype(media_start=self.media_start,
+ media_duration=self.media_duration,
+ factory=self.factory, start=self.start,
+ duration=self.duration,
+ media_type=mtype,
+ name=self.name + "-brother")
def getExportSettings(self):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]