1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <pthread.h>
#include <math.h>
#include <sys/time.h>
#include <sys/mman.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
#include "grab-ng.h"
#include "jpeglib.h"
#include "list.h"
main()
{
const struct ng_vid_driver *drv;
void *h_drv;
struct stat st;
int i, fh;
ng_init();
ng_debug = 1;
for ( i = 0; ng_dev.video_scan[i] != NULL; i++ )
{
if (-1 == lstat(ng_dev.video_scan[i],&st))
{
if (ENOENT == errno)
continue;
fprintf(stderr,"%s: %s\n",ng_dev.video_scan[i],strerror(errno));
continue;
}
fh = open(ng_dev.video_scan[i],O_RDWR);
if (-1 == fh)
{
if (ENODEV == errno)
continue;
fprintf(stderr,"%s: %s\n",ng_dev.video_scan[i],strerror(errno));
continue;
}
close(fh);
drv = ng_vid_open(ng_dev.video_scan[i], NULL, NULL, 0, &h_drv);
if (NULL == drv)
{
fprintf(stderr,"%s: initialization failed\n",ng_dev.video_scan[i]);
perror ( "Impossible d'ouvrir le dev" );
continue;
}
printf ( "trouve: [%s] suite\n", ng_dev.video_scan[i] );
}
} |
Partager