#pragma once #include #include #include typedef struct Xorg_Viewer Xorg_Viewer; /* Returns false when compiled without HAVE_GLFW. */ bool xorg_available(void); /* * Open a viewer window at screen position (x, y) with the given size. * Returns NULL if xorg is unavailable or if window/context creation fails. */ Xorg_Viewer *xorg_viewer_open(int x, int y, int width, int height, const char *title); /* Push a YUV 4:2:0 planar frame for immediate display. */ bool xorg_viewer_push_yuv420(Xorg_Viewer *v, const uint8_t *y, const uint8_t *cb, const uint8_t *cr, int width, int height); /* Push a packed BGRA frame for immediate display. */ bool xorg_viewer_push_bgra(Xorg_Viewer *v, const uint8_t *data, int width, int height); /* * Push a MJPEG frame. Decoded via libjpeg-turbo to planar YUV before upload. * Returns false if compiled without HAVE_TURBOJPEG. */ bool xorg_viewer_push_mjpeg(Xorg_Viewer *v, const uint8_t *data, size_t size); /* * Process pending window events. * Returns false when the user has closed the window. * Must be called from the thread that created the viewer. */ bool xorg_viewer_poll(Xorg_Viewer *v); void xorg_viewer_close(Xorg_Viewer *v);