Do some manual coding style adjustments, while keeping
the coding style defined for clang-format.
This also fixes some compilation breakages, due to include
reordering.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
When decoders encounter binary data, they attempt to guess the encoding
of the data and convert it to text. This destroys other types of data.
The new boolean decoder configuration option ZBAR_CFG_BINARY
suppresses this automatic character set conversion.
The decoders that support it will output the raw binary data.
Signed-off-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
In file included from ./include/zbar/QZBarImage.h:29,
from qt/QZBarThread.h:30,
from qt/moc_QZBarThread.cpp:10:
/usr/include/qt5/QtGui/qimage.h:222:44: note: declared here
222 | QT_DEPRECATED_X("Use sizeInBytes") int byteCount() const;
Replace it as recommented by Qt warning.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
In order to properly support python 3, we need first to
support GObject introspection. So, add support for it.
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Making it properly parseable by g-ir-scanner is not easy:
there are several tricks. Add the proper annotations for it to
produce a working .typelib and .gir file.
Note: the main trick that the parser should be able to recognize
zbar_gtk_get_type(), in order to generate a class. It is not
possible to make it produce a class called ZBarGtk, as I would
like, so, the next best good thing is to recognize it as ZBar.Gtk.
The reason is that the GIR logic will strip part of the name of
the function, but it needs a final name for the class. So, if it
strips "zbar_gtk_", the name would be "get_type", with is invalid.
By stripping only "zbar_" prefix, the name will be "gtk_get_type",
and the class will be called "Gtk", inside the "ZBar" namespace.
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Get rid of some deprecated Gtk2 APIs and add support for a few
changes that require a different approach with Gtk3.
It should be noticed that it will still be using Gtk3 deprecated
stuff.
As a side effect, the Gtk2 deprecated warnings are now gone.
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
The gobject-introspection scanner warns about troubles at
the Gtk-DOC markups.
So, in order to shut up errors that will happen after
using it, fix them in advance.
No functional changes.
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Now that the resolution change code is in place, remind the
latest used resolution, and ensure that resolution change
event will be blocked when the QComboBox is updated.
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Export the detected resolutions to ZBar API.
Changing resolutions in runtime can be tricky with V4L2 and
ZBar, as it needs to dequeue all pending buffers, in order
to free them and reallocate.
While V4L2 allows to do that without needing to close/reopen
the file descriptor, with current ZBar implementation, it is
a lot easier if we just close/reopen, just like if we were
opening a different device.
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Sometimes, QR code images are printed inverted, e. g. lines
are written in write instead of black.
Let ZBar optionally recognize reverted images, by enabling
"test-inverted" parameter.
Such logic is disabled by default.
Suggested-by: Peter Turczak <peter@turczak.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
ZBar uses an array (scanner sym_configs) in order to store
some decoder-specific configurations (currently,
only ZBAR_CFG_UNCERTAINTY is stored there).
As the value of zbar_symbol_type_e can be up to 0x700,
it uses a poor man's hash table to map it into an array with
NUM_SYMS elements (19 elements).
The idea of using a hash to convert from zbar_symbol_type_e
into an array index between 0 and NUM_SYMS - 1 is interesting,
but it has a drawback: the latest added symbology (SQCODE)
caused a collision, making one of the used vars to be a -1.
As the hash code there doesn't provide any collision detection
mechanism, it checks for problems with assert() calls.
So, if one tries to set or retrieve ZBAR_CFG_UNCERTAINTY config
for sqcode, it gets an abort().
While we could come up with some improved hash logic there that
would avoid collisions, as the range of symbol codes that makes
sense for that code is not bigger than 128, let's just use an
static array with 129 elements (instead of the original one
with 32 elements).
I opted to preserve the values returned by the past hash
table code for the symbologies that makes sense.
In the case of the new SQCODE, I opted to set it to 1
(it could also be 0).
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
While parsing D-Bus messages at processor.c works fine for
zbarcam and zbarimg apps, this is not generic enough. Making
it to work, for example, with zbarcam-qt, would be really
painful.
So, while not too late, move the code to be inside img_scanner,
where it belongs.
While here, don't make the API/ABI dependent if HAVE_DBUS or
not, as this may cause problems in the future.
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
It is very useful to be able to dynamically change what
codes will be parsed by the GUI interface. Add such
logic to zbarcam-qt.
This adds a bunch of new cpp and QZBar API/ABI. The
ABI changes are backward compatible.
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Sending separate signals makes it difficult to associate the code
data and type. We can send them in the same signal using a dict.
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
Compilation fails with:
error: ‘>>’ should be ‘> >’ within a nested template argument list
Fix it.
Signed-off-by: Javier Serrano Polo <javier@jasp.net>
This is useful for running zbarcam as a systemd service so that other
applications can receive scan messages through dbus.
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
Add support for SQ code, a simple 2D barcode. zbarimg works with images
without noise elements. Language bindings have not been tested.
Signed-off-by: Javier Serrano Polo <javier@jasp.net>
On the control rework, we got rid of it at the C interface.
Let's get rid of it also on C++ and qt interfaces.
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Add logic to enable support for most of V4L2 control types.
What is left is:
- V4L2_CTRL_TYPE_BITMASK;
- compound controls.
The compound controls are used to carry on histogram data
for 3A algorithms. There are currently only tree
bitmask controls outside DV, all related to status.
So, currently, there are no good reasons to add support for
them.
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
On struct video_controls_s, there are a number of values that
are read from the controls definition. Instead of using a
type-dependent value with is usually 32 bits, make sure
that they all are 64 bits. That would allow support for
controls with 64 bit integers.
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
The control API is currently too confusing and relies on
having an internal table that would translate control names,
as reported by the platform-specific driver into an
internal name.
Change the logic to use the names provided at the driver.
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
The patch with added support for get/set controls didn't
include a C++ interface, nor to qt library.
Add it.
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Now that we have a way to query camera controls at the C
interface, add it also to the C++ and qt.
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Now that zbar internally can query controls, add a C interface
to allow zbar applications to see the control information.
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
In relation to discussion "introducing video controls"
https://sourceforge.net/projects/zbar/forums/forum/664597/topic/4617109
This patch implements get_control, set_control and query_control for
v4l2. Suitable methods are inserted into processor and video interface.
Some tests added in zbarcam.
What is missing:
1. support for extended controls
2. more controls can be enumerated in v4l2.c
3. a list of all acceptable control names in documentation of processor
Patch imported from:
https://sourceforge.net/p/zbar/patches/24/
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Specially when debugging issues, it is interesting to be able
to allod printing messages.
Add support for it at the Qt interface.
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
There aren't many changes for it to support both qt4 and qt5.
Add the needed stuff for qt5, without breaking backard compatible.
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
- remove (broken/tmp) converted image result sharing
- add explicit symbol recycle API, update processor/widgets to use
- cleanup and update C++ API
- update Python/Perl APIs
- fix broken and add new Python/Perl tests
--HG--
branch : qr
- add hierarchy to symbol results
- extract QR symbols during text decode, preserving position and structure
- outline QR symbols in window overlay
- tmp fix converted image result propagation
--HG--
branch : qr