Unable to query video device
Noobie here, bare with me. I am trying to write a capture program for my Logitech QuickCommunicate STX webcam and running into difficulties. I am able to open /dev/video with no problems, but when I query the device to fill the capabilities table, the function fails. I am not using a capture card if it helps. Here is my source so far:
[\code]
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <jpeglib.h>
#include <linux/ioctl.h>
#include <linux/mman.h>
#include <errno.h>
#include <linux/videodev.h>
#include <linux/videodev2.h>
struct video_capability capability;
int video_fd;
char *file_device = "/dev/video";
char ch;
int main()
{
if (video_fd = (open(file_device, O_RDONLY)) == 0)
{
printf("\nUnable to open device %s\n",file_device);
}
else
{
printf("\nSucess opening device %s\n", file_device);
}
if ((ioctl(video_fd, VIDIOC_QUERYCAP, &capability)) != -1)
{
printf("\nSucess querying device.\n");
}
else
{
printf("\nUnable to query device.\n");
}
while (1)
{
printf("\nReading device %s\n", file_device);
if ((ch = getc(stdin)) == 'x')
break;
else
continue;
}
video_fd = close(file_device);
return (0);
}
[\code]
Can the camera be considered a capture device, or am I coding something wrong? Thanks in advance.
|