Skip to content

Commit

Permalink
Remove --pixelformat flag
Browse files Browse the repository at this point in the history
This hack is not needed anymore.
  • Loading branch information
emersion authored and danshick committed May 5, 2020
1 parent 26b6bf6 commit a7ea407
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 21 deletions.
1 change: 0 additions & 1 deletion include/screencast_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ struct xdpw_screencast_context {

// cli options
const char *output_name;
const char *forced_pixelformat;

// sessions
struct wl_list screencast_instances;
Expand Down
3 changes: 1 addition & 2 deletions include/xdpw.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ enum {
};

int xdpw_screenshot_init(struct xdpw_state *state);
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);

struct xdpw_request *xdpw_request_create(sd_bus *bus, const char *object_path);
void xdpw_request_destroy(struct xdpw_request *req);
Expand Down
8 changes: 1 addition & 7 deletions src/core/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ int xdpw_usage(FILE* stream, int rc) {
" -l, --loglevel=<loglevel> Select log level (default is ERROR).\n"
" QUIET, ERROR, WARN, INFO, DEBUG, TRACE\n"
" -o, --output=<name> Select output to capture.\n"
" -p,--pixelformat=BGRx|RGBx Force a pixelformat in pipewire\n"
" metadata (performs no conversion).\n"
" -h,--help Get help (this text).\n"
"\n";
Expand All @@ -34,14 +33,12 @@ int xdpw_usage(FILE* stream, int rc) {

int main(int argc, char *argv[]) {
const char* output_name = NULL;
const char* forced_pixelformat = NULL;
enum LOGLEVEL loglevel = ERROR;

static const char* shortopts = "l:o:p:h";
static const struct option longopts[] = {
{ "loglevel", required_argument, NULL, 'l' },
{ "output", required_argument, NULL, 'o' },
{ "pixelformat", required_argument, NULL, 'p' },
{ "help", no_argument, NULL, 'h' },
{ NULL, 0, NULL, 0 }
};
Expand All @@ -58,9 +55,6 @@ int main(int argc, char *argv[]) {
case 'o':
output_name = optarg;
break;
case 'p':
forced_pixelformat = optarg;
break;
case 'h':
return xdpw_usage(stdout, 0);
default:
Expand Down Expand Up @@ -107,7 +101,7 @@ int main(int argc, char *argv[]) {
wl_list_init(&state.xdpw_sessions);

xdpw_screenshot_init(&state);
ret = xdpw_screencast_init(&state, output_name, forced_pixelformat);
ret = xdpw_screencast_init(&state, output_name);
if (ret < 0) {
logprint(ERROR, "xdpw: failed to initialize screencast");
goto error;
Expand Down
3 changes: 1 addition & 2 deletions src/screencast/screencast.c
Original file line number Diff line number Diff line change
Expand Up @@ -436,12 +436,11 @@ static const sd_bus_vtable screencast_vtable[] = {
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;

state->screencast = (struct xdpw_screencast_context) { 0 };
state->screencast.state = state;
state->screencast.forced_pixelformat = forced_pixelformat;
state->screencast.output_name = output_name;

int err;
Expand Down
9 changes: 0 additions & 9 deletions src/screencast/screencast_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,6 @@ void randname(char *buf) {

enum spa_video_format xdpw_format_pw_from_wl_shm(
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) {
case WL_SHM_FORMAT_ARGB8888:
return SPA_VIDEO_FORMAT_BGRA;
Expand Down

0 comments on commit a7ea407

Please sign in to comment.