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

int zebra_processor_set_active ( zebra_processor_t processor,
int  active 
)

control the processor in free running video mode. only works if video input is initialized. if threading is in use, scanning will occur in the background, otherwise this is only useful wrapping calls to zebra_processor_user_wait(). if the library output window is visible, video display will be enabled.

Definition at line 662 of file processor.c.

References zebra_image_scanner_enable_cache(), zebra_processor_set_active(), zebra_video_enable(), and zebra_video_get_fd().

Referenced by zebra::Processor::set_active(), and zebra_processor_set_active().

{
    if(proc_lock(proc) < 0)
        return(-1);
    if(!proc->video) {
        proc_unlock(proc);
        return(-1);
    }
    zebra_image_scanner_enable_cache(proc->scanner, active);
    int rc = zebra_video_enable(proc->video, active);
    int vid_fd = zebra_video_get_fd(proc->video);
    if(vid_fd >= 0) {
        if(active)
            add_poll(proc, vid_fd, proc_video_handler);
        else
            remove_poll(proc, vid_fd);
    }
    /* FIXME failure recovery? */
    proc->active = active;
    proc->events &= ~EVENT_INPUT;
#ifdef HAVE_LIBPTHREAD
    if(proc->threaded) {
        assert(!proc->sem);
        assert(pthread_equal(proc->sem_owner, pthread_self()));
        pthread_mutex_lock(&proc->mutex);
        proc->sem++;
        pthread_cond_broadcast(&proc->event);
        pthread_cond_signal(&proc->cond);
        pthread_mutex_unlock(&proc->mutex);
    }
#endif
    return(rc);
}


Generated by  Doxygen 1.6.0   Back to index