/zbar_update_to_617889f8f73.patch
Patch | 12235 lines | 12142 code | 93 blank | 0 comment | 0 complexity | bec7532f513f4040726f95b8d12b2056 MD5 | raw file
Possible License(s): LGPL-2.1
Large files files are truncated, but you can click here to view the full file
- diff --git a/COPYING b/COPYING
- --- a/COPYING
- +++ b/COPYING
- @@ -1,4 +1,4 @@
- -The ZBar Bar Code Reader is Copyright (C) 2007-2009 Jeff Brown
- +The ZBar Bar Code Reader is Copyright (C) 2007-2010 Jeff Brown
- <spadix@users.sourceforge.net>
- The QR Code reader is Copyright (C) 1999-2009 Timothy B. Terriberry
- <tterribe@xiph.org>
- diff --git a/Makefile.am b/Makefile.am
- --- a/Makefile.am
- +++ b/Makefile.am
- @@ -1,6 +1,3 @@
- -AM_CPPFLAGS = -I$(srcdir)/include
- -AM_CFLAGS = -Wall -Wno-parentheses
- -AM_CXXFLAGS = $(AM_CFLAGS)
- ACLOCAL_AMFLAGS = -I config
- bin_PROGRAMS =
- check_PROGRAMS =
- @@ -9,8 +6,10 @@ lib_LTLIBRARIES =
- pyexec_LTLIBRARIES =
- CLEANFILES =
- DISTCLEANFILES =
- +MAINTAINERCLEANFILES =
- BUILT_SOURCES =
- EXTRA_DIST =
- +SUBDIRS = .
-
- pkgconfigdir = $(libdir)/pkgconfig
- pkgconfig_DATA = zbar.pc
- @@ -39,6 +38,9 @@ if HAVE_QT
- include $(srcdir)/qt/Makefile.am.inc
- pkgconfig_DATA += zbar-qt.pc
- endif
- +if HAVE_JAVA
- +SUBDIRS += java
- +endif
- if HAVE_NPAPI
- include $(srcdir)/plugin/Makefile.am.inc
- endif
- @@ -47,11 +49,8 @@ include $(srcdir)/doc/Makefile.am.inc
-
- EXTRA_DIST += zbar.ico zbar.nsi
-
- -EXTRA_DIST += examples/upcrpc.pl examples/upcrpc.py examples/paginate.pl \
- - examples/barcode.png examples/processor.pl examples/processor.py \
- - examples/read_one.py examples/read_one.pl \
- - examples/scan_image.c examples/scan_image.cpp examples/scan_image.pl \
- - examples/scan_image.py examples/scan_image.vcproj
- +EXTRA_DIST += examples/barcode.png examples/upcrpc.py examples/upcrpc.pl \
- + examples/scan_image.c examples/scan_image.cpp examples/scan_image.vcproj
-
- EXTRA_DIST += perl/MANIFEST perl/README perl/Changes perl/COPYING.LIB \
- perl/Makefile.PL perl/typemap perl/ZBar.xs perl/ppport.h \
- diff --git a/configure.ac b/configure.ac
- --- a/configure.ac
- +++ b/configure.ac
- @@ -46,6 +46,13 @@ AC_DEFINE_UNQUOTED([LIB_VERSION_REVISION
- [[`echo "$LIB_VERSION" | sed -e 's/^[^:]*:\([^:]*\):.*$/\1/'`]],
- [Library revision])
-
- +AM_CPPFLAGS="-I$srcdir/include"
- +AM_CFLAGS="-Wall -Wno-parentheses"
- +AM_CXXFLAGS="$AM_CFLAGS"
- +AC_SUBST([AM_CPPFLAGS])
- +AC_SUBST([AM_CFLAGS])
- +AC_SUBST([AM_CXXFLAGS])
- +
- dnl windows build
-
- AC_CANONICAL_HOST
- @@ -73,13 +80,36 @@ documentation generation])
- AC_ARG_VAR([XMLTOFLAGS], [additional arguments for xmlto])
- AC_CHECK_PROGS([XMLTO], [xmlto], [:])
-
- +have_java="maybe"
- +AC_ARG_VAR([JAVA_HOME], [root location of JDK])
- +AS_IF([test "x$JAVA_HOME" = "x"],
- + [JAVA_PATH="$PATH"],
- + [JAVA_PATH="$JAVA_HOME/bin$PATH_SEPARATOR$PATH"])
- +
- +AC_ARG_VAR([JAVAC], [location of Java language compiler])
- +AC_PATH_PROGS([JAVAC], [javac jikes ecj gcj], [:], [$JAVA_PATH])
- +AS_IF([test "x$JAVAC" = "x:"], [have_java="no"])
- +
- +AC_ARG_VAR([JAVAH], [location of Java header generator])
- +AC_PATH_PROGS([JAVAH], [javah], [/bin/false], [$JAVA_PATH])
- +
- +AC_ARG_VAR([JAR], [location of Java archive tool])
- +AC_PATH_PROGS([JAR], [jar], [:], [$JAVA_PATH])
- +AS_IF([test "x$JAR" = "x:"], [have_java="no"])
- +
- +AC_ARG_VAR([JAVA], [location of Java application launcher])
- +AC_PATH_PROGS([JAVA], [java], [/bin/false], [$JAVA_PATH])
- +
- +AC_ARG_VAR([CLASSPATH], [Java class path (include JUnit to run java tests)])
- +AS_IF([test "x$CLASSPATH" = "x"], [CLASSPATH="."])
- +
- dnl symbologies
-
- AC_ARG_ENABLE([codes],
- [AS_HELP_STRING([--enable-codes=SYMS],
- - [select symbologies to compile [default=ean,i25,code39,code128,qrcode]])],
- + [select symbologies to compile [default=ean,databar,code128,code93,code39,i25,qrcode]])],
- [],
- - [enable_codes="ean,code39,code128,i25,qrcode"]) dnl pdf417
- + [enable_codes="ean,databar,code128,code93,code39,i25,qrcode"])
-
- AC_DEFUN([ZBAR_CHK_CODE], [
- AC_MSG_CHECKING([whether to build $2])
- @@ -97,11 +127,13 @@ AC_DEFUN([ZBAR_CHK_CODE], [
- ])dnl
-
- ZBAR_CHK_CODE([ean], [EAN symbologies])
- +ZBAR_CHK_CODE([databar], [DataBar symbology])
- ZBAR_CHK_CODE([code128], [Code 128 symbology])
- +ZBAR_CHK_CODE([code93], [Code 93 symbology])
- ZBAR_CHK_CODE([code39], [Code 39 symbology])
- -ZBAR_CHK_CODE([pdf417], [PDF417 symbology])
- ZBAR_CHK_CODE([i25], [Interleaved 2 of 5 symbology])
- ZBAR_CHK_CODE([qrcode], [QR Code])
- +ZBAR_CHK_CODE([pdf417], [PDF417 symbology])
-
- dnl libraries
-
- @@ -255,7 +287,7 @@ AM_CONDITIONAL([HAVE_JPEG], [test "x$wit
- dnl ImageMagick
- AC_ARG_WITH([imagemagick],
- [AS_HELP_STRING([--without-imagemagick],
- - [disable support for scanning images using ImageMagick])],
- + [disable support for scanning images with ImageMagick])],
- [],
- [with_imagemagick="yes"])
-
- @@ -296,7 +328,7 @@ AM_CONDITIONAL([HAVE_MAGICK], [test "x$w
- dnl Mozilla NPAPI
- AC_ARG_WITH([npapi],
- [AS_HELP_STRING([--with-npapi],
- - [enable support for Firefox/Mozilla/OpenOffice NPAPI plugin])],
- + [enable support for Firefox/Mozilla/OpenOffice plugin])],
- [],
- [with_npapi="no"])
-
- @@ -383,13 +415,38 @@ AS_IF([test "x$with_qt" != "xno"],
-
- AM_CONDITIONAL([HAVE_QT], [test "x$with_qt" = "xyes"])
-
- +dnl Java
- +AC_ARG_WITH([java],
- + [AS_HELP_STRING([--without-java],
- + [disable support for Java interface])],
- + [],
- + [with_java="check"])
- +
- +AC_ARG_VAR([JAVA_CFLAGS], [compiler flags for building JNI extensions])
- +AS_IF([test "x$JAVA_CFLAGS" = "x" && test "x$JAVA_HOME" != "x"],
- + [JAVA_CFLAGS="-I$JAVA_HOME/include"])
- +
- +AS_IF([test "x$with_java" != "xno"],
- + [CPPFLAGS_save="$CPPFLAGS"
- + CPPFLAGS="$CPPFLAGS $JAVA_CFLAGS"
- + AC_CHECK_HEADER([jni.h], [], [have_java="no"])
- + CPPFLAGS="$CPPFLAGS_save"
- + AS_IF([test "x$have_java" != "xno"],
- + [with_java="yes"],
- + [test "x$with_java" = "xyes"],
- + [AC_MSG_FAILURE([unable to find Java JNI! ensure CFLAGS are set
- +appropriately or configure --without-java])],
- + [with_java="no"])
- +])
- +AM_CONDITIONAL([HAVE_JAVA], [test "x$with_java" = "xyes"])
- +
-
- dnl header files
-
- dnl FIXME switches for shm, mmap
- AC_HEADER_ASSERT
- -AC_CHECK_HEADERS([fcntl.h features.h inttypes.h stdlib.h string.h unistd.h \
- - sys/ioctl.h sys/time.h sys/times.h sys/ipc.h sys/shm.h sys/mman.h])
- +AC_CHECK_HEADERS([errno.h fcntl.h features.h inttypes.h stdlib.h string.h \
- + unistd.h sys/ioctl.h sys/time.h sys/times.h sys/ipc.h sys/shm.h sys/mman.h])
-
- dnl types
-
- @@ -428,6 +485,7 @@ AC_CONFIG_COMMANDS([doc/reldate.xml],
-
- AC_CONFIG_FILES([
- Makefile
- +java/Makefile
- zbar.pc
- zbar-gtk.pc
- zbar-qt.pc
- @@ -460,6 +518,9 @@ AS_IF([test "x$with_gtk" != "xyes"],
- echo "Qt4 --with-qt=$with_qt"
- AS_IF([test "x$with_qt" != "xyes"],
- [echo " => the Qt4 widget will *NOT* be built"])
- +echo "Java --with-java=$with_java"
- +AS_IF([test "x$with_java" != "xyes"],
- + [echo " => the Java interface will *NOT* be built"])
- #echo "NPAPI Plugin --with-npapi=$with_npapi"
- #AS_IF([test "x$with_mozilla" != "xyes"],
- # [echo " => the Mozilla/Firefox/OpenOffice plugin will *NOT* be built"])
- diff --git a/doc/Makefile.am.inc b/doc/Makefile.am.inc
- --- a/doc/Makefile.am.inc
- +++ b/doc/Makefile.am.inc
- @@ -2,6 +2,7 @@
- DOCSOURCES = doc/manual.xml doc/version.xml doc/reldate.xml \
- doc/ref/zbarimg.xml doc/ref/zbarcam.xml doc/ref/commonoptions.xml
-
- +MAINTAINERCLEANFILES += doc/man/man.stamp doc/version.xml doc/reldate.xml
-
- # man page targets to distribute and install
- dist_man_MANS =
- diff --git a/doc/api/footer.html b/doc/api/footer.html
- --- a/doc/api/footer.html
- +++ b/doc/api/footer.html
- @@ -9,9 +9,12 @@
-
- <address><a href="mailto:spadix@users.sourceforge.net">spadix@users.sourceforge.net</a></address>
-
- -<p>Copyright 2008-2009 (c) Jeff Brown - All Rights Reserved.</p>
- -<p>Verbatim copying and distribution of this entire article are
- - permitted worldwide, without royalty, in any medium, provided this
- - notice, and the copyright notice, are preserved.</p>
- +<p>Copyright 2008-2010 (c) Jeff Brown</p>
- +<p>This documentation is part of the ZBar Barcode Reader; you can
- +redistribute it and/or modify it under the terms of the
- +<a href="http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html">GNU
- +Lesser General Public License</a> as published by the Free Software
- +Foundation; either version 2.1 of the License, or (at your option) any
- +later version.</p>
-
- </body></html>
- diff --git a/doc/manual.xml b/doc/manual.xml
- --- a/doc/manual.xml
- +++ b/doc/manual.xml
- @@ -29,10 +29,10 @@
- <year>2007</year>
- <year>2008</year>
- <year>2009</year>
- + <year>2010</year>
- <holder>Jeff Brown</holder>
- </copyright>
- <legalnotice><para>All Rights Reserved</para></legalnotice>
- - <!-- <legalnotice><para>insert GNU FDL header?</para></legalnotice> -->
- </bookinfo>
-
- <chapter id="intro">
- @@ -47,7 +47,4 @@
- &refzbarimg;
-
- </reference>
- -
- - <!-- insert GNU FDL? -->
- -
- </book>
- diff --git a/doc/ref/commonoptions.xml b/doc/ref/commonoptions.xml
- --- a/doc/ref/commonoptions.xml
- +++ b/doc/ref/commonoptions.xml
- @@ -47,8 +47,9 @@
- <option>ean13</option>, <option>ean8</option>,
- <option>upca</option>, <option>upce</option>,
- <option>isbn13</option>, <option>isbn10</option>,
- - <option>i25</option>, <option>code39</option>,
- - <option>code128</option> or the special value <option>*</option>.
- + <option>i25</option>, <option>code39</option>, <option>code93</option>,
- + <option>code128</option>, <option>qrcode</option>
- + or the special value <option>*</option>.
- If <replaceable class="parameter">symbology</replaceable> is
- omitted or <option>*</option>, the <replaceable
- class="parameter">config</replaceable> will be set for all
- diff --git a/doc/ref/zbarcam.xml b/doc/ref/zbarcam.xml
- --- a/doc/ref/zbarcam.xml
- +++ b/doc/ref/zbarcam.xml
- @@ -60,9 +60,10 @@
- <filename>/dev/video0</filename></para>
-
- <para>The underlying library currently supports EAN-13 (including
- - UPC and ISBN subsets), EAN-8, Code 128, Code 39, and Interleaved
- - 2 of 5 symbologies. The specific type of each detected symbol is
- - printed with the decoded data.</para>
- + UPC and ISBN subsets), EAN-8, DataBar, DataBar Expanded, Code 128,
- + Code 93, Code 39, Interleaved 2 of 5 and QR Code symbologies. The
- + specific type of each detected symbol is printed with the decoded
- + data.</para>
-
- </refsection>
-
- @@ -160,6 +161,37 @@
- </refsection>
-
- <refsection>
- + <title>Exit Status</title>
- +
- + <para><command>zbarcam</command> returns an exit code to indicate the
- + status of the program execution. Current exit codes are:</para>
- +
- + <variablelist>
- + <varlistentry>
- + <term>0</term>
- + <listitem>
- + <para>Successful program completion.</para>
- + </listitem>
- + </varlistentry>
- +
- + <varlistentry>
- + <term>1</term>
- + <listitem>
- + <para>An error occurred. This includes bad arguments and I/O
- + errors.</para>
- + </listitem>
- + </varlistentry>
- +
- + <varlistentry>
- + <term>2</term>
- + <listitem>
- + <para>A fatal error occurred.</para>
- + </listitem>
- + </varlistentry>
- + </variablelist>
- + </refsection>
- +
- + <refsection>
- <title>See Also</title>
- <para><xref linkend="zbarimg"/></para>
- <para><link xlink:href="http://zbar.sf.net/"/></para>
- diff --git a/doc/ref/zbarimg.xml b/doc/ref/zbarimg.xml
- --- a/doc/ref/zbarimg.xml
- +++ b/doc/ref/zbarimg.xml
- @@ -59,9 +59,10 @@
- displayed to the screen.</para>
-
- <para>The underlying library currently supports EAN-13 (including
- - UPC and ISBN subsets), EAN-8, Code 128, Code 39, and Interleaved
- - 2 of 5 symbologies. The specific type of each detected symbol is
- - printed with the decoded data.</para>
- + UPC and ISBN subsets), EAN-8, DataBar, DataBar Expanded, Code 128,
- + Code 93, Code 39, Interleaved 2 of 5 and QR Code symbologies. The
- + specific type of each detected symbol is printed with the decoded
- + data.</para>
-
- <para>Note that "<filename><replaceable>image</replaceable></filename>"
-
- @@ -166,6 +167,56 @@
- </refsection>
-
- <refsection>
- + <title>Exit Status</title>
- +
- + <para><command>zbarimg</command> returns an exit code to indicate the
- + status of the program execution. Current exit codes are:</para>
- +
- + <variablelist>
- + <varlistentry>
- + <term>0</term>
- + <listitem>
- + <para>Barcodes successfully detected in all images. Warnings may
- + have been generated, but no errors.</para>
- + </listitem>
- + </varlistentry>
- +
- + <varlistentry>
- + <term>1</term>
- + <listitem>
- + <para>An error occurred while processing some image(s). This
- + includes bad arguments, I/O errors and image handling errors from
- + ImageMagick.</para>
- + </listitem>
- + </varlistentry>
- +
- + <varlistentry>
- + <term>2</term>
- + <listitem>
- + <para>ImageMagick fatal error.</para>
- + </listitem>
- + </varlistentry>
- +
- + <varlistentry>
- + <term>3</term>
- + <listitem>
- + <para>The user quit the program before all images were scanned.
- + Only applies when running in interactive mode
- + (with <option>--display</option>)</para>
- + </listitem>
- + </varlistentry>
- +
- + <varlistentry>
- + <term>4</term>
- + <listitem>
- + <para>No barcode was detected in one or more of the images. No
- + other errors occurred.</para>
- + </listitem>
- + </varlistentry>
- + </variablelist>
- + </refsection>
- +
- + <refsection>
- <title>See Also</title>
- <para><xref linkend="zbarcam"/></para>
- <para><link xlink:href="http://zbar.sf.net/"/></para>
- diff --git a/examples/paginate.pl b/examples/paginate.pl
- deleted file mode 100755
- --- a/examples/paginate.pl
- +++ /dev/null
- @@ -1,71 +0,0 @@
- -#!/usr/bin/perl
- -#------------------------------------------------------------------------
- -# Copyright 2009 (c) Jeff Brown <spadix@users.sourceforge.net>
- -#
- -# This file is part of the ZBar Bar Code Reader.
- -#
- -# The ZBar Bar Code Reader is free software; you can redistribute it
- -# and/or modify it under the terms of the GNU Lesser Public License as
- -# published by the Free Software Foundation; either version 2.1 of
- -# the License, or (at your option) any later version.
- -#
- -# The ZBar Bar Code Reader is distributed in the hope that it will be
- -# useful, but WITHOUT ANY WARRANTY; without even the implied warranty
- -# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- -# GNU Lesser Public License for more details.
- -#
- -# You should have received a copy of the GNU Lesser Public License
- -# along with the ZBar Bar Code Reader; if not, write to the Free
- -# Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- -# Boston, MA 02110-1301 USA
- -#
- -# http://sourceforge.net/projects/zbar
- -#------------------------------------------------------------------------
- -use warnings;
- -use strict;
- -
- -use Barcode::ZBar;
- -use Image::Magick;
- -
- -warn("no input files specified?\n") if(!@ARGV);
- -
- -# running output document
- -my $out = undef;
- -
- -# barcode scanner
- -my $scanner = Barcode::ZBar::ImageScanner->new();
- -
- -foreach my $file (@ARGV) {
- - print "scanning from \"$file\"\n";
- - my $imseq = Image::Magick->new();
- - my $err = $imseq->Read($file);
- - warn($err) if($err);
- -
- - foreach my $page (@$imseq) {
- - # convert ImageMagick page to ZBar image
- - my $zimg = Barcode::ZBar::Image->new();
- - $zimg->set_format('Y800');
- - $zimg->set_size($page->Get(qw(columns rows)));
- - $zimg->set_data($page->Clone()->ImageToBlob(magick => 'GRAY', depth => 8));
- -
- - # scan for barcodes
- - if($scanner->scan_image($zimg)) {
- - # write out previous document
- - $out->write() if($out);
- -
- - # use first symbol found to name next image (FIXME sanitize)
- - my $data = ($zimg->get_symbols())[0]->get_data();
- - my $idx = $page->Get('scene') + 1;
- - print "splitting $data from page $idx\n";
- -
- - # create new output document
- - $out = Image::Magick->new(filename => $data);
- - }
- -
- - # append this page to current output
- - push(@$out, $page) if($out);
- - }
- -
- - # write out final document
- - $out->write() if($out);
- -}
- diff --git a/examples/processor.c b/examples/processor.c
- new file mode 100644
- --- /dev/null
- +++ b/examples/processor.c
- @@ -0,0 +1,47 @@
- +#include <stdio.h>
- +#include <zbar.h>
- +
- +static void my_handler (zbar_image_t *image,
- + const void *userdata)
- +{
- + /* extract results */
- + const zbar_symbol_t *symbol = zbar_image_first_symbol(image);
- + for(; symbol; symbol = zbar_symbol_next(symbol)) {
- + /* do something useful with results */
- + zbar_symbol_type_t typ = zbar_symbol_get_type(symbol);
- + const char *data = zbar_symbol_get_data(symbol);
- + printf("decoded %s symbol \"%s\"\n",
- + zbar_get_symbol_name(typ), data);
- + }
- +}
- +
- +int main (int argc, char **argv)
- +{
- + const char *device = "/dev/video0";
- +
- + /* create a Processor */
- + zbar_processor_t *proc = zbar_processor_create(1);
- +
- + /* configure the Processor */
- + zbar_processor_set_config(proc, 0, ZBAR_CFG_ENABLE, 1);
- +
- + /* initialize the Processor */
- + if(argc > 1)
- + device = argv[1];
- + zbar_processor_init(proc, device, 1);
- +
- + /* setup a callback */
- + zbar_processor_set_data_handler(proc, my_handler, NULL);
- +
- + /* enable the preview window */
- + zbar_processor_set_visible(proc, 1);
- + zbar_processor_set_active(proc, 1);
- +
- + /* keep scanning until user provides key/mouse input */
- + zbar_processor_user_wait(proc, -1);
- +
- + /* clean up */
- + zbar_processor_destroy(proc);
- +
- + return(0);
- +}
- diff --git a/examples/processor.cpp b/examples/processor.cpp
- new file mode 100644
- --- /dev/null
- +++ b/examples/processor.cpp
- @@ -0,0 +1,45 @@
- +#include <iostream>
- +#include <zbar.h>
- +
- +using namespace std;
- +using namespace zbar;
- +
- +class MyHandler : public Image::Handler
- +{
- + void image_callback (Image &image)
- + {
- + for(SymbolIterator symbol = image.symbol_begin();
- + symbol != image.symbol_end();
- + ++symbol)
- + cout << "decoded " << symbol->get_type_name() << " symbol "
- + << "\"" << symbol->get_data() << "\"" << endl;
- + }
- +};
- +
- +int main (int argc, char **argv)
- +{
- + // create and initialize a Processor
- + const char *device = "/dev/video0";
- + if(argc > 1)
- + device = argv[1];
- + Processor proc(true, device);
- +
- + // configure the Processor
- + proc.set_config(ZBAR_NONE, ZBAR_CFG_ENABLE, 1);
- +
- + // setup a callback
- + MyHandler my_handler;
- + proc.set_handler(my_handler);
- +
- + // enable the preview window
- + proc.set_visible();
- + proc.set_active();
- +
- + try {
- + // keep scanning until user provides key/mouse input
- + proc.user_wait();
- + }
- + catch(ClosedError &e) {
- + }
- + return(0);
- +}
- diff --git a/examples/processor.pl b/examples/processor.pl
- deleted file mode 100755
- --- a/examples/processor.pl
- +++ /dev/null
- @@ -1,35 +0,0 @@
- -#!/usr/bin/env perl
- -use warnings;
- -use strict;
- -require Barcode::ZBar;
- -
- -# create a Processor
- -my $proc = Barcode::ZBar::Processor->new();
- -
- -# configure the Processor
- -$proc->parse_config("enable");
- -
- -# initialize the Processor
- -$proc->init($ARGV[0] || '/dev/video0');
- -
- -# setup a callback
- -sub my_handler {
- - my ($proc, $image, $closure) = @_;
- -
- - # extract results
- - foreach my $symbol ($proc->get_results()) {
- - # do something useful with results
- - print('decoded ' . $symbol->get_type() .
- - ' symbol "' . $symbol->get_data() . "\"\n");
- - }
- -}
- -$proc->set_data_handler(\&my_handler);
- -
- -# enable the preview window
- -$proc->set_visible();
- -
- -# initiate scanning
- -$proc->set_active();
- -
- -# keep scanning until user provides key/mouse input
- -$proc->user_wait();
- diff --git a/examples/read_one.pl b/examples/read_one.pl
- deleted file mode 100755
- --- a/examples/read_one.pl
- +++ /dev/null
- @@ -1,29 +0,0 @@
- -#!/usr/bin/env perl
- -use warnings;
- -use strict;
- -require Barcode::ZBar;
- -
- -# create a Processor
- -my $proc = Barcode::ZBar::Processor->new();
- -
- -# configure the Processor
- -$proc->parse_config("enable");
- -
- -# initialize the Processor
- -$proc->init($ARGV[0] || '/dev/video0');
- -
- -# enable the preview window
- -$proc->set_visible();
- -
- -# read at least one barcode (or until window closed)
- -$proc->process_one();
- -
- -# hide the preview window
- -$proc->set_visible(0);
- -
- -# extract results
- -foreach my $symbol ($proc->get_results()) {
- - # do something useful with results
- - print('decoded ' . $symbol->get_type() .
- - ' symbol "' . $symbol->get_data() . "\"\n");
- -}
- diff --git a/examples/scan_image.c b/examples/scan_image.c
- --- a/examples/scan_image.c
- +++ b/examples/scan_image.c
- @@ -65,7 +65,7 @@ int main (int argc, char **argv)
-
- /* wrap image data */
- zbar_image_t *image = zbar_image_create();
- - zbar_image_set_format(image, *(int*)"Y800");
- + zbar_image_set_format(image, zbar_fourcc('Y','8','0','0'));
- zbar_image_set_size(image, width, height);
- zbar_image_set_data(image, raw, width * height, zbar_image_free_data);
-
- diff --git a/examples/scan_image.pl b/examples/scan_image.pl
- deleted file mode 100755
- --- a/examples/scan_image.pl
- +++ /dev/null
- @@ -1,37 +0,0 @@
- -#!/usr/bin/perl
- -use warnings;
- -use strict;
- -require Image::Magick;
- -require Barcode::ZBar;
- -
- -$ARGV[0] || die;
- -
- -# create a reader
- -my $scanner = Barcode::ZBar::ImageScanner->new();
- -
- -# configure the reader
- -$scanner->parse_config("enable");
- -
- -# obtain image data
- -my $magick = Image::Magick->new();
- -$magick->Read($ARGV[0]) && die;
- -my $raw = $magick->ImageToBlob(magick => 'GRAY', depth => 8);
- -
- -# wrap image data
- -my $image = Barcode::ZBar::Image->new();
- -$image->set_format('Y800');
- -$image->set_size($magick->Get(qw(columns rows)));
- -$image->set_data($raw);
- -
- -# scan the image for barcodes
- -my $n = $scanner->scan_image($image);
- -
- -# extract results
- -foreach my $symbol ($image->get_symbols()) {
- - # do something useful with results
- - print('decoded ' . $symbol->get_type() .
- - ' symbol "' . $symbol->get_data() . "\"\n");
- -}
- -
- -# clean up
- -undef($image);
- diff --git a/examples/upcrpc.pl b/examples/upcrpc.pl
- --- a/examples/upcrpc.pl
- +++ b/examples/upcrpc.pl
- @@ -3,7 +3,7 @@ use warnings;
- use strict;
- use Frontier::Client;
- use Data::Dumper;
- -my $s = Frontier::Client->new('url' => 'http://dev.upcdatabase.com/rpc');
- +my $s = Frontier::Client->new('url' => 'http://www.upcdatabase.com/rpc');
-
- $| = 1; # autoflush
-
- diff --git a/examples/upcrpc.py b/examples/upcrpc.py
- --- a/examples/upcrpc.py
- +++ b/examples/upcrpc.py
- @@ -2,7 +2,7 @@
- from xmlrpclib import ServerProxy
- import sys, re
-
- -server = ServerProxy("http://dev.upcdatabase.com/rpc")
- +server = ServerProxy("http://www.upcdatabase.com/rpc")
- ean_re = re.compile(r'^(UPC-A:|EAN-13:)?(\d{11,13})$', re.M)
-
- def lookup(decode):
- diff --git a/gtk/zbargtk.c b/gtk/zbargtk.c
- --- a/gtk/zbargtk.c
- +++ b/gtk/zbargtk.c
- @@ -1,5 +1,5 @@
- /*------------------------------------------------------------------------
- - * Copyright 2008-2009 (c) Jeff Brown <spadix@users.sourceforge.net>
- + * Copyright 2008-2010 (c) Jeff Brown <spadix@users.sourceforge.net>
- *
- * This file is part of the ZBar Bar Code Reader.
- *
- @@ -35,11 +35,6 @@
- #define DEFAULT_WIDTH 640
- #define DEFAULT_HEIGHT 480
-
- -/* adapted from v4l2 spec */
- -#define fourcc(a, b, c, d) \
- - ((long)(a) | ((long)(b) << 8) | \
- - ((long)(c) << 16) | ((long)(d) << 24))
- -
- enum {
- DECODED,
- DECODED_TEXT,
- @@ -88,15 +83,15 @@ gboolean zbar_gtk_image_from_pixbuf (zba
-
- /* these are all guesses... */
- if(nchannels == 3 && bps == 8)
- - type = fourcc('R','G','B','3');
- + type = zbar_fourcc('R','G','B','3');
- else if(nchannels == 4 && bps == 8)
- - type = fourcc('B','G','R','4'); /* FIXME alpha flipped?! */
- + type = zbar_fourcc('B','G','R','4'); /* FIXME alpha flipped?! */
- else if(nchannels == 1 && bps == 8)
- - type = fourcc('Y','8','0','0');
- + type = zbar_fourcc('Y','8','0','0');
- else if(nchannels == 3 && bps == 5)
- - type = fourcc('R','G','B','R');
- + type = zbar_fourcc('R','G','B','R');
- else if(nchannels == 3 && bps == 4)
- - type = fourcc('R','4','4','4'); /* FIXME maybe? */
- + type = zbar_fourcc('R','4','4','4'); /* FIXME maybe? */
- else {
- g_warning("unsupported combination: nchannels=%d bps=%d\n",
- nchannels, bps);
- @@ -142,10 +137,6 @@ static inline gboolean zbar_gtk_video_op
-
- gdk_threads_enter();
-
- - zbar->req_width = DEFAULT_WIDTH;
- - zbar->req_height = DEFAULT_HEIGHT;
- - gtk_widget_queue_resize(GTK_WIDGET(self));
- -
- zbar->video_opened = FALSE;
- if(zbar->thread)
- g_object_notify(G_OBJECT(self), "video-opened");
- @@ -184,6 +175,10 @@ static inline gboolean zbar_gtk_video_op
- */
- gdk_threads_enter();
-
- + if(zbar->video_width && zbar->video_height)
- + zbar_video_request_size(zbar->video,
- + zbar->video_width, zbar->video_height);
- +
- video_opened = !zbar_negotiate_format(zbar->video, zbar->window);
-
- if(video_opened) {
- @@ -209,7 +204,7 @@ static inline int zbar_gtk_process_image
- if(!image)
- return(-1);
-
- - zbar_image_t *tmp = zbar_image_convert(image, fourcc('Y','8','0','0'));
- + zbar_image_t *tmp = zbar_image_convert(image, zbar_fourcc('Y','8','0','0'));
- if(!tmp)
- return(-1);
-
- @@ -560,6 +555,19 @@ gboolean zbar_gtk_get_video_opened (ZBar
- return(zbar->video_opened);
- }
-
- +void zbar_gtk_request_video_size (ZBarGtk *self,
- + int width,
- + int height)
- +{
- + if(!self->_private || width < 0 || height < 0)
- + return;
- + ZBarGtkPrivate *zbar = ZBAR_GTK_PRIVATE(self->_private);
- +
- + zbar->req_width = zbar->video_width = width;
- + zbar->req_height = zbar->video_height = height;
- + gtk_widget_queue_resize(GTK_WIDGET(self));
- +}
- +
- static void zbar_gtk_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- @@ -613,8 +621,8 @@ static void zbar_gtk_init (ZBarGtk *self
- zbar->window = zbar_window_create();
- g_assert(zbar->window);
-
- - zbar->req_width = DEFAULT_WIDTH;
- - zbar->req_height = DEFAULT_HEIGHT;
- + zbar->req_width = zbar->video_width = DEFAULT_WIDTH;
- + zbar->req_height = zbar->video_width = DEFAULT_HEIGHT;
-
- /* spawn a thread to handle decoding and video */
- zbar->queue = g_async_queue_new();
- diff --git a/gtk/zbargtkprivate.h b/gtk/zbargtkprivate.h
- --- a/gtk/zbargtkprivate.h
- +++ b/gtk/zbargtkprivate.h
- @@ -71,6 +71,7 @@ typedef struct _ZBarGtkPrivate
- * protected by main gui lock
- */
- unsigned req_width, req_height;
- + unsigned video_width, video_height;
- gboolean video_opened;
-
- /* window is shared: owned by main gui thread.
- diff --git a/include/zbar.h b/include/zbar.h
- --- a/include/zbar.h
- +++ b/include/zbar.h
- @@ -1,5 +1,5 @@
- /*------------------------------------------------------------------------
- - * Copyright 2007-2009 (c) Jeff Brown <spadix@users.sourceforge.net>
- + * Copyright 2007-2010 (c) Jeff Brown <spadix@users.sourceforge.net>
- *
- * This file is part of the ZBar Bar Code Reader.
- *
- @@ -93,9 +93,12 @@ typedef enum zbar_symbol_type_e {
- ZBAR_EAN13 = 13, /**< EAN-13 */
- ZBAR_ISBN13 = 14, /**< ISBN-13 (from EAN-13). @since 0.4 */
- ZBAR_I25 = 25, /**< Interleaved 2 of 5. @since 0.4 */
- + ZBAR_DATABAR = 34, /**< GS1 DataBar (RSS). @since 0.11 */
- + ZBAR_DATABAR_EXP = 35, /**< GS1 DataBar Expanded. @since 0.11 */
- ZBAR_CODE39 = 39, /**< Code 39. @since 0.4 */
- ZBAR_PDF417 = 57, /**< PDF417. @since 0.6 */
- ZBAR_QRCODE = 64, /**< QR Code. @since 0.10 */
- + ZBAR_CODE93 = 93, /**< Code 93. @since 0.11 */
- ZBAR_CODE128 = 128, /**< Code 128 */
- ZBAR_SYMBOL = 0x00ff, /**< mask for base symbol type */
- ZBAR_ADDON2 = 0x0200, /**< 2-digit add-on flag */
- @@ -103,6 +106,17 @@ typedef enum zbar_symbol_type_e {
- ZBAR_ADDON = 0x0700, /**< add-on flag mask */
- } zbar_symbol_type_t;
-
- +/** decoded symbol coarse orientation.
- + * @since 0.11
- + */
- +typedef enum zbar_orientation_e {
- + ZBAR_ORIENT_UNKNOWN = -1, /**< unable to determine orientation */
- + ZBAR_ORIENT_UP, /**< upright, read left to right */
- + ZBAR_ORIENT_RIGHT, /**< sideways, read top to bottom */
- + ZBAR_ORIENT_DOWN, /**< upside-down, read right to left */
- + ZBAR_ORIENT_LEFT, /**< sideways, read bottom to top */
- +} zbar_orientation_t;
- +
- /** error codes. */
- typedef enum zbar_error_e {
- ZBAR_OK = 0, /**< no error */
- @@ -133,12 +147,33 @@ typedef enum zbar_config_e {
- ZBAR_CFG_MIN_LEN = 0x20, /**< minimum data length for valid decode */
- ZBAR_CFG_MAX_LEN, /**< maximum data length for valid decode */
-
- + ZBAR_CFG_UNCERTAINTY = 0x40,/**< required video consistency frames */
- +
- ZBAR_CFG_POSITION = 0x80, /**< enable scanner to collect position data */
-
- ZBAR_CFG_X_DENSITY = 0x100, /**< image scanner vertical scan density */
- ZBAR_CFG_Y_DENSITY, /**< image scanner horizontal scan density */
- } zbar_config_t;
-
- +/** decoder symbology modifier flags.
- + * @since 0.11
- + */
- +typedef enum zbar_modifier_e {
- + /** barcode tagged as GS1 (EAN.UCC) reserved
- + * (eg, FNC1 before first data character).
- + * data may be parsed as a sequence of GS1 AIs
- + */
- + ZBAR_MOD_GS1 = 0,
- +
- + /** barcode tagged as AIM reserved
- + * (eg, FNC1 after first character or digit pair)
- + */
- + ZBAR_MOD_AIM,
- +
- + /** number of modifiers */
- + ZBAR_MOD_NUM,
- +} zbar_modifier_t;
- +
- /** retrieve runtime library version information.
- * @param major set to the running major version (unless NULL)
- * @param minor set to the running minor version (unless NULL)
- @@ -171,6 +206,28 @@ extern const char *zbar_get_symbol_name(
- */
- extern const char *zbar_get_addon_name(zbar_symbol_type_t sym);
-
- +/** retrieve string name for configuration setting.
- + * @param config setting to name
- + * @returns static string name for config,
- + * or the empty string if value is not a known config
- + */
- +extern const char *zbar_get_config_name(zbar_config_t config);
- +
- +/** retrieve string name for modifier.
- + * @param modifier flag to name
- + * @returns static string name for modifier,
- + * or the empty string if the value is not a known flag
- + */
- +extern const char *zbar_get_modifier_name(zbar_modifier_t modifier);
- +
- +/** retrieve string name for orientation.
- + * @param orientation orientation encoding
- + * @returns the static string name for the specified orientation,
- + * or "UNKNOWN" if the orientation is not recognized
- + * @since 0.11
- + */
- +extern const char *zbar_get_orientation_name(zbar_orientation_t orientation);
- +
- /** parse a configuration string of the form "[symbology.]config[=value]".
- * the config must match one of the recognized names.
- * the symbology, if present, must match one of the recognized names.
- @@ -184,6 +241,30 @@ extern int zbar_parse_config(const char
- zbar_config_t *config,
- int *value);
-
- +/** consistently compute fourcc values across architectures
- + * (adapted from v4l2 specification)
- + * @since 0.11
- + */
- +#define zbar_fourcc(a, b, c, d) \
- + ((unsigned long)(a) | \
- + ((unsigned long)(b) << 8) | \
- + ((unsigned long)(c) << 16) | \
- + ((unsigned long)(d) << 24))
- +
- +/** parse a fourcc string into its encoded integer value.
- + * @since 0.11
- + */
- +static inline unsigned long zbar_fourcc_parse (const char *format)
- +{
- + unsigned long fourcc = 0;
- + if(format) {
- + int i;
- + for(i = 0; i < 4 && format[i]; i++)
- + fourcc |= ((unsigned long)format[i]) << (i * 8);
- + }
- + return(fourcc);
- +}
- +
- /** @internal type unsafe error API (don't use) */
- extern int _zbar_error_spew(const void *object,
- int verbosity);
- @@ -229,6 +310,20 @@ extern void zbar_symbol_ref(const zbar_s
- */
- extern zbar_symbol_type_t zbar_symbol_get_type(const zbar_symbol_t *symbol);
-
- +/** retrieve symbology boolean config settings.
- + * @returns a bitmask indicating which configs were set for the detected
- + * symbology during decoding.
- + * @since 0.11
- + */
- +extern unsigned int zbar_symbol_get_configs(const zbar_symbol_t *symbol);
- +
- +/** retrieve symbology modifier flag settings.
- + * @returns a bitmask indicating which characteristics were detected
- + * during decoding.
- + * @since 0.11
- + */
- +extern unsigned int zbar_symbol_get_modifiers(const zbar_symbol_t *symbol);
- +
- /** retrieve data decoded from symbol.
- * @returns the data string
- */
- @@ -284,6 +379,14 @@ extern int zbar_symbol_get_loc_x(const z
- extern int zbar_symbol_get_loc_y(const zbar_symbol_t *symbol,
- unsigned index);
-
- +/** retrieve general orientation of decoded symbol.
- + * @returns a coarse, axis-aligned indication of symbol orientation or
- + * ZBAR_ORIENT_UNKNOWN if unknown
- + * @since 0.11
- + */
- +extern zbar_orientation_t
- +zbar_symbol_get_orientation(const zbar_symbol_t *symbol);
- +
- /** iterate the set to which this symbol belongs (there can be only one).
- * @returns the next symbol in the set, or
- * @returns NULL when no more results are available
- @@ -357,6 +460,14 @@ extern int zbar_symbol_set_get_size(cons
- extern const zbar_symbol_t*
- zbar_symbol_set_first_symbol(const zbar_symbol_set_t *symbols);
-
- +/** raw result iterator.
- + * @returns the first decoded symbol result in a set, *before* filtering
- + * @returns NULL if the set is empty
- + * @since 0.11
- + */
- +extern const zbar_symbol_t*
- +zbar_symbol_set_first_unfiltered(const zbar_symbol_set_t *symbols);
- +
- /*@}*/
-
- /*------------------------------------------------------------*/
- @@ -456,6 +567,25 @@ extern unsigned zbar_image_get_width(con
- */
- extern unsigned zbar_image_get_height(const zbar_image_t *image);
-
- +/** retrieve both dimensions of the image.
- + * fills in the width and height in samples
- + */
- +extern void zbar_image_get_size(const zbar_image_t *image,
- + unsigned *width,
- + unsigned *height);
- +
- +/** retrieve the crop rectangle.
- + * fills in the image coordinates of the upper left corner and size
- + * of an axis-aligned rectangular area of the image that will be scanned.
- + * defaults to the full image
- + * @since 0.11
- + */
- +extern void zbar_image_get_crop(const zbar_image_t *image,
- + unsigned *x,
- + unsigned *y,
- + unsigned *width,
- + unsigned *height);
- +
- /** return the image sample data. the returned data buffer is only
- * valid until zbar_image_destroy() is called
- */
- @@ -505,12 +635,24 @@ extern void zbar_image_set_sequence(zbar
- unsigned sequence_num);
-
- /** specify the pixel size of the image.
- + * @note this also resets the crop rectangle to the full image
- + * (0, 0, width, height)
- * @note this does not affect the data!
- */
- extern void zbar_image_set_size(zbar_image_t *image,
- unsigned width,
- unsigned height);
-
- +/** specify a rectangular region of the image to scan.
- + * the rectangle will be clipped to the image boundaries.
- + * defaults to the full image specified by zbar_image_set_size()
- + */
- +extern void zbar_image_set_crop(zbar_image_t *image,
- + unsigned x,
- + unsigned y,
- + unsigned width,
- + unsigned height);
- +
- /** specify image sample data. when image data is no longer needed by
- * the library the specific data cleanup handler will be called
- * (unless NULL)
- @@ -1148,6 +1290,14 @@ static inline int zbar_decoder_parse_con
- zbar_decoder_set_config(decoder, sym, cfg, val));
- }
-
- +/** retrieve symbology boolean config settings.
- + * @returns a bitmask indicating which configs are currently set for the
- + * specified symbology.
- + * @since 0.11
- + */
- +extern unsigned int zbar_decoder_get_configs(const zbar_decoder_t *decoder,
- + zbar_symbol_type_t symbology);
- +
- /** clear all decoder state.
- * any partial symbols are flushed
- */
- @@ -1195,6 +1345,20 @@ zbar_decoder_get_data_length(const zbar_
- extern zbar_symbol_type_t
- zbar_decoder_get_type(const zbar_decoder_t *decoder);
-
- +/** retrieve modifier flags for the last decoded symbol.
- + * @returns a bitmask indicating which characteristics were detected
- + * during decoding.
- + * @since 0.11
- + */
- +extern unsigned int zbar_decoder_get_modifiers(const zbar_decoder_t *decoder);
- +
- +/** retrieve last decode direction.
- + * @returns 1 for forward and -1 for reverse
- + * @returns 0 if the decode direction is unknown or does not apply
- + * @since 0.11
- + */
- +extern int zbar_decoder_get_direction(const zbar_decoder_t *decoder);
- +
- /** setup data handler callback.
- * the registered function will be called by the decoder
- * just before zbar_decode_width() returns a non-zero value.
- diff --git a/include/zbar/Decoder.h b/include/zbar/Decoder.h
- --- a/include/zbar/Decoder.h
- +++ b/include/zbar/Decoder.h
- @@ -1,5 +1,5 @@
- //------------------------------------------------------------------------
- -// Copyright 2007-2009 (c) Jeff Brown <spadix@users.sourceforge.net>
- +// Copyright 2007-2010 (c) Jeff Brown <spadix@users.sourceforge.net>
- //
- // This file is part of the ZBar Bar Code Reader.
- //
- @@ -149,6 +149,14 @@ class Decoder {
- return(zbar_decoder_get_data_length(_decoder));
- }
-
- + /// retrieve last decode direction.
- + /// see zbar_decoder_get_direction()
- + /// @since 0.11
- + int get_direction() const
- + {
- + return(zbar_decoder_get_direction(_decoder));
- + }
- +
- /// setup callback to handle result data.
- void set_handler (Handler &handler)
- {
- diff --git a/include/zbar/Image.h b/include/zbar/Image.h
- --- a/include/zbar/Image.h
- +++ b/include/zbar/Image.h
- @@ -1,5 +1,5 @@
- //------------------------------------------------------------------------
- -// Copyright 2007-2009 (c) Jeff Brown <spadix@users.sourceforge.net>
- +// Copyright 2007-2010 (c) Jeff Brown <spadix@users.sourceforge.net>
- //
- // This file is part of the ZBar Bar Code Reader.
- //
- @@ -67,7 +67,12 @@ public:
- {
- if(userdata) {
- Image *image = (Image*)zbar_image_get_userdata(zimg);
- - ((Handler*)userdata)->image_callback(*image);
- + if(image)
- + ((Handler*)userdata)->image_callback(*image);
- + else {
- + Image tmp(zimg, 1);
- + ((Handler*)userdata)->image_callback(tmp);
- + }
- }
- }
- };
- @@ -110,6 +115,8 @@ public:
-
- ~Image ()
- {
- + set_data(NULL, 0);
- + zbar_image_set_userdata(_img, NULL);
- zbar_image_ref(_img, -1);
- }
-
- @@ -143,12 +150,7 @@ public:
- /// see zbar_image_set_format()
- void set_format (const std::string& format)
- {
- - if(format.length() != 4)
- - throw FormatError();
- - unsigned long fourcc = ((format[0] & 0xff) |
- - ((format[1] & 0xff) << 8) |
- - ((format[2] & 0xff) << 16) |
- - ((format[3] & 0xff) << 24));
- + unsigned long fourcc = zbar_fourcc_parse(format.c_str());
- zbar_image_set_format(_img, fourcc);
- }
-
- @@ -183,6 +185,15 @@ public:
- return(zbar_image_get_height(_img));
- }
-
- + /// retrieve both dimensions of the image.
- + /// see zbar_image_get_size()
- + /// @since 0.11
- + void get_size (unsigned &width,
- + unsigned &height) const
- + {
- + zbar_image_get_size(_img, &width, &height);
- + }
- +
- /// specify the pixel size of the image.
- /// see zbar_image_set_size()
- void set_size (unsigned width,
- @@ -191,6 +202,26 @@ public:
- zbar_image_set_size(_img, width, height);
- }
-
- + /// retrieve the scan crop rectangle.
- + /// see zbar_image_get_crop()
- + void get_crop (unsigned &x,
- + unsigned &y,
- + unsigned &width,
- + unsigned &height) const
- + {
- + zbar_image_get_crop(_img, &x, &y, &width, &height);
- + }
- +
- + /// set the scan crop rectangle.
- + /// see zbar_image_set_crop()
- + void set_crop (unsigned x,
- + unsigned y,
- + unsigned width,
- + unsigned height)
- + {
- + zbar_image_set_crop(_img, x, y, width, height);
- + }
- +
- /// return the image sample data.
- /// see zbar_image_get_data()
- const void *get_data () const
- diff --git a/include/zbar/Processor.h b/include/zbar/Processor.h
- --- a/include/zbar/Processor.h
- +++ b/include/zbar/Processor.h
- @@ -1,5 +1,5 @@
- //------------------------------------------------------------------------
- -// Copyright 2007-2009 (c) Jeff Brown <spadix@users.sourceforge.net>
- +// Copyright 2007-2010 (c) Jeff Brown <spadix@users.sourceforge.net>
- //
- // This file is part of the ZBar Bar Code Reader.
- //
- @@ -183,8 +183,8 @@ class Processor {
- void force_format (std::string& input_format,
- std::string& output_format)
- {
- - unsigned long ifourcc = *(unsigned long*)input_format.c_str();
- - unsigned long ofourcc = *(unsigned long*)output_format.c_str();
- + unsigned long ifourcc = zbar_fourcc_parse(input_format.c_str());
- + unsigned long ofourcc = zbar_fourcc_parse(output_format.c_str());
- if(zbar_processor_force_format(_processor, ifourcc, ofourcc))
- throw_exception(_processor);
- }
- diff --git a/include/zbar/QZBarImage.h b/include/zbar/QZBarImage.h
- --- a/include/zbar/QZBarImage.h
- +++ b/include/zbar/QZBarImage.h
- @@ -1,5 +1,5 @@
- //------------------------------------------------------------------------
- -// Copyright 2008-2009 (c) Jeff Brown <spadix@users.sourceforge.net>
- +// Copyright 2008-2010 (c) Jeff Brown <spadix@users.sourceforge.net>
- //
- // This file is part of the ZBar Bar Code Reader.
- //
- @@ -53,7 +53,7 @@ public:
- unsigned width = bpl / 4;
- unsigned height = qimg.height();
- set_size(width, height);
- - set_format('B' | ('G' << 8) | ('R' << 16) | ('4' << 24));
- + set_format(zbar_fourcc('B','G','R','4'));
- unsigned long datalen = qimg.numBytes();
- set_data(qimg.bits(), datalen);
-
- diff --git a/include/zbar/Symbol.h b/include/zbar/Symbol.h
- --- a/include/zbar/Symbol.h
- +++ b/include/zbar/Symbol.h
- @@ -1,5 +1,5 @@
- //------------------------------------------------------------------------
- -// Copyright 2007-2009 (c) Jeff Brown <spadix@users.sourceforge.net>
- +// Copyright 2007-2010 (c) Jeff Brown <spadix@users.sourceforge.net>
- //
- // This file is part of the ZBar Bar Code Reader.
- //
- @@ -64,6 +64,21 @@ public:
- ref(-1);
- }
-
- + /// assignment.
- + SymbolSet& operator= (const SymbolSet& syms)
- + {
- + syms.ref();
- + ref(-1);
- + _syms = syms._syms;
- + return(*this);
- + }
- +
- + /// truth testing.
- + bool operator! () const
- + {
- + return(!_syms || !get_size());
- + }
- +
- /// manipulate reference count.
- void ref (int delta = 1) const
- {
- @@ -77,7 +92,7 @@ public:
- return(_syms);
- }
-
- - int get_size ()
- + int get_size () const
- {
- return((_syms) ? zbar_symbol_set_get_size(_syms) : 0);
- }
- @@ -112,9 +127,16 @@ public:
-
- /// copy constructor.
- Point (const Point& pt)
- + : x(pt.x),
- + y(pt.y)
- + { }
- +
- + /// assignment.
- + Point& operator= (const Point& pt)
- {
- x = pt.x;
- y = pt.y;
- + return(*this);
- }
- };
-
- @@ -135,7 +157,7 @@ public:
- _index = -1;
- }
-
- - /// constructor.
- + /// copy constructor.
- PointIterator (const PointIterator& iter)
- : _sym(iter._sym),
- _index(iter._index)
- @@ -149,6 +171,22 @@ public:
- _sym->ref(-1);
- }
-
- + /// assignment.
- + PointIterator& operator= (const PointIterator& iter)
- + {
- + iter._sym->ref();
- + _sym->ref(-1);
- + _sym = iter._sym;
- + _index = iter._index;
- + return(*this);
- + }
- +
- + /// truth testing.
- + bool operator! () const
- + {
- + return(!_sym || _index < 0);
- + }
- +
- /// advance iterator to next Point.
- PointIterator& operator++ ()
- {
- @@ -161,7 +199,9 @@ public:
- /// retrieve currently referenced Point.
- const Point operator* () const
- {
- - assert(_index >= 0);
- + assert(!!*this);
- + if(!*this)
- + return(Point());
- return(Point(zbar_symbol_get_loc_x(*_sym, _index),
- zbar_symbol_get_loc_y(*_sym, _index)));
- }
- @@ -213,6 +253,32 @@ public:
- ref(-1);
- }
-
- + /// assignment.
- + Symbol& operator= (const Symbol& sym)
- + {
- + sym.ref(1);
- + ref(-1);
- + _sym = sym._sym;
- + _type = sym._type;
- + _data = sym._data;
- + return(*this);
- + }
- +
- + Symbol& operator= (const zbar_symbol_t *sym)
- + {
- + if(sym)
- + zbar_symbol_ref(sym, 1);
- + ref(-1);
- + init(sym);
- + return(*this);
- + }
- +
- + /// truth testing.
- + bool operator! () const
- + {
- + return(!_sym);
- + }
- +
- void ref (int delta = 1) const
- {
- if(_sym)
- @@ -311,6 +377,13 @@ public:
- return((_sym) ? zbar_symbol_get_loc_y(_sym, index) : -1);
- }
-
- + /// see zbar_symbol_get_orientation().
- + /// @since 0.11
- + int get_orientation () const
- + {
- + return(zbar_symbol_get_orientation(_sym));
- + }
- +
- /// see zbar_symbol_xml().
- const std::string xml () const
- {
- @@ -320,9 +393,6 @@ public:
- }
-
- protected:
- -
- - friend class SymbolIterator;
- -
- /// (re)initialize Symbol from C symbol object.
- void init (const zbar_symbol_t *sym = NULL)
- {
- @@ -361,7 +431,7 @@ public:
- {
- const zbar_symbol_set_t *zsyms = _syms;
- if(zsyms)
- - _sym.init(zbar_symbol_set_first_symbol(zsyms));
- + _sym = zbar_symbol_set_first_symbol(zsyms);
- }
-
- /// copy constructor.
- @@ -370,25 +440,33 @@ public:
- {
- const zbar_symbol_set_t *zsyms = _syms;
- if(zsyms)
- - _sym.init(zbar_symbol_set_first_symbol(zsyms));
- + _sym = zbar_symbol_set_first_symbol(zsyms);
- }
-
- ~SymbolIterator ()
- {
- - _sym.init();
- + }
- +
- + /// assignment.
- + SymbolIterator& operator= (const SymbolIterator& iter)
- + {
- + _syms = iter._syms;
- + _sym = iter._sym;
- + return(*this);
- + }
- +
- + bool operator! () const
- + {
- + return(!_syms || !_sym);
- }
-
- /// advance iterator to next Symbol.
- SymbolIterator& operator++ ()
- {
- - const zbar_symbol_t *zsym = _sym;
- - if(zsym)
- - _sym.init(zbar_symbol_next(zsym));
- - else {
- - const zbar_symbol_set_t *zsyms = _syms;
- - if(zsyms)
- - _sym.init(zbar_symbol_set_first_symbol(zsyms));
- - }
- + if(!!_sym)
- + _sym = zbar_symbol_next(_sym);
- + else if(!!_syms)
- + _sym = zbar_symbol_set_first_symbol(_syms);
- return(*this);
- }
-
- diff --git a/include/zbar/Video.h b/include/zbar/Video.h
- --- a/include/zbar/Video.h
- +++ b/include/zbar/Video.h
- @@ -1,5 +1,5 @@
- //------------------------------------------------------------------------
- -// Copyright 2007-2009 (c) Jeff Brown <spadix@users.sourceforge.net>
- +// Copyright 2007-2010 (c) Jeff Brown <spadix@users.sourceforge.net>
- //
- // This file is part of the ZBar Bar Code Reader.
- //
- @@ -92,7 +92,7 @@ public:
- /// see zbar_video_init()
- void init (std::string& format)
- {
- - unsigned int fourcc = *(unsigned int*)format.c_str();
- + unsigned int fourcc = zbar_fourcc_parse(format.c_str());
- if(zbar_video_init(_video, fourcc))
- throw_exception(_video);
- }
- diff --git a/include/zbar/zbargtk.h b/include/zbar/zbargtk.h
- --- a/include/zbar/zbargtk.h
- +++ b/include/zbar/zbargtk.h
- @@ -136,7 +136,7 @@ struct _ZBarGtkClass {
-
- GType zbar_gtk_get_type(void) G_GNUC_CONST;
-
- -/**
- +/**
- * zbar_gtk_new:
- * create a new barcode reader widget instance.
- * initially has no associated video device or image.
- @@ -189,7 +189,17 @@ void zbar_gtk_set_video_enabled(ZBarGtk
- */
- gboolean zbar_gtk_get_video_opened(ZBarGtk *zbar);
-
- -/**
- +/** set video camera resolution.
- + * @width: width in pixels
- + * @height: height in pixels
- + *
- + * @note this call must be made before video is initialized
- + */
- +void zbar_gtk_request_video_size(ZBarGtk *zbar,
- + int width,
- + int height);
- +
- +/**
- * utility function to populate a zbar_image_t from a GdkPixbuf.
- * @image: the zbar library image destination to populate
- * @pixbuf: the GdkPixbuf source
- diff --git a/iphone/ChangeLog b/iphone/ChangeLog
- new file mode 100644
- --- /dev/null
- +++ b/iphone/ChangeLog
- @@ -0,0 +1,70 @@
- +version 1.0.1:
- + * hotfix broken ZBarHelpController back button
- + * release updates
- + - update docs
- + * fix support for GS1 AIs
- + * fix simulated camera image orientation/scaling
- + * cleanup and expose ZBarHelpController
- + * expose enable for reader capture processing
- + * workaround iOS 4.2 hang
- + - upd…
Large files files are truncated, but you can click here to view the full file