Start preprations for supporting switching between sources
This commit is contained in:
parent
da763be9d7
commit
83fbc8ea22
@ -47,6 +47,7 @@ class GStreamerProcess(BaseProcess):
|
||||
self.core_queue = core_queue
|
||||
self.output_queue = output_queue
|
||||
self.gst_pipeline = None
|
||||
self.gst_target = None
|
||||
|
||||
def run_inside_try(self):
|
||||
self.setup()
|
||||
@ -63,23 +64,15 @@ class GStreamerProcess(BaseProcess):
|
||||
messages_thread.start()
|
||||
|
||||
self.gst_pipeline = gst.parse_launch(' ! '.join([
|
||||
'multiqueue name=queue',
|
||||
'volume name=volume',
|
||||
'alsasink'
|
||||
]))
|
||||
|
||||
self.gst_target = self.gst_pipeline.get_by_name('volume')
|
||||
|
||||
decode_bin = gst.element_factory_make('uridecodebin', 'uri')
|
||||
decode_bin.connect('pad-added', self.process_new_pad)
|
||||
app_src = gst.element_factory_make('appsrc', 'src')
|
||||
queue = self.gst_pipeline.get_by_name('queue')
|
||||
|
||||
self.gst_pipeline.add(decode_bin)
|
||||
self.gst_pipeline.add(app_src)
|
||||
|
||||
self.gst_uri_pad = queue.get_request_pad('sink0')
|
||||
self.gst_src_pad = queue.get_request_pad('sink1')
|
||||
|
||||
app_src.get_pad('src').link(self.gst_src_pad)
|
||||
|
||||
# Setup bus and message processor
|
||||
gst_bus = self.gst_pipeline.get_bus()
|
||||
@ -87,7 +80,7 @@ class GStreamerProcess(BaseProcess):
|
||||
gst_bus.connect('message', self.process_gst_message)
|
||||
|
||||
def process_new_pad(self, source, pad):
|
||||
pad.link(self.gst_uri_pad)
|
||||
pad.link(self.gst_target.get_pad('sink'))
|
||||
|
||||
def process_mopidy_message(self, message):
|
||||
"""Process messages from the rest of Mopidy."""
|
||||
|
||||
Loading…
Reference in New Issue
Block a user