aboutsummaryrefslogtreecommitdiffstats
path: root/utils/v4l2-ctl
diff options
context:
space:
mode:
authorRosen Penev <rosenp@gmail.com>2020-04-26 00:44:46 -0700
committerHans Verkuil <hverkuil-cisco@xs4all.nl>2020-04-28 11:18:15 +0200
commite8e9eca82c713e04b218f99117120e9aa4ad8bef (patch)
treec15d188c8b05654abb5355420134d4a51809b619 /utils/v4l2-ctl
parentb8e58b75b57b94378990cedb38459623c06fc3eb (diff)
utils: replace exit with std variant
Also converted to the appropriate macros for clarity. Signed-off-by: Rosen Penev <rosenp@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Diffstat (limited to 'utils/v4l2-ctl')
-rw-r--r--utils/v4l2-ctl/v4l2-ctl-common.cpp14
-rw-r--r--utils/v4l2-ctl/v4l2-ctl-edid.cpp28
-rw-r--r--utils/v4l2-ctl/v4l2-ctl-meta.cpp2
-rw-r--r--utils/v4l2-ctl/v4l2-ctl-misc.cpp6
-rw-r--r--utils/v4l2-ctl/v4l2-ctl-sdr.cpp2
-rw-r--r--utils/v4l2-ctl/v4l2-ctl-selection.cpp8
-rw-r--r--utils/v4l2-ctl/v4l2-ctl-stds.cpp16
-rw-r--r--utils/v4l2-ctl/v4l2-ctl-streaming.cpp26
-rw-r--r--utils/v4l2-ctl/v4l2-ctl-subdev.cpp18
-rw-r--r--utils/v4l2-ctl/v4l2-ctl-tuner.cpp6
-rw-r--r--utils/v4l2-ctl/v4l2-ctl-vbi.cpp4
-rw-r--r--utils/v4l2-ctl/v4l2-ctl-vidcap.cpp16
-rw-r--r--utils/v4l2-ctl/v4l2-ctl-vidout.cpp4
-rw-r--r--utils/v4l2-ctl/v4l2-ctl.cpp30
14 files changed, 90 insertions, 90 deletions
diff --git a/utils/v4l2-ctl/v4l2-ctl-common.cpp b/utils/v4l2-ctl/v4l2-ctl-common.cpp
index 4bf7328d..bbd00e95 100644
--- a/utils/v4l2-ctl/v4l2-ctl-common.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-common.cpp
@@ -695,13 +695,13 @@ void common_process_controls(cv4l_fd &fd)
for (ctrl_get_list::iterator iter = get_ctrls.begin(); iter != get_ctrls.end(); ++iter) {
if (ctrl_str2q.find(*iter) == ctrl_str2q.end()) {
fprintf(stderr, "unknown control '%s'\n", iter->c_str());
- exit(1);
+ std::exit(EXIT_FAILURE);
}
}
for (ctrl_set_map::iterator iter = set_ctrls.begin(); iter != set_ctrls.end(); ++iter) {
if (ctrl_str2q.find(iter->first) == ctrl_str2q.end()) {
fprintf(stderr, "unknown control '%s'\n", iter->first.c_str());
- exit(1);
+ std::exit(EXIT_FAILURE);
}
}
}
@@ -806,11 +806,11 @@ void common_cmd(const std::string &media_bus_info, int ch, char *optarg)
while (*subs != '\0') {
if (parse_next_subopt(&subs, &value)) {
common_usage();
- exit(1);
+ std::exit(EXIT_FAILURE);
}
if (strchr(value, '=')) {
common_usage();
- exit(1);
+ std::exit(EXIT_FAILURE);
}
else {
get_ctrls.push_back(value);
@@ -822,21 +822,21 @@ void common_cmd(const std::string &media_bus_info, int ch, char *optarg)
while (*subs != '\0') {
if (parse_next_subopt(&subs, &value)) {
common_usage();
- exit(1);
+ std::exit(EXIT_FAILURE);
}
if (const char *equal = strchr(value, '=')) {
set_ctrls[std::string(value, (equal - value))] = equal + 1;
}
else {
fprintf(stderr, "control '%s' without '='\n", value);
- exit(1);
+ std::exit(EXIT_FAILURE);
}
}
break;
case OptSubset:
if (parse_subset(optarg)) {
common_usage();
- exit(1);
+ std::exit(EXIT_FAILURE);
}
break;
case OptSetPriority:
diff --git a/utils/v4l2-ctl/v4l2-ctl-edid.cpp b/utils/v4l2-ctl/v4l2-ctl-edid.cpp
index 9c7c6bc4..a2df6089 100644
--- a/utils/v4l2-ctl/v4l2-ctl-edid.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-edid.cpp
@@ -233,7 +233,7 @@ static void edid_add_block(struct v4l2_edid *e)
fprintf(stderr, "edid file error: too long\n");
free(e->edid);
e->edid = NULL;
- exit(1);
+ std::exit(EXIT_FAILURE);
}
e->edid = static_cast<unsigned char *>(realloc(e->edid, e->blocks * 128));
}
@@ -986,13 +986,13 @@ void edid_cmd(int ch, char *optarg)
if (opt == -1) {
fprintf(stderr, "Invalid suboptions specified\n");
edid_usage();
- exit(1);
+ std::exit(EXIT_FAILURE);
}
if (value == NULL && opt <= 8) {
fprintf(stderr, "No value given to suboption <%s>\n",
subopts[opt]);
edid_usage();
- exit(1);
+ std::exit(EXIT_FAILURE);
}
switch (opt) {
case 0:
@@ -1020,11 +1020,11 @@ void edid_cmd(int ch, char *optarg)
sedid.blocks = sizeof(hdmi_edid) / 128;
} else {
edid_usage();
- exit(1);
+ std::exit(EXIT_FAILURE);
}
if (file_in) {
fprintf(stderr, "The edid and file options can't be used together.\n");
- exit(1);
+ std::exit(EXIT_FAILURE);
}
break;
case 3:
@@ -1032,7 +1032,7 @@ void edid_cmd(int ch, char *optarg)
file_in = value;
if (sedid.edid) {
fprintf(stderr, "The edid and file options can't be used together.\n");
- exit(1);
+ std::exit(EXIT_FAILURE);
}
}
break;
@@ -1043,7 +1043,7 @@ void edid_cmd(int ch, char *optarg)
sformat = RAW;
} else {
edid_usage();
- exit(1);
+ std::exit(EXIT_FAILURE);
}
break;
case 5:
@@ -1109,7 +1109,7 @@ void edid_cmd(int ch, char *optarg)
case 56: toggle_speaker3_flags |= SPEAKER3_TPLS_TPRS; break;
default:
edid_usage();
- exit(1);
+ std::exit(EXIT_FAILURE);
}
}
break;
@@ -1145,7 +1145,7 @@ void edid_cmd(int ch, char *optarg)
gedid.start_block = strtoul(value, 0, 0);
if (gedid.start_block > 255) {
fprintf(stderr, "startblock %d too large, max 255\n", gedid.start_block);
- exit(1);
+ std::exit(EXIT_FAILURE);
}
break;
case 2:
@@ -1160,7 +1160,7 @@ void edid_cmd(int ch, char *optarg)
gformat = CARRAY;
} else {
edid_usage();
- exit(1);
+ std::exit(EXIT_FAILURE);
}
break;
case 4:
@@ -1169,7 +1169,7 @@ void edid_cmd(int ch, char *optarg)
break;
default:
edid_usage();
- exit(1);
+ std::exit(EXIT_FAILURE);
}
}
if (gedid.start_block + gedid.blocks > 256)
@@ -1209,7 +1209,7 @@ void edid_set(cv4l_fd &_fd)
if (!fin) {
fprintf(stderr, "Failed to open %s: %s\n", file_in,
strerror(errno));
- exit(1);
+ std::exit(EXIT_FAILURE);
}
}
if (fin) {
@@ -1217,7 +1217,7 @@ void edid_set(cv4l_fd &_fd)
if (sedid.blocks == 0) {
fprintf(stderr, "%s contained an empty EDID, ignoring.\n",
file_in ? file_in : "stdin");
- exit(1);
+ std::exit(EXIT_FAILURE);
}
}
if (toggle_cta861_hdr_flags || phys_addr >= 0) {
@@ -1329,7 +1329,7 @@ void edid_get(cv4l_fd &_fd)
if (!fout) {
fprintf(stderr, "Failed to open %s: %s\n", file_out,
strerror(errno));
- exit(1);
+ std::exit(EXIT_FAILURE);
}
}
gedid.edid = static_cast<unsigned char *>(malloc(gedid.blocks * 128));
diff --git a/utils/v4l2-ctl/v4l2-ctl-meta.cpp b/utils/v4l2-ctl/v4l2-ctl-meta.cpp
index 76d4b1dd..2561b029 100644
--- a/utils/v4l2-ctl/v4l2-ctl-meta.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-meta.cpp
@@ -49,7 +49,7 @@ void meta_cmd(int ch, char *optarg)
case OptTryMetaOutFormat:
if (strlen(optarg) == 0) {
meta_usage();
- exit(1);
+ std::exit(EXIT_FAILURE);
} else if (strlen(optarg) == 4) {
vfmt.fmt.meta.dataformat = v4l2_fourcc(optarg[0],
optarg[1], optarg[2], optarg[3]);
diff --git a/utils/v4l2-ctl/v4l2-ctl-misc.cpp b/utils/v4l2-ctl/v4l2-ctl-misc.cpp
index b038cfe9..6db87568 100644
--- a/utils/v4l2-ctl/v4l2-ctl-misc.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-misc.cpp
@@ -230,7 +230,7 @@ void misc_cmd(int ch, char *optarg)
default:
if (opt < 0 || opt > 15) {
misc_usage();
- exit(1);
+ std::exit(EXIT_FAILURE);
}
len = strlen(value);
if (len > sizeof(jpegcomp.APP_data) - 1)
@@ -266,7 +266,7 @@ void misc_cmd(int ch, char *optarg)
break;
default:
misc_usage();
- exit(1);
+ std::exit(EXIT_FAILURE);
}
}
break;
@@ -304,7 +304,7 @@ void misc_cmd(int ch, char *optarg)
break;
default:
misc_usage();
- exit(1);
+ std::exit(EXIT_FAILURE);
}
}
break;
diff --git a/utils/v4l2-ctl/v4l2-ctl-sdr.cpp b/utils/v4l2-ctl/v4l2-ctl-sdr.cpp
index 0b7c4cdc..62b26f0c 100644
--- a/utils/v4l2-ctl/v4l2-ctl-sdr.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-sdr.cpp
@@ -52,7 +52,7 @@ void sdr_cmd(int ch, char *optarg)
case OptTrySdrOutFormat:
if (strlen(optarg) == 0) {
sdr_usage();
- exit(1);
+ std::exit(EXIT_FAILURE);
} else if (strlen(optarg) == 4) {
vfmt.fmt.sdr.pixelformat = v4l2_fourcc(optarg[0],
optarg[1], optarg[2], optarg[3]);
diff --git a/utils/v4l2-ctl/v4l2-ctl-selection.cpp b/utils/v4l2-ctl/v4l2-ctl-selection.cpp
index ac5a1d7b..be62eb03 100644
--- a/utils/v4l2-ctl/v4l2-ctl-selection.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-selection.cpp
@@ -136,7 +136,7 @@ static void parse_crop(char *optarg, unsigned int &set_crop, v4l2_rect &vcrop)
break;
default:
selection_usage();
- exit(1);
+ std::exit(EXIT_FAILURE);
}
}
}
@@ -184,7 +184,7 @@ static int parse_selection(char *optarg, unsigned int &set_sel, v4l2_selection &
if (parse_selection_target(value, vsel.target)) {
fprintf(stderr, "Unknown selection target\n");
selection_usage();
- exit(1);
+ std::exit(EXIT_FAILURE);
}
break;
case 1:
@@ -210,7 +210,7 @@ static int parse_selection(char *optarg, unsigned int &set_sel, v4l2_selection &
default:
fprintf(stderr, "Unknown option\n");
selection_usage();
- exit(1);
+ std::exit(EXIT_FAILURE);
}
}
@@ -262,7 +262,7 @@ void selection_cmd(int ch, char *optarg)
if (parse_selection(optarg, get_sel, gsel)) {
fprintf(stderr, "Unknown selection target\n");
selection_usage();
- exit(1);
+ std::exit(EXIT_FAILURE);
}
get_sel_target = gsel.target;
break;
diff --git a/utils/v4l2-ctl/v4l2-ctl-stds.cpp b/utils/v4l2-ctl/v4l2-ctl-stds.cpp
index 62f57a44..8dd06c43 100644
--- a/utils/v4l2-ctl/v4l2-ctl-stds.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-stds.cpp
@@ -102,7 +102,7 @@ static v4l2_std_id parse_pal(const char *pal)
}
fprintf(stderr, "pal specifier not recognised\n");
stds_usage();
- exit(1);
+ std::exit(EXIT_FAILURE);
}
static v4l2_std_id parse_secam(const char *secam)
@@ -124,7 +124,7 @@ static v4l2_std_id parse_secam(const char *secam)
}
fprintf(stderr, "secam specifier not recognised\n");
stds_usage();
- exit(1);
+ std::exit(EXIT_FAILURE);
}
static v4l2_std_id parse_ntsc(const char *ntsc)
@@ -141,7 +141,7 @@ static v4l2_std_id parse_ntsc(const char *ntsc)
}
fprintf(stderr, "ntsc specifier not recognised\n");
stds_usage();
- exit(1);
+ std::exit(EXIT_FAILURE);
}
enum timing_opts {
@@ -204,13 +204,13 @@ static int parse_timing_subopt(char **subopt_str, int *value)
if (opt == -1) {
fprintf(stderr, "Invalid suboptions specified\n");
stds_usage();
- exit(1);
+ std::exit(EXIT_FAILURE);
}
if (opt_str == NULL && opt != CVT && opt != GTF && opt != CLEAR) {
fprintf(stderr, "No value given to suboption <%s>\n",
subopt_list[opt]);
stds_usage();
- exit(1);
+ std::exit(EXIT_FAILURE);
}
if (opt_str)
@@ -269,7 +269,7 @@ static void get_cvt_gtf_timings(char *subopt, int standard,
if (!timings_valid) {
stds_usage();
- exit(1);
+ std::exit(EXIT_FAILURE);
}
}
@@ -356,7 +356,7 @@ static void parse_dv_bt_timings(char *optarg, struct v4l2_dv_timings *dv_timings
break;
default:
stds_usage();
- exit(1);
+ std::exit(EXIT_FAILURE);
}
set_dv_timing_opts |= 1 << opt;
}
@@ -464,7 +464,7 @@ void stds_cmd(int ch, char *optarg)
} else {
fprintf(stderr, "Unknown standard '%s'\n", optarg);
stds_usage();
- exit(1);
+ std::exit(EXIT_FAILURE);
}
break;
case OptSetDvBtTimings:
diff --git a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
index a4cdc4bd..95ffe986 100644
--- a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
@@ -1677,12 +1677,12 @@ static FILE *open_output_file(cv4l_fd &fd)
host_fd_to = socket(AF_INET, SOCK_STREAM, 0);
if (host_fd_to < 0) {
fprintf(stderr, "cannot open socket");
- exit(0);
+ std::exit(EXIT_SUCCESS);
}
server = gethostbyname(host_to);
if (server == NULL) {
fprintf(stderr, "no such host %s\n", host_to);
- exit(0);
+ std::exit(EXIT_SUCCESS);
}
memset(reinterpret_cast<char *>(&serv_addr), 0, sizeof(serv_addr));
serv_addr.sin_family = AF_INET;
@@ -1692,7 +1692,7 @@ static FILE *open_output_file(cv4l_fd &fd)
serv_addr.sin_port = htons(host_port_to);
if (connect(host_fd_to, reinterpret_cast<struct sockaddr *>(&serv_addr), sizeof(serv_addr)) < 0) {
fprintf(stderr, "could not connect\n");
- exit(0);
+ std::exit(EXIT_SUCCESS);
}
fout = fdopen(host_fd_to, "a");
write_u32(fout, V4L_STREAM_ID);
@@ -1937,30 +1937,30 @@ static FILE *open_input_file(cv4l_fd &fd, __u32 type)
listen_fd = socket(AF_INET, SOCK_STREAM, 0);
if (listen_fd < 0) {
fprintf(stderr, "could not opening socket\n");
- exit(1);
+ std::exit(EXIT_FAILURE);
}
serv_addr.sin_family = AF_INET;
serv_addr.sin_addr.s_addr = INADDR_ANY;
serv_addr.sin_port = htons(host_port_from);
if (bind(listen_fd, reinterpret_cast<struct sockaddr *>(&serv_addr), sizeof(serv_addr)) < 0) {
fprintf(stderr, "could not bind\n");
- exit(1);
+ std::exit(EXIT_FAILURE);
}
listen(listen_fd, 1);
clilen = sizeof(cli_addr);
host_fd_from = accept(listen_fd, reinterpret_cast<struct sockaddr *>(&cli_addr), &clilen);
if (host_fd_from < 0) {
fprintf(stderr, "could not accept\n");
- exit(1);
+ std::exit(EXIT_FAILURE);
}
fin = fdopen(host_fd_from, "r");
if (read_u32(fin) != V4L_STREAM_ID) {
fprintf(stderr, "unknown protocol ID\n");
- exit(1);
+ std::exit(EXIT_FAILURE);
}
if (read_u32(fin) != V4L_STREAM_VERSION) {
fprintf(stderr, "unknown protocol version\n");
- exit(1);
+ std::exit(EXIT_FAILURE);
}
for (;;) {
__u32 packet = read_u32(fin);
@@ -1968,7 +1968,7 @@ static FILE *open_input_file(cv4l_fd &fd, __u32 type)
if (packet == V4L_STREAM_PACKET_END) {
fprintf(stderr, "END packet read\n");
- exit(1);
+ std::exit(EXIT_FAILURE);
}
if (packet == V4L_STREAM_PACKET_FMT_VIDEO)
@@ -1982,7 +1982,7 @@ static FILE *open_input_file(cv4l_fd &fd, __u32 type)
n = fread(buf, 1, rdsize, fin);
if (n < 0) {
fprintf(stderr, "error reading %d bytes\n", sz);
- exit(1);
+ std::exit(EXIT_FAILURE);
}
sz -= n;
}
@@ -1995,7 +1995,7 @@ static FILE *open_input_file(cv4l_fd &fd, __u32 type)
if (sz != V4L_STREAM_PACKET_FMT_VIDEO_SIZE_FMT) {
fprintf(stderr, "unsupported FMT_VIDEO size\n");
- exit(1);
+ std::exit(EXIT_FAILURE);
}
cfmt.s_num_planes(read_u32(fin));
cfmt.s_pixelformat(read_u32(fin));
@@ -2023,7 +2023,7 @@ static FILE *open_input_file(cv4l_fd &fd, __u32 type)
if (sz != V4L_STREAM_PACKET_FMT_VIDEO_SIZE_FMT_PLANE) {
fprintf(stderr, "unsupported FMT_VIDEO plane size\n");
- exit(1);
+ std::exit(EXIT_FAILURE);
}
cfmt.s_sizeimage(read_u32(fin), i);
cfmt.s_bytesperline(read_u32(fin), i);
@@ -2031,7 +2031,7 @@ static FILE *open_input_file(cv4l_fd &fd, __u32 type)
}
if (fd.s_fmt(cfmt)) {
fprintf(stderr, "failed to set new format\n");
- exit(1);
+ std::exit(EXIT_FAILURE);
}
return fin;
}
diff --git a/utils/v4l2-ctl/v4l2-ctl-subdev.cpp b/utils/v4l2-ctl/v4l2-ctl-subdev.cpp
index 5bd5f57e..9e17a58d 100644
--- a/utils/v4l2-ctl/v4l2-ctl-subdev.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-subdev.cpp
@@ -128,7 +128,7 @@ void subdev_cmd(int ch, char *optarg)
break;
default:
subdev_usage();
- exit(1);
+ std::exit(EXIT_FAILURE);
}
}
break;
@@ -158,7 +158,7 @@ void subdev_cmd(int ch, char *optarg)
break;
default:
subdev_usage();
- exit(1);
+ std::exit(EXIT_FAILURE);
}
}
break;
@@ -184,13 +184,13 @@ void subdev_cmd(int ch, char *optarg)
if (parse_selection_target(value, target)) {
fprintf(stderr, "Unknown selection target\n");
subdev_usage();
- exit(1);
+ std::exit(EXIT_FAILURE);
}
get_sel_target = target;
break;
default:
subdev_usage();
- exit(1);
+ std::exit(EXIT_FAILURE);
}
}
break;
@@ -263,7 +263,7 @@ void subdev_cmd(int ch, char *optarg)
default:
fprintf(stderr, "Unknown option\n");
subdev_usage();
- exit(1);
+ std::exit(EXIT_FAILURE);
}
}
break;
@@ -288,7 +288,7 @@ void subdev_cmd(int ch, char *optarg)
if (parse_selection_target(value, vsel.target)) {
fprintf(stderr, "Unknown selection target\n");
subdev_usage();
- exit(1);
+ std::exit(EXIT_FAILURE);
}
break;
case 1:
@@ -317,7 +317,7 @@ void subdev_cmd(int ch, char *optarg)
default:
fprintf(stderr, "Unknown option\n");
subdev_usage();
- exit(1);
+ std::exit(EXIT_FAILURE);
}
}
break;
@@ -341,7 +341,7 @@ void subdev_cmd(int ch, char *optarg)
default:
fprintf(stderr, "Unknown option\n");
subdev_usage();
- exit(1);
+ std::exit(EXIT_FAILURE);
}
}
break;
@@ -484,7 +484,7 @@ void subdev_set(cv4l_fd &_fd)
if (set_fps <= 0) {
fprintf(stderr, "invalid fps %f\n", set_fps);
subdev_usage();
- exit(1);
+ std::exit(EXIT_FAILURE);
}
fival.interval.numerator = 1000;
fival.interval.denominator = static_cast<uint32_t>(set_fps * fival.interval.numerator);
diff --git a/utils/v4l2-ctl/v4l2-ctl-tuner.cpp b/utils/v4l2-ctl/v4l2-ctl-tuner.cpp
index 73dc323c..981b8765 100644
--- a/utils/v4l2-ctl/v4l2-ctl-tuner.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-tuner.cpp
@@ -198,7 +198,7 @@ static void parse_freq_seek(char *optarg, struct v4l2_hw_freq_seek &seek)
break;
default:
tuner_usage();
- exit(1);
+ std::exit(EXIT_FAILURE);
}
}
}
@@ -223,7 +223,7 @@ void tuner_cmd(int ch, char *optarg)
else {
fprintf(stderr, "Unknown audio mode\n");
tuner_usage();
- exit(1);
+ std::exit(EXIT_FAILURE);
}
break;
case OptSetModulator:
@@ -245,7 +245,7 @@ void tuner_cmd(int ch, char *optarg)
else {
fprintf(stderr, "Unknown txsubchans value\n");
tuner_usage();
- exit(1);
+ std::exit(EXIT_FAILURE);
}
break;
case OptFreqSeek:
diff --git a/utils/v4l2-ctl/v4l2-ctl-vbi.cpp b/utils/v4l2-ctl/v4l2-ctl-vbi.cpp
index 987fae25..6a4f627f 100644
--- a/utils/v4l2-ctl/v4l2-ctl-vbi.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-vbi.cpp
@@ -95,7 +95,7 @@ void vbi_cmd(int ch, char *optarg)
if (optarg[0] == 0) {
fprintf(stderr, "empty string\n");
vbi_usage();
- exit(1);
+ std::exit(EXIT_FAILURE);
}
while (*optarg) {
subs = strchr(optarg, ',');
@@ -125,7 +125,7 @@ void vbi_cmd(int ch, char *optarg)
if (found_off && sliced->fmt.sliced.service_set) {
fprintf(stderr, "Sliced VBI mode 'off' cannot be combined with other modes\n");
vbi_usage();
- exit(1);
+ std::exit(EXIT_FAILURE);
}
break;
case OptSetVbiOutFormat:
diff --git a/utils/v4l2-ctl/v4l2-ctl-vidcap.cpp b/utils/v4l2-ctl/v4l2-ctl-vidcap.cpp
index 49c20200..6e920c1d 100644
--- a/utils/v4l2-ctl/v4l2-ctl-vidcap.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-vidcap.cpp
@@ -113,7 +113,7 @@ void vidcap_cmd(int ch, char *optarg)
if (!set_fmts ||
(set_fmts & (FmtColorspace | FmtYCbCr | FmtQuantization | FmtXferFunc))) {
vidcap_usage();
- exit(1);
+ std::exit(EXIT_FAILURE);
}
break;
case OptListFrameSizes:
@@ -127,7 +127,7 @@ void vidcap_cmd(int ch, char *optarg)
frmsize.pixel_format = strtol(optarg, 0L, 0);
} else {
fprintf(stderr, "The pixelformat '%s' is invalid\n", optarg);
- exit(1);
+ std::exit(EXIT_FAILURE);
}
break;
case OptListFrameIntervals:
@@ -159,12 +159,12 @@ void vidcap_cmd(int ch, char *optarg)
frmival.pixel_format = strtol(value, 0L, 0);
} else {
fprintf(stderr, "The pixelformat '%s' is invalid\n", optarg);
- exit(1);
+ std::exit(EXIT_FAILURE);
}
break;
default:
vidcap_usage();
- exit(1);
+ std::exit(EXIT_FAILURE);
}
}
break;
@@ -317,14 +317,14 @@ void vidcap_list(cv4l_fd &fd)
false, is_multiplanar);
if (!frmsize.pixel_format) {
fprintf(stderr, "The pixelformat index was invalid\n");
- exit(1);
+ std::exit(EXIT_FAILURE);
}
}
if (!valid_pixel_format(fd.g_fd(), frmsize.pixel_format, false, is_multiplanar) &&
!valid_pixel_format(fd.g_fd(), frmsize.pixel_format, true, is_multiplanar)) {
fprintf(stderr, "The pixelformat '%s' is invalid\n",
fcc2s(frmsize.pixel_format).c_str());
- exit(1);
+ std::exit(EXIT_FAILURE);
}
printf("ioctl: VIDIOC_ENUM_FRAMESIZES\n");
@@ -342,13 +342,13 @@ void vidcap_list(cv4l_fd &fd)
false, is_multiplanar);
if (!frmival.pixel_format) {
fprintf(stderr, "The pixelformat index was invalid\n");
- exit(1);
+ std::exit(EXIT_FAILURE);
}
}
if (!valid_pixel_format(fd.g_fd(), frmival.pixel_format, false, is_multiplanar)) {
fprintf(stderr, "The pixelformat '%s' is invalid\n",
fcc2s(frmival.pixel_format).c_str());
- exit(1);
+ std::exit(EXIT_FAILURE);
}
printf("ioctl: VIDIOC_ENUM_FRAMEINTERVALS\n");
diff --git a/utils/v4l2-ctl/v4l2-ctl-vidout.cpp b/utils/v4l2-ctl/v4l2-ctl-vidout.cpp
index 955b2c50..e3cb4bcb 100644
--- a/utils/v4l2-ctl/v4l2-ctl-vidout.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-vidout.cpp
@@ -99,7 +99,7 @@ void vidout_cmd(int ch, char *optarg)
sizeimage);
if (!set_fmts_out) {
vidcap_usage();
- exit(1);
+ std::exit(EXIT_FAILURE);
}
break;
}
@@ -202,7 +202,7 @@ void vidout_set(cv4l_fd &_fd)
fcc2s(pixfmt).c_str());
else
fprintf(stderr, "The pixelformat index was invalid\n");
- exit(1);
+ std::exit(EXIT_FAILURE);
}
if (options[OptSetVideoOutFormat])
diff --git a/utils/v4l2-ctl/v4l2-ctl.cpp b/utils/v4l2-ctl/v4l2-ctl.cpp
index f6e90f51..f8187fea 100644
--- a/utils/v4l2-ctl/v4l2-ctl.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl.cpp
@@ -795,7 +795,7 @@ int parse_fmt(char *optarg, __u32 &width, __u32 &height, __u32 &pixelformat,
pixelformat = strtol(value, 0L, 0);
} else {
fprintf(stderr, "The pixelformat '%s' is invalid\n", value);
- exit(1);
+ std::exit(EXIT_FAILURE);
}
fmts |= FmtPixelFormat;
break;
@@ -931,7 +931,7 @@ static __u32 parse_event(const char *e, const char **name)
if (event == V4L2_EVENT_CTRL) {
fprintf(stderr, "Missing control name for ctrl event, use ctrl=<name>\n");
misc_usage();
- exit(1);
+ std::exit(EXIT_FAILURE);
}
} else if (!strcmp(e, "eos")) {
event = V4L2_EVENT_EOS;
@@ -954,7 +954,7 @@ static __u32 parse_event(const char *e, const char **name)
if (event == 0) {
fprintf(stderr, "Unknown event\n");
misc_usage();
- exit(1);
+ std::exit(EXIT_FAILURE);
}
return event;
}
@@ -1288,7 +1288,7 @@ int main(int argc, char **argv)
if (type == MEDIA_TYPE_CANT_STAT) {
fprintf(stderr, "Cannot open device %s, exiting.\n",
device);
- exit(1);
+ std::exit(EXIT_FAILURE);
}
switch (type) {
@@ -1308,7 +1308,7 @@ int main(int argc, char **argv)
if (type == MEDIA_TYPE_UNKNOWN) {
fprintf(stderr, "Unable to detect what device %s is, exiting.\n",
device);
- exit(1);
+ std::exit(EXIT_FAILURE);
}
is_subdev = type == MEDIA_TYPE_SUBDEV;
if (is_subdev)
@@ -1325,14 +1325,14 @@ int main(int argc, char **argv)
if (fd < 0) {
fprintf(stderr, "Failed to open %s: %s\n", device,
strerror(errno));
- exit(1);
+ std::exit(EXIT_FAILURE);
}
verbose = options[OptVerbose];
c_fd.s_trace(options[OptSilent] ? 0 : (verbose ? 2 : 1));
if (!is_subdev && doioctl(fd, VIDIOC_QUERYCAP, &vcap)) {
fprintf(stderr, "%s: not a v4l2 node\n", device);
- exit(1);
+ std::exit(EXIT_FAILURE);
}
capabilities = vcap.capabilities;
if (capabilities & V4L2_CAP_DEVICE_CAPS)
@@ -1356,12 +1356,12 @@ int main(int argc, char **argv)
if (out_fd < 0) {
fprintf(stderr, "Failed to open %s: %s\n", out_device,
strerror(errno));
- exit(1);
+ std::exit(EXIT_FAILURE);
}
c_out_fd.s_trace(options[OptSilent] ? 0 : (verbose ? 2 : 1));
if (doioctl(out_fd, VIDIOC_QUERYCAP, &vcap)) {
fprintf(stderr, "%s: not a v4l2 node\n", out_device);
- exit(1);
+ std::exit(EXIT_FAILURE);
}
out_capabilities = vcap.capabilities;
if (out_capabilities & V4L2_CAP_DEVICE_CAPS)
@@ -1375,12 +1375,12 @@ int main(int argc, char **argv)
if (exp_fd < 0) {
fprintf(stderr, "Failed to open %s: %s\n", export_device,
strerror(errno));
- exit(1);
+ std::exit(EXIT_FAILURE);
}
c_exp_fd.s_trace(options[OptSilent] ? 0 : (verbose ? 2 : 1));
if (doioctl(exp_fd, VIDIOC_QUERYCAP, &vcap)) {
fprintf(stderr, "%s: not a v4l2 node\n", export_device);
- exit(1);
+ std::exit(EXIT_FAILURE);
}
}
@@ -1389,17 +1389,17 @@ int main(int argc, char **argv)
if (wait_for_event == V4L2_EVENT_CTRL && wait_event_id)
if (!common_find_ctrl_id(wait_event_id)) {
fprintf(stderr, "unknown control '%s'\n", wait_event_id);
- exit(1);
+ std::exit(EXIT_FAILURE);
}
if (poll_for_event == V4L2_EVENT_CTRL && poll_event_id)
if (!common_find_ctrl_id(poll_event_id)) {
fprintf(stderr, "unknown control '%s'\n", poll_event_id);
- exit(1);
+ std::exit(EXIT_FAILURE);
}
if (epoll_for_event == V4L2_EVENT_CTRL && epoll_event_id)
if (!common_find_ctrl_id(epoll_event_id)) {
fprintf(stderr, "unknown control '%s'\n", epoll_event_id);
- exit(1);
+ std::exit(EXIT_FAILURE);
}
if (options[OptAll]) {
@@ -1610,5 +1610,5 @@ int main(int argc, char **argv)
// --all sets --silent to avoid ioctl errors to be shown when an ioctl
// is not implemented by the driver. Which is fine, but we shouldn't
// return an application error in that specific case.
- exit(options[OptAll] ? 0 : app_result);
+ std::exit(options[OptAll] ? 0 : app_result);
}

Privacy Policy