checking for webcam camera device gnome library
How can i detect camera device(s) using gnome libraries.
Please get me some sample codes regarding this.
I have followed Cheese source code, but when i call det开发者_JS百科ect camera api, it returns NULL.
Thanks and Regards, iSight
from my understanding, you don't really need to use gnome\gtk if what you need is webcam device information. Pls, try the code below, it should query and output video driver capabilities:
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <linux/videodev2.h>
int main()
{
struct v4l2_capability vc;
int fd = open("/dev/video0", O_RDONLY);
if (fd != -1)
{
ioctl(fd, VIDIOC_QUERYCAP, &vc);
printf("driver: %s\n", vc.driver);
printf("card: %s\n", vc.card);
printf("bus info: %s\n", vc.bus_info);
printf("version: %d\n", vc.version);
printf("capabilities: %x\n", vc.capabilities);
close(fd);
}
return 0;
}
on my machine output is:
driver: uvcvideo
card: Lenovo EasyCamera
bus info: usb-0000:00:1d.7-3
version: 256
capabilities: 4000001
you also can find more info here: How to get a list of video capture devices (web cameras) on linux
hope this helps, regards
精彩评论