zebra_image_scanner_t *zebra_image_scanner_create () { zebra_image_scanner_t *iscn = calloc(1, sizeof(zebra_image_scanner_t)); if(!iscn) return(NULL); iscn->dcode = zebra_decoder_create(); iscn->scn = zebra_scanner_create(iscn->dcode); if(!iscn->dcode || !iscn->scn) { zebra_image_scanner_destroy(iscn); return(NULL); } return(iscn); }
void zebra_processor_destroy (zebra_processor_t *proc) { (void)proc_lock(proc); proc_destroy_thread(proc->video_thread, &proc->video_started); proc_destroy_thread(proc->input_thread, &proc->input_started); if(proc->window) { zebra_window_destroy(proc->window); proc->window = NULL; _zebra_window_close(proc); } if(proc->video) { zebra_video_destroy(proc->video); proc->video = NULL; } if(proc->scanner) { zebra_image_scanner_destroy(proc->scanner); proc->scanner = NULL; } proc_unlock(proc); err_cleanup(&proc->err); #ifdef HAVE_LIBPTHREAD pthread_cond_destroy(&proc->event); pthread_cond_destroy(&proc->cond); pthread_mutex_destroy(&proc->mutex); #endif if(proc->polling.fds) { free(proc->polling.fds); proc->polling.fds = NULL; } if(proc->polling.handlers) { free(proc->polling.handlers); proc->polling.handlers = NULL; } if(proc->thr_polling.fds) { free(proc->thr_polling.fds); proc->thr_polling.fds = NULL; } if(proc->thr_polling.handlers) { free(proc->thr_polling.handlers); proc->thr_polling.handlers = NULL; } free(proc); }