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

int zbar_video_init ( zbar_video_t video,
unsigned long  format 
)

initialize video using a specific format for debug. use zbar_negotiate_format() to automatically select and initialize the best available format

Definition at line 259 of file video.c.

References ZBAR_ERR_INVALID, zbar_image_create(), zbar_image_destroy(), and zbar_video_init().

Referenced by zbar::Video::init(), zbar_negotiate_format(), zbar_processor_init(), and zbar_video_init().

{
    if(vdo->initialized)
        /* FIXME re-init different format? */
        return(err_capture(vdo, SEV_ERROR, ZBAR_ERR_INVALID, __func__,
                           "already initialized, re-init unimplemented"));

    if(vdo->init(vdo, fmt))
        return(-1);
    vdo->format = fmt;
    if(video_init_images(vdo))
        return(-1);
#ifdef HAVE_LIBJPEG
    const zbar_format_def_t *vidfmt = _zbar_format_lookup(fmt);
    if(vidfmt && vidfmt->group == ZBAR_FMT_JPEG) {
        /* prepare for decoding */
        if(!vdo->jpeg)
            vdo->jpeg = _zbar_jpeg_decomp_create();
        if(vdo->jpeg_img)
            zbar_image_destroy(vdo->jpeg_img);

        /* create intermediate image for decoder to use*/
        zbar_image_t *img = vdo->jpeg_img = zbar_image_create();
        img->format = fourcc('Y','8','0','0');
        img->width = vdo->width;
        img->height = vdo->height;
        img->datalen = vdo->width * vdo->height;
    }
#endif
    vdo->initialized = 1;
    return(0);
}


Generated by  Doxygen 1.6.0   Back to index