Example #1
0
def remove_video_device_change_callback(callback):
    from xpra.platform.webcam import _video_device_change_callbacks
    global _watch_manager, _notifier
    if not _watch_manager:
        log.error(
            "Error: cannot remove video device change callback, no watch manager!"
        )
        return
    if callback not in _video_device_change_callbacks:
        log.error(
            "Error: video device change callback not found, cannot remove it!")
        return
    log("remove_video_device_change_callback(%s)", callback)
    _video_device_change_callbacks.remove(callback)
    if not _video_device_change_callbacks:
        log("last video device change callback removed, closing the watch manager"
            )
        #we can close it:
        try:
            _notifier.stop()
        except Exception:
            pass
        _notifier = None
        try:
            _watch_manager.close()
        except Exception:
            pass
        _watch_manager = None
Example #2
0
def remove_video_device_change_callback(callback):
    from xpra.platform.webcam import _video_device_change_callbacks
    if callback in _video_device_change_callbacks:
        _video_device_change_callbacks.remove(callback)
    if len(_video_device_change_callbacks) == 0:
        #none left, stop listening
        el = get_win32_event_listener(False)
        if el:
            el.remove_event_callback(WM_DEVICECHANGE, _device_change_callback)
Example #3
0
def remove_video_device_change_callback(callback):
    if not get_win32_event_listener:
        return
    from xpra.platform.webcam import _video_device_change_callbacks
    if callback in _video_device_change_callbacks:
        _video_device_change_callbacks.remove(callback)
    if len(_video_device_change_callbacks)==0:
        #none left, stop listening
        get_win32_event_listener().remove_event_callback(WM_DEVICECHANGE, _device_change_callback)
Example #4
0
def remove_video_device_change_callback(callback):
    from xpra.platform.webcam import _video_device_change_callbacks
    global _watch_manager, _notifier
    if not _watch_manager:
        log.error("Error: cannot remove video device change callback, no watch manager!")
        return
    if callback not in _video_device_change_callbacks:
        log.error("Error: video device change callback not found, cannot remove it!")
        return
    log("remove_video_device_change_callback(%s)", callback)
    _video_device_change_callbacks.remove(callback)
    if len(_video_device_change_callbacks)==0:
        log("last video device change callback removed, closing the watch manager")
        #we can close it:
        try:
            _notifier.stop()
        except:
            pass
        _notifier = None
        try:
            _watch_manager.close()
        except:
            pass
        _watch_manager = None