From 7ed8fb61482d975b1c79225dd0dea3db5c01c8c4 Mon Sep 17 00:00:00 2001 From: FranciscoCanas Date: Tue, 18 Nov 2014 12:58:58 -0500 Subject: [PATCH] Fixes error at startup for windows missing plugin Moves get_default_device and get_default_source methods out of affected plugin Config classes and into the get_videoinput_bin or get_audioinput_bin methods, so that no OS-dependent plugin code gets run at startup. Fix #658 --- src/freeseer/plugins/audioinput/pulsesrc/__init__.py | 10 ++++++---- .../plugins/videoinput/firewiresrc/__init__.py | 5 ++++- src/freeseer/plugins/videoinput/usbsrc/__init__.py | 5 ++++- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/freeseer/plugins/audioinput/pulsesrc/__init__.py b/src/freeseer/plugins/audioinput/pulsesrc/__init__.py index a6b7af78..1c2e9daf 100644 --- a/src/freeseer/plugins/audioinput/pulsesrc/__init__.py +++ b/src/freeseer/plugins/audioinput/pulsesrc/__init__.py @@ -71,7 +71,7 @@ def get_default_source(): class PulseSrcConfig(Config): """Default PulseSrc config settings.""" - source = options.StringOption(get_default_source()) + source = options.StringOption('') class PulseSrc(IAudioInput): @@ -84,9 +84,11 @@ def get_audioinput_bin(self): audiosrc = gst.element_factory_make("pulsesrc", "audiosrc") - if self.config.source: - audiosrc.set_property('device', self.config.source) - log.debug('Pulseaudio source is set to %s', audiosrc.get_property('device')) + if not self.config.source: + self.config.source = get_default_source() + + audiosrc.set_property('device', self.config.source) + log.debug('Pulseaudio source is set to %s', audiosrc.get_property('device')) bin.add(audiosrc) diff --git a/src/freeseer/plugins/videoinput/firewiresrc/__init__.py b/src/freeseer/plugins/videoinput/firewiresrc/__init__.py index 4937b52e..2d41d9f4 100644 --- a/src/freeseer/plugins/videoinput/firewiresrc/__init__.py +++ b/src/freeseer/plugins/videoinput/firewiresrc/__init__.py @@ -75,7 +75,7 @@ def get_default_device(): class FirewireSrcConfig(Config): """Config settings for Firewire video source.""" - device = options.StringOption(get_default_device()) + device = options.StringOption('') class FirewireSrc(IVideoInput): @@ -89,6 +89,9 @@ def __init__(self): def get_videoinput_bin(self): bin = gst.Bin() # Do not pass a name so that we can load this input more than once. + if not self.config.device: + self.config.device = get_default_device() + videosrc = gst.element_factory_make("dv1394src", "videosrc") dv1394q1 = gst.element_factory_make('queue', 'dv1394q1') dv1394dvdemux = gst.element_factory_make('dvdemux', 'dv1394dvdemux') diff --git a/src/freeseer/plugins/videoinput/usbsrc/__init__.py b/src/freeseer/plugins/videoinput/usbsrc/__init__.py index 82c67d5f..9e3e7132 100644 --- a/src/freeseer/plugins/videoinput/usbsrc/__init__.py +++ b/src/freeseer/plugins/videoinput/usbsrc/__init__.py @@ -96,7 +96,7 @@ def get_default_device(): class USBSrcConfig(Config): """USBSrc Configuration settings.""" - device = options.StringOption(get_default_device()) + device = options.StringOption('') class USBSrc(IVideoInput): @@ -115,6 +115,9 @@ def get_videoinput_bin(self): videosrc = None + if not self.config.device: + self.config.device = get_default_device() + if sys.platform.startswith("linux"): videosrc = gst.element_factory_make("v4l2src", "videosrc") videosrc.set_property("device", self.config.device)