Logo Search packages:      
Sourcecode: zbar version File versions  Download package

int zbar_video_open ( zbar_video_t video,
const char *  device 
)

open and probe a video device. the device specified by platform specific unique name (v4l device node path in *nix eg "/dev/video", DirectShow DevicePath property in windows).

Returns:
0 if successful or -1 if an error occurs

Definition at line 130 of file video.c.

References zbar_video_enable(), and zbar_video_open().

Referenced by zbar::Video::close(), zbar::Video::open(), zbar_processor_init(), zbar_video_destroy(), and zbar_video_open().

{
    zbar_video_enable(vdo, 0);
    video_lock(vdo);
    if(vdo->intf != VIDEO_INVALID) {
        if(vdo->cleanup) {
            vdo->cleanup(vdo);
            vdo->cleanup = NULL;
        }
        zprintf(1, "closed camera (fd=%d)\n", vdo->fd);
        vdo->intf = VIDEO_INVALID;
    }
    video_unlock(vdo);

    if(!dev)
        return(0);

    char *ldev = NULL;
    if((unsigned char)dev[0] < 0x10) {
        /* default linux device, overloaded for other platforms */
        int id = dev[0];
        dev = ldev = strdup("/dev/video0");
        ldev[10] = '0' + id;
    }

    int rc = _zbar_video_open(vdo, dev);

    if(ldev)
        free(ldev);
    return(rc);
}


Generated by  Doxygen 1.6.0   Back to index