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

zbar_symbol_type_t zbar_decode_width ( zbar_decoder_t decoder,
unsigned  width 
)

process next bar/space width from input stream. the width is in arbitrary relative units. first value of a scan is ZBAR_SPACE width, alternating from there.

Returns:
appropriate symbol type if width completes decode of a symbol (data is available for retrieval)

ZBAR_PARTIAL as a hint if part of a symbol was decoded

ZBAR_NONE (0) if no new symbol data is available

Definition at line 177 of file decoder.c.

References ZBAR_CFG_ENABLE, zbar_decode_width(), ZBAR_NONE, and ZBAR_PARTIAL.

Referenced by zbar::Decoder::decode_width(), zbar::Decoder::operator<<(), zbar_decode_width(), and zbar_scanner_flush().

{
    dcode->w[dcode->idx & (DECODE_WINDOW - 1)] = w;
    dprintf(1, "    decode[%x]: w=%d (%g)\n", dcode->idx, w, (w / 32.));

    /* each decoder processes width stream in parallel */
    zbar_symbol_type_t sym = dcode->type = ZBAR_NONE;

#ifdef ENABLE_EAN
    if((dcode->ean.enable) &&
       (sym = _zbar_decode_ean(dcode)))
        dcode->type = sym;
#endif
#ifdef ENABLE_CODE39
    if(TEST_CFG(dcode->code39.config, ZBAR_CFG_ENABLE) &&
       (sym = _zbar_decode_code39(dcode)) > ZBAR_PARTIAL)
        dcode->type = sym;
#endif
#ifdef ENABLE_CODE128
    if(TEST_CFG(dcode->code128.config, ZBAR_CFG_ENABLE) &&
       (sym = _zbar_decode_code128(dcode)) > ZBAR_PARTIAL)
        dcode->type = sym;
#endif
#ifdef ENABLE_I25
    if(TEST_CFG(dcode->i25.config, ZBAR_CFG_ENABLE) &&
       (sym = _zbar_decode_i25(dcode)) > ZBAR_PARTIAL)
        dcode->type = sym;
#endif
#ifdef ENABLE_PDF417
    if(TEST_CFG(dcode->pdf417.config, ZBAR_CFG_ENABLE) &&
       (sym = _zbar_decode_pdf417(dcode)) > ZBAR_PARTIAL)
        dcode->type = sym;
#endif
#ifdef ENABLE_QRCODE
    if(TEST_CFG(dcode->qrf.config, ZBAR_CFG_ENABLE) &&
       (sym = _zbar_find_qr(dcode)) > ZBAR_PARTIAL)
        dcode->type = sym;
#endif

    dcode->idx++;
    if(dcode->type) {
        if(dcode->handler)
            dcode->handler(dcode);
        if(dcode->lock && dcode->type > ZBAR_PARTIAL)
            dcode->lock = 0;
    }
    return(dcode->type);
}


Generated by  Doxygen 1.6.0   Back to index