summaryrefslogtreecommitdiffstats
path: root/tests/roof.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/roof.py')
-rw-r--r--tests/roof.py33
1 files changed, 25 insertions, 8 deletions
diff --git a/tests/roof.py b/tests/roof.py
index 2138931..a859069 100644
--- a/tests/roof.py
+++ b/tests/roof.py
@@ -1,8 +1,9 @@
import gi
import sys
import json
-import gobject
+import argparse
+gi.require_version('Ufo', '0.0')
from gi.repository import Ufo
from gi.repository import GObject
@@ -16,24 +17,40 @@ class RoofConfig:
self.streams = cfg["network"]["streams"]
elif cfg.get("setup", {}).get("modules") != None:
self.streams = cfg["setup"]["modules"]
-
+
+
config = "roof.json"
-cfg = RoofConfig(config)
+output = None
+
+parser = argparse.ArgumentParser()
+parser.add_argument('-c', '--config', dest="config", default="roof.json", help="ROOF configuration (JSON)")
+parser.add_argument('-o', '--output', dest="output", default=None, help="Output file")
+parser.add_argument('-n', '--number', dest="number", default=None, help="Specify number of frames to capture")
+args = parser.parse_args()
+
+
+cfg = RoofConfig(args.config)
pm = Ufo.PluginManager()
graph = Ufo.TaskGraph()
scheduler = Ufo.Scheduler()
+if args.output is None:
+ print ("Starting ROOF using NULL writter")
+ write = pm.get_task('null')
+ if args.number is None: args.number = 0
+else:
+ print ("Starting ROOF streaming to {}".format(args.output))
+ write = pm.get_task('write')
+ write.set_properties(filename=args.output)
+ if args.number is None: args.number = 5
build = pm.get_task('roof-build')
-build.set_properties(config=config, number=0)
-
-write = pm.get_task('write')
-write.set_properties(filename="test.raw")
+build.set_properties(config=args.config, number=args.number)
for id in range(cfg.streams):
read = pm.get_task('roof-read')
- read.set_properties(config=config, id=id)
+ read.set_properties(config=args.config, id=id)
graph.connect_nodes(read, build)
build.bind_property('stop', read, 'stop', GObject.BindingFlags.DEFAULT)