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

zebra_video_t* zebra_video_create (  ) 

constructor.

Definition at line 52 of file video.c.

References zebra_image_create(), zebra_video_create(), and zebra_video_destroy().

Referenced by zebra::Video::Video(), zebra_processor_init(), and zebra_video_create().

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

#ifdef HAVE_LIBPTHREAD
    if(pthread_mutex_init(&vdo->qlock, NULL)) {
        free(vdo);
        return(NULL);
    }
#endif

    /* pre-allocate images */
    vdo->num_images = ZEBRA_VIDEO_IMAGES_MAX;
    vdo->images = calloc(ZEBRA_VIDEO_IMAGES_MAX, sizeof(zebra_image_t*));
    if(!vdo->images) {
        zebra_video_destroy(vdo);
        return(NULL);
    }

    int i;
    for(i = 0; i < ZEBRA_VIDEO_IMAGES_MAX; i++) {
        zebra_image_t *img = vdo->images[i] = zebra_image_create();
        if(!img) {
            zebra_video_destroy(vdo);
            return(NULL);
        }
        img->refcnt = 0;
        img->cleanup = _zebra_video_recycle_image;
        img->srcidx = i;
        img->src = vdo;
    }

    return(vdo);
}


Generated by  Doxygen 1.6.0   Back to index