From 52a534d024c824c9359b3b9ea605f4fbb719f1f8 Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Thu, 14 Jan 2021 08:49:01 +0200 Subject: py: add fourcc_to_pixelformat Signed-off-by: Tomi Valkeinen --- py/pykms/pykmsbase.cpp | 2 ++ py/tests/cam.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'py') diff --git a/py/pykms/pykmsbase.cpp b/py/pykms/pykmsbase.cpp index a963843..382ef6f 100644 --- a/py/pykms/pykmsbase.cpp +++ b/py/pykms/pykmsbase.cpp @@ -224,6 +224,8 @@ void init_pykmsbase(py::module& m) .value("RGBA1010102", PixelFormat::RGBA1010102) .value("BGRA1010102", PixelFormat::BGRA1010102); + m.def("fourcc_to_pixelformat", &FourCCToPixelFormat); + py::enum_(m, "SyncPolarity") .value("Undefined", SyncPolarity::Undefined) .value("Positive", SyncPolarity::Positive) diff --git a/py/tests/cam.py b/py/tests/cam.py index b7294ed..957eb11 100755 --- a/py/tests/cam.py +++ b/py/tests/cam.py @@ -9,11 +9,12 @@ import time parser = argparse.ArgumentParser() parser.add_argument("width", type=int) parser.add_argument("height", type=int) +parser.add_argument("fourcc", type=str, nargs="?", default="YUVY") args = parser.parse_args() w = args.width h = args.height -fmt = pykms.PixelFormat.YUYV +fmt = pykms.fourcc_to_pixelformat(args.fourcc) print("Capturing in {}x{}".format(w, h)) -- cgit v1.2.3