Cleanup error handling of bad GStreamer settings.
No need to have a GStreamerError, we can just let the GErrors bubble now that we are initialising in the main thread.
This commit is contained in:
parent
036bf2ab24
commit
7574862491
@ -20,7 +20,7 @@ sys.argv[1:] = gstreamer_args
|
||||
|
||||
from mopidy import (get_version, settings, OptionalDependencyError,
|
||||
SettingsError, DATA_PATH, SETTINGS_PATH, SETTINGS_FILE)
|
||||
from mopidy.gstreamer import GStreamer, GStreamerError
|
||||
from mopidy.gstreamer import GStreamer
|
||||
from mopidy.utils import get_class
|
||||
from mopidy.utils.log import setup_logging
|
||||
from mopidy.utils.path import get_or_create_folder, get_or_create_file
|
||||
@ -45,8 +45,6 @@ def main():
|
||||
loop.run()
|
||||
except SettingsError as e:
|
||||
logger.error(e.message)
|
||||
except GStreamerError as e:
|
||||
logger.error(e)
|
||||
except KeyboardInterrupt:
|
||||
logger.info(u'Interrupted. Exiting...')
|
||||
except Exception as e:
|
||||
|
||||
@ -14,10 +14,6 @@ from mopidy.backends.base import Backend
|
||||
logger = logging.getLogger('mopidy.gstreamer')
|
||||
|
||||
|
||||
class GStreamerError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
# TODO: we might want to add some ranking to the mixers we know about?
|
||||
# TODO: move to mixers module and do from mopidy.mixers import * to install
|
||||
# elements.
|
||||
@ -213,34 +209,32 @@ class GStreamer(ThreadingActor):
|
||||
self._pipeline.get_by_name('queue').get_pad('sink'))
|
||||
|
||||
def _setup_output(self, output_description):
|
||||
try:
|
||||
self._output = gst.parse_bin_from_description(output_description, True)
|
||||
except gobject.GError as e:
|
||||
raise GStreamerError('%r while creating %r' % (e.message,
|
||||
output_description))
|
||||
# This will raise a gobject.GError if the description is bad.
|
||||
self._output = gst.parse_bin_from_description(output_description, True)
|
||||
|
||||
self._pipeline.add(self._output)
|
||||
gst.element_link_many(self._pipeline.get_by_name('queue'),
|
||||
self._output)
|
||||
logger.info('Output set to %s', output_description)
|
||||
|
||||
def _setup_mixer(self, mixer_bin_description, track_label):
|
||||
if not mixer_bin_description:
|
||||
logger.debug('Not adding mixer.')
|
||||
def _setup_mixer(self, mixer_description, track_label):
|
||||
if not mixer_description:
|
||||
logger.info('Not setting up mixer.')
|
||||
return
|
||||
|
||||
mixerbin = gst.parse_bin_from_description(mixer_bin_description, False)
|
||||
# This will raise a gobject.GError if the description is bad.
|
||||
mixerbin = gst.parse_bin_from_description(mixer_description, False)
|
||||
|
||||
# We assume that the bin will contain a single mixer.
|
||||
mixer = mixerbin.get_by_interface('GstMixer')
|
||||
if not mixer:
|
||||
logger.warning('Did not find any mixers in %r',
|
||||
mixer_bin_description)
|
||||
mixer_description)
|
||||
return
|
||||
|
||||
if mixerbin.set_state(gst.STATE_READY) != gst.STATE_CHANGE_SUCCESS:
|
||||
logger.warning('Setting mixer %r to READY failed.',
|
||||
mixer_bin_description)
|
||||
mixer_description)
|
||||
return
|
||||
|
||||
track = self._select_mixer_track(mixer, track_label)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user