2020-01-24 23:31:01 +01:00
|
|
|
#include "screencast_common.h"
|
|
|
|
|
2020-03-13 23:19:19 +01:00
|
|
|
enum spa_video_format pipewire_from_wl_shm(void *data) {
|
2020-01-24 23:31:01 +01:00
|
|
|
struct screencast_context *ctx = data;
|
2020-02-19 17:48:36 +01:00
|
|
|
|
2020-03-13 17:43:24 +01:00
|
|
|
if (ctx->forced_pixelformat) {
|
|
|
|
if (strcmp(ctx->forced_pixelformat, "BGRx") == 0) {
|
2020-03-13 23:19:19 +01:00
|
|
|
return SPA_VIDEO_FORMAT_BGRx;
|
2020-02-19 17:48:36 +01:00
|
|
|
}
|
2020-03-13 17:43:24 +01:00
|
|
|
if (strcmp(ctx->forced_pixelformat, "RGBx") == 0) {
|
2020-03-13 23:19:19 +01:00
|
|
|
return SPA_VIDEO_FORMAT_RGBx;
|
2020-02-19 17:48:36 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-01-24 23:31:01 +01:00
|
|
|
switch (ctx->simple_frame.format) {
|
2020-03-13 17:43:24 +01:00
|
|
|
case WL_SHM_FORMAT_ARGB8888:
|
2020-03-13 23:19:19 +01:00
|
|
|
return SPA_VIDEO_FORMAT_BGRA;
|
2020-03-13 17:43:24 +01:00
|
|
|
case WL_SHM_FORMAT_XRGB8888:
|
2020-03-13 23:19:19 +01:00
|
|
|
return SPA_VIDEO_FORMAT_BGRx;
|
2020-03-13 17:43:24 +01:00
|
|
|
case WL_SHM_FORMAT_RGBA8888:
|
2020-03-13 23:19:19 +01:00
|
|
|
return SPA_VIDEO_FORMAT_ABGR;
|
2020-03-13 17:43:24 +01:00
|
|
|
case WL_SHM_FORMAT_RGBX8888:
|
2020-03-13 23:19:19 +01:00
|
|
|
return SPA_VIDEO_FORMAT_xBGR;
|
2020-03-13 17:43:24 +01:00
|
|
|
case WL_SHM_FORMAT_ABGR8888:
|
2020-03-13 23:19:19 +01:00
|
|
|
return SPA_VIDEO_FORMAT_RGBA;
|
2020-03-13 17:43:24 +01:00
|
|
|
case WL_SHM_FORMAT_XBGR8888:
|
2020-03-13 23:19:19 +01:00
|
|
|
return SPA_VIDEO_FORMAT_RGBx;
|
2020-03-13 17:43:24 +01:00
|
|
|
case WL_SHM_FORMAT_BGRA8888:
|
2020-03-13 23:19:19 +01:00
|
|
|
return SPA_VIDEO_FORMAT_ARGB;
|
2020-03-13 17:43:24 +01:00
|
|
|
case WL_SHM_FORMAT_BGRX8888:
|
2020-03-13 23:19:19 +01:00
|
|
|
return SPA_VIDEO_FORMAT_xRGB;
|
2020-03-13 17:43:24 +01:00
|
|
|
case WL_SHM_FORMAT_NV12:
|
2020-03-13 23:19:19 +01:00
|
|
|
return SPA_VIDEO_FORMAT_NV12;
|
2020-03-13 17:43:24 +01:00
|
|
|
default:
|
|
|
|
abort();
|
2020-01-24 23:31:01 +01:00
|
|
|
}
|
|
|
|
}
|