[packages/zbar] - rel 9; fix build; update_to_hg, libv4l patches from fc

arekm arekm at pld-linux.org
Sun Jun 9 16:47:53 CEST 2013


commit 9c696e8ef45eaed1e0f6f1bd054901fb1699f320
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Sun Jun 9 16:47:49 2013 +0200

    - rel 9; fix build; update_to_hg, libv4l patches from fc

 zbar-no-v4l1.patch      |    77 -
 zbar.spec               |    13 +-
 zbar_update_to_hg.patch | 35415 ++++++++++++++++++++++++++++++++++++++++++++++
 zbar_use_libv4l.patch   |   295 +
 4 files changed, 35719 insertions(+), 81 deletions(-)
---
diff --git a/zbar.spec b/zbar.spec
index c8f84d2..146f803 100644
--- a/zbar.spec
+++ b/zbar.spec
@@ -8,14 +8,16 @@ Summary:	ZBar Bar Code Reader
 Summary(pl.UTF-8):	ZBar - czytnik kodów paskowych
 Name:		zbar
 Version:	0.10
-Release:	8
+Release:	9
 License:	LGPL v2.1+
 Group:		Libraries
 Source0:	http://downloads.sourceforge.net/zbar/%{name}-%{version}.tar.bz2
 # Source0-md5:	0fd61eb590ac1bab62a77913c8b086a5
-Patch0:		%{name}-link.patch
-Patch1:		%{name}-npapi.patch
-Patch2:		%{name}-no-v4l1.patch
+Patch0:		zbar_update_to_hg.patch
+Patch1:		%{name}-link.patch
+Patch2:		%{name}-npapi.patch
+Patch3:		zbar_use_libv4l.patch
+Patch4:		%{name}-ac.patch
 URL:		http://zbar.sourceforge.net/
 BuildRequires:	ImageMagick-devel >= 1:6.2.6
 BuildRequires:	QtCore-devel >= 4
@@ -26,6 +28,7 @@ BuildRequires:	gettext-devel
 BuildRequires:	gtk+2-devel >= 2.0
 BuildRequires:	libjpeg-devel
 BuildRequires:	libtool >= 2:2.2
+BuildRequires:	libv4l-devel
 BuildRequires:	perl-devel >= 1:5.8.0
 BuildRequires:	pkgconfig
 BuildRequires:	python-devel >= 2.3.5
@@ -225,6 +228,8 @@ Wtyczka ZBar dla przeglądarek WWW.
 %patch0 -p1
 %patch1 -p1
 %patch2 -p1
+%patch3 -p1
+%patch4 -p1
 
 %build
 %{__libtoolize}
diff --git a/zbar-no-v4l1.patch b/zbar-no-v4l1.patch
deleted file mode 100644
index 39cdf04..0000000
--- a/zbar-no-v4l1.patch
+++ /dev/null
@@ -1,77 +0,0 @@
-diff -ruN zbar-0.10.orig/configure.ac zbar-0.10/configure.ac
---- zbar-0.10.orig/configure.ac	2009-10-23 20:16:44.000000000 +0200
-+++ zbar-0.10/configure.ac	2011-11-27 21:14:05.407241311 +0100
-@@ -147,19 +147,13 @@
- with_video="no"
- AS_IF([test "x$enable_video" != "xno"],
-   [AS_IF([test "x$win32" = "xno"],
--    [AC_CHECK_HEADERS([linux/videodev.h], [with_video="v4l1"],
--      [AC_MSG_FAILURE([test for video support failed!
--rebuild your kernel to include video4linux support or
--configure --disable-video to skip building video support.])])
--       AC_CHECK_HEADERS([linux/videodev2.h], [with_video="v4l2"],
-+    [AC_CHECK_HEADERS([linux/videodev2.h], [with_video="v4l2"],
-          [AC_MSG_WARN([v4l2 API not detected, upgrade your kernel!])])],
-     [AC_CHECK_HEADERS([vfw.h], [with_video="vfw"],
-       [AC_MSG_FAILURE([test for VfW video support failed!
- configure --disable-video to skip building vidoe support.])])])
- ])
- AM_CONDITIONAL([HAVE_VIDEO], [test "x$enable_video" != "xno"])
--AM_CONDITIONAL([HAVE_V4L1],
--  [test "x$with_video" = "xv4l1" || test "x$with_video" = "xv4l2"])
- AM_CONDITIONAL([HAVE_V4L2], [test "x$with_video" = "xv4l2"])
- 
- dnl X
-diff -ruN zbar-0.10.orig/zbar/Makefile.am.inc zbar-0.10/zbar/Makefile.am.inc
---- zbar-0.10.orig/zbar/Makefile.am.inc	2009-10-23 20:16:44.000000000 +0200
-+++ zbar-0.10/zbar/Makefile.am.inc	2011-11-27 21:14:05.407241311 +0100
-@@ -53,12 +53,9 @@
- zbar_libzbar_la_SOURCES += zbar/processor/posix.h zbar/processor/posix.c
- endif
- 
--if HAVE_V4L1
--zbar_libzbar_la_SOURCES += zbar/video/v4l1.c
- if HAVE_V4L2
- zbar_libzbar_la_SOURCES += zbar/video/v4l2.c
- endif
--endif
- if WIN32
- if HAVE_VIDEO
- zbar_libzbar_la_SOURCES += zbar/video/vfw.c
-diff -ruN zbar-0.10.orig/zbar/video/v4l2.c zbar-0.10/zbar/video/v4l2.c
---- zbar-0.10.orig/zbar/video/v4l2.c	2009-10-23 20:16:44.000000000 +0200
-+++ zbar-0.10/zbar/video/v4l2.c	2011-11-27 21:14:05.408241505 +0100
-@@ -39,6 +39,9 @@
- # include <sys/mman.h>
- #endif
- #include <linux/videodev2.h>
-+#include <sys/stat.h>
-+#include <unistd.h>
-+#include <fcntl.h>
- 
- #include "video.h"
- #include "image.h"
-@@ -507,3 +510,23 @@
-     vdo->dq = v4l2_dq;
-     return(0);
- }
-+
-+int _zbar_video_open (zbar_video_t *vdo,
-+                      const char *dev)
-+{
-+    vdo->fd = open(dev, O_RDWR);
-+    if(vdo->fd < 0)
-+        return(err_capture_str(vdo, SEV_ERROR, ZBAR_ERR_SYSTEM, __func__,
-+                               "opening video device '%s'", dev));
-+    zprintf(1, "opened camera device %s (fd=%d)\n", dev, vdo->fd);
-+
-+    int rc = -1;
-+    if(vdo->intf != VIDEO_V4L1)
-+        rc = _zbar_v4l2_probe(vdo);
-+
-+    if(rc && vdo->fd >= 0) {
-+        close(vdo->fd);
-+        vdo->fd = -1;
-+    }
-+    return(rc);
-+}
diff --git a/zbar_update_to_hg.patch b/zbar_update_to_hg.patch
new file mode 100644
index 0000000..16486fb
--- /dev/null
+++ b/zbar_update_to_hg.patch
@@ -0,0 +1,35415 @@
+diff -r 563557a923d0 COPYING
+--- a/COPYING	Tue Oct 27 11:25:59 2009 -0400
++++ b/COPYING	Fri Feb 22 08:54:29 2013 -0300
+@@ -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-2011 Jeff Brown
+  <spadix at users.sourceforge.net>
+ The QR Code reader is Copyright (C) 1999-2009 Timothy B. Terriberry
+  <tterribe at xiph.org>
+diff -r 563557a923d0 ChangeLog
+--- a/ChangeLog	Tue Oct 27 11:25:59 2009 -0400
++++ b/ChangeLog	Fri Feb 22 08:54:29 2013 -0300
+@@ -1,3 +1,95 @@
++current:
++  * Codabar reliability enhancements
++    - fix missing check
++    - require minimum quality
++    - bump default uncertainty
++  * tweak Codabar bar/space ratio validation
++  * finish Codabar support for python, perl, java and iPhone interfaces
++    - reduce Codabar uncertainty to minimum
++  * add core support for Codabar symbology
++    - TBD: python, perl, java and iPhone interfaces
++  * fix v4l config and build variations (bug #3348888)
++    - thanks to jarekczek for reporting this!
++    - NB v4l1 removed from kernel as of 2.6.38
++  * fix missing python thread initialization (bug #3349199)
++    - thanks to jarekczek for reporting this problem!
++  * fix missing configure check for Python.h (bug #3092663)
++    - thanks to Zoltan Kovacs for reporting this problem!
++  * fix C++ wrapper missing Symbol.quality (bug #3076524)
++    - thanks to Rudy Melli for pointing this out!
++  * fix C++ wrapper bugs (bug #3396068)
++    - thanks to anotheruser1 for reporting this!
++    - add new C++ wrapper test
++  * fix avoid compositing ISBN10 data
++  * add support for GraphicsMagick as ImageMagick alternative
++  * mention xmlto in HACKING (patch #3297039)
++    - thanks to jarekczek for the patch!
++  * disable addons by default until synchronization with main symbol is working
++  * fix image scanner min quality filtering
++  * fix i25 buffer overrun corner case
++  * fix EAN addon enables
++  * fix zbarimg to accept autodetected stdin (lone dash)
++  * fix Qt 4.6.3 compilation error (patch #3178244)
++    - thanks to hrhristov for the patch!
++  * add Python Processor support for request_size interface
++  * fix Python Processor support for GIL, allowing asynchronous scanning
++  * fix jpeg decoder skip handling
++    - thanks to jarekczek for the patch!
++  * rename dprintf macro to avoid conflicts (patch #3128538)
++    - thanks to maurochehab for the patch!
++  * add support for EAN/UPC 2 and 5 digit add-on symbols
++    - deprecate original, unfinished add-on APIs
++    - add self-checking to test_decode
++  * fix support for GS1 AIs
++    - thanks to jockusch for a patch!
++    - add decoder/symbol "modifier" flags and config read access
++    - set flags or emit GS appropriately for Code 128 FNC1
++    - add iphone, java, perl, python bindings for modifiers and configs
++  * add support for Code 93 symbology
++  * add video size request to (Py)GTK widget (req #3034522)
++    - thanks to Jerome Charaoui for the patch!
++  * add support for GS1 DataBar Expanded (RSS Expanded) symbology
++  * add language bindings for DataBar
++  * add preliminary support for GS1 DataBar (RSS-14) symbology
++  * enhance decoder reliability (EAN, Code 39, Code 128)
++    - enhance decoder test
++  * fix documentation of command exit codes (bug #3017322)
++  * fix C++ video callback bug
++    - add C and C++ processor examples
++  * add per-symbology cache consistency
++    - reliable symbologies decode immediately by default
++    - no more need to disable cache with video
++    - also fix crop bugs w/video scanning
++  * add support for scanning partial images (cropping)
++    - update c++, python, perl, java bindings and tests
++  * fix couple of leaks
++  * remove doc hints about GFDL (bug #3004411)
++    - apply LGPL to API docs
++  * relax Code 39 width ratio checks
++  * core library portability improvements
++    - remove some unnecessary C99 syntax
++    - add configure checks for errno
++    - enhance C++ Symbol interface
++  * adjust Python module README (add examples and note DLL in path)
++  * fix QR Code missing from man pages (bug #2969857)
++  * cleanup decoder assertions and locking (bug #2966916)
++  * add Java interface to library via JNI
++    - add Java tools and JNI build tests to configure
++    - fix compiler warnings from binary output changes
++  * fix output of binary data in zbarimg and zbarcam
++    - thanks to fukuchi for a patch!
++    - add base64 format for binary xml output
++  * add coarse symbol orientation information (patch #2913094)
++    - thanks to Anssi for a patch!
++    - add decode direction feedback to decoder
++    - update C++, Python, Perl and ObjC wrappers
++    - add orientation to test suites
++  * fix inconsistent fourcc endian handling bugs (bug #2918994)
++    - thanks to jdccdevel for a patch!
++    - add fourcc conversion and parse interfaces to zbar.h
++  * report QR immediately for video (no inter-frame consistency check)
++  * add python distutils build infrastructure
++
+ version 0.10:
+   * hotfix add MinGW import lib to Windows installer
+   * attempt fix for Qt4 < 4.4
+diff -r 563557a923d0 HACKING
+--- a/HACKING	Tue Oct 27 11:25:59 2009 -0400
++++ b/HACKING	Fri Feb 22 08:54:29 2013 -0300
+@@ -13,6 +13,12 @@
+     GNU autoconf 2.61
+     GNU automake 1.10.1
+     GNU libtool 2.2.6
++    GNU gettext 0.18.1.1
++    GNU pkg-config 0.25
++    xmlto 0.0.20-5 (for docs building)
++all above mentioned tools (except xmlto) must be installed in the same
++prefix. mixing prefixes (i.g. /usr/bin and /usr/local/bin) may lead to
++errors in configuration stages
+ 
+ when you're done hacking and want to make your patch, run:
+ 
+diff -r 563557a923d0 Makefile.am
+--- a/Makefile.am	Tue Oct 27 11:25:59 2009 -0400
++++ b/Makefile.am	Fri Feb 22 08:54:29 2013 -0300
+@@ -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 @@
+ pyexec_LTLIBRARIES =
+ CLEANFILES =
+ DISTCLEANFILES =
++MAINTAINERCLEANFILES =
+ BUILT_SOURCES =
+ EXTRA_DIST =
++SUBDIRS = .
+ 
+ pkgconfigdir = $(libdir)/pkgconfig
+ pkgconfig_DATA = zbar.pc
+@@ -39,6 +38,9 @@
+ 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 @@
+ 
+ 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 -r 563557a923d0 README
+--- a/README	Tue Oct 27 11:25:59 2009 -0400
++++ b/README	Fri Feb 22 08:54:29 2013 -0300
+@@ -4,9 +4,9 @@
+ ZBar Bar Code Reader is an open source software suite for reading bar
+ codes from various sources, such as video streams, image files and raw
+ intensity sensors. It supports EAN-13/UPC-A, UPC-E, EAN-8, Code 128,
+-Code 39, Interleaved 2 of 5 and QR Code.  Included with the library
+-are basic applications for decoding captured bar code images and using
+-a video device (eg, webcam) as a bar code scanner.  For application
++Code 39, Codabar, Interleaved 2 of 5 and QR Code.  Included with the
++library are basic applications for decoding captured bar code images and
++using a video device (eg, webcam) as a bar code scanner.  For application
+ developers, language bindings are included for C, C++, Python and Perl
+ as well as GUI widgets for Qt, GTK and PyGTK.
+ 
+diff -r 563557a923d0 README.windows
+--- a/README.windows	Tue Oct 27 11:25:59 2009 -0400
++++ b/README.windows	Fri Feb 22 08:54:29 2013 -0300
+@@ -3,8 +3,8 @@
+ 
+ ZBar Bar Code Reader is an open source software suite for reading bar codes
+ from various sources, such as video streams, image files and raw intensity
+-sensors. It supports EAN-13/UPC-A, UPC-E, EAN-8, Code 128, Code 39,
+-Interleaved 2 of 5 and QR Code.  Included with the library are basic
++sensors. It supports EAN-13/UPC-A, UPC-E, EAN-8, Code 128, Code 93, Code 39,
++Codabar, Interleaved 2 of 5 and QR Code.  Included with the library are basic
+ applications for decoding captured bar code images and using a video device
+ (eg, webcam) as a bar code scanner.  For application developers, language
+ bindings are included for C, C++, Python and Perl as well as GUI widgets for
+diff -r 563557a923d0 TODO
+--- a/TODO	Tue Oct 27 11:25:59 2009 -0400
++++ b/TODO	Fri Feb 22 08:54:29 2013 -0300
+@@ -25,7 +25,6 @@
+   * Code 39, i25 optional features (check digit and ASCII escapes)
+   * handle Code 128 function characters (FNC1-4)
+   * Code 128 trailing quiet zone checks
+-  * finish addon decoding
+ 
+ decoder:
+   * start/stop/abort and location detail APIs (PDF417, OMR)
+diff -r 563557a923d0 android/AndroidManifest.xml
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
++++ b/android/AndroidManifest.xml	Fri Feb 22 08:54:29 2013 -0300
+@@ -0,0 +1,15 @@
++<?xml version="1.0" encoding="utf-8"?>
++<manifest xmlns:android="http://schemas.android.com/apk/res/android"
++      package="net.sourceforge.zbar.android"
++      android:versionCode="1"
++      android:versionName="1.0">
++    <application android:label="@string/app_name" >
++        <activity android:name="ACTIVITY_ENTRY_NAME"
++                  android:label="@string/app_name">
++            <intent-filter>
++                <action android:name="android.intent.action.MAIN" />
++                <category android:name="android.intent.category.LAUNCHER" />
++            </intent-filter>
++        </activity>
++    </application>
++</manifest> 
+diff -r 563557a923d0 android/ChangeLog
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
++++ b/android/ChangeLog	Fri Feb 22 08:54:29 2013 -0300
+@@ -0,0 +1,2 @@
++version 0.1:
++  * Add initial support for Android platform
+diff -r 563557a923d0 android/README
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
++++ b/android/README	Fri Feb 22 08:54:29 2013 -0300
+@@ -0,0 +1,112 @@
++ZBar Android SDK
++================
++
++ZBar Bar Code Reader is an open source software suite for reading bar
++codes from various sources, such as video streams, image files and raw
++intensity sensors. It supports EAN-13/UPC-A, UPC-E, EAN-8, Code 128,
++Code 93, Code 39, Codabar, Interleaved 2 of 5, QR Code and
++DataBar. These are the JNI wrappers for developing the library on
++Android platform.
++
++Check the ZBar home page for the latest release, mailing lists, etc.
++    http://zbar.sourceforge.net/
++
++Copyright and License
++---------------------
++Licensed under the GNU Lesser General Public License, version 2.1.
++http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
++
++Copyright 2008-2012 � Jeff Brown <spadix at users.sourceforge.net> et al
++
++The Android distribution also includes pre-compiled binaries of
++supporting libaries, for which copyright, license and source code
++locations are as follows:
++  * The GNU libiconv character set conversion library
++    Copyright (C) 1999-2011 Free Software Foundation, Inc.
++    This distribution includes GNU libiconv version 1.14, licensed under
++    the LGPL version 2.  The source code is available from
++        http://www.gnu.org/software/libiconv
++
++See included files COPYING and LICENSE for details.
++
++
++Installation
++------------
++
++After downloading the ZBar-Android-Lib-<version>.zip file, you need to
++unzip the file and add it to your Android project. Unzip the file
++using your favorite method (ie: command-line, finder, windows
++explorer...)
++
++Follow one of the two options.
++Option 1 - via command line
++  cd <android project>
++  cp -r ZBar-Android-SDK-<version>/libs .
++
++Option 2 - via Eclipse
++  Right click on Android Project
++  Select "Import" -> "File System"
++  Select "Browse" (next to "From directory File" and select the
++    ZBar-Android-SDK-<verion>/libs directory and click "Open".
++  Click the check box next to "libs" and the "Options" "Create top-level folder"
++  check box (below).
++  Then click "Finish".
++      
++  You should then see a "libs" folder under your project.
++
++Building
++--------
++
++Via Eclipse
++You have to add the zbar.jar file to your build path
++  1) select zbar.jar under libs
++  2) right-click, select "Build Path" -> "Add to Build Path"
++  
++Via command-line
++You are all set; ant will automatcially find jar files under the "libs"
++subdirectory.
++
++Documentation
++-------------
++   TDB
++
++Examples
++--------
++
++You should be able to open and build the examples directly from the
++unzipped directory. You will need to run the android tools to setup
++the local.properties file which sets sdk.dir.
++  1) cd <unzip dir>/examples/CameraTest
++  2) android update project --path .
++  3) ant debug install
++
++If you have problems with this, please create a new Android project
++and copy the necessary files from the examples.
++
++examples/CameraTest is a simple demonstration of how to integrate the
++ZBar image scanner with the camera.
++
++Manually building ZBar JNI library
++----------------------------------
++First download and unzip the iconv library source from 
++  http://www.gnu.org/software/libiconv/
++
++Then kick off the build from the ZBar android directory. You will
++need to run the android tools to setup the local.properties file which
++setups sdk.dir.
++
++  1) cd <zbar project>/android
++  2) android update project --path . 
++  3) ant -Dndk.dir=<NDK path> -Diconv.src=<iconv library src> zbar-all
++
++This will rebuild all source files, create zbar.jar and
++ZBarAndroidSDK.zip file (which bundles the jar and shared
++libraries). From here, you can follow the steps for "Integrating ZBar
++JNI library in Android project".
++
++To clean run:
++  ant -Dndk.dir=<NDK path> zbar-clean
++
++See build-ndk.xml for additional target options.
++
++
+diff -r 563557a923d0 android/ant.properties
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
++++ b/android/ant.properties	Fri Feb 22 08:54:29 2013 -0300
+@@ -0,0 +1,17 @@
++# This file is used to override default values used by the Ant build system.
++#
++# This file must be checked in Version Control Systems, as it is
++# integral to the build system of your project.
++
++# This file is only used by the Ant script.
++
++# You can use this to override default values such as
++#  'source.dir' for the location of your java source folder and
++#  'out.dir' for the location of your output folder.
++
++# You can also use it define how the release builds are signed by declaring
++# the following properties:
++#  'key.store' for the location of your keystore and
++#  'key.alias' for the name of the key to use.
++# The password will be asked during the build when you use the 'release' target.
++
+diff -r 563557a923d0 android/build-ndk.xml
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
++++ b/android/build-ndk.xml	Fri Feb 22 08:54:29 2013 -0300
+@@ -0,0 +1,66 @@
++<!-- 
++Ant build file to compile the ZBar JNI files using Android NDK tool
++targets:
++  zbar-clean     - removes build generated files, build dir, jar and zip files
++  zbar-ndk-build - builds the zbarjni and iconv shared libraries
++  zbar-compile   - builds the zbar java files
++  zbar-jar       - builds and jars the zbar java files
++  zbar-zip       - Creates ZBarAndroidSDK-x.y.zip of jar, .so, etc
++  zbar-all       - performs all the above :)
++-->
++<project name="zbar">
++  <property name="project.name" value="zbar" />
++  <property name="project.sdk.name" value="ZBarAndroidSDK" />
++
++  <target name="zbar-clean">
++      <delete dir="../java/build"/>
++      <delete file="libs/${project.name}.jar"/>
++      <delete file="${ant.project.name}.zip"/>
++      <exec executable="${ndk.dir}/ndk-build" failonerror="true">
++          <arg value="clean"/>
++      </exec>
++  </target>
++
++  <target name="zbar-ndk-build">
++      <exec executable="${ndk.dir}/ndk-build" failonerror="true">
++          <arg value="ICONV_SRC=${iconv.src}" />
++      </exec>
++  </target>
++
++  <target name="zbar-compile" depends="zbar-ndk-build">
++      <mkdir dir="../java/build" />
++      <javac srcdir="../java/net" destdir="../java/build" />
++  </target>
++
++  <target name="zbar-jar" depends="zbar-compile">
++      <jar destfile="libs/${project.name}.jar" basedir="../java/build">
++      </jar>
++  </target>
++
++  <target name="zbar-zip">
++      <if><condition><not><isset property="version"/></not></condition><then>
++         <property name="version" value="0.2" />
++      </then></if>
++      <zip destfile="${project.sdk.name}-${version}.zip" >
++          <zipfileset dir="../" prefix="${project.sdk.name}-${version}" includes="COPYING, LICENSE"/>
++          <zipfileset dir="." prefix="${project.sdk.name}-${version}" includes="README"/>
++          <zipfileset dir="libs" prefix="${project.sdk.name}-${version}/libs"/>
++          <zipfileset dir="examples" prefix="${project.sdk.name}-${version}/examples"/>
++          <zipfileset dir="libs" prefix="${project.sdk.name}-${version}/examples/CameraTest/libs"/>
++      </zip>
++  </target>
++
++  <target name="zbar-all" depends="zbar-jar">
++      <if><condition><not><isset property="version"/></not></condition><then>
++         <property name="version" value="0.2" />
++      </then></if>
++      <zip destfile="${project.sdk.name}-${version}.zip" >
++          <zipfileset dir="../" prefix="${project.sdk.name}-${version}" includes="COPYING, LICENSE"/>
++          <zipfileset dir="." prefix="${project.sdk.name}-${version}" includes="README"/>
++          <zipfileset dir="libs" prefix="${project.sdk.name}-${version}/libs"/>
++          <zipfileset dir="examples" prefix="${project.sdk.name}-${version}/examples"/>
++          <zipfileset dir="libs" prefix="${project.sdk.name}-${version}/examples/CameraTest/libs"/>
++      </zip>
++  </target>
++</project>
++
+diff -r 563557a923d0 android/build.xml
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
++++ b/android/build.xml	Fri Feb 22 08:54:29 2013 -0300
+@@ -0,0 +1,86 @@
++<?xml version="1.0" encoding="UTF-8"?>
++<project name="ZBarAndroidSDK" default="help">
++
++    <!-- The local.properties file is created and updated by the 'android' tool.
++         It contains the path to the SDK. It should *NOT* be checked into
++         Version Control Systems. -->
++    <property file="local.properties" />
++
++    <!-- The ant.properties file can be created by you. It is only edited by the
++         'android' tool to add properties to it.
++         This is the place to change some Ant specific build properties.
++         Here are some properties you may want to change/update:
++
++         source.dir
++             The name of the source directory. Default is 'src'.
++         out.dir
++             The name of the output directory. Default is 'bin'.
++
++         For other overridable properties, look at the beginning of the rules
++         files in the SDK, at tools/ant/build.xml
++
++         Properties related to the SDK location or the project target should
++         be updated using the 'android' tool with the 'update' action.
++
++         This file is an integral part of the build system for your
++         application and should be checked into Version Control Systems.
++
++         -->
++    <property file="ant.properties" />
++
++    <!-- The project.properties file is created and updated by the 'android'
++         tool, as well as ADT.
++
++         This contains project specific properties such as project target, and library
++         dependencies. Lower level build properties are stored in ant.properties
++         (or in .classpath for Eclipse projects).
++
++         This file is an integral part of the build system for your
++         application and should be checked into Version Control Systems. -->
++    <loadproperties srcFile="project.properties" />
++
++    <!-- quick check on sdk.dir -->
++    <fail
++            message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through an env var"
++            unless="sdk.dir"
++    />
++
++
++<!-- extension targets. Uncomment the ones where you want to do custom work
++     in between standard targets -->
++<!--
++    <target name="-pre-build">
++    </target>
++    <target name="-pre-compile">
++    </target>
++
++    /* This is typically used for code obfuscation.
++       Compiled code location: ${out.classes.absolute.dir}
++       If this is not done in place, override ${out.dex.input.absolute.dir} */
++    <target name="-post-compile">
++      <copy file="${out.absolute.dir}/classes.jar" tofile="${jar.libs.dir}/zbar_android.jar" />
++    </target>
++-->
++
++    <!-- Import the actual build file.
++
++         To customize existing targets, there are two options:
++         - Customize only one target:
++             - copy/paste the target into this file, *before* the
++               <import> task.
++             - customize it to your needs.
++         - Customize the whole content of build.xml
++             - copy/paste the content of the rules files (minus the top node)
++               into this file, replacing the <import> task.
++             - customize to your needs.
++
++         ***********************
++         ****** IMPORTANT ******
++         ***********************
++         In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
++         in order to avoid having your file be overridden by tools such as "android update project"
++    -->
++    <!-- version-tag: 1 -->
++    <import file="build-ndk.xml" />
++    <import file="${sdk.dir}/tools/ant/build.xml" />
++</project>
+diff -r 563557a923d0 android/examples/CameraTest/AndroidManifest.xml
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
++++ b/android/examples/CameraTest/AndroidManifest.xml	Fri Feb 22 08:54:29 2013 -0300
+@@ -0,0 +1,19 @@
++<?xml version="1.0" encoding="utf-8"?>
++<manifest xmlns:android="http://schemas.android.com/apk/res/android"
++      package="net.sourceforge.zbar.android.CameraTest"
++      android:versionCode="1"
++      android:versionName="1.0">
++    <uses-sdk android:minSdkVersion="8" />
++    <uses-permission android:name="android.permission.CAMERA" />
++    <uses-feature android:name="android.hardware.camera" />
++    <uses-feature android:name="android.hardware.camera.autofocus" />
++    <application android:label="@string/app_name" >
++        <activity android:name="CameraTestActivity"
++                  android:label="@string/app_name">
++            <intent-filter>
++                <action android:name="android.intent.action.MAIN" />
++                <category android:name="android.intent.category.LAUNCHER" />
++            </intent-filter>
++        </activity>
++    </application>
++</manifest> 
+diff -r 563557a923d0 android/examples/CameraTest/ant.properties
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
++++ b/android/examples/CameraTest/ant.properties	Fri Feb 22 08:54:29 2013 -0300
+@@ -0,0 +1,17 @@
++# This file is used to override default values used by the Ant build system.
++#
++# This file must be checked in Version Control Systems, as it is
++# integral to the build system of your project.
++
++# This file is only used by the Ant script.
++
++# You can use this to override default values such as
++#  'source.dir' for the location of your java source folder and
++#  'out.dir' for the location of your output folder.
++
++# You can also use it define how the release builds are signed by declaring
++# the following properties:
++#  'key.store' for the location of your keystore and
++#  'key.alias' for the name of the key to use.
++# The password will be asked during the build when you use the 'release' target.
++
+diff -r 563557a923d0 android/examples/CameraTest/build.xml
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
++++ b/android/examples/CameraTest/build.xml	Fri Feb 22 08:54:29 2013 -0300
+@@ -0,0 +1,85 @@
++<?xml version="1.0" encoding="UTF-8"?>
++<project name="CameraTest" default="help">
++
++    <!-- The local.properties file is created and updated by the 'android' tool.
++         It contains the path to the SDK. It should *NOT* be checked into
++         Version Control Systems. -->
++    <property file="local.properties" />
++
++    <!-- The ant.properties file can be created by you. It is only edited by the
++         'android' tool to add properties to it.
++         This is the place to change some Ant specific build properties.
++         Here are some properties you may want to change/update:
++
++         source.dir
++             The name of the source directory. Default is 'src'.
++         out.dir
++             The name of the output directory. Default is 'bin'.
++
++         For other overridable properties, look at the beginning of the rules
++         files in the SDK, at tools/ant/build.xml
++
++         Properties related to the SDK location or the project target should
++         be updated using the 'android' tool with the 'update' action.
++
++         This file is an integral part of the build system for your
++         application and should be checked into Version Control Systems.
++
++         -->
++    <property file="ant.properties" />
++
++    <!-- The project.properties file is created and updated by the 'android'
++         tool, as well as ADT.
++
++         This contains project specific properties such as project target, and library
++         dependencies. Lower level build properties are stored in ant.properties
++         (or in .classpath for Eclipse projects).
++
++         This file is an integral part of the build system for your
++         application and should be checked into Version Control Systems. -->
++    <loadproperties srcFile="project.properties" />
++
++    <!-- quick check on sdk.dir -->
++    <fail
++            message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through an env var"
++            unless="sdk.dir"
++    />
++
++
++<!-- extension targets. Uncomment the ones where you want to do custom work
++     in between standard targets -->
++<!--
++    <target name="-pre-build">
++    </target>
++    <target name="-pre-compile">
++    </target>
++
++    /* This is typically used for code obfuscation.
++       Compiled code location: ${out.classes.absolute.dir}
++       If this is not done in place, override ${out.dex.input.absolute.dir} */
++    <target name="-post-compile">
++    </target>
++-->
++
++    <!-- Import the actual build file.
++
++         To customize existing targets, there are two options:
++         - Customize only one target:
++             - copy/paste the target into this file, *before* the
++               <import> task.
++             - customize it to your needs.
++         - Customize the whole content of build.xml
++             - copy/paste the content of the rules files (minus the top node)
++               into this file, replacing the <import> task.
++             - customize to your needs.
++
++         ***********************
++         ****** IMPORTANT ******
++         ***********************
++         In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
++         in order to avoid having your file be overridden by tools such as "android update project"
++    -->
++    <!-- version-tag: 1 -->
++    <import file="${sdk.dir}/tools/ant/build.xml" />
++
++</project>
+diff -r 563557a923d0 android/examples/CameraTest/proguard.cfg
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
++++ b/android/examples/CameraTest/proguard.cfg	Fri Feb 22 08:54:29 2013 -0300
+@@ -0,0 +1,40 @@
++-optimizationpasses 5
++-dontusemixedcaseclassnames
++-dontskipnonpubliclibraryclasses
++-dontpreverify
++-verbose
++-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
++
++-keep public class * extends android.app.Activity
++-keep public class * extends android.app.Application
++-keep public class * extends android.app.Service
++-keep public class * extends android.content.BroadcastReceiver
++-keep public class * extends android.content.ContentProvider
++-keep public class * extends android.app.backup.BackupAgentHelper
++-keep public class * extends android.preference.Preference
++-keep public class com.android.vending.licensing.ILicensingService
++
++-keepclasseswithmembernames class * {
++    native <methods>;
++}
++
++-keepclasseswithmembers class * {
++    public <init>(android.content.Context, android.util.AttributeSet);
++}
++
++-keepclasseswithmembers class * {
++    public <init>(android.content.Context, android.util.AttributeSet, int);
++}
++
++-keepclassmembers class * extends android.app.Activity {
++   public void *(android.view.View);
++}
++
++-keepclassmembers enum * {
++    public static **[] values();
++    public static ** valueOf(java.lang.String);
++}
++
++-keep class * implements android.os.Parcelable {
++  public static final android.os.Parcelable$Creator *;
++}
+diff -r 563557a923d0 android/examples/CameraTest/project.properties
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
++++ b/android/examples/CameraTest/project.properties	Fri Feb 22 08:54:29 2013 -0300
+@@ -0,0 +1,11 @@
++# This file is automatically generated by Android Tools.
++# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
++#
++# This file must be checked in Version Control Systems.
++#
++# To customize properties used by the Ant build system use,
++# "ant.properties", and override values to adapt the script to your
++# project structure.
++
++# Project target.
++target=android-15
+diff -r 563557a923d0 android/examples/CameraTest/res/layout/main.xml
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
++++ b/android/examples/CameraTest/res/layout/main.xml	Fri Feb 22 08:54:29 2013 -0300
+@@ -0,0 +1,28 @@
++<?xml version="1.0" encoding="utf-8"?>
++<LinearLayout
++  xmlns:android="http://schemas.android.com/apk/res/android"
++  android:orientation="vertical"
++  android:layout_width="match_parent"
++  android:layout_height="match_parent">
++
++  <FrameLayout
++    android:id="@+id/cameraPreview"
++    android:layout_width="match_parent"
++    android:layout_height="match_parent"
++    android:layout_weight="1"
++  />
++
++  <TextView
++    android:id="@+id/scanText"
++    android:text="Scanning..."
++    android:layout_height="wrap_content" 
++    android:layout_width="match_parent">
++  </TextView>
++  <Button
++    android:id="@+id/ScanButton"
++    android:text="Scan"
++    android:layout_width="wrap_content"
++    android:layout_height="wrap_content"
++    android:layout_gravity="center"
++  />
++</LinearLayout>
+diff -r 563557a923d0 android/examples/CameraTest/res/values/strings.xml
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
++++ b/android/examples/CameraTest/res/values/strings.xml	Fri Feb 22 08:54:29 2013 -0300
+@@ -0,0 +1,4 @@
++<?xml version="1.0" encoding="utf-8"?>
++<resources>
++    <string name="app_name">ZBar CameraTest</string>
++</resources>
+diff -r 563557a923d0 android/examples/CameraTest/src/net/sourceforge/zbar/android/CameraTest/CameraPreview.java
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
++++ b/android/examples/CameraTest/src/net/sourceforge/zbar/android/CameraTest/CameraPreview.java	Fri Feb 22 08:54:29 2013 -0300
+@@ -0,0 +1,108 @@
++/*
++ * Barebones implementation of displaying camera preview.
++ * 
++ * Created by lisah0 on 2012-02-24
++ */
++package net.sourceforge.zbar.android.CameraTest;
++
++import java.io.IOException;
++
++import android.app.Activity;
++import android.os.Bundle;
++
++import android.util.Log;
++
++import android.view.View;
++import android.view.Surface;
++import android.view.SurfaceView;
++import android.view.SurfaceHolder;
++
++import android.content.Context;
++
++import android.hardware.Camera;
++import android.hardware.Camera.PreviewCallback;
++import android.hardware.Camera.AutoFocusCallback;
++import android.hardware.Camera.Parameters;
++
++/** A basic Camera preview class */
++public class CameraPreview extends SurfaceView implements SurfaceHolder.Callback {
++    private SurfaceHolder mHolder;
++    private Camera mCamera;
++    private PreviewCallback previewCallback;
++    private AutoFocusCallback autoFocusCallback;
++
++    public CameraPreview(Context context, Camera camera,
++                         PreviewCallback previewCb,
++                         AutoFocusCallback autoFocusCb) {
++        super(context);
++        mCamera = camera;
++        previewCallback = previewCb;
++        autoFocusCallback = autoFocusCb;
++
++        /* 
++         * Set camera to continuous focus if supported, otherwise use
++         * software auto-focus. Only works for API level >=9.
++         */
++        /*
++        Camera.Parameters parameters = camera.getParameters();
++        for (String f : parameters.getSupportedFocusModes()) {
++            if (f == Parameters.FOCUS_MODE_CONTINUOUS_PICTURE) {
++                mCamera.setFocusMode(Parameters.FOCUS_MODE_CONTINUOUS_PICTURE);
++                autoFocusCallback = null;
++                break;
++            }
++        }
++        */
++
++        // Install a SurfaceHolder.Callback so we get notified when the
++        // underlying surface is created and destroyed.
++        mHolder = getHolder();
++        mHolder.addCallback(this);
++
++        // deprecated setting, but required on Android versions prior to 3.0
++        mHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
++    }
++
++    public void surfaceCreated(SurfaceHolder holder) {
++        // The Surface has been created, now tell the camera where to draw the preview.
++        try {
++            mCamera.setPreviewDisplay(holder);
++        } catch (IOException e) {
++            Log.d("DBG", "Error setting camera preview: " + e.getMessage());
++        }
++    }
++
++    public void surfaceDestroyed(SurfaceHolder holder) {
++        // Camera preview released in activity
++    }
++
++    public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
++        /*
++         * If your preview can change or rotate, take care of those events here.
++         * Make sure to stop the preview before resizing or reformatting it.
++         */
++        if (mHolder.getSurface() == null){
++          // preview surface does not exist
++          return;
++        }
++
++        // stop preview before making changes
++        try {
++            mCamera.stopPreview();
++        } catch (Exception e){
++          // ignore: tried to stop a non-existent preview
++        }
++
++        try {
++            // Hard code camera surface rotation 90 degs to match Activity view in portrait
++            mCamera.setDisplayOrientation(90);
++
++            mCamera.setPreviewDisplay(mHolder);
++            mCamera.setPreviewCallback(previewCallback);
++            mCamera.startPreview();
++            mCamera.autoFocus(autoFocusCallback);
++        } catch (Exception e){
++            Log.d("DBG", "Error starting camera preview: " + e.getMessage());
++        }
++    }
++}
+diff -r 563557a923d0 android/examples/CameraTest/src/net/sourceforge/zbar/android/CameraTest/CameraTestActivity.java
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
++++ b/android/examples/CameraTest/src/net/sourceforge/zbar/android/CameraTest/CameraTestActivity.java	Fri Feb 22 08:54:29 2013 -0300
+@@ -0,0 +1,155 @@
++/*
++ * Basic no frills app which integrates the ZBar barcode scanner with
++ * the camera.
++ * 
++ * Created by lisah0 on 2012-02-24
++ */
++package net.sourceforge.zbar.android.CameraTest;
++
++import net.sourceforge.zbar.android.CameraTest.CameraPreview;
++
++import android.app.Activity;
++import android.content.pm.ActivityInfo;
++import android.os.Bundle;
++import android.os.Handler;
++import android.util.Log;
++
++import android.view.View;
++import android.view.View.OnClickListener;
++import android.view.Window;
++import android.widget.FrameLayout;
++import android.widget.Button;
++
++import android.hardware.Camera;
++import android.hardware.Camera.PreviewCallback;
++import android.hardware.Camera.AutoFocusCallback;
++import android.hardware.Camera.Parameters;
++import android.hardware.Camera.Size;
++
++import android.widget.TextView;
++import android.graphics.ImageFormat;
++
++/* Import ZBar Class files */
++import net.sourceforge.zbar.ImageScanner;
++import net.sourceforge.zbar.Image;
++import net.sourceforge.zbar.Symbol;
++import net.sourceforge.zbar.SymbolSet;
++import net.sourceforge.zbar.Config;
++
++public class CameraTestActivity extends Activity
++{
++    private Camera mCamera;
++    private CameraPreview mPreview;
++    private Handler autoFocusHandler;
++
++    TextView scanText;
++    Button scanButton;
++
++    ImageScanner scanner;
++
++    private boolean barcodeScanned = false;
++    private boolean previewing = true;
++
++    static {
++        System.loadLibrary("iconv");
++    } 
++
++    public void onCreate(Bundle savedInstanceState) {
++        super.onCreate(savedInstanceState);
++
++        setContentView(R.layout.main);
++
++        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
++
++        autoFocusHandler = new Handler();
++        mCamera = getCameraInstance();
++
++        /* Instance barcode scanner */
++        scanner = new ImageScanner();
++        scanner.setConfig(0, Config.X_DENSITY, 3);
++        scanner.setConfig(0, Config.Y_DENSITY, 3);
++
++        mPreview = new CameraPreview(this, mCamera, previewCb, autoFocusCB);
++        FrameLayout preview = (FrameLayout)findViewById(R.id.cameraPreview);
++        preview.addView(mPreview);
++
++        scanText = (TextView)findViewById(R.id.scanText);
++
++        scanButton = (Button)findViewById(R.id.ScanButton);
++
++        scanButton.setOnClickListener(new OnClickListener() {
++                public void onClick(View v) {
++                    if (barcodeScanned) {
++                        barcodeScanned = false;
++                        scanText.setText("Scanning...");
++                        mCamera.setPreviewCallback(previewCb);
++                        mCamera.startPreview();
++                        previewing = true;
++                        mCamera.autoFocus(autoFocusCB);
++                    }
++                }
++            });
++    }
++
++    public void onPause() {
++        super.onPause();
++        releaseCamera();
++    }
++
++    /** A safe way to get an instance of the Camera object. */
++    public static Camera getCameraInstance(){
++        Camera c = null;
++        try {
++            c = Camera.open();
++        } catch (Exception e){
++        }
++        return c;
++    }
++
++    private void releaseCamera() {
++        if (mCamera != null) {
++            previewing = false;
++            mCamera.setPreviewCallback(null);
++            mCamera.release();
++            mCamera = null;
++        }
++    }
++
++    private Runnable doAutoFocus = new Runnable() {
++            public void run() {
++                if (previewing)
++                    mCamera.autoFocus(autoFocusCB);
++            }
++        };
++
++    PreviewCallback previewCb = new PreviewCallback() {
++            public void onPreviewFrame(byte[] data, Camera camera) {
++                Camera.Parameters parameters = camera.getParameters();
++                Size size = parameters.getPreviewSize();
++
++                Image barcode = new Image(size.width, size.height, "Y800");
++                barcode.setData(data);
++
++                int result = scanner.scanImage(barcode);
++                
++                if (result != 0) {
++                    previewing = false;
++                    mCamera.setPreviewCallback(null);
++                    mCamera.stopPreview();
++                    
++                    SymbolSet syms = scanner.getResults();
++                    for (Symbol sym : syms) {
++                        scanText.setText("barcode result " + sym.getData());
++                        barcodeScanned = true;
++                    }
++                }
++            }
++        };
++
++    // Mimic continuous auto-focusing
++    AutoFocusCallback autoFocusCB = new AutoFocusCallback() {
++            public void onAutoFocus(boolean success, Camera camera) {
++                autoFocusHandler.postDelayed(doAutoFocus, 1000);
++            }
++        };
++}
+diff -r 563557a923d0 android/jni/Android.mk
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
++++ b/android/jni/Android.mk	Fri Feb 22 08:54:29 2013 -0300
+@@ -0,0 +1,76 @@
++#
++# Android NDK makefile 
++#
++# build - <ndk path>/ndk-build ICONV_SRC=<iconv library src> 
++# clean -  <ndk path>/ndk-build clean
++#
++MY_LOCAL_PATH := $(call my-dir)
++
++# libiconv
++include $(CLEAR_VARS)
++LOCAL_PATH := $(ICONV_SRC)
++
++LOCAL_MODULE := libiconv
++
++LOCAL_CFLAGS := \
++    -Wno-multichar \
++    -D_ANDROID \
++    -DLIBDIR="c" \
++    -DBUILDING_LIBICONV \
++    -DBUILDING_LIBCHARSET \
++    -DIN_LIBRARY
++
++LOCAL_SRC_FILES := \
++	lib/iconv.c \
++	libcharset/lib/localcharset.c \
++	lib/relocatable.c
++
++LOCAL_C_INCLUDES := \
++	$(ICONV_SRC)/include \
++	$(ICONV_SRC)/libcharset \
++	$(ICONV_SRC)/libcharset/include
++
++include $(BUILD_SHARED_LIBRARY)
++
++LOCAL_LDLIBS := -llog -lcharset
++
++# libzbarjni
++include $(CLEAR_VARS)
++
++LOCAL_PATH := $(MY_LOCAL_PATH)
++LOCAL_MODULE := zbarjni
++LOCAL_SRC_FILES := ../../java/zbarjni.c \
++		   ../../zbar/img_scanner.c \
++		   ../../zbar/decoder.c \
++		   ../../zbar/image.c \
++		   ../../zbar/symbol.c \
++		   ../../zbar/convert.c \
++		   ../../zbar/config.c \
++		   ../../zbar/scanner.c \
++		   ../../zbar/error.c \
++		   ../../zbar/refcnt.c \
++		   ../../zbar/video.c \
++		   ../../zbar/video/null.c \
++		   ../../zbar/decoder/code128.c \
++		   ../../zbar/decoder/code39.c \
++		   ../../zbar/decoder/code93.c \
++		   ../../zbar/decoder/codabar.c \
++		   ../../zbar/decoder/databar.c \
++		   ../../zbar/decoder/ean.c \
++		   ../../zbar/decoder/i25.c \
++		   ../../zbar/decoder/qr_finder.c \
++		   ../../zbar/qrcode/bch15_5.c \
++		   ../../zbar/qrcode/binarize.c \
++		   ../../zbar/qrcode/isaac.c \
++		   ../../zbar/qrcode/qrdec.c \
++		   ../../zbar/qrcode/qrdectxt.c \
++		   ../../zbar/qrcode/rs.c \
++		   ../../zbar/qrcode/util.c
++
++LOCAL_C_INCLUDES := ../include \
++		    ../zbar \
++		    $(ICONV_SRC)/include 
++
++LOCAL_SHARED_LIBRARIES := libiconv
++
++include $(BUILD_SHARED_LIBRARY)
+\ No newline at end of file
+diff -r 563557a923d0 android/jni/Application.mk
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
++++ b/android/jni/Application.mk	Fri Feb 22 08:54:29 2013 -0300
+@@ -0,0 +1,1 @@
++APP_ABI := armeabi armeabi-v7a x86
+diff -r 563557a923d0 android/jni/config.h
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
++++ b/android/jni/config.h	Fri Feb 22 08:54:29 2013 -0300
+@@ -0,0 +1,236 @@
++/* manually customized for iPhone platform */
++
++#define HAVE_LANGINFO_CODESET 0
++
++/* whether to build support for Code 128 symbology */
++#define ENABLE_CODE128 1
++
++/* whether to build support for Code 93 symbology */
++#define ENABLE_CODE93 1
++
++/* whether to build support for Code 39 symbology */
++#define ENABLE_CODE39 1
++
++/* whether to build support for Codabar symbology */
++#define ENABLE_CODABAR 1
++
++/* whether to build support for DataBar symbology */
++#define ENABLE_DATABAR 1
++
++/* whether to build support for EAN symbologies */
++#define ENABLE_EAN 1
++
++/* whether to build support for Interleaved 2 of 5 symbology */
++#define ENABLE_I25 1
++
++/* whether to build support for PDF417 symbology */
++#undef ENABLE_PDF417
++
++/* whether to build support for QR Code */
++#define ENABLE_QRCODE 1
++
++/* Define to 1 if you have the `atexit' function. */
++#undef HAVE_ATEXIT
++
++/* Define to 1 if you have the <dlfcn.h> header file. */
++#undef HAVE_DLFCN_H
++
++/* Define to 1 if you have the <fcntl.h> header file. */
++#undef HAVE_FCNTL_H
++
++/* Define to 1 if you have the <features.h> header file. */
++#undef HAVE_FEATURES_H
++
++/* Define to 1 if you have the `getpagesize' function. */
++#undef HAVE_GETPAGESIZE
++
++/* Define if you have the iconv() function and it works. */
++#undef HAVE_ICONV
++
++/* Define to 1 if you have the <inttypes.h> header file. */
++#define HAVE_INTTYPES_H 1
++
++/* Define to 1 if you have the <jpeglib.h> header file. */
++#undef HAVE_JPEGLIB_H
++
++/* Define to 1 if you have the `jpeg' library (-ljpeg). */
++#undef HAVE_LIBJPEG
++
++/* Define to 1 if you have the `pthread' library (-lpthread). */
++#undef HAVE_LIBPTHREAD
++
++/* Define to 1 if you have the <linux/videodev2.h> header file. */
++#undef HAVE_LINUX_VIDEODEV2_H
++
++/* Define to 1 if you have the <linux/videodev.h> header file. */
++#undef HAVE_LINUX_VIDEODEV_H
++
++/* Define to 1 if you have the <memory.h> header file. */
++#undef HAVE_MEMORY_H
++
++/* Define to 1 if you have the `memset' function. */
++#define HAVE_MEMSET 1
++
++/* Define to 1 if you have a working `mmap' system call. */
++#undef HAVE_MMAP
++
++/* Define to 1 if you have the <poll.h> header file. */
++#undef HAVE_POLL_H
++
++/* Define to 1 if you have the <pthread.h> header file. */
++#undef HAVE_PTHREAD_H
++
++/* Define to 1 if you have the `setenv' function. */
++#undef HAVE_SETENV
++
++/* Define to 1 if you have the <stdint.h> header file. */
++#define HAVE_STDINT_H 1
++
++/* Define to 1 if you have the <stdlib.h> header file. */
++#define HAVE_STDLIB_H 1
++
++/* Define to 1 if you have the <strings.h> header file. */
++#define HAVE_STRINGS_H 1
++
++/* Define to 1 if you have the <string.h> header file. */
++#define HAVE_STRING_H 1
++
++/* Define to 1 if you have the <sys/ioctl.h> header file. */
++#undef HAVE_SYS_IOCTL_H
++
++/* Define to 1 if you have the <sys/ipc.h> header file. */
++#undef HAVE_SYS_IPC_H
++
++/* Define to 1 if you have the <sys/mman.h> header file. */
++#undef HAVE_SYS_MMAN_H
++
++/* Define to 1 if you have the <sys/shm.h> header file. */
++#undef HAVE_SYS_SHM_H
++
++/* Define to 1 if you have the <sys/stat.h> header file. */
++#define HAVE_SYS_STAT_H 1
++
++/* Define to 1 if you have the <sys/times.h> header file. */
++#define HAVE_SYS_TIMES_H 1
++
++/* Define to 1 if you have the <sys/time.h> header file. */
++#define HAVE_SYS_TIME_H 1
++
++/* Define to 1 if you have the <sys/types.h> header file. */
++#define HAVE_SYS_TYPES_H 1
++
++/* Define to 1 if the system has the type `uintptr_t'. */
++#define HAVE_UINTPTR_T 1
++
++/* Define to 1 if you have the <unistd.h> header file. */
++#define HAVE_UNISTD_H 1
++
++/* Define to 1 if you have the <vfw.h> header file. */
++#undef HAVE_VFW_H
++
++/* Define to 1 if you have the <X11/extensions/XShm.h> header file. */
++#undef HAVE_X11_EXTENSIONS_XSHM_H
++
++/* Define to 1 if you have the <X11/extensions/Xvlib.h> header file. */
++#undef HAVE_X11_EXTENSIONS_XVLIB_H
++
++/* Define as const if the declaration of iconv() needs const. */
++#undef ICONV_CONST
++
++/* Library major version */
++#define LIB_VERSION_MAJOR 0
++
++/* Library minor version */
++#define LIB_VERSION_MINOR 2
++
++/* Library revision */
++#define LIB_VERSION_REVISION 0
++
++/* Define to the sub-directory in which libtool stores uninstalled libraries.
++   */
++#undef LT_OBJDIR
++
++/* Define to 1 if assertions should be disabled. */
++//#undef NDEBUG
++
++/* Define to 1 if your C compiler doesn't accept -c and -o together. */
++#undef NO_MINUS_C_MINUS_O
++
++/* Name of package */
++#define PACKAGE "zbar"
++
++/* Define to the address where bug reports for this package should be sent. */
++#define PACKAGE_BUGREPORT "spadix at users.sourceforge.net"
++
++/* Define to the full name of this package. */
++#define PACKAGE_NAME "zbar"
++
++/* Define to the full name and version of this package. */
++#define PACKAGE_STRING "zbar 0.10"
++
++/* Define to the one symbol short name of this package. */
++#define PACKAGE_TARNAME "zbar"
++
++/* Define to the version of this package. */
++#define PACKAGE_VERSION "0.10"
++
++/* Define to 1 if you have the ANSI C header files. */
++#define STDC_HEADERS 1
++
++/* Version number of package */
++#define VERSION "0.10"
++
++/* Define to 1 if the X Window System is missing or not being used. */
++#define X_DISPLAY_MISSING 1
++
++/* Program major version (before the '.') as a number */
++#define ZBAR_VERSION_MAJOR 0
++
++/* Program minor version (after '.') as a number */
++#define ZBAR_VERSION_MINOR 10
++
++/* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>,
++   <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
++   #define below would cause a syntax error. */
++#undef _UINT32_T
++
++/* Define for Solaris 2.5.1 so the uint8_t typedef from <sys/synch.h>,
++   <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
++   #define below would cause a syntax error. */
++#undef _UINT8_T
++
++/* Minimum Windows API version */
++#undef _WIN32_WINNT
++
++/* used only for pthread debug attributes */
++#undef __USE_UNIX98
++
++/* Define to empty if `const' does not conform to ANSI C. */
++#undef const
++
++/* Define to `__inline__' or `__inline' if that's what the C compiler
++   calls it, or to nothing if 'inline' is not supported under any name.  */
++#ifndef __cplusplus
++#undef inline
++#endif
++
++/* Define to the type of a signed integer type of width exactly 32 bits if
++   such a type exists and the standard includes do not define it. */
++#undef int32_t
++
++/* Define to the type of an unsigned integer type of width exactly 32 bits if
++   such a type exists and the standard includes do not define it. */
++#undef uint32_t
++
++/* Define to the type of an unsigned integer type of width exactly 8 bits if
++   such a type exists and the standard includes do not define it. */
++#undef uint8_t
++
++/* Define to the type of an unsigned integer type wide enough to hold a
++   pointer, if such a type exists, and if the system does not define it. */
++#undef uintptr_t
++
++#ifndef X_DISPLAY_MISSING
++# define HAVE_X
++#endif
++
+diff -r 563557a923d0 android/proguard.cfg
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
++++ b/android/proguard.cfg	Fri Feb 22 08:54:29 2013 -0300
+@@ -0,0 +1,40 @@
++-optimizationpasses 5
++-dontusemixedcaseclassnames
++-dontskipnonpubliclibraryclasses
++-dontpreverify
++-verbose
++-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
++
++-keep public class * extends android.app.Activity
++-keep public class * extends android.app.Application
++-keep public class * extends android.app.Service
++-keep public class * extends android.content.BroadcastReceiver
++-keep public class * extends android.content.ContentProvider
++-keep public class * extends android.app.backup.BackupAgentHelper
++-keep public class * extends android.preference.Preference
++-keep public class com.android.vending.licensing.ILicensingService
++
++-keepclasseswithmembernames class * {
++    native <methods>;
++}
++
++-keepclasseswithmembers class * {
++    public <init>(android.content.Context, android.util.AttributeSet);
++}
++
++-keepclasseswithmembers class * {
++    public <init>(android.content.Context, android.util.AttributeSet, int);
++}
++
++-keepclassmembers class * extends android.app.Activity {
++   public void *(android.view.View);
++}
++
++-keepclassmembers enum * {
++    public static **[] values();
++    public static ** valueOf(java.lang.String);
++}
++
++-keep class * implements android.os.Parcelable {
++  public static final android.os.Parcelable$Creator *;
++}
+diff -r 563557a923d0 android/project.properties
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
++++ b/android/project.properties	Fri Feb 22 08:54:29 2013 -0300
+@@ -0,0 +1,12 @@
++# This file is automatically generated by Android Tools.
++# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
++#
++# This file must be checked in Version Control Systems.
++#
++# To customize properties used by the Ant build system use,
++# "ant.properties", and override values to adapt the script to your
++# project structure.
++
++android.library=true
++# Project target.
++target=android-8
+diff -r 563557a923d0 android/res/layout/main.xml
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
++++ b/android/res/layout/main.xml	Fri Feb 22 08:54:29 2013 -0300
+@@ -0,0 +1,13 @@
++<?xml version="1.0" encoding="utf-8"?>
++<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
++    android:orientation="vertical"
++    android:layout_width="fill_parent"
++    android:layout_height="fill_parent"
++    >
++<TextView  
++    android:layout_width="fill_parent" 
++    android:layout_height="wrap_content" 
++    android:text="Hello World, ACTIVITY_ENTRY_NAME"
++    />
++</LinearLayout>
++
+diff -r 563557a923d0 android/res/values/strings.xml
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
++++ b/android/res/values/strings.xml	Fri Feb 22 08:54:29 2013 -0300
+@@ -0,0 +1,4 @@
++<?xml version="1.0" encoding="utf-8"?>
++<resources>
++    <string name="app_name">ACTIVITY_ENTRY_NAME</string>
++</resources>
+diff -r 563557a923d0 configure.ac
+--- a/configure.ac	Tue Oct 27 11:25:59 2009 -0400
++++ b/configure.ac	Fri Feb 22 08:54:29 2013 -0300
+@@ -46,6 +46,13 @@
+   [[`echo "$LIB_VERSION" | sed -e 's/^[^:]*:\([^:]*\):.*$/\1/'`]],
+   [Library revision])
+ 
++AM_CPPFLAGS="-I$srcdir/include"
++AM_CFLAGS="-Wall -Wno-parentheses -Werror"
++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 @@
+ 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,codabar,i25,qrcode]])],
+   [],
+-  [enable_codes="ean,code39,code128,i25,qrcode"]) dnl pdf417
++  [enable_codes="ean,databar,code128,code93,code39,codabar,i25,qrcode"])
+ 
+ AC_DEFUN([ZBAR_CHK_CODE], [
+   AC_MSG_CHECKING([whether to build $2])
+@@ -97,11 +127,14 @@
+ ])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([codabar], [Codabar symbology])
+ ZBAR_CHK_CODE([i25], [Interleaved 2 of 5 symbology])
+ ZBAR_CHK_CODE([qrcode], [QR Code])
++ZBAR_CHK_CODE([pdf417], [PDF417 symbology])
+ 
+ dnl libraries
+ 
+@@ -144,23 +177,26 @@
+   [],
+   [enable_video="yes"])
+ 
+-with_video="no"
+-AS_IF([test "x$enable_video" != "xno"],
+-  [AS_IF([test "x$win32" = "xno"],
+-    [AC_CHECK_HEADERS([linux/videodev.h], [with_video="v4l1"],
+-      [AC_MSG_FAILURE([test for video support failed!
++have_v4l1="no"
++have_v4l2="no"
++AS_IF([test "x$enable_video" = "xno"],
++  [],
++  [test "x$win32" = "xno"],
++  [AC_CHECK_HEADERS([linux/videodev.h], [have_v4l1="yes"])
++   AC_CHECK_HEADERS([linux/videodev2.h], [have_v4l2="yes"])
++   AS_IF([test "x$have_v4l2" = "xno" && test "x$have_v4l1" = "xno"],
++     [AC_MSG_FAILURE([test for video support failed!
+ rebuild your kernel to include video4linux support or
+-configure --disable-video to skip building video support.])])
+-       AC_CHECK_HEADERS([linux/videodev2.h], [with_video="v4l2"],
+-         [AC_MSG_WARN([v4l2 API not detected, upgrade your kernel!])])],
+-    [AC_CHECK_HEADERS([vfw.h], [with_video="vfw"],
+-      [AC_MSG_FAILURE([test for VfW video support failed!
+-configure --disable-video to skip building vidoe support.])])])
+-])
++configure --disable-video to skip building video support.])],
++     [test "x$have_v4l2" = "xno"],
++     [AC_MSG_WARN([v4l2 API not detected, upgrade your kernel!])])],
++  [AC_CHECK_HEADERS([vfw.h], [with_video="vfw"],
++    [AC_MSG_FAILURE([test for VfW video support failed!
++configure --disable-video to skip building video support.])])])
++
+ AM_CONDITIONAL([HAVE_VIDEO], [test "x$enable_video" != "xno"])
+-AM_CONDITIONAL([HAVE_V4L1],
+-  [test "x$with_video" = "xv4l1" || test "x$with_video" = "xv4l2"])
+-AM_CONDITIONAL([HAVE_V4L2], [test "x$with_video" = "xv4l2"])
++AM_CONDITIONAL([HAVE_V4L1], [test "x$have_v4l1" != "xno"])
++AM_CONDITIONAL([HAVE_V4L2], [test "x$have_v4l2" != "xno"])
+ 
+ dnl X
+ AC_ARG_VAR([XSHM_LIBS], [linker flags for X shared memory extension])
+@@ -252,51 +288,105 @@
+ ])
+ AM_CONDITIONAL([HAVE_JPEG], [test "x$with_jpeg" = "xyes"])
+ 
+-dnl ImageMagick
++dnl ImageMagick or GraphicsMagick
++dnl disable both if IM is explicitly disabled to preserve old behavior
++
+ 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"])
++  [with_imagemagick="check"])
+ 
+-AS_IF([test "x$with_imagemagick" != "xno"],
+-  [PKG_CHECK_MODULES([MAGICK], [MagickWand >= 6.2.6], [],
+-     [dnl Wand is deprecated in favor of MagickWand,
+-      dnl but the latter doesn't exist in older verisons (bug #2848437)
++AC_ARG_WITH([graphicsmagick],
++  [AS_HELP_STRING([--with-graphicsmagick],
++    [use GraphicsMagick alternative to ImageMagick])],
++  [],
++  [with_graphicsmagick="check"])
++
++magick="UnknownMagick"
++have_IM="maybe"
++AS_IF([test "x$with_imagemagick" = "xno"], [],
++      [test "x$with_imagemagick" = "xyes" || \
++       test "x$with_graphicsmagick" != "xyes"],
++  [looked_for="ImageMagick >= 6.2.6"
++   PKG_CHECK_MODULES([MAGICK], [MagickWand >= 6.2.6],
++     [MAGICK_VERSION=`$PKG_CONFIG MagickWand --modversion`],
++     [dnl
++dnl Wand is deprecated in favor of MagickWand,
++dnl but the latter doesn't exist in older verisons (bug #2848437)
+       saved_error=$MAGICK_PKG_ERRORS
+-      PKG_CHECK_MODULES([MAGICK], [Wand >= 6.2.6], [],
+-        [AC_MSG_FAILURE([dnl
+-Unable to find ImageMagick >= 6.2.6:
++      PKG_CHECK_MODULES([MAGICK], [Wand >= 6.2.6],
++        [MAGICK_VERSION=`$PKG_CONFIG Wand --modversion`],
++        [have_IM="no"])])
++   AS_IF([test "x$have_IM" != "xno"],
++     [magick="ImageMagick"
++      AC_MSG_NOTICE([trying ImageMagick version $MAGICK_VERSION])
++dnl double check ImageMagick install (bug #2582232)
++      CPPFLAGS_save="$CPPFLAGS"
++      CPPFLAGS="$CPPFLAGS $MAGICK_CFLAGS"
++      AC_CHECK_HEADER([wand/MagickWand.h],
++        [have_IM="yes"],
++        [have_IM="broken"])
++      CPPFLAGS="$CPPFLAGS_save"])])
++
++have_GM="maybe"
++AS_IF([test "x$have_IM" = "xyes"], [],
++      [test "x$with_graphicsmagick" = "xno"], [],
++      [test "x$with_graphicsmagick" = "xyes" || \
++       test "x$with_imagemagick" = "xcheck"],
++  [AS_IF([test "x$looked_for" = "x"],
++     [looked_for="GraphicsMagick"],
++     [looked_for="$looked_for or GraphicsMagick"])
++   PKG_CHECK_MODULES([MAGICK], [GraphicsMagickWand],
++     [have_GM="yes"
++      magick="GraphicsMagick"
++      MAGICK_VERSION=`$PKG_CONFIG GraphicsMagickWand --modversion`],
++     [have_GM="no"
++      AS_IF([test "x$saved_error" = "x"],
++        [saved_error=$MAGICK_PKG_ERRORS])])])
++
++dnl now that we have collected all the info abt what Magick is available
++dnl let the user know what we will or can't do
++AS_IF([test "x$have_IM" = "xbroken" && test "x$have_GM" = "xyes"],
++  [AC_MSG_WARN([Your ImageMagick install is broken, using GraphicsMagick instead])])
++
++AS_IF([test "x$have_IM" = "xyes" || test "x$have_GM" = "xyes"],
++  [AC_MSG_NOTICE([using $magick version $MAGICK_VERSION])],
++  [test "x$with_imagemagick" = "xno" && \
++   test "x$with_graphicsmagick" != "xyes"],
++  [AC_MSG_NOTICE([image scanning disabled -- zbarimg will *not* be built])],
++  [test "x$have_IM" = "xbroken"],
++  [AC_MSG_FAILURE([$magick package found but wand/MagickWand.h not installed?!
++this is a problem with your $magick install, please try again after
++resolving the inconsistency or installing GraphicsMagick alternative...])],
++  [AC_MSG_FAILURE([dnl
++Unable to find $looked_for:
+ 
+ $saved_error
+ 
+-* Ensure that you installed any "development" packages for ImageMagick.
++* Ensure that you installed any "development" packages for ImageMagick or
++  GraphicsMagick.
+ * Consider adjusting the PKG_CONFIG_PATH environment variable if you
+   installed software in a non-standard prefix.
+ * You may set the environment variables MAGICK_CFLAGS and MAGICK_LIBS
+   to avoid the need to call pkg-config.
+   See the pkg-config man page for more details.
+-* To avoid using ImageMagick altogether you may add the --without-imagemagick
+-  flag to the configure command; the zbarimg program will not be built.
+-])])])
+-   MAGICK_VERSION=`$PKG_CONFIG MagickWand --modversion`
+-   AC_MSG_NOTICE([using ImageMagick version $MAGICK_VERSION])
++* To avoid using ImageMagick or GraphicsMagick altogether you may add the
++  --without-imagemagick flag to the configure command; the zbarimg program
++  will *not* be built.
++])])
+ 
+-dnl double check ImageMagick install (bug #2582232)
+-   CPPFLAGS_save="$CPPFLAGS"
+-   CPPFLAGS="$CPPFLAGS $MAGICK_CFLAGS"
+-   AC_CHECK_HEADER([wand/MagickWand.h], [],
+-     [AC_MSG_FAILURE([ImageMagick package found but wand/MagickWand.h not installed?!
+-this is a problem with your ImageMagick install,
+-please resolve the inconsistency and try again...])])
+-   CPPFLAGS="$CPPFLAGS_save"])
+-
+-AM_CONDITIONAL([HAVE_MAGICK], [test "x$with_imagemagick" = "xyes"])
++AS_IF([test "x$have_IM" = "xyes"],
++  [AC_DEFINE([HAVE_IMAGEMAGICK], [1], [Define to 1 to use ImageMagick])],
++  [test "x$have_GM" = "xyes"],
++  [AC_DEFINE([HAVE_GRAPHICSMAGICK], [1], [Define to 1 to use GraphicsMagick])])
++AM_CONDITIONAL([HAVE_MAGICK],
++  [test "x$have_IM" = "xyes" || test "x$have_GM" = "xyes"])
+ 
+ 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"])
+ 
+@@ -350,7 +440,16 @@
+      [test -x "$PYTHON-config"],
+      [PYTHON_CFLAGS=`$PYTHON-config --cflags`],
+      [PYTHON_CFLAGS=`$PYTHON -c 'import distutils.sysconfig as s; print " ".join(s.get_config_vars("CFLAGS")) + " -I"+s.get_python_inc() + " -I"+s.get_python_inc(plat_specific=True)'`])
+-dnl FIXME now should check that #include <Python.h> compiles
++
++dnl check that #include <Python.h> compiles (bug #3092663)
++   CPPFLAGS_save="$CPPFLAGS"
++   CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
++   AC_CHECK_HEADER([Python.h], [], [AC_MSG_ERROR([dnl
++Python module enabled, but unable to compile Python.h.
++Install the development package for python-$am_cv_python_version, or configure
++--without-python to disable the python bindings.dnl
++])])
++   CPPFLAGS="$CPPFLAGS_save"
+ 
+    AS_IF([test "x$with_gtk" = "xyes"],
+      [PKG_CHECK_MODULES([PYGTK], [pygtk-2.0])
+@@ -383,13 +482,39 @@
+ 
+ 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/types.h sys/stat.h sys/ioctl.h sys/time.h sys/times.h \
++  sys/ipc.h sys/shm.h sys/mman.h])
+ 
+ dnl types
+ 
+@@ -428,6 +553,7 @@
+ 
+ AC_CONFIG_FILES([
+ Makefile
++java/Makefile
+ zbar.pc
+ zbar-gtk.pc
+ zbar-qt.pc
+@@ -448,8 +574,10 @@
+ echo "jpeg              --with-jpeg=$with_jpeg"
+ AS_IF([test "x$with_jpeg" != "xyes"],
+   [echo "        => JPEG image conversions will *NOT* be supported"])
+-echo "Magick++          --with-imagemagick=$with_imagemagick"
+-AS_IF([test "x$with_imagemagick" != "xyes"],
++AS_IF([test "x$have_GM" = "xyes"],
++  [echo "GraphicsMagick    --with-graphicsmagick=yes"],
++  [echo "ImageMagick       --with-imagemagick=$with_imagemagick"])
++AS_IF([test "x$have_IM" != "xyes" && test "x$have_GM" != "xyes"],
+   [echo "        => the zbarimg file scanner will *NOT* be built"])
+ echo "Python            --with-python=$with_python"
+ echo "GTK+              --with-gtk=$with_gtk"
+@@ -460,6 +588,9 @@
+ 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 -r 563557a923d0 doc/Makefile.am.inc
+--- a/doc/Makefile.am.inc	Tue Oct 27 11:25:59 2009 -0400
++++ b/doc/Makefile.am.inc	Fri Feb 22 08:54:29 2013 -0300
+@@ -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 -r 563557a923d0 doc/api/footer.html
+--- a/doc/api/footer.html	Tue Oct 27 11:25:59 2009 -0400
++++ b/doc/api/footer.html	Fri Feb 22 08:54:29 2013 -0300
+@@ -9,9 +9,12 @@
+ 
+ <address><a href="mailto:spadix at users.sourceforge.net">spadix at 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 -r 563557a923d0 doc/manual.xml
+--- a/doc/manual.xml	Tue Oct 27 11:25:59 2009 -0400
++++ b/doc/manual.xml	Fri Feb 22 08:54:29 2013 -0300
+@@ -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 -r 563557a923d0 doc/ref/commonoptions.xml
+--- a/doc/ref/commonoptions.xml	Tue Oct 27 11:25:59 2009 -0400
++++ b/doc/ref/commonoptions.xml	Fri Feb 22 08:54:29 2013 -0300
+@@ -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>codabar</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
+@@ -128,11 +129,12 @@
+           If a decode result is outside the configured min/max range
+           (inclusive), it will not be reported.  Set to 0 to disable the
+           corresponding check.  This setting applies to variable-length
+-          symbologies: <option>i25</option>, <option>code39</option>,
+-          <option>code128</option> and <option>pdf417</option>.
+-          <option>min-length</option> defaults to 6 for <option>i25</option>
+-          and 1 for <option>code39</option> (per Code 39 autodiscrimination
+-          recommendation); all others default to 0</simpara>
++          symbologies: <option>i25</option>, <option>codabar</option>,
++          <option>code39</option>, <option>code128</option> and
++          <option>pdf417</option>. <option>min-length</option> defaults to 6
++          for <option>i25</option> and 1 for <option>code39</option> (per Code
++          39 autodiscrimination recommendation); all others default to
++          0</simpara>
+         </listitem>
+       </varlistentry>
+ 
+diff -r 563557a923d0 doc/ref/zbarcam.xml
+--- a/doc/ref/zbarcam.xml	Tue Oct 27 11:25:59 2009 -0400
++++ b/doc/ref/zbarcam.xml	Fri Feb 22 08:54:29 2013 -0300
+@@ -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, Codabar, 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 -r 563557a923d0 doc/ref/zbarimg.xml
+--- a/doc/ref/zbarimg.xml	Tue Oct 27 11:25:59 2009 -0400
++++ b/doc/ref/zbarimg.xml	Fri Feb 22 08:54:29 2013 -0300
+@@ -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, Codabar, 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 -r 563557a923d0 examples/paginate.pl
+--- a/examples/paginate.pl	Tue Oct 27 11:25:59 2009 -0400
++++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
+@@ -1,71 +0,0 @@
+-#!/usr/bin/perl
+-#------------------------------------------------------------------------
+-#  Copyright 2009 (c) Jeff Brown <spadix at 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 -r 563557a923d0 examples/processor.c
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
++++ b/examples/processor.c	Fri Feb 22 08:54:29 2013 -0300
+@@ -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 -r 563557a923d0 examples/processor.cpp
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
++++ b/examples/processor.cpp	Fri Feb 22 08:54:29 2013 -0300
+@@ -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 -r 563557a923d0 examples/processor.pl
+--- a/examples/processor.pl	Tue Oct 27 11:25:59 2009 -0400
++++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
+@@ -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 -r 563557a923d0 examples/processor.py
+--- a/examples/processor.py	Tue Oct 27 11:25:59 2009 -0400
++++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
+@@ -1,35 +0,0 @@
+-#!/usr/bin/python
+-from sys import argv
+-import zbar
+-
+-# create a Processor
+-proc = zbar.Processor()
+-
+-# configure the Processor
+-proc.parse_config('enable')
+-
+-# initialize the Processor
+-device = '/dev/video0'
+-if len(argv) > 1:
+-    device = argv[1]
+-proc.init(device)
+-
+-# setup a callback
+-def my_handler(proc, image, closure):
+-    # extract results
+-    for symbol in image.symbols:
+-        # do something useful with results
+-        print 'decoded', symbol.type, 'symbol', '"%s"' % symbol.data
+-
+-proc.set_data_handler(my_handler)
+-
+-# enable the preview window
+-proc.visible = True
+-
+-# initiate scanning
+-proc.active = True
+-try:
+-    # keep scanning until user provides key/mouse input
+-    proc.user_wait()
+-except zbar.WindowClosed, e:
+-    pass
+diff -r 563557a923d0 examples/read_one.pl
+--- a/examples/read_one.pl	Tue Oct 27 11:25:59 2009 -0400
++++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
+@@ -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 -r 563557a923d0 examples/read_one.py
+--- a/examples/read_one.py	Tue Oct 27 11:25:59 2009 -0400
++++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
+@@ -1,29 +0,0 @@
+-#!/usr/bin/python
+-from sys import argv
+-import zbar
+-
+-# create a Processor
+-proc = zbar.Processor()
+-
+-# configure the Processor
+-proc.parse_config('enable')
+-
+-# initialize the Processor
+-device = '/dev/video0'
+-if len(argv) > 1:
+-    device = argv[1]
+-proc.init(device)
+-
+-# enable the preview window
+-proc.visible = True
+-
+-# read at least one barcode (or until window closed)
+-proc.process_one()
+-
+-# hide the preview window
+-proc.visible = False
+-
+-# extract results
+-for symbol in proc.results:
+-    # do something useful with results
+-    print 'decoded', symbol.type, 'symbol', '"%s"' % symbol.data
+diff -r 563557a923d0 examples/scan_image.c
+--- a/examples/scan_image.c	Tue Oct 27 11:25:59 2009 -0400
++++ b/examples/scan_image.c	Fri Feb 22 08:54:29 2013 -0300
+@@ -3,6 +3,20 @@
+ #include <png.h>
+ #include <zbar.h>
+ 
++#if !defined(PNG_LIBPNG_VER) || \
++    PNG_LIBPNG_VER < 10018 ||   \
++    (PNG_LIBPNG_VER > 10200 &&  \
++     PNG_LIBPNG_VER < 10209)
++  /* Changes to Libpng from version 1.2.42 to 1.4.0 (January 4, 2010)
++   * ...
++   * 2. m. The function png_set_gray_1_2_4_to_8() was removed. It has been
++   *       deprecated since libpng-1.0.18 and 1.2.9, when it was replaced with
++   *       png_set_expand_gray_1_2_4_to_8() because the former function also
++   *       expanded palette images.
++   */
++# define png_set_expand_gray_1_2_4_to_8 png_set_gray_1_2_4_to_8
++#endif
++
+ zbar_image_scanner_t *scanner = NULL;
+ 
+ /* to complete a runnable example, this abbreviated implementation of
+@@ -30,7 +44,7 @@
+     if(color & PNG_COLOR_TYPE_PALETTE)
+         png_set_palette_to_rgb(png);
+     if(color == PNG_COLOR_TYPE_GRAY && bits < 8)
+-        png_set_gray_1_2_4_to_8(png);
++        png_set_expand_gray_1_2_4_to_8(png);
+     if(bits == 16)
+         png_set_strip_16(png);
+     if(color & PNG_COLOR_MASK_ALPHA)
+@@ -65,7 +79,7 @@
+ 
+     /* 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 -r 563557a923d0 examples/scan_image.pl
+--- a/examples/scan_image.pl	Tue Oct 27 11:25:59 2009 -0400
++++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
+@@ -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 -r 563557a923d0 examples/scan_image.py
+--- a/examples/scan_image.py	Tue Oct 27 11:25:59 2009 -0400
++++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
+@@ -1,31 +0,0 @@
+-#!/usr/bin/python
+-from sys import argv
+-import zbar
+-import Image
+-
+-if len(argv) < 2: exit(1)
+-
+-# create a reader
+-scanner = zbar.ImageScanner()
+-
+-# configure the reader
+-scanner.parse_config('enable')
+-
+-# obtain image data
+-pil = Image.open(argv[1]).convert('L')
+-width, height = pil.size
+-raw = pil.tostring()
+-
+-# wrap image data
+-image = zbar.Image(width, height, 'Y800', raw)
+-
+-# scan the image for barcodes
+-scanner.scan(image)
+-
+-# extract results
+-for symbol in image:
+-    # do something useful with results
+-    print 'decoded', symbol.type, 'symbol', '"%s"' % symbol.data
+-
+-# clean up
+-del(image)
+diff -r 563557a923d0 examples/upcrpc.pl
+--- a/examples/upcrpc.pl	Tue Oct 27 11:25:59 2009 -0400
++++ b/examples/upcrpc.pl	Fri Feb 22 08:54:29 2013 -0300
+@@ -3,7 +3,7 @@
+ 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 -r 563557a923d0 examples/upcrpc.py
+--- a/examples/upcrpc.py	Tue Oct 27 11:25:59 2009 -0400
++++ b/examples/upcrpc.py	Fri Feb 22 08:54:29 2013 -0300
+@@ -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 -r 563557a923d0 gtk/zbargtk.c
+--- a/gtk/zbargtk.c	Tue Oct 27 11:25:59 2009 -0400
++++ b/gtk/zbargtk.c	Fri Feb 22 08:54:29 2013 -0300
+@@ -1,5 +1,5 @@
+ /*------------------------------------------------------------------------
+- *  Copyright 2008-2009 (c) Jeff Brown <spadix at users.sourceforge.net>
++ *  Copyright 2008-2010 (c) Jeff Brown <spadix at 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 @@
+ 
+     /* 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 @@
+ 
+     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 @@
+          */
+         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 @@
+     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);
+ 
+@@ -236,7 +231,6 @@
+ 
+                 /* FIXME skip this when unconnected? */
+                 gchar *text = g_strconcat(zbar_get_symbol_name(type),
+-                                          zbar_get_addon_name(type),
+                                           ":",
+                                           data,
+                                           NULL);
+@@ -560,6 +554,19 @@
+     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 +620,8 @@
+     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 -r 563557a923d0 gtk/zbargtkprivate.h
+--- a/gtk/zbargtkprivate.h	Tue Oct 27 11:25:59 2009 -0400
++++ b/gtk/zbargtkprivate.h	Fri Feb 22 08:54:29 2013 -0300
+@@ -71,6 +71,7 @@
+      * 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 -r 563557a923d0 include/zbar.h
+--- a/include/zbar.h	Tue Oct 27 11:25:59 2009 -0400
++++ b/include/zbar.h	Fri Feb 22 08:54:29 2013 -0300
+@@ -1,5 +1,5 @@
+ /*------------------------------------------------------------------------
+- *  Copyright 2007-2009 (c) Jeff Brown <spadix at users.sourceforge.net>
++ *  Copyright 2007-2010 (c) Jeff Brown <spadix at users.sourceforge.net>
+  *
+  *  This file is part of the ZBar Bar Code Reader.
+  *
+@@ -86,23 +86,58 @@
+ typedef enum zbar_symbol_type_e {
+     ZBAR_NONE        =      0,  /**< no symbol decoded */
+     ZBAR_PARTIAL     =      1,  /**< intermediate status */
++    ZBAR_EAN2        =      2,  /**< GS1 2-digit add-on */
++    ZBAR_EAN5        =      5,  /**< GS1 5-digit add-on */
+     ZBAR_EAN8        =      8,  /**< EAN-8 */
+     ZBAR_UPCE        =      9,  /**< UPC-E */
+     ZBAR_ISBN10      =     10,  /**< ISBN-10 (from EAN-13). @since 0.4 */
+     ZBAR_UPCA        =     12,  /**< UPC-A */
+     ZBAR_EAN13       =     13,  /**< EAN-13 */
+     ZBAR_ISBN13      =     14,  /**< ISBN-13 (from EAN-13). @since 0.4 */
++    ZBAR_COMPOSITE   =     15,  /**< EAN/UPC composite */
+     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_CODABAR     =     38,  /**< Codabar. @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 */
+-    ZBAR_ADDON5      = 0x0500,  /**< 5-digit add-on flag */
+-    ZBAR_ADDON       = 0x0700,  /**< add-on flag mask */
++
++    /** mask for base symbol type.
++     * @deprecated in 0.11, remove this from existing code
++     */
++    ZBAR_SYMBOL      = 0x00ff,
++    /** 2-digit add-on flag.
++     * @deprecated in 0.11, a ::ZBAR_EAN2 component is used for
++     * 2-digit GS1 add-ons
++     */
++    ZBAR_ADDON2      = 0x0200,
++    /** 5-digit add-on flag.
++     * @deprecated in 0.11, a ::ZBAR_EAN5 component is used for
++     * 5-digit GS1 add-ons
++     */
++    ZBAR_ADDON5      = 0x0500,
++    /** add-on flag mask.
++     * @deprecated in 0.11, GS1 add-ons are represented using composite
++     * symbols of type ::ZBAR_COMPOSITE; add-on components use ::ZBAR_EAN2
++     * or ::ZBAR_EAN5
++     */
++    ZBAR_ADDON       = 0x0700,
+ } 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 +168,33 @@
+     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)
+@@ -168,9 +224,32 @@
+  * @param sym symbol type encoding
+  * @returns static string name for any addon, or the empty string
+  * if no addons were decoded
++ * @deprecated in 0.11
+  */
+ 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 +263,30 @@
+                              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 +332,20 @@
+  */
+ 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 +401,14 @@
+ 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 +482,14 @@
+ 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 +589,25 @@
+  */
+ 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 +657,24 @@
+                                     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 +1312,14 @@
+            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 +1367,20 @@
+ 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 -r 563557a923d0 include/zbar/Decoder.h
+--- a/include/zbar/Decoder.h	Tue Oct 27 11:25:59 2009 -0400
++++ b/include/zbar/Decoder.h	Fri Feb 22 08:54:29 2013 -0300
+@@ -1,5 +1,5 @@
+ //------------------------------------------------------------------------
+-//  Copyright 2007-2009 (c) Jeff Brown <spadix at users.sourceforge.net>
++//  Copyright 2007-2010 (c) Jeff Brown <spadix at users.sourceforge.net>
+ //
+ //  This file is part of the ZBar Bar Code Reader.
+ //
+@@ -115,6 +115,7 @@
+ 
+     /// retrieve string name for last decode addon.
+     /// see zbar_get_addon_name()
++    /// @deprecated in 0.11
+     const char *get_addon_name () const
+     {
+         return(zbar_get_addon_name(zbar_decoder_get_type(_decoder)));
+@@ -149,6 +150,14 @@
+         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 -r 563557a923d0 include/zbar/Image.h
+--- a/include/zbar/Image.h	Tue Oct 27 11:25:59 2009 -0400
++++ b/include/zbar/Image.h	Fri Feb 22 08:54:29 2013 -0300
+@@ -1,5 +1,5 @@
+ //------------------------------------------------------------------------
+-//  Copyright 2007-2009 (c) Jeff Brown <spadix at users.sourceforge.net>
++//  Copyright 2007-2010 (c) Jeff Brown <spadix at users.sourceforge.net>
+ //
+ //  This file is part of the ZBar Bar Code Reader.
+ //
+@@ -67,7 +67,12 @@
+         {
+             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 @@
+ 
+     ~Image ()
+     {
++        if(zbar_image_get_userdata(_img) == this)
++            zbar_image_set_userdata(_img, NULL);
+         zbar_image_ref(_img, -1);
+     }
+ 
+@@ -143,12 +150,7 @@
+     /// 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 @@
+         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 @@
+         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
+@@ -224,6 +255,15 @@
+         throw FormatError();
+     }
+ 
++    /// image format conversion.
++    /// see zbar_image_convert()
++    /// @since 0.11
++    Image convert (std::string format) const
++    {
++        unsigned long fourcc = zbar_fourcc_parse(format.c_str());
++        return(convert(fourcc));
++    }
++
+     /// image format conversion with crop/pad.
+     /// see zbar_image_convert_resize()
+     /// @since 0.4
+@@ -278,7 +318,6 @@
+     {
+         // by default nothing is cleaned
+         assert(img);
+-        assert(zbar_image_get_userdata(img));
+     }
+ 
+ private:
+diff -r 563557a923d0 include/zbar/Processor.h
+--- a/include/zbar/Processor.h	Tue Oct 27 11:25:59 2009 -0400
++++ b/include/zbar/Processor.h	Fri Feb 22 08:54:29 2013 -0300
+@@ -1,5 +1,5 @@
+ //------------------------------------------------------------------------
+-//  Copyright 2007-2009 (c) Jeff Brown <spadix at users.sourceforge.net>
++//  Copyright 2007-2010 (c) Jeff Brown <spadix at users.sourceforge.net>
+ //
+ //  This file is part of the ZBar Bar Code Reader.
+ //
+@@ -183,8 +183,8 @@
+     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 -r 563557a923d0 include/zbar/QZBarImage.h
+--- a/include/zbar/QZBarImage.h	Tue Oct 27 11:25:59 2009 -0400
++++ b/include/zbar/QZBarImage.h	Fri Feb 22 08:54:29 2013 -0300
+@@ -1,5 +1,5 @@
+ //------------------------------------------------------------------------
+-//  Copyright 2008-2009 (c) Jeff Brown <spadix at users.sourceforge.net>
++//  Copyright 2008-2010 (c) Jeff Brown <spadix at users.sourceforge.net>
+ //
+ //  This file is part of the ZBar Bar Code Reader.
+ //
+@@ -53,7 +53,7 @@
+         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 -r 563557a923d0 include/zbar/Symbol.h
+--- a/include/zbar/Symbol.h	Tue Oct 27 11:25:59 2009 -0400
++++ b/include/zbar/Symbol.h	Fri Feb 22 08:54:29 2013 -0300
+@@ -1,5 +1,5 @@
+ //------------------------------------------------------------------------
+-//  Copyright 2007-2009 (c) Jeff Brown <spadix at users.sourceforge.net>
++//  Copyright 2007-2010 (c) Jeff Brown <spadix at users.sourceforge.net>
+ //
+ //  This file is part of the ZBar Bar Code Reader.
+ //
+@@ -64,6 +64,21 @@
+         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 @@
+         return(_syms);
+     }
+ 
+-    int get_size ()
++    int get_size () const
+     {
+         return((_syms) ? zbar_symbol_set_get_size(_syms) : 0);
+     }
+@@ -112,9 +127,16 @@
+ 
+         /// 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);
+         }
+     };
+ 
+@@ -129,31 +151,52 @@
+             : _sym(sym),
+               _index(index)
+         {
+-            sym->ref(1);
++            if(sym)
++                sym->ref(1);
+             if(!sym ||
+                (unsigned)_index >= zbar_symbol_get_loc_size(*_sym))
+                 _index = -1;
+         }
+ 
+-        /// constructor.
++        /// copy constructor.
+         PointIterator (const PointIterator& iter)
+             : _sym(iter._sym),
+               _index(iter._index)
+         {
+-            _sym->ref();
++            if(_sym)
++                _sym->ref();
+         }
+ 
+         /// destructor.
+         ~PointIterator ()
+         {
+-            _sym->ref(-1);
++            if(_sym)
++                _sym->ref(-1);
++        }
++
++        /// assignment.
++        PointIterator& operator= (const PointIterator& iter)
++        {
++            if(iter._sym)
++                iter._sym->ref();
++            if(_sym)
++                _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++ ()
+         {
+             unsigned int i = ++_index;
+-            if(i >= zbar_symbol_get_loc_size(*_sym))
++            if(!_sym || i >= zbar_symbol_get_loc_size(*_sym))
+                 _index = -1;
+             return(*this);
+         }
+@@ -161,7 +204,9 @@
+         /// 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 +258,32 @@
+         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)
+@@ -250,6 +321,7 @@
+     }
+ 
+     /// retrieve the string name for any addon.
++    /// @deprecated in 0.11
+     const std::string get_addon_name () const
+     {
+         return(zbar_get_addon_name(_type));
+@@ -269,12 +341,20 @@
+ 
+     /// retrieve inter-frame coherency count.
+     /// see zbar_symbol_get_count()
+-    /// @since 1.5
++    /// @since 0.5
+     int get_count () const
+     {
+         return((_sym) ? zbar_symbol_get_count(_sym) : -1);
+     }
+ 
++    /// retrieve loosely defined relative quality metric.
++    /// see zbar_symbol_get_quality()
++    /// @since 0.11
++    int get_quality () const
++    {
++        return((_sym) ? zbar_symbol_get_quality(_sym) : 0);
++    }
++
+     SymbolSet get_components () const
+     {
+         return(SymbolSet((_sym) ? zbar_symbol_get_components(_sym) : NULL));
+@@ -311,6 +391,13 @@
+         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 +407,6 @@
+     }
+ 
+ protected:
+-
+-    friend class SymbolIterator;
+-
+     /// (re)initialize Symbol from C symbol object.
+     void init (const zbar_symbol_t *sym = NULL)
+     {
+@@ -361,7 +445,7 @@
+     {
+         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 +454,33 @@
+     {
+         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);
+     }
+ 
+@@ -440,9 +532,7 @@
+ static inline std::ostream& operator<< (std::ostream& out,
+                                         const Symbol& sym)
+ {
+-    out << sym.get_type_name()
+-        << sym.get_addon_name()
+-        << ":" << sym.get_data();
++    out << sym.get_type_name() << ":" << sym.get_data();
+     return(out);
+ }
+ 
+diff -r 563557a923d0 include/zbar/Video.h
+--- a/include/zbar/Video.h	Tue Oct 27 11:25:59 2009 -0400
++++ b/include/zbar/Video.h	Fri Feb 22 08:54:29 2013 -0300
+@@ -1,5 +1,5 @@
+ //------------------------------------------------------------------------
+-//  Copyright 2007-2009 (c) Jeff Brown <spadix at users.sourceforge.net>
++//  Copyright 2007-2010 (c) Jeff Brown <spadix at users.sourceforge.net>
+ //
+ //  This file is part of the ZBar Bar Code Reader.
+ //
+@@ -92,7 +92,7 @@
+     /// 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 -r 563557a923d0 include/zbar/zbargtk.h
+--- a/include/zbar/zbargtk.h	Tue Oct 27 11:25:59 2009 -0400
++++ b/include/zbar/zbargtk.h	Fri Feb 22 08:54:29 2013 -0300
+@@ -136,7 +136,7 @@
+ 
+ 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 @@
+  */
+ 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 -r 563557a923d0 iphone/ChangeLog
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
++++ b/iphone/ChangeLog	Fri Feb 22 08:54:29 2013 -0300
+@@ -0,0 +1,138 @@
++version 1.3.1:
++  * fix examples
++    - fix EmbedReader initial iPad orientation
++    - fix TabReader shouldn't show controls
++  * add retry workaround when device lock fails
++    - add iPhone 5 launch image to examples
++    - doc updates
++  * Lion and Xcode updates
++    - fix new warnings/errors
++    - find missing buddy
++    - fix SDK bg image: force resoution to 72dpi
++  * Fix EmbedReader example rotation interaction
++
++version 1.2.2:
++  * reduce controller present and dismiss latency
++    - add simple shutter to mask video start
++
++version 1.2.1:
++  * fix overlay resizing bug
++
++version 1.2:
++  * release updates
++
++version 1.1.3:
++  * fix UITabViewController rotation interaction
++
++version 1.1.2:
++  * add maxZoom for increasing zoom range
++    - workaround camera preview initial location/size bug
++  * add emulation for UI videoQuality to adjust camera resolution
++  * fix several simulator-related bugs
++    - fix device property missing from simulated ZBarReaderView
++    - fix AVCaptureDevice referenced from ZBarReaderViewController
++    - fix simulated camera gesture multiple recognition
++
++version 1.1.1:
++  * fix ReaderSample project path to ZBarSDK
++  * README document new examples
++    - make ReaderSample scheme public
++  * documentation updates
++  * add emulation for UI camera device and flash mode properties
++  * workaround orientation bugs in parent controllers
++    - enable orientation and iPad support for all examples
++  * add orientation detection fall back
++  * fix captureReader not exposed to simulator
++  * fix camera preview stale rotation corner
++    - fix ZBarReaderViewController toolbar layout accomodation
++    - switch pre-release samples to use debug library
++  * update docs to note possible link order dependency
++  * add missing references to new samples
++  * add IB support to ZBarReaderViewController
++    - add tabbed reader sample
++  * add embedded reader sample
++    - factor out camera simulation logic
++  * fix readertest max quality result filtering
++    - thanks to John Boydon for finding this!
++  * improve support for resizing, rotating and embedding the reader
++  * add readertest fixed zoom stops
++  * add manual frame capture
++    - readertest save as PNG
++  * enhance readertest to support default/demo pre-config and distribution
++  * updates for Xcode 4
++  * expose tracking box color
++
++version 1.1:
++  * fix doc typo (bug #3139087)
++    - add modifier bit docs
++
++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
++    - update to use latest SDK
++  * add support for Code 93 symbology
++
++version 1.0:
++  * update to SDK 4.1, clean out LLVM warnings
++  * fix camera simulation gesture
++
++version 0.1.2:
++  * fix missing header dependency
++  * doc enhancements
++  * force controls to front when showsZBarControls is enabled
++  * fix initial zoom crop (performance bug)
++  * workaround iPhone quartz access past image data
++
++version 0.1.1:
++  * migrate to binary iPhone SDK distribution (NB backward incompatibilities!)
++    - restructure headers
++
++version 0.1:
++  * workaround for iPhone simulator builds
++    - refactor ZBarReaderView for capture/simulator specific implementations
++    - fix tracking calculations
++    - fix captured video frame color conversion
++  * fix for poor iPhone 4 performance
++  * enable torch for iPhone 4
++  * fix iPhone circular ref bug
++  * add iPhone cache flush, change new libs to weak refs
++  * fix iPhone async ref bug
++  * enhance iPhone readertest w/more options
++  * add iPhone zoom support, integrate with crop
++  * add iPhone OS 4.0 video capture support
++    - replacement view controller for new camera reader
++    - separate view for use without controller
++    - separate capture delegate for use standalone
++    - add continuous autofocus
++  * cleanup and expose iphone help display API
++  * fixes to new iphone help display
++  * migrate iphone help display to integrated web page (NB resource updates!)
++    - allows easier customization
++    - local links open directly, external links confirm and jump out to Safari
++    - JavaScript hook for help context customization
++    - also enhanced default help (note this changes the required resources)
++    - fix to disable scanning during help overlay
++    - thanks to iafanasyev and others for detailed suggestions
++  * fix iphone custom overlay response (bug #2959617)
++    - thanks to an anonymous user for the patch!
++  * iphone widget performance tuning enhancements
++    - fix crop calculation bug in ZBarImage
++    - add properties to control pre-scan image cropping and scaling
++    - add property for scanner cache control
++    - enable some scanner density control (FIXME should be property)
++    - fix ifdef for quality control (FIXME should be property)
++    - add "sequence" mode test (not actually so useful)
++  * realtime scanning for iphone widget
++    - uses UIGetScreenImage() (NB private)
++    - ZBarImage from CGImage (instead of UIImage)
++    - add crop to scaling step
++    - expose symbol set unfiltered results
++  * iphone widget back compat updates, add basic test app
++  * add Obj-C wrapper
++  * first pass working iPhone "widget"
+diff -r 563557a923d0 iphone/README
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
++++ b/iphone/README	Fri Feb 22 08:54:29 2013 -0300
+@@ -0,0 +1,66 @@
++ZBar iOS SDK
++============
++
++ZBar Bar Code Reader is an open source software suite for reading bar
++codes from various sources, such as video streams, image files and raw
++intensity sensors. It supports EAN-13/UPC-A, UPC-E, EAN-8, DataBar,
++Code 128, Code 93, Code 39, Codabar, Interleaved 2 of 5 and QR Code.
++These are the Objective C wrappers and integrated widget for developing
++with the library on the iOS platform.
++
++Check the ZBar project home page for the latest release, forums, etc.
++
++* http://zbar.sourceforge.net/iphone
++
++Installation
++------------
++
++If you are migrating from a pre-SDK source version of the library,
++first make sure you remove all of the old references to zbar.xcodeproj
++and libzbar.a and revert any related build settings.
++
++To add the SDK to an Xcode project:
++
++   1. Drag ZBarSDK into your Xcode project.
++   3. Add these system frameworks to your project:
++      * AVFoundation.framework (weak)
++      * CoreMedia.framework (weak)
++      * CoreVideo.framework (weak)
++      * QuartzCore.framework
++      * libiconv.dylib
++
++Documentation
++-------------
++
++See Documentation.html for complete SDK documentation.
++
++Examples
++--------
++
++You should be able to open and build the examples directly from the
++disk image (ignore warnings about the read-only volume).  If you have
++problems with this, please copy the examples to your local drive
++instead and build from there.
++
++A tutorial that walks through installing and using the SDK is
++available in the documentation.  The SDK disk image also contains the
++resulting Xcode project at Examples/ReaderSample.
++
++Examples/readertest demonstrates most of the configuration options
++available for the reader.
++
++Examples/TabReader shows how you can use Interface Builder to add the
++reader as a tab in a UITabBarController.
++
++Examples/EmbedReader shows how a ZBarReaderView may be embedded
++directly in the application view hierarchy.
++
++Copyright and License
++---------------------
++
++Licensed under the GNU Lesser General Public License, version 2.1.
++http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
++
++Copyright 2008-2011 � Jeff Brown <spadix at users.sourceforge.net> et al
++
++See the included files COPYING and LICENSE for details
+diff -r 563557a923d0 iphone/ZBarCVImage.h
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
++++ b/iphone/ZBarCVImage.h	Fri Feb 22 08:54:29 2013 -0300
+@@ -0,0 +1,43 @@
++//------------------------------------------------------------------------
++//  Copyright 2010 (c) Jeff Brown <spadix at 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
++//------------------------------------------------------------------------
++
++#import <ZBarSDK/ZBarImage.h>
++#import <CoreVideo/CoreVideo.h>
++
++// ZBarImage referring to a CVPixelBuffer.  used internally to handle
++// asynchronous conversion to UIImage
++
++ at interface ZBarCVImage
++    : ZBarImage
++{
++    CVPixelBufferRef pixelBuffer;
++    void *rgbBuffer;
++    NSInvocationOperation *conversion;
++}
++
++- (void) waitUntilConverted;
++
++ at property (nonatomic) CVPixelBufferRef pixelBuffer;
++ at property (nonatomic, readonly) void *rgbBuffer;
++
++ at end
+diff -r 563557a923d0 iphone/ZBarCVImage.m
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
++++ b/iphone/ZBarCVImage.m	Fri Feb 22 08:54:29 2013 -0300
+@@ -0,0 +1,195 @@
++//------------------------------------------------------------------------
++//  Copyright 2010 (c) Jeff Brown <spadix at 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
++//------------------------------------------------------------------------
++
++#import "ZBarCVImage.h"
++#define MODULE ZBarCVImage
++#import "debug.h"
++
++static NSOperationQueue *conversionQueue;
++
++static const void*
++asyncProvider_getBytePointer (void *info)
++{
++    // block until data is available
++    ZBarCVImage *image = info;
++    assert(image);
++    [image waitUntilConverted];
++    void *buf = image.rgbBuffer;
++    assert(buf);
++    return(buf);
++}
++
++static const CGDataProviderDirectCallbacks asyncProvider = {
++    .version = 0,
++    .getBytePointer = asyncProvider_getBytePointer,
++    .releaseBytePointer = NULL,
++    .getBytesAtPosition = NULL,
++    .releaseInfo = (void*)CFRelease,
++};
++
++ at implementation ZBarCVImage
++
++ at synthesize pixelBuffer, rgbBuffer;
++
++- (void) dealloc
++{
++    self.pixelBuffer = NULL;
++    if(rgbBuffer) {
++        free(rgbBuffer);
++        rgbBuffer = NULL;
++    }
++    [conversion release];
++    conversion = nil;
++    [super dealloc];
++}
++
++- (void) setPixelBuffer: (CVPixelBufferRef) newbuf
++{
++    CVPixelBufferRef oldbuf = pixelBuffer;
++    if(newbuf)
++        CVPixelBufferRetain(newbuf);
++    pixelBuffer = newbuf;
++    if(oldbuf)
++        CVPixelBufferRelease(oldbuf);
++}
++
++- (void) waitUntilConverted
++{
++    // operation will at least have been queued already
++    NSOperation *op = [conversion retain];
++    if(!op)
++        return;
++    [op waitUntilFinished];
++    [op release];
++}
++
++- (UIImage*) UIImageWithOrientation: (UIImageOrientation) orient
++{
++    if(!conversion && !rgbBuffer) {
++        // start format conversion in separate thread
++        NSOperationQueue *queue = conversionQueue;
++        if(!queue) {
++            queue = conversionQueue = [NSOperationQueue new];
++            queue.maxConcurrentOperationCount = 1;
++        }
++        else
++            [queue waitUntilAllOperationsAreFinished];
++
++        conversion = [[NSInvocationOperation alloc]
++                         initWithTarget: self
++                         selector: @selector(convertCVtoRGB)
++                         object: nil];
++        [queue addOperation: conversion];
++        [conversion release];
++    }
++
++    // create UIImage before converted data is available
++    CGSize size = self.size;
++    int w = size.width;
++    int h = size.height;
++
++    CGDataProviderRef datasrc =
++        CGDataProviderCreateDirect([self retain], 3 * w * h, &asyncProvider);
++    CGColorSpaceRef cs = CGColorSpaceCreateDeviceRGB();
++    CGImageRef cgimg =
++        CGImageCreate(w, h, 8, 24, 3 * w, cs,
++                      kCGBitmapByteOrderDefault, datasrc,
++                      NULL, YES, kCGRenderingIntentDefault);
++    CGColorSpaceRelease(cs);
++    CGDataProviderRelease(datasrc);
++
++    UIImage *uiimg =
++        [UIImage imageWithCGImage: cgimg
++                 scale: 1
++                 orientation: orient];
++    CGImageRelease(cgimg);
++
++    return(uiimg);
++}
++
++// convert video frame to a CGImage compatible RGB format
++// FIXME this is temporary until we can find the native way...
++- (void) convertCVtoRGB
++{
++    timer_start;
++    unsigned long format = self.format;
++    assert(format == zbar_fourcc('C','V','2','P'));
++    if(format != zbar_fourcc('C','V','2','P'))
++        return;
++
++    CVPixelBufferLockBaseAddress(pixelBuffer, kCVPixelBufferLock_ReadOnly);
++    int w = CVPixelBufferGetWidth(pixelBuffer);
++    int h = CVPixelBufferGetHeight(pixelBuffer);
++    int dy = CVPixelBufferGetBytesPerRowOfPlane(pixelBuffer, 0);
++    int duv = CVPixelBufferGetBytesPerRowOfPlane(pixelBuffer, 1);
++    uint8_t *py = CVPixelBufferGetBaseAddressOfPlane(pixelBuffer, 0);
++    uint8_t *puv = CVPixelBufferGetBaseAddressOfPlane(pixelBuffer, 1);
++    if(!py || !puv || dy < w || duv < w)
++        goto error;
++
++    int datalen = 3 * w * h;
++    // Quartz accesses some undocumented amount past allocated data?
++    // ...allocate extra to compensate
++    uint8_t *pdst = rgbBuffer = malloc(datalen + 3 * w);
++    if(!pdst)
++        goto error;
++    [self setData: rgbBuffer
++          withLength: datalen];
++
++    for(int y = 0; y < h; y++) {
++        const uint8_t *qy = py;
++        const uint8_t *quv = puv;
++        for(int x = 0; x < w; x++) {
++            int Y1 = *(qy++) - 16;
++            int Cb = *(quv) - 128;
++            int Cr = *(quv + 1) - 128;
++            Y1 *= 4769;
++            quv += (x & 1) << 1;
++            int r = (Y1 + 6537 * Cr + 2048) / 4096;
++            int g = (Y1 - 1604 * Cb - 3329 * Cr + 2048) / 4096;
<Skipped 31874 lines>
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/zbar.git/commitdiff/9c696e8ef45eaed1e0f6f1bd054901fb1699f320




More information about the pld-cvs-commit mailing list