diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2006-06-25 15:24:54 +0200 |
---|---|---|
committer | Hans Verkuil <hverkuil@xs4all.nl> | 2006-06-25 15:24:54 +0200 |
commit | a1cf4a48bee5bcd7550da4e256a449ff88ec38b6 (patch) | |
tree | 1d6afb4263ee244e4b720fa6e264d27f8fd587d9 /test/v4l2-ctl.cpp | |
parent | 84a9d921f79d9aee2d650c4f18acea2111ad7e2d (diff) | |
download | mediapointer-dvb-s2-a1cf4a48bee5bcd7550da4e256a449ff88ec38b6.tar.gz mediapointer-dvb-s2-a1cf4a48bee5bcd7550da4e256a449ff88ec38b6.tar.bz2 |
Print TV standards in human-readable form
From: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Diffstat (limited to 'test/v4l2-ctl.cpp')
-rw-r--r-- | test/v4l2-ctl.cpp | 51 |
1 files changed, 50 insertions, 1 deletions
diff --git a/test/v4l2-ctl.cpp b/test/v4l2-ctl.cpp index a9604e650..9604dcc96 100644 --- a/test/v4l2-ctl.cpp +++ b/test/v4l2-ctl.cpp @@ -640,6 +640,24 @@ static void parse_next_subopt(char **subs, char **value) } } +static void print_std(const char *prefix, const char *stds[], unsigned long long std) +{ + int first = 1; + + printf("\t%s-", prefix); + while (*stds) { + if (std & 1) { + if (!first) + printf("/"); + first = 0; + printf("%s", *stds); + } + stds++; + std >>= 1; + } + printf("\n"); +} + int main(int argc, char **argv) { char *value, *subs; @@ -1130,8 +1148,39 @@ int main(int argc, char **argv) } if (options[OptGetStandard]) { - if (doioctl(fd, VIDIOC_G_STD, &std, "VIDIOC_G_STD") == 0) + if (doioctl(fd, VIDIOC_G_STD, &std, "VIDIOC_G_STD") == 0) { + static const char *pal[] = { + "B", "B1", "G", "H", "I", "D", "D1", "K", + "M", "N", "Nc", "60", + NULL + }; + static const char *ntsc[] = { + "M", "M-JP", "443", "M-KR", + NULL + }; + static const char *secam[] = { + "B", "D", "G", "H", "K", "K1", "L", "Lc", + NULL + }; + static const char *atsc[] = { + "ATSC-8-VSB", "ATSC-16-VSB", + NULL + }; + printf("Video standard = 0x%08llx\n", (unsigned long long)std); + if (std & 0xfff) { + print_std("PAL", pal, std); + } + if (std & 0xf000) { + print_std("NTSC", ntsc, std >> 12); + } + if (std & 0xff0000) { + print_std("SECAM", secam, std >> 16); + } + if (std & 0xf000000) { + print_std("ATSC/HDTV", atsc, std >> 24); + } + } } if (options[OptListCtrlsMenus]) { |