video-infos can now print a title

This commit is contained in:
tth 2019-08-15 12:06:21 +02:00
parent 4aaed6f322
commit c3852b4dee

View File

@ -232,35 +232,51 @@ fprintf(stderr, "%s not implemented\n", __func__);
return -1;
}
/* --------------------------------------------------------------------- */
void help(int k)
static void help(int k)
{
puts("Options :");
puts("\t-d\tselect the video device");
puts("\t-K\tset the K parameter");
puts("\t-l\tlist video devices");
puts("\t-v\tincrease verbosity");
puts("\t-d\t\tselect the video device");
puts("\t-K\t\tset the K parameter");
puts("\t-l\t\tlist video devices");
puts("\t-T bla\t\tadd a title");
puts("\t-v\t\tincrease verbosity");
exit(0);
}
/* --------------------------------------------------------------------- */
static void print_title(char *txt)
{
int foo, l;
l = strlen(txt);
for (foo=0; foo<l+18; foo++) putchar('*'); puts("");
printf("****** %s ******\n", txt);
for (foo=0; foo<l+18; foo++) putchar('*'); puts("\n");
}
/* --------------------------------------------------------------------- */
int main(int argc, char *argv[])
{
int foo, opt;
char *device = "/dev/video0";
char *title = NULL;
int K = 0;
while ((opt = getopt(argc, argv, "d:hK:lv")) != -1) {
while ((opt = getopt(argc, argv, "d:hK:lT:v")) != -1) {
switch(opt) {
case 'd': device = optarg; break;
case 'h': help(0); break;
case 'K': K = atol(optarg); break;
case 'l': liste_des_devices(0); break;
case 'T': title = optarg; break;
case 'v': verbosity++; break;
}
}
if (NULL != title) {
print_title(title);
}
foo = show_webcam_infos(device, "", K);
fprintf(stderr, "\n\tshow_webcam_infos -> %d\n", foo);