pitivi r1105 - in trunk: . pitivi/elements
- From: edwardrv svn gnome org
- To: svn-commits-list gnome org
- Subject: pitivi r1105 - in trunk: . pitivi/elements
- Date: Thu, 10 Jan 2008 14:07:08 +0000 (GMT)
Author: edwardrv
Date: Thu Jan 10 14:07:08 2008
New Revision: 1105
URL: http://svn.gnome.org/viewvc/pitivi?rev=1105&view=rev
Log:
* pitivi/elements/Makefile.am:
* pitivi/elements/videofade.py:
New fade-in/fade-out element. Only works with cvs gst-plugins-good.
Added:
trunk/pitivi/elements/videofade.py
Modified:
trunk/ChangeLog
trunk/pitivi/elements/Makefile.am
Modified: trunk/pitivi/elements/Makefile.am
==============================================================================
--- trunk/pitivi/elements/Makefile.am (original)
+++ trunk/pitivi/elements/Makefile.am Thu Jan 10 14:07:08 2008
@@ -4,7 +4,8 @@
__init__.py \
singledecodebin.py \
smartscale.py \
- thumbnailsink.py
+ thumbnailsink.py \
+ videofade.py
clean-local:
rm -rf *.pyc *.pyo
Added: trunk/pitivi/elements/videofade.py
==============================================================================
--- (empty file)
+++ trunk/pitivi/elements/videofade.py Thu Jan 10 14:07:08 2008
@@ -0,0 +1,94 @@
+# PiTiVi , Non-linear video editor
+#
+# pitivi/elements/videofade.py
+#
+# Copyright (c) 2008, Edward Hervey <bilboed bilboed com>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this program; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+"""
+Simple video fade element
+"""
+
+import gobject
+import gst
+
+class VideoFade(gst.Bin):
+ """
+ Simple video fade element
+ """
+
+ def __init__(self, position=0, duration=2*gst.SECOND, fadefromblack=True):
+ gst.Bin.__init__(self)
+ self.incsp = gst.element_factory_make("ffmpegcolorspace", "incsp")
+ self.outcsp = gst.element_factory_make("ffmpegcolorspace", "outcsp")
+ self.alpha = gst.element_factory_make("alpha", "alpha")
+ self.vmix = gst.element_factory_make("videomixer", "videomix")
+ self.vmix.set_property("background", 1)
+ self.add(self.incsp, self.alpha, self.vmix, self.outcsp)
+ gst.element_link_many(self.incsp, self.alpha, self.vmix, self.outcsp)
+
+ self._sinkPad = gst.GhostPad("sink", self.incsp.get_pad("sink"))
+ self._sinkPad.set_active(True)
+ self._srcPad = gst.GhostPad("src", self.outcsp.get_pad("src"))
+ self._srcPad.set_active(True)
+
+ self.add_pad(self._sinkPad)
+ self.add_pad(self._srcPad)
+
+ self.startposition = position
+ self.duration = duration
+ self.fadefromblack = fadefromblack
+
+ self.alphacontrol = gst.Controller(self.alpha, "alpha")
+ self.alphacontrol.set_interpolation_mode("alpha", gst.INTERPOLATE_LINEAR)
+
+ self._resetControllerValues()
+
+ def setStartPosition(self, position):
+ if position == self.startposition:
+ return
+ self.startposition = position
+ self._resetControllerValues()
+
+ def setDuration(self, duration):
+ if self.duration == duration:
+ return
+ self.duration = duration
+ self._resetControllerValues()
+
+ def setFadeFromBlack(self, fromblack):
+ if self.fadefromblack == fromblack:
+ return
+ self.fadefromblack = fromblack
+ self._resetControllerValues()
+
+ def _resetControllerValues(self):
+ self.alphacontrol.unset_all("alpha")
+ if self.fadefromblack:
+ start = 0.0
+ stop = 1.0
+ else:
+ start = 1.0
+ stop = 0.0
+ self.alphacontrol.set("alpha",
+ self.startposition,
+ start)
+ self.alphacontrol.set("alpha",
+ self.startposition + self.duration,
+ stop)
+
+gobject.type_register(VideoFade)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]