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

zbar_video_t* zbar_video_create ( void   ) 

constructor.

Definition at line 58 of file video.c.

References zbar_image_create(), zbar_video_create(), and zbar_video_destroy().

Referenced by zbar::Video::Video(), zbar_processor_init(), and zbar_video_create().

{
    zbar_video_t *vdo = calloc(1, sizeof(zbar_video_t));
    if(!vdo)
        return(NULL);
    err_init(&vdo->err, ZBAR_MOD_VIDEO);
    vdo->fd = -1;

    (void)_zbar_mutex_init(&vdo->qlock);

    /* pre-allocate images */
    vdo->num_images = ZBAR_VIDEO_IMAGES_MAX;
    vdo->images = calloc(ZBAR_VIDEO_IMAGES_MAX, sizeof(zbar_image_t*));
    if(!vdo->images) {
        zbar_video_destroy(vdo);
        return(NULL);
    }

    int i;
    for(i = 0; i < ZBAR_VIDEO_IMAGES_MAX; i++) {
        zbar_image_t *img = vdo->images[i] = zbar_image_create();
        if(!img) {
            zbar_video_destroy(vdo);
            return(NULL);
        }
        img->refcnt = 0;
        img->cleanup = _zbar_video_recycle_image;
        img->srcidx = i;
        img->src = vdo;
    }

    return(vdo);
}


Generated by  Doxygen 1.6.0   Back to index