Merge branch 'feature/gst_proxy' of https://github.com/AlexandrePTJ/mopidy into AlexandrePTJ-feature/gst_proxy
Conflicts: docs/changelog.rst mopidy/http/actor.py
This commit is contained in:
commit
48184ad9d9
@ -107,6 +107,7 @@ class Audio(pykka.ThreadingActor):
|
||||
|
||||
self._connect(playbin, 'about-to-finish', self._on_about_to_finish)
|
||||
self._connect(playbin, 'notify::source', self._on_new_source)
|
||||
self._connect(playbin, 'source-setup', self._on_source_setup)
|
||||
|
||||
self._playbin = playbin
|
||||
|
||||
@ -138,6 +139,27 @@ class Audio(pykka.ThreadingActor):
|
||||
|
||||
self._appsrc = source
|
||||
|
||||
def _on_source_setup(self, element, source):
|
||||
if hasattr(source.props, 'proxy') and self._config['proxy']['hostname']:
|
||||
|
||||
proxy_scheme = 'http'
|
||||
proxy_port = 80
|
||||
|
||||
if self._config['proxy']['port']:
|
||||
proxy_port = self._config['proxy']['port']
|
||||
if self._config['proxy']['scheme']:
|
||||
proxy_scheme = self._config['proxy']['scheme']
|
||||
|
||||
full_proxy = "%s://%s:%s" % (
|
||||
proxy_scheme,
|
||||
self._config['proxy']['hostname'],
|
||||
str(proxy_port)
|
||||
)
|
||||
|
||||
source.set_property('proxy', full_proxy)
|
||||
source.set_property('proxy-id', self._config['proxy']['username'])
|
||||
source.set_property('proxy-pw', self._config['proxy']['password'])
|
||||
|
||||
def _appsrc_on_need_data(self, appsrc, gst_length_hint):
|
||||
length_hint = utils.clocktime_to_millisecond(gst_length_hint)
|
||||
if self._appsrc_need_data_callback is not None:
|
||||
@ -158,6 +180,7 @@ class Audio(pykka.ThreadingActor):
|
||||
def _teardown_playbin(self):
|
||||
self._disconnect(self._playbin, 'about-to-finish')
|
||||
self._disconnect(self._playbin, 'notify::source')
|
||||
self._disconnect(self._playbin, 'source-setup')
|
||||
self._playbin.set_state(gst.STATE_NULL)
|
||||
|
||||
def _setup_output(self):
|
||||
|
||||
Loading…
Reference in New Issue
Block a user