Remove --pixelformat flag

This hack is not needed anymore.
This commit is contained in:
Simon Ser 2020-05-03 16:36:37 +02:00 committed by danshick
parent 26b6bf69aa
commit a7ea407e2f
5 changed files with 3 additions and 21 deletions

View file

@ -59,7 +59,6 @@ struct xdpw_screencast_context {
// cli options // cli options
const char *output_name; const char *output_name;
const char *forced_pixelformat;
// sessions // sessions
struct wl_list screencast_instances; struct wl_list screencast_instances;

View file

@ -39,8 +39,7 @@ enum {
}; };
int xdpw_screenshot_init(struct xdpw_state *state); int xdpw_screenshot_init(struct xdpw_state *state);
int xdpw_screencast_init(struct xdpw_state *state, const char *output_name, int xdpw_screencast_init(struct xdpw_state *state, const char *output_name);
const char *forced_pixelformat);
struct xdpw_request *xdpw_request_create(sd_bus *bus, const char *object_path); struct xdpw_request *xdpw_request_create(sd_bus *bus, const char *object_path);
void xdpw_request_destroy(struct xdpw_request *req); void xdpw_request_destroy(struct xdpw_request *req);

View file

@ -23,7 +23,6 @@ int xdpw_usage(FILE* stream, int rc) {
" -l, --loglevel=<loglevel> Select log level (default is ERROR).\n" " -l, --loglevel=<loglevel> Select log level (default is ERROR).\n"
" QUIET, ERROR, WARN, INFO, DEBUG, TRACE\n" " QUIET, ERROR, WARN, INFO, DEBUG, TRACE\n"
" -o, --output=<name> Select output to capture.\n" " -o, --output=<name> Select output to capture.\n"
" -p,--pixelformat=BGRx|RGBx Force a pixelformat in pipewire\n"
" metadata (performs no conversion).\n" " metadata (performs no conversion).\n"
" -h,--help Get help (this text).\n" " -h,--help Get help (this text).\n"
"\n"; "\n";
@ -34,14 +33,12 @@ int xdpw_usage(FILE* stream, int rc) {
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
const char* output_name = NULL; const char* output_name = NULL;
const char* forced_pixelformat = NULL;
enum LOGLEVEL loglevel = ERROR; enum LOGLEVEL loglevel = ERROR;
static const char* shortopts = "l:o:p:h"; static const char* shortopts = "l:o:p:h";
static const struct option longopts[] = { static const struct option longopts[] = {
{ "loglevel", required_argument, NULL, 'l' }, { "loglevel", required_argument, NULL, 'l' },
{ "output", required_argument, NULL, 'o' }, { "output", required_argument, NULL, 'o' },
{ "pixelformat", required_argument, NULL, 'p' },
{ "help", no_argument, NULL, 'h' }, { "help", no_argument, NULL, 'h' },
{ NULL, 0, NULL, 0 } { NULL, 0, NULL, 0 }
}; };
@ -58,9 +55,6 @@ int main(int argc, char *argv[]) {
case 'o': case 'o':
output_name = optarg; output_name = optarg;
break; break;
case 'p':
forced_pixelformat = optarg;
break;
case 'h': case 'h':
return xdpw_usage(stdout, 0); return xdpw_usage(stdout, 0);
default: default:
@ -107,7 +101,7 @@ int main(int argc, char *argv[]) {
wl_list_init(&state.xdpw_sessions); wl_list_init(&state.xdpw_sessions);
xdpw_screenshot_init(&state); xdpw_screenshot_init(&state);
ret = xdpw_screencast_init(&state, output_name, forced_pixelformat); ret = xdpw_screencast_init(&state, output_name);
if (ret < 0) { if (ret < 0) {
logprint(ERROR, "xdpw: failed to initialize screencast"); logprint(ERROR, "xdpw: failed to initialize screencast");
goto error; goto error;

View file

@ -436,12 +436,11 @@ static const sd_bus_vtable screencast_vtable[] = {
SD_BUS_VTABLE_END SD_BUS_VTABLE_END
}; };
int xdpw_screencast_init(struct xdpw_state *state, const char *output_name, const char *forced_pixelformat) { int xdpw_screencast_init(struct xdpw_state *state, const char *output_name) {
sd_bus_slot *slot = NULL; sd_bus_slot *slot = NULL;
state->screencast = (struct xdpw_screencast_context) { 0 }; state->screencast = (struct xdpw_screencast_context) { 0 };
state->screencast.state = state; state->screencast.state = state;
state->screencast.forced_pixelformat = forced_pixelformat;
state->screencast.output_name = output_name; state->screencast.output_name = output_name;
int err; int err;

View file

@ -14,15 +14,6 @@ void randname(char *buf) {
enum spa_video_format xdpw_format_pw_from_wl_shm( enum spa_video_format xdpw_format_pw_from_wl_shm(
struct xdpw_screencast_instance *cast) { struct xdpw_screencast_instance *cast) {
if (cast->ctx->forced_pixelformat) {
if (strcmp(cast->ctx->forced_pixelformat, "BGRx") == 0) {
return SPA_VIDEO_FORMAT_BGRx;
}
if (strcmp(cast->ctx->forced_pixelformat, "RGBx") == 0) {
return SPA_VIDEO_FORMAT_RGBx;
}
}
switch (cast->simple_frame.format) { switch (cast->simple_frame.format) {
case WL_SHM_FORMAT_ARGB8888: case WL_SHM_FORMAT_ARGB8888:
return SPA_VIDEO_FORMAT_BGRA; return SPA_VIDEO_FORMAT_BGRA;