Beispiel #1
0
def main():
    
    args = get_args()

    core_ip = socket.gethostbyname(args.host)
    # establish a synchronus connection to server
    Connection.establish(core_ip) 

    server_caps = get_server_caps()

    pipeline = mk_pipeline(args, server_caps)
    print(pipeline)

    if args.debug:
        gst_cmd = "gst-launch-1.0 {}".format(pipeline)

        # escape the ! because  
        # asl2: ! is interpreted as a command history metacharacter
        gst_cmd = gst_cmd.replace("!"," \! ")

        # remove all the \n to make it easy to cut/paste into shell
        gst_cmd = gst_cmd.replace("\n"," ")
        while "  " in gst_cmd:
            gst_cmd = gst_cmd.replace("  "," ")
        print("-"*78)
        print(gst_cmd)
        print("-"*78)

    run_pipeline(pipeline, args)
Beispiel #2
0
def main():
    # configure logging
    docolor = (Args.color == 'always') or (Args.color == 'auto'
                                           and sys.stderr.isatty())

    handler = LogHandler(docolor, Args.timestamp)
    logging.root.addHandler(handler)

    if Args.verbose >= 2:
        level = logging.DEBUG
    elif Args.verbose == 1:
        level = logging.INFO
    else:
        level = logging.WARNING

    logging.root.setLevel(level)

    # make killable by ctrl-c
    logging.debug('setting SIGINT handler')
    signal.signal(signal.SIGINT, signal.SIG_DFL)

    logging.info('Python Version: %s', sys.version_info)
    logging.info('GStreamer Version: %s', Gst.version())

    # establish a synchronus connection to server
    Connection.establish(Config.get('server', 'host'))

    # fetch config from server
    Config.fetchServerConfig()

    # Warn when connecting to a non-local core without preview-encoders enabled
    # the list-comparison is not complete (one could use a local hostname or the local system ip)
    # but it's only here to warn that one might be making a mistake
    use_previews = Config.getboolean(
        'previews', 'enabled') and Config.getboolean('previews', 'use')
    looks_like_localhost = Config.get(
        'server', 'host') in ['::1', '127.0.0.1', 'localhost']
    if not use_previews and not looks_like_localhost:
        logging.warn(
            'Connecting to `%s` (which looks like a remote host) might not work without enabeling '
            'the preview encoders (set `[previews] enabled=true` on the core) or it might saturate '
            'your ethernet link between the two machines.',
            Config.get('server', 'host'))

    # obtain network-clock
    ClockManager.obtainClock(Connection.ip)

    # switch connection to nonblocking, event-driven mode
    Connection.enterNonblockingMode()

    # init main-class and main-loop
    # (this binds all event-hander on the Connection)
    logging.debug('initializing Voctogui')
    voctogui = Voctogui()

    # start the Mainloop and show the Window
    logging.debug('running Voctogui')
    voctogui.run()
Beispiel #3
0
def main():
	# configure logging
	docolor = (Args.color == 'always') or (Args.color == 'auto' and sys.stderr.isatty())

	handler = LogHandler(docolor, Args.timestamp)
	logging.root.addHandler(handler)

	if Args.verbose >= 2:
		level = logging.DEBUG
	elif Args.verbose == 1:
		level = logging.INFO
	else:
		level = logging.WARNING

	logging.root.setLevel(level)

	# make killable by ctrl-c
	logging.debug('setting SIGINT handler')
	signal.signal(signal.SIGINT, signal.SIG_DFL)

	logging.info('Python Version: %s', sys.version_info)
	logging.info('GStreamer Version: %s', Gst.version())

	# establish a synchronus connection to server
	Connection.establish(
		Config.get('server', 'host'))

	# fetch config from server
	Config.fetchServerConfig()

	# Warn when connecting to a non-local core without preview-encoders enabled
	# the list-comparison is not complete (one could use a local hostname or the local system ip)
	# but it's only here to warn that one might be making a mistake
	use_previews = Config.getboolean('previews', 'enabled') and Config.getboolean('previews', 'use')
	looks_like_localhost = Config.get('server', 'host') in ['::1', '127.0.0.1', 'localhost']
	if not use_previews and not looks_like_localhost:
		logging.warn(
			'Connecting to `%s` (which looks like a remote host) might not work without enabeling '
			'the preview encoders (set `[previews] enabled=true` on the core) or it might saturate '
			'your ethernet link between the two machines.',
			Config.get('server', 'host')
		)

	# obtain network-clock
	ClockManager.obtainClock(Connection.ip)

	# switch connection to nonblocking, event-driven mode
	Connection.enterNonblockingMode()

	# init main-class and main-loop
	# (this binds all event-hander on the Connection)
	logging.debug('initializing Voctogui')
	voctogui = Voctogui()

	# start the Mainloop and show the Window
	logging.debug('running Voctogui')
	voctogui.run()
Beispiel #4
0
def get_server_caps(core_ip):

    # establish a synchronus connection to server
    Connection.establish(core_ip)

    # fetch config from server
    server_config = Connection.fetchServerConfig()

    # Pull out the configs relevant to this client
    server_caps = {
        'videocaps': server_config['mix']['videocaps'],
        'audiocaps': server_config['mix']['audiocaps']
        }

    return server_caps
Beispiel #5
0
def main():
	# configure logging
	docolor = (Args.color == 'always') or (Args.color == 'auto' and sys.stderr.isatty())

	if Args.verbose == 2:
		level = logging.DEBUG
	elif Args.verbose == 1:
		level = logging.INFO
	else:
		level = logging.WARNING

	if docolor:
		format = '\x1b[33m%(levelname)8s\x1b[0m \x1b[32m%(name)s\x1b[0m: %(message)s'
	else:
		format = '%(levelname)8s %(name)s: %(message)s'

	logging.basicConfig(level=level, format=format)

	# make killable by ctrl-c
	logging.debug('setting SIGINT handler')
	signal.signal(signal.SIGINT, signal.SIG_DFL)

	logging.info('Python Version: %s', sys.version_info)
	logging.info('GStreamer Version: %s', Gst.version())

	# establish a synchronus connection to server
	Connection.establish(
		Config.get('server', 'host'))

	# fetch config from server
	Config.fetchServerConfig()

	# switch connection to nonblocking, event-driven mode
	Connection.enterNonblockingMode()

	# init main-class and main-loop
	# (this binds all event-hander on the Connection)
	logging.debug('initializing Voctogui')
	voctogui = Voctogui()

	# start the Mainloop and show the Window
	logging.debug('running Voctogui')
	voctogui.run()
Beispiel #6
0
def main():
	# configure logging
	docolor = (Args.color == 'always') or (Args.color == 'auto' and sys.stderr.isatty())

	handler = LogHandler(docolor)
	logging.root.addHandler(handler)

	if Args.verbose >= 2:
		level = logging.DEBUG
	elif Args.verbose == 1:
		level = logging.INFO
	else:
		level = logging.WARNING

	logging.root.setLevel(level)

	# make killable by ctrl-c
	logging.debug('setting SIGINT handler')
	signal.signal(signal.SIGINT, signal.SIG_DFL)

	logging.info('Python Version: %s', sys.version_info)
	logging.info('GStreamer Version: %s', Gst.version())

	# establish a synchronus connection to server
	Connection.establish(
		Config.get('server', 'host'))

	# fetch config from server
	Config.fetchServerConfig()

	# switch connection to nonblocking, event-driven mode
	Connection.enterNonblockingMode()

	# init main-class and main-loop
	# (this binds all event-hander on the Connection)
	logging.debug('initializing Voctogui')
	voctogui = Voctogui()

	# start the Mainloop and show the Window
	logging.debug('running Voctogui')
	voctogui.run()
Beispiel #7
0
def main():
    docolor = (Args.color == 'always') or (Args.color == 'auto'
                                           and sys.stderr.isatty())
    loghandler = LogHandler(docolor, Args.timestamp)
    logging.root.addHandler(loghandler)
    if Args.verbose >= 2:
        level = logging.DEBUG
    elif Args.verbose == 1:
        level = logging.INFO
    else:
        level = logging.WARNING

    logging.root.setLevel(level)
    logging.debug('setting SIGINT handler')
    signal.signal(signal.SIGINT, signal.SIG_DFL)
    Connection.establish(Args.host)
    Connection.enterNonblockingMode()
    Connection.on("message", testCallback)
    mainloop = GObject.MainLoop()
    mainloop.run()
    while True:
        logging.debug("mimimi...")
        Connection.send("message", "test2")
        time.sleep(10)