[pitivi] mixer/factory: Several fixes for the smart mixer element.
- From: Edward Hervey <edwardrv src gnome org>
- To: svn-commits-list gnome org
- Subject: [pitivi] mixer/factory: Several fixes for the smart mixer element.
- Date: Thu, 11 Jun 2009 12:38:28 -0400 (EDT)
commit b90d49b9e90592956c340669aca1a8258518f9b4
Author: Edward Hervey <bilboed bilboed com>
Date: Wed Jun 10 19:24:43 2009 +0200
mixer/factory: Several fixes for the smart mixer element.
pitivi/elements/mixer.py | 5 ++++-
pitivi/factories/base.py | 36 +++++++++++++++++++++++++++++++++---
2 files changed, 37 insertions(+), 4 deletions(-)
---
diff --git a/pitivi/elements/mixer.py b/pitivi/elements/mixer.py
index f62974e..0e850ac 100644
--- a/pitivi/elements/mixer.py
+++ b/pitivi/elements/mixer.py
@@ -81,7 +81,7 @@ class SmartAdderBin(gst.Bin):
return pad
def do_release_pad(self, pad):
- self.warning("pad:%r", pad)
+ self.warning("pad:%r" % pad)
name = pad.get_name()
if name in self.inputs.keys():
sinkpad, aconv, aresample, adderpad = self.inputs.pop(name)
@@ -89,7 +89,10 @@ class SmartAdderBin(gst.Bin):
aconv.unlink(aresample)
aresample.get_pad("src").unlink(adderpad)
self.adder.release_request_pad(adderpad)
+ aconv.set_state(gst.STATE_NULL)
+ aresample.set_state(gst.STATE_NULL)
self.remove(aconv, aresample)
+ self.warning("done")
gobject.type_register(SmartAdderBin)
diff --git a/pitivi/factories/base.py b/pitivi/factories/base.py
index 2da0d1f..240bdf7 100644
--- a/pitivi/factories/base.py
+++ b/pitivi/factories/base.py
@@ -28,7 +28,7 @@ import gst
from pitivi.log.loggable import Loggable
from pitivi.elements.singledecodebin import SingleDecodeBin
from pitivi.signalinterface import Signallable
-from pitivi.stream import match_stream_groups_map
+from pitivi.stream import match_stream_groups_map, AudioStream
# FIXME: define a proper hierarchy
class ObjectFactoryError(Exception):
@@ -584,8 +584,38 @@ class URISourceFactoryMixin(object):
bin.remove_pad(ghost_pad)
def _makeStreamBin(self, output_stream):
- return self.singleDecodeBinClass(uri=self.uri, caps=output_stream.caps,
- stream=output_stream)
+ self.debug("output_stream:%r", output_stream)
+ b = gst.Bin()
+ b.dbin = self.singleDecodeBinClass(uri=self.uri, caps=output_stream.caps,
+ stream=output_stream)
+ b.dbin.connect("pad-added", self._singlePadAddedCb, b)
+ b.dbin.connect("pad-removed", self._singlePadRemovedCb, b)
+
+ if isinstance(output_stream, AudioStream):
+ self.debug("Adding volume element")
+ # add a volume element
+ b.volume = gst.element_factory_make("volume", "internal-volume")
+ b.add(b.volume)
+
+ b.add(b.dbin)
+ return b
+
+ def _singlePadAddedCb(self, dbin, pad, topbin):
+ self.debug("dbin:%r, pad:%r, topbin:%r", dbin, pad, topbin)
+ if hasattr(topbin, "volume"):
+ pad.link(topbin.volume.get_pad("sink"))
+ topbin.ghostpad = gst.GhostPad("src", topbin.volume.get_pad("src"))
+ else:
+ topbin.ghostpad = gst.GhostPad("src", pad)
+ topbin.ghostpad.set_active(True)
+ topbin.add_pad(topbin.ghostpad)
+
+ def _singlePadRemovedCb(self, dbin, pad, topbin):
+ self.debug("dbin:%r, pad:%r, topbin:%r", dbin, pad, topbin)
+ topbin.remove_pad(topbin.ghostpad)
+ topbin.ghostpad = None
+ if hasattr(topbin, "volume"):
+ pad.unlink(topbin.volume.get_pad("sink"))
class LiveURISourceFactory(URISourceFactoryMixin, LiveSourceFactory):
"""
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]