2011-01-28 165 views
1

如何檢測使用GNOME庫的攝像頭設備。檢查網絡攝像頭攝像頭設備GNOME庫

請給我一些關於此的示例代碼。

我遵循奶酪源代碼,但是當我調用檢測相機api時,它返回NULL。

感謝和問候, iSight攝像頭

回答

2

從我的理解,你並不真正需要的,如果你需要的是攝像頭設備信息使用GNOME \ GTK。 PLS,嘗試下面的代碼,它應該查詢和輸出的視頻驅動程序的功能:

#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; 
} 

在我的機器上輸出是:

司機:uvcvideo

卡:聯想EasyCamera

bus info:usb-0000:00:1d.7-3

版本:256

功能:4000001

你也可以在這裏找到更多的信息:How to get a list of video capture devices (web cameras) on linux

希望這會有所幫助,至於

+0

K精,那我該怎麼做,開始從網絡攝像頭捕捉會話.. .. – boom 2011-01-31 05:08:25