ZBar Bar Code Reader Library  version 0.10
zbar.h File Reference

ZBar Barcode Reader C API definition. More...

Namespaces

 zbar
 C++ namespace for library interfaces.
 

Global library interfaces

enum  zbar::zbar_color_e {
  zbar::ZBAR_SPACE,
  zbar::ZBAR_BAR
}
 "color" of element: bar or space. More...
 
enum  zbar::zbar_symbol_type_e {
  zbar::ZBAR_NONE,
  zbar::ZBAR_PARTIAL,
  zbar::ZBAR_EAN8,
  zbar::ZBAR_UPCE,
  zbar::ZBAR_ISBN10,
  zbar::ZBAR_UPCA,
  zbar::ZBAR_EAN13,
  zbar::ZBAR_ISBN13,
  zbar::ZBAR_I25,
  zbar::ZBAR_CODE39,
  zbar::ZBAR_PDF417,
  zbar::ZBAR_QRCODE,
  zbar::ZBAR_CODE128,
  zbar::ZBAR_SYMBOL,
  zbar::ZBAR_ADDON2,
  zbar::ZBAR_ADDON5,
  zbar::ZBAR_ADDON
}
 decoded symbol type. More...
 
enum  zbar::zbar_error_e {
  zbar::ZBAR_OK,
  zbar::ZBAR_ERR_NOMEM,
  zbar::ZBAR_ERR_INTERNAL,
  zbar::ZBAR_ERR_UNSUPPORTED,
  zbar::ZBAR_ERR_INVALID,
  zbar::ZBAR_ERR_SYSTEM,
  zbar::ZBAR_ERR_LOCKING,
  zbar::ZBAR_ERR_BUSY,
  zbar::ZBAR_ERR_XDISPLAY,
  zbar::ZBAR_ERR_XPROTO,
  zbar::ZBAR_ERR_CLOSED,
  zbar::ZBAR_ERR_WINAPI,
  zbar::ZBAR_ERR_NUM
}
 error codes. More...
 
enum  zbar::zbar_config_e {
  zbar::ZBAR_CFG_ENABLE,
  zbar::ZBAR_CFG_ADD_CHECK,
  zbar::ZBAR_CFG_EMIT_CHECK,
  zbar::ZBAR_CFG_ASCII,
  zbar::ZBAR_CFG_NUM,
  zbar::ZBAR_CFG_MIN_LEN,
  zbar::ZBAR_CFG_MAX_LEN,
  zbar::ZBAR_CFG_POSITION,
  zbar::ZBAR_CFG_X_DENSITY,
  zbar::ZBAR_CFG_Y_DENSITY
}
 decoder configuration options. More...
 
typedef enum zbar::zbar_color_e zbar::zbar_color_t
 "color" of element: bar or space. More...
 
typedef enum zbar::zbar_symbol_type_e zbar::zbar_symbol_type_t
 decoded symbol type. More...
 
typedef enum zbar::zbar_error_e zbar::zbar_error_t
 error codes. More...
 
typedef enum zbar::zbar_config_e zbar::zbar_config_t
 decoder configuration options. More...
 
int zbar::zbar_version (unsigned *major, unsigned *minor)
 retrieve runtime library version information. More...
 
void zbar::zbar_set_verbosity (int verbosity)
 set global library debug level. More...
 
void zbar::zbar_increase_verbosity (void)
 increase global library debug level. More...
 
const char * zbar::zbar_get_symbol_name (zbar_symbol_type_t sym)
 retrieve string name for symbol encoding. More...
 
const char * zbar::zbar_get_addon_name (zbar_symbol_type_t sym)
 retrieve string name for addon encoding. More...
 
int zbar::zbar_parse_config (const char *config_string, zbar_symbol_type_t *symbology, zbar_config_t *config, int *value)
 parse a configuration string of the form "[symbology.]config[=value]". More...
 
int zbar::_zbar_error_spew (const void *object, int verbosity)
 
const char * zbar::_zbar_error_string (const void *object, int verbosity)
 
zbar_error_t zbar::_zbar_get_error_code (const void *object)
 

Symbol interface

decoded barcode symbol result object.

stores type, data, and image location of decoded symbol. all memory is owned by the library

typedef struct zbar_symbol_s zbar::zbar_symbol_t
 opaque decoded symbol object. More...
 
void zbar::zbar_symbol_ref (const zbar_symbol_t *symbol, int refs)
 symbol reference count manipulation. More...
 
zbar_symbol_type_t zbar::zbar_symbol_get_type (const zbar_symbol_t *symbol)
 retrieve type of decoded symbol. More...
 
const char * zbar::zbar_symbol_get_data (const zbar_symbol_t *symbol)
 retrieve data decoded from symbol. More...
 
unsigned int zbar::zbar_symbol_get_data_length (const zbar_symbol_t *symbol)
 retrieve length of binary data. More...
 
int zbar::zbar_symbol_get_quality (const zbar_symbol_t *symbol)
 retrieve a symbol confidence metric. More...
 
int zbar::zbar_symbol_get_count (const zbar_symbol_t *symbol)
 retrieve current cache count. More...
 
unsigned zbar::zbar_symbol_get_loc_size (const zbar_symbol_t *symbol)
 retrieve the number of points in the location polygon. More...
 
int zbar::zbar_symbol_get_loc_x (const zbar_symbol_t *symbol, unsigned index)
 retrieve location polygon x-coordinates. More...
 
int zbar::zbar_symbol_get_loc_y (const zbar_symbol_t *symbol, unsigned index)
 retrieve location polygon y-coordinates. More...
 
const zbar_symbol_t * zbar::zbar_symbol_next (const zbar_symbol_t *symbol)
 iterate the set to which this symbol belongs (there can be only one). More...
 
const zbar_symbol_set_t * zbar::zbar_symbol_get_components (const zbar_symbol_t *symbol)
 retrieve components of a composite result. More...
 
const zbar_symbol_t * zbar::zbar_symbol_first_component (const zbar_symbol_t *symbol)
 iterate components of a composite result. More...
 
char * zbar::zbar_symbol_xml (const zbar_symbol_t *symbol, char **buffer, unsigned *buflen)
 print XML symbol element representation to user result buffer. More...
 

Symbol Set interface

container for decoded result symbols associated with an image or a composite symbol.

Since
0.10
typedef struct zbar_symbol_set_s zbar::zbar_symbol_set_t
 opaque symbol iterator object. More...
 
void zbar::zbar_symbol_set_ref (const zbar_symbol_set_t *symbols, int refs)
 reference count manipulation. More...
 
int zbar::zbar_symbol_set_get_size (const zbar_symbol_set_t *symbols)
 retrieve set size. More...
 
const zbar_symbol_t * zbar::zbar_symbol_set_first_symbol (const zbar_symbol_set_t *symbols)
 set iterator. More...
 

Image interface

stores image data samples along with associated format and size metadata

typedef struct zbar_image_s zbar::zbar_image_t
 opaque image object. More...
 
typedef voidzbar::zbar_image_cleanup_handler_t) (zbar_image_t *image)
 cleanup handler callback function. More...
 
typedef voidzbar::zbar_image_data_handler_t) (zbar_image_t *image, const void *userdata)
 data handler callback function. More...
 
zbar_image_t * zbar::zbar_image_create (void)
 new image constructor. More...
 
void zbar::zbar_image_destroy (zbar_image_t *image)
 image destructor. More...
 
void zbar::zbar_image_ref (zbar_image_t *image, int refs)
 image reference count manipulation. More...
 
zbar_image_t * zbar::zbar_image_convert (const zbar_image_t *image, unsigned long format)
 image format conversion. More...
 
zbar_image_t * zbar::zbar_image_convert_resize (const zbar_image_t *image, unsigned long format, unsigned width, unsigned height)
 image format conversion with crop/pad. More...
 
unsigned long zbar::zbar_image_get_format (const zbar_image_t *image)
 retrieve the image format. More...
 
unsigned zbar::zbar_image_get_sequence (const zbar_image_t *image)
 retrieve a "sequence" (page/frame) number associated with this image. More...
 
unsigned zbar::zbar_image_get_width (const zbar_image_t *image)
 retrieve the width of the image. More...
 
unsigned zbar::zbar_image_get_height (const zbar_image_t *image)
 retrieve the height of the image. More...
 
const voidzbar::zbar_image_get_data (const zbar_image_t *image)
 return the image sample data. More...
 
unsigned long zbar::zbar_image_get_data_length (const zbar_image_t *img)
 return the size of image data. More...
 
const zbar_symbol_set_t * zbar::zbar_image_get_symbols (const zbar_image_t *image)
 retrieve the decoded results. More...
 
void zbar::zbar_image_set_symbols (zbar_image_t *image, const zbar_symbol_set_t *symbols)
 associate the specified symbol set with the image, replacing any existing results. More...
 
const zbar_symbol_t * zbar::zbar_image_first_symbol (const zbar_image_t *image)
 image_scanner decode result iterator. More...
 
void zbar::zbar_image_set_format (zbar_image_t *image, unsigned long format)
 specify the fourcc image format code for image sample data. More...
 
void zbar::zbar_image_set_sequence (zbar_image_t *image, unsigned sequence_num)
 associate a "sequence" (page/frame) number with this image. More...
 
void zbar::zbar_image_set_size (zbar_image_t *image, unsigned width, unsigned height)
 specify the pixel size of the image. More...
 
void zbar::zbar_image_set_data (zbar_image_t *image, const void *data, unsigned long data_byte_length, zbar_image_cleanup_handler_t *cleanup_hndlr)
 specify image sample data. More...
 
void zbar::zbar_image_free_data (zbar_image_t *image)
 built-in cleanup handler. More...
 
void zbar::zbar_image_set_userdata (zbar_image_t *image, void *userdata)
 associate user specified data value with an image. More...
 
voidzbar::zbar_image_get_userdata (const zbar_image_t *image)
 return user specified data value associated with the image. More...
 
int zbar::zbar_image_write (const zbar_image_t *image, const char *filebase)
 dump raw image data to a file for debug. More...
 
zbar_image_t * zbar::zbar_image_read (char *filename)
 read back an image in the format written by zbar_image_write() More...
 

Processor interface

high-level self-contained image processor. processes video and images for barcodes, optionally displaying images to a library owned output window

typedef struct zbar_processor_s zbar::zbar_processor_t
 opaque standalone processor object. More...
 
zbar_processor_t * zbar::zbar_processor_create (int threaded)
 constructor. More...
 
void zbar::zbar_processor_destroy (zbar_processor_t *processor)
 destructor. More...
 
int zbar::zbar_processor_init (zbar_processor_t *processor, const char *video_device, int enable_display)
 (re)initialization. More...
 
int zbar::zbar_processor_request_size (zbar_processor_t *processor, unsigned width, unsigned height)
 request a preferred size for the video image from the device. More...
 
int zbar::zbar_processor_request_interface (zbar_processor_t *processor, int version)
 request a preferred video driver interface version for debug/testing. More...
 
int zbar::zbar_processor_request_iomode (zbar_processor_t *video, int iomode)
 request a preferred video I/O mode for debug/testing. More...
 
int zbar::zbar_processor_force_format (zbar_processor_t *processor, unsigned long input_format, unsigned long output_format)
 force specific input and output formats for debug/testing. More...
 
zbar_image_data_handler_t * zbar::zbar_processor_set_data_handler (zbar_processor_t *processor, zbar_image_data_handler_t *handler, const void *userdata)
 setup result handler callback. More...
 
void zbar::zbar_processor_set_userdata (zbar_processor_t *processor, void *userdata)
 associate user specified data value with the processor. More...
 
voidzbar::zbar_processor_get_userdata (const zbar_processor_t *processor)
 return user specified data value associated with the processor. More...
 
int zbar::zbar_processor_set_config (zbar_processor_t *processor, zbar_symbol_type_t symbology, zbar_config_t config, int value)
 set config for indicated symbology (0 for all) to specified value. More...
 
static int zbar::zbar_processor_parse_config (zbar_processor_t *processor, const char *config_string)
 parse configuration string using zbar_parse_config() and apply to processor using zbar_processor_set_config(). More...
 
int zbar::zbar_processor_is_visible (zbar_processor_t *processor)
 retrieve the current state of the ouput window. More...
 
int zbar::zbar_processor_set_visible (zbar_processor_t *processor, int visible)
 show or hide the display window owned by the library. More...
 
int zbar::zbar_processor_set_active (zbar_processor_t *processor, int active)
 control the processor in free running video mode. More...
 
const zbar_symbol_set_t * zbar::zbar_processor_get_results (const zbar_processor_t *processor)
 retrieve decode results for last scanned image/frame. More...
 
int zbar::zbar_processor_user_wait (zbar_processor_t *processor, int timeout)
 wait for input to the display window from the user (via mouse or keyboard). More...
 
int zbar::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. More...
 
int zbar::zbar_process_image (zbar_processor_t *processor, zbar_image_t *image)
 process the provided image for barcodes. More...
 
static int zbar::zbar_processor_error_spew (const zbar_processor_t *processor, int verbosity)
 display detail for last processor error to stderr. More...
 
static const char * zbar::zbar_processor_error_string (const zbar_processor_t *processor, int verbosity)
 retrieve the detail string for the last processor error. More...
 
static zbar_error_t zbar::zbar_processor_get_error_code (const zbar_processor_t *processor)
 retrieve the type code for the last processor error. More...
 

Video interface

mid-level video source abstraction. captures images from a video device

typedef struct zbar_video_s zbar::zbar_video_t
 opaque video object. More...
 
zbar_video_t * zbar::zbar_video_create (void)
 constructor. More...
 
void zbar::zbar_video_destroy (zbar_video_t *video)
 destructor. More...
 
int zbar::zbar_video_open (zbar_video_t *video, const char *device)
 open and probe a video device. More...
 
int zbar::zbar_video_get_fd (const zbar_video_t *video)
 retrieve file descriptor associated with open *nix video device useful for using select()/poll() to tell when new images are available (NB v4l2 only!!). More...
 
int zbar::zbar_video_request_size (zbar_video_t *video, unsigned width, unsigned height)
 request a preferred size for the video image from the device. More...
 
int zbar::zbar_video_request_interface (zbar_video_t *video, int version)
 request a preferred driver interface version for debug/testing. More...
 
int zbar::zbar_video_request_iomode (zbar_video_t *video, int iomode)
 request a preferred I/O mode for debug/testing. More...
 
int zbar::zbar_video_get_width (const zbar_video_t *video)
 retrieve current output image width. More...
 
int zbar::zbar_video_get_height (const zbar_video_t *video)
 retrieve current output image height. More...
 
int zbar::zbar_video_init (zbar_video_t *video, unsigned long format)
 initialize video using a specific format for debug. More...
 
int zbar::zbar_video_enable (zbar_video_t *video, int enable)
 start/stop video capture. More...
 
zbar_image_t * zbar::zbar_video_next_image (zbar_video_t *video)
 retrieve next captured image. More...
 
static int zbar::zbar_video_error_spew (const zbar_video_t *video, int verbosity)
 display detail for last video error to stderr. More...
 
static const char * zbar::zbar_video_error_string (const zbar_video_t *video, int verbosity)
 retrieve the detail string for the last video error. More...
 
static zbar_error_t zbar::zbar_video_get_error_code (const zbar_video_t *video)
 retrieve the type code for the last video error. More...
 

Window interface

mid-level output window abstraction. displays images to user-specified platform specific output window

typedef struct zbar_window_s zbar::zbar_window_t
 opaque window object. More...
 
zbar_window_t * zbar::zbar_window_create (void)
 constructor. More...
 
void zbar::zbar_window_destroy (zbar_window_t *window)
 destructor. More...
 
int zbar::zbar_window_attach (zbar_window_t *window, void *x11_display_w32_hwnd, unsigned long x11_drawable)
 associate reader with an existing platform window. More...
 
void zbar::zbar_window_set_overlay (zbar_window_t *window, int level)
 control content level of the reader overlay. More...
 
int zbar::zbar_window_get_overlay (const zbar_window_t *window)
 retrieve current content level of reader overlay. More...
 
int zbar::zbar_window_draw (zbar_window_t *window, zbar_image_t *image)
 draw a new image into the output window. More...
 
int zbar::zbar_window_redraw (zbar_window_t *window)
 redraw the last image (exposure handler). More...
 
int zbar::zbar_window_resize (zbar_window_t *window, unsigned width, unsigned height)
 resize the image window (reconfigure handler). More...
 
static int zbar::zbar_window_error_spew (const zbar_window_t *window, int verbosity)
 display detail for last window error to stderr. More...
 
static const char * zbar::zbar_window_error_string (const zbar_window_t *window, int verbosity)
 retrieve the detail string for the last window error. More...
 
static zbar_error_t zbar::zbar_window_get_error_code (const zbar_window_t *window)
 retrieve the type code for the last window error. More...
 
int zbar::zbar_negotiate_format (zbar_video_t *video, zbar_window_t *window)
 select a compatible format between video input and output window. More...
 

Image Scanner interface

mid-level image scanner interface. reads barcodes from 2-D images

typedef struct zbar_image_scanner_s zbar::zbar_image_scanner_t
 opaque image scanner object. More...
 
zbar_image_scanner_t * zbar::zbar_image_scanner_create (void)
 constructor. More...
 
void zbar::zbar_image_scanner_destroy (zbar_image_scanner_t *scanner)
 destructor. More...
 
zbar_image_data_handler_t * zbar::zbar_image_scanner_set_data_handler (zbar_image_scanner_t *scanner, zbar_image_data_handler_t *handler, const void *userdata)
 setup result handler callback. More...
 
int zbar::zbar_image_scanner_set_config (zbar_image_scanner_t *scanner, zbar_symbol_type_t symbology, zbar_config_t config, int value)
 set config for indicated symbology (0 for all) to specified value. More...
 
static int zbar::zbar_image_scanner_parse_config (zbar_image_scanner_t *scanner, const char *config_string)
 parse configuration string using zbar_parse_config() and apply to image scanner using zbar_image_scanner_set_config(). More...
 
void zbar::zbar_image_scanner_enable_cache (zbar_image_scanner_t *scanner, int enable)
 enable or disable the inter-image result cache (default disabled). More...
 
void zbar::zbar_image_scanner_recycle_image (zbar_image_scanner_t *scanner, zbar_image_t *image)
 remove any previously decoded results from the image scanner and the specified image. More...
 
const zbar_symbol_set_t * zbar::zbar_image_scanner_get_results (const zbar_image_scanner_t *scanner)
 retrieve decode results for last scanned image. More...
 
int zbar::zbar_scan_image (zbar_image_scanner_t *scanner, zbar_image_t *image)
 scan for symbols in provided image. More...
 

Decoder interface

low-level bar width stream decoder interface. identifies symbols and extracts encoded data

typedef struct zbar_decoder_s zbar::zbar_decoder_t
 opaque decoder object. More...
 
typedef voidzbar::zbar_decoder_handler_t) (zbar_decoder_t *decoder)
 decoder data handler callback function. More...
 
zbar_decoder_t * zbar::zbar_decoder_create (void)
 constructor. More...
 
void zbar::zbar_decoder_destroy (zbar_decoder_t *decoder)
 destructor. More...
 
int zbar::zbar_decoder_set_config (zbar_decoder_t *decoder, zbar_symbol_type_t symbology, zbar_config_t config, int value)
 set config for indicated symbology (0 for all) to specified value. More...
 
static int zbar::zbar_decoder_parse_config (zbar_decoder_t *decoder, const char *config_string)
 parse configuration string using zbar_parse_config() and apply to decoder using zbar_decoder_set_config(). More...
 
void zbar::zbar_decoder_reset (zbar_decoder_t *decoder)
 clear all decoder state. More...
 
void zbar::zbar_decoder_new_scan (zbar_decoder_t *decoder)
 mark start of a new scan pass. More...
 
zbar_symbol_type_t zbar::zbar_decode_width (zbar_decoder_t *decoder, unsigned width)
 process next bar/space width from input stream. More...
 
zbar_color_t zbar::zbar_decoder_get_color (const zbar_decoder_t *decoder)
 retrieve color of next element passed to zbar_decode_width(). More...
 
const char * zbar::zbar_decoder_get_data (const zbar_decoder_t *decoder)
 retrieve last decoded data. More...
 
unsigned int zbar::zbar_decoder_get_data_length (const zbar_decoder_t *decoder)
 retrieve length of binary data. More...
 
zbar_symbol_type_t zbar::zbar_decoder_get_type (const zbar_decoder_t *decoder)
 retrieve last decoded symbol type. More...
 
zbar_decoder_handler_t * zbar::zbar_decoder_set_handler (zbar_decoder_t *decoder, zbar_decoder_handler_t *handler)
 setup data handler callback. More...
 
void zbar::zbar_decoder_set_userdata (zbar_decoder_t *decoder, void *userdata)
 associate user specified data value with the decoder. More...
 
voidzbar::zbar_decoder_get_userdata (const zbar_decoder_t *decoder)
 return user specified data value associated with the decoder. More...
 

Scanner interface

low-level linear intensity sample stream scanner interface. identifies "bar" edges and measures width between them. optionally passes to bar width decoder

typedef struct zbar_scanner_s zbar::zbar_scanner_t
 opaque scanner object. More...
 
zbar_scanner_t * zbar::zbar_scanner_create (zbar_decoder_t *decoder)
 constructor. More...
 
void zbar::zbar_scanner_destroy (zbar_scanner_t *scanner)
 destructor. More...
 
zbar_symbol_type_t zbar::zbar_scanner_reset (zbar_scanner_t *scanner)
 clear all scanner state. More...
 
zbar_symbol_type_t zbar::zbar_scanner_new_scan (zbar_scanner_t *scanner)
 mark start of a new scan pass. More...
 
zbar_symbol_type_t zbar::zbar_scanner_flush (zbar_scanner_t *scanner)
 flush scanner processing pipeline. More...
 
zbar_symbol_type_t zbar::zbar_scan_y (zbar_scanner_t *scanner, int y)
 process next sample intensity value. More...
 
static zbar_symbol_type_t zbar::zbar_scan_rgb24 (zbar_scanner_t *scanner, unsigned char *rgb)
 process next sample from RGB (or BGR) triple. More...
 
unsigned zbar::zbar_scanner_get_width (const zbar_scanner_t *scanner)
 retrieve last scanned width. More...
 
unsigned zbar::zbar_scanner_get_edge (const zbar_scanner_t *scn, unsigned offset, int prec)
 retrieve sample position of last edge. More...
 
zbar_color_t zbar::zbar_scanner_get_color (const zbar_scanner_t *scanner)
 retrieve last scanned color. More...
 

Detailed Description

ZBar Barcode Reader C API definition.