diff --git a/src/screencast/screencast_scp_shm.c b/src/screencast/screencast_scp_shm.c new file mode 100644 index 00000000..5171bec7 --- /dev/null +++ b/src/screencast/screencast_scp_shm.c @@ -0,0 +1,29 @@ +#include "screencast_scp_shm.h" + +enum spa_video_format xdpw_format_pw_from_wl_shm( + struct xdpw_frame_scp_shm *frame) { + switch (frame->format) { + case WL_SHM_FORMAT_ARGB8888: + return SPA_VIDEO_FORMAT_BGRA; + case WL_SHM_FORMAT_XRGB8888: + return SPA_VIDEO_FORMAT_BGRx; + case WL_SHM_FORMAT_RGBA8888: + return SPA_VIDEO_FORMAT_ABGR; + case WL_SHM_FORMAT_RGBX8888: + return SPA_VIDEO_FORMAT_xBGR; + case WL_SHM_FORMAT_ABGR8888: + return SPA_VIDEO_FORMAT_RGBA; + case WL_SHM_FORMAT_XBGR8888: + return SPA_VIDEO_FORMAT_RGBx; + case WL_SHM_FORMAT_BGRA8888: + return SPA_VIDEO_FORMAT_ARGB; + case WL_SHM_FORMAT_BGRX8888: + return SPA_VIDEO_FORMAT_xRGB; + case WL_SHM_FORMAT_NV12: + return SPA_VIDEO_FORMAT_NV12; + default: + abort(); + } +} + +