From 31e4e66408e82ba811517aba6866477c6646d596 Mon Sep 17 00:00:00 2001 From: alban Date: Tue, 13 Oct 2020 22:04:17 +0200 Subject: [PATCH] [enh] there should be a clitools blank generator --- clitools/generators/blank.py | 53 ++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100755 clitools/generators/blank.py diff --git a/clitools/generators/blank.py b/clitools/generators/blank.py new file mode 100755 index 0000000..657bc5a --- /dev/null +++ b/clitools/generators/blank.py @@ -0,0 +1,53 @@ +#!/usr/bin/python3 +# -*- coding: utf-8 -*- +# -*- mode: Python -*- + + +''' + +Send only black points +v0.1.0 + +Use it to test your filters and outputs + +LICENCE : CC + +by cocoa + +''' + +from __future__ import print_function +import time +import argparse +import sys +name="generator::dummy" + + +def debug(*args, **kwargs): + if( verbose == False ): + return + print(*args, file=sys.stderr, **kwargs) + +argsparser = argparse.ArgumentParser(description="dummy generator") +argsparser.add_argument("-f","--fps",help="Frame Per Second",default=30,type=int) +argsparser.add_argument("-v","--verbose",action="store_true",help="Verbose output") +args = argsparser.parse_args() + +fps=args.fps +verbose=args.verbose +optimal_looptime = 1 / fps +debug(name+" optimal looptime "+str(optimal_looptime)) + + +shape = [[400,400,0],[400,400,64],[400,400,0]] + + +while True: + start = time.time() + print(shape, flush=True); + looptime = time.time() - start + if( looptime < optimal_looptime ): + time.sleep( optimal_looptime - looptime) + debug(name+" micro sleep:"+str( optimal_looptime - looptime)) + +