cleanup: use fprintf to stderr for error exits from option parser

This commit is contained in:
F. Duncanh
2023-01-15 15:42:59 -05:00
parent a7445da3e6
commit 1db45e2950

View File

@@ -542,7 +542,7 @@ static void append_hostname(std::string &server_name) {
#endif #endif
} }
static void parse_arguments (int argc, char *argv[]) { static void parse_arguments (int argc, char *argv[]) {
// Parse arguments // Parse arguments
for (int i = 1; i < argc; i++) { for (int i = 1; i < argc; i++) {
std::string arg(argv[i]); std::string arg(argv[i]);
@@ -647,14 +647,14 @@ static void parse_arguments (int argc, char *argv[]) {
video_converter = "videoconvert"; video_converter = "videoconvert";
} else if (arg == "-v4l2" || arg == "-rpi") { } else if (arg == "-v4l2" || arg == "-rpi") {
if (arg == "-rpi") { if (arg == "-rpi") {
printf("*** -rpi no longer includes -bt709: add it if needed\n"); LOGI("*** -rpi no longer includes -bt709: add it if needed");
} }
video_decoder.erase(); video_decoder.erase();
video_decoder = "v4l2h264dec"; video_decoder = "v4l2h264dec";
video_converter.erase(); video_converter.erase();
video_converter = "v4l2convert"; video_converter = "v4l2convert";
} else if (arg == "-rpifb") { } else if (arg == "-rpifb") {
printf("*** -rpifb no longer includes -bt709: add it if needed\n"); LOGI("*** -rpifb no longer includes -bt709: add it if needed");
video_decoder.erase(); video_decoder.erase();
video_decoder = "v4l2h264dec"; video_decoder = "v4l2h264dec";
video_converter.erase(); video_converter.erase();
@@ -662,7 +662,7 @@ static void parse_arguments (int argc, char *argv[]) {
videosink.erase(); videosink.erase();
videosink = "kmssink"; videosink = "kmssink";
} else if (arg == "-rpigl") { } else if (arg == "-rpigl") {
printf("*** -rpigl does not include -bt709: add it if needed\n"); LOGI("*** -rpigl does not include -bt709: add it if needed");
video_decoder.erase(); video_decoder.erase();
video_decoder = "v4l2h264dec"; video_decoder = "v4l2h264dec";
video_converter.erase(); video_converter.erase();
@@ -670,7 +670,7 @@ static void parse_arguments (int argc, char *argv[]) {
videosink.erase(); videosink.erase();
videosink = "glimagesink"; videosink = "glimagesink";
} else if (arg == "-rpiwl" ) { } else if (arg == "-rpiwl" ) {
printf("*** -rpiwl no longer includes -bt709: add it if needed\n"); LOGI("*** -rpiwl no longer includes -bt709: add it if needed");
video_decoder.erase(); video_decoder.erase();
video_decoder = "v4l2h264dec"; video_decoder = "v4l2h264dec";
video_converter.erase(); video_converter.erase();
@@ -730,7 +730,7 @@ static void parse_arguments (int argc, char *argv[]) {
coverart_filename.erase(); coverart_filename.erase();
coverart_filename.append(argv[++i]); coverart_filename.append(argv[++i]);
} else { } else {
LOGE("option -ca must be followed by a filename for cover-art output"); fprintf(stderr,"option -ca must be followed by a filename for cover-art output\n");
exit(1); exit(1);
} }
} else if (arg == "-bt709") { } else if (arg == "-bt709") {
@@ -753,11 +753,11 @@ static void parse_arguments (int argc, char *argv[]) {
continue; continue;
} }
} }
LOGE("invalid argument -ao %s: must be a decimal time offset in seconds, range [0,10]\n" fprintf(stderr, "invalid argument -ao %s: must be a decimal time offset in seconds, range [0,10]\n"
"(like 5 or 4.8, which will be converted to a whole number of milliseconds)", argv[i]); "(like 5 or 4.8, which will be converted to a whole number of milliseconds)\n", argv[i]);
exit(1); exit(1);
} else { } else {
LOGE("unknown option %s, stopping\n",argv[i]); fprintf(stderr, "unknown option %s, stopping\n",argv[i]);
exit(1); exit(1);
} }
} }