Compare commits

..

4 commits

Author SHA1 Message Date
Mauro Carvalho Chehab
29f2f8e92c Make rpmlint happy
- Remove weird white spaces;
- don't mix tabs with white spaces;
- Use "bar code" instead of: "barcode".
- Use "e. g." instead of "eg".

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-04-11 15:08:07 -03:00
Mauro Carvalho Chehab
4457e7c741 Bump to version 0.20
Point to the new place where we're storing zbar tarballs
and bump it to version 0.20.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-04-11 14:46:04 -03:00
Mauro Carvalho Chehab
b1573ef1e2 Added two missing patches
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-03-26 10:34:31 -03:00
Mauro Carvalho Chehab
6e78a1e633 compile also zbarcam-qt and zbarcam-gtk
Those applications are there for a while, but weren't compiled
by default, as they used to be at the test directory.

Compile them too.

For Fedora 25, let's not switch to Qt5, as this could break
some other application that would be dependent on libqt4 and
zbar-qt. So, let's build it with --without-qt5.

On future versions, we'll switch it to qt5.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-03-26 10:27:26 -03:00
12 changed files with 36483 additions and 333 deletions

11
.gitignore vendored
View file

@ -1,14 +1,3 @@
zbar-0.10.tar.bz2
/zbar-0.10.tar.bz2
/zbar-0.20.tar.bz2
/zbar-0.20.1.tar.bz2
/zbar-0.21.tar.bz2
/zbar-0.22.tar.bz2
/zbar-0.22.2.tar.gz
/zbar-0.22.2.tar.bz2
/zbar-0.22.90.tar.bz2
/zbar-0.22.91.tar.bz2
/zbar-0.22.92.tar.bz2
/zbar-0.23.tar.bz2
/zbar-0.23.90.tar.bz2
/zbar-0.23.93.tar.bz2

View file

@ -1,16 +0,0 @@
This was causing Qt5 to be linked into every binary in zbar, where it is only
needed for the Qt bindings (which already specify QT_CFLAGS, QT_LIBS, etc).
diff --git a/configure.ac b/configure.ac
index f0f9723..2a26973 100644
--- a/configure.ac
+++ b/configure.ac
@@ -689,8 +689,6 @@ AM_CONDITIONAL([HAVE_QT], [test "x$with_qt" = "xyes"])
AM_COND_IF([HAVE_QT],
[AC_MSG_NOTICE([using Qt version $QT_VERSION])
AC_MSG_NOTICE([using moc from $MOC])
- CPPFLAGS="$CPPFLAGS $QT_CPPFLAGS"
- LIBS="$LIBS $QT_LIBS"
AC_CONFIG_FILES([zbar-qt.pc:"${qt_pkgconfig_file}.in"])
#dnl -fPIC has no effect on Windows and breaks windres
AS_IF([test "x$win32" = "xno"], [CPPFLAGS="$CPPFLAGS -fPIC"])])

View file

@ -1 +1 @@
SHA512 (zbar-0.23.93.tar.bz2) = 8b1d57557cb1c425109b709f0cbe94830939cb4cd9a0cb505d44ba3c7cfb3522560c3bbf2a8b37985da4577b677ad675491f6ef0e9796749382079c0e844e21e
SHA512 (zbar-0.20.tar.bz2) = d967b250d2bf021aa02583751dc62ffc3f8d220224df1a3644f52eee6d0ec5bd5c5cceb36c3d765a85afafd7a0ba182ed9d8263ef1be1852456687b687de5375

View file

@ -1,10 +0,0 @@
diff --git a/test/test_python.py b/test/test_python.py
index 252c51a97256..8388d9a5aa36 100755
--- a/test/test_python.py
+++ b/test/test_python.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
#------------------------------------------------------------------------
# Copyright 2019 (c) Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
#

368
zbar.spec
View file

@ -1,176 +1,139 @@
%ifarch %{java_arches}
%global JAVA 1
%else
%global JAVA 0
%endif
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
Name: zbar
Version: 0.23.93
Release: 13%{?dist}
Version: 0.20
Release: 1%{?dist}
Summary: Bar code reader
License: LGPL-2.1-or-later
Group: User Interface/X Hardware Support
License: LGPLv2+
URL: http://zbar.sourceforge.net/
Source0: https://linuxtv.org/downloads/%{name}/%{name}-%{version}.tar.bz2
Patch0: use_python3_on_python_script.patch
Patch1: fix_qt_overlinking.patch
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: dbus-devel
BuildRequires: gettext-devel
BuildRequires: GraphicsMagick-devel
BuildRequires: gtk3-devel
BuildRequires: libSM-devel
BuildRequires: libtool
BuildRequires: libv4l-devel
BuildRequires: libXv-devel
BuildRequires: make
BuildRequires: python3-gobject-devel
BuildRequires: qt5-qtbase-devel
BuildRequires: qt5-qtx11extras-devel
%if %{JAVA}
BuildRequires: java-devel
%endif
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: xmlto
BuildRequires: gobject-introspection-devel
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: autoconf automake libtool python-devel gettext-devel
BuildRequires: qt4-devel gtk2-devel pygtk2-devel GraphicsMagick-c++-devel
BuildRequires: libv4l-devel libXv-devel xmlto
%description
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 SQ Code.
A layered bar code scanning and decoding library. Supports EAN, UPC, Code 128,
Code 39 and Interleaved 2 of 5.
Includes applications for decoding captured bar code images and using a video
device (e. g., webcam) as a bar code scanner.
%package devel
Summary: Bar code reader library extra development files
Requires: %{name}-libs%{_isa} = %{version}-%{release}
Group: Development/Libraries
Summary: Bar code library extra development files
Requires: pkgconfig, %{name} = %{version}-%{release}
%description devel
This package contains header files and additional libraries used for
developing applications that read bar codes with this library.
%package libs
Summary: Bar code reader library
%description libs
This package contains the ZBar Bar Code Reader library.
%package gtk
Group: Development/Libraries
Summary: Bar code reader GTK widget
Requires: %{name}-libs%{_isa} = %{version}-%{release}
# Obsoleted in F37
Obsoletes: %{name}-gi < %{version}-%{release}
Requires: %{name} = %{version}-%{release}
%description gtk
This package contains a bar code scanning widget for use with GUI
applications based on GTK 3.
applications based on GTK+-2.0.
%package gtk-devel
Group: Development/Libraries
Summary: Bar code reader GTK widget extra development files
Requires: %{name}-devel%{_isa} = %{version}-%{release}
Requires: %{name}-gtk%{_isa} = %{version}-%{release}
Requires: pkgconfig, %{name}-gtk = %{version}-%{release}, %{name}-devel = %{version}-%{release}
%description gtk-devel
This package contains header files and additional libraries used for
developing GUI applications based on GTK 3 that include a bar code
developing GUI applications based on GTK+-2.0 that include a bar code
scanning widget.
%package pygtk
Group: Development/Libraries
Summary: Bar code reader PyGTK widget
Requires: pygtk2, %{name}-gtk = %{version}-%{release}
%description pygtk
This package contains a bar code scanning widget for use in GUI
applications based on PyGTK.
%package qt
Group: Development/Libraries
Summary: Bar code reader Qt widget
Requires: %{name}-libs%{_isa} = %{version}-%{release}
Requires: %{name} = %{version}-%{release}
%description qt
This package contains a bar code scanning widget for use with GUI
applications based on Qt4.
%package qt-devel
Group: Development/Libraries
Summary: Bar code reader Qt widget extra development files
Requires: %{name}-devel%{_isa} = %{version}-%{release}
Requires: %{name}-qt%{_isa} = %{version}-%{release}
Requires: pkgconfig, %{name}-qt = %{version}-%{release}, %{name}-devel = %{version}-%{release}
%description qt-devel
This package contains header files and additional libraries used for
developing GUI applications based on Qt5 that include a bar code
developing GUI applications based on Qt4 that include a bar code
scanning widget.
%package -n python3-zbar
Summary: Bar code reader PyGTK widget
Requires: %{name}-libs%{_isa} = %{version}-%{release}
Requires: python3-pillow
# Renamed in F37
Obsoletes: %{name}-python3 < %{version}-%{release}
%description -n python3-zbar
This package contains a bar code scanning widget for use on
python applications that work with images.
%if %{JAVA}
%package java
Summary: Bar code reader Java library
Requires: %{name}-devel%{_isa} = %{version}-%{release}
Requires: %{name}-gtk%{_isa} = %{version}-%{release}
%description java
This package contains header files and additional libraries used for
on Java Native Interface (JNI) applications using ZBar.
%endif
%prep
%setup -q
%patch 0 -p1
%patch 1 -p1
%build
autoreconf -fiv
%configure --with-python=python3 --with-gtk=auto --with-dbusconfdir=%{_sysconfdir} --docdir=%{_docdir}/%{name}-%{version} --with-graphicsmagick --without-xshm --without-xv --enable-codes=ean,databar,code128,code93,code39,codabar,i25,qrcode,sqcode,pdf417
autoreconf -vfi
%configure --without-java --with-graphicsmagick --without-qt5 --docdir=%{_docdir}/%{name}-%{version}
# rpath
sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
%make_build
make %{?_smp_mflags}
%install
%make_install
%if %{JAVA}
install -d %{buildroot}%{_jnidir}
mv %{buildroot}%{_datadir}/zbar/lib/zbar.jar %{buildroot}%{_jnidir}
mv %{buildroot}%{_datadir}/zbar/lib/libzbarjni.so* %{buildroot}%{_libdir}
%endif
cp test/test_python.py %{buildroot}%{_docdir}
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT INSTALL="install -p"
#Remove .la and .a files
find ${RPM_BUILD_ROOT} -name '*.la' -or -name '*.a' | xargs rm -f
# Remove installed doc
rm -rf $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}/
rm -rf $RPM_BUILD_ROOT/usr/share/doc/zbar-%{version}/
%ldconfig_scriptlets
%clean
rm -rf $RPM_BUILD_ROOT
%ldconfig_scriptlets devel
%post -p /sbin/ldconfig
%ldconfig_scriptlets gtk
%post devel -p /sbin/ldconfig
%ldconfig_scriptlets qt
%post gtk -p /sbin/ldconfig
%find_lang zbar
%post qt -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%postun devel -p /sbin/ldconfig
%postun gtk -p /sbin/ldconfig
%postun qt -p /sbin/ldconfig
%files
%doc NEWS.md README.md INSTALL.md
%defattr(-,root,root,-)
%doc COPYING LICENSE NEWS
%{_bindir}/zbarimg
%{_bindir}/zbarcam
%{_libdir}/libzbar.so.*
%{_mandir}/man1/*
%{_sysconfdir}/dbus-1/system.d/org.linuxtv.Zbar.conf
%files libs -f zbar.lang
%license COPYING LICENSE.md
%{_libdir}/libzbar.so.0*
%{_libdir}/girepository-1.0/ZBar-1.0.typelib
%files devel
%doc HACKING.md TODO.md
%defattr(-,root,root,-)
%doc HACKING TODO
%{_libdir}/libzbar.so
%{_libdir}/pkgconfig/zbar.pc
%dir %{_includedir}/zbar
@ -184,224 +147,41 @@ rm -rf $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}/
%{_includedir}/zbar/Video.h
%{_includedir}/zbar/Window.h
%{_includedir}/zbar/Processor.h
%{_datadir}/gir-1.0/ZBar-1.0.gir
%files gtk
%defattr(-,root,root,-)
%{_libdir}/libzbargtk.so.*
%{_bindir}/zbarcam-gtk
%files gtk-devel
%defattr(-,root,root,-)
%{_libdir}/libzbargtk.so
%{_libdir}/pkgconfig/zbar-gtk.pc
%{_includedir}/zbar/zbargtk.h
%files pygtk
%defattr(-,root,root,-)
%{python_sitearch}/zbarpygtk.so
%{python_sitearch}/zbar.so
%files qt
%defattr(-,root,root,-)
%{_libdir}/libzbarqt.so.*
%{_bindir}/zbarcam-qt
%files qt-devel
%defattr(-,root,root,-)
%{_libdir}/libzbarqt.so
%{_libdir}/pkgconfig/zbar-qt.pc
%{_includedir}/zbar/QZBar*.h
%if %{JAVA}
%files java
%{_jnidir}/zbar.jar
%{_libdir}/libzbarjni.so*
%endif
%files -n python3-zbar
%{python3_sitearch}/zbar.so
%{_docdir}/test_python.py
%changelog
* Tue Aug 04 2026 Gwyn Ciesla <gwync@protonmail.com> - 0.23.93-13
- Rebuild for Python 3.15.0b4
* Fri Jul 17 2026 Fedora Release Engineering <releng@fedoraproject.org> - 0.23.93-12
- Rebuilt for https://fedoraproject.org/wiki/Fedora_45_Mass_Rebuild
* Wed Jun 03 2026 Python Maint <python-maint@redhat.com> - 0.23.93-11
- Rebuilt for Python 3.15
* Sat Jan 17 2026 Fedora Release Engineering <releng@fedoraproject.org> - 0.23.93-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_44_Mass_Rebuild
* Fri Sep 05 2025 Yaakov Selkowitz <yselkowi@redhat.com> - 0.23.93-9
- Fix Qt overlinking
* Fri Jul 25 2025 Fedora Release Engineering <releng@fedoraproject.org> - 0.23.93-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild
* Tue Jun 03 2025 Python Maint <python-maint@redhat.com> - 0.23.93-7
- Rebuilt for Python 3.14
* Sun Jan 19 2025 Fedora Release Engineering <releng@fedoraproject.org> - 0.23.93-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild
* Sat Jul 20 2024 Fedora Release Engineering <releng@fedoraproject.org> - 0.23.93-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild
* Fri Jun 07 2024 Python Maint <python-maint@redhat.com> - 0.23.93-4
- Rebuilt for Python 3.13
* Mon Apr 15 2024 Gwyn Ciesla <gwync@protonmail.com> - 0.23.93-3
- Update python3-gobject BuildRequires
* Sat Jan 27 2024 Fedora Release Engineering <releng@fedoraproject.org> - 0.23.93-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Tue Jan 09 2024 Gwyn Ciesla <gwync@protonmail.com> - 0.23.93-1
- 0.23.93
* Fri Jan 05 2024 Florian Weimer <fweimer@redhat.com> - 0.23.90-12
- Add missing Py_SIZE to py311.patch
* Sat Jul 22 2023 Fedora Release Engineering <releng@fedoraproject.org> - 0.23.90-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
* Fri Jul 07 2023 Michael J Gruber <mjg@fedoraproject.org> - 0.23.90-10
- Fix FTBFS with python 3.12 (rhbz#2220630)
* Thu Jun 15 2023 Python Maint <python-maint@redhat.com> - 0.23.90-9
- Rebuilt for Python 3.12
* Wed Mar 01 2023 Gwyn Ciesla <gwync@protonmail.com> - 0.23.90-8
- migrated to SPDX license
* Sat Jan 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 0.23.90-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
* Wed Dec 21 2022 Gwyn Ciesla <gwync@protonmail.com> - 0.23.90-6
- BR setuptools
* Fri Aug 26 2022 Kalev Lember <klember@redhat.com> - 0.23.90-5
- Misc packaging cleanup
- Sort BuildRequires and Requires and split them out one per line
- Move GObject Introspection bindings to -gtk and -gtk-devel subpackages
- Split libzbar out to zbar-libs subpackage
- Tighten subpackage deps with %%{_isa}
- Drop manual requires on pkgconfig and rely on rpm dep extractor
- Rename zbar-python3 to python3-zbar as per latest Python guidelines
- Use make_build and make_install macros
* Mon Aug 01 2022 Gwyn Ciesla <gwync@protonmail.com> - 0.23.90-4
- Only build Java on supported platforms.
* Sat Jul 23 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.23.90-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Mon Jun 13 2022 Python Maint <python-maint@redhat.com> - 0.23.90-2
- Rebuilt for Python 3.11
* Tue May 31 2022 Gwyn Ciesla <gwync@protonmail.com> - 0.23.90-1
- 0.23.90
* Sat Feb 05 2022 Jiri Vanek <jvanek@redhat.com> - 0.23-14
- Rebuilt for java-17-openjdk as system jdk
* Sat Jan 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.23-13
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Wed Jan 12 2022 Gwyn Ciesla <gwync@protonmail.com> - 0.23-12
- Fix 3.11 FTBFS.
* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.23-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Fri Jun 04 2021 Python Maint <python-maint@redhat.com> - 0.23-10
- Rebuilt for Python 3.10
* Thu Mar 25 2021 Gwyn Ciesla <gwync@protonmail.com> - 0.23-9
Fix FTBFS for autoconf 2.71.
* Thu Jan 28 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.23-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.23-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Mon Jul 20 2020 Gwyn Ciesla <gwync@protonmail.com> - 0.23-6
- Update description.
- Patch for Python 3.9.
- Move back to GraphicsMagick.
* Tue May 26 2020 Miro Hrončok <mhroncok@redhat.com> - 0.23-5
- Rebuilt for Python 3.9
* Fri Jan 31 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.23-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Mon Aug 19 2019 Miro Hrončok <mhroncok@redhat.com> - 0.23-3
- Rebuilt for Python 3.8
* Sat Jul 27 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.23-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Thu May 23 2019 Mauro Carvalho Chehab <mchehab+samsung@kernel.org> - 0.23-1
- Bump to release 0.23.
* Tue May 14 2019 Mauro Carvalho Chehab <mchehab+samsung@kernel.org> - 0.22.92-1
- Third release candidate for 0.23.
* Fri May 10 2019 Mauro Carvalho Chehab <mchehab+samsung@kernel.org> - 0.22.90-1
- Release candidate for 0.23. Support for Gtk3 and GObject Introspection (GIR)
* Mon Apr 29 2019 Mauro Carvalho Chehab <mchehab+samsung@kernel.org> - 0.22.2-1
- Update to 0.22.2: added support for Java 11
* Wed Feb 20 2019 Mauro Carvalho Chehab <mchehab+samsung@kernel.org> - 0.22-1
- Bump to version 0.22: zbarcam-qt is now a full-featured application
* Tue Feb 12 2019 Mauro Carvalho Chehab <mchehab+samsung@kernel.org> - 0.21-1
- Bump to version 0.21: d-bus and SQ code support, improved zbarcam-qt
* Sun Feb 03 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.20.1-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Mon Jan 7 2019 Mauro Carvalho Chehab <mchehab+samsung@kernel.org> - 0.20.1-4
- Disable python2 bindings due to pygtk2 orphaned package
* Thu Aug 9 2018 Hans de Goede <hdegoede@redhat.com> - 0.20.1-3
- Drop zbar_fedora29_hack_for_codegen_to_work.patch now that pygobject2 is
fixed (rhbz# 1606784)
- Use %%ldconfig_scriptlets so that we don't unnecessarily run ldconfig on F28+
* Wed Aug 08 2018 Mauro Carvalho Chehab <mchehab+samsung@kernel.org> - 0.20.1-2
- Re-enable python2 bindings
* Wed Aug 08 2018 Mauro Carvalho Chehab <mchehab+samsung@kernel.org> - 0.20.1-1
- Bump version to 0.20.1
* Tue Aug 07 2018 Mauro Carvalho Chehab <mchehab+samsung@kernel.org> - 0.20-8
- Fix python 2 dependencies
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.20-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Wed Feb 14 2018 Iryna Shcherbina <ishcherb@redhat.com> - 0.20-6
- Update Python 2 dependency declarations to new packaging standards
(See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.20-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.20-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.20-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Tue Apr 11 2017 Mauro Carvalho Chehab <mchehab@s-opensource.com> - 0.20-1
- Update it to version 0.20 with brings V4L2 controls to zbarcam-qt
* Sun Mar 26 2017 Mauro Carvalho Chehab <mchehab@s-opensource.com> - 0.10-29
- Make zbar-qt to use Qt5 and generate gtk and qt applications
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.10-28
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.10-27
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages

View file

@ -0,0 +1,140 @@
diff --git a/configure.ac b/configure.ac
index dbd7153fb13b..7bcb18219853 100644
--- a/configure.ac
+++ b/configure.ac
@@ -476,18 +476,33 @@ AM_CONDITIONAL([HAVE_PYTHON], [test "x$with_python" = "xyes"])
dnl Qt
AC_ARG_WITH([qt],
[AS_HELP_STRING([--without-qt],
- [disable support for Qt4 widget])],
+ [disable support for Qt widget])],
[],
[with_qt="yes"])
+dnl Qt5
+AC_ARG_WITH([qt5],
+ [AS_HELP_STRING([--without-qt5],
+ [disable support for Qt5 widget. if --with-qt, it will seek only for Qt4])],
+ [],
+ [with_qt5="yes"])
+
AC_ARG_VAR([MOC], [full path to Qt moc program])
AS_IF([test "x$with_qt" != "xno"],
- [PKG_CHECK_MODULES([QT], [QtCore >= 4 QtGui >= 4])
- MOC=`$PKG_CONFIG QtGui --variable=moc_location`
- AC_MSG_NOTICE([using moc from $MOC])
- QT_VERSION=`$PKG_CONFIG QtGui --modversion`
- AC_MSG_NOTICE([using Qt version $QT_VERSION])])
+ AS_IF([test "x$with_qt5" != "xno"],
+ [PKG_CHECK_MODULES([QT], [Qt5Core >= 5 Qt5Gui >= 5 Qt5Widgets >= 5.0 Qt5X11Extras >= 5.0])
+ AC_CHECK_PROGS(MOC, [moc-qt5 moc])
+ AC_MSG_NOTICE([using moc from $MOC])
+ QT_VERSION=`$PKG_CONFIG Qt5Gui --modversion`
+ CPPFLAGS="$CPPFLAGS $QT_CPPFLAGS -fPIC"
+ AC_MSG_NOTICE([using Qt version $QT_VERSION])],
+
+ [PKG_CHECK_MODULES([QT], [QtCore >= 4 QtGui >= 4])
+ MOC=`$PKG_CONFIG QtGui --variable=moc_location`
+ AC_MSG_NOTICE([using moc from $MOC])
+ QT_VERSION=`$PKG_CONFIG QtGui --modversion`
+ AC_MSG_NOTICE([using Qt version $QT_VERSION])]))
AM_CONDITIONAL([HAVE_QT], [test "x$with_qt" = "xyes"])
@@ -596,9 +611,9 @@ AS_IF([test "x$with_gtk" != "xyes"],
[echo " => the GTK+ widget will *NOT* be built"],
[AS_IF([test "x$with_python" != "xyes"],
[echo " => the PyGTK widget wrapper will *NOT* be built"])])
-echo "Qt4 --with-qt=$with_qt"
+echo "Qt${QT_VERSION} --with-qt=$with_qt"
AS_IF([test "x$with_qt" != "xyes"],
- [echo " => the Qt4 widget will *NOT* be built"])
+ [echo " => the Qt 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"])
diff --git a/include/zbar/QZBar.h b/include/zbar/QZBar.h
index 104449928e2d..1a4716565047 100644
--- a/include/zbar/QZBar.h
+++ b/include/zbar/QZBar.h
@@ -26,7 +26,12 @@
/// @file
/// Barcode Reader Qt4 Widget
-#include <qwidget.h>
+#include <QtGui>
+#if QT_VERSION >= 0x050000
+# include <QtWidgets>
+#else
+# include <qwidget.h>
+#endif
namespace zbar {
diff --git a/include/zbar/QZBarImage.h b/include/zbar/QZBarImage.h
index 1505177e07a9..b862c8085576 100644
--- a/include/zbar/QZBarImage.h
+++ b/include/zbar/QZBarImage.h
@@ -54,7 +54,11 @@ public:
unsigned height = qimg.height();
set_size(width, height);
set_format(zbar_fourcc('B','G','R','4'));
+#if QT_VERSION >= 0x050000
+ unsigned long datalen = qimg.byteCount();
+#else
unsigned long datalen = qimg.numBytes();
+#endif
set_data(qimg.bits(), datalen);
if((width * 4 != bpl) ||
diff --git a/qt/QZBar.cpp b/qt/QZBar.cpp
index e1001b09cff5..a5b956b342ad 100644
--- a/qt/QZBar.cpp
+++ b/qt/QZBar.cpp
@@ -23,7 +23,7 @@
#include <qevent.h>
#include <qurl.h>
-#include <qx11info_x11.h>
+#include <QX11Info>
#include <zbar/QZBar.h>
#include "QZBarThread.h"
@@ -49,7 +49,11 @@ QZBar::QZBar (QWidget *parent)
thread = new QZBarThread;
if(testAttribute(Qt::WA_WState_Created)) {
+#if QT_VERSION >= 0x050000
+ thread->window.attach(QX11Info::display(), winId());
+#else
thread->window.attach(x11Info().display(), winId());
+#endif
_attached = 1;
}
connect(thread, SIGNAL(videoOpened(bool)),
@@ -204,7 +208,12 @@ void QZBar::changeEvent(QEvent *event)
try {
QMutexLocker locker(&thread->mutex);
if(event->type() == QEvent::ParentChange)
+#if QT_VERSION >= 0x050000
+ thread->window.attach(QX11Info::display(), winId());
+#else
thread->window.attach(x11Info().display(), winId());
+#endif
+
}
catch(Exception) { /* ignore (FIXME do something w/error) */ }
}
@@ -215,7 +224,11 @@ void QZBar::attach ()
return;
try {
+#if QT_VERSION >= 0x050000
+ thread->window.attach(QX11Info::display(), winId());
+#else
thread->window.attach(x11Info().display(), winId());
+#endif
_attached = 1;
_videoEnabled = !_videoDevice.isEmpty();

View file

@ -0,0 +1,128 @@
diff -r 60f92d860a1f zbar/convert.c
--- a/zbar/convert.c Sat Dec 25 08:29:33 2010 -0200
+++ b/zbar/convert.c Sat Dec 25 14:36:04 2010 -0200
@@ -1157,6 +1157,42 @@
break;
}
}
+ if(!min_fmt && vdo->emu_formats) {
+ /* As vdo->formats aren't compatible, just free them */
+ free(vdo->formats);
+ vdo->formats = vdo->emu_formats;
+ vdo->emu_formats = NULL;
+
+ /*
+ * Use the same cost algorithm to select emulated formats.
+ * This might select a sub-optimal conversion, but, in practice,
+ * it will select a conversion to YUV at libv4l, and a YUY->Y8
+ * in zbar, with it is OK. Yet, it is better to not select the
+ * most performatic conversion than to not support the webcam.
+ */
+ for(fmt = _zbar_formats; *fmt; fmt++) {
+ /* only consider formats supported by video device */
+ uint32_t win_fmt = 0;
+ int cost;
+ if(!has_format(*fmt, srcs))
+ continue;
+ cost = _zbar_best_format(*fmt, &win_fmt, dsts);
+ if(cost < 0) {
+ zprintf(4, "%.4s(%08" PRIx32 ") -> ? (unsupported)\n",
+ (char*)fmt, *fmt);
+ continue;
+ }
+ zprintf(4, "%.4s(%08" PRIx32 ") -> %.4s(%08" PRIx32 ") (%d)\n",
+ (char*)fmt, *fmt, (char*)&win_fmt, win_fmt, cost);
+ if(min_cost > cost) {
+ min_cost = cost;
+ min_fmt = *fmt;
+ if(!cost)
+ break;
+ }
+ }
+ }
+
if(win)
(void)window_unlock(win);
diff -r 60f92d860a1f zbar/video.c
--- a/zbar/video.c Sat Dec 25 08:29:33 2010 -0200
+++ b/zbar/video.c Sat Dec 25 14:36:04 2010 -0200
@@ -111,6 +111,9 @@
free(vdo->buf);
if(vdo->formats)
free(vdo->formats);
+ if(vdo->emu_formats)
+ free(vdo->emu_formats);
+
err_cleanup(&vdo->err);
_zbar_mutex_destroy(&vdo->qlock);
diff -r 60f92d860a1f zbar/video.h
--- a/zbar/video.h Sat Dec 25 08:29:33 2010 -0200
+++ b/zbar/video.h Sat Dec 25 14:36:04 2010 -0200
@@ -69,6 +69,7 @@
uint32_t format; /* selected fourcc */
unsigned palette; /* v4l1 format index corresponding to format */
uint32_t *formats; /* 0 terminated list of supported formats */
+ uint32_t *emu_formats; /* 0 terminated list of emulated formats */
unsigned long datalen; /* size of image data for selected format */
unsigned long buflen; /* total size of image data buffer */
diff -r 60f92d860a1f zbar/video/v4l2.c
--- a/zbar/video/v4l2.c Sat Dec 25 08:29:33 2010 -0200
+++ b/zbar/video/v4l2.c Sat Dec 25 14:36:04 2010 -0200
@@ -347,6 +347,8 @@
static inline int v4l2_probe_formats (zbar_video_t *vdo)
{
+ int n_formats = 0, n_emu_formats = 0;
+
zprintf(2, "enumerating supported formats:\n");
struct v4l2_fmtdesc desc;
memset(&desc, 0, sizeof(desc));
@@ -354,17 +356,39 @@
for(desc.index = 0; desc.index < V4L2_FORMATS_MAX; desc.index++) {
if(v4l2_ioctl(vdo->fd, VIDIOC_ENUM_FMT, &desc) < 0)
break;
- zprintf(2, " [%d] %.4s : %s%s\n",
+ zprintf(2, " [%d] %.4s : %s%s%s\n",
desc.index, (char*)&desc.pixelformat, desc.description,
- (desc.flags & V4L2_FMT_FLAG_COMPRESSED) ? " COMPRESSED" : "");
- vdo->formats = realloc(vdo->formats,
- (desc.index + 2) * sizeof(uint32_t));
- vdo->formats[desc.index] = desc.pixelformat;
+ (desc.flags & V4L2_FMT_FLAG_COMPRESSED) ? " COMPRESSED" : "",
+ (desc.flags & V4L2_FMT_FLAG_EMULATED) ? " EMULATED" : "");
+ if (desc.flags & V4L2_FMT_FLAG_EMULATED) {
+ vdo->emu_formats = realloc(vdo->emu_formats,
+ (n_emu_formats + 2) * sizeof(uint32_t));
+ vdo->emu_formats[n_emu_formats++] = desc.pixelformat;
+ } else {
+ vdo->formats = realloc(vdo->formats,
+ (n_formats + 2) * sizeof(uint32_t));
+ vdo->formats[n_formats++] = desc.pixelformat;
+ }
}
if(!desc.index)
return(err_capture(vdo, SEV_ERROR, ZBAR_ERR_SYSTEM, __func__,
"enumerating video formats (VIDIOC_ENUM_FMT)"));
- vdo->formats[desc.index] = 0;
+ if(vdo->formats)
+ vdo->formats[n_formats] = 0;
+ if(vdo->emu_formats)
+ vdo->emu_formats[n_emu_formats] = 0;
+ if(!vdo->formats && vdo->emu_formats) {
+ /*
+ * If only emu formats are available, just move them to vdo->formats.
+ * This happens when libv4l detects that the only available fourcc
+ * formats are webcam proprietary formats or bayer formats.
+ */
+ vdo->formats = vdo->emu_formats;
+ vdo->emu_formats = NULL;
+ }
+
+ zprintf(2, "Found %d formats and %d emulated formats.\n",
+ n_formats, n_emu_formats);
struct v4l2_format fmt;
struct v4l2_pix_format *pix = &fmt.fmt.pix;

View file

@ -0,0 +1,11 @@
--- a/configure.ac 2015-08-14 16:26:09.661856984 -0300
+++ b/configure.ac 2015-08-14 16:26:20.209851076 -0300
@@ -4,7 +4,7 @@
AC_CONFIG_AUX_DIR(config)
AC_CONFIG_MACRO_DIR(config)
AM_INIT_AUTOMAKE([1.10 -Werror foreign subdir-objects std-options dist-bzip2])
-AM_PROG_AR
+m4_pattern_allow([AM_PROG_AR])
AC_CONFIG_HEADERS([include/config.h])
AC_CONFIG_SRCDIR(zbar/scanner.c)
LT_PREREQ([2.2])

View file

@ -0,0 +1,148 @@
From 76a286fd34d5159b55de4d4f276dcbf69d1b263e Mon Sep 17 00:00:00 2001
From: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Date: Sun, 26 Mar 2017 09:43:07 -0300
Subject: [PATCH] zbarcam: add qt and gtk variants
The original zbarcam use standard X11 libraries to display
video. That provides an ugly interface, and could be
slow on high resolutions.
As Zbar has already test examples for qt and gtk, let's
promote them to real applications. One advantage is that
both qt and gtk libraries will be tested when building
those.
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
diff --git a/qt/Makefile.am.inc b/qt/Makefile.am.inc
index dc1525e0d52a..5f860bfa31bc 100644
--- a/qt/Makefile.am.inc
+++ b/qt/Makefile.am.inc
@@ -7,6 +7,7 @@ qt_libzbarqt_la_SOURCES = qt/QZBar.cpp qt/QZBarThread.h qt/QZBarThread.cpp
nodist_qt_libzbarqt_la_SOURCES = qt/moc_QZBar.cpp qt/moc_QZBarThread.cpp
BUILT_SOURCES += $(nodist_qt_libzbarqt_la_SOURCES)
DISTCLEANFILES += $(nodist_qt_libzbarqt_la_SOURCES)
+CLEANFILES += qt/moc_%.cpp
qt/moc_%.cpp: qt/%.h
$(MOC) $(qt_libzbarqt_la_CPPFLAGS) $< -o $@
diff --git a/test/Makefile.am.inc b/test/Makefile.am.inc
index 7340a7f2f61f..8496eb30f3cc 100644
--- a/test/Makefile.am.inc
+++ b/test/Makefile.am.inc
@@ -45,26 +45,6 @@ test_dbg_scan_CPPFLAGS = $(MAGICK_CFLAGS) $(AM_CPPFLAGS)
test_dbg_scan_LDADD = $(MAGICK_LIBS) -lMagick++ zbar/libzbar.la $(AM_LDADD)
endif
-if HAVE_GTK
-check_PROGRAMS += test/test_gtk
-test_test_gtk_SOURCES = test/test_gtk.c test/scan_video.c
-test_test_gtk_CPPFLAGS = $(GTK_CFLAGS) $(AM_CPPFLAGS)
-test_test_gtk_LDADD = $(GTK_LIBS) gtk/libzbargtk.la $(AM_LDADD)
-endif
-
-if HAVE_QT
-check_PROGRAMS += test/test_qt
-test_test_qt_SOURCES = test/test_qt.cpp test/scan_video.c
-nodist_test_test_qt_SOURCES = test/moc_test_qt.h
-test_test_qt_CPPFLAGS = -Itest $(QT_CFLAGS) $(AM_CPPFLAGS)
-test_test_qt_LDADD = $(QT_LIBS) qt/libzbarqt.la $(AM_LDADD)
-BUILT_SOURCES += $(nodist_test_test_qt_SOURCES)
-DISTCLEANFILES += $(nodist_test_test_qt_SOURCES)
-
-test/moc_%.h: test/%.cpp
- $(MOC) -i $(test_test_qt_CPPFLAGS) $< -o $@
-endif
-
EXTRA_DIST += test/test_pygtk.py test/test_perl.pl
# automake bug in "monolithic mode"?
diff --git a/zbarcam/Makefile.am.inc b/zbarcam/Makefile.am.inc
index ea869bcd2e11..5aa788a23da5 100644
--- a/zbarcam/Makefile.am.inc
+++ b/zbarcam/Makefile.am.inc
@@ -2,7 +2,32 @@ bin_PROGRAMS += zbarcam/zbarcam
zbarcam_zbarcam_SOURCES = zbarcam/zbarcam.c
zbarcam_zbarcam_LDADD = zbar/libzbar.la
# automake bug in "monolithic mode"?
-CLEANFILES += zbarcam/.libs/zbarcam
+CLEANFILES += zbarcam/.libs/zbarcam zbarcam/moc_zbarcam_qt.h
+
+if HAVE_GTK
+bin_PROGRAMS += zbarcam/zbarcam-gtk
+check_PROGRAMS += zbarcam/zbarcam-gtk
+zbarcam_zbarcam_gtk_SOURCES = zbarcam/zbarcam-gtk.c zbarcam/scan_video.c
+zbarcam_zbarcam_gtk_CPPFLAGS = $(GTK_CFLAGS) $(AM_CPPFLAGS)
+zbarcam_zbarcam_gtk_LDADD = $(GTK_LIBS) gtk/libzbargtk.la $(AM_LDADD)
+endif
+
+if HAVE_QT
+bin_PROGRAMS += zbarcam/zbarcam-qt
+check_PROGRAMS += zbarcam/zbarcam-qt
+
+zbarcam_zbarcam_qt_SOURCES = zbarcam/zbarcam-qt.cpp zbarcam/scan_video.c
+nodist_zbarcam_zbarcam_qt_SOURCES = zbarcam/moc_zbarcam_qt.h
+zbarcam_zbarcam_qt_CPPFLAGS = -Izbarcam $(QT_CFLAGS) $(AM_CPPFLAGS)
+zbarcam_zbarcam_qt_LDADD = $(QT_LIBS) qt/libzbarqt.la $(AM_LDADD)
+BUILT_SOURCES += $(nodist_zbarcam_zbarcam_qt_SOURCES)
+DISTCLEANFILES += $(nodist_zbarcam_zbarcam_qt_SOURCES) zbarcam/moc_zbarcam_qt.h
+
+
+zbarcam/moc_zbarcam_qt.h: zbarcam/zbarcam-qt.cpp
+ $(MOC) -i $(zbarcam_zbarcam_qt_CPPFLAGS) $< -o $@
+endif
+
if WIN32
zbarcam_zbarcam_SOURCES += zbarcam/zbarcam.rc
diff --git a/test/scan_video.c b/zbarcam/scan_video.c
similarity index 100%
rename from test/scan_video.c
rename to zbarcam/scan_video.c
diff --git a/test/test_gtk.c b/zbarcam/zbarcam-gtk.c
similarity index 100%
rename from test/test_gtk.c
rename to zbarcam/zbarcam-gtk.c
diff --git a/test/test_qt.cpp b/zbarcam/zbarcam-qt.cpp
similarity index 97%
rename from test/test_qt.cpp
rename to zbarcam/zbarcam-qt.cpp
index 96d2f9541453..3a39a338b59d 100644
--- a/test/test_qt.cpp
+++ b/zbarcam/zbarcam-qt.cpp
@@ -40,7 +40,7 @@ int scan_video(void *add_device,
const char *default_device);
}
-class TestQZBar : public QWidget
+class ZbarcamQZBar : public QWidget
{
Q_OBJECT
@@ -52,7 +52,7 @@ protected:
}
public:
- TestQZBar (const char *default_device)
+ ZbarcamQZBar (const char *default_device)
{
// drop-down list of video devices
QComboBox *videoList = new QComboBox;
@@ -142,7 +142,7 @@ private:
zbar::QZBar *zbar;
};
-#include "moc_test_qt.h"
+#include "moc_zbarcam_qt.h"
int main (int argc, char *argv[])
{
@@ -152,7 +152,7 @@ int main (int argc, char *argv[])
if(argc > 1)
dev = argv[1];
- TestQZBar window(dev);
+ ZbarcamQZBar window(dev);
window.show();
return(app.exec());
}

35551
zbar_update_to_hg.patch Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,124 @@
From a8ed8c04c119e5a323a2c79fcd0d28b4d29fc28a Mon Sep 17 00:00:00 2001
From: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Date: Thu, 23 Apr 2015 22:56:09 -0300
Subject: [PATCH] v4l2: use REQBUFS properly
There are two issues on this driver with regards to buffer
request:
1) it is not calling VIDIOC_REQBUFS for USERPTR;
2) It is calling VIDIOC_REQBUFS at probe, to check the max
number of supported buffers, but it doesn't deallocate
the buffers at the end of the probe function.
Fix those issues. Also, improve the error/warning messages
associated with possible problems.
This is based on the issues detected by the patch proposed
to fix this bug:
https://bugs.archlinux.org/task/44091
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
diff --git a/zbar/video/v4l2.c b/zbar/video/v4l2.c
index aabd16643ddc..f6662d3707f9 100644
--- a/zbar/video/v4l2.c
+++ b/zbar/video/v4l2.c
@@ -201,21 +201,6 @@ static int v4l2_cleanup (zbar_video_t *vdo)
static int v4l2_mmap_buffers (zbar_video_t *vdo)
{
- struct v4l2_requestbuffers rb;
- memset(&rb, 0, sizeof(rb));
- rb.count = vdo->num_images;
- rb.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
- rb.memory = V4L2_MEMORY_MMAP;
- if(v4l2_ioctl(vdo->fd, VIDIOC_REQBUFS, &rb) < 0)
- return(err_capture(vdo, SEV_ERROR, ZBAR_ERR_SYSTEM, __func__,
- "requesting video frame buffers (VIDIOC_REQBUFS)"));
- zprintf(1, "mapping %u buffers (of %d requested)\n",
- rb.count, vdo->num_images);
- if(!rb.count)
- return(err_capture(vdo, SEV_ERROR, ZBAR_ERR_INVALID, __func__,
- "driver returned 0 buffers"));
- if(vdo->num_images > rb.count)
- vdo->num_images = rb.count;
struct v4l2_buffer vbuf;
memset(&vbuf, 0, sizeof(vbuf));
@@ -313,8 +298,32 @@ static int v4l2_set_format (zbar_video_t *vdo,
static int v4l2_init (zbar_video_t *vdo,
uint32_t fmt)
{
+ struct v4l2_requestbuffers rb;
if(v4l2_set_format(vdo, fmt))
return(-1);
+
+ memset(&rb, 0, sizeof(rb));
+ rb.count = vdo->num_images;
+ rb.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+ if(vdo->iomode == VIDEO_MMAP)
+ rb.memory = V4L2_MEMORY_MMAP;
+ else
+ rb.memory = V4L2_MEMORY_USERPTR;
+
+ if(v4l2_ioctl(vdo->fd, VIDIOC_REQBUFS, &rb) < 0)
+ return(err_capture(vdo, SEV_ERROR, ZBAR_ERR_SYSTEM, __func__,
+ "requesting video frame buffers (VIDIOC_REQBUFS)"));
+
+ if(!rb.count)
+ return(err_capture(vdo, SEV_ERROR, ZBAR_ERR_INVALID, __func__,
+ "driver returned 0 buffers"));
+
+ if(vdo->num_images > rb.count)
+ vdo->num_images = rb.count;
+
+ zprintf(1, "using %u buffers (of %d requested)\n",
+ rb.count, vdo->num_images);
+
if(vdo->iomode == VIDEO_MMAP)
return(v4l2_mmap_buffers(vdo));
return(0);
@@ -324,7 +333,7 @@ static int v4l2_probe_iomode (zbar_video_t *vdo)
{
struct v4l2_requestbuffers rb;
memset(&rb, 0, sizeof(rb));
- rb.count = vdo->num_images; /* FIXME workaround broken drivers */
+ rb.count = vdo->num_images;
rb.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
if(vdo->iomode == VIDEO_MMAP)
rb.memory = V4L2_MEMORY_MMAP;
@@ -340,14 +349,31 @@ static int v4l2_probe_iomode (zbar_video_t *vdo)
return(err_capture(vdo, SEV_ERROR, ZBAR_ERR_SYSTEM, __func__,
"querying streaming mode (VIDIOC_REQBUFS)"));
#ifdef HAVE_SYS_MMAN_H
+ err_capture(vdo, SEV_WARNING, ZBAR_ERR_SYSTEM, __func__,
+ "USERPTR failed. Falling back to mmap");
vdo->iomode = VIDEO_MMAP;
+#else
+ return err_capture(vdo, SEV_ERROR, ZBAR_ERR_SYSTEM, __func__,
+ "Userptr not supported, and zbar was compiled without mmap support"));
#endif
}
else {
if(!vdo->iomode)
- vdo->iomode = VIDEO_USERPTR;
+ rb.memory = V4L2_MEMORY_USERPTR;
+ /* Update the num_images with the max supported by the driver */
if(rb.count)
vdo->num_images = rb.count;
+ else
+ err_capture(vdo, SEV_WARNING, ZBAR_ERR_SYSTEM, __func__,
+ "Something is wrong: number of buffers returned by REQBUF is zero!");
+
+ /* requesting 0 buffers
+ * This cleans up the buffers allocated previously on probe
+ */
+ rb.count = 0;
+ if(v4l2_ioctl(vdo->fd, VIDIOC_REQBUFS, &rb) < 0)
+ err_capture(vdo, SEV_WARNING, ZBAR_ERR_SYSTEM, __func__,
+ "releasing video frame buffers (VIDIOC_REQBUFS)");
}
return(0);
}

305
zbar_use_libv4l.patch Normal file
View file

@ -0,0 +1,305 @@
diff -r 38e78368283d configure.ac
--- a/configure.ac Sun Oct 14 23:02:08 2012 -0700
+++ b/configure.ac Fri Feb 22 10:04:52 2013 -0300
@@ -3,7 +3,8 @@
AC_INIT([zbar], [0.10], [spadix@users.sourceforge.net])
AC_CONFIG_AUX_DIR(config)
AC_CONFIG_MACRO_DIR(config)
-AM_INIT_AUTOMAKE([1.10 -Wall -Werror foreign subdir-objects std-options dist-bzip2])
+AM_INIT_AUTOMAKE([1.10 -Werror foreign subdir-objects std-options dist-bzip2])
+AM_PROG_AR
AC_CONFIG_HEADERS([include/config.h])
AC_CONFIG_SRCDIR(zbar/scanner.c)
LT_PREREQ([2.2])
@@ -47,7 +48,7 @@
[Library revision])
AM_CPPFLAGS="-I$srcdir/include"
-AM_CFLAGS="-Wall -Wno-parentheses -Werror"
+AM_CFLAGS="-Wall -Wno-parentheses"
AM_CXXFLAGS="$AM_CFLAGS"
AC_SUBST([AM_CPPFLAGS])
AC_SUBST([AM_CFLAGS])
@@ -179,11 +180,13 @@
have_v4l1="no"
have_v4l2="no"
+have_libv4l="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"])
+ AC_CHECK_HEADERS([libv4l2.h], [have_libv4l="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
@@ -194,9 +197,15 @@
[AC_MSG_FAILURE([test for VfW video support failed!
configure --disable-video to skip building video support.])])])
+AS_IF([test "x$have_libv4l" = "xyes"],
+ AC_CHECK_LIB([v4l2], [v4l2_open], [],
+ [AC_MSG_FAILURE([unable to find libv4l.so])]),
+ [AC_MSG_WARN([libv4l not detected. Install it to support more cameras!])])
+
AM_CONDITIONAL([HAVE_VIDEO], [test "x$enable_video" != "xno"])
AM_CONDITIONAL([HAVE_V4L1], [test "x$have_v4l1" != "xno"])
AM_CONDITIONAL([HAVE_V4L2], [test "x$have_v4l2" != "xno"])
+AM_CONDITIONAL([HAVE_LIBV4L], [test "x$have_libv4l" != "xno"])
dnl X
AC_ARG_VAR([XSHM_LIBS], [linker flags for X shared memory extension])
@@ -571,6 +580,8 @@
echo "v4l --enable-video=$enable_video"
AS_IF([test "x$enable_video" != "xyes"],
[echo " => zbarcam video scanner will *NOT* be built"])
+AS_IF([test "x$have_libv4l" != "xyes"],
+ [echo " => libv4l will *NOT* be used"])
echo "jpeg --with-jpeg=$with_jpeg"
AS_IF([test "x$with_jpeg" != "xyes"],
[echo " => JPEG image conversions will *NOT* be supported"])
diff -r 38e78368283d zbar/video/v4l.c
--- a/zbar/video/v4l.c Sun Oct 14 23:02:08 2012 -0700
+++ b/zbar/video/v4l.c Fri Feb 22 10:04:52 2013 -0300
@@ -34,6 +34,13 @@
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
+#ifdef HAVE_LIBV4L2_H
+# include <fcntl.h>
+# include <libv4l2.h>
+#else
+# define v4l2_open open
+# define v4l2_close close
+#endif
#include "video.h"
@@ -43,7 +50,7 @@
int _zbar_video_open (zbar_video_t *vdo,
const char *dev)
{
- vdo->fd = open(dev, O_RDWR);
+ vdo->fd = v4l2_open(dev, O_RDWR);
if(vdo->fd < 0)
return(err_capture_str(vdo, SEV_ERROR, ZBAR_ERR_SYSTEM, __func__,
"opening video device '%s'", dev));
@@ -60,7 +67,7 @@
#endif
if(rc && vdo->fd >= 0) {
- close(vdo->fd);
+ v4l2_close(vdo->fd);
vdo->fd = -1;
}
return(rc);
diff -r 38e78368283d zbar/video/v4l2.c
--- a/zbar/video/v4l2.c Sun Oct 14 23:02:08 2012 -0700
+++ b/zbar/video/v4l2.c Fri Feb 22 10:04:52 2013 -0300
@@ -38,6 +38,15 @@
#ifdef HAVE_SYS_MMAN_H
# include <sys/mman.h>
#endif
+#ifdef HAVE_LIBV4L2_H
+# include <fcntl.h>
+# include <libv4l2.h>
+#else
+# define v4l2_close close
+# define v4l2_ioctl ioctl
+# define v4l2_mmap mmap
+# define v4l2_munmap munmap
+#endif
#include <linux/videodev2.h>
#include "video.h"
@@ -67,7 +76,7 @@
vbuf.length = img->datalen;
vbuf.index = img->srcidx; /* FIXME workaround broken drivers */
}
- if(ioctl(vdo->fd, VIDIOC_QBUF, &vbuf) < 0)
+ if(v4l2_ioctl(vdo->fd, VIDIOC_QBUF, &vbuf) < 0)
return(err_capture(vdo, SEV_ERROR, ZBAR_ERR_SYSTEM, __func__,
"queuing video buffer (VIDIOC_QBUF)"));
return(0);
@@ -91,7 +100,7 @@
else
vbuf.memory = V4L2_MEMORY_USERPTR;
- if(ioctl(fd, VIDIOC_DQBUF, &vbuf) < 0)
+ if(v4l2_ioctl(fd, VIDIOC_DQBUF, &vbuf) < 0)
return(NULL);
if(iomode == VIDEO_MMAP) {
@@ -132,7 +141,7 @@
return(0);
enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
- if(ioctl(vdo->fd, VIDIOC_STREAMON, &type) < 0)
+ if(v4l2_ioctl(vdo->fd, VIDIOC_STREAMON, &type) < 0)
return(err_capture(vdo, SEV_ERROR, ZBAR_ERR_SYSTEM, __func__,
"starting video stream (VIDIOC_STREAMON)"));
return(0);
@@ -144,7 +153,7 @@
return(0);
enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
- if(ioctl(vdo->fd, VIDIOC_STREAMOFF, &type) < 0)
+ if(v4l2_ioctl(vdo->fd, VIDIOC_STREAMOFF, &type) < 0)
return(err_capture(vdo, SEV_ERROR, ZBAR_ERR_SYSTEM, __func__,
"stopping video stream (VIDIOC_STREAMOFF)"));
return(0);
@@ -164,7 +173,7 @@
for(i = 0; i < vdo->num_images; i++) {
zbar_image_t *img = vdo->images[i];
if(img->data &&
- munmap((void*)img->data, img->datalen))
+ v4l2_munmap((void*)img->data, img->datalen))
err_capture(vdo, SEV_WARNING, ZBAR_ERR_SYSTEM, __func__,
"unmapping video frame buffers");
img->data = NULL;
@@ -177,14 +186,14 @@
/* requesting 0 buffers
* should implicitly disable streaming
*/
- if(ioctl(vdo->fd, VIDIOC_REQBUFS, &rb) < 0)
+ if(v4l2_ioctl(vdo->fd, VIDIOC_REQBUFS, &rb) < 0)
err_capture(vdo, SEV_WARNING, ZBAR_ERR_SYSTEM, __func__,
"releasing video frame buffers (VIDIOC_REQBUFS)");
- /* close open device */
+ /* v4l2_close v4l2_open device */
if(vdo->fd >= 0) {
- close(vdo->fd);
+ v4l2_close(vdo->fd);
vdo->fd = -1;
}
return(0);
@@ -197,7 +206,7 @@
rb.count = vdo->num_images;
rb.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
rb.memory = V4L2_MEMORY_MMAP;
- if(ioctl(vdo->fd, VIDIOC_REQBUFS, &rb) < 0)
+ if(v4l2_ioctl(vdo->fd, VIDIOC_REQBUFS, &rb) < 0)
return(err_capture(vdo, SEV_ERROR, ZBAR_ERR_SYSTEM, __func__,
"requesting video frame buffers (VIDIOC_REQBUFS)"));
zprintf(1, "mapping %u buffers (of %d requested)\n",
@@ -216,7 +225,7 @@
int i;
for(i = 0; i < vdo->num_images; i++) {
vbuf.index = i;
- if(ioctl(vdo->fd, VIDIOC_QUERYBUF, &vbuf) < 0)
+ if(v4l2_ioctl(vdo->fd, VIDIOC_QUERYBUF, &vbuf) < 0)
/* FIXME cleanup */
return(err_capture(vdo, SEV_ERROR, ZBAR_ERR_SYSTEM, __func__,
"querying video buffer (VIDIOC_QUERYBUF)"));
@@ -229,7 +238,7 @@
zbar_image_t *img = vdo->images[i];
img->datalen = vbuf.length;
- img->data = mmap(NULL, vbuf.length, PROT_READ | PROT_WRITE, MAP_SHARED,
+ img->data = v4l2_mmap(NULL, vbuf.length, PROT_READ | PROT_WRITE, MAP_SHARED,
vdo->fd, vbuf.m.offset);
if(img->data == MAP_FAILED)
/* FIXME cleanup */
@@ -253,7 +262,7 @@
vpix->pixelformat = fmt;
vpix->field = V4L2_FIELD_NONE;
int rc = 0;
- if((rc = ioctl(vdo->fd, VIDIOC_S_FMT, &vfmt)) < 0) {
+ if((rc = v4l2_ioctl(vdo->fd, VIDIOC_S_FMT, &vfmt)) < 0) {
/* several broken drivers return an error if we request
* no interlacing (NB v4l2 spec violation)
* ...try again with an interlaced request
@@ -264,7 +273,7 @@
/* FIXME this might be _ANY once we can de-interlace */
vpix->field = V4L2_FIELD_INTERLACED;
- if(ioctl(vdo->fd, VIDIOC_S_FMT, &vfmt) < 0)
+ if(v4l2_ioctl(vdo->fd, VIDIOC_S_FMT, &vfmt) < 0)
return(err_capture_int(vdo, SEV_ERROR, ZBAR_ERR_SYSTEM, __func__,
"setting format %x (VIDIOC_S_FMT)", fmt));
@@ -276,7 +285,7 @@
struct v4l2_pix_format *newpix = &newfmt.fmt.pix;
memset(&newfmt, 0, sizeof(newfmt));
newfmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
- if(ioctl(vdo->fd, VIDIOC_G_FMT, &newfmt) < 0)
+ if(v4l2_ioctl(vdo->fd, VIDIOC_G_FMT, &newfmt) < 0)
return(err_capture(vdo, SEV_ERROR, ZBAR_ERR_SYSTEM, __func__,
"querying format (VIDIOC_G_FMT)"));
@@ -322,7 +331,7 @@
else
rb.memory = V4L2_MEMORY_USERPTR;
- if(ioctl(vdo->fd, VIDIOC_REQBUFS, &rb) < 0) {
+ if(v4l2_ioctl(vdo->fd, VIDIOC_REQBUFS, &rb) < 0) {
if(vdo->iomode)
return(err_capture_int(vdo, SEV_ERROR, ZBAR_ERR_INVALID, __func__,
"unsupported iomode requested (%d)",
@@ -350,7 +359,7 @@
memset(&desc, 0, sizeof(desc));
desc.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
for(desc.index = 0; desc.index < V4L2_FORMATS_MAX; desc.index++) {
- if(ioctl(vdo->fd, VIDIOC_ENUM_FMT, &desc) < 0)
+ if(v4l2_ioctl(vdo->fd, VIDIOC_ENUM_FMT, &desc) < 0)
break;
zprintf(2, " [%d] %.4s : %s%s\n",
desc.index, (char*)&desc.pixelformat, desc.description,
@@ -368,7 +377,7 @@
struct v4l2_pix_format *pix = &fmt.fmt.pix;
memset(&fmt, 0, sizeof(fmt));
fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
- if(ioctl(vdo->fd, VIDIOC_G_FMT, &fmt) < 0)
+ if(v4l2_ioctl(vdo->fd, VIDIOC_G_FMT, &fmt) < 0)
return(err_capture(vdo, SEV_ERROR, ZBAR_ERR_SYSTEM, __func__,
"querying current video format (VIDIO_G_FMT)"));
@@ -390,15 +399,15 @@
maxpix->height = vdo->height;
zprintf(1, "setting requested size: %d x %d\n", vdo->width, vdo->height);
- if(ioctl(vdo->fd, VIDIOC_S_FMT, &maxfmt) < 0) {
+ if(v4l2_ioctl(vdo->fd, VIDIOC_S_FMT, &maxfmt) < 0) {
zprintf(1, "set FAILED...trying to recover original format\n");
/* ignore errors (driver broken anyway) */
- ioctl(vdo->fd, VIDIOC_S_FMT, &fmt);
+ v4l2_ioctl(vdo->fd, VIDIOC_S_FMT, &fmt);
}
memset(&fmt, 0, sizeof(fmt));
fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
- if(ioctl(vdo->fd, VIDIOC_G_FMT, &fmt) < 0)
+ if(v4l2_ioctl(vdo->fd, VIDIOC_G_FMT, &fmt) < 0)
return(err_capture(vdo, SEV_ERROR, ZBAR_ERR_SYSTEM, __func__,
"querying current video format (VIDIOC_G_FMT)"));
@@ -420,7 +429,7 @@
struct v4l2_cropcap ccap;
memset(&ccap, 0, sizeof(ccap));
ccap.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
- if(ioctl(vdo->fd, VIDIOC_CROPCAP, &ccap) < 0)
+ if(v4l2_ioctl(vdo->fd, VIDIOC_CROPCAP, &ccap) < 0)
return(err_capture(vdo, SEV_ERROR, ZBAR_ERR_SYSTEM, __func__,
"querying crop support (VIDIOC_CROPCAP)"));
@@ -442,7 +451,7 @@
memset(&crop, 0, sizeof(crop));
crop.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
crop.c = ccap.defrect;
- if(ioctl(vdo->fd, VIDIOC_S_CROP, &crop) < 0 && errno != EINVAL)
+ if(v4l2_ioctl(vdo->fd, VIDIOC_S_CROP, &crop) < 0 && errno != EINVAL)
return(err_capture(vdo, SEV_ERROR, ZBAR_ERR_SYSTEM, __func__,
"setting default crop window (VIDIOC_S_CROP)"));
return(0);
@@ -453,7 +462,7 @@
/* check capabilities */
struct v4l2_capability vcap;
memset(&vcap, 0, sizeof(vcap));
- if(ioctl(vdo->fd, VIDIOC_QUERYCAP, &vcap) < 0)
+ if(v4l2_ioctl(vdo->fd, VIDIOC_QUERYCAP, &vcap) < 0)
return(err_capture(vdo, SEV_WARNING, ZBAR_ERR_UNSUPPORTED, __func__,
"video4linux version 2 not supported (VIDIOC_QUERYCAP)"));