Commit Graph

102 Commits

Author SHA1 Message Date
ssrlive
c60026ecbe Merge https://github.com/mchehab/zbar.git 2022-09-21 16:23:00 +08:00
a1346054
9037004f22 Several files: fix whitespace
* trim trailing whitespace
* trim excess whitespace
* indentation

Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
2022-05-29 18:31:57 +02:00
ssrlive
f0b3ab2324 find . -regex '.*\.\(cpp\|hpp\|cu\|c\|h\)' -exec clang-format --verbose --style=file -i {} \; 2021-10-07 09:19:48 +00:00
ssrlive
cf3d385492 Synchronize with upstream code. 2021-10-07 16:38:06 +08:00
ssrlive
a812a96fad clang-format find . -regex '.*\.\(cpp\|hpp\|cu\|c\|h\)' -exec clang-format --verbose --style=file -i {} \; 2021-10-07 06:06:52 +00:00
Mauro Carvalho Chehab
4d9a03e716 Improve the coding style on some places
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>
2021-03-14 17:27:36 +01:00
Mauro Carvalho Chehab
5b3c33d5c8 Enforce a coding style
Use clang-format to ensure that a single coding style will
be followed everywhere.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2021-03-14 17:27:36 +01:00
Matheus Afonso Martins Moreira
488bac3f9b config: add boolean option for raw binary decoding
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>
2020-03-13 10:49:04 +01:00
Mauro Carvalho Chehab
bd2cdb9393 QZbarImage.h: byteCount is now obsolete
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>
2020-01-29 14:42:19 +01:00
Mauro Carvalho Chehab
fb527003df configure.ac: add support for GObject Introspection on ZbarGtk
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>
2019-05-09 23:14:55 -03:00
Mauro Carvalho Chehab
9cd5d03d6e zbargtk.h: make it capable of producing a good ZBar .gir file
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>
2019-05-09 22:36:00 -03:00
Mauro Carvalho Chehab
bcc4a6cb83 gtk: prepare it to support Gtk3
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>
2019-05-07 08:35:20 -03:00
Mauro Carvalho Chehab
13038c2bd3 zbargtk.h: Do some improvements at Gtk-DOC markups.
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>
2019-05-07 08:06:32 -03:00
Mauro Carvalho Chehab
9922bce52e zbarcam-qt: remind the latest used resolution
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>
2019-02-19 10:48:41 -03:00
Mauro Carvalho Chehab
37011f0254 Add an API to allow getting supported resolutions and change them
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>
2019-02-19 10:48:41 -03:00
Mauro Carvalho Chehab
2cd4f3ddf2 img_scanner: add handler for inverted codes
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>
2019-02-18 09:00:00 -03:00
Mauro Carvalho Chehab
532e3201b3 symbol.c: fix symbol hash logic
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>
2019-02-16 10:27:44 -02:00
Mauro Carvalho Chehab
6fccdcb26f zbar: fix some typos
Use Linux Kernel's checkpatch.pl script to detect and fix
some typos:
	../kernel/checkpatch.pl --test-only=misspelled --codespellfile ../kernel/scripts/spelling.txt $(find . -name *.h) $(find . -name *.c) $(find . -name *.cpp) --fix-inplace

Reported-by: Boyuan Yang
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2019-02-14 07:16:48 -02:00
Mauro Carvalho Chehab
1bb3cb3c8b zbar: add support to retrieve per-sym config
Currently, there's no way to get per-symbology configuration.

Add support for it.

Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2019-02-13 13:53:32 -02:00
Mauro Carvalho Chehab
eabb9de9bb zbarcam-qt: add support for d-bus output
Allow enabling/disabling D-Bus output from zbarcam-qt.

Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2019-02-11 21:45:57 -02:00
Mauro Carvalho Chehab
ad26de30db move d-bus code to img_scanner.c
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>
2019-02-11 21:23:45 -02:00
Mauro Carvalho Chehab
90b1b6cebe zbarcam-qt: Add code selection to the GUI interface
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>
2019-02-11 18:23:02 -02:00
Mauro Carvalho Chehab
60898ee7a6 Merge branch 'dbus-dict' of https://github.com/jameshilliard/zbar into jameshilliard-dbus-dict
* 'dbus-dict' of https://github.com/jameshilliard/zbar:
  Combine dbus Type and Data signals into a single combined signal.
2019-02-08 07:51:08 -02:00
James Hilliard
c1ae1efce0 Combine dbus Type and Data signals into a single combined signal.
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>
2019-02-08 07:15:14 +08:00
Javier Serrano Polo
39dfefc2d9 cpp files: fix compilation with older compilers (xenial)
Compilation fails with:

  error: ‘>>’ should be ‘> >’ within a nested template argument list

Fix it.

Signed-off-by: Javier Serrano Polo <javier@jasp.net>
2019-02-07 09:26:17 -02:00
James Hilliard
a8be6a7bbb Add simple dbus IPC API to zbarcam.
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>
2019-02-06 06:22:29 +08:00
Javier Serrano Polo
0583b85093 Apply jasp-01-sqcode.patch
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>
2019-02-02 18:07:15 +01:00
Mauro Carvalho Chehab
edcf08b49e Add support for using versions with major.minor.patch
If patch is not specified, it will default to zero.

Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
2018-08-08 10:11:02 -03:00
Mauro Carvalho Chehab
2f96677c49 Bump version to 0.20
Now that we added a lot of stuff at ZBar, it is time to
bump its version number.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-04-11 11:40:36 -03:00
Mauro Carvalho Chehab
6d713b34e2 qt: get rid of the extra flags parameter for set_control
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>
2017-04-09 06:52:43 -03:00
Mauro Carvalho Chehab
80899ede8a qt: add support for menu controls
Now that the zbar core supports menu controls, add support also
at the qt library.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-04-08 18:28:17 -03:00
Mauro Carvalho Chehab
0d01d9800c Add support for most v4l2 control types
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>
2017-04-08 14:15:39 -03:00
Mauro Carvalho Chehab
5ed1cd69b9 zbar.h: before it is too late, change values to 64 bits
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>
2017-04-08 08:16:15 -03:00
Mauro Carvalho Chehab
60b64f5b22 Add API bits for other control types
Prepare the code to accept other types of controls.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-04-08 07:08:50 -03:00
Mauro Carvalho Chehab
f4156d4ef4 Cleanup control API
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>
2017-04-07 18:51:10 -03:00
Mauro Carvalho Chehab
3925d802cb Video.h, qt: add C++ interface to get/set bool/integer controls
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>
2017-04-07 18:51:10 -03:00
Mauro Carvalho Chehab
1e194f2d42 qt: add support for querying camera controls
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>
2017-04-07 18:51:10 -03:00
Mauro Carvalho Chehab
205358d5cc video: add an API to query controls
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>
2017-04-07 18:51:10 -03:00
Jarek Czekalski
0f5a290113 video controls for v4l2
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>
2017-04-07 18:51:10 -03:00
Mauro Carvalho Chehab
253dea39f8 qt: allow selecting the verbosity
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>
2017-04-05 18:13:40 -03:00
Mauro Carvalho Chehab
3e81367fa1 Add support to compile zbar with qt5
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>
2017-03-26 08:25:16 -03:00
Mauro Carvalho Chehab
cd5b63e5b5 Update to the very latest version of zbar
zbar was using a 2010 snapshot of its hg tree.
Take a new snapshot to get zbar's improvements.

[Imported from Fedora 26 tree]
2017-03-25 23:04:38 -03:00
spadix@users.sourceforge.net
1d5c851f4b Windows updates 2009-10-22 22:36:02 -04:00
spadix@users.sourceforge.net
4fce4655e9 add result query interfaces to image scanner and processor
- move result filtering into image scanner (from user)
    - abort output blockers when window closed
2009-10-21 10:34:43 -04:00
spadix@users.sourceforge.net
eaf5c4fa15 overlay enhancements
- add fps to overlay
    - add overlay control to processor
    - add windows overlay drawing
2009-10-05 20:13:47 -04:00
spadix@users.sourceforge.net
47b8945076 extract explicit result container, separate from image
- 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
2009-09-24 11:35:22 -04:00
spadix@users.sourceforge.net
19d4d07b1a cleanup QR result integration
- 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
2009-09-19 11:12:20 -04:00
spadix@users.sourceforge.net
a87383c033 merge trunk updates to qr branch
--HG--
branch : qr
2009-09-16 13:50:15 -04:00
spadix@users.sourceforge.net
ee266247ce add missing API doc 2009-08-31 08:52:36 -04:00
spadix@users.sourceforge.net
6f96dc6e4c move image conversion out of image scanner up to higher levels
(preparation for library split)
2009-08-28 21:04:26 -04:00