diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2017-01-02 16:42:08 +0200 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2017-01-03 10:46:42 +0200 |
commit | b11baff09f78a4a383f817ec35208ae8966ab832 (patch) | |
tree | 610e89719c4a3d9714a472cdc6681e36df419a1b /py/cam.py | |
parent | c6f964425cdec25e3d0ecd0054d398d3420fdfeb (diff) |
py: Reorganize source directory
Separate the Python bindings sources from the test scripts. While at it,
remove the unneeded run.sh script.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'py/cam.py')
-rwxr-xr-x | py/cam.py | 78 |
1 files changed, 0 insertions, 78 deletions
diff --git a/py/cam.py b/py/cam.py deleted file mode 100755 index b44f8f9..0000000 --- a/py/cam.py +++ /dev/null @@ -1,78 +0,0 @@ -#!/usr/bin/python3 - -import sys -import selectors -import pykms -from helpers import * - - -w = 640 -h = 480 -fmt = pykms.PixelFormat.YUYV - - -# This hack makes drm initialize the fbcon, setting up the default connector -card = pykms.Card() -card = 0 - -card = pykms.Card() -res = pykms.ResourceManager(card) -conn = res.reserve_connector() -crtc = res.reserve_crtc(conn) -plane = res.reserve_overlay_plane(crtc, fmt) - -mode = conn.get_default_mode() - -NUM_BUFS = 5 - -fbs = [] -for i in range(NUM_BUFS): - fb = pykms.DumbFramebuffer(card, w, h, fmt) - fbs.append(fb) - -vidpath = pykms.VideoDevice.get_capture_devices()[0] - -vid = pykms.VideoDevice(vidpath) -cap = vid.capture_streamer -cap.set_port(0) -cap.set_format(fmt, w, h) -cap.set_queue_size(NUM_BUFS) - -for fb in fbs: - cap.queue(fb) - -cap.stream_on() - - -def readvid(conn, mask): - fb = cap.dequeue() - - if card.has_atomic: - set_props(plane, { - "FB_ID": fb.id, - "CRTC_ID": crtc.id, - "SRC_W": fb.width << 16, - "SRC_H": fb.height << 16, - "CRTC_W": fb.width, - "CRTC_H": fb.height, - }) - else: - crtc.set_plane(plane, fb, 0, 0, fb.width, fb.height, - 0, 0, fb.width, fb.height) - - cap.queue(fb) - -def readkey(conn, mask): - #print("KEY EVENT"); - sys.stdin.readline() - exit(0) - -sel = selectors.DefaultSelector() -sel.register(cap.fd, selectors.EVENT_READ, readvid) -sel.register(sys.stdin, selectors.EVENT_READ, readkey) - -while True: - events = sel.select() - for key, mask in events: - callback = key.data - callback(key.fileobj, mask) |