summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuciana Fujii Pontello <luciana@fujii.eti.br>2010-08-18 23:17:59 (GMT)
committerLuciana Fujii Pontello <luciana@fujii.eti.br>2010-08-19 20:14:32 (GMT)
commit8192d464117d7e8464c1cdb8d8aa3b04a3e04fb0 (patch)
tree53588b316b8ba0589e68fbb2059209fe53887de2
parent14af6fadc329a386c8960403a43a9a4853f1f84c (diff)
downloadsltv-8192d464117d7e8464c1cdb8d8aa3b04a3e04fb0.tar.gz
sltv-8192d464117d7e8464c1cdb8d8aa3b04a3e04fb0.tar.xz
sltv: Adding all audio inputs to pipeline
Instead of adding only the chosen audio source to the pipeline, we add all available audio sources, because we want to be able to change the source during transmition later. To do this, we use the new class AudioInputBin. All audio sources are connected to input-selector, that chooses the initially selected audio source.
-rw-r--r--sltv/sltv.py37
1 files changed, 18 insertions, 19 deletions
diff --git a/sltv/sltv.py b/sltv/sltv.py
index ce8d6c0..d1adce1 100644
--- a/sltv/sltv.py
+++ b/sltv/sltv.py
@@ -33,10 +33,10 @@ from registry import REGISTRY_INPUT, REGISTRY_OUTPUT, \
import medialist
import effect
import volume
-import audioresample
import metadata
import multeequeue
import outputbin
+import audioinputbin
MEDIA_AUDIO = 1
MEDIA_VIDEO = 2
@@ -219,6 +219,7 @@ class Sltv(gobject.GObject):
# Source selection
self.source_pads = {}
+ self.audio_pads = {}
self.pip_pads = {}
self.output_bins = {}
@@ -233,28 +234,26 @@ class Sltv(gobject.GObject):
for row in self.sources.get_store():
(name, source) = row
element = source.create()
+ self.player.add(element)
if element.does_audio():
- if name == self.audio_source:
- self.player.add(element)
- self.queue_audio = gst.element_factory_make(
- "queue", "queue_audio"
- )
- self.player.add(self.queue_audio)
- pad = self.queue_audio.get_static_pad("sink")
- element.audio_pad.link(pad)
+ if not self.input_type & MEDIA_AUDIO:
self.input_type |= MEDIA_AUDIO
- self.audio_input_item = source
- elif element.does_video():
+ self.input_selector = gst.element_factory_make(
+ "input-selector", "audio-selector"
+ )
+ self.player.add(self.input_selector)
- # If element does audio and video, it will be added.
+ audiobin = audioinputbin.AudioInputBin(source)
+ self.player.add(audiobin)
- self.player.add(element)
+ element.audio_pad.link(audiobin.get_static_pad("sink"))
+ self.audio_pads[name] = \
+ self.input_selector.get_request_pad("sink%d")
+ audiobin.src_pad.link(self.audio_pads[name])
if element.does_video():
self.input_type |= MEDIA_VIDEO
- if not element.does_audio():
- self.player.add(element)
self.source_pads[name] = source_number
source_number = source_number + 1
@@ -370,16 +369,16 @@ class Sltv(gobject.GObject):
self.audio_tee = gst.element_factory_make("tee", "audio_tee")
self.player.add(self.audio_tee)
- self.audioresample = self.audio_input_item.parent.create()
-
- self.player.add(self.audioresample)
self.volume = volume.Volume()
self.player.add(self.volume)
gst.element_link_many(
- self.queue_audio, self.audioresample, self.volume,
+ self.input_selector, self.volume,
self.effect[MEDIA_AUDIO], self.convert, self.audio_tee
)
+ self.input_selector.set_property(
+ "active-pad", self.audio_pads[self.audio_source]
+ )
added_encoders = {}
pip_width = 0