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

int zbar_process_one ( zbar_processor_t processor,
int  timeout 
)

process from the video stream until a result is available, or the timeout (in milliseconds) expires. specify a timeout of -1 to scan indefinitely (zbar_processor_set_active() may still be used to abort the scan from another thread). if the library window is visible, video display will be enabled.

Note:
that multiple results may still be returned (despite the name).
Returns:
>0 if symbols were successfully decoded, 0 if no symbols were found (ie, the timeout expired) or -1 if an error occurs

Definition at line 628 of file processor.c.

References ZBAR_ERR_INVALID, zbar_process_one(), and zbar_processor_set_active().

Referenced by zbar::Processor::process_one(), and zbar_process_one().

{
    proc_enter(proc);
    int streaming = proc->streaming;
    _zbar_mutex_unlock(&proc->mutex);

    int rc = 0;
    if(!proc->video) {
        rc = err_capture(proc, SEV_ERROR, ZBAR_ERR_INVALID, __func__,
                         "video input not initialized");
        goto done;
    }

    if(!streaming) {
        rc = zbar_processor_set_active(proc, 1);
        if(rc)
            goto done;
    }

    zbar_timer_t timer;
    rc = _zbar_processor_wait(proc, EVENT_OUTPUT,
                              _zbar_timer_init(&timer, timeout));

    if(!streaming && zbar_processor_set_active(proc, 0))
        rc = -1;

 done:
    _zbar_mutex_lock(&proc->mutex);
    proc_leave(proc);
    return(rc);
}


Generated by  Doxygen 1.6.0   Back to index