(self, guard=None, try_interfaces=(), audio_override=None, wait=False, **kwargs)
Initialise interface.
Initialise interface.
Initialise interface .
def __init__(self, guard=None, try_interfaces=(), audio_override=None, wait=False, **kwargs):
        """Initialise interface."""
        self._input_queue = queue.Queue()
        self._video_queue = queue.Queue()
        self._audio_queue = queue.Queue()
        self._wait = wait
        self._guard = guard
        self._video, self._audio = None, None
        for video in try_interfaces:
            try:
                self._video = video_plugins[video](self._input_queue, self._video_queue, **kwargs)
            except KeyError:
                logging.error('Unknown video plugin `%s`', video)
            except InitFailed as e:
                logging.info('Could not initialise video plugin `%s`: %s', video, e)
            if self._video:
                break
        else:
            # video plugin is necessary, fail without it
            raise InitFailed('Failed to initialise any video plugin.')
        audio = audio_override or video
        try:
            self._audio = audio_plugins[audio](self._audio_queue, **kwargs)
        except KeyError:
            # ignore if an interface has no audio, but not if an override doesn't exist
            if audio_override and audio_override != 'none':
                logging.error('Unknown audio plugin `%s`', audio)
        except InitFailed as e:
            logging.info('Could not initialise audio plugin `%s`: %s', audio, e)
        if not self._audio:
            # audio fallback to no-plugin
            self._audio = AudioPlugin(self._audio_queue, **kwargs)
def __init__ ( self , guard = None , try_interfaces = ( ) , audio_override = None , wait = False , * * kwargs ) : self . _input_queue = queue . Queue ( ) self . _video_queue = queue . Queue ( ) self . _audio_queue = queue . Queue ( ) self . _wait = wait self . _guard = guard self . _video , self . _audio = None , None for video in try_interfaces : try : self . _video = video_plugins [ video ] ( self . _input_queue , self . _video_queue , * * kwargs ) except KeyError : logging . error ( 'Unknown video plugin `%s`' , video ) except InitFailed as e : logging . info ( 'Could not initialise video plugin `%s`: %s' , video , e ) if self . _video : break else : # video plugin is necessary, fail without it raise InitFailed ( 'Failed to initialise any video plugin.' ) audio = audio_override or video try : self . _audio = audio_plugins [ audio ] ( self . _audio_queue , * * kwargs ) except KeyError : # ignore if an interface has no audio, but not if an override doesn't exist if audio_override and audio_override != 'none' : logging . error ( 'Unknown audio plugin `%s`' , audio ) except InitFailed as e : logging . info ( 'Could not initialise audio plugin `%s`: %s' , audio , e ) if not self . _audio : # audio fallback to no-plugin self . _audio = AudioPlugin ( self . _audio_queue , * * kwargs )