forked from tTh/FloatImg
video-infos : more informations displayed
This commit is contained in:
parent
991308f5b2
commit
4e687db723
@ -3,7 +3,7 @@
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <linux/videodev2.h>
|
||||
|
||||
#include "v4l2_pr_structs.h"
|
||||
@ -27,17 +27,87 @@ switch(type) {
|
||||
return "???";
|
||||
}
|
||||
/* --------------------------------------------------------------------- */
|
||||
static void pr_capabilities(uint32_t caps)
|
||||
{
|
||||
fputs(" ", FP);
|
||||
|
||||
if (caps & V4L2_CAP_VIDEO_CAPTURE) fputs("vcapt ", FP);
|
||||
if (caps & V4L2_CAP_VIDEO_OUTPUT) fputs("vout ", FP);
|
||||
if (caps & V4L2_CAP_VIDEO_OVERLAY) fputs("overlay ", FP);
|
||||
if (caps & V4L2_CAP_VBI_CAPTURE) fputs("vbicapt ", FP);
|
||||
if (caps & V4L2_CAP_VBI_OUTPUT) fputs("vbiout ", FP);
|
||||
|
||||
/* to be continued */
|
||||
|
||||
if (caps & V4L2_CAP_AUDIO) fputs("audio ", FP);
|
||||
|
||||
|
||||
if (caps & V4L2_CAP_SDR_CAPTURE) fputs("sdrcapt ", FP);
|
||||
if (caps & V4L2_CAP_EXT_PIX_FORMAT) fputs("extpix ", FP);
|
||||
if (caps & V4L2_CAP_SDR_OUTPUT) fputs("sdrout ", FP);
|
||||
|
||||
|
||||
|
||||
|
||||
if (caps & V4L2_CAP_READWRITE) fputs("rwsysc ", FP);
|
||||
if (caps & V4L2_CAP_ASYNCIO) fputs("asyncio ", FP);
|
||||
if (caps & V4L2_CAP_STREAMING) fputs("stream ", FP);
|
||||
|
||||
|
||||
fputs("\n", FP);
|
||||
}
|
||||
/* --------------------------------------------------------------------- */
|
||||
int pr_v4l2_capability(char *txt, struct v4l2_capability *ptr)
|
||||
{
|
||||
fprintf(FP, "-- v4l2_capability, %-15s %p\n", txt, ptr);
|
||||
|
||||
fprintf(FP, " driver %s\n", ptr->driver);
|
||||
fprintf(FP, " card %s\n", ptr->card);
|
||||
fprintf(FP, " bus info %s\n", ptr->bus_info);
|
||||
fprintf(FP, " driver %s\n", ptr->driver);
|
||||
fprintf(FP, " card %s\n", ptr->card);
|
||||
fprintf(FP, " bus info %s\n", ptr->bus_info);
|
||||
|
||||
fprintf(FP, " version %X\n", ptr->version);
|
||||
fprintf(FP, " capabilities %X\n", ptr->capabilities);
|
||||
fprintf(FP, " device caps %X\n", ptr->device_caps);
|
||||
fprintf(FP, " version 0x%X\n", ptr->version);
|
||||
fprintf(FP, " capabilities 0x%X\n", ptr->capabilities);
|
||||
pr_capabilities(ptr->capabilities);
|
||||
fprintf(FP, " device caps 0x%X\n", ptr->device_caps);
|
||||
|
||||
return -1;
|
||||
}
|
||||
/* --------------------------------------------------------------------- */
|
||||
static char *str_input_type(int t)
|
||||
{
|
||||
switch (t) {
|
||||
case V4L2_INPUT_TYPE_TUNER: return "tuner";
|
||||
case V4L2_INPUT_TYPE_CAMERA: return "camera";
|
||||
case V4L2_INPUT_TYPE_TOUCH: return "touch";
|
||||
}
|
||||
return "???";
|
||||
}
|
||||
/* --------------------------------------------------------------------- */
|
||||
static void pr_input_status(uint32_t st)
|
||||
{
|
||||
if (st & V4L2_IN_ST_NO_POWER) fputs("nopower", FP);
|
||||
if (st & V4L2_IN_ST_NO_SIGNAL) fputs("nosignal", FP);
|
||||
if (st & V4L2_IN_ST_NO_COLOR) fputs("nocolor", FP);
|
||||
|
||||
/* to be continued */
|
||||
|
||||
|
||||
}
|
||||
/* --------------------------------------------------------------------- */
|
||||
int pr_v4l2_input(char *txt, struct v4l2_input *ptr)
|
||||
{
|
||||
fprintf(FP, "-- v4l2_input, %-15s %p\n", txt, ptr);
|
||||
|
||||
fprintf(FP, " index %d\n", ptr->index);
|
||||
fprintf(FP, " name %s\n", ptr->name);
|
||||
fprintf(FP, " type %d %s\n", ptr->type,
|
||||
str_input_type(ptr->type));
|
||||
fprintf(FP, " audioset 0x%X\n", ptr->audioset);
|
||||
fprintf(FP, " tuner 0x%X\n", ptr->tuner);
|
||||
/* XXX v4l2_std_id std; */
|
||||
fprintf(FP, " status %d\n", ptr->status);
|
||||
pr_input_status(ptr->status);
|
||||
fprintf(FP, " capabilities 0x%X\n", ptr->capabilities);
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
int pr_v4l2_capability(char *txt, struct v4l2_capability *ptr);
|
||||
|
||||
int pr_v4l2_input(char *txt, struct v4l2_input *ptr);
|
||||
int pr_v4l2_format(char *txt, struct v4l2_format *ptr);
|
||||
int pr_v4l2_requestbuffers(char *txt, struct v4l2_requestbuffers *ptr);
|
||||
/* --------------------------------------------------------------------- */
|
||||
|
@ -18,13 +18,22 @@
|
||||
|
||||
int verbosity;
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
static int enum_input(char *txt, int k)
|
||||
{
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
int show_webcam_infos(char *devname, int k)
|
||||
{
|
||||
int vfd, foo;
|
||||
|
||||
struct v4l2_capability cap;
|
||||
struct v4l2_format fmt;
|
||||
// struct v4l2_format fmt;
|
||||
struct v4l2_input input;
|
||||
// int index;
|
||||
|
||||
// struct v4l2_requestbuffers reqbuf;
|
||||
|
||||
@ -40,15 +49,21 @@ if (vfd < 0) {
|
||||
|
||||
fprintf(stderr, "\topen %s -> %d\n", devname, vfd);
|
||||
|
||||
memset(&cap, 0, sizeof(cap));
|
||||
foo = ioctl(vfd, VIDIOC_QUERYCAP, &cap);
|
||||
if (foo < 0) {
|
||||
perror("ioctl QUERYCAP");
|
||||
return -4;
|
||||
}
|
||||
pr_v4l2_capability(devname, &cap);
|
||||
if ( ! (cap.capabilities & V4L2_CAP_VIDEO_CAPTURE)) {
|
||||
fprintf("%s : no video capture\n", devname);
|
||||
|
||||
memset(&input, 0, sizeof(input));
|
||||
if (-1 == ioctl(vfd, VIDIOC_ENUMINPUT, &input)) {
|
||||
perror("VIDIOC_ENUMINPUT");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
pr_v4l2_input("input 0", &input);
|
||||
|
||||
|
||||
close(vfd);
|
||||
|
||||
@ -95,7 +110,7 @@ while ((opt = getopt(argc, argv, "d:hK:lv")) != -1) {
|
||||
if (verbosity) fimg_print_version(0);
|
||||
|
||||
foo = show_webcam_infos(device, K);
|
||||
fprintf(stderr, "\tshow_webcam_infos -> %d\n", foo);
|
||||
fprintf(stderr, "\n\tshow_webcam_infos -> %d\n", foo);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user