Skip to content

Commit

Permalink
Fixes error at startup for windows missing plugin
Browse files Browse the repository at this point in the history
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 Freeseer#658
  • Loading branch information
FranciscoCanas authored and dideler committed Nov 20, 2014
1 parent 42a264c commit 7ed8fb6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
10 changes: 6 additions & 4 deletions src/freeseer/plugins/audioinput/pulsesrc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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)

Expand Down
5 changes: 4 additions & 1 deletion src/freeseer/plugins/videoinput/firewiresrc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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')
Expand Down
5 changes: 4 additions & 1 deletion src/freeseer/plugins/videoinput/usbsrc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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)
Expand Down

0 comments on commit 7ed8fb6

Please sign in to comment.