From 8f16bd52629b850ff40447623d72a669c06e341b Mon Sep 17 00:00:00 2001 From: Martin Pulec Date: Tue, 3 Dec 2019 10:20:26 +0100 Subject: [PATCH] Screen X11: fixed indention in probe --- src/video_capture/screen_x11.c | 56 ++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 26 deletions(-) diff --git a/src/video_capture/screen_x11.c b/src/video_capture/screen_x11.c index 6c3d5786e..14eca1b38 100644 --- a/src/video_capture/screen_x11.c +++ b/src/video_capture/screen_x11.c @@ -244,36 +244,40 @@ static struct vidcap_type * vidcap_screen_x11_probe(bool verbose, void (**delete *deleter = free; vt = (struct vidcap_type *) calloc(1, sizeof(struct vidcap_type)); - if (vt != NULL) { - vt->name = "screen"; - vt->description = "Grabbing screen"; + if (vt == NULL) { + return NULL; + } - if (verbose) { - vt->card_count = 1; - vt->cards = calloc(vt->card_count, sizeof(struct device_info)); - // vt->cards[0].id can be "" since screen cap. doesn't require parameters - snprintf(vt->cards[0].name, sizeof vt->cards[0].name, "Screen capture"); + vt->name = "screen"; + vt->description = "Grabbing screen"; - int framerates[] = {24, 30, 60}; + if (!verbose) { + return vt; + } - snprintf(vt->cards[0].modes[0].name, - sizeof vt->cards[0].name, - "Unlimited fps"); - snprintf(vt->cards[0].modes[0].id, - sizeof vt->cards[0].id, - "{\"fps\":\"\"}"); + vt->card_count = 1; + vt->cards = calloc(vt->card_count, sizeof(struct device_info)); + // vt->cards[0].id can be "" since screen cap. doesn't require parameters + snprintf(vt->cards[0].name, sizeof vt->cards[0].name, "Screen capture"); - for(unsigned i = 0; i < sizeof(framerates) / sizeof(framerates[0]); i++){ - snprintf(vt->cards[0].modes[i + 1].name, - sizeof vt->cards[0].name, - "%d fps", - framerates[i]); - snprintf(vt->cards[0].modes[i + 1].id, - sizeof vt->cards[0].id, - "{\"fps\":\"%d\"}", - framerates[i]); - } - } + int framerates[] = {24, 30, 60}; + + snprintf(vt->cards[0].modes[0].name, + sizeof vt->cards[0].name, + "Unlimited fps"); + snprintf(vt->cards[0].modes[0].id, + sizeof vt->cards[0].id, + "{\"fps\":\"\"}"); + + for(unsigned i = 0; i < sizeof(framerates) / sizeof(framerates[0]); i++){ + snprintf(vt->cards[0].modes[i + 1].name, + sizeof vt->cards[0].name, + "%d fps", + framerates[i]); + snprintf(vt->cards[0].modes[i + 1].id, + sizeof vt->cards[0].id, + "{\"fps\":\"%d\"}", + framerates[i]); } return vt; }