summaryrefslogtreecommitdiff
path: root/src/py/cam/cam_qtgl.py
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ideasonboard.com>2022-05-18 16:13:23 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2022-05-18 17:52:30 +0300
commitfa7bda46f8a44e1d228489b37744d1eac8373b56 (patch)
tree78027ab9b2e3658960a667be24b3b3399371b9af /src/py/cam/cam_qtgl.py
parent11a271b29234e0271c9cf83aefc529dc1e0b3cc3 (diff)
py: Implement PixelFormat class
Implement PixelFormat bindings properly with a PixelFormat class. Change the bindings to use the new class instead of a string. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/py/cam/cam_qtgl.py')
-rw-r--r--src/py/cam/cam_qtgl.py17
1 files changed, 1 insertions, 16 deletions
diff --git a/src/py/cam/cam_qtgl.py b/src/py/cam/cam_qtgl.py
index 8a95994e..261accb8 100644
--- a/src/py/cam/cam_qtgl.py
+++ b/src/py/cam/cam_qtgl.py
@@ -30,14 +30,6 @@ from OpenGL.GL import shaders
from gl_helpers import *
-# libcamera format string -> DRM fourcc
-FMT_MAP = {
- 'RGB888': 'RG24',
- 'XRGB8888': 'XR24',
- 'ARGB8888': 'AR24',
- 'YUYV': 'YUYV',
-}
-
class EglState:
def __init__(self):
@@ -204,12 +196,6 @@ class MainWindow(QtWidgets.QWidget):
self.current[ctx['idx']] = []
for stream in ctx['streams']:
- fmt = stream.configuration.pixel_format
- size = stream.configuration.size
-
- if fmt not in FMT_MAP:
- raise Exception('Unsupported pixel format: ' + str(fmt))
-
self.textures[stream] = None
num_tiles = len(self.textures)
@@ -281,8 +267,7 @@ class MainWindow(QtWidgets.QWidget):
def create_texture(self, stream, fb):
cfg = stream.configuration
- fmt = cfg.pixel_format
- fmt = str_to_fourcc(FMT_MAP[fmt])
+ fmt = cfg.pixel_format.fourcc
w, h = cfg.size
attribs = [