From e4e2b9ceeef2f1ae31eff36b95c9ff5ddeecf687c319f06233343d5a2ae8fc2f Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 14 Mar 2025 15:24:58 +0000 Subject: [PATCH 1/5] - Use pkgconfig() to be impervious to package renames. OBS-URL: https://build.opensuse.org/package/show/multimedia:apps/guvcview?expand=0&rev=23 --- .gitattributes | 23 +++ .gitignore | 1 + 0001-Fix-build-with-GCC-14.patch | 40 ++++ _multibuild | 3 + guvcview-SUSE.patch | 36 ++++ guvcview-qt5-nolibs_qt5names.patch | 83 ++++++++ guvcview-src-2.0.8.tar.bz2 | 3 + guvcview-src-2.1.0.tar.bz2 | 3 + guvcview.changes | 309 +++++++++++++++++++++++++++++ guvcview.spec | 255 ++++++++++++++++++++++++ 10 files changed, 756 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 0001-Fix-build-with-GCC-14.patch create mode 100644 _multibuild create mode 100644 guvcview-SUSE.patch create mode 100644 guvcview-qt5-nolibs_qt5names.patch create mode 100644 guvcview-src-2.0.8.tar.bz2 create mode 100644 guvcview-src-2.1.0.tar.bz2 create mode 100644 guvcview.changes create mode 100644 guvcview.spec diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/0001-Fix-build-with-GCC-14.patch b/0001-Fix-build-with-GCC-14.patch new file mode 100644 index 0000000..3002340 --- /dev/null +++ b/0001-Fix-build-with-GCC-14.patch @@ -0,0 +1,40 @@ +From 98feb36a5f4971ca152b2d90a923008d0bd6cf5f Mon Sep 17 00:00:00 2001 +From: Christophe Marin +Date: Tue, 27 Aug 2024 10:31:02 +0200 +Subject: [PATCH] =?UTF-8?q?Fix=20build=20with=20GCC=C2=A014?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--- + gview_v4l2core/jpeg_decoder.c | 1 + + gview_v4l2core/uvc_h264.c | 1 + + 2 files changed, 2 insertions(+) + +diff --git a/gview_v4l2core/jpeg_decoder.c b/gview_v4l2core/jpeg_decoder.c +index 9d30ea2..d60fdf8 100644 +--- a/gview_v4l2core/jpeg_decoder.c ++++ b/gview_v4l2core/jpeg_decoder.c +@@ -36,6 +36,7 @@ + #include + #include + #include ++#include + + #include "gviewv4l2core.h" + #include "colorspaces.h" +diff --git a/gview_v4l2core/uvc_h264.c b/gview_v4l2core/uvc_h264.c +index ed0c6a8..a02271e 100644 +--- a/gview_v4l2core/uvc_h264.c ++++ b/gview_v4l2core/uvc_h264.c +@@ -24,6 +24,7 @@ + /* support for internationalization - i18n */ + #include + #include ++#include + #include + #include + #include +-- +2.46.0 + diff --git a/_multibuild b/_multibuild new file mode 100644 index 0000000..de9a3e0 --- /dev/null +++ b/_multibuild @@ -0,0 +1,3 @@ + + qt5 + diff --git a/guvcview-SUSE.patch b/guvcview-SUSE.patch new file mode 100644 index 0000000..b4d5445 --- /dev/null +++ b/guvcview-SUSE.patch @@ -0,0 +1,36 @@ +From: Luigi Baldoni +Date: 2017-07-28 17:04:22 +0200 +Subject: SUSE-specific paths + +Change filenames and paths to SUSE standards instead +of messing with them in the .spec file. + +Index: guvcview-src-2.0.8/Makefile.am +=================================================================== +--- guvcview-src-2.0.8.orig/Makefile.am ++++ guvcview-src-2.0.8/Makefile.am +@@ -27,14 +27,6 @@ pkgconfig_DATA = pkgconfig/libgviewv4l2c + + ACLOCAL_AMFLAGS = -I m4 + +-docdir = ${datadir}/doc/guvcview +-doc_DATA = \ +- README.md\ +- COPYING\ +- AUTHORS\ +- ChangeLog\ +- INSTALL +- + EXTRA_DIST = bootstrap.sh + + check-gettext: +Index: guvcview-src-2.0.8/data/icons/Makefile.am +=================================================================== +--- guvcview-src-2.0.8.orig/data/icons/Makefile.am ++++ guvcview-src-2.0.8/data/icons/Makefile.am +@@ -1,4 +1,4 @@ +-iconsdir = ${datadir}/pixmaps/guvcview ++iconsdir = ${datadir}/pixmaps/ + icons_DATA = \ + guvcview.png + diff --git a/guvcview-qt5-nolibs_qt5names.patch b/guvcview-qt5-nolibs_qt5names.patch new file mode 100644 index 0000000..01f62fd --- /dev/null +++ b/guvcview-qt5-nolibs_qt5names.patch @@ -0,0 +1,83 @@ +From: Luigi Baldoni +Date: 2017-07-28 17:05:35 +0200 +Subject: Modifications for the -qt5 package + +Don't build libraries and rely on those supplied by the +regular (GTK+) package. +Also change a few filenames to avoid collisions. + +Index: guvcview-src-2.0.8/Makefile.am +=================================================================== +--- guvcview-src-2.0.8.orig/Makefile.am ++++ guvcview-src-2.0.8/Makefile.am +@@ -1,13 +1,8 @@ + ## Process this file with automake to produce Makefile.in + +-SUBDIRS = gview_v4l2core \ +- gview_audio \ +- gview_render \ +- gview_encoder \ +- guvcview \ ++SUBDIRS = guvcview \ + data \ +- po \ +- po/gview_v4l2core ++ po + + #Distribute these directories: + DIST_SUBDIRS = gview_v4l2core \ +@@ -19,12 +14,6 @@ DIST_SUBDIRS = gview_v4l2core \ + po \ + po/gview_v4l2core + +-pkgconfigdir = $(libdir)/pkgconfig +-pkgconfig_DATA = pkgconfig/libgviewv4l2core.pc \ +- pkgconfig/libgviewaudio.pc \ +- pkgconfig/libgviewrender.pc \ +- pkgconfig/libgviewencoder.pc +- + ACLOCAL_AMFLAGS = -I m4 + + EXTRA_DIST = bootstrap.sh +Index: guvcview-src-2.0.8/guvcview/Makefile.am +=================================================================== +--- guvcview-src-2.0.8.orig/guvcview/Makefile.am ++++ guvcview-src-2.0.8/guvcview/Makefile.am +@@ -57,14 +57,14 @@ guvcview_CPPFLAGS = $(guvcview_CFLAGS) \ + -fPIC + endif + +-guvcview_LDFLAGS = $(LIBINTL) ++guvcview_LDFLAGS = $(LIBINTL) \ ++ $(shell pkg-config --libs libgviewv4l2core) \ ++ $(shell pkg-config --libs libgviewrender) \ ++ $(shell pkg-config --libs libgviewaudio) \ ++ $(shell pkg-config --libs libgviewencoder) + +-guvcview_LDADD = ../gview_v4l2core/$(GVIEWV4L2CORE_LIBRARY_NAME).la \ +- ../gview_render/$(GVIEWRENDER_LIBRARY_NAME).la \ +- ../gview_audio/$(GVIEWAUDIO_LIBRARY_NAME).la \ +- ../gview_encoder/$(GVIEWENCODER_LIBRARY_NAME).la \ +- $(PTHREAD_LIBS) \ +- -lm ++guvcview_LDADD = -lpthread \ ++ -lm + if HAVE_GTK3 + guvcview_LDADD += $(GUIGTK3_LIBS) + endif +Index: guvcview-src-2.0.8/configure.ac +=================================================================== +--- guvcview-src-2.0.8.orig/configure.ac ++++ guvcview-src-2.0.8/configure.ac +@@ -73,9 +73,9 @@ GETTEXT_PACKAGE_V4L2CORE=gview_v4l2core + AC_SUBST(GETTEXT_PACKAGE_V4L2CORE) + AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE_V4L2CORE,"$GETTEXT_PACKAGE_V4L2CORE", [gview_v4l2core]) + +-GETTEXT_PACKAGE=guvcview ++GETTEXT_PACKAGE=guvcview-qt5 + AC_SUBST(GETTEXT_PACKAGE) +-AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [guvcview]) ++AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [guvcview-qt5]) + + IT_PROG_INTLTOOL([0.40]) + IT_PO_SUBDIR(po/gview_v4l2core) diff --git a/guvcview-src-2.0.8.tar.bz2 b/guvcview-src-2.0.8.tar.bz2 new file mode 100644 index 0000000..8bd9ec1 --- /dev/null +++ b/guvcview-src-2.0.8.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a21f4e448286666cf27bafef5290cc953a0a1796b752e5bbe521266dc1230c81 +size 902736 diff --git a/guvcview-src-2.1.0.tar.bz2 b/guvcview-src-2.1.0.tar.bz2 new file mode 100644 index 0000000..5762595 --- /dev/null +++ b/guvcview-src-2.1.0.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3d93e4c9fab8d1a7a9bde1a6dbbf04d6cf9d347c134b5128b4586a1d90b63cfb +size 775670 diff --git a/guvcview.changes b/guvcview.changes new file mode 100644 index 0000000..38de2b1 --- /dev/null +++ b/guvcview.changes @@ -0,0 +1,309 @@ +------------------------------------------------------------------- +Thu Mar 13 18:44:01 UTC 2025 - Jan Engelhardt + +- Use pkgconfig() to be impervious to package renames. + +------------------------------------------------------------------- +Tue Aug 27 18:06:06 UTC 2024 - Dave Plater + +- Revert to ffmpeg-7 + +------------------------------------------------------------------- +Tue Aug 27 10:47:09 UTC 2024 - Dave Plater + +- Force ffmpeg-6 library use in order to fix build + +------------------------------------------------------------------- +Tue Aug 27 08:07:37 UTC 2024 - Christophe Marin + +- Update to 2.1.0 + * Fix audio channels deprecated warning for avcodec >= 58 + * Add button click support for certain type of digital + microscopes + * Small fixes + * Fix minimum version for audio channels api deprecated + warning for avcodec >= 59 + * Fix COPYING to the same GPL version (v2) as the source files + * Add binary fx filter + * Make guvcview skip metadada devices + * Enable OSD crosshair size to be changed in config +- Add patch to fix build failure with GCC 14: + * 0001-Fix-build-with-GCC-14.patch +- Fix license. There's no GPL-3.0-only file that could impact + the binaries license. +- Spec cleanup + +------------------------------------------------------------------- +Tue Feb 27 11:16:13 UTC 2024 - Dominique Leuenberger + +- Use %patch -P N instead of deprecated %patchN. + +------------------------------------------------------------------- +Mon Aug 8 22:06:07 UTC 2022 - Atri Bhattacharya + +- Update to version 2.0.8: + * Fix libav API break (ticket #70) + * Update autoconf scripts + * Support for building against ffmpeg5. +- Changes from version 2.0.7: + * Fix audio encoder (tickets #64 and #65) + * Use current theme icons (get icon by name) +- Convert to multibuild with qt5 as additional flavor: + * Drop guvcview-qt5.spec, guvcview-qt5.changes, pre_checkin.sh + script. + * Drop hunks from guvcview-qt5-nolibs_qt5names.patch duplicated + in guvcview-SUSE.patch. + * Adapt BuildRequires for the additional flavour appropriately. +- Update so versions in keeping with upstream shlib versioning. +- Replace packageand type Supplements with RPM binary Supplements. +- Update guvcview-SUSE.patch to drop icon dir restructuring: no + longer needed after all theme-able application icons dropped. + +------------------------------------------------------------------- +Mon Feb 3 13:51:18 UTC 2020 - Dominique Leuenberger + +- BuildRequire pkgconfig(libudev) instead of libudev-devel: allow + OBS to shortcut through the -mini flavors. + +------------------------------------------------------------------- +Tue Feb 12 18:24:24 UTC 2019 - bjorn.lie@gmail.com + +- Update to version 2.0.6: + * No upstream changes provided, please see + https://sourceforge.net/p/guvcview/git-master/ci/master/tree/ +- No longer force use ffmpeg3 version of pkgconfig(libav*). +- Drop guvcview-qt5-ppc64_QVariant.patch: Fixed upstream. +- Rebase guvcview-qt5-nolibs_qt5names.patch with quilt. + +------------------------------------------------------------------- +Fri May 4 14:03:47 UTC 2018 - olaf@aepfle.de + +- Use ffmpeg3 versions of pkgconfig(libav*) + +------------------------------------------------------------------- +Mon Sep 11 18:48:13 UTC 2017 - jengelh@inai.de + +- Update summary of -devel subpackage. + +------------------------------------------------------------------- +Sat Jul 29 10:53:31 UTC 2017 - aloisio@gmx.com + +- Update to version 2.0.5 + * terminate configure if qt5 is enabled and moc is missing + * add sfml render + * fix aac encoder (replace experimental aac by libvo_aacenc) + * fix build against newer kernels + * disable window key pressed events if a string control has focus + * fix video monotonic pts flag value in encoder context + * fix audio cleanup + * add support for HEVC (h265) video codec + * fix muxed h264 support; fix raw output (alloc outbuf frame) + * add circular buffer for delayed audio frames pts + * remove support for older libavcodec versions (< 54.01) + * add support for VP9 + * fix motion estimation method for x264 [1-4] + * fix buggy behaviour for file names without extension + * add support for sfml render + * drop support for sdl1 based render + * Flavio Spagnuolo : fix matroska + clean up when audio is disabled + * fix segfault when destroying mutexes by unlocking already + unlocked mutexes + * fix libc readdir_r deprecated warning: replace by readdir + * add extra video fx filters + +- Dropped guvcview-2.0.4_ffmpeg-3.0.patch (merged upstream) + +- Split lang package contents between guvcview-lang and a new + libgviewv4l2core-lang + +- Added separate -qt5 and -qt5-lang packages and pre_checkin.sh + and guvcview-qt5-nolibs_qt5names.patch to support them + +- Added guvcview-qt5-ppc64_QVariant.patch to fix build on ppc64 + +- Replaced some in-spec commands with guvcview-SUSE.patch + +------------------------------------------------------------------- +Thu Mar 2 10:28:49 UTC 2017 - jengelh@inai.de + +- Rename %soname to %sover to better reflect its use +- Ensure description neutrality + +------------------------------------------------------------------- +Sun May 1 18:06:05 UTC 2016 - aloisio@gmx.com + +- Update to version 2.0.4: + * drop support for internal 422 packed format (use only 420 planar) + * add support for extra pixel formats, including be formats + * add command line option for requesting fps + * add support for control events + * add support for string, int64, bitmask and integer menu controls + * make sure we can't select unsuported pix formats from the gui + * fix status message for QT5 interface + * move mutexes to device handlers (context) + * v4l2core and audio api - don't access device data directly (use opaque structures) + * add constructor and destructor functions for v4l2core and encoder + Paulo Assis Mon, 22 Feb 2016 10:10:00 +0100 + 2.0.3: + * Add Qt5 interface (--enable-qt5) + * fix '-n' option (don't save frame when photo countdown reaches 0) + * restore exit_on_term option + * use AC_SYS_LARGEFILE m4 macro for enabling Large File Support (LFS) on 32 bit systems + * add color config for crosshair osd + * change rendering engine to use updateTexture instead of lock/unlock texture + * change rendering lib to avoid frame copy when using osd + Paulo Assis Mon, 4 Jan 2016 23:34:00 +0100 + +- Dropped guvcview-implicit-pointer-decl.patch + guvcview-no-return-in-nonvoid-function.patch + guvcview-voidreturn.patch + +- Added guvcview-2.0.4_ffmpeg-3.0.patch + +------------------------------------------------------------------- +Tue Sep 22 08:47:31 UTC 2015 - olaf@aepfle.de + +- Use pkgconfig for ffmpeg BuildRequires + +------------------------------------------------------------------- +Wed Aug 05 10:49:17 UTC 2015 - joerg.lorenzen@ki.tng.de + +- Update to version 2.0.2: + + fix mjpeg and h264 decoders (libav): init avpacket. + + fix wrong logic of enable switches (Marvin Schmidt ticket #12). + + create a frame queue and refactor frame grab/decode. + + fix jpeg decoder for older libavcodec api ( < 54.25). + + attach video capture to SIGUSR1 signal. + + add audio latency control to gui. + + change default portaudio latency to high latency. + + set device during initialization. + + use time for matroska segment uid if gsl is disabled. + + fix array index causing buffer overflow. + + restore CPPFLAGS after AC_CHECK_HEADERS. + + remove direct access to device data in v4l2core lib. + + make sure to stop encoder thread before exiting capture thread. + + avoid SIGFPE on bad channels or samprate data inside audio + capture callbacks. + + remove check for avcodec.h (it's needed for very old libavcodec + versions); set iyuv as default internal format (over yuyv). + + add basic support for continuous and stepwise frame sizes. + + add support for empty control list. + + add code for crossair osd. + + fix h264 demux from mjpg container. + + fix pan/tilt for logitech peripheral V3 (use raw control + instead of v4l2). + +------------------------------------------------------------------- +Fri Oct 31 11:53:42 UTC 2014 - joerg.lorenzen@ki.tng.de + +- Update to version 2.0.1: + + Fix audio clean bug (segfault when audio=none). + + Add --disable_libv4l2 option. + + Add support for internal yu12 planar format. + + Workaround uvcvideo bug (buf.bytesused=0 on kernels >=3.16). +- Changes since version 2.0.0: + + New version 2.0.0 (code rewriten from scratch). + + Move all core functions to 4 shared libs. + + Change options. + + Change config. + + Add sdl2 render. + + Use gsl for random number generation. +- Changes since version 1.7.3: + + Add silence frames to compensate audio drift (delay). + + Fix possible memory leak. + + Add video and image capture through system signals: + SIGUSR1 and SIGUSR2. + + Add true no_display mode (no X required). + + Small bug fixes. +- Changes since version 1.7.2: + + Add H264 decoding support. + + Sync translations. +- Changes since version 1.7.1: + + Fix avi muxer: fix opendml indexes (>= 1Gb). + + Update Italian translation. + +------------------------------------------------------------------- +Tue Jul 30 13:34:46 UTC 2013 - i@margueirte.su + +- build against libffmpeg-devel. + +------------------------------------------------------------------- +Sat Jul 20 20:41:27 UTC 2013 - zaitor@opensuse.org + +- Update to version 1.7.0: + + Refactor avi muxer (base it on libav muxer with opendml + support). + + Refactor mkv muxer (base it on libav muxer with webm support). + + Add VP8, Theora and Vorbis codecs. + + Add Webm support. + + Add a Top Menu. + + Move all file operations to the Top Menu. + +------------------------------------------------------------------- +Fri Sep 20 12:27:00 UTC 2012 - zaitor@opensuse.org + +- Update to version 1.6.1: + + Fix build with latest libavcodec. + + Fix audio codecs listing. + + Fix audio codecs (AC3 and AAC) input format for latest + libavcodec API (float). + + Add support for delayed frames in video encoding. +- Changes since version 1.6.0: + + Run audio in separate thread. + + Update audio buffer. + + Move pulse audio interface from simple to async API. + + Add pulse device list. + + Enable build of pulse API by default. +- Added new build dependency, intltool. + +------------------------------------------------------------------- +Sun May 20 14:28:10 UTC 2012 - zaitor@opensuse.org + +- Update to version 1.5.3: + + Update libavcodec API. + + Add libavutil dependency. + + Fix pulse interface. + + Update language catalogs. +- Drop guvcview-pulseaudio-fix.patch, fixed upstream. +- Change BuildRequires: pulseaudio-devel to libpulse-devel. + +------------------------------------------------------------------- +Sun Feb 26 15:52:45 UTC 2012 - zaitor@opensuse.org + +- Update to version 1.5.2: + + Move to pthreads (fix gthread API 2 issues). + + Add italian translation. + + Fix several libavcodec issues. + + Fix some gtk3 widgets. +- Drop guvcview-fix-glib-include.patch, fixed upstream. +- Add guvcview-pulseaudio-fix.patch: Fix pulseaudio interface. + +------------------------------------------------------------------- +Mon Jan 23 00:48:09 UTC 2012 - malcolmlewis@opensuse.org + +- Updated to version 1.5.1: + + Moved to gtk3. + + Make control window size dependent on screen resolution. + + Threaded coding patch - George Sedov . + + Fix h264 codec properties. +- Updates from version 1.5.0: + + Add a no display mode (--no_display). + + Fix build issues with newer versions (>=0.7.x) of ffmpeg + libavcodec. + + Add support for unix signals. + + Add VU meter OSD. + + Fix menu controls (linux 3.0). +- Add guvcview-fix-glib-include.patch: To fix only can be + included directly error for builds > 1210. + +------------------------------------------------------------------- +Mon Oct 3 19:28:19 UTC 2011 - malcolmlewis@opensuse.org + +- Fix guvcview.desktop file in spec file. + +------------------------------------------------------------------- +Fri Jul 1 02:06:44 UTC 2011 - malcolmlewis@opensuse.org + +- Initial build based on fc15 spec file. + diff --git a/guvcview.spec b/guvcview.spec new file mode 100644 index 0000000..259e867 --- /dev/null +++ b/guvcview.spec @@ -0,0 +1,255 @@ +# +# spec file for package guvcview +# +# Copyright (c) 2025 SUSE LLC +# Copyright (c) 2012 Malcolm J Lewis +# Copyright (c) 2013 Marguerite Su +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +%define sover0 2_2-2 +%define sover1 2_2-2 +%global flavor @BUILD_FLAVOR@%{nil} + +%define pname guvcview + +%if "%{flavor}" == "qt5" +%bcond_without qt5 +%define psuffix -qt5 +%else +%bcond_with qt5 +%endif + +Name: guvcview%{?psuffix} +Version: 2.1.0 +Release: 0 +# Reference to GPL-2.0 in some files? +Summary: GTK+ UVC Viewer and Capturer +License: GPL-2.0-or-later +Group: Productivity/Multimedia/Video/Players +URL: https://guvcview.sourceforge.net/ +Source0: https://sourceforge.net/projects/guvcview/files/source/guvcview-src-%{version}.tar.bz2 +# PATCH-FIX-OPENSUSE guvcview-SUSE.patch -- use SUSE-specific paths +Patch0: guvcview-SUSE.patch +# PATCH-FIX-OPENSUSE guvcview-qt5-nolibs_qt5names.patch -- use libraries from the GTK+ package +Patch1: guvcview-qt5-nolibs_qt5names.patch +# PATCH-FIX-OPENSUSE 0001-Fix-build-with-GCC-14.patch -- Upstream already has the fix (although part of bigger changeset) +Patch2: 0001-Fix-build-with-GCC-14.patch +BuildRequires: automake +BuildRequires: fdupes +BuildRequires: gcc-c++ +BuildRequires: gettext +BuildRequires: intltool +BuildRequires: libpng-devel +BuildRequires: libtool +BuildRequires: pkgconfig +BuildRequires: update-desktop-files +BuildRequires: pkgconfig(alsa) +BuildRequires: pkgconfig(gsl) +BuildRequires: pkgconfig(gtk+-3.0) +BuildRequires: pkgconfig(libavcodec) +BuildRequires: pkgconfig(libavutil) +BuildRequires: pkgconfig(libpulse) +BuildRequires: pkgconfig(libudev) +BuildRequires: pkgconfig(libusb-1.0) +BuildRequires: pkgconfig(libv4l2) +BuildRequires: pkgconfig(portaudio-2.0) +BuildRequires: pkgconfig(sdl2) +%if %{with qt5} +BuildRequires: pkgconfig(Qt5Widgets) +BuildRequires: pkgconfig(libgviewaudio) +BuildRequires: pkgconfig(libgviewencoder) +BuildRequires: pkgconfig(libgviewrender) +BuildRequires: pkgconfig(libgviewv4l2core) +%endif +Recommends: %{name}-lang + +%description +A GTK interface for capturing and viewing video from devices +supported by the Linux UVC driver, although it should also work with +any v4l2 compatible device. + +%package -n libgviewaudio-%{sover0} +Summary: GTK+ UVC Viewer and Capturer +Group: System/Libraries + +%description -n libgviewaudio-%{sover0} +A GTK interface for capturing and viewing video from devices +supported by the Linux UVC driver, although it should also work with +any v4l2 compatible device. + +%package -n libgviewencoder-%{sover1} +Summary: GTK+ UVC Viewer and Capturer +Group: System/Libraries + +%description -n libgviewencoder-%{sover1} +A GTK interface for capturing and viewing video from devices +supported by the Linux UVC driver, although it should also work with +any v4l2 compatible device. + +%package -n libgviewrender-%{sover1} +Summary: GTK+ UVC Viewer and Capturer +Group: System/Libraries + +%description -n libgviewrender-%{sover1} +A GTK interface for capturing and viewing video from devices +supported by the Linux UVC driver, although it should also work with +any v4l2 compatible device. + +%package -n libgviewv4l2core-%{sover1} +Summary: GTK+ UVC Viewer and Capturer +Group: System/Libraries +Recommends: libgviewv4l2core-lang + +%description -n libgviewv4l2core-%{sover1} +A GTK interface for capturing and viewing video from devices +supported by the Linux UVC driver, although it should also work with +any v4l2 compatible device. + +%package devel +Summary: Development files for guvcview +Group: Development/Libraries/C and C++ +Requires: alsa-devel +Requires: glibc-devel +Requires: gsl-devel +Requires: libSDL2-devel +Requires: libgviewaudio-%{sover0} = %{version}-%{release} +Requires: libgviewencoder-%{sover1} = %{version}-%{release} +Requires: libgviewrender-%{sover1} = %{version}-%{release} +Requires: libgviewv4l2core-%{sover1} = %{version}-%{release} +Requires: libpng-devel +Requires: libpulse-devel +Requires: libudev-devel +Requires: libusb-1_0-devel +Requires: libv4l-devel +Requires: portaudio-devel +Requires: pkgconfig(libavcodec) +Requires: pkgconfig(libavutil) + +%description devel +A GTK interface for capturing and viewing video from devices +supported by the Linux UVC driver, although it should also work with +any v4l2 compatible device. + +This subpackage contains the header files for developing +applications that want to make use of the GUVC libraries. + +%lang_package + +%package -n libgviewv4l2core-lang +Summary: Languages for libgviewv4l2core +Group: System/Localization +Requires: libgviewv4l2core-%{sover1} = %{version} +Provides: libgviewv4l2core-lang-all = %{version} +Supplements: (bundle-lang-other and libgviewv4l2core-%{sover1}) +BuildArch: noarch + +%description -n libgviewv4l2core-lang +Provides translations to libgviewv4l2core. + +%prep +%setup -q -n %{pname}-src-%{version} +%patch -P 0 -p1 +%patch -P 2 -p1 +%if %{with qt5} +%patch -P 1 -p1 +%endif + +%build +# autoconf is too old in Leap +%if 0%{?suse_version} == 1500 +sed -i '/AC_CHECK_INCLUDES_DEFAULT/d' configure.ac +%endif + +autoreconf -fiv +%configure --disable-debian-menu \ + --disable-desktop \ +%if %{with qt5} + --disable-gtk3 \ + --enable-qt5 \ + --program-suffix=-qt5 \ +%endif +%{nil} +%make_build + +%install +%make_install +# Create desktop file as disabled during build +%suse_update_desktop_file -c %{name} "A video viewer and capturer for the linux uvc driver" %{name} %{name} %{name} AudioVideo AudioVideoEditing +%find_lang %{name} %{?no_lang_C} + +%if %{with qt5} +mv %{buildroot}%{_datadir}/pixmaps/%{pname}.png %{buildroot}%{_datadir}/pixmaps/%{name}.png +%else +%find_lang gview_v4l2core libgviewv4l2core.lang %{?no_lang_C} +%endif + +%fdupes %{buildroot} + +%if ! %{with qt5} +rm %{buildroot}%{_libdir}/*.{la,a} + +%ldconfig_scriptlets -n libgviewaudio-%{sover0} +%ldconfig_scriptlets -n libgviewencoder-%{sover1} +%ldconfig_scriptlets -n libgviewrender-%{sover1} +%ldconfig_scriptlets -n libgviewv4l2core-%{sover1} +%endif + +%files +%license COPYING +%doc AUTHORS ChangeLog README.md +%{_bindir}/%{name} +%{_datadir}/applications/%{name}.desktop +%{_datadir}/pixmaps/%{name}.png +%{_mandir}/man1/%{name}.1%{?ext_man} + +%if ! %{with qt5} +%files -n libgviewaudio-%{sover0} +%{_libdir}/libgviewaudio-*.so.* + +%files -n libgviewencoder-%{sover1} +%{_libdir}/libgviewencoder-*.so.* + +%files -n libgviewrender-%{sover1} +%{_libdir}/libgviewrender-*.so.* + +%files -n libgviewv4l2core-%{sover1} +%{_libdir}/libgviewv4l2core-*.so.* + +%files devel +%dir %{_includedir}/guvcview-2 +%dir %{_includedir}/guvcview-2/libgviewaudio +%dir %{_includedir}/guvcview-2/libgviewencoder +%dir %{_includedir}/guvcview-2/libgviewrender +%dir %{_includedir}/guvcview-2/libgviewv4l2core +%{_includedir}/guvcview-2/libgviewaudio/gviewaudio.h +%{_includedir}/guvcview-2/libgviewencoder/gviewencoder.h +%{_includedir}/guvcview-2/libgviewrender/gviewrender.h +%{_includedir}/guvcview-2/libgviewv4l2core/gview.h +%{_includedir}/guvcview-2/libgviewv4l2core/gviewv4l2core.h +%{_libdir}/libgviewaudio.so +%{_libdir}/libgviewencoder.so +%{_libdir}/libgviewrender.so +%{_libdir}/libgviewv4l2core.so +%{_libdir}/pkgconfig/libgviewaudio.pc +%{_libdir}/pkgconfig/libgviewencoder.pc +%{_libdir}/pkgconfig/libgviewrender.pc +%{_libdir}/pkgconfig/libgviewv4l2core.pc + +%files -n libgviewv4l2core-lang -f libgviewv4l2core.lang +%endif + +%files lang -f %{name}.lang + +%changelog -- 2.51.1 From df69a33be3c7def0a26255145a0450f1c2420e6664796d72ebc6f21892848621 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Sun, 16 Mar 2025 08:04:11 +0000 Subject: [PATCH 2/5] even more pkgconfig() lines OBS-URL: https://build.opensuse.org/package/show/multimedia:apps/guvcview?expand=0&rev=24 --- guvcview.spec | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/guvcview.spec b/guvcview.spec index 259e867..adc2b13 100644 --- a/guvcview.spec +++ b/guvcview.spec @@ -120,22 +120,22 @@ any v4l2 compatible device. %package devel Summary: Development files for guvcview Group: Development/Libraries/C and C++ -Requires: alsa-devel Requires: glibc-devel -Requires: gsl-devel -Requires: libSDL2-devel Requires: libgviewaudio-%{sover0} = %{version}-%{release} Requires: libgviewencoder-%{sover1} = %{version}-%{release} Requires: libgviewrender-%{sover1} = %{version}-%{release} Requires: libgviewv4l2core-%{sover1} = %{version}-%{release} Requires: libpng-devel -Requires: libpulse-devel -Requires: libudev-devel -Requires: libusb-1_0-devel -Requires: libv4l-devel -Requires: portaudio-devel +Requires: pkgconfig(alsa) +Requires: pkgconfig(gsl) Requires: pkgconfig(libavcodec) Requires: pkgconfig(libavutil) +Requires: pkgconfig(libpulse) +Requires: pkgconfig(libudev) +Requires: pkgconfig(libusb-1.0) +Requires: pkgconfig(libv4l2) +Requires: pkgconfig(portaudio-2.0) +Requires: pkgconfig(sdl2) %description devel A GTK interface for capturing and viewing video from devices -- 2.51.1 From 3b685afe0b3abce830b8c120304abf6c6013ac943cb8ace912eb49391b7e5813 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 10 Nov 2025 14:18:52 +0000 Subject: [PATCH 3/5] - Switch to cmake - Drop multibuild; use a wrapper script instead - Use %ldconfig_scriptlets - Update to version 2.2.1 * Fix encoder video timestamps * Fix encoder video codec defaults * Move from qt5 to qt6 * Change build system from autoconf to cmake * Add support for yuv420p pixel format for MJPG decoding - Drop patches (not longer needed): * 0001-Fix-build-with-GCC-14.patch * guvcview-SUSE.patch * guvcview-qt5-nolibs_qt5names.patch * 0001-Fix-build-with-GCC-14.patch - Add patches: * 0001-fix-deprecation-warning-with-ffpmeg-7.1-add-Wall-to-.patch * 0002-Fix-desktop-file-for-cmake.patch * fix-linking.patch * fix-pkgconfig-path.patch OBS-URL: https://build.opensuse.org/package/show/multimedia:apps/guvcview?expand=0&rev=26 --- .gitattributes | 23 + .gitignore | 1 + 0001-Fix-build-with-GCC-14.patch | 40 + ...warning-with-ffpmeg-7.1-add-Wall-to-.patch | 1500 +++++++++++++++++ 0002-Fix-desktop-file-for-cmake.patch | 85 + _multibuild | 3 + fix-linking.patch | 26 + fix-pkgconfig-path.patch | 52 + guvcview-SUSE.patch | 36 + guvcview-qt5-nolibs_qt5names.patch | 83 + guvcview-src-2.1.0.tar.bz2 | 3 + guvcview-src-2.2.1.tar.bz2 | 3 + guvcview.changes | 332 ++++ guvcview.spec | 209 +++ 14 files changed, 2396 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 0001-Fix-build-with-GCC-14.patch create mode 100644 0001-fix-deprecation-warning-with-ffpmeg-7.1-add-Wall-to-.patch create mode 100644 0002-Fix-desktop-file-for-cmake.patch create mode 100644 _multibuild create mode 100644 fix-linking.patch create mode 100644 fix-pkgconfig-path.patch create mode 100644 guvcview-SUSE.patch create mode 100644 guvcview-qt5-nolibs_qt5names.patch create mode 100644 guvcview-src-2.1.0.tar.bz2 create mode 100644 guvcview-src-2.2.1.tar.bz2 create mode 100644 guvcview.changes create mode 100644 guvcview.spec diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/0001-Fix-build-with-GCC-14.patch b/0001-Fix-build-with-GCC-14.patch new file mode 100644 index 0000000..3002340 --- /dev/null +++ b/0001-Fix-build-with-GCC-14.patch @@ -0,0 +1,40 @@ +From 98feb36a5f4971ca152b2d90a923008d0bd6cf5f Mon Sep 17 00:00:00 2001 +From: Christophe Marin +Date: Tue, 27 Aug 2024 10:31:02 +0200 +Subject: [PATCH] =?UTF-8?q?Fix=20build=20with=20GCC=C2=A014?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--- + gview_v4l2core/jpeg_decoder.c | 1 + + gview_v4l2core/uvc_h264.c | 1 + + 2 files changed, 2 insertions(+) + +diff --git a/gview_v4l2core/jpeg_decoder.c b/gview_v4l2core/jpeg_decoder.c +index 9d30ea2..d60fdf8 100644 +--- a/gview_v4l2core/jpeg_decoder.c ++++ b/gview_v4l2core/jpeg_decoder.c +@@ -36,6 +36,7 @@ + #include + #include + #include ++#include + + #include "gviewv4l2core.h" + #include "colorspaces.h" +diff --git a/gview_v4l2core/uvc_h264.c b/gview_v4l2core/uvc_h264.c +index ed0c6a8..a02271e 100644 +--- a/gview_v4l2core/uvc_h264.c ++++ b/gview_v4l2core/uvc_h264.c +@@ -24,6 +24,7 @@ + /* support for internationalization - i18n */ + #include + #include ++#include + #include + #include + #include +-- +2.46.0 + diff --git a/0001-fix-deprecation-warning-with-ffpmeg-7.1-add-Wall-to-.patch b/0001-fix-deprecation-warning-with-ffpmeg-7.1-add-Wall-to-.patch new file mode 100644 index 0000000..d647d34 --- /dev/null +++ b/0001-fix-deprecation-warning-with-ffpmeg-7.1-add-Wall-to-.patch @@ -0,0 +1,1500 @@ +From 150c054fe971e282515f4d13e42a061096bfdd6e Mon Sep 17 00:00:00 2001 +From: Paulo Assis +Date: Sat, 16 Nov 2024 20:04:52 +0000 +Subject: [PATCH 1/2] fix deprecation warning with ffpmeg 7.1; add -Wall to + compile flags + +--- + guvcview/CMakeLists.txt | 2 + + gview_audio/CMakeLists.txt | 2 + + gview_encoder/CMakeLists.txt | 2 + + gview_encoder/audio_codecs.c | 818 ++++++++++++++++----------------- + gview_encoder/encoder.c | 74 ++- + gview_render/CMakeLists.txt | 1 + + gview_render/render_fx.c | 53 ++- + gview_render/render_sdl2.c | 3 +- + gview_render/render_sfml.cpp | 4 +- + gview_v4l2core/CMakeLists.txt | 2 + + gview_v4l2core/colorspaces.c | 6 +- + gview_v4l2core/frame_decoder.c | 2 +- + gview_v4l2core/jpeg_decoder.c | 34 +- + gview_v4l2core/v4l2_controls.c | 2 +- + 14 files changed, 513 insertions(+), 492 deletions(-) + +diff --git a/guvcview/CMakeLists.txt b/guvcview/CMakeLists.txt +index bb501bf..e087b64 100644 +--- a/guvcview/CMakeLists.txt ++++ b/guvcview/CMakeLists.txt +@@ -18,6 +18,8 @@ add_executable(guvcview + video_capture.c + ) + ++add_definitions("-Wall") ++ + if(USE_GTK3) + pkg_check_modules(GTK3 gtk+-3.0) + if(GTK3_FOUND) +diff --git a/gview_audio/CMakeLists.txt b/gview_audio/CMakeLists.txt +index 9714745..6217ef9 100644 +--- a/gview_audio/CMakeLists.txt ++++ b/gview_audio/CMakeLists.txt +@@ -18,6 +18,8 @@ set_target_properties( + SOVERSION ${LIBSOVERSION} + ) + ++add_definitions("-Wall") ++ + pkg_check_modules(PORTAUDIO2 REQUIRED portaudio-2.0) + + target_link_libraries(gviewaudio ${PORTAUDIO2_LIBRARIES}) +diff --git a/gview_encoder/CMakeLists.txt b/gview_encoder/CMakeLists.txt +index 8942bae..dfd7c38 100644 +--- a/gview_encoder/CMakeLists.txt ++++ b/gview_encoder/CMakeLists.txt +@@ -22,6 +22,8 @@ set_target_properties( + SOVERSION ${LIBSOVERSION} + ) + ++add_definitions("-Wall") ++ + pkg_check_modules(FFMPEG REQUIRED libavcodec libavutil) + + target_link_libraries(gviewencoder ${FFMPEG_LIBRARIES}) +diff --git a/gview_encoder/audio_codecs.c b/gview_encoder/audio_codecs.c +index 5c9f764..6965df8 100644 +--- a/gview_encoder/audio_codecs.c ++++ b/gview_encoder/audio_codecs.c +@@ -1,204 +1,195 @@ +-/*******************************************************************************# +-# guvcview http://guvcview.sourceforge.net # +-# # +-# Paulo Assis # +-# # +-# This program is free software; you can redistribute it and/or modify # +-# it under the terms of the GNU General Public License as published by # +-# the Free Software Foundation; either version 2 of the License, or # +-# (at your option) any later version. # +-# # +-# This program 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 General Public License for more details. # +-# # +-# You should have received a copy of the GNU General Public License # +-# along with this program; if not, write to the Free Software # +-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +-# # +-********************************************************************************/ ++/******************************************************************************# ++# guvcview http://guvcview.sourceforge.net # ++# # ++# Paulo Assis # ++# # ++# This program is free software; you can redistribute it and/or modify # ++# it under the terms of the GNU General Public License as published by # ++# the Free Software Foundation; either version 2 of the License, or # ++# (at your option) any later version. # ++# # ++# This program 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 General Public License for more details. # ++# # ++# You should have received a copy of the GNU General Public License # ++# along with this program; if not, write to the Free Software # ++# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # ++# # ++*******************************************************************************/ + +-#include ++#include ++#include ++#include + #include ++#include ++#include + #include + #include +-#include +-#include +-#include +-#include + /* support for internationalization - i18n */ +-#include + #include ++#include + +-#include "gviewencoder.h" +-#include "gview.h" + #include "encoder.h" ++#include "gview.h" ++#include "gviewencoder.h" + + extern int enc_verbosity; + + /* AAC object types index: MAIN = 1; LOW = 2; SSR = 3; LTP = 4*/ +-static int AAC_OBJ_TYPE[5] = +- { FF_PROFILE_UNKNOWN, FF_PROFILE_AAC_MAIN, FF_PROFILE_AAC_LOW, FF_PROFILE_AAC_SSR, FF_PROFILE_AAC_LTP }; ++static int AAC_OBJ_TYPE[5] = {FF_PROFILE_UNKNOWN, FF_PROFILE_AAC_MAIN, ++ FF_PROFILE_AAC_LOW, FF_PROFILE_AAC_SSR, ++ FF_PROFILE_AAC_LTP}; + /*-1 = reserved; 0 = freq. is writen explictly (increases header by 24 bits)*/ +-static int AAC_SAMP_FREQ[16] = +- { 96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350, -1, -1, 0}; ++static int AAC_SAMP_FREQ[16] = {96000, 88200, 64000, 48000, 44100, 32000, ++ 24000, 22050, 16000, 12000, 11025, 8000, ++ 7350, -1, -1, 0}; + + /*NORMAL AAC HEADER*/ +-/*2 bytes: object type index(5 bits) + sample frequency index(4bits) + channels(4 bits) + flags(3 bit) */ ++/*2 bytes: object type index(5 bits) + sample frequency index(4bits) + ++ * channels(4 bits) + flags(3 bit) */ + /*default = MAIN(1)+44100(4)+stereo(2)+flags(0) = 0x0A10*/ +-static uint8_t AAC_ESDS[2] = {0x0A,0x10}; ++static uint8_t AAC_ESDS[2] = {0x0A, 0x10}; + /* if samprate index == 15 AAC_ESDS[5]: +- * object type index(5 bits) + sample frequency index(4bits) + samprate(24bits) + channels(4 bits) + flags(3 bit) ++ * object type index(5 bits) + sample frequency index(4bits) + samprate(24bits) ++ * + channels(4 bits) + flags(3 bit) + */ + +- +-static audio_codec_t listSupCodecs[] = //list of software supported formats +-{ +- { +- .valid = 1, +- .bits = 32, +- .monotonic_pts = 0, +- .avi_4cc = WAVE_FORMAT_IEEE_FLOAT, +- .mkv_codec = "A_PCM/FLOAT/IEEE", +- .description = N_("PCM - uncompressed (float 32 bit)"), +- .bit_rate = 0, +- .codec_id = AV_CODEC_ID_PCM_F32LE, +- .codec_name = "pcm_f32le", +- .sample_format = AV_SAMPLE_FMT_FLT, +- .profile = FF_PROFILE_UNKNOWN, +- .mkv_codpriv = NULL, +- .codpriv_size = 0, +- .flags = 0, +- .name = "pcm" +- }, +- { +- .valid = 1, +- .bits = 0, +- .monotonic_pts= 0, +- .avi_4cc = WAVE_FORMAT_MPEG12, +- .mkv_codec = "A_MPEG/L2", +- .description = N_("MP2 (MPEG audio layer 2)"), +- .bit_rate = 160000, +- .codec_id = AV_CODEC_ID_MP2, +- .codec_name = "mp2", +- .sample_format = AV_SAMPLE_FMT_S16, +- .profile = FF_PROFILE_UNKNOWN, +- .mkv_codpriv = NULL, +- .codpriv_size = 0, +- .flags = 0, +- .name = "mp2" +- }, +- { +- .valid = 1, +- .bits = 0, +- .monotonic_pts= 0, +- .avi_4cc = WAVE_FORMAT_MP3, +- .mkv_codec = "A_MPEG/L3", +- .description = N_("MP3 (MPEG audio layer 3)"), +- .bit_rate = 160000, +- .codec_id = AV_CODEC_ID_MP3, +- .codec_name = "libmp3lame", +-#if LIBAVCODEC_VER_AT_LEAST(54,31) +- .sample_format = AV_SAMPLE_FMT_FLTP, ++static audio_codec_t listSupCodecs[] = // list of software supported formats ++ {{.valid = 1, ++ .bits = 32, ++ .monotonic_pts = 0, ++ .avi_4cc = WAVE_FORMAT_IEEE_FLOAT, ++ .mkv_codec = "A_PCM/FLOAT/IEEE", ++ .description = N_("PCM - uncompressed (float 32 bit)"), ++ .bit_rate = 0, ++ .codec_id = AV_CODEC_ID_PCM_F32LE, ++ .codec_name = "pcm_f32le", ++ .sample_format = AV_SAMPLE_FMT_FLT, ++ .profile = FF_PROFILE_UNKNOWN, ++ .mkv_codpriv = NULL, ++ .codpriv_size = 0, ++ .flags = 0, ++ .name = "pcm"}, ++ {.valid = 1, ++ .bits = 0, ++ .monotonic_pts = 0, ++ .avi_4cc = WAVE_FORMAT_MPEG12, ++ .mkv_codec = "A_MPEG/L2", ++ .description = N_("MP2 (MPEG audio layer 2)"), ++ .bit_rate = 160000, ++ .codec_id = AV_CODEC_ID_MP2, ++ .codec_name = "mp2", ++ .sample_format = AV_SAMPLE_FMT_S16, ++ .profile = FF_PROFILE_UNKNOWN, ++ .mkv_codpriv = NULL, ++ .codpriv_size = 0, ++ .flags = 0, ++ .name = "mp2"}, ++ {.valid = 1, ++ .bits = 0, ++ .monotonic_pts = 0, ++ .avi_4cc = WAVE_FORMAT_MP3, ++ .mkv_codec = "A_MPEG/L3", ++ .description = N_("MP3 (MPEG audio layer 3)"), ++ .bit_rate = 160000, ++ .codec_id = AV_CODEC_ID_MP3, ++ .codec_name = "libmp3lame", ++#if LIBAVCODEC_VER_AT_LEAST(54, 31) ++ .sample_format = AV_SAMPLE_FMT_FLTP, + #else +- .sample_format = AV_SAMPLE_FMT_S16, ++ .sample_format = AV_SAMPLE_FMT_S16, + #endif +- .profile = FF_PROFILE_UNKNOWN, +- .mkv_codpriv = NULL, +- .codpriv_size = 0, +- .flags = 0, +- .name = "mp3" +- }, +- { +- .valid = 1, +- .bits = 0, +- .monotonic_pts= 0, +- .avi_4cc = WAVE_FORMAT_AC3, +- .mkv_codec = "A_AC3", +- .description = N_("AC-3 (ATSC A/52A)"), +- .bit_rate = 160000, +- .codec_id = AV_CODEC_ID_AC3, +- .codec_name = "ac3", +-#if LIBAVCODEC_VER_AT_LEAST(54,31) +- .sample_format = AV_SAMPLE_FMT_FLTP, ++ .profile = FF_PROFILE_UNKNOWN, ++ .mkv_codpriv = NULL, ++ .codpriv_size = 0, ++ .flags = 0, ++ .name = "mp3"}, ++ {.valid = 1, ++ .bits = 0, ++ .monotonic_pts = 0, ++ .avi_4cc = WAVE_FORMAT_AC3, ++ .mkv_codec = "A_AC3", ++ .description = N_("AC-3 (ATSC A/52A)"), ++ .bit_rate = 160000, ++ .codec_id = AV_CODEC_ID_AC3, ++ .codec_name = "ac3", ++#if LIBAVCODEC_VER_AT_LEAST(54, 31) ++ .sample_format = AV_SAMPLE_FMT_FLTP, + #else +- .sample_format = AV_SAMPLE_FMT_FLT, ++ .sample_format = AV_SAMPLE_FMT_FLT, + #endif +- .profile = FF_PROFILE_UNKNOWN, +- .mkv_codpriv = NULL, +- .codpriv_size = 0, +- .flags = 0, +- .name = "ac3" +- }, +- { +- .valid = 1, +- .bits = 16, +- .monotonic_pts= 0, +- .avi_4cc = WAVE_FORMAT_AAC, +- .mkv_codec = "A_AAC", +- .description = N_("AAC (Advanced Audio Coding)"), +- .bit_rate = 64000, +- .codec_id = AV_CODEC_ID_AAC, +- .codec_name = "libvo_aacenc", +-#if LIBAVCODEC_VER_AT_LEAST(54,31) +- .sample_format = AV_SAMPLE_FMT_FLTP, ++ .profile = FF_PROFILE_UNKNOWN, ++ .mkv_codpriv = NULL, ++ .codpriv_size = 0, ++ .flags = 0, ++ .name = "ac3"}, ++ {.valid = 1, ++ .bits = 16, ++ .monotonic_pts = 0, ++ .avi_4cc = WAVE_FORMAT_AAC, ++ .mkv_codec = "A_AAC", ++ .description = N_("AAC (Advanced Audio Coding)"), ++ .bit_rate = 64000, ++ .codec_id = AV_CODEC_ID_AAC, ++ .codec_name = "libvo_aacenc", ++#if LIBAVCODEC_VER_AT_LEAST(54, 31) ++ .sample_format = AV_SAMPLE_FMT_FLTP, + #else +- .sample_format = AV_SAMPLE_FMT_S16, ++ .sample_format = AV_SAMPLE_FMT_S16, + #endif +- .profile = FF_PROFILE_AAC_LOW, +- .mkv_codpriv = AAC_ESDS, +- .codpriv_size = 2, +- .flags = 0, +- .name = "aac" +- }, +- { +- .valid = 1, +- .bits = 16, +- .monotonic_pts= 0, +- .avi_4cc = OGG_FORMAT_VORBIS, +- .mkv_codec = "A_VORBIS", +- .description = N_("Vorbis"), +- .bit_rate = 64000, +- .codec_id = AV_CODEC_ID_VORBIS, +- .codec_name = "libvorbis", +-#if LIBAVCODEC_VER_AT_LEAST(54,31) +- .sample_format = AV_SAMPLE_FMT_FLTP, ++ .profile = FF_PROFILE_AAC_LOW, ++ .mkv_codpriv = AAC_ESDS, ++ .codpriv_size = 2, ++ .flags = 0, ++ .name = "aac"}, ++ {.valid = 1, ++ .bits = 16, ++ .monotonic_pts = 0, ++ .avi_4cc = OGG_FORMAT_VORBIS, ++ .mkv_codec = "A_VORBIS", ++ .description = N_("Vorbis"), ++ .bit_rate = 64000, ++ .codec_id = AV_CODEC_ID_VORBIS, ++ .codec_name = "libvorbis", ++#if LIBAVCODEC_VER_AT_LEAST(54, 31) ++ .sample_format = AV_SAMPLE_FMT_FLTP, + #else +- .sample_format = AV_SAMPLE_FMT_S16, ++ .sample_format = AV_SAMPLE_FMT_S16, + #endif +- .profile = FF_PROFILE_UNKNOWN, +- .mkv_codpriv = NULL, +- .codpriv_size = 0, +- .flags = 0, +- .name = "vorb" +- } +-}; +- +-static int get_aac_obj_ind(int profile) +-{ +- int i = 0; +- +- for (i=0; i<5; i++) +- if(AAC_OBJ_TYPE[i] == profile) break; +- +- return i; +-} ++ .profile = FF_PROFILE_UNKNOWN, ++ .mkv_codpriv = NULL, ++ .codpriv_size = 0, ++ .flags = 0, ++ .name = "vorb"}}; + +-static int get_aac_samp_ind(int samprate) +-{ +- int i = 0; ++static int get_aac_obj_ind(int profile) { ++ int i = 0; + +- for (i=0; i<13; i++) +- if(AAC_SAMP_FREQ[i] == samprate) break; ++ for (i = 0; i < 5; i++) { ++ if (AAC_OBJ_TYPE[i] == profile) ++ break; ++ } ++ ++ return i; ++} + +- if (i>12) +- { +- printf("WARNING: invalid sample rate for AAC encoding\n"); +- printf("valid(96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350)\n"); +- i=4; /*default 44100*/ +- } +- return i; ++static int get_aac_samp_ind(int samprate) { ++ int i = 0; ++ ++ for (i = 0; i < 13; i++) { ++ if (AAC_SAMP_FREQ[i] == samprate) ++ break; ++ } ++ ++ if (i > 12) { ++ printf("WARNING: invalid sample rate for AAC encoding\n"); ++ printf("valid(96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, " ++ "16000, 12000, 11025, 8000, 7350)\n"); ++ i = 4; /*default 44100*/ ++ } ++ return i; + } + + /* +@@ -211,14 +202,13 @@ static int get_aac_samp_ind(int samprate) + * + * returns: listSupCodecs size (number of elements) + */ +-int encoder_get_audio_codec_list_size() +-{ +- int size = sizeof(listSupCodecs)/sizeof(audio_codec_t); ++int encoder_get_audio_codec_list_size() { ++ int size = sizeof(listSupCodecs) / sizeof(audio_codec_t); + +- if(enc_verbosity > 3) +- printf("ENCODER: audio codec list size:%i\n", size); ++ if (enc_verbosity > 3) ++ printf("ENCODER: audio codec list size:%i\n", size); + +- return size; ++ return size; + } + + /* +@@ -231,7 +221,7 @@ int encoder_get_audio_codec_list_size() + * + * returns: listSupCodecs valid number of elements + */ +-//int encoder_get_audio_codec_valid_list_size() ++// int encoder_get_audio_codec_valid_list_size() + //{ + // int valid_size = 0; + // +@@ -244,7 +234,7 @@ int encoder_get_audio_codec_list_size() + // printf("ENCODER: audio codec valid list size:%i\n", valid_size); + // + // return valid_size; +-//} ++// } + + /* + * return the real (valid only) codec index +@@ -256,18 +246,16 @@ int encoder_get_audio_codec_list_size() + * + * returns: matching listSupCodecs index + */ +-static int get_real_index (int codec_ind) +-{ +- int i = 0; +- int ind = -1; +- for (i = 0; i < encoder_get_audio_codec_list_size(); ++i) +- { +- if(listSupCodecs[i].valid) +- ind++; +- if(ind == codec_ind) +- return i; +- } +- return (codec_ind); //should never arrive ++static int get_real_index(int codec_ind) { ++ int i = 0; ++ int ind = -1; ++ for (i = 0; i < encoder_get_audio_codec_list_size(); ++i) { ++ if (listSupCodecs[i].valid) ++ ind++; ++ if (ind == codec_ind) ++ return i; ++ } ++ return (codec_ind); // should never arrive + } + + /* +@@ -280,22 +268,19 @@ static int get_real_index (int codec_ind) + * + * returns: matching list index (with non valid removed) + */ +-static int get_list_index (int real_index) +-{ +- if( real_index < 0 || +- real_index >= encoder_get_audio_codec_list_size() || +- !listSupCodecs[real_index].valid ) +- return -1; //error: real index is not valid +- +- int i = 0; +- int ind = -1; +- for (i = 0; i<= real_index; ++i) +- { +- if(listSupCodecs[i].valid) +- ind++; +- } +- +- return (ind); ++static int get_list_index(int real_index) { ++ if (real_index < 0 || real_index >= encoder_get_audio_codec_list_size() || ++ !listSupCodecs[real_index].valid) ++ return -1; // error: real index is not valid ++ ++ int i = 0; ++ int ind = -1; ++ for (i = 0; i <= real_index; ++i) { ++ if (listSupCodecs[i].valid) ++ ind++; ++ } ++ ++ return (ind); + } + + /* +@@ -308,16 +293,14 @@ static int get_list_index (int real_index) + * + * returns: real index or -1 if none + */ +-int get_audio_codec_index(int codec_id) +-{ +- int i = 0; +- for(i = 0; i < encoder_get_audio_codec_list_size(); ++i ) +- { +- if(codec_id == listSupCodecs[i].codec_id) +- return i; +- } +- +- return -1; ++int get_audio_codec_index(int codec_id) { ++ int i = 0; ++ for (i = 0; i < encoder_get_audio_codec_list_size(); ++i) { ++ if (codec_id == listSupCodecs[i].codec_id) ++ return i; ++ } ++ ++ return -1; + } + + /* +@@ -330,9 +313,8 @@ int get_audio_codec_index(int codec_id) + * + * returns: real index or -1 if none + */ +-int get_audio_codec_list_index(int codec_id) +-{ +- return get_list_index(get_audio_codec_index(codec_id)); ++int get_audio_codec_list_index(int codec_id) { ++ return get_list_index(get_audio_codec_index(codec_id)); + } + + /* +@@ -345,17 +327,16 @@ int get_audio_codec_list_index(int codec_id) + * + * returns: list codec entry or NULL if none + */ +-audio_codec_t *encoder_get_audio_codec_defaults(int codec_ind) +-{ +- int real_index = get_real_index (codec_ind); +- +- if(real_index >= 0 && real_index < encoder_get_audio_codec_list_size()) +- return (&(listSupCodecs[real_index])); +- else +- { +- fprintf(stderr, "ENCODER: (audio codec defaults) bad codec index (%i)\n", codec_ind); +- return NULL; +- } ++audio_codec_t *encoder_get_audio_codec_defaults(int codec_ind) { ++ int real_index = get_real_index(codec_ind); ++ ++ if (real_index >= 0 && real_index < encoder_get_audio_codec_list_size()) ++ return (&(listSupCodecs[real_index])); ++ else { ++ fprintf(stderr, "ENCODER: (audio codec defaults) bad codec index (%i)\n", ++ codec_ind); ++ return NULL; ++ } + } + + /* +@@ -368,15 +349,14 @@ audio_codec_t *encoder_get_audio_codec_defaults(int codec_ind) + * + * returns: 1 true; 0 false + */ +-int encoder_check_webm_audio_codec(int codec_ind) +-{ +- int real_index = get_real_index (codec_ind); ++int encoder_check_webm_audio_codec(int codec_ind) { ++ int real_index = get_real_index(codec_ind); + +- int ret = 0; +- if(real_index >= 0 && real_index < encoder_get_audio_codec_list_size()) +- ret = (listSupCodecs[real_index].codec_id == AV_CODEC_ID_VORBIS) ? 1: 0; ++ int ret = 0; ++ if (real_index >= 0 && real_index < encoder_get_audio_codec_list_size()) ++ ret = (listSupCodecs[real_index].codec_id == AV_CODEC_ID_VORBIS) ? 1 : 0; + +- return ret; ++ return ret; + } + + /* +@@ -389,9 +369,8 @@ int encoder_check_webm_audio_codec(int codec_ind) + * + * returns: index for Vorbis codec or -1 if error + */ +-int encoder_get_webm_audio_codec_index() +-{ +- return get_audio_codec_list_index(AV_CODEC_ID_VORBIS); ++int encoder_get_webm_audio_codec_index() { ++ return get_audio_codec_list_index(AV_CODEC_ID_VORBIS); + } + + /* +@@ -404,22 +383,20 @@ int encoder_get_webm_audio_codec_index() + * + * returns: number of valid audio codecs in list + */ +-int encoder_set_valid_audio_codec_list () +-{ +- int ind = 0; +- int num_codecs = 0; +- for ( ind = 0; ind < encoder_get_audio_codec_list_size(); ++ind) +- { +- const AVCodec *codec = avcodec_find_encoder(listSupCodecs[ind].codec_id); +- if (!codec) +- { +- printf("ENCODER: no audio codec detected for %s\n", listSupCodecs[ind].description); +- listSupCodecs[ind].valid = 0; +- } +- else num_codecs++; +- } +- +- return num_codecs; ++int encoder_set_valid_audio_codec_list() { ++ int ind = 0; ++ int num_codecs = 0; ++ for (ind = 0; ind < encoder_get_audio_codec_list_size(); ++ind) { ++ const AVCodec *codec = avcodec_find_encoder(listSupCodecs[ind].codec_id); ++ if (!codec) { ++ printf("ENCODER: no audio codec detected for %s\n", ++ listSupCodecs[ind].description); ++ listSupCodecs[ind].valid = 0; ++ } else ++ num_codecs++; ++ } ++ ++ return num_codecs; + } + + /* +@@ -432,16 +409,15 @@ int encoder_set_valid_audio_codec_list () + * + * returns: list codec entry or NULL if none + */ +-const char *encoder_get_audio_codec_description(int codec_ind) +-{ +- int real_index = get_real_index (codec_ind); +- if(real_index >= 0 && real_index < encoder_get_audio_codec_list_size()) +- return (listSupCodecs[real_index].description); +- else +- { +- fprintf(stderr, "ENCODER: (audio codec description) bad codec index (%i)\n", codec_ind); +- return NULL; +- } ++const char *encoder_get_audio_codec_description(int codec_ind) { ++ int real_index = get_real_index(codec_ind); ++ if (real_index >= 0 && real_index < encoder_get_audio_codec_list_size()) ++ return (listSupCodecs[real_index].description); ++ else { ++ fprintf(stderr, "ENCODER: (audio codec description) bad codec index (%i)\n", ++ codec_ind); ++ return NULL; ++ } + } + + /* +@@ -454,16 +430,15 @@ const char *encoder_get_audio_codec_description(int codec_ind) + * + * returns: mkv codec entry or NULL if none + */ +-const char *encoder_get_audio_mkv_codec(int codec_ind) +-{ +- int real_index = get_real_index (codec_ind); +- if(real_index >= 0 && real_index < encoder_get_audio_codec_list_size()) +- return (listSupCodecs[real_index].mkv_codec); +- else +- { +- fprintf(stderr, "ENCODER: (audio mkv codec) bad codec index (%i)\n", codec_ind); +- return NULL; +- } ++const char *encoder_get_audio_mkv_codec(int codec_ind) { ++ int real_index = get_real_index(codec_ind); ++ if (real_index >= 0 && real_index < encoder_get_audio_codec_list_size()) ++ return (listSupCodecs[real_index].mkv_codec); ++ else { ++ fprintf(stderr, "ENCODER: (audio mkv codec) bad codec index (%i)\n", ++ codec_ind); ++ return NULL; ++ } + } + + /* +@@ -476,16 +451,15 @@ const char *encoder_get_audio_mkv_codec(int codec_ind) + * + * returns: bits entry from audio codec list + */ +-int encoder_get_audio_bits(int codec_ind) +-{ +- int real_index = get_real_index (codec_ind); +- if(real_index >= 0 && real_index < encoder_get_audio_codec_list_size()) +- return (listSupCodecs[real_index].bits); +- else +- { +- fprintf(stderr, "ENCODER: (get_audio_bits) bad codec index (%i)\n", codec_ind); +- return 0; +- } ++int encoder_get_audio_bits(int codec_ind) { ++ int real_index = get_real_index(codec_ind); ++ if (real_index >= 0 && real_index < encoder_get_audio_codec_list_size()) ++ return (listSupCodecs[real_index].bits); ++ else { ++ fprintf(stderr, "ENCODER: (get_audio_bits) bad codec index (%i)\n", ++ codec_ind); ++ return 0; ++ } + } + + /* +@@ -498,16 +472,15 @@ int encoder_get_audio_bits(int codec_ind) + * + * returns: bit_rate entry from audio codec list + */ +-int encoder_get_audio_bit_rate(int codec_ind) +-{ +- int real_index = get_real_index (codec_ind); +- if(real_index >= 0 && real_index < encoder_get_audio_codec_list_size()) +- return (listSupCodecs[real_index].bit_rate); +- else +- { +- fprintf(stderr, "ENCODER: (get_audio_bit_rate) bad codec index (%i)\n", codec_ind); +- return 0; +- } ++int encoder_get_audio_bit_rate(int codec_ind) { ++ int real_index = get_real_index(codec_ind); ++ if (real_index >= 0 && real_index < encoder_get_audio_codec_list_size()) ++ return (listSupCodecs[real_index].bit_rate); ++ else { ++ fprintf(stderr, "ENCODER: (get_audio_bit_rate) bad codec index (%i)\n", ++ codec_ind); ++ return 0; ++ } + } + + /* +@@ -520,16 +493,15 @@ int encoder_get_audio_bit_rate(int codec_ind) + * + * returns: pointer to mkvCodecPriv data + */ +-void *encoder_get_audio_mkvCodecPriv(int codec_ind) +-{ +- int real_index = get_real_index (codec_ind); +- if(real_index >= 0 && real_index < encoder_get_audio_codec_list_size()) +- return ((void *) listSupCodecs[real_index].mkv_codpriv); +- else +- { +- fprintf(stderr, "ENCODER: (mkvCodecPriv) bad codec index (%i)\n", codec_ind); +- return NULL; +- } ++void *encoder_get_audio_mkvCodecPriv(int codec_ind) { ++ int real_index = get_real_index(codec_ind); ++ if (real_index >= 0 && real_index < encoder_get_audio_codec_list_size()) ++ return ((void *)listSupCodecs[real_index].mkv_codpriv); ++ else { ++ fprintf(stderr, "ENCODER: (mkvCodecPriv) bad codec index (%i)\n", ++ codec_ind); ++ return NULL; ++ } + } + + /* +@@ -542,100 +514,99 @@ void *encoder_get_audio_mkvCodecPriv(int codec_ind) + * + * returns: mkvCodecPriv size + */ +-int encoder_set_audio_mkvCodecPriv(encoder_context_t *encoder_ctx) +-{ +- /*assertions*/ +- assert(encoder_ctx != NULL); +- +- /*assert audio encoder context is not null*/ +- assert( encoder_ctx->enc_audio_ctx); +- encoder_codec_data_t *audio_codec_data = (encoder_codec_data_t *) encoder_ctx->enc_audio_ctx->codec_data; +- /*assert video codec data is not null*/ +- assert(audio_codec_data); +- +- int codec_id = audio_codec_data->codec_context->codec_id; +- int real_index = get_audio_codec_index(codec_id); +- +- +- if (codec_id == AV_CODEC_ID_AAC) +- { +- int obj_type = get_aac_obj_ind(listSupCodecs[real_index].profile); +- int sampind = get_aac_samp_ind(encoder_ctx->audio_samprate); +- AAC_ESDS[0] = (uint8_t) ((obj_type & 0x1F) << 3 ) + ((sampind & 0x0F) >> 1); +- AAC_ESDS[1] = (uint8_t) ((sampind & 0x0F) << 7 ) + ((encoder_ctx->audio_channels & 0x0F) << 3); +- +- return listSupCodecs[real_index].codpriv_size; /*return size = 2 */ +- } +- else if(codec_id == AV_CODEC_ID_VORBIS) +- { +- //get the 3 first header packets +- uint8_t *header_start[3]; +- int header_len[3]; +- int first_header_size; +- +- first_header_size = 30; //theora = 42 +- if (avpriv_split_xiph_headers( +- audio_codec_data->codec_context->extradata, +- audio_codec_data->codec_context->extradata_size, +- first_header_size, header_start, header_len) < 0) +- { +- fprintf(stderr, "ENCODER: vorbis codec - Extradata corrupt.\n"); +- return -1; +- } +- +- //printf("Vorbis: header1: %i header2: %i header3:%i \n", header_len[0], header_len[1], header_len[2]); +- +- //get the allocation needed for headers size +- int header_lace_size[2]; +- header_lace_size[0]=0; +- header_lace_size[1]=0; +- int i; +- for (i = 0; i < header_len[0] / 255; i++) +- header_lace_size[0]++; +- header_lace_size[0]++; +- for (i = 0; i < header_len[1] / 255; i++) +- header_lace_size[1]++; +- header_lace_size[1]++; +- +- int priv_data_size = 1 + //number of packets -1 +- header_lace_size[0] + //first packet size +- header_lace_size[1] + //second packet size +- header_len[0] + //first packet header +- header_len[1] + //second packet header +- header_len[2]; //third packet header +- +- /*should check and clean before allocating ??*/ +- encoder_ctx->enc_audio_ctx->priv_data = calloc(priv_data_size, sizeof(uint8_t)); +- if(encoder_ctx->enc_audio_ctx->priv_data == NULL) +- { +- fprintf(stderr, "ENCODER: FATAL memory allocation failure (encoder_set_audio_mkvCodecPriv): %s\n", strerror(errno)); +- exit(-1); +- } +- //write header +- uint8_t* tmp = encoder_ctx->enc_audio_ctx->priv_data; +- *tmp++ = 0x02; //number of packets -1 +- //size of head 1 +- for (i = 0; i < header_len[0] / 0xff; i++) +- *tmp++ = 0xff; +- *tmp++ = header_len[0] % 0xff; +- //size of head 2 +- for (i = 0; i < header_len[1] / 0xff; i++) +- *tmp++ = 0xff; +- *tmp++ = header_len[1] % 0xff; +- //add headers +- for(i=0; i<3; i++) +- { +- memcpy(tmp, header_start[i] , header_len[i]); +- tmp += header_len[i]; +- } +- +- listSupCodecs[real_index].mkv_codpriv = encoder_ctx->enc_audio_ctx->priv_data; +- listSupCodecs[real_index].codpriv_size = priv_data_size; +- return listSupCodecs[real_index].codpriv_size; +- } +- +- +- return 0; ++int encoder_set_audio_mkvCodecPriv(encoder_context_t *encoder_ctx) { ++ /*assertions*/ ++ assert(encoder_ctx != NULL); ++ ++ /*assert audio encoder context is not null*/ ++ assert(encoder_ctx->enc_audio_ctx); ++ encoder_codec_data_t *audio_codec_data = ++ (encoder_codec_data_t *)encoder_ctx->enc_audio_ctx->codec_data; ++ /*assert video codec data is not null*/ ++ assert(audio_codec_data); ++ ++ int codec_id = audio_codec_data->codec_context->codec_id; ++ int real_index = get_audio_codec_index(codec_id); ++ ++ if (codec_id == AV_CODEC_ID_AAC) { ++ int obj_type = get_aac_obj_ind(listSupCodecs[real_index].profile); ++ int sampind = get_aac_samp_ind(encoder_ctx->audio_samprate); ++ AAC_ESDS[0] = (uint8_t)((obj_type & 0x1F) << 3) + ((sampind & 0x0F) >> 1); ++ AAC_ESDS[1] = (uint8_t)((sampind & 0x0F) << 7) + ++ ((encoder_ctx->audio_channels & 0x0F) << 3); ++ ++ return listSupCodecs[real_index].codpriv_size; /*return size = 2 */ ++ } else if (codec_id == AV_CODEC_ID_VORBIS) { ++ // get the 3 first header packets ++ uint8_t *header_start[3]; ++ int header_len[3]; ++ int first_header_size; ++ ++ first_header_size = 30; // theora = 42 ++ if (avpriv_split_xiph_headers( ++ audio_codec_data->codec_context->extradata, ++ audio_codec_data->codec_context->extradata_size, first_header_size, ++ header_start, header_len) < 0) { ++ fprintf(stderr, "ENCODER: vorbis codec - Extradata corrupt.\n"); ++ return -1; ++ } ++ ++ // printf("Vorbis: header1: %i header2: %i header3:%i \n", header_len[0], ++ // header_len[1], header_len[2]); ++ ++ // get the allocation needed for headers size ++ int header_lace_size[2]; ++ header_lace_size[0] = 0; ++ header_lace_size[1] = 0; ++ int i; ++ for (i = 0; i < header_len[0] / 255; i++) ++ header_lace_size[0]++; ++ header_lace_size[0]++; ++ for (i = 0; i < header_len[1] / 255; i++) ++ header_lace_size[1]++; ++ header_lace_size[1]++; ++ ++ int priv_data_size = 1 + // number of packets -1 ++ header_lace_size[0] + // first packet size ++ header_lace_size[1] + // second packet size ++ header_len[0] + // first packet header ++ header_len[1] + // second packet header ++ header_len[2]; // third packet header ++ ++ /*should check and clean before allocating ??*/ ++ encoder_ctx->enc_audio_ctx->priv_data = ++ calloc(priv_data_size, sizeof(uint8_t)); ++ if (encoder_ctx->enc_audio_ctx->priv_data == NULL) { ++ fprintf(stderr, ++ "ENCODER: FATAL memory allocation failure " ++ "(encoder_set_audio_mkvCodecPriv): %s\n", ++ strerror(errno)); ++ exit(-1); ++ } ++ // write header ++ uint8_t *tmp = encoder_ctx->enc_audio_ctx->priv_data; ++ *tmp++ = 0x02; // number of packets -1 ++ // size of head 1 ++ for (i = 0; i < header_len[0] / 0xff; i++) ++ *tmp++ = 0xff; ++ *tmp++ = header_len[0] % 0xff; ++ // size of head 2 ++ for (i = 0; i < header_len[1] / 0xff; i++) ++ *tmp++ = 0xff; ++ *tmp++ = header_len[1] % 0xff; ++ // add headers ++ for (i = 0; i < 3; i++) { ++ memcpy(tmp, header_start[i], header_len[i]); ++ tmp += header_len[i]; ++ } ++ ++ listSupCodecs[real_index].mkv_codpriv = ++ encoder_ctx->enc_audio_ctx->priv_data; ++ listSupCodecs[real_index].codpriv_size = priv_data_size; ++ return listSupCodecs[real_index].codpriv_size; ++ } ++ ++ return 0; + } + + /* +@@ -648,16 +619,16 @@ int encoder_set_audio_mkvCodecPriv(encoder_context_t *encoder_ctx) + * + * returns: codec name entry + */ +-const char *encoder_get_audio_codec_name(int codec_ind) +-{ +- int real_index = get_real_index (codec_ind); +- if(real_index >= 0 && real_index < encoder_get_audio_codec_list_size()) +- return (listSupCodecs[real_index].name); +- else +- { +- fprintf(stderr, "ENCODER: (audio codec name) bad codec index (%i)\n", codec_ind);; +- return NULL; +- } ++const char *encoder_get_audio_codec_name(int codec_ind) { ++ int real_index = get_real_index(codec_ind); ++ if (real_index >= 0 && real_index < encoder_get_audio_codec_list_size()) ++ return (listSupCodecs[real_index].name); ++ else { ++ fprintf(stderr, "ENCODER: (audio codec name) bad codec index (%i)\n", ++ codec_ind); ++ ; ++ return NULL; ++ } + } + + /* +@@ -670,17 +641,16 @@ const char *encoder_get_audio_codec_name(int codec_ind) + * + * returns: codec index or -1 if error + */ +-int encoder_get_audio_codec_ind_name(const char *codec_name) +-{ +- int real_index = 0; +- int index = -1; +- for(real_index = 0; real_index < encoder_get_audio_codec_list_size(); ++real_index) +- { +- if(listSupCodecs[real_index].valid) +- index++; +- if(strcasecmp(codec_name, listSupCodecs[real_index].name) == 0) +- return index; +- } +- +- return -1; ++int encoder_get_audio_codec_ind_name(const char *codec_name) { ++ int real_index = 0; ++ int index = -1; ++ for (real_index = 0; real_index < encoder_get_audio_codec_list_size(); ++ ++real_index) { ++ if (listSupCodecs[real_index].valid) ++ index++; ++ if (strcasecmp(codec_name, listSupCodecs[real_index].name) == 0) ++ return index; ++ } ++ ++ return -1; + } +diff --git a/gview_encoder/encoder.c b/gview_encoder/encoder.c +index 83d63a1..9d29669 100644 +--- a/gview_encoder/encoder.c ++++ b/gview_encoder/encoder.c +@@ -212,6 +212,7 @@ void __attribute__((destructor)) gviewencoder_fini() { + /* + * check that a given sample format is supported by the encoder + * args: ++ * enc_ctx - pointer to AVCodecContext + * codec - pointer to AVCodec + * sample_fmt - audio sample format + * +@@ -220,9 +221,21 @@ void __attribute__((destructor)) gviewencoder_fini() { + * + * returns: 1 - sample format is supported; 0 - is not supported + */ +-static int encoder_check_audio_sample_fmt(const AVCodec *codec, ++static int encoder_check_audio_sample_fmt(const AVCodecContext *enc_ctx, ++ const AVCodec *codec, + enum AVSampleFormat sample_fmt) { +- const enum AVSampleFormat *p = codec->sample_fmts; ++const enum AVSampleFormat *sample_fmts; ++ ++#if LIBAVCODEC_VER_AT_LEAST(61, 19) ++ ++avcodec_get_supported_config(enc_ctx, codec, ++ AV_CODEC_CONFIG_SAMPLE_FORMAT, 0, ++ (const void **) &(sample_fmts), NULL); ++#else ++ sample_fmts = codec->sample_fmts; ++#endif ++ ++ const enum AVSampleFormat *p = sample_fmts; + + while (*p != AV_SAMPLE_FMT_NONE) { + if (*p == sample_fmt) +@@ -235,6 +248,7 @@ static int encoder_check_audio_sample_fmt(const AVCodec *codec, + /* + * check that a given sample rate is supported by the encoder + * args: ++ * enc_ctx - pointer to AVCodecContext + * codec - pointer to AVCodec + * sample_rate - audio sample rate + * +@@ -243,15 +257,28 @@ static int encoder_check_audio_sample_fmt(const AVCodec *codec, + * + * returns: sample_rate if supported or max supported sample rate if not + */ +-static int select_sample_rate(const AVCodec *codec, int sample_rate) { ++static int select_sample_rate(const AVCodecContext *enc_ctx, ++ const AVCodec *codec, ++ int sample_rate) { + const int *p; + int best_samplerate = 0; ++ const int *supported_samplerates; ++ ++#if LIBAVCODEC_VER_AT_LEAST(61, 19) + +- if (!codec->supported_samplerates) ++ avcodec_get_supported_config(enc_ctx, codec, ++ AV_CODEC_CONFIG_SAMPLE_RATE, 0, ++ (const void **) &supported_samplerates, NULL); ++#else ++ supported_samplerates = codec->supported_samplerates; ++#endif ++ ++ p = supported_samplerates; ++ ++ if (!supported_samplerates) + return sample_rate; + +- p = codec->supported_samplerates; +- while (*p) { ++ while (*p != 0) { + if (*p == sample_rate) + return sample_rate; + +@@ -260,6 +287,7 @@ static int select_sample_rate(const AVCodec *codec, int sample_rate) { + } + return best_samplerate; + } ++ + /* + * video encoder initialization for raw input + * (don't set a codec but set the proper codec 4cc) +@@ -834,7 +862,9 @@ encoder_audio_init(encoder_context_t *encoder_ctx) { + audio_codec_data->codec_context->codec_type = AVMEDIA_TYPE_AUDIO; + + int best_samprate = +- select_sample_rate(audio_codec_data->codec, encoder_ctx->audio_samprate); ++ select_sample_rate(audio_codec_data->codec_context, ++ audio_codec_data->codec, ++ encoder_ctx->audio_samprate); + + if (best_samprate != encoder_ctx->audio_samprate) { + fprintf( +@@ -848,20 +878,24 @@ encoder_audio_init(encoder_context_t *encoder_ctx) { + (AVRational){1, encoder_ctx->audio_samprate}; + + /*check if codec supports sample format*/ +- if (!encoder_check_audio_sample_fmt(audio_codec_data->codec, ++ if (!encoder_check_audio_sample_fmt(audio_codec_data->codec_context, ++ audio_codec_data->codec, + audio_defaults->sample_format)) { + /*replace by a supported format*/ + switch (audio_defaults->sample_format) { + case AV_SAMPLE_FMT_S16: +- if (encoder_check_audio_sample_fmt(audio_codec_data->codec, ++ if (encoder_check_audio_sample_fmt(audio_codec_data->codec_context, ++ audio_codec_data->codec, + AV_SAMPLE_FMT_S16P)) { + fprintf(stderr, "ENCODER: changing sample format (S16 -> S16P)\n"); + audio_defaults->sample_format = AV_SAMPLE_FMT_S16P; +- } else if (encoder_check_audio_sample_fmt(audio_codec_data->codec, ++ } else if (encoder_check_audio_sample_fmt(audio_codec_data->codec_context, ++ audio_codec_data->codec, + AV_SAMPLE_FMT_FLT)) { + fprintf(stderr, "ENCODER: changing sample format (S16 -> FLT)\n"); + audio_defaults->sample_format = AV_SAMPLE_FMT_FLT; +- } else if (encoder_check_audio_sample_fmt(audio_codec_data->codec, ++ } else if (encoder_check_audio_sample_fmt(audio_codec_data->codec_context, ++ audio_codec_data->codec, + AV_SAMPLE_FMT_FLTP)) { + fprintf(stderr, "ENCODER: changing sample format (S16 -> FLTP)\n"); + audio_defaults->sample_format = AV_SAMPLE_FMT_FLTP; +@@ -877,15 +911,18 @@ encoder_audio_init(encoder_context_t *encoder_ctx) { + break; + + case AV_SAMPLE_FMT_FLT: +- if (encoder_check_audio_sample_fmt(audio_codec_data->codec, ++ if (encoder_check_audio_sample_fmt(audio_codec_data->codec_context, ++ audio_codec_data->codec, + AV_SAMPLE_FMT_S16)) { + fprintf(stderr, "ENCODER: changing sample format (FLT -> S16)\n"); + audio_defaults->sample_format = AV_SAMPLE_FMT_S16; +- } else if (encoder_check_audio_sample_fmt(audio_codec_data->codec, ++ } else if (encoder_check_audio_sample_fmt(audio_codec_data->codec_context, ++ audio_codec_data->codec, + AV_SAMPLE_FMT_S16P)) { + fprintf(stderr, "ENCODER: changing sample format (FLT -> S16P)\n"); + audio_defaults->sample_format = AV_SAMPLE_FMT_S16P; +- } else if (encoder_check_audio_sample_fmt(audio_codec_data->codec, ++ } else if (encoder_check_audio_sample_fmt(audio_codec_data->codec_context, ++ audio_codec_data->codec, + AV_SAMPLE_FMT_FLTP)) { + fprintf(stderr, "ENCODER: changing sample format (FLT -> FLTP)\n"); + audio_defaults->sample_format = AV_SAMPLE_FMT_FLTP; +@@ -901,15 +938,18 @@ encoder_audio_init(encoder_context_t *encoder_ctx) { + break; + + case AV_SAMPLE_FMT_FLTP: +- if (encoder_check_audio_sample_fmt(audio_codec_data->codec, ++ if (encoder_check_audio_sample_fmt(audio_codec_data->codec_context, ++ audio_codec_data->codec, + AV_SAMPLE_FMT_S16)) { + fprintf(stderr, "ENCODER: changing sample format (FLTP -> S16)\n"); + audio_defaults->sample_format = AV_SAMPLE_FMT_S16; +- } else if (encoder_check_audio_sample_fmt(audio_codec_data->codec, ++ } else if (encoder_check_audio_sample_fmt(audio_codec_data->codec_context, ++ audio_codec_data->codec, + AV_SAMPLE_FMT_S16P)) { + fprintf(stderr, "ENCODER: changing sample format (FLTP -> S16P)\n"); + audio_defaults->sample_format = AV_SAMPLE_FMT_S16P; +- } else if (encoder_check_audio_sample_fmt(audio_codec_data->codec, ++ } else if (encoder_check_audio_sample_fmt(audio_codec_data->codec_context, ++ audio_codec_data->codec, + AV_SAMPLE_FMT_FLT)) { + fprintf(stderr, "ENCODER: changing sample format (FLTP -> FLT)\n"); + audio_defaults->sample_format = AV_SAMPLE_FMT_FLT; +diff --git a/gview_render/CMakeLists.txt b/gview_render/CMakeLists.txt +index e63ba39..4c9e2f3 100644 +--- a/gview_render/CMakeLists.txt ++++ b/gview_render/CMakeLists.txt +@@ -17,6 +17,7 @@ set_target_properties( + SOVERSION ${LIBSOVERSION} + ) + ++add_definitions("-Wall") + + if(SDL2_FOUND) + target_sources(gviewrender PRIVATE render_sdl2.c) +diff --git a/gview_render/render_fx.c b/gview_render/render_fx.c +index d65a4b2..ff2c9d5 100644 +--- a/gview_render/render_fx.c ++++ b/gview_render/render_fx.c +@@ -1,18 +1,23 @@ +-/*******************************************************************************# +-# guvcview http://guvcview.sourceforge.net # # # # Paulo +-Assis # # # # This +-program is free software; you can redistribute it and/or modify # # it +-under the terms of the GNU General Public License as published by # # +-the Free Software Foundation; either version 2 of the License, or # +-# (at your option) any later version. # # # # This program 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 General Public License for +-more details. # # # # You should have received +-a copy of the GNU General Public License # # along with this +-program; if not, write to the Free Software # # Foundation, +-Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # # +-********************************************************************************/ ++/******************************************************************************# ++# guvcview http://guvcview.sourceforge.net # ++# # ++# Paulo Assis # ++# # ++# This program is free software; you can redistribute it and/or modify # ++# it under the terms of the GNU General Public License as published by # ++# the Free Software Foundation; either version 2 of the License, or # ++# (at your option) any later version. # ++# # ++# This program 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 General Public License for more details. # ++# # ++# You should have received a copy of the GNU General Public License # ++# along with this program; if not, write to the Free Software # ++# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # ++# # ++*******************************************************************************/ + + #include + #include +@@ -90,8 +95,8 @@ static void fx_yu12_mirror(uint8_t *frame, int width, int height) { + + int h = 0; + int w = 0; +- int y_sizeline = width; +- int c_sizeline = width / 2; ++ //int y_sizeline = width; ++ //int c_sizeline = width / 2; + + uint8_t *end = NULL; + uint8_t *end2 = NULL; +@@ -157,8 +162,8 @@ static void fx_yu12_half_mirror(uint8_t *frame, int width, int height) { + uint8_t *pu = frame + (width * height); + uint8_t *pv = pu + ((width * height) / 4); + +- uint8_t pixel = 0; +- uint8_t pixel2 = 0; ++ //uint8_t pixel = 0; ++ //uint8_t pixel2 = 0; + + /*mirror y*/ + for (h = 0; h < height; h++) { +@@ -384,11 +389,11 @@ static void fx_yu12_binary(uint8_t *frame, int width, int height) { + */ + static void fx_yu12_pieces(uint8_t *frame, int width, int height, + int piece_size) { +- int numx = width / piece_size; // number of pieces in x axis +- int numy = height / piece_size; // number of pieces in y axis ++ //int numx = width / piece_size; // number of pieces in x axis ++ //int numy = height / piece_size; // number of pieces in y axis + + uint8_t piece[(piece_size * piece_size * 3) / 2]; +- uint8_t *ppiece = piece; ++ //uint8_t *ppiece = piece; + + int i = 0, j = 0, w = 0, h = 0; + +@@ -400,8 +405,8 @@ static void fx_yu12_pieces(uint8_t *frame, int width, int height, + int rot = 0; + + uint8_t *py = NULL; +- uint8_t *pu = NULL; +- uint8_t *pv = NULL; ++ //uint8_t *pu = NULL; ++ //uint8_t *pv = NULL; + + for (h = 0; h < height; h += piece_size) { + for (w = 0; w < width; w += piece_size) { +diff --git a/gview_render/render_sdl2.c b/gview_render/render_sdl2.c +index a2d336e..e671777 100644 +--- a/gview_render/render_sdl2.c ++++ b/gview_render/render_sdl2.c +@@ -81,7 +81,8 @@ static int video_init(int width, int height, int flags, int win_w, int win_h) { + + + SDL_SetHint("SDL_HINT_RENDER_SCALE_QUALITY", "1"); +- ++ //SDL_SetHint("SDL_HINT_VIDEO_WAYLAND_ALLOW_LIBDECOR", "0"); ++ + sdl_window = SDL_CreateWindow("Guvcview Video", // window title + SDL_WINDOWPOS_UNDEFINED, // initial x position + SDL_WINDOWPOS_UNDEFINED, // initial y position +diff --git a/gview_render/render_sfml.cpp b/gview_render/render_sfml.cpp +index 11e8fd5..ac47d32 100644 +--- a/gview_render/render_sfml.cpp ++++ b/gview_render/render_sfml.cpp +@@ -149,8 +149,8 @@ static sf::View getLetterboxView(sf::View view, int windowWidth, int windowHeigh + } + + SFMLRender::SFMLRender(int width, int height, int flags, int win_w, int win_h) { +- int w = width; +- int h = height; ++ unsigned int w = width; ++ unsigned int h = height; + + if (win_w > 0) + w = win_w; +diff --git a/gview_v4l2core/CMakeLists.txt b/gview_v4l2core/CMakeLists.txt +index 1ca4aa1..5ec3198 100644 +--- a/gview_v4l2core/CMakeLists.txt ++++ b/gview_v4l2core/CMakeLists.txt +@@ -28,6 +28,8 @@ set_target_properties( + SOVERSION ${LIBSOVERSION} + ) + ++add_definitions("-Wall") ++ + pkg_check_modules(V4L2 REQUIRED + libv4l2 libudev libusb-1.0 libavcodec>=57.16 libavutil libpng) + +diff --git a/gview_v4l2core/colorspaces.c b/gview_v4l2core/colorspaces.c +index 6a6951a..f849608 100644 +--- a/gview_v4l2core/colorspaces.c ++++ b/gview_v4l2core/colorspaces.c +@@ -520,7 +520,7 @@ void vyuy_to_yu12(uint8_t *out, uint8_t *in, int width, int height) { + + int w = 0, h = 0; + int y_sizeline = width; +- int c_sizeline = width / 2; ++ //int c_sizeline = width / 2; + + uint8_t *in1 = in; // first line + uint8_t *in2 = in1 + (width * 2); // second line in yuyv buffer +@@ -570,7 +570,7 @@ void yuv422p_to_yu12(uint8_t *out, uint8_t *in, int width, int height) { + memcpy(out, in, width * height); + + int w = 0, h = 0; +- int c_sizeline = width / 2; ++ //int c_sizeline = width / 2; + + uint8_t *pu = out + (width * height); + uint8_t *inu1 = in + (width * height); +@@ -613,7 +613,7 @@ void yyuv_to_yu12(uint8_t *out, uint8_t *in, int width, int height) { + + int w = 0, h = 0; + int y_sizeline = width; +- int c_sizeline = width / 2; ++ //int c_sizeline = width / 2; + + uint8_t *in1 = in; // first line + uint8_t *in2 = in1 + (width * 2); // second line in yyuv buffer +diff --git a/gview_v4l2core/frame_decoder.c b/gview_v4l2core/frame_decoder.c +index b2ec055..feb3acb 100644 +--- a/gview_v4l2core/frame_decoder.c ++++ b/gview_v4l2core/frame_decoder.c +@@ -733,7 +733,7 @@ int decode_v4l2_frame(v4l2_dev_t *vd, v4l2_frame_buff_t *frame) { + */ + int format = vd->requested_fmt; + +- int framesizeIn = (width * height << 1); // 2 bytes per pixel ++ //int framesizeIn = (width * height << 1); // 2 bytes per pixel + switch (format) { + case V4L2_PIX_FMT_H264: + /* +diff --git a/gview_v4l2core/jpeg_decoder.c b/gview_v4l2core/jpeg_decoder.c +index eccfadf..15a0105 100644 +--- a/gview_v4l2core/jpeg_decoder.c ++++ b/gview_v4l2core/jpeg_decoder.c +@@ -21,12 +21,6 @@ + # # + *******************************************************************************/ + +-/******************************************************************************# +-# # +-# M/Jpeg decoding and frame capture taken from luvcview # +-# # +-*******************************************************************************/ +- + #include + #include + #include +@@ -1315,7 +1309,7 @@ int jpeg_init_decoder(int width, int height) { + #endif + { + fprintf(stderr, "V4L2_CORE: (mjpeg decoder) couldn't open codec\n"); +- ++ + #if LIBAVCODEC_VER_AT_LEAST(61, 3) + avcodec_free_context(&codec_data->context); + #else +@@ -1421,32 +1415,34 @@ int jpeg_decode(uint8_t *out_buf, uint8_t *in_buf, int size) { + codec_data->context->pix_fmt, jpeg_ctx->width, + jpeg_ctx->height, jpeg_ctx->tmp_frame, jpeg_ctx->pic_size); + #endif +- /* requested libavcodec output format is yuv422p ++ /* requested libavcodec output format is yuv422p + * but apparently for some cameras +- * (https://sourceforge.net/u/shicetu/uos-guvcview/ci/fbdc4b23f0072c5285383d09d2724dbf962d8a7f/) ++ * (https://sourceforge.net/u/shicetu/uos-guvcview/ci/fbdc4b23f0072c5285383d09d2724dbf962d8a7f/) + * it can turn out be in yuv420p */ +- if (codec_data->context->pix_fmt == AV_PIX_FMT_YUV422P || ++ if (codec_data->context->pix_fmt == AV_PIX_FMT_YUV422P || + codec_data->context->pix_fmt == AV_PIX_FMT_YUVJ422P) { +- +- yuv422p_to_yu12(out_buf, jpeg_ctx->tmp_frame, jpeg_ctx->width, jpeg_ctx->height); ++ ++ yuv422p_to_yu12(out_buf, jpeg_ctx->tmp_frame, jpeg_ctx->width, ++ jpeg_ctx->height); + return jpeg_ctx->pic_size; + +- } else if (codec_data->context->pix_fmt == AV_PIX_FMT_YUVJ420P || ++ } else if (codec_data->context->pix_fmt == AV_PIX_FMT_YUVJ420P || + codec_data->context->pix_fmt == AV_PIX_FMT_YUV420P) { + +- if (jpeg_ctx->pic_size > (size_t)(jpeg_ctx->width * jpeg_ctx->height * 3 / 2)) +- jpeg_ctx->pic_size = (size_t)(jpeg_ctx->width * jpeg_ctx->height * 3 / 2); ++ if (jpeg_ctx->pic_size > ++ (size_t)(jpeg_ctx->width * jpeg_ctx->height * 3 / 2)) ++ jpeg_ctx->pic_size = ++ (size_t)(jpeg_ctx->width * jpeg_ctx->height * 3 / 2); + + memcpy(out_buf, jpeg_ctx->tmp_frame, jpeg_ctx->pic_size); + return jpeg_ctx->pic_size; +- ++ + } else { +- fprintf(stderr, "JPEG_DECODER: output pixel format not supported: %li\n", ++ fprintf(stderr, "JPEG_DECODER: output pixel format not supported: %i\n", + codec_data->context->pix_fmt); + } ++ } + +- } +- + return 0; + } + +diff --git a/gview_v4l2core/v4l2_controls.c b/gview_v4l2core/v4l2_controls.c +index ffae7cd..beca130 100644 +--- a/gview_v4l2core/v4l2_controls.c ++++ b/gview_v4l2core/v4l2_controls.c +@@ -1208,7 +1208,7 @@ void set_control_defaults(v4l2_dev_t *vd) { + } + + v4l2_ctrl_t *current = vd->list_device_controls; +- v4l2_ctrl_t *next = current->next; ++ //v4l2_ctrl_t *next = current->next; + + if (verbosity > 0) + printf("V4L2_CORE: loading defaults\n"); +-- +2.51.1 + diff --git a/0002-Fix-desktop-file-for-cmake.patch b/0002-Fix-desktop-file-for-cmake.patch new file mode 100644 index 0000000..1f8a1d9 --- /dev/null +++ b/0002-Fix-desktop-file-for-cmake.patch @@ -0,0 +1,85 @@ +From 39f76eda4d66ef7b2303ce795e701e43fafadff2 Mon Sep 17 00:00:00 2001 +From: Paulo Assis +Date: Mon, 2 Dec 2024 14:19:01 +0000 +Subject: [PATCH 2/2] Fix desktop file for cmake + +--- + data/guvcview.desktop.in | 64 +++++++++++++++++++++++++++++++++++++--- + 1 file changed, 60 insertions(+), 4 deletions(-) + +diff --git a/data/guvcview.desktop.in b/data/guvcview.desktop.in +index c086c21..ca02856 100644 +--- a/data/guvcview.desktop.in ++++ b/data/guvcview.desktop.in +@@ -1,8 +1,64 @@ + [Desktop Entry] +-_Name=guvcview +-_GenericName=GTK UVC video viewer +-_X-GNOME-FullName=GTK UVC video viewer +-_Comment=A video viewer and capturer for the linux uvc driver ++Name=guvcview ++Name[cs]=guvcview ++Name[de]=GUVCView ++Name[en_AU]=guvcview ++Name[es]=guvcview ++Name[fr]=guvcview ++Name[it]=guvcview ++Name[lv]=guvcview ++Name[nl]=guvcview ++Name[pt]=guvcview ++Name[pt_BR]=guvcview ++Name[ru]=guvcview ++Name[si]=guvcview ++Name[sr]=Камерица ++Name[tr]=guvcview ++GenericName=GTK UVC video viewer ++GenericName[cs]=Prohlížeč videa GTK UVC ++GenericName[de]=UVC-Video-Betrachter in GTK ++GenericName[en_AU]=GTK UVC video viewer ++GenericName[es]=Visualizador GTK de vídeo UVC ++GenericName[fr]=Logiciel GTK de visualisation de vidéo UVC ++GenericName[it]=GTK UVC visualizzatore video ++GenericName[lv]=GTK UVC video skatītājs ++GenericName[nl]=GTK UVC videokijker ++GenericName[pt]=Visualizador de vídeo GTK UVC ++GenericName[pt_BR]=Visualizador de vídeo GTK UVC ++GenericName[ru]=GTK UVC видео обозреватель ++GenericName[si]=GTK UVC වීඩියෝ දකින්නා ++GenericName[sr]=ГТК УВЦ видео приказивач ++GenericName[tr]=GTK UVC video görüntüleyici ++X-GNOME-FullName=GTK UVC video viewer ++X-GNOME-FullName[cs]=Prohlížeč videa GTK UVC ++X-GNOME-FullName[de]=UVC-Video-Betrachter in GTK ++X-GNOME-FullName[en_AU]=GTK UVC video viewer ++X-GNOME-FullName[es]=Visualizador GTK de vídeo UVC ++X-GNOME-FullName[fr]=Logiciel GTK de visualisation de vidéo UVC ++X-GNOME-FullName[it]=GTK UVC visualizzatore video ++X-GNOME-FullName[lv]=GTK UVC video skatītājs ++X-GNOME-FullName[nl]=GTK UVC videokijker ++X-GNOME-FullName[pt]=Visualizador de vídeo GTK UVC ++X-GNOME-FullName[pt_BR]=Visualizador de vídeo GTK UVC ++X-GNOME-FullName[ru]=GTK UVC видео обозреватель ++X-GNOME-FullName[si]=GTK UVC වීඩියෝ දකින්නා ++X-GNOME-FullName[sr]=ГТК УВЦ видео приказивач ++X-GNOME-FullName[tr]=GTK UVC video görüntüleyici ++Comment=A video viewer and capturer for the linux uvc driver ++Comment[cs]=Prohlížení a zachytávání videa z linuxových uvc ovladačů ++Comment[de]=Ein Video-Betrachter und Aufnahmewerkzeug für den Linux-UVC-Treiber ++Comment[en_AU]=A video viewer and capturer for the linux uvc driver ++Comment[es]=Un visualizador y capturador de vídeo para el controlador UVC de Linux ++Comment[fr]=Logiciel de visualisation et de capture vidéo pour le pilote uvc Linux ++Comment[it]=Un visualizzatore e catturatore video per il driver uvc di linux ++Comment[lv]=Video skatītājs un uzņēmējs Linux UVC draiverim ++Comment[nl]=Een programma voor het bekijken en opnemen van video, voor het Linuxstuurprogramma uvc ++Comment[pt]=Um visualizador e capturador de de vídeo para o controlador linux uvc ++Comment[pt_BR]=Um visualizador e capturador de de vídeo para o controlador linux uvc ++Comment[ru]=Программа просмотра и записи видео для драйвера Linux UVC ++Comment[si]=ලිනක්ස් uvc ඩ්‍රයිවරය සඳහා වීඩියෝ පෙන්වන්නා සහ ග්‍රහණය කරන්නා ++Comment[sr]=Приказивач и снимач видеа за линуксов увц управљачки програм ++Comment[tr]=Linux uvc sürücüsü için video görüntüleyici ve yakalayıcı + TryExec=guvcview + Exec=guvcview + Icon=@DATADIR@/pixmaps/guvcview.png +-- +2.51.1 + diff --git a/_multibuild b/_multibuild new file mode 100644 index 0000000..de9a3e0 --- /dev/null +++ b/_multibuild @@ -0,0 +1,3 @@ + + qt5 + diff --git a/fix-linking.patch b/fix-linking.patch new file mode 100644 index 0000000..d7a2617 --- /dev/null +++ b/fix-linking.patch @@ -0,0 +1,26 @@ +diff --git a/gview_encoder/CMakeLists.txt b/gview_encoder/CMakeLists.txt +index 8942bae..a39fdaf 100644 +--- a/gview_encoder/CMakeLists.txt ++++ b/gview_encoder/CMakeLists.txt +@@ -24,7 +24,7 @@ set_target_properties( + + pkg_check_modules(FFMPEG REQUIRED libavcodec libavutil) + +-target_link_libraries(gviewencoder ${FFMPEG_LIBRARIES}) ++target_link_libraries(gviewencoder ${FFMPEG_LIBRARIES} m) + add_definitions(${FFMPEG_CFLAGS} ${FFMPEG_CFLAGS_OTHER}) + + include_directories(${CMAKE_SOURCE_DIR}/includes) +diff --git a/gview_v4l2core/CMakeLists.txt b/gview_v4l2core/CMakeLists.txt +index 1ca4aa1..e204238 100644 +--- a/gview_v4l2core/CMakeLists.txt ++++ b/gview_v4l2core/CMakeLists.txt +@@ -31,7 +31,7 @@ set_target_properties( + pkg_check_modules(V4L2 REQUIRED + libv4l2 libudev libusb-1.0 libavcodec>=57.16 libavutil libpng) + +-target_link_libraries(gviewv4l2core ${V4L2_LIBRARIES}) ++target_link_libraries(gviewv4l2core ${V4L2_LIBRARIES} m) + add_definitions(${V4L2_CFLAGS} ${V4L2_CFLAGS_OTHER}) + + add_compile_definitions(GETTEXT_PACKAGE_V4L2CORE="gview_v4l2core") diff --git a/fix-pkgconfig-path.patch b/fix-pkgconfig-path.patch new file mode 100644 index 0000000..549d885 --- /dev/null +++ b/fix-pkgconfig-path.patch @@ -0,0 +1,52 @@ +diff --git a/gview_audio/CMakeLists.txt b/gview_audio/CMakeLists.txt +index 9714745..3bea235 100644 +--- a/gview_audio/CMakeLists.txt ++++ b/gview_audio/CMakeLists.txt +@@ -42,7 +42,7 @@ if(INSTALL_DEVKIT) + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/gviewaudio.h TYPE INCLUDE) + install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/libgviewaudio.pc +- DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/pkgconfig ++ DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig + ) + endif() + +diff --git a/gview_encoder/CMakeLists.txt b/gview_encoder/CMakeLists.txt +index a39fdaf..dae9b1f 100644 +--- a/gview_encoder/CMakeLists.txt ++++ b/gview_encoder/CMakeLists.txt +@@ -36,7 +36,7 @@ if(INSTALL_DEVKIT) + + install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/libgviewencoder.pc +- DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/pkgconfig ++ DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig + ) + endif() + +diff --git a/gview_render/CMakeLists.txt b/gview_render/CMakeLists.txt +index e63ba39..8cc3e7d 100644 +--- a/gview_render/CMakeLists.txt ++++ b/gview_render/CMakeLists.txt +@@ -53,7 +53,7 @@ if(INSTALL_DEVKIT) + + install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/libgviewrender.pc +- DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/pkgconfig ++ DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig + ) + endif() + +diff --git a/gview_v4l2core/CMakeLists.txt b/gview_v4l2core/CMakeLists.txt +index e204238..8eed292 100644 +--- a/gview_v4l2core/CMakeLists.txt ++++ b/gview_v4l2core/CMakeLists.txt +@@ -44,7 +44,7 @@ if(INSTALL_DEVKIT) + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/gviewv4l2core.h TYPE INCLUDE) + install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/libgviewv4l2core.pc +- DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/pkgconfig ++ DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig + ) + endif() + diff --git a/guvcview-SUSE.patch b/guvcview-SUSE.patch new file mode 100644 index 0000000..b4d5445 --- /dev/null +++ b/guvcview-SUSE.patch @@ -0,0 +1,36 @@ +From: Luigi Baldoni +Date: 2017-07-28 17:04:22 +0200 +Subject: SUSE-specific paths + +Change filenames and paths to SUSE standards instead +of messing with them in the .spec file. + +Index: guvcview-src-2.0.8/Makefile.am +=================================================================== +--- guvcview-src-2.0.8.orig/Makefile.am ++++ guvcview-src-2.0.8/Makefile.am +@@ -27,14 +27,6 @@ pkgconfig_DATA = pkgconfig/libgviewv4l2c + + ACLOCAL_AMFLAGS = -I m4 + +-docdir = ${datadir}/doc/guvcview +-doc_DATA = \ +- README.md\ +- COPYING\ +- AUTHORS\ +- ChangeLog\ +- INSTALL +- + EXTRA_DIST = bootstrap.sh + + check-gettext: +Index: guvcview-src-2.0.8/data/icons/Makefile.am +=================================================================== +--- guvcview-src-2.0.8.orig/data/icons/Makefile.am ++++ guvcview-src-2.0.8/data/icons/Makefile.am +@@ -1,4 +1,4 @@ +-iconsdir = ${datadir}/pixmaps/guvcview ++iconsdir = ${datadir}/pixmaps/ + icons_DATA = \ + guvcview.png + diff --git a/guvcview-qt5-nolibs_qt5names.patch b/guvcview-qt5-nolibs_qt5names.patch new file mode 100644 index 0000000..01f62fd --- /dev/null +++ b/guvcview-qt5-nolibs_qt5names.patch @@ -0,0 +1,83 @@ +From: Luigi Baldoni +Date: 2017-07-28 17:05:35 +0200 +Subject: Modifications for the -qt5 package + +Don't build libraries and rely on those supplied by the +regular (GTK+) package. +Also change a few filenames to avoid collisions. + +Index: guvcview-src-2.0.8/Makefile.am +=================================================================== +--- guvcview-src-2.0.8.orig/Makefile.am ++++ guvcview-src-2.0.8/Makefile.am +@@ -1,13 +1,8 @@ + ## Process this file with automake to produce Makefile.in + +-SUBDIRS = gview_v4l2core \ +- gview_audio \ +- gview_render \ +- gview_encoder \ +- guvcview \ ++SUBDIRS = guvcview \ + data \ +- po \ +- po/gview_v4l2core ++ po + + #Distribute these directories: + DIST_SUBDIRS = gview_v4l2core \ +@@ -19,12 +14,6 @@ DIST_SUBDIRS = gview_v4l2core \ + po \ + po/gview_v4l2core + +-pkgconfigdir = $(libdir)/pkgconfig +-pkgconfig_DATA = pkgconfig/libgviewv4l2core.pc \ +- pkgconfig/libgviewaudio.pc \ +- pkgconfig/libgviewrender.pc \ +- pkgconfig/libgviewencoder.pc +- + ACLOCAL_AMFLAGS = -I m4 + + EXTRA_DIST = bootstrap.sh +Index: guvcview-src-2.0.8/guvcview/Makefile.am +=================================================================== +--- guvcview-src-2.0.8.orig/guvcview/Makefile.am ++++ guvcview-src-2.0.8/guvcview/Makefile.am +@@ -57,14 +57,14 @@ guvcview_CPPFLAGS = $(guvcview_CFLAGS) \ + -fPIC + endif + +-guvcview_LDFLAGS = $(LIBINTL) ++guvcview_LDFLAGS = $(LIBINTL) \ ++ $(shell pkg-config --libs libgviewv4l2core) \ ++ $(shell pkg-config --libs libgviewrender) \ ++ $(shell pkg-config --libs libgviewaudio) \ ++ $(shell pkg-config --libs libgviewencoder) + +-guvcview_LDADD = ../gview_v4l2core/$(GVIEWV4L2CORE_LIBRARY_NAME).la \ +- ../gview_render/$(GVIEWRENDER_LIBRARY_NAME).la \ +- ../gview_audio/$(GVIEWAUDIO_LIBRARY_NAME).la \ +- ../gview_encoder/$(GVIEWENCODER_LIBRARY_NAME).la \ +- $(PTHREAD_LIBS) \ +- -lm ++guvcview_LDADD = -lpthread \ ++ -lm + if HAVE_GTK3 + guvcview_LDADD += $(GUIGTK3_LIBS) + endif +Index: guvcview-src-2.0.8/configure.ac +=================================================================== +--- guvcview-src-2.0.8.orig/configure.ac ++++ guvcview-src-2.0.8/configure.ac +@@ -73,9 +73,9 @@ GETTEXT_PACKAGE_V4L2CORE=gview_v4l2core + AC_SUBST(GETTEXT_PACKAGE_V4L2CORE) + AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE_V4L2CORE,"$GETTEXT_PACKAGE_V4L2CORE", [gview_v4l2core]) + +-GETTEXT_PACKAGE=guvcview ++GETTEXT_PACKAGE=guvcview-qt5 + AC_SUBST(GETTEXT_PACKAGE) +-AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [guvcview]) ++AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [guvcview-qt5]) + + IT_PROG_INTLTOOL([0.40]) + IT_PO_SUBDIR(po/gview_v4l2core) diff --git a/guvcview-src-2.1.0.tar.bz2 b/guvcview-src-2.1.0.tar.bz2 new file mode 100644 index 0000000..5762595 --- /dev/null +++ b/guvcview-src-2.1.0.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3d93e4c9fab8d1a7a9bde1a6dbbf04d6cf9d347c134b5128b4586a1d90b63cfb +size 775670 diff --git a/guvcview-src-2.2.1.tar.bz2 b/guvcview-src-2.2.1.tar.bz2 new file mode 100644 index 0000000..1e0d7c1 --- /dev/null +++ b/guvcview-src-2.2.1.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d2adc7ce762961e853c3e16b511bad61504492d12f3e2eb7e30da4a2f7ade5af +size 355747 diff --git a/guvcview.changes b/guvcview.changes new file mode 100644 index 0000000..7da612d --- /dev/null +++ b/guvcview.changes @@ -0,0 +1,332 @@ +------------------------------------------------------------------- +Tue Nov 4 14:01:22 UTC 2025 - Martin Hauke + +- Switch to cmake +- Drop multibuild; use a wrapper script instead +- Use %ldconfig_scriptlets +- Update to version 2.2.1 + * Fix encoder video timestamps + * Fix encoder video codec defaults + * Move from qt5 to qt6 + * Change build system from autoconf to cmake + * Add support for yuv420p pixel format for MJPG decoding +- Drop patches (not longer needed): + * 0001-Fix-build-with-GCC-14.patch + * guvcview-SUSE.patch + * guvcview-qt5-nolibs_qt5names.patch + * 0001-Fix-build-with-GCC-14.patch +- Add patches: + * 0001-fix-deprecation-warning-with-ffpmeg-7.1-add-Wall-to-.patch + * 0002-Fix-desktop-file-for-cmake.patch + * fix-linking.patch + * fix-pkgconfig-path.patch + +------------------------------------------------------------------- +Thu Mar 13 18:44:01 UTC 2025 - Jan Engelhardt + +- Use pkgconfig() to be impervious to package renames. + +------------------------------------------------------------------- +Tue Aug 27 18:06:06 UTC 2024 - Dave Plater + +- Revert to ffmpeg-7 + +------------------------------------------------------------------- +Tue Aug 27 10:47:09 UTC 2024 - Dave Plater + +- Force ffmpeg-6 library use in order to fix build + +------------------------------------------------------------------- +Tue Aug 27 08:07:37 UTC 2024 - Christophe Marin + +- Update to 2.1.0 + * Fix audio channels deprecated warning for avcodec >= 58 + * Add button click support for certain type of digital + microscopes + * Small fixes + * Fix minimum version for audio channels api deprecated + warning for avcodec >= 59 + * Fix COPYING to the same GPL version (v2) as the source files + * Add binary fx filter + * Make guvcview skip metadada devices + * Enable OSD crosshair size to be changed in config +- Add patch to fix build failure with GCC 14: + * 0001-Fix-build-with-GCC-14.patch +- Fix license. There's no GPL-3.0-only file that could impact + the binaries license. +- Spec cleanup + +------------------------------------------------------------------- +Tue Feb 27 11:16:13 UTC 2024 - Dominique Leuenberger + +- Use %patch -P N instead of deprecated %patchN. + +------------------------------------------------------------------- +Mon Aug 8 22:06:07 UTC 2022 - Atri Bhattacharya + +- Update to version 2.0.8: + * Fix libav API break (ticket #70) + * Update autoconf scripts + * Support for building against ffmpeg5. +- Changes from version 2.0.7: + * Fix audio encoder (tickets #64 and #65) + * Use current theme icons (get icon by name) +- Convert to multibuild with qt5 as additional flavor: + * Drop guvcview-qt5.spec, guvcview-qt5.changes, pre_checkin.sh + script. + * Drop hunks from guvcview-qt5-nolibs_qt5names.patch duplicated + in guvcview-SUSE.patch. + * Adapt BuildRequires for the additional flavour appropriately. +- Update so versions in keeping with upstream shlib versioning. +- Replace packageand type Supplements with RPM binary Supplements. +- Update guvcview-SUSE.patch to drop icon dir restructuring: no + longer needed after all theme-able application icons dropped. + +------------------------------------------------------------------- +Mon Feb 3 13:51:18 UTC 2020 - Dominique Leuenberger + +- BuildRequire pkgconfig(libudev) instead of libudev-devel: allow + OBS to shortcut through the -mini flavors. + +------------------------------------------------------------------- +Tue Feb 12 18:24:24 UTC 2019 - bjorn.lie@gmail.com + +- Update to version 2.0.6: + * No upstream changes provided, please see + https://sourceforge.net/p/guvcview/git-master/ci/master/tree/ +- No longer force use ffmpeg3 version of pkgconfig(libav*). +- Drop guvcview-qt5-ppc64_QVariant.patch: Fixed upstream. +- Rebase guvcview-qt5-nolibs_qt5names.patch with quilt. + +------------------------------------------------------------------- +Fri May 4 14:03:47 UTC 2018 - olaf@aepfle.de + +- Use ffmpeg3 versions of pkgconfig(libav*) + +------------------------------------------------------------------- +Mon Sep 11 18:48:13 UTC 2017 - jengelh@inai.de + +- Update summary of -devel subpackage. + +------------------------------------------------------------------- +Sat Jul 29 10:53:31 UTC 2017 - aloisio@gmx.com + +- Update to version 2.0.5 + * terminate configure if qt5 is enabled and moc is missing + * add sfml render + * fix aac encoder (replace experimental aac by libvo_aacenc) + * fix build against newer kernels + * disable window key pressed events if a string control has focus + * fix video monotonic pts flag value in encoder context + * fix audio cleanup + * add support for HEVC (h265) video codec + * fix muxed h264 support; fix raw output (alloc outbuf frame) + * add circular buffer for delayed audio frames pts + * remove support for older libavcodec versions (< 54.01) + * add support for VP9 + * fix motion estimation method for x264 [1-4] + * fix buggy behaviour for file names without extension + * add support for sfml render + * drop support for sdl1 based render + * Flavio Spagnuolo : fix matroska + clean up when audio is disabled + * fix segfault when destroying mutexes by unlocking already + unlocked mutexes + * fix libc readdir_r deprecated warning: replace by readdir + * add extra video fx filters + +- Dropped guvcview-2.0.4_ffmpeg-3.0.patch (merged upstream) + +- Split lang package contents between guvcview-lang and a new + libgviewv4l2core-lang + +- Added separate -qt5 and -qt5-lang packages and pre_checkin.sh + and guvcview-qt5-nolibs_qt5names.patch to support them + +- Added guvcview-qt5-ppc64_QVariant.patch to fix build on ppc64 + +- Replaced some in-spec commands with guvcview-SUSE.patch + +------------------------------------------------------------------- +Thu Mar 2 10:28:49 UTC 2017 - jengelh@inai.de + +- Rename %soname to %sover to better reflect its use +- Ensure description neutrality + +------------------------------------------------------------------- +Sun May 1 18:06:05 UTC 2016 - aloisio@gmx.com + +- Update to version 2.0.4: + * drop support for internal 422 packed format (use only 420 planar) + * add support for extra pixel formats, including be formats + * add command line option for requesting fps + * add support for control events + * add support for string, int64, bitmask and integer menu controls + * make sure we can't select unsuported pix formats from the gui + * fix status message for QT5 interface + * move mutexes to device handlers (context) + * v4l2core and audio api - don't access device data directly (use opaque structures) + * add constructor and destructor functions for v4l2core and encoder + Paulo Assis Mon, 22 Feb 2016 10:10:00 +0100 + 2.0.3: + * Add Qt5 interface (--enable-qt5) + * fix '-n' option (don't save frame when photo countdown reaches 0) + * restore exit_on_term option + * use AC_SYS_LARGEFILE m4 macro for enabling Large File Support (LFS) on 32 bit systems + * add color config for crosshair osd + * change rendering engine to use updateTexture instead of lock/unlock texture + * change rendering lib to avoid frame copy when using osd + Paulo Assis Mon, 4 Jan 2016 23:34:00 +0100 + +- Dropped guvcview-implicit-pointer-decl.patch + guvcview-no-return-in-nonvoid-function.patch + guvcview-voidreturn.patch + +- Added guvcview-2.0.4_ffmpeg-3.0.patch + +------------------------------------------------------------------- +Tue Sep 22 08:47:31 UTC 2015 - olaf@aepfle.de + +- Use pkgconfig for ffmpeg BuildRequires + +------------------------------------------------------------------- +Wed Aug 05 10:49:17 UTC 2015 - joerg.lorenzen@ki.tng.de + +- Update to version 2.0.2: + + fix mjpeg and h264 decoders (libav): init avpacket. + + fix wrong logic of enable switches (Marvin Schmidt ticket #12). + + create a frame queue and refactor frame grab/decode. + + fix jpeg decoder for older libavcodec api ( < 54.25). + + attach video capture to SIGUSR1 signal. + + add audio latency control to gui. + + change default portaudio latency to high latency. + + set device during initialization. + + use time for matroska segment uid if gsl is disabled. + + fix array index causing buffer overflow. + + restore CPPFLAGS after AC_CHECK_HEADERS. + + remove direct access to device data in v4l2core lib. + + make sure to stop encoder thread before exiting capture thread. + + avoid SIGFPE on bad channels or samprate data inside audio + capture callbacks. + + remove check for avcodec.h (it's needed for very old libavcodec + versions); set iyuv as default internal format (over yuyv). + + add basic support for continuous and stepwise frame sizes. + + add support for empty control list. + + add code for crossair osd. + + fix h264 demux from mjpg container. + + fix pan/tilt for logitech peripheral V3 (use raw control + instead of v4l2). + +------------------------------------------------------------------- +Fri Oct 31 11:53:42 UTC 2014 - joerg.lorenzen@ki.tng.de + +- Update to version 2.0.1: + + Fix audio clean bug (segfault when audio=none). + + Add --disable_libv4l2 option. + + Add support for internal yu12 planar format. + + Workaround uvcvideo bug (buf.bytesused=0 on kernels >=3.16). +- Changes since version 2.0.0: + + New version 2.0.0 (code rewriten from scratch). + + Move all core functions to 4 shared libs. + + Change options. + + Change config. + + Add sdl2 render. + + Use gsl for random number generation. +- Changes since version 1.7.3: + + Add silence frames to compensate audio drift (delay). + + Fix possible memory leak. + + Add video and image capture through system signals: + SIGUSR1 and SIGUSR2. + + Add true no_display mode (no X required). + + Small bug fixes. +- Changes since version 1.7.2: + + Add H264 decoding support. + + Sync translations. +- Changes since version 1.7.1: + + Fix avi muxer: fix opendml indexes (>= 1Gb). + + Update Italian translation. + +------------------------------------------------------------------- +Tue Jul 30 13:34:46 UTC 2013 - i@margueirte.su + +- build against libffmpeg-devel. + +------------------------------------------------------------------- +Sat Jul 20 20:41:27 UTC 2013 - zaitor@opensuse.org + +- Update to version 1.7.0: + + Refactor avi muxer (base it on libav muxer with opendml + support). + + Refactor mkv muxer (base it on libav muxer with webm support). + + Add VP8, Theora and Vorbis codecs. + + Add Webm support. + + Add a Top Menu. + + Move all file operations to the Top Menu. + +------------------------------------------------------------------- +Fri Sep 20 12:27:00 UTC 2012 - zaitor@opensuse.org + +- Update to version 1.6.1: + + Fix build with latest libavcodec. + + Fix audio codecs listing. + + Fix audio codecs (AC3 and AAC) input format for latest + libavcodec API (float). + + Add support for delayed frames in video encoding. +- Changes since version 1.6.0: + + Run audio in separate thread. + + Update audio buffer. + + Move pulse audio interface from simple to async API. + + Add pulse device list. + + Enable build of pulse API by default. +- Added new build dependency, intltool. + +------------------------------------------------------------------- +Sun May 20 14:28:10 UTC 2012 - zaitor@opensuse.org + +- Update to version 1.5.3: + + Update libavcodec API. + + Add libavutil dependency. + + Fix pulse interface. + + Update language catalogs. +- Drop guvcview-pulseaudio-fix.patch, fixed upstream. +- Change BuildRequires: pulseaudio-devel to libpulse-devel. + +------------------------------------------------------------------- +Sun Feb 26 15:52:45 UTC 2012 - zaitor@opensuse.org + +- Update to version 1.5.2: + + Move to pthreads (fix gthread API 2 issues). + + Add italian translation. + + Fix several libavcodec issues. + + Fix some gtk3 widgets. +- Drop guvcview-fix-glib-include.patch, fixed upstream. +- Add guvcview-pulseaudio-fix.patch: Fix pulseaudio interface. + +------------------------------------------------------------------- +Mon Jan 23 00:48:09 UTC 2012 - malcolmlewis@opensuse.org + +- Updated to version 1.5.1: + + Moved to gtk3. + + Make control window size dependent on screen resolution. + + Threaded coding patch - George Sedov . + + Fix h264 codec properties. +- Updates from version 1.5.0: + + Add a no display mode (--no_display). + + Fix build issues with newer versions (>=0.7.x) of ffmpeg + libavcodec. + + Add support for unix signals. + + Add VU meter OSD. + + Fix menu controls (linux 3.0). +- Add guvcview-fix-glib-include.patch: To fix only can be + included directly error for builds > 1210. + +------------------------------------------------------------------- +Mon Oct 3 19:28:19 UTC 2011 - malcolmlewis@opensuse.org + +- Fix guvcview.desktop file in spec file. + +------------------------------------------------------------------- +Fri Jul 1 02:06:44 UTC 2011 - malcolmlewis@opensuse.org + +- Initial build based on fc15 spec file. + diff --git a/guvcview.spec b/guvcview.spec new file mode 100644 index 0000000..101b512 --- /dev/null +++ b/guvcview.spec @@ -0,0 +1,209 @@ +# +# spec file for package guvcview +# +# Copyright (c) 2025 SUSE LLC and contributors +# Copyright (c) 2012 Malcolm J Lewis +# Copyright (c) 2013 Marguerite Su +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +%define sover 2_2-2 +Name: guvcview +Version: 2.2.1 +Release: 0 +Summary: GTK+ UVC Viewer and Capturer +# Reference to GPL-2.0 in some files? +License: GPL-2.0-or-later +Group: Productivity/Multimedia/Video/Players +URL: https://guvcview.sourceforge.net/ +#Git-Clone: git://git.code.sf.net/p/guvcview/git-master +Source0: https://sourceforge.net/projects/guvcview/files/source/guvcview-src-%{version}.tar.bz2 +Patch3: 0001-fix-deprecation-warning-with-ffpmeg-7.1-add-Wall-to-.patch +Patch4: 0002-Fix-desktop-file-for-cmake.patch +Patch5: fix-linking.patch +Patch6: fix-pkgconfig-path.patch +# +BuildRequires: cmake +BuildRequires: fdupes +BuildRequires: gcc-c++ +BuildRequires: libpng-devel +BuildRequires: pkgconfig +BuildRequires: pkgconfig(alsa) +BuildRequires: pkgconfig(gsl) +BuildRequires: pkgconfig(gtk+-3.0) +# use ffmpeg7 +BuildRequires: ffmpeg-7-libavcodec-devel +BuildRequires: ffmpeg-7-libavutil-devel +# +BuildRequires: pkgconfig(libpulse) +BuildRequires: pkgconfig(Qt6Core) +BuildRequires: pkgconfig(Qt6Gui) +BuildRequires: pkgconfig(Qt6Widgets) +BuildRequires: pkgconfig(libudev) +BuildRequires: pkgconfig(libusb-1.0) +BuildRequires: pkgconfig(libv4l2) +BuildRequires: pkgconfig(portaudio-2.0) +BuildRequires: pkgconfig(sdl2) +Recommends: %{name}-lang + +%description +A GTK interface for capturing and viewing video from devices +supported by the Linux UVC driver, although it should also work with +any v4l2 compatible device. + +%package -n libgviewaudio-%{sover} +Summary: GTK+ UVC Viewer and Capturer +Group: System/Libraries + +%description -n libgviewaudio-%{sover} +A GTK interface for capturing and viewing video from devices +supported by the Linux UVC driver, although it should also work with +any v4l2 compatible device. + +%package -n libgviewencoder-%{sover} +Summary: GTK+ UVC Viewer and Capturer +Group: System/Libraries + +%description -n libgviewencoder-%{sover} +A GTK interface for capturing and viewing video from devices +supported by the Linux UVC driver, although it should also work with +any v4l2 compatible device. + +%package -n libgviewrender-%{sover} +Summary: GTK+ UVC Viewer and Capturer +Group: System/Libraries + +%description -n libgviewrender-%{sover} +A GTK interface for capturing and viewing video from devices +supported by the Linux UVC driver, although it should also work with +any v4l2 compatible device. + +%package -n libgviewv4l2core-%{sover} +Summary: GTK+ UVC Viewer and Capturer +Group: System/Libraries +Recommends: libgviewv4l2core-lang + +%description -n libgviewv4l2core-%{sover} +A GTK interface for capturing and viewing video from devices +supported by the Linux UVC driver, although it should also work with +any v4l2 compatible device. + +%package devel +Summary: Development files for guvcview +Group: Development/Libraries/C and C++ +Requires: glibc-devel +Requires: libgviewaudio-%{sover} = %{version}-%{release} +Requires: libgviewencoder-%{sover} = %{version}-%{release} +Requires: libgviewrender-%{sover} = %{version}-%{release} +Requires: libgviewv4l2core-%{sover} = %{version}-%{release} +Requires: libpng-devel +Requires: pkgconfig(alsa) +Requires: pkgconfig(gsl) +Requires: pkgconfig(libavcodec) +Requires: pkgconfig(libavutil) +Requires: pkgconfig(libpulse) +Requires: pkgconfig(libudev) +Requires: pkgconfig(libusb-1.0) +Requires: pkgconfig(libv4l2) +Requires: pkgconfig(portaudio-2.0) +Requires: pkgconfig(sdl2) + +%description devel +A GTK interface for capturing and viewing video from devices +supported by the Linux UVC driver, although it should also work with +any v4l2 compatible device. + +This subpackage contains the header files for developing +applications that want to make use of the GUVC libraries. + +%lang_package + +%package -n libgviewv4l2core-lang +Summary: Languages for libgviewv4l2core +Group: System/Localization +Requires: libgviewv4l2core-%{sover} = %{version} +Provides: libgviewv4l2core-lang-all = %{version} +Supplements: (bundle-lang-other and libgviewv4l2core-%{sover}) +BuildArch: noarch + +%description -n libgviewv4l2core-lang +Provides translations to libgviewv4l2core. + +%prep +%autosetup -p1 -n %{name}-src-%{version} + +%build +%cmake \ + -DUSE_GTK3=ON \ + -DUSE_QT6=ON \ + -DUSE_SDL2=ON \ + -DINSTALL_DEVKIT=ON +%make_jobs + +%install +%cmake_install + +# wrapper for guvcview-qt6 +echo -e "#!/bin/sh\nexec %{_bindir}/guvcview --gui=qt6 \"\$@\"" > %{buildroot}%{_bindir}/guvcview-qt6 +chmod 755 %{buildroot}%{_bindir}/guvcview-qt6 + +%find_lang %{name} %{?no_lang_C} +%find_lang gview_v4l2core libgviewv4l2core.lang %{?no_lang_C} + +%ldconfig_scriptlets -n libgviewaudio-%{sover} +%ldconfig_scriptlets -n libgviewencoder-%{sover} +%ldconfig_scriptlets -n libgviewrender-%{sover} +%ldconfig_scriptlets -n libgviewv4l2core-%{sover} + +%files +%license COPYING +%doc AUTHORS ChangeLog README.md +%{_bindir}/%{name} +%{_bindir}/%{name}-qt6 +%{_datadir}/applications/%{name}.desktop +%{_datadir}/appdata/%{name}.appdata.xml +%{_datadir}/pixmaps/%{name}.png +%{_mandir}/man1/%{name}.1%{?ext_man} + +%files -n libgviewaudio-%{sover} +%{_libdir}/libgviewaudio.so.* + +%files -n libgviewencoder-%{sover} +%{_libdir}/libgviewencoder.so.* + +%files -n libgviewrender-%{sover} +%{_libdir}/libgviewrender.so.* + +%files -n libgviewv4l2core-%{sover} +%{_libdir}/libgviewv4l2core.so.* + +%files devel +%{_includedir}/gviewaudio.h +%{_includedir}/gviewencoder.h +%{_includedir}/gviewrender.h +%{_includedir}/gviewv4l2core.h +%{_libdir}/libgviewaudio.so +%{_libdir}/libgviewencoder.so +%{_libdir}/libgviewrender.so +%{_libdir}/libgviewv4l2core.so +%{_libdir}/pkgconfig/libgviewaudio.pc +%{_libdir}/pkgconfig/libgviewencoder.pc +%{_libdir}/pkgconfig/libgviewrender.pc +%{_libdir}/pkgconfig/libgviewv4l2core.pc + +%files -n libgviewv4l2core-lang -f libgviewv4l2core.lang + +%files lang -f %{name}.lang + +%changelog -- 2.51.1 From 8e9008a3795a5b46d9293b18522a1e0201d52273478c916285f8edf1c31c9c87 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 13 Nov 2025 17:03:24 +0000 Subject: [PATCH 4/5] - Add desktop file for guvcview-qt6 OBS-URL: https://build.opensuse.org/package/show/multimedia:apps/guvcview?expand=0&rev=28 --- .gitattributes | 23 + .gitignore | 1 + 0001-Fix-build-with-GCC-14.patch | 40 + ...warning-with-ffpmeg-7.1-add-Wall-to-.patch | 1500 +++++++++++++++++ 0002-Fix-desktop-file-for-cmake.patch | 85 + _multibuild | 3 + fix-linking.patch | 26 + fix-pkgconfig-path.patch | 52 + guvcview-SUSE.patch | 36 + guvcview-qt.desktop | 11 + guvcview-qt5-nolibs_qt5names.patch | 83 + guvcview-src-2.1.0.tar.bz2 | 3 + guvcview-src-2.2.1.tar.bz2 | 3 + guvcview.changes | 337 ++++ guvcview.spec | 213 +++ 15 files changed, 2416 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 0001-Fix-build-with-GCC-14.patch create mode 100644 0001-fix-deprecation-warning-with-ffpmeg-7.1-add-Wall-to-.patch create mode 100644 0002-Fix-desktop-file-for-cmake.patch create mode 100644 _multibuild create mode 100644 fix-linking.patch create mode 100644 fix-pkgconfig-path.patch create mode 100644 guvcview-SUSE.patch create mode 100644 guvcview-qt.desktop create mode 100644 guvcview-qt5-nolibs_qt5names.patch create mode 100644 guvcview-src-2.1.0.tar.bz2 create mode 100644 guvcview-src-2.2.1.tar.bz2 create mode 100644 guvcview.changes create mode 100644 guvcview.spec diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/0001-Fix-build-with-GCC-14.patch b/0001-Fix-build-with-GCC-14.patch new file mode 100644 index 0000000..3002340 --- /dev/null +++ b/0001-Fix-build-with-GCC-14.patch @@ -0,0 +1,40 @@ +From 98feb36a5f4971ca152b2d90a923008d0bd6cf5f Mon Sep 17 00:00:00 2001 +From: Christophe Marin +Date: Tue, 27 Aug 2024 10:31:02 +0200 +Subject: [PATCH] =?UTF-8?q?Fix=20build=20with=20GCC=C2=A014?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--- + gview_v4l2core/jpeg_decoder.c | 1 + + gview_v4l2core/uvc_h264.c | 1 + + 2 files changed, 2 insertions(+) + +diff --git a/gview_v4l2core/jpeg_decoder.c b/gview_v4l2core/jpeg_decoder.c +index 9d30ea2..d60fdf8 100644 +--- a/gview_v4l2core/jpeg_decoder.c ++++ b/gview_v4l2core/jpeg_decoder.c +@@ -36,6 +36,7 @@ + #include + #include + #include ++#include + + #include "gviewv4l2core.h" + #include "colorspaces.h" +diff --git a/gview_v4l2core/uvc_h264.c b/gview_v4l2core/uvc_h264.c +index ed0c6a8..a02271e 100644 +--- a/gview_v4l2core/uvc_h264.c ++++ b/gview_v4l2core/uvc_h264.c +@@ -24,6 +24,7 @@ + /* support for internationalization - i18n */ + #include + #include ++#include + #include + #include + #include +-- +2.46.0 + diff --git a/0001-fix-deprecation-warning-with-ffpmeg-7.1-add-Wall-to-.patch b/0001-fix-deprecation-warning-with-ffpmeg-7.1-add-Wall-to-.patch new file mode 100644 index 0000000..d647d34 --- /dev/null +++ b/0001-fix-deprecation-warning-with-ffpmeg-7.1-add-Wall-to-.patch @@ -0,0 +1,1500 @@ +From 150c054fe971e282515f4d13e42a061096bfdd6e Mon Sep 17 00:00:00 2001 +From: Paulo Assis +Date: Sat, 16 Nov 2024 20:04:52 +0000 +Subject: [PATCH 1/2] fix deprecation warning with ffpmeg 7.1; add -Wall to + compile flags + +--- + guvcview/CMakeLists.txt | 2 + + gview_audio/CMakeLists.txt | 2 + + gview_encoder/CMakeLists.txt | 2 + + gview_encoder/audio_codecs.c | 818 ++++++++++++++++----------------- + gview_encoder/encoder.c | 74 ++- + gview_render/CMakeLists.txt | 1 + + gview_render/render_fx.c | 53 ++- + gview_render/render_sdl2.c | 3 +- + gview_render/render_sfml.cpp | 4 +- + gview_v4l2core/CMakeLists.txt | 2 + + gview_v4l2core/colorspaces.c | 6 +- + gview_v4l2core/frame_decoder.c | 2 +- + gview_v4l2core/jpeg_decoder.c | 34 +- + gview_v4l2core/v4l2_controls.c | 2 +- + 14 files changed, 513 insertions(+), 492 deletions(-) + +diff --git a/guvcview/CMakeLists.txt b/guvcview/CMakeLists.txt +index bb501bf..e087b64 100644 +--- a/guvcview/CMakeLists.txt ++++ b/guvcview/CMakeLists.txt +@@ -18,6 +18,8 @@ add_executable(guvcview + video_capture.c + ) + ++add_definitions("-Wall") ++ + if(USE_GTK3) + pkg_check_modules(GTK3 gtk+-3.0) + if(GTK3_FOUND) +diff --git a/gview_audio/CMakeLists.txt b/gview_audio/CMakeLists.txt +index 9714745..6217ef9 100644 +--- a/gview_audio/CMakeLists.txt ++++ b/gview_audio/CMakeLists.txt +@@ -18,6 +18,8 @@ set_target_properties( + SOVERSION ${LIBSOVERSION} + ) + ++add_definitions("-Wall") ++ + pkg_check_modules(PORTAUDIO2 REQUIRED portaudio-2.0) + + target_link_libraries(gviewaudio ${PORTAUDIO2_LIBRARIES}) +diff --git a/gview_encoder/CMakeLists.txt b/gview_encoder/CMakeLists.txt +index 8942bae..dfd7c38 100644 +--- a/gview_encoder/CMakeLists.txt ++++ b/gview_encoder/CMakeLists.txt +@@ -22,6 +22,8 @@ set_target_properties( + SOVERSION ${LIBSOVERSION} + ) + ++add_definitions("-Wall") ++ + pkg_check_modules(FFMPEG REQUIRED libavcodec libavutil) + + target_link_libraries(gviewencoder ${FFMPEG_LIBRARIES}) +diff --git a/gview_encoder/audio_codecs.c b/gview_encoder/audio_codecs.c +index 5c9f764..6965df8 100644 +--- a/gview_encoder/audio_codecs.c ++++ b/gview_encoder/audio_codecs.c +@@ -1,204 +1,195 @@ +-/*******************************************************************************# +-# guvcview http://guvcview.sourceforge.net # +-# # +-# Paulo Assis # +-# # +-# This program is free software; you can redistribute it and/or modify # +-# it under the terms of the GNU General Public License as published by # +-# the Free Software Foundation; either version 2 of the License, or # +-# (at your option) any later version. # +-# # +-# This program 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 General Public License for more details. # +-# # +-# You should have received a copy of the GNU General Public License # +-# along with this program; if not, write to the Free Software # +-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +-# # +-********************************************************************************/ ++/******************************************************************************# ++# guvcview http://guvcview.sourceforge.net # ++# # ++# Paulo Assis # ++# # ++# This program is free software; you can redistribute it and/or modify # ++# it under the terms of the GNU General Public License as published by # ++# the Free Software Foundation; either version 2 of the License, or # ++# (at your option) any later version. # ++# # ++# This program 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 General Public License for more details. # ++# # ++# You should have received a copy of the GNU General Public License # ++# along with this program; if not, write to the Free Software # ++# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # ++# # ++*******************************************************************************/ + +-#include ++#include ++#include ++#include + #include ++#include ++#include + #include + #include +-#include +-#include +-#include +-#include + /* support for internationalization - i18n */ +-#include + #include ++#include + +-#include "gviewencoder.h" +-#include "gview.h" + #include "encoder.h" ++#include "gview.h" ++#include "gviewencoder.h" + + extern int enc_verbosity; + + /* AAC object types index: MAIN = 1; LOW = 2; SSR = 3; LTP = 4*/ +-static int AAC_OBJ_TYPE[5] = +- { FF_PROFILE_UNKNOWN, FF_PROFILE_AAC_MAIN, FF_PROFILE_AAC_LOW, FF_PROFILE_AAC_SSR, FF_PROFILE_AAC_LTP }; ++static int AAC_OBJ_TYPE[5] = {FF_PROFILE_UNKNOWN, FF_PROFILE_AAC_MAIN, ++ FF_PROFILE_AAC_LOW, FF_PROFILE_AAC_SSR, ++ FF_PROFILE_AAC_LTP}; + /*-1 = reserved; 0 = freq. is writen explictly (increases header by 24 bits)*/ +-static int AAC_SAMP_FREQ[16] = +- { 96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350, -1, -1, 0}; ++static int AAC_SAMP_FREQ[16] = {96000, 88200, 64000, 48000, 44100, 32000, ++ 24000, 22050, 16000, 12000, 11025, 8000, ++ 7350, -1, -1, 0}; + + /*NORMAL AAC HEADER*/ +-/*2 bytes: object type index(5 bits) + sample frequency index(4bits) + channels(4 bits) + flags(3 bit) */ ++/*2 bytes: object type index(5 bits) + sample frequency index(4bits) + ++ * channels(4 bits) + flags(3 bit) */ + /*default = MAIN(1)+44100(4)+stereo(2)+flags(0) = 0x0A10*/ +-static uint8_t AAC_ESDS[2] = {0x0A,0x10}; ++static uint8_t AAC_ESDS[2] = {0x0A, 0x10}; + /* if samprate index == 15 AAC_ESDS[5]: +- * object type index(5 bits) + sample frequency index(4bits) + samprate(24bits) + channels(4 bits) + flags(3 bit) ++ * object type index(5 bits) + sample frequency index(4bits) + samprate(24bits) ++ * + channels(4 bits) + flags(3 bit) + */ + +- +-static audio_codec_t listSupCodecs[] = //list of software supported formats +-{ +- { +- .valid = 1, +- .bits = 32, +- .monotonic_pts = 0, +- .avi_4cc = WAVE_FORMAT_IEEE_FLOAT, +- .mkv_codec = "A_PCM/FLOAT/IEEE", +- .description = N_("PCM - uncompressed (float 32 bit)"), +- .bit_rate = 0, +- .codec_id = AV_CODEC_ID_PCM_F32LE, +- .codec_name = "pcm_f32le", +- .sample_format = AV_SAMPLE_FMT_FLT, +- .profile = FF_PROFILE_UNKNOWN, +- .mkv_codpriv = NULL, +- .codpriv_size = 0, +- .flags = 0, +- .name = "pcm" +- }, +- { +- .valid = 1, +- .bits = 0, +- .monotonic_pts= 0, +- .avi_4cc = WAVE_FORMAT_MPEG12, +- .mkv_codec = "A_MPEG/L2", +- .description = N_("MP2 (MPEG audio layer 2)"), +- .bit_rate = 160000, +- .codec_id = AV_CODEC_ID_MP2, +- .codec_name = "mp2", +- .sample_format = AV_SAMPLE_FMT_S16, +- .profile = FF_PROFILE_UNKNOWN, +- .mkv_codpriv = NULL, +- .codpriv_size = 0, +- .flags = 0, +- .name = "mp2" +- }, +- { +- .valid = 1, +- .bits = 0, +- .monotonic_pts= 0, +- .avi_4cc = WAVE_FORMAT_MP3, +- .mkv_codec = "A_MPEG/L3", +- .description = N_("MP3 (MPEG audio layer 3)"), +- .bit_rate = 160000, +- .codec_id = AV_CODEC_ID_MP3, +- .codec_name = "libmp3lame", +-#if LIBAVCODEC_VER_AT_LEAST(54,31) +- .sample_format = AV_SAMPLE_FMT_FLTP, ++static audio_codec_t listSupCodecs[] = // list of software supported formats ++ {{.valid = 1, ++ .bits = 32, ++ .monotonic_pts = 0, ++ .avi_4cc = WAVE_FORMAT_IEEE_FLOAT, ++ .mkv_codec = "A_PCM/FLOAT/IEEE", ++ .description = N_("PCM - uncompressed (float 32 bit)"), ++ .bit_rate = 0, ++ .codec_id = AV_CODEC_ID_PCM_F32LE, ++ .codec_name = "pcm_f32le", ++ .sample_format = AV_SAMPLE_FMT_FLT, ++ .profile = FF_PROFILE_UNKNOWN, ++ .mkv_codpriv = NULL, ++ .codpriv_size = 0, ++ .flags = 0, ++ .name = "pcm"}, ++ {.valid = 1, ++ .bits = 0, ++ .monotonic_pts = 0, ++ .avi_4cc = WAVE_FORMAT_MPEG12, ++ .mkv_codec = "A_MPEG/L2", ++ .description = N_("MP2 (MPEG audio layer 2)"), ++ .bit_rate = 160000, ++ .codec_id = AV_CODEC_ID_MP2, ++ .codec_name = "mp2", ++ .sample_format = AV_SAMPLE_FMT_S16, ++ .profile = FF_PROFILE_UNKNOWN, ++ .mkv_codpriv = NULL, ++ .codpriv_size = 0, ++ .flags = 0, ++ .name = "mp2"}, ++ {.valid = 1, ++ .bits = 0, ++ .monotonic_pts = 0, ++ .avi_4cc = WAVE_FORMAT_MP3, ++ .mkv_codec = "A_MPEG/L3", ++ .description = N_("MP3 (MPEG audio layer 3)"), ++ .bit_rate = 160000, ++ .codec_id = AV_CODEC_ID_MP3, ++ .codec_name = "libmp3lame", ++#if LIBAVCODEC_VER_AT_LEAST(54, 31) ++ .sample_format = AV_SAMPLE_FMT_FLTP, + #else +- .sample_format = AV_SAMPLE_FMT_S16, ++ .sample_format = AV_SAMPLE_FMT_S16, + #endif +- .profile = FF_PROFILE_UNKNOWN, +- .mkv_codpriv = NULL, +- .codpriv_size = 0, +- .flags = 0, +- .name = "mp3" +- }, +- { +- .valid = 1, +- .bits = 0, +- .monotonic_pts= 0, +- .avi_4cc = WAVE_FORMAT_AC3, +- .mkv_codec = "A_AC3", +- .description = N_("AC-3 (ATSC A/52A)"), +- .bit_rate = 160000, +- .codec_id = AV_CODEC_ID_AC3, +- .codec_name = "ac3", +-#if LIBAVCODEC_VER_AT_LEAST(54,31) +- .sample_format = AV_SAMPLE_FMT_FLTP, ++ .profile = FF_PROFILE_UNKNOWN, ++ .mkv_codpriv = NULL, ++ .codpriv_size = 0, ++ .flags = 0, ++ .name = "mp3"}, ++ {.valid = 1, ++ .bits = 0, ++ .monotonic_pts = 0, ++ .avi_4cc = WAVE_FORMAT_AC3, ++ .mkv_codec = "A_AC3", ++ .description = N_("AC-3 (ATSC A/52A)"), ++ .bit_rate = 160000, ++ .codec_id = AV_CODEC_ID_AC3, ++ .codec_name = "ac3", ++#if LIBAVCODEC_VER_AT_LEAST(54, 31) ++ .sample_format = AV_SAMPLE_FMT_FLTP, + #else +- .sample_format = AV_SAMPLE_FMT_FLT, ++ .sample_format = AV_SAMPLE_FMT_FLT, + #endif +- .profile = FF_PROFILE_UNKNOWN, +- .mkv_codpriv = NULL, +- .codpriv_size = 0, +- .flags = 0, +- .name = "ac3" +- }, +- { +- .valid = 1, +- .bits = 16, +- .monotonic_pts= 0, +- .avi_4cc = WAVE_FORMAT_AAC, +- .mkv_codec = "A_AAC", +- .description = N_("AAC (Advanced Audio Coding)"), +- .bit_rate = 64000, +- .codec_id = AV_CODEC_ID_AAC, +- .codec_name = "libvo_aacenc", +-#if LIBAVCODEC_VER_AT_LEAST(54,31) +- .sample_format = AV_SAMPLE_FMT_FLTP, ++ .profile = FF_PROFILE_UNKNOWN, ++ .mkv_codpriv = NULL, ++ .codpriv_size = 0, ++ .flags = 0, ++ .name = "ac3"}, ++ {.valid = 1, ++ .bits = 16, ++ .monotonic_pts = 0, ++ .avi_4cc = WAVE_FORMAT_AAC, ++ .mkv_codec = "A_AAC", ++ .description = N_("AAC (Advanced Audio Coding)"), ++ .bit_rate = 64000, ++ .codec_id = AV_CODEC_ID_AAC, ++ .codec_name = "libvo_aacenc", ++#if LIBAVCODEC_VER_AT_LEAST(54, 31) ++ .sample_format = AV_SAMPLE_FMT_FLTP, + #else +- .sample_format = AV_SAMPLE_FMT_S16, ++ .sample_format = AV_SAMPLE_FMT_S16, + #endif +- .profile = FF_PROFILE_AAC_LOW, +- .mkv_codpriv = AAC_ESDS, +- .codpriv_size = 2, +- .flags = 0, +- .name = "aac" +- }, +- { +- .valid = 1, +- .bits = 16, +- .monotonic_pts= 0, +- .avi_4cc = OGG_FORMAT_VORBIS, +- .mkv_codec = "A_VORBIS", +- .description = N_("Vorbis"), +- .bit_rate = 64000, +- .codec_id = AV_CODEC_ID_VORBIS, +- .codec_name = "libvorbis", +-#if LIBAVCODEC_VER_AT_LEAST(54,31) +- .sample_format = AV_SAMPLE_FMT_FLTP, ++ .profile = FF_PROFILE_AAC_LOW, ++ .mkv_codpriv = AAC_ESDS, ++ .codpriv_size = 2, ++ .flags = 0, ++ .name = "aac"}, ++ {.valid = 1, ++ .bits = 16, ++ .monotonic_pts = 0, ++ .avi_4cc = OGG_FORMAT_VORBIS, ++ .mkv_codec = "A_VORBIS", ++ .description = N_("Vorbis"), ++ .bit_rate = 64000, ++ .codec_id = AV_CODEC_ID_VORBIS, ++ .codec_name = "libvorbis", ++#if LIBAVCODEC_VER_AT_LEAST(54, 31) ++ .sample_format = AV_SAMPLE_FMT_FLTP, + #else +- .sample_format = AV_SAMPLE_FMT_S16, ++ .sample_format = AV_SAMPLE_FMT_S16, + #endif +- .profile = FF_PROFILE_UNKNOWN, +- .mkv_codpriv = NULL, +- .codpriv_size = 0, +- .flags = 0, +- .name = "vorb" +- } +-}; +- +-static int get_aac_obj_ind(int profile) +-{ +- int i = 0; +- +- for (i=0; i<5; i++) +- if(AAC_OBJ_TYPE[i] == profile) break; +- +- return i; +-} ++ .profile = FF_PROFILE_UNKNOWN, ++ .mkv_codpriv = NULL, ++ .codpriv_size = 0, ++ .flags = 0, ++ .name = "vorb"}}; + +-static int get_aac_samp_ind(int samprate) +-{ +- int i = 0; ++static int get_aac_obj_ind(int profile) { ++ int i = 0; + +- for (i=0; i<13; i++) +- if(AAC_SAMP_FREQ[i] == samprate) break; ++ for (i = 0; i < 5; i++) { ++ if (AAC_OBJ_TYPE[i] == profile) ++ break; ++ } ++ ++ return i; ++} + +- if (i>12) +- { +- printf("WARNING: invalid sample rate for AAC encoding\n"); +- printf("valid(96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350)\n"); +- i=4; /*default 44100*/ +- } +- return i; ++static int get_aac_samp_ind(int samprate) { ++ int i = 0; ++ ++ for (i = 0; i < 13; i++) { ++ if (AAC_SAMP_FREQ[i] == samprate) ++ break; ++ } ++ ++ if (i > 12) { ++ printf("WARNING: invalid sample rate for AAC encoding\n"); ++ printf("valid(96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, " ++ "16000, 12000, 11025, 8000, 7350)\n"); ++ i = 4; /*default 44100*/ ++ } ++ return i; + } + + /* +@@ -211,14 +202,13 @@ static int get_aac_samp_ind(int samprate) + * + * returns: listSupCodecs size (number of elements) + */ +-int encoder_get_audio_codec_list_size() +-{ +- int size = sizeof(listSupCodecs)/sizeof(audio_codec_t); ++int encoder_get_audio_codec_list_size() { ++ int size = sizeof(listSupCodecs) / sizeof(audio_codec_t); + +- if(enc_verbosity > 3) +- printf("ENCODER: audio codec list size:%i\n", size); ++ if (enc_verbosity > 3) ++ printf("ENCODER: audio codec list size:%i\n", size); + +- return size; ++ return size; + } + + /* +@@ -231,7 +221,7 @@ int encoder_get_audio_codec_list_size() + * + * returns: listSupCodecs valid number of elements + */ +-//int encoder_get_audio_codec_valid_list_size() ++// int encoder_get_audio_codec_valid_list_size() + //{ + // int valid_size = 0; + // +@@ -244,7 +234,7 @@ int encoder_get_audio_codec_list_size() + // printf("ENCODER: audio codec valid list size:%i\n", valid_size); + // + // return valid_size; +-//} ++// } + + /* + * return the real (valid only) codec index +@@ -256,18 +246,16 @@ int encoder_get_audio_codec_list_size() + * + * returns: matching listSupCodecs index + */ +-static int get_real_index (int codec_ind) +-{ +- int i = 0; +- int ind = -1; +- for (i = 0; i < encoder_get_audio_codec_list_size(); ++i) +- { +- if(listSupCodecs[i].valid) +- ind++; +- if(ind == codec_ind) +- return i; +- } +- return (codec_ind); //should never arrive ++static int get_real_index(int codec_ind) { ++ int i = 0; ++ int ind = -1; ++ for (i = 0; i < encoder_get_audio_codec_list_size(); ++i) { ++ if (listSupCodecs[i].valid) ++ ind++; ++ if (ind == codec_ind) ++ return i; ++ } ++ return (codec_ind); // should never arrive + } + + /* +@@ -280,22 +268,19 @@ static int get_real_index (int codec_ind) + * + * returns: matching list index (with non valid removed) + */ +-static int get_list_index (int real_index) +-{ +- if( real_index < 0 || +- real_index >= encoder_get_audio_codec_list_size() || +- !listSupCodecs[real_index].valid ) +- return -1; //error: real index is not valid +- +- int i = 0; +- int ind = -1; +- for (i = 0; i<= real_index; ++i) +- { +- if(listSupCodecs[i].valid) +- ind++; +- } +- +- return (ind); ++static int get_list_index(int real_index) { ++ if (real_index < 0 || real_index >= encoder_get_audio_codec_list_size() || ++ !listSupCodecs[real_index].valid) ++ return -1; // error: real index is not valid ++ ++ int i = 0; ++ int ind = -1; ++ for (i = 0; i <= real_index; ++i) { ++ if (listSupCodecs[i].valid) ++ ind++; ++ } ++ ++ return (ind); + } + + /* +@@ -308,16 +293,14 @@ static int get_list_index (int real_index) + * + * returns: real index or -1 if none + */ +-int get_audio_codec_index(int codec_id) +-{ +- int i = 0; +- for(i = 0; i < encoder_get_audio_codec_list_size(); ++i ) +- { +- if(codec_id == listSupCodecs[i].codec_id) +- return i; +- } +- +- return -1; ++int get_audio_codec_index(int codec_id) { ++ int i = 0; ++ for (i = 0; i < encoder_get_audio_codec_list_size(); ++i) { ++ if (codec_id == listSupCodecs[i].codec_id) ++ return i; ++ } ++ ++ return -1; + } + + /* +@@ -330,9 +313,8 @@ int get_audio_codec_index(int codec_id) + * + * returns: real index or -1 if none + */ +-int get_audio_codec_list_index(int codec_id) +-{ +- return get_list_index(get_audio_codec_index(codec_id)); ++int get_audio_codec_list_index(int codec_id) { ++ return get_list_index(get_audio_codec_index(codec_id)); + } + + /* +@@ -345,17 +327,16 @@ int get_audio_codec_list_index(int codec_id) + * + * returns: list codec entry or NULL if none + */ +-audio_codec_t *encoder_get_audio_codec_defaults(int codec_ind) +-{ +- int real_index = get_real_index (codec_ind); +- +- if(real_index >= 0 && real_index < encoder_get_audio_codec_list_size()) +- return (&(listSupCodecs[real_index])); +- else +- { +- fprintf(stderr, "ENCODER: (audio codec defaults) bad codec index (%i)\n", codec_ind); +- return NULL; +- } ++audio_codec_t *encoder_get_audio_codec_defaults(int codec_ind) { ++ int real_index = get_real_index(codec_ind); ++ ++ if (real_index >= 0 && real_index < encoder_get_audio_codec_list_size()) ++ return (&(listSupCodecs[real_index])); ++ else { ++ fprintf(stderr, "ENCODER: (audio codec defaults) bad codec index (%i)\n", ++ codec_ind); ++ return NULL; ++ } + } + + /* +@@ -368,15 +349,14 @@ audio_codec_t *encoder_get_audio_codec_defaults(int codec_ind) + * + * returns: 1 true; 0 false + */ +-int encoder_check_webm_audio_codec(int codec_ind) +-{ +- int real_index = get_real_index (codec_ind); ++int encoder_check_webm_audio_codec(int codec_ind) { ++ int real_index = get_real_index(codec_ind); + +- int ret = 0; +- if(real_index >= 0 && real_index < encoder_get_audio_codec_list_size()) +- ret = (listSupCodecs[real_index].codec_id == AV_CODEC_ID_VORBIS) ? 1: 0; ++ int ret = 0; ++ if (real_index >= 0 && real_index < encoder_get_audio_codec_list_size()) ++ ret = (listSupCodecs[real_index].codec_id == AV_CODEC_ID_VORBIS) ? 1 : 0; + +- return ret; ++ return ret; + } + + /* +@@ -389,9 +369,8 @@ int encoder_check_webm_audio_codec(int codec_ind) + * + * returns: index for Vorbis codec or -1 if error + */ +-int encoder_get_webm_audio_codec_index() +-{ +- return get_audio_codec_list_index(AV_CODEC_ID_VORBIS); ++int encoder_get_webm_audio_codec_index() { ++ return get_audio_codec_list_index(AV_CODEC_ID_VORBIS); + } + + /* +@@ -404,22 +383,20 @@ int encoder_get_webm_audio_codec_index() + * + * returns: number of valid audio codecs in list + */ +-int encoder_set_valid_audio_codec_list () +-{ +- int ind = 0; +- int num_codecs = 0; +- for ( ind = 0; ind < encoder_get_audio_codec_list_size(); ++ind) +- { +- const AVCodec *codec = avcodec_find_encoder(listSupCodecs[ind].codec_id); +- if (!codec) +- { +- printf("ENCODER: no audio codec detected for %s\n", listSupCodecs[ind].description); +- listSupCodecs[ind].valid = 0; +- } +- else num_codecs++; +- } +- +- return num_codecs; ++int encoder_set_valid_audio_codec_list() { ++ int ind = 0; ++ int num_codecs = 0; ++ for (ind = 0; ind < encoder_get_audio_codec_list_size(); ++ind) { ++ const AVCodec *codec = avcodec_find_encoder(listSupCodecs[ind].codec_id); ++ if (!codec) { ++ printf("ENCODER: no audio codec detected for %s\n", ++ listSupCodecs[ind].description); ++ listSupCodecs[ind].valid = 0; ++ } else ++ num_codecs++; ++ } ++ ++ return num_codecs; + } + + /* +@@ -432,16 +409,15 @@ int encoder_set_valid_audio_codec_list () + * + * returns: list codec entry or NULL if none + */ +-const char *encoder_get_audio_codec_description(int codec_ind) +-{ +- int real_index = get_real_index (codec_ind); +- if(real_index >= 0 && real_index < encoder_get_audio_codec_list_size()) +- return (listSupCodecs[real_index].description); +- else +- { +- fprintf(stderr, "ENCODER: (audio codec description) bad codec index (%i)\n", codec_ind); +- return NULL; +- } ++const char *encoder_get_audio_codec_description(int codec_ind) { ++ int real_index = get_real_index(codec_ind); ++ if (real_index >= 0 && real_index < encoder_get_audio_codec_list_size()) ++ return (listSupCodecs[real_index].description); ++ else { ++ fprintf(stderr, "ENCODER: (audio codec description) bad codec index (%i)\n", ++ codec_ind); ++ return NULL; ++ } + } + + /* +@@ -454,16 +430,15 @@ const char *encoder_get_audio_codec_description(int codec_ind) + * + * returns: mkv codec entry or NULL if none + */ +-const char *encoder_get_audio_mkv_codec(int codec_ind) +-{ +- int real_index = get_real_index (codec_ind); +- if(real_index >= 0 && real_index < encoder_get_audio_codec_list_size()) +- return (listSupCodecs[real_index].mkv_codec); +- else +- { +- fprintf(stderr, "ENCODER: (audio mkv codec) bad codec index (%i)\n", codec_ind); +- return NULL; +- } ++const char *encoder_get_audio_mkv_codec(int codec_ind) { ++ int real_index = get_real_index(codec_ind); ++ if (real_index >= 0 && real_index < encoder_get_audio_codec_list_size()) ++ return (listSupCodecs[real_index].mkv_codec); ++ else { ++ fprintf(stderr, "ENCODER: (audio mkv codec) bad codec index (%i)\n", ++ codec_ind); ++ return NULL; ++ } + } + + /* +@@ -476,16 +451,15 @@ const char *encoder_get_audio_mkv_codec(int codec_ind) + * + * returns: bits entry from audio codec list + */ +-int encoder_get_audio_bits(int codec_ind) +-{ +- int real_index = get_real_index (codec_ind); +- if(real_index >= 0 && real_index < encoder_get_audio_codec_list_size()) +- return (listSupCodecs[real_index].bits); +- else +- { +- fprintf(stderr, "ENCODER: (get_audio_bits) bad codec index (%i)\n", codec_ind); +- return 0; +- } ++int encoder_get_audio_bits(int codec_ind) { ++ int real_index = get_real_index(codec_ind); ++ if (real_index >= 0 && real_index < encoder_get_audio_codec_list_size()) ++ return (listSupCodecs[real_index].bits); ++ else { ++ fprintf(stderr, "ENCODER: (get_audio_bits) bad codec index (%i)\n", ++ codec_ind); ++ return 0; ++ } + } + + /* +@@ -498,16 +472,15 @@ int encoder_get_audio_bits(int codec_ind) + * + * returns: bit_rate entry from audio codec list + */ +-int encoder_get_audio_bit_rate(int codec_ind) +-{ +- int real_index = get_real_index (codec_ind); +- if(real_index >= 0 && real_index < encoder_get_audio_codec_list_size()) +- return (listSupCodecs[real_index].bit_rate); +- else +- { +- fprintf(stderr, "ENCODER: (get_audio_bit_rate) bad codec index (%i)\n", codec_ind); +- return 0; +- } ++int encoder_get_audio_bit_rate(int codec_ind) { ++ int real_index = get_real_index(codec_ind); ++ if (real_index >= 0 && real_index < encoder_get_audio_codec_list_size()) ++ return (listSupCodecs[real_index].bit_rate); ++ else { ++ fprintf(stderr, "ENCODER: (get_audio_bit_rate) bad codec index (%i)\n", ++ codec_ind); ++ return 0; ++ } + } + + /* +@@ -520,16 +493,15 @@ int encoder_get_audio_bit_rate(int codec_ind) + * + * returns: pointer to mkvCodecPriv data + */ +-void *encoder_get_audio_mkvCodecPriv(int codec_ind) +-{ +- int real_index = get_real_index (codec_ind); +- if(real_index >= 0 && real_index < encoder_get_audio_codec_list_size()) +- return ((void *) listSupCodecs[real_index].mkv_codpriv); +- else +- { +- fprintf(stderr, "ENCODER: (mkvCodecPriv) bad codec index (%i)\n", codec_ind); +- return NULL; +- } ++void *encoder_get_audio_mkvCodecPriv(int codec_ind) { ++ int real_index = get_real_index(codec_ind); ++ if (real_index >= 0 && real_index < encoder_get_audio_codec_list_size()) ++ return ((void *)listSupCodecs[real_index].mkv_codpriv); ++ else { ++ fprintf(stderr, "ENCODER: (mkvCodecPriv) bad codec index (%i)\n", ++ codec_ind); ++ return NULL; ++ } + } + + /* +@@ -542,100 +514,99 @@ void *encoder_get_audio_mkvCodecPriv(int codec_ind) + * + * returns: mkvCodecPriv size + */ +-int encoder_set_audio_mkvCodecPriv(encoder_context_t *encoder_ctx) +-{ +- /*assertions*/ +- assert(encoder_ctx != NULL); +- +- /*assert audio encoder context is not null*/ +- assert( encoder_ctx->enc_audio_ctx); +- encoder_codec_data_t *audio_codec_data = (encoder_codec_data_t *) encoder_ctx->enc_audio_ctx->codec_data; +- /*assert video codec data is not null*/ +- assert(audio_codec_data); +- +- int codec_id = audio_codec_data->codec_context->codec_id; +- int real_index = get_audio_codec_index(codec_id); +- +- +- if (codec_id == AV_CODEC_ID_AAC) +- { +- int obj_type = get_aac_obj_ind(listSupCodecs[real_index].profile); +- int sampind = get_aac_samp_ind(encoder_ctx->audio_samprate); +- AAC_ESDS[0] = (uint8_t) ((obj_type & 0x1F) << 3 ) + ((sampind & 0x0F) >> 1); +- AAC_ESDS[1] = (uint8_t) ((sampind & 0x0F) << 7 ) + ((encoder_ctx->audio_channels & 0x0F) << 3); +- +- return listSupCodecs[real_index].codpriv_size; /*return size = 2 */ +- } +- else if(codec_id == AV_CODEC_ID_VORBIS) +- { +- //get the 3 first header packets +- uint8_t *header_start[3]; +- int header_len[3]; +- int first_header_size; +- +- first_header_size = 30; //theora = 42 +- if (avpriv_split_xiph_headers( +- audio_codec_data->codec_context->extradata, +- audio_codec_data->codec_context->extradata_size, +- first_header_size, header_start, header_len) < 0) +- { +- fprintf(stderr, "ENCODER: vorbis codec - Extradata corrupt.\n"); +- return -1; +- } +- +- //printf("Vorbis: header1: %i header2: %i header3:%i \n", header_len[0], header_len[1], header_len[2]); +- +- //get the allocation needed for headers size +- int header_lace_size[2]; +- header_lace_size[0]=0; +- header_lace_size[1]=0; +- int i; +- for (i = 0; i < header_len[0] / 255; i++) +- header_lace_size[0]++; +- header_lace_size[0]++; +- for (i = 0; i < header_len[1] / 255; i++) +- header_lace_size[1]++; +- header_lace_size[1]++; +- +- int priv_data_size = 1 + //number of packets -1 +- header_lace_size[0] + //first packet size +- header_lace_size[1] + //second packet size +- header_len[0] + //first packet header +- header_len[1] + //second packet header +- header_len[2]; //third packet header +- +- /*should check and clean before allocating ??*/ +- encoder_ctx->enc_audio_ctx->priv_data = calloc(priv_data_size, sizeof(uint8_t)); +- if(encoder_ctx->enc_audio_ctx->priv_data == NULL) +- { +- fprintf(stderr, "ENCODER: FATAL memory allocation failure (encoder_set_audio_mkvCodecPriv): %s\n", strerror(errno)); +- exit(-1); +- } +- //write header +- uint8_t* tmp = encoder_ctx->enc_audio_ctx->priv_data; +- *tmp++ = 0x02; //number of packets -1 +- //size of head 1 +- for (i = 0; i < header_len[0] / 0xff; i++) +- *tmp++ = 0xff; +- *tmp++ = header_len[0] % 0xff; +- //size of head 2 +- for (i = 0; i < header_len[1] / 0xff; i++) +- *tmp++ = 0xff; +- *tmp++ = header_len[1] % 0xff; +- //add headers +- for(i=0; i<3; i++) +- { +- memcpy(tmp, header_start[i] , header_len[i]); +- tmp += header_len[i]; +- } +- +- listSupCodecs[real_index].mkv_codpriv = encoder_ctx->enc_audio_ctx->priv_data; +- listSupCodecs[real_index].codpriv_size = priv_data_size; +- return listSupCodecs[real_index].codpriv_size; +- } +- +- +- return 0; ++int encoder_set_audio_mkvCodecPriv(encoder_context_t *encoder_ctx) { ++ /*assertions*/ ++ assert(encoder_ctx != NULL); ++ ++ /*assert audio encoder context is not null*/ ++ assert(encoder_ctx->enc_audio_ctx); ++ encoder_codec_data_t *audio_codec_data = ++ (encoder_codec_data_t *)encoder_ctx->enc_audio_ctx->codec_data; ++ /*assert video codec data is not null*/ ++ assert(audio_codec_data); ++ ++ int codec_id = audio_codec_data->codec_context->codec_id; ++ int real_index = get_audio_codec_index(codec_id); ++ ++ if (codec_id == AV_CODEC_ID_AAC) { ++ int obj_type = get_aac_obj_ind(listSupCodecs[real_index].profile); ++ int sampind = get_aac_samp_ind(encoder_ctx->audio_samprate); ++ AAC_ESDS[0] = (uint8_t)((obj_type & 0x1F) << 3) + ((sampind & 0x0F) >> 1); ++ AAC_ESDS[1] = (uint8_t)((sampind & 0x0F) << 7) + ++ ((encoder_ctx->audio_channels & 0x0F) << 3); ++ ++ return listSupCodecs[real_index].codpriv_size; /*return size = 2 */ ++ } else if (codec_id == AV_CODEC_ID_VORBIS) { ++ // get the 3 first header packets ++ uint8_t *header_start[3]; ++ int header_len[3]; ++ int first_header_size; ++ ++ first_header_size = 30; // theora = 42 ++ if (avpriv_split_xiph_headers( ++ audio_codec_data->codec_context->extradata, ++ audio_codec_data->codec_context->extradata_size, first_header_size, ++ header_start, header_len) < 0) { ++ fprintf(stderr, "ENCODER: vorbis codec - Extradata corrupt.\n"); ++ return -1; ++ } ++ ++ // printf("Vorbis: header1: %i header2: %i header3:%i \n", header_len[0], ++ // header_len[1], header_len[2]); ++ ++ // get the allocation needed for headers size ++ int header_lace_size[2]; ++ header_lace_size[0] = 0; ++ header_lace_size[1] = 0; ++ int i; ++ for (i = 0; i < header_len[0] / 255; i++) ++ header_lace_size[0]++; ++ header_lace_size[0]++; ++ for (i = 0; i < header_len[1] / 255; i++) ++ header_lace_size[1]++; ++ header_lace_size[1]++; ++ ++ int priv_data_size = 1 + // number of packets -1 ++ header_lace_size[0] + // first packet size ++ header_lace_size[1] + // second packet size ++ header_len[0] + // first packet header ++ header_len[1] + // second packet header ++ header_len[2]; // third packet header ++ ++ /*should check and clean before allocating ??*/ ++ encoder_ctx->enc_audio_ctx->priv_data = ++ calloc(priv_data_size, sizeof(uint8_t)); ++ if (encoder_ctx->enc_audio_ctx->priv_data == NULL) { ++ fprintf(stderr, ++ "ENCODER: FATAL memory allocation failure " ++ "(encoder_set_audio_mkvCodecPriv): %s\n", ++ strerror(errno)); ++ exit(-1); ++ } ++ // write header ++ uint8_t *tmp = encoder_ctx->enc_audio_ctx->priv_data; ++ *tmp++ = 0x02; // number of packets -1 ++ // size of head 1 ++ for (i = 0; i < header_len[0] / 0xff; i++) ++ *tmp++ = 0xff; ++ *tmp++ = header_len[0] % 0xff; ++ // size of head 2 ++ for (i = 0; i < header_len[1] / 0xff; i++) ++ *tmp++ = 0xff; ++ *tmp++ = header_len[1] % 0xff; ++ // add headers ++ for (i = 0; i < 3; i++) { ++ memcpy(tmp, header_start[i], header_len[i]); ++ tmp += header_len[i]; ++ } ++ ++ listSupCodecs[real_index].mkv_codpriv = ++ encoder_ctx->enc_audio_ctx->priv_data; ++ listSupCodecs[real_index].codpriv_size = priv_data_size; ++ return listSupCodecs[real_index].codpriv_size; ++ } ++ ++ return 0; + } + + /* +@@ -648,16 +619,16 @@ int encoder_set_audio_mkvCodecPriv(encoder_context_t *encoder_ctx) + * + * returns: codec name entry + */ +-const char *encoder_get_audio_codec_name(int codec_ind) +-{ +- int real_index = get_real_index (codec_ind); +- if(real_index >= 0 && real_index < encoder_get_audio_codec_list_size()) +- return (listSupCodecs[real_index].name); +- else +- { +- fprintf(stderr, "ENCODER: (audio codec name) bad codec index (%i)\n", codec_ind);; +- return NULL; +- } ++const char *encoder_get_audio_codec_name(int codec_ind) { ++ int real_index = get_real_index(codec_ind); ++ if (real_index >= 0 && real_index < encoder_get_audio_codec_list_size()) ++ return (listSupCodecs[real_index].name); ++ else { ++ fprintf(stderr, "ENCODER: (audio codec name) bad codec index (%i)\n", ++ codec_ind); ++ ; ++ return NULL; ++ } + } + + /* +@@ -670,17 +641,16 @@ const char *encoder_get_audio_codec_name(int codec_ind) + * + * returns: codec index or -1 if error + */ +-int encoder_get_audio_codec_ind_name(const char *codec_name) +-{ +- int real_index = 0; +- int index = -1; +- for(real_index = 0; real_index < encoder_get_audio_codec_list_size(); ++real_index) +- { +- if(listSupCodecs[real_index].valid) +- index++; +- if(strcasecmp(codec_name, listSupCodecs[real_index].name) == 0) +- return index; +- } +- +- return -1; ++int encoder_get_audio_codec_ind_name(const char *codec_name) { ++ int real_index = 0; ++ int index = -1; ++ for (real_index = 0; real_index < encoder_get_audio_codec_list_size(); ++ ++real_index) { ++ if (listSupCodecs[real_index].valid) ++ index++; ++ if (strcasecmp(codec_name, listSupCodecs[real_index].name) == 0) ++ return index; ++ } ++ ++ return -1; + } +diff --git a/gview_encoder/encoder.c b/gview_encoder/encoder.c +index 83d63a1..9d29669 100644 +--- a/gview_encoder/encoder.c ++++ b/gview_encoder/encoder.c +@@ -212,6 +212,7 @@ void __attribute__((destructor)) gviewencoder_fini() { + /* + * check that a given sample format is supported by the encoder + * args: ++ * enc_ctx - pointer to AVCodecContext + * codec - pointer to AVCodec + * sample_fmt - audio sample format + * +@@ -220,9 +221,21 @@ void __attribute__((destructor)) gviewencoder_fini() { + * + * returns: 1 - sample format is supported; 0 - is not supported + */ +-static int encoder_check_audio_sample_fmt(const AVCodec *codec, ++static int encoder_check_audio_sample_fmt(const AVCodecContext *enc_ctx, ++ const AVCodec *codec, + enum AVSampleFormat sample_fmt) { +- const enum AVSampleFormat *p = codec->sample_fmts; ++const enum AVSampleFormat *sample_fmts; ++ ++#if LIBAVCODEC_VER_AT_LEAST(61, 19) ++ ++avcodec_get_supported_config(enc_ctx, codec, ++ AV_CODEC_CONFIG_SAMPLE_FORMAT, 0, ++ (const void **) &(sample_fmts), NULL); ++#else ++ sample_fmts = codec->sample_fmts; ++#endif ++ ++ const enum AVSampleFormat *p = sample_fmts; + + while (*p != AV_SAMPLE_FMT_NONE) { + if (*p == sample_fmt) +@@ -235,6 +248,7 @@ static int encoder_check_audio_sample_fmt(const AVCodec *codec, + /* + * check that a given sample rate is supported by the encoder + * args: ++ * enc_ctx - pointer to AVCodecContext + * codec - pointer to AVCodec + * sample_rate - audio sample rate + * +@@ -243,15 +257,28 @@ static int encoder_check_audio_sample_fmt(const AVCodec *codec, + * + * returns: sample_rate if supported or max supported sample rate if not + */ +-static int select_sample_rate(const AVCodec *codec, int sample_rate) { ++static int select_sample_rate(const AVCodecContext *enc_ctx, ++ const AVCodec *codec, ++ int sample_rate) { + const int *p; + int best_samplerate = 0; ++ const int *supported_samplerates; ++ ++#if LIBAVCODEC_VER_AT_LEAST(61, 19) + +- if (!codec->supported_samplerates) ++ avcodec_get_supported_config(enc_ctx, codec, ++ AV_CODEC_CONFIG_SAMPLE_RATE, 0, ++ (const void **) &supported_samplerates, NULL); ++#else ++ supported_samplerates = codec->supported_samplerates; ++#endif ++ ++ p = supported_samplerates; ++ ++ if (!supported_samplerates) + return sample_rate; + +- p = codec->supported_samplerates; +- while (*p) { ++ while (*p != 0) { + if (*p == sample_rate) + return sample_rate; + +@@ -260,6 +287,7 @@ static int select_sample_rate(const AVCodec *codec, int sample_rate) { + } + return best_samplerate; + } ++ + /* + * video encoder initialization for raw input + * (don't set a codec but set the proper codec 4cc) +@@ -834,7 +862,9 @@ encoder_audio_init(encoder_context_t *encoder_ctx) { + audio_codec_data->codec_context->codec_type = AVMEDIA_TYPE_AUDIO; + + int best_samprate = +- select_sample_rate(audio_codec_data->codec, encoder_ctx->audio_samprate); ++ select_sample_rate(audio_codec_data->codec_context, ++ audio_codec_data->codec, ++ encoder_ctx->audio_samprate); + + if (best_samprate != encoder_ctx->audio_samprate) { + fprintf( +@@ -848,20 +878,24 @@ encoder_audio_init(encoder_context_t *encoder_ctx) { + (AVRational){1, encoder_ctx->audio_samprate}; + + /*check if codec supports sample format*/ +- if (!encoder_check_audio_sample_fmt(audio_codec_data->codec, ++ if (!encoder_check_audio_sample_fmt(audio_codec_data->codec_context, ++ audio_codec_data->codec, + audio_defaults->sample_format)) { + /*replace by a supported format*/ + switch (audio_defaults->sample_format) { + case AV_SAMPLE_FMT_S16: +- if (encoder_check_audio_sample_fmt(audio_codec_data->codec, ++ if (encoder_check_audio_sample_fmt(audio_codec_data->codec_context, ++ audio_codec_data->codec, + AV_SAMPLE_FMT_S16P)) { + fprintf(stderr, "ENCODER: changing sample format (S16 -> S16P)\n"); + audio_defaults->sample_format = AV_SAMPLE_FMT_S16P; +- } else if (encoder_check_audio_sample_fmt(audio_codec_data->codec, ++ } else if (encoder_check_audio_sample_fmt(audio_codec_data->codec_context, ++ audio_codec_data->codec, + AV_SAMPLE_FMT_FLT)) { + fprintf(stderr, "ENCODER: changing sample format (S16 -> FLT)\n"); + audio_defaults->sample_format = AV_SAMPLE_FMT_FLT; +- } else if (encoder_check_audio_sample_fmt(audio_codec_data->codec, ++ } else if (encoder_check_audio_sample_fmt(audio_codec_data->codec_context, ++ audio_codec_data->codec, + AV_SAMPLE_FMT_FLTP)) { + fprintf(stderr, "ENCODER: changing sample format (S16 -> FLTP)\n"); + audio_defaults->sample_format = AV_SAMPLE_FMT_FLTP; +@@ -877,15 +911,18 @@ encoder_audio_init(encoder_context_t *encoder_ctx) { + break; + + case AV_SAMPLE_FMT_FLT: +- if (encoder_check_audio_sample_fmt(audio_codec_data->codec, ++ if (encoder_check_audio_sample_fmt(audio_codec_data->codec_context, ++ audio_codec_data->codec, + AV_SAMPLE_FMT_S16)) { + fprintf(stderr, "ENCODER: changing sample format (FLT -> S16)\n"); + audio_defaults->sample_format = AV_SAMPLE_FMT_S16; +- } else if (encoder_check_audio_sample_fmt(audio_codec_data->codec, ++ } else if (encoder_check_audio_sample_fmt(audio_codec_data->codec_context, ++ audio_codec_data->codec, + AV_SAMPLE_FMT_S16P)) { + fprintf(stderr, "ENCODER: changing sample format (FLT -> S16P)\n"); + audio_defaults->sample_format = AV_SAMPLE_FMT_S16P; +- } else if (encoder_check_audio_sample_fmt(audio_codec_data->codec, ++ } else if (encoder_check_audio_sample_fmt(audio_codec_data->codec_context, ++ audio_codec_data->codec, + AV_SAMPLE_FMT_FLTP)) { + fprintf(stderr, "ENCODER: changing sample format (FLT -> FLTP)\n"); + audio_defaults->sample_format = AV_SAMPLE_FMT_FLTP; +@@ -901,15 +938,18 @@ encoder_audio_init(encoder_context_t *encoder_ctx) { + break; + + case AV_SAMPLE_FMT_FLTP: +- if (encoder_check_audio_sample_fmt(audio_codec_data->codec, ++ if (encoder_check_audio_sample_fmt(audio_codec_data->codec_context, ++ audio_codec_data->codec, + AV_SAMPLE_FMT_S16)) { + fprintf(stderr, "ENCODER: changing sample format (FLTP -> S16)\n"); + audio_defaults->sample_format = AV_SAMPLE_FMT_S16; +- } else if (encoder_check_audio_sample_fmt(audio_codec_data->codec, ++ } else if (encoder_check_audio_sample_fmt(audio_codec_data->codec_context, ++ audio_codec_data->codec, + AV_SAMPLE_FMT_S16P)) { + fprintf(stderr, "ENCODER: changing sample format (FLTP -> S16P)\n"); + audio_defaults->sample_format = AV_SAMPLE_FMT_S16P; +- } else if (encoder_check_audio_sample_fmt(audio_codec_data->codec, ++ } else if (encoder_check_audio_sample_fmt(audio_codec_data->codec_context, ++ audio_codec_data->codec, + AV_SAMPLE_FMT_FLT)) { + fprintf(stderr, "ENCODER: changing sample format (FLTP -> FLT)\n"); + audio_defaults->sample_format = AV_SAMPLE_FMT_FLT; +diff --git a/gview_render/CMakeLists.txt b/gview_render/CMakeLists.txt +index e63ba39..4c9e2f3 100644 +--- a/gview_render/CMakeLists.txt ++++ b/gview_render/CMakeLists.txt +@@ -17,6 +17,7 @@ set_target_properties( + SOVERSION ${LIBSOVERSION} + ) + ++add_definitions("-Wall") + + if(SDL2_FOUND) + target_sources(gviewrender PRIVATE render_sdl2.c) +diff --git a/gview_render/render_fx.c b/gview_render/render_fx.c +index d65a4b2..ff2c9d5 100644 +--- a/gview_render/render_fx.c ++++ b/gview_render/render_fx.c +@@ -1,18 +1,23 @@ +-/*******************************************************************************# +-# guvcview http://guvcview.sourceforge.net # # # # Paulo +-Assis # # # # This +-program is free software; you can redistribute it and/or modify # # it +-under the terms of the GNU General Public License as published by # # +-the Free Software Foundation; either version 2 of the License, or # +-# (at your option) any later version. # # # # This program 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 General Public License for +-more details. # # # # You should have received +-a copy of the GNU General Public License # # along with this +-program; if not, write to the Free Software # # Foundation, +-Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # # +-********************************************************************************/ ++/******************************************************************************# ++# guvcview http://guvcview.sourceforge.net # ++# # ++# Paulo Assis # ++# # ++# This program is free software; you can redistribute it and/or modify # ++# it under the terms of the GNU General Public License as published by # ++# the Free Software Foundation; either version 2 of the License, or # ++# (at your option) any later version. # ++# # ++# This program 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 General Public License for more details. # ++# # ++# You should have received a copy of the GNU General Public License # ++# along with this program; if not, write to the Free Software # ++# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # ++# # ++*******************************************************************************/ + + #include + #include +@@ -90,8 +95,8 @@ static void fx_yu12_mirror(uint8_t *frame, int width, int height) { + + int h = 0; + int w = 0; +- int y_sizeline = width; +- int c_sizeline = width / 2; ++ //int y_sizeline = width; ++ //int c_sizeline = width / 2; + + uint8_t *end = NULL; + uint8_t *end2 = NULL; +@@ -157,8 +162,8 @@ static void fx_yu12_half_mirror(uint8_t *frame, int width, int height) { + uint8_t *pu = frame + (width * height); + uint8_t *pv = pu + ((width * height) / 4); + +- uint8_t pixel = 0; +- uint8_t pixel2 = 0; ++ //uint8_t pixel = 0; ++ //uint8_t pixel2 = 0; + + /*mirror y*/ + for (h = 0; h < height; h++) { +@@ -384,11 +389,11 @@ static void fx_yu12_binary(uint8_t *frame, int width, int height) { + */ + static void fx_yu12_pieces(uint8_t *frame, int width, int height, + int piece_size) { +- int numx = width / piece_size; // number of pieces in x axis +- int numy = height / piece_size; // number of pieces in y axis ++ //int numx = width / piece_size; // number of pieces in x axis ++ //int numy = height / piece_size; // number of pieces in y axis + + uint8_t piece[(piece_size * piece_size * 3) / 2]; +- uint8_t *ppiece = piece; ++ //uint8_t *ppiece = piece; + + int i = 0, j = 0, w = 0, h = 0; + +@@ -400,8 +405,8 @@ static void fx_yu12_pieces(uint8_t *frame, int width, int height, + int rot = 0; + + uint8_t *py = NULL; +- uint8_t *pu = NULL; +- uint8_t *pv = NULL; ++ //uint8_t *pu = NULL; ++ //uint8_t *pv = NULL; + + for (h = 0; h < height; h += piece_size) { + for (w = 0; w < width; w += piece_size) { +diff --git a/gview_render/render_sdl2.c b/gview_render/render_sdl2.c +index a2d336e..e671777 100644 +--- a/gview_render/render_sdl2.c ++++ b/gview_render/render_sdl2.c +@@ -81,7 +81,8 @@ static int video_init(int width, int height, int flags, int win_w, int win_h) { + + + SDL_SetHint("SDL_HINT_RENDER_SCALE_QUALITY", "1"); +- ++ //SDL_SetHint("SDL_HINT_VIDEO_WAYLAND_ALLOW_LIBDECOR", "0"); ++ + sdl_window = SDL_CreateWindow("Guvcview Video", // window title + SDL_WINDOWPOS_UNDEFINED, // initial x position + SDL_WINDOWPOS_UNDEFINED, // initial y position +diff --git a/gview_render/render_sfml.cpp b/gview_render/render_sfml.cpp +index 11e8fd5..ac47d32 100644 +--- a/gview_render/render_sfml.cpp ++++ b/gview_render/render_sfml.cpp +@@ -149,8 +149,8 @@ static sf::View getLetterboxView(sf::View view, int windowWidth, int windowHeigh + } + + SFMLRender::SFMLRender(int width, int height, int flags, int win_w, int win_h) { +- int w = width; +- int h = height; ++ unsigned int w = width; ++ unsigned int h = height; + + if (win_w > 0) + w = win_w; +diff --git a/gview_v4l2core/CMakeLists.txt b/gview_v4l2core/CMakeLists.txt +index 1ca4aa1..5ec3198 100644 +--- a/gview_v4l2core/CMakeLists.txt ++++ b/gview_v4l2core/CMakeLists.txt +@@ -28,6 +28,8 @@ set_target_properties( + SOVERSION ${LIBSOVERSION} + ) + ++add_definitions("-Wall") ++ + pkg_check_modules(V4L2 REQUIRED + libv4l2 libudev libusb-1.0 libavcodec>=57.16 libavutil libpng) + +diff --git a/gview_v4l2core/colorspaces.c b/gview_v4l2core/colorspaces.c +index 6a6951a..f849608 100644 +--- a/gview_v4l2core/colorspaces.c ++++ b/gview_v4l2core/colorspaces.c +@@ -520,7 +520,7 @@ void vyuy_to_yu12(uint8_t *out, uint8_t *in, int width, int height) { + + int w = 0, h = 0; + int y_sizeline = width; +- int c_sizeline = width / 2; ++ //int c_sizeline = width / 2; + + uint8_t *in1 = in; // first line + uint8_t *in2 = in1 + (width * 2); // second line in yuyv buffer +@@ -570,7 +570,7 @@ void yuv422p_to_yu12(uint8_t *out, uint8_t *in, int width, int height) { + memcpy(out, in, width * height); + + int w = 0, h = 0; +- int c_sizeline = width / 2; ++ //int c_sizeline = width / 2; + + uint8_t *pu = out + (width * height); + uint8_t *inu1 = in + (width * height); +@@ -613,7 +613,7 @@ void yyuv_to_yu12(uint8_t *out, uint8_t *in, int width, int height) { + + int w = 0, h = 0; + int y_sizeline = width; +- int c_sizeline = width / 2; ++ //int c_sizeline = width / 2; + + uint8_t *in1 = in; // first line + uint8_t *in2 = in1 + (width * 2); // second line in yyuv buffer +diff --git a/gview_v4l2core/frame_decoder.c b/gview_v4l2core/frame_decoder.c +index b2ec055..feb3acb 100644 +--- a/gview_v4l2core/frame_decoder.c ++++ b/gview_v4l2core/frame_decoder.c +@@ -733,7 +733,7 @@ int decode_v4l2_frame(v4l2_dev_t *vd, v4l2_frame_buff_t *frame) { + */ + int format = vd->requested_fmt; + +- int framesizeIn = (width * height << 1); // 2 bytes per pixel ++ //int framesizeIn = (width * height << 1); // 2 bytes per pixel + switch (format) { + case V4L2_PIX_FMT_H264: + /* +diff --git a/gview_v4l2core/jpeg_decoder.c b/gview_v4l2core/jpeg_decoder.c +index eccfadf..15a0105 100644 +--- a/gview_v4l2core/jpeg_decoder.c ++++ b/gview_v4l2core/jpeg_decoder.c +@@ -21,12 +21,6 @@ + # # + *******************************************************************************/ + +-/******************************************************************************# +-# # +-# M/Jpeg decoding and frame capture taken from luvcview # +-# # +-*******************************************************************************/ +- + #include + #include + #include +@@ -1315,7 +1309,7 @@ int jpeg_init_decoder(int width, int height) { + #endif + { + fprintf(stderr, "V4L2_CORE: (mjpeg decoder) couldn't open codec\n"); +- ++ + #if LIBAVCODEC_VER_AT_LEAST(61, 3) + avcodec_free_context(&codec_data->context); + #else +@@ -1421,32 +1415,34 @@ int jpeg_decode(uint8_t *out_buf, uint8_t *in_buf, int size) { + codec_data->context->pix_fmt, jpeg_ctx->width, + jpeg_ctx->height, jpeg_ctx->tmp_frame, jpeg_ctx->pic_size); + #endif +- /* requested libavcodec output format is yuv422p ++ /* requested libavcodec output format is yuv422p + * but apparently for some cameras +- * (https://sourceforge.net/u/shicetu/uos-guvcview/ci/fbdc4b23f0072c5285383d09d2724dbf962d8a7f/) ++ * (https://sourceforge.net/u/shicetu/uos-guvcview/ci/fbdc4b23f0072c5285383d09d2724dbf962d8a7f/) + * it can turn out be in yuv420p */ +- if (codec_data->context->pix_fmt == AV_PIX_FMT_YUV422P || ++ if (codec_data->context->pix_fmt == AV_PIX_FMT_YUV422P || + codec_data->context->pix_fmt == AV_PIX_FMT_YUVJ422P) { +- +- yuv422p_to_yu12(out_buf, jpeg_ctx->tmp_frame, jpeg_ctx->width, jpeg_ctx->height); ++ ++ yuv422p_to_yu12(out_buf, jpeg_ctx->tmp_frame, jpeg_ctx->width, ++ jpeg_ctx->height); + return jpeg_ctx->pic_size; + +- } else if (codec_data->context->pix_fmt == AV_PIX_FMT_YUVJ420P || ++ } else if (codec_data->context->pix_fmt == AV_PIX_FMT_YUVJ420P || + codec_data->context->pix_fmt == AV_PIX_FMT_YUV420P) { + +- if (jpeg_ctx->pic_size > (size_t)(jpeg_ctx->width * jpeg_ctx->height * 3 / 2)) +- jpeg_ctx->pic_size = (size_t)(jpeg_ctx->width * jpeg_ctx->height * 3 / 2); ++ if (jpeg_ctx->pic_size > ++ (size_t)(jpeg_ctx->width * jpeg_ctx->height * 3 / 2)) ++ jpeg_ctx->pic_size = ++ (size_t)(jpeg_ctx->width * jpeg_ctx->height * 3 / 2); + + memcpy(out_buf, jpeg_ctx->tmp_frame, jpeg_ctx->pic_size); + return jpeg_ctx->pic_size; +- ++ + } else { +- fprintf(stderr, "JPEG_DECODER: output pixel format not supported: %li\n", ++ fprintf(stderr, "JPEG_DECODER: output pixel format not supported: %i\n", + codec_data->context->pix_fmt); + } ++ } + +- } +- + return 0; + } + +diff --git a/gview_v4l2core/v4l2_controls.c b/gview_v4l2core/v4l2_controls.c +index ffae7cd..beca130 100644 +--- a/gview_v4l2core/v4l2_controls.c ++++ b/gview_v4l2core/v4l2_controls.c +@@ -1208,7 +1208,7 @@ void set_control_defaults(v4l2_dev_t *vd) { + } + + v4l2_ctrl_t *current = vd->list_device_controls; +- v4l2_ctrl_t *next = current->next; ++ //v4l2_ctrl_t *next = current->next; + + if (verbosity > 0) + printf("V4L2_CORE: loading defaults\n"); +-- +2.51.1 + diff --git a/0002-Fix-desktop-file-for-cmake.patch b/0002-Fix-desktop-file-for-cmake.patch new file mode 100644 index 0000000..1f8a1d9 --- /dev/null +++ b/0002-Fix-desktop-file-for-cmake.patch @@ -0,0 +1,85 @@ +From 39f76eda4d66ef7b2303ce795e701e43fafadff2 Mon Sep 17 00:00:00 2001 +From: Paulo Assis +Date: Mon, 2 Dec 2024 14:19:01 +0000 +Subject: [PATCH 2/2] Fix desktop file for cmake + +--- + data/guvcview.desktop.in | 64 +++++++++++++++++++++++++++++++++++++--- + 1 file changed, 60 insertions(+), 4 deletions(-) + +diff --git a/data/guvcview.desktop.in b/data/guvcview.desktop.in +index c086c21..ca02856 100644 +--- a/data/guvcview.desktop.in ++++ b/data/guvcview.desktop.in +@@ -1,8 +1,64 @@ + [Desktop Entry] +-_Name=guvcview +-_GenericName=GTK UVC video viewer +-_X-GNOME-FullName=GTK UVC video viewer +-_Comment=A video viewer and capturer for the linux uvc driver ++Name=guvcview ++Name[cs]=guvcview ++Name[de]=GUVCView ++Name[en_AU]=guvcview ++Name[es]=guvcview ++Name[fr]=guvcview ++Name[it]=guvcview ++Name[lv]=guvcview ++Name[nl]=guvcview ++Name[pt]=guvcview ++Name[pt_BR]=guvcview ++Name[ru]=guvcview ++Name[si]=guvcview ++Name[sr]=Камерица ++Name[tr]=guvcview ++GenericName=GTK UVC video viewer ++GenericName[cs]=Prohlížeč videa GTK UVC ++GenericName[de]=UVC-Video-Betrachter in GTK ++GenericName[en_AU]=GTK UVC video viewer ++GenericName[es]=Visualizador GTK de vídeo UVC ++GenericName[fr]=Logiciel GTK de visualisation de vidéo UVC ++GenericName[it]=GTK UVC visualizzatore video ++GenericName[lv]=GTK UVC video skatītājs ++GenericName[nl]=GTK UVC videokijker ++GenericName[pt]=Visualizador de vídeo GTK UVC ++GenericName[pt_BR]=Visualizador de vídeo GTK UVC ++GenericName[ru]=GTK UVC видео обозреватель ++GenericName[si]=GTK UVC වීඩියෝ දකින්නා ++GenericName[sr]=ГТК УВЦ видео приказивач ++GenericName[tr]=GTK UVC video görüntüleyici ++X-GNOME-FullName=GTK UVC video viewer ++X-GNOME-FullName[cs]=Prohlížeč videa GTK UVC ++X-GNOME-FullName[de]=UVC-Video-Betrachter in GTK ++X-GNOME-FullName[en_AU]=GTK UVC video viewer ++X-GNOME-FullName[es]=Visualizador GTK de vídeo UVC ++X-GNOME-FullName[fr]=Logiciel GTK de visualisation de vidéo UVC ++X-GNOME-FullName[it]=GTK UVC visualizzatore video ++X-GNOME-FullName[lv]=GTK UVC video skatītājs ++X-GNOME-FullName[nl]=GTK UVC videokijker ++X-GNOME-FullName[pt]=Visualizador de vídeo GTK UVC ++X-GNOME-FullName[pt_BR]=Visualizador de vídeo GTK UVC ++X-GNOME-FullName[ru]=GTK UVC видео обозреватель ++X-GNOME-FullName[si]=GTK UVC වීඩියෝ දකින්නා ++X-GNOME-FullName[sr]=ГТК УВЦ видео приказивач ++X-GNOME-FullName[tr]=GTK UVC video görüntüleyici ++Comment=A video viewer and capturer for the linux uvc driver ++Comment[cs]=Prohlížení a zachytávání videa z linuxových uvc ovladačů ++Comment[de]=Ein Video-Betrachter und Aufnahmewerkzeug für den Linux-UVC-Treiber ++Comment[en_AU]=A video viewer and capturer for the linux uvc driver ++Comment[es]=Un visualizador y capturador de vídeo para el controlador UVC de Linux ++Comment[fr]=Logiciel de visualisation et de capture vidéo pour le pilote uvc Linux ++Comment[it]=Un visualizzatore e catturatore video per il driver uvc di linux ++Comment[lv]=Video skatītājs un uzņēmējs Linux UVC draiverim ++Comment[nl]=Een programma voor het bekijken en opnemen van video, voor het Linuxstuurprogramma uvc ++Comment[pt]=Um visualizador e capturador de de vídeo para o controlador linux uvc ++Comment[pt_BR]=Um visualizador e capturador de de vídeo para o controlador linux uvc ++Comment[ru]=Программа просмотра и записи видео для драйвера Linux UVC ++Comment[si]=ලිනක්ස් uvc ඩ්‍රයිවරය සඳහා වීඩියෝ පෙන්වන්නා සහ ග්‍රහණය කරන්නා ++Comment[sr]=Приказивач и снимач видеа за линуксов увц управљачки програм ++Comment[tr]=Linux uvc sürücüsü için video görüntüleyici ve yakalayıcı + TryExec=guvcview + Exec=guvcview + Icon=@DATADIR@/pixmaps/guvcview.png +-- +2.51.1 + diff --git a/_multibuild b/_multibuild new file mode 100644 index 0000000..de9a3e0 --- /dev/null +++ b/_multibuild @@ -0,0 +1,3 @@ + + qt5 + diff --git a/fix-linking.patch b/fix-linking.patch new file mode 100644 index 0000000..d7a2617 --- /dev/null +++ b/fix-linking.patch @@ -0,0 +1,26 @@ +diff --git a/gview_encoder/CMakeLists.txt b/gview_encoder/CMakeLists.txt +index 8942bae..a39fdaf 100644 +--- a/gview_encoder/CMakeLists.txt ++++ b/gview_encoder/CMakeLists.txt +@@ -24,7 +24,7 @@ set_target_properties( + + pkg_check_modules(FFMPEG REQUIRED libavcodec libavutil) + +-target_link_libraries(gviewencoder ${FFMPEG_LIBRARIES}) ++target_link_libraries(gviewencoder ${FFMPEG_LIBRARIES} m) + add_definitions(${FFMPEG_CFLAGS} ${FFMPEG_CFLAGS_OTHER}) + + include_directories(${CMAKE_SOURCE_DIR}/includes) +diff --git a/gview_v4l2core/CMakeLists.txt b/gview_v4l2core/CMakeLists.txt +index 1ca4aa1..e204238 100644 +--- a/gview_v4l2core/CMakeLists.txt ++++ b/gview_v4l2core/CMakeLists.txt +@@ -31,7 +31,7 @@ set_target_properties( + pkg_check_modules(V4L2 REQUIRED + libv4l2 libudev libusb-1.0 libavcodec>=57.16 libavutil libpng) + +-target_link_libraries(gviewv4l2core ${V4L2_LIBRARIES}) ++target_link_libraries(gviewv4l2core ${V4L2_LIBRARIES} m) + add_definitions(${V4L2_CFLAGS} ${V4L2_CFLAGS_OTHER}) + + add_compile_definitions(GETTEXT_PACKAGE_V4L2CORE="gview_v4l2core") diff --git a/fix-pkgconfig-path.patch b/fix-pkgconfig-path.patch new file mode 100644 index 0000000..549d885 --- /dev/null +++ b/fix-pkgconfig-path.patch @@ -0,0 +1,52 @@ +diff --git a/gview_audio/CMakeLists.txt b/gview_audio/CMakeLists.txt +index 9714745..3bea235 100644 +--- a/gview_audio/CMakeLists.txt ++++ b/gview_audio/CMakeLists.txt +@@ -42,7 +42,7 @@ if(INSTALL_DEVKIT) + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/gviewaudio.h TYPE INCLUDE) + install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/libgviewaudio.pc +- DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/pkgconfig ++ DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig + ) + endif() + +diff --git a/gview_encoder/CMakeLists.txt b/gview_encoder/CMakeLists.txt +index a39fdaf..dae9b1f 100644 +--- a/gview_encoder/CMakeLists.txt ++++ b/gview_encoder/CMakeLists.txt +@@ -36,7 +36,7 @@ if(INSTALL_DEVKIT) + + install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/libgviewencoder.pc +- DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/pkgconfig ++ DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig + ) + endif() + +diff --git a/gview_render/CMakeLists.txt b/gview_render/CMakeLists.txt +index e63ba39..8cc3e7d 100644 +--- a/gview_render/CMakeLists.txt ++++ b/gview_render/CMakeLists.txt +@@ -53,7 +53,7 @@ if(INSTALL_DEVKIT) + + install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/libgviewrender.pc +- DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/pkgconfig ++ DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig + ) + endif() + +diff --git a/gview_v4l2core/CMakeLists.txt b/gview_v4l2core/CMakeLists.txt +index e204238..8eed292 100644 +--- a/gview_v4l2core/CMakeLists.txt ++++ b/gview_v4l2core/CMakeLists.txt +@@ -44,7 +44,7 @@ if(INSTALL_DEVKIT) + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/gviewv4l2core.h TYPE INCLUDE) + install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/libgviewv4l2core.pc +- DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/pkgconfig ++ DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig + ) + endif() + diff --git a/guvcview-SUSE.patch b/guvcview-SUSE.patch new file mode 100644 index 0000000..b4d5445 --- /dev/null +++ b/guvcview-SUSE.patch @@ -0,0 +1,36 @@ +From: Luigi Baldoni +Date: 2017-07-28 17:04:22 +0200 +Subject: SUSE-specific paths + +Change filenames and paths to SUSE standards instead +of messing with them in the .spec file. + +Index: guvcview-src-2.0.8/Makefile.am +=================================================================== +--- guvcview-src-2.0.8.orig/Makefile.am ++++ guvcview-src-2.0.8/Makefile.am +@@ -27,14 +27,6 @@ pkgconfig_DATA = pkgconfig/libgviewv4l2c + + ACLOCAL_AMFLAGS = -I m4 + +-docdir = ${datadir}/doc/guvcview +-doc_DATA = \ +- README.md\ +- COPYING\ +- AUTHORS\ +- ChangeLog\ +- INSTALL +- + EXTRA_DIST = bootstrap.sh + + check-gettext: +Index: guvcview-src-2.0.8/data/icons/Makefile.am +=================================================================== +--- guvcview-src-2.0.8.orig/data/icons/Makefile.am ++++ guvcview-src-2.0.8/data/icons/Makefile.am +@@ -1,4 +1,4 @@ +-iconsdir = ${datadir}/pixmaps/guvcview ++iconsdir = ${datadir}/pixmaps/ + icons_DATA = \ + guvcview.png + diff --git a/guvcview-qt.desktop b/guvcview-qt.desktop new file mode 100644 index 0000000..4bd3729 --- /dev/null +++ b/guvcview-qt.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Name=guvcview-qt6 +GenericName=Qt UVC video viewer +Comment=A video viewer and capturer for the linux uvc driver +TryExec=guvcview-qt6 +Exec=guvcview-qt6 +Icon=/usr/share/pixmaps/guvcview.png +Terminal=false +Type=Application +Categories=Video;AudioVideo; +StartupNotify=true diff --git a/guvcview-qt5-nolibs_qt5names.patch b/guvcview-qt5-nolibs_qt5names.patch new file mode 100644 index 0000000..01f62fd --- /dev/null +++ b/guvcview-qt5-nolibs_qt5names.patch @@ -0,0 +1,83 @@ +From: Luigi Baldoni +Date: 2017-07-28 17:05:35 +0200 +Subject: Modifications for the -qt5 package + +Don't build libraries and rely on those supplied by the +regular (GTK+) package. +Also change a few filenames to avoid collisions. + +Index: guvcview-src-2.0.8/Makefile.am +=================================================================== +--- guvcview-src-2.0.8.orig/Makefile.am ++++ guvcview-src-2.0.8/Makefile.am +@@ -1,13 +1,8 @@ + ## Process this file with automake to produce Makefile.in + +-SUBDIRS = gview_v4l2core \ +- gview_audio \ +- gview_render \ +- gview_encoder \ +- guvcview \ ++SUBDIRS = guvcview \ + data \ +- po \ +- po/gview_v4l2core ++ po + + #Distribute these directories: + DIST_SUBDIRS = gview_v4l2core \ +@@ -19,12 +14,6 @@ DIST_SUBDIRS = gview_v4l2core \ + po \ + po/gview_v4l2core + +-pkgconfigdir = $(libdir)/pkgconfig +-pkgconfig_DATA = pkgconfig/libgviewv4l2core.pc \ +- pkgconfig/libgviewaudio.pc \ +- pkgconfig/libgviewrender.pc \ +- pkgconfig/libgviewencoder.pc +- + ACLOCAL_AMFLAGS = -I m4 + + EXTRA_DIST = bootstrap.sh +Index: guvcview-src-2.0.8/guvcview/Makefile.am +=================================================================== +--- guvcview-src-2.0.8.orig/guvcview/Makefile.am ++++ guvcview-src-2.0.8/guvcview/Makefile.am +@@ -57,14 +57,14 @@ guvcview_CPPFLAGS = $(guvcview_CFLAGS) \ + -fPIC + endif + +-guvcview_LDFLAGS = $(LIBINTL) ++guvcview_LDFLAGS = $(LIBINTL) \ ++ $(shell pkg-config --libs libgviewv4l2core) \ ++ $(shell pkg-config --libs libgviewrender) \ ++ $(shell pkg-config --libs libgviewaudio) \ ++ $(shell pkg-config --libs libgviewencoder) + +-guvcview_LDADD = ../gview_v4l2core/$(GVIEWV4L2CORE_LIBRARY_NAME).la \ +- ../gview_render/$(GVIEWRENDER_LIBRARY_NAME).la \ +- ../gview_audio/$(GVIEWAUDIO_LIBRARY_NAME).la \ +- ../gview_encoder/$(GVIEWENCODER_LIBRARY_NAME).la \ +- $(PTHREAD_LIBS) \ +- -lm ++guvcview_LDADD = -lpthread \ ++ -lm + if HAVE_GTK3 + guvcview_LDADD += $(GUIGTK3_LIBS) + endif +Index: guvcview-src-2.0.8/configure.ac +=================================================================== +--- guvcview-src-2.0.8.orig/configure.ac ++++ guvcview-src-2.0.8/configure.ac +@@ -73,9 +73,9 @@ GETTEXT_PACKAGE_V4L2CORE=gview_v4l2core + AC_SUBST(GETTEXT_PACKAGE_V4L2CORE) + AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE_V4L2CORE,"$GETTEXT_PACKAGE_V4L2CORE", [gview_v4l2core]) + +-GETTEXT_PACKAGE=guvcview ++GETTEXT_PACKAGE=guvcview-qt5 + AC_SUBST(GETTEXT_PACKAGE) +-AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [guvcview]) ++AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [guvcview-qt5]) + + IT_PROG_INTLTOOL([0.40]) + IT_PO_SUBDIR(po/gview_v4l2core) diff --git a/guvcview-src-2.1.0.tar.bz2 b/guvcview-src-2.1.0.tar.bz2 new file mode 100644 index 0000000..5762595 --- /dev/null +++ b/guvcview-src-2.1.0.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3d93e4c9fab8d1a7a9bde1a6dbbf04d6cf9d347c134b5128b4586a1d90b63cfb +size 775670 diff --git a/guvcview-src-2.2.1.tar.bz2 b/guvcview-src-2.2.1.tar.bz2 new file mode 100644 index 0000000..1e0d7c1 --- /dev/null +++ b/guvcview-src-2.2.1.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d2adc7ce762961e853c3e16b511bad61504492d12f3e2eb7e30da4a2f7ade5af +size 355747 diff --git a/guvcview.changes b/guvcview.changes new file mode 100644 index 0000000..9b58b1d --- /dev/null +++ b/guvcview.changes @@ -0,0 +1,337 @@ +------------------------------------------------------------------- +Wed Nov 12 19:15:51 UTC 2025 - Martin Hauke + +- Add desktop file for guvcview-qt6 + +------------------------------------------------------------------- +Tue Nov 4 14:01:22 UTC 2025 - Martin Hauke + +- Switch to cmake +- Drop multibuild; use a wrapper script instead +- Use %ldconfig_scriptlets +- Update to version 2.2.1 + * Fix encoder video timestamps + * Fix encoder video codec defaults + * Move from qt5 to qt6 + * Change build system from autoconf to cmake + * Add support for yuv420p pixel format for MJPG decoding +- Drop patches (not longer needed): + * 0001-Fix-build-with-GCC-14.patch + * guvcview-SUSE.patch + * guvcview-qt5-nolibs_qt5names.patch + * 0001-Fix-build-with-GCC-14.patch +- Add patches: + * 0001-fix-deprecation-warning-with-ffpmeg-7.1-add-Wall-to-.patch + * 0002-Fix-desktop-file-for-cmake.patch + * fix-linking.patch + * fix-pkgconfig-path.patch + +------------------------------------------------------------------- +Thu Mar 13 18:44:01 UTC 2025 - Jan Engelhardt + +- Use pkgconfig() to be impervious to package renames. + +------------------------------------------------------------------- +Tue Aug 27 18:06:06 UTC 2024 - Dave Plater + +- Revert to ffmpeg-7 + +------------------------------------------------------------------- +Tue Aug 27 10:47:09 UTC 2024 - Dave Plater + +- Force ffmpeg-6 library use in order to fix build + +------------------------------------------------------------------- +Tue Aug 27 08:07:37 UTC 2024 - Christophe Marin + +- Update to 2.1.0 + * Fix audio channels deprecated warning for avcodec >= 58 + * Add button click support for certain type of digital + microscopes + * Small fixes + * Fix minimum version for audio channels api deprecated + warning for avcodec >= 59 + * Fix COPYING to the same GPL version (v2) as the source files + * Add binary fx filter + * Make guvcview skip metadada devices + * Enable OSD crosshair size to be changed in config +- Add patch to fix build failure with GCC 14: + * 0001-Fix-build-with-GCC-14.patch +- Fix license. There's no GPL-3.0-only file that could impact + the binaries license. +- Spec cleanup + +------------------------------------------------------------------- +Tue Feb 27 11:16:13 UTC 2024 - Dominique Leuenberger + +- Use %patch -P N instead of deprecated %patchN. + +------------------------------------------------------------------- +Mon Aug 8 22:06:07 UTC 2022 - Atri Bhattacharya + +- Update to version 2.0.8: + * Fix libav API break (ticket #70) + * Update autoconf scripts + * Support for building against ffmpeg5. +- Changes from version 2.0.7: + * Fix audio encoder (tickets #64 and #65) + * Use current theme icons (get icon by name) +- Convert to multibuild with qt5 as additional flavor: + * Drop guvcview-qt5.spec, guvcview-qt5.changes, pre_checkin.sh + script. + * Drop hunks from guvcview-qt5-nolibs_qt5names.patch duplicated + in guvcview-SUSE.patch. + * Adapt BuildRequires for the additional flavour appropriately. +- Update so versions in keeping with upstream shlib versioning. +- Replace packageand type Supplements with RPM binary Supplements. +- Update guvcview-SUSE.patch to drop icon dir restructuring: no + longer needed after all theme-able application icons dropped. + +------------------------------------------------------------------- +Mon Feb 3 13:51:18 UTC 2020 - Dominique Leuenberger + +- BuildRequire pkgconfig(libudev) instead of libudev-devel: allow + OBS to shortcut through the -mini flavors. + +------------------------------------------------------------------- +Tue Feb 12 18:24:24 UTC 2019 - bjorn.lie@gmail.com + +- Update to version 2.0.6: + * No upstream changes provided, please see + https://sourceforge.net/p/guvcview/git-master/ci/master/tree/ +- No longer force use ffmpeg3 version of pkgconfig(libav*). +- Drop guvcview-qt5-ppc64_QVariant.patch: Fixed upstream. +- Rebase guvcview-qt5-nolibs_qt5names.patch with quilt. + +------------------------------------------------------------------- +Fri May 4 14:03:47 UTC 2018 - olaf@aepfle.de + +- Use ffmpeg3 versions of pkgconfig(libav*) + +------------------------------------------------------------------- +Mon Sep 11 18:48:13 UTC 2017 - jengelh@inai.de + +- Update summary of -devel subpackage. + +------------------------------------------------------------------- +Sat Jul 29 10:53:31 UTC 2017 - aloisio@gmx.com + +- Update to version 2.0.5 + * terminate configure if qt5 is enabled and moc is missing + * add sfml render + * fix aac encoder (replace experimental aac by libvo_aacenc) + * fix build against newer kernels + * disable window key pressed events if a string control has focus + * fix video monotonic pts flag value in encoder context + * fix audio cleanup + * add support for HEVC (h265) video codec + * fix muxed h264 support; fix raw output (alloc outbuf frame) + * add circular buffer for delayed audio frames pts + * remove support for older libavcodec versions (< 54.01) + * add support for VP9 + * fix motion estimation method for x264 [1-4] + * fix buggy behaviour for file names without extension + * add support for sfml render + * drop support for sdl1 based render + * Flavio Spagnuolo : fix matroska + clean up when audio is disabled + * fix segfault when destroying mutexes by unlocking already + unlocked mutexes + * fix libc readdir_r deprecated warning: replace by readdir + * add extra video fx filters + +- Dropped guvcview-2.0.4_ffmpeg-3.0.patch (merged upstream) + +- Split lang package contents between guvcview-lang and a new + libgviewv4l2core-lang + +- Added separate -qt5 and -qt5-lang packages and pre_checkin.sh + and guvcview-qt5-nolibs_qt5names.patch to support them + +- Added guvcview-qt5-ppc64_QVariant.patch to fix build on ppc64 + +- Replaced some in-spec commands with guvcview-SUSE.patch + +------------------------------------------------------------------- +Thu Mar 2 10:28:49 UTC 2017 - jengelh@inai.de + +- Rename %soname to %sover to better reflect its use +- Ensure description neutrality + +------------------------------------------------------------------- +Sun May 1 18:06:05 UTC 2016 - aloisio@gmx.com + +- Update to version 2.0.4: + * drop support for internal 422 packed format (use only 420 planar) + * add support for extra pixel formats, including be formats + * add command line option for requesting fps + * add support for control events + * add support for string, int64, bitmask and integer menu controls + * make sure we can't select unsuported pix formats from the gui + * fix status message for QT5 interface + * move mutexes to device handlers (context) + * v4l2core and audio api - don't access device data directly (use opaque structures) + * add constructor and destructor functions for v4l2core and encoder + Paulo Assis Mon, 22 Feb 2016 10:10:00 +0100 + 2.0.3: + * Add Qt5 interface (--enable-qt5) + * fix '-n' option (don't save frame when photo countdown reaches 0) + * restore exit_on_term option + * use AC_SYS_LARGEFILE m4 macro for enabling Large File Support (LFS) on 32 bit systems + * add color config for crosshair osd + * change rendering engine to use updateTexture instead of lock/unlock texture + * change rendering lib to avoid frame copy when using osd + Paulo Assis Mon, 4 Jan 2016 23:34:00 +0100 + +- Dropped guvcview-implicit-pointer-decl.patch + guvcview-no-return-in-nonvoid-function.patch + guvcview-voidreturn.patch + +- Added guvcview-2.0.4_ffmpeg-3.0.patch + +------------------------------------------------------------------- +Tue Sep 22 08:47:31 UTC 2015 - olaf@aepfle.de + +- Use pkgconfig for ffmpeg BuildRequires + +------------------------------------------------------------------- +Wed Aug 05 10:49:17 UTC 2015 - joerg.lorenzen@ki.tng.de + +- Update to version 2.0.2: + + fix mjpeg and h264 decoders (libav): init avpacket. + + fix wrong logic of enable switches (Marvin Schmidt ticket #12). + + create a frame queue and refactor frame grab/decode. + + fix jpeg decoder for older libavcodec api ( < 54.25). + + attach video capture to SIGUSR1 signal. + + add audio latency control to gui. + + change default portaudio latency to high latency. + + set device during initialization. + + use time for matroska segment uid if gsl is disabled. + + fix array index causing buffer overflow. + + restore CPPFLAGS after AC_CHECK_HEADERS. + + remove direct access to device data in v4l2core lib. + + make sure to stop encoder thread before exiting capture thread. + + avoid SIGFPE on bad channels or samprate data inside audio + capture callbacks. + + remove check for avcodec.h (it's needed for very old libavcodec + versions); set iyuv as default internal format (over yuyv). + + add basic support for continuous and stepwise frame sizes. + + add support for empty control list. + + add code for crossair osd. + + fix h264 demux from mjpg container. + + fix pan/tilt for logitech peripheral V3 (use raw control + instead of v4l2). + +------------------------------------------------------------------- +Fri Oct 31 11:53:42 UTC 2014 - joerg.lorenzen@ki.tng.de + +- Update to version 2.0.1: + + Fix audio clean bug (segfault when audio=none). + + Add --disable_libv4l2 option. + + Add support for internal yu12 planar format. + + Workaround uvcvideo bug (buf.bytesused=0 on kernels >=3.16). +- Changes since version 2.0.0: + + New version 2.0.0 (code rewriten from scratch). + + Move all core functions to 4 shared libs. + + Change options. + + Change config. + + Add sdl2 render. + + Use gsl for random number generation. +- Changes since version 1.7.3: + + Add silence frames to compensate audio drift (delay). + + Fix possible memory leak. + + Add video and image capture through system signals: + SIGUSR1 and SIGUSR2. + + Add true no_display mode (no X required). + + Small bug fixes. +- Changes since version 1.7.2: + + Add H264 decoding support. + + Sync translations. +- Changes since version 1.7.1: + + Fix avi muxer: fix opendml indexes (>= 1Gb). + + Update Italian translation. + +------------------------------------------------------------------- +Tue Jul 30 13:34:46 UTC 2013 - i@margueirte.su + +- build against libffmpeg-devel. + +------------------------------------------------------------------- +Sat Jul 20 20:41:27 UTC 2013 - zaitor@opensuse.org + +- Update to version 1.7.0: + + Refactor avi muxer (base it on libav muxer with opendml + support). + + Refactor mkv muxer (base it on libav muxer with webm support). + + Add VP8, Theora and Vorbis codecs. + + Add Webm support. + + Add a Top Menu. + + Move all file operations to the Top Menu. + +------------------------------------------------------------------- +Fri Sep 20 12:27:00 UTC 2012 - zaitor@opensuse.org + +- Update to version 1.6.1: + + Fix build with latest libavcodec. + + Fix audio codecs listing. + + Fix audio codecs (AC3 and AAC) input format for latest + libavcodec API (float). + + Add support for delayed frames in video encoding. +- Changes since version 1.6.0: + + Run audio in separate thread. + + Update audio buffer. + + Move pulse audio interface from simple to async API. + + Add pulse device list. + + Enable build of pulse API by default. +- Added new build dependency, intltool. + +------------------------------------------------------------------- +Sun May 20 14:28:10 UTC 2012 - zaitor@opensuse.org + +- Update to version 1.5.3: + + Update libavcodec API. + + Add libavutil dependency. + + Fix pulse interface. + + Update language catalogs. +- Drop guvcview-pulseaudio-fix.patch, fixed upstream. +- Change BuildRequires: pulseaudio-devel to libpulse-devel. + +------------------------------------------------------------------- +Sun Feb 26 15:52:45 UTC 2012 - zaitor@opensuse.org + +- Update to version 1.5.2: + + Move to pthreads (fix gthread API 2 issues). + + Add italian translation. + + Fix several libavcodec issues. + + Fix some gtk3 widgets. +- Drop guvcview-fix-glib-include.patch, fixed upstream. +- Add guvcview-pulseaudio-fix.patch: Fix pulseaudio interface. + +------------------------------------------------------------------- +Mon Jan 23 00:48:09 UTC 2012 - malcolmlewis@opensuse.org + +- Updated to version 1.5.1: + + Moved to gtk3. + + Make control window size dependent on screen resolution. + + Threaded coding patch - George Sedov . + + Fix h264 codec properties. +- Updates from version 1.5.0: + + Add a no display mode (--no_display). + + Fix build issues with newer versions (>=0.7.x) of ffmpeg + libavcodec. + + Add support for unix signals. + + Add VU meter OSD. + + Fix menu controls (linux 3.0). +- Add guvcview-fix-glib-include.patch: To fix only can be + included directly error for builds > 1210. + +------------------------------------------------------------------- +Mon Oct 3 19:28:19 UTC 2011 - malcolmlewis@opensuse.org + +- Fix guvcview.desktop file in spec file. + +------------------------------------------------------------------- +Fri Jul 1 02:06:44 UTC 2011 - malcolmlewis@opensuse.org + +- Initial build based on fc15 spec file. + diff --git a/guvcview.spec b/guvcview.spec new file mode 100644 index 0000000..8bc09d3 --- /dev/null +++ b/guvcview.spec @@ -0,0 +1,213 @@ +# +# spec file for package guvcview +# +# Copyright (c) 2025 SUSE LLC and contributors +# Copyright (c) 2012 Malcolm J Lewis +# Copyright (c) 2013 Marguerite Su +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +%define sover 2_2-2 +Name: guvcview +Version: 2.2.1 +Release: 0 +Summary: GTK+ UVC Viewer and Capturer +# Reference to GPL-2.0 in some files? +License: GPL-2.0-or-later +Group: Productivity/Multimedia/Video/Players +URL: https://guvcview.sourceforge.net/ +#Git-Clone: git://git.code.sf.net/p/guvcview/git-master +Source0: https://sourceforge.net/projects/guvcview/files/source/guvcview-src-%{version}.tar.bz2 +Source1: guvcview-qt.desktop +Patch3: 0001-fix-deprecation-warning-with-ffpmeg-7.1-add-Wall-to-.patch +Patch4: 0002-Fix-desktop-file-for-cmake.patch +Patch5: fix-linking.patch +Patch6: fix-pkgconfig-path.patch +# +BuildRequires: cmake +BuildRequires: fdupes +BuildRequires: gcc-c++ +BuildRequires: libpng-devel +BuildRequires: pkgconfig +BuildRequires: pkgconfig(alsa) +BuildRequires: pkgconfig(gsl) +BuildRequires: pkgconfig(gtk+-3.0) +# use ffmpeg7 +BuildRequires: ffmpeg-7-libavcodec-devel +BuildRequires: ffmpeg-7-libavutil-devel +# +BuildRequires: pkgconfig(libpulse) +BuildRequires: pkgconfig(Qt6Core) +BuildRequires: pkgconfig(Qt6Gui) +BuildRequires: pkgconfig(Qt6Widgets) +BuildRequires: pkgconfig(libudev) +BuildRequires: pkgconfig(libusb-1.0) +BuildRequires: pkgconfig(libv4l2) +BuildRequires: pkgconfig(portaudio-2.0) +BuildRequires: pkgconfig(sdl2) +Recommends: %{name}-lang + +%description +A GTK interface for capturing and viewing video from devices +supported by the Linux UVC driver, although it should also work with +any v4l2 compatible device. + +%package -n libgviewaudio-%{sover} +Summary: GTK+ UVC Viewer and Capturer +Group: System/Libraries + +%description -n libgviewaudio-%{sover} +A GTK interface for capturing and viewing video from devices +supported by the Linux UVC driver, although it should also work with +any v4l2 compatible device. + +%package -n libgviewencoder-%{sover} +Summary: GTK+ UVC Viewer and Capturer +Group: System/Libraries + +%description -n libgviewencoder-%{sover} +A GTK interface for capturing and viewing video from devices +supported by the Linux UVC driver, although it should also work with +any v4l2 compatible device. + +%package -n libgviewrender-%{sover} +Summary: GTK+ UVC Viewer and Capturer +Group: System/Libraries + +%description -n libgviewrender-%{sover} +A GTK interface for capturing and viewing video from devices +supported by the Linux UVC driver, although it should also work with +any v4l2 compatible device. + +%package -n libgviewv4l2core-%{sover} +Summary: GTK+ UVC Viewer and Capturer +Group: System/Libraries +Recommends: libgviewv4l2core-lang + +%description -n libgviewv4l2core-%{sover} +A GTK interface for capturing and viewing video from devices +supported by the Linux UVC driver, although it should also work with +any v4l2 compatible device. + +%package devel +Summary: Development files for guvcview +Group: Development/Libraries/C and C++ +Requires: glibc-devel +Requires: libgviewaudio-%{sover} = %{version}-%{release} +Requires: libgviewencoder-%{sover} = %{version}-%{release} +Requires: libgviewrender-%{sover} = %{version}-%{release} +Requires: libgviewv4l2core-%{sover} = %{version}-%{release} +Requires: libpng-devel +Requires: pkgconfig(alsa) +Requires: pkgconfig(gsl) +Requires: pkgconfig(libavcodec) +Requires: pkgconfig(libavutil) +Requires: pkgconfig(libpulse) +Requires: pkgconfig(libudev) +Requires: pkgconfig(libusb-1.0) +Requires: pkgconfig(libv4l2) +Requires: pkgconfig(portaudio-2.0) +Requires: pkgconfig(sdl2) + +%description devel +A GTK interface for capturing and viewing video from devices +supported by the Linux UVC driver, although it should also work with +any v4l2 compatible device. + +This subpackage contains the header files for developing +applications that want to make use of the GUVC libraries. + +%lang_package + +%package -n libgviewv4l2core-lang +Summary: Languages for libgviewv4l2core +Group: System/Localization +Requires: libgviewv4l2core-%{sover} = %{version} +Provides: libgviewv4l2core-lang-all = %{version} +Supplements: (bundle-lang-other and libgviewv4l2core-%{sover}) +BuildArch: noarch + +%description -n libgviewv4l2core-lang +Provides translations to libgviewv4l2core. + +%prep +%autosetup -p1 -n %{name}-src-%{version} + +%build +%cmake \ + -DUSE_GTK3=ON \ + -DUSE_QT6=ON \ + -DUSE_SDL2=ON \ + -DINSTALL_DEVKIT=ON +%make_jobs + +%install +%cmake_install + +# wrapper for guvcview-qt6 +echo -e "#!/bin/sh\nexec %{_bindir}/guvcview --gui=qt6 \"\$@\"" > %{buildroot}%{_bindir}/guvcview-qt6 +chmod 755 %{buildroot}%{_bindir}/guvcview-qt6 + +install -Dpm 0644 %{SOURCE1} %{buildroot}%{_datadir}/applications/%{name}-qt6.desktop + +%find_lang %{name} %{?no_lang_C} +%find_lang gview_v4l2core libgviewv4l2core.lang %{?no_lang_C} + +%ldconfig_scriptlets -n libgviewaudio-%{sover} +%ldconfig_scriptlets -n libgviewencoder-%{sover} +%ldconfig_scriptlets -n libgviewrender-%{sover} +%ldconfig_scriptlets -n libgviewv4l2core-%{sover} + +%files +%license COPYING +%doc AUTHORS ChangeLog README.md +%{_bindir}/%{name} +%{_bindir}/%{name}-qt6 +%{_datadir}/applications/%{name}.desktop +%{_datadir}/applications/%{name}-qt6.desktop +%{_datadir}/appdata/%{name}.appdata.xml +%{_datadir}/pixmaps/%{name}.png +%{_mandir}/man1/%{name}.1%{?ext_man} + +%files -n libgviewaudio-%{sover} +%{_libdir}/libgviewaudio.so.* + +%files -n libgviewencoder-%{sover} +%{_libdir}/libgviewencoder.so.* + +%files -n libgviewrender-%{sover} +%{_libdir}/libgviewrender.so.* + +%files -n libgviewv4l2core-%{sover} +%{_libdir}/libgviewv4l2core.so.* + +%files devel +%{_includedir}/gviewaudio.h +%{_includedir}/gviewencoder.h +%{_includedir}/gviewrender.h +%{_includedir}/gviewv4l2core.h +%{_libdir}/libgviewaudio.so +%{_libdir}/libgviewencoder.so +%{_libdir}/libgviewrender.so +%{_libdir}/libgviewv4l2core.so +%{_libdir}/pkgconfig/libgviewaudio.pc +%{_libdir}/pkgconfig/libgviewencoder.pc +%{_libdir}/pkgconfig/libgviewrender.pc +%{_libdir}/pkgconfig/libgviewv4l2core.pc + +%files -n libgviewv4l2core-lang -f libgviewv4l2core.lang + +%files lang -f %{name}.lang + +%changelog -- 2.51.1 From 2c2562bf36230872fd5796fc74b823b555523376747014777890e9dd8df1dad6 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Sat, 15 Nov 2025 08:22:24 +0000 Subject: [PATCH 5/5] - Update to version 2.2.2 * Apply ffmpeg8 and musl patches by Paul Zander. * Update to SFML 3.0 . * Fix some spelling errors. * Add support for OBSMEET4K. - Drop patches: * 0001-fix-deprecation-warning-with-ffpmeg-7.1-add-Wall-to-.patch * 0002-Fix-desktop-file-for-cmake.patch OBS-URL: https://build.opensuse.org/package/show/multimedia:apps/guvcview?expand=0&rev=30 --- .gitattributes | 23 + .gitignore | 1 + 0001-Fix-build-with-GCC-14.patch | 40 + ...warning-with-ffpmeg-7.1-add-Wall-to-.patch | 1500 +++++++++++++++++ 0002-Fix-desktop-file-for-cmake.patch | 85 + _multibuild | 3 + fix-linking.patch | 26 + fix-pkgconfig-path.patch | 52 + guvcview-SUSE.patch | 36 + guvcview-qt.desktop | 11 + guvcview-qt5-nolibs_qt5names.patch | 83 + guvcview-src-2.1.0.tar.bz2 | 3 + guvcview-src-2.2.1.tar.bz2 | 3 + guvcview-src-2.2.2.tar.bz2 | 3 + guvcview.changes | 349 ++++ guvcview.spec | 208 +++ 16 files changed, 2426 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 0001-Fix-build-with-GCC-14.patch create mode 100644 0001-fix-deprecation-warning-with-ffpmeg-7.1-add-Wall-to-.patch create mode 100644 0002-Fix-desktop-file-for-cmake.patch create mode 100644 _multibuild create mode 100644 fix-linking.patch create mode 100644 fix-pkgconfig-path.patch create mode 100644 guvcview-SUSE.patch create mode 100644 guvcview-qt.desktop create mode 100644 guvcview-qt5-nolibs_qt5names.patch create mode 100644 guvcview-src-2.1.0.tar.bz2 create mode 100644 guvcview-src-2.2.1.tar.bz2 create mode 100644 guvcview-src-2.2.2.tar.bz2 create mode 100644 guvcview.changes create mode 100644 guvcview.spec diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/0001-Fix-build-with-GCC-14.patch b/0001-Fix-build-with-GCC-14.patch new file mode 100644 index 0000000..3002340 --- /dev/null +++ b/0001-Fix-build-with-GCC-14.patch @@ -0,0 +1,40 @@ +From 98feb36a5f4971ca152b2d90a923008d0bd6cf5f Mon Sep 17 00:00:00 2001 +From: Christophe Marin +Date: Tue, 27 Aug 2024 10:31:02 +0200 +Subject: [PATCH] =?UTF-8?q?Fix=20build=20with=20GCC=C2=A014?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--- + gview_v4l2core/jpeg_decoder.c | 1 + + gview_v4l2core/uvc_h264.c | 1 + + 2 files changed, 2 insertions(+) + +diff --git a/gview_v4l2core/jpeg_decoder.c b/gview_v4l2core/jpeg_decoder.c +index 9d30ea2..d60fdf8 100644 +--- a/gview_v4l2core/jpeg_decoder.c ++++ b/gview_v4l2core/jpeg_decoder.c +@@ -36,6 +36,7 @@ + #include + #include + #include ++#include + + #include "gviewv4l2core.h" + #include "colorspaces.h" +diff --git a/gview_v4l2core/uvc_h264.c b/gview_v4l2core/uvc_h264.c +index ed0c6a8..a02271e 100644 +--- a/gview_v4l2core/uvc_h264.c ++++ b/gview_v4l2core/uvc_h264.c +@@ -24,6 +24,7 @@ + /* support for internationalization - i18n */ + #include + #include ++#include + #include + #include + #include +-- +2.46.0 + diff --git a/0001-fix-deprecation-warning-with-ffpmeg-7.1-add-Wall-to-.patch b/0001-fix-deprecation-warning-with-ffpmeg-7.1-add-Wall-to-.patch new file mode 100644 index 0000000..d647d34 --- /dev/null +++ b/0001-fix-deprecation-warning-with-ffpmeg-7.1-add-Wall-to-.patch @@ -0,0 +1,1500 @@ +From 150c054fe971e282515f4d13e42a061096bfdd6e Mon Sep 17 00:00:00 2001 +From: Paulo Assis +Date: Sat, 16 Nov 2024 20:04:52 +0000 +Subject: [PATCH 1/2] fix deprecation warning with ffpmeg 7.1; add -Wall to + compile flags + +--- + guvcview/CMakeLists.txt | 2 + + gview_audio/CMakeLists.txt | 2 + + gview_encoder/CMakeLists.txt | 2 + + gview_encoder/audio_codecs.c | 818 ++++++++++++++++----------------- + gview_encoder/encoder.c | 74 ++- + gview_render/CMakeLists.txt | 1 + + gview_render/render_fx.c | 53 ++- + gview_render/render_sdl2.c | 3 +- + gview_render/render_sfml.cpp | 4 +- + gview_v4l2core/CMakeLists.txt | 2 + + gview_v4l2core/colorspaces.c | 6 +- + gview_v4l2core/frame_decoder.c | 2 +- + gview_v4l2core/jpeg_decoder.c | 34 +- + gview_v4l2core/v4l2_controls.c | 2 +- + 14 files changed, 513 insertions(+), 492 deletions(-) + +diff --git a/guvcview/CMakeLists.txt b/guvcview/CMakeLists.txt +index bb501bf..e087b64 100644 +--- a/guvcview/CMakeLists.txt ++++ b/guvcview/CMakeLists.txt +@@ -18,6 +18,8 @@ add_executable(guvcview + video_capture.c + ) + ++add_definitions("-Wall") ++ + if(USE_GTK3) + pkg_check_modules(GTK3 gtk+-3.0) + if(GTK3_FOUND) +diff --git a/gview_audio/CMakeLists.txt b/gview_audio/CMakeLists.txt +index 9714745..6217ef9 100644 +--- a/gview_audio/CMakeLists.txt ++++ b/gview_audio/CMakeLists.txt +@@ -18,6 +18,8 @@ set_target_properties( + SOVERSION ${LIBSOVERSION} + ) + ++add_definitions("-Wall") ++ + pkg_check_modules(PORTAUDIO2 REQUIRED portaudio-2.0) + + target_link_libraries(gviewaudio ${PORTAUDIO2_LIBRARIES}) +diff --git a/gview_encoder/CMakeLists.txt b/gview_encoder/CMakeLists.txt +index 8942bae..dfd7c38 100644 +--- a/gview_encoder/CMakeLists.txt ++++ b/gview_encoder/CMakeLists.txt +@@ -22,6 +22,8 @@ set_target_properties( + SOVERSION ${LIBSOVERSION} + ) + ++add_definitions("-Wall") ++ + pkg_check_modules(FFMPEG REQUIRED libavcodec libavutil) + + target_link_libraries(gviewencoder ${FFMPEG_LIBRARIES}) +diff --git a/gview_encoder/audio_codecs.c b/gview_encoder/audio_codecs.c +index 5c9f764..6965df8 100644 +--- a/gview_encoder/audio_codecs.c ++++ b/gview_encoder/audio_codecs.c +@@ -1,204 +1,195 @@ +-/*******************************************************************************# +-# guvcview http://guvcview.sourceforge.net # +-# # +-# Paulo Assis # +-# # +-# This program is free software; you can redistribute it and/or modify # +-# it under the terms of the GNU General Public License as published by # +-# the Free Software Foundation; either version 2 of the License, or # +-# (at your option) any later version. # +-# # +-# This program 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 General Public License for more details. # +-# # +-# You should have received a copy of the GNU General Public License # +-# along with this program; if not, write to the Free Software # +-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +-# # +-********************************************************************************/ ++/******************************************************************************# ++# guvcview http://guvcview.sourceforge.net # ++# # ++# Paulo Assis # ++# # ++# This program is free software; you can redistribute it and/or modify # ++# it under the terms of the GNU General Public License as published by # ++# the Free Software Foundation; either version 2 of the License, or # ++# (at your option) any later version. # ++# # ++# This program 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 General Public License for more details. # ++# # ++# You should have received a copy of the GNU General Public License # ++# along with this program; if not, write to the Free Software # ++# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # ++# # ++*******************************************************************************/ + +-#include ++#include ++#include ++#include + #include ++#include ++#include + #include + #include +-#include +-#include +-#include +-#include + /* support for internationalization - i18n */ +-#include + #include ++#include + +-#include "gviewencoder.h" +-#include "gview.h" + #include "encoder.h" ++#include "gview.h" ++#include "gviewencoder.h" + + extern int enc_verbosity; + + /* AAC object types index: MAIN = 1; LOW = 2; SSR = 3; LTP = 4*/ +-static int AAC_OBJ_TYPE[5] = +- { FF_PROFILE_UNKNOWN, FF_PROFILE_AAC_MAIN, FF_PROFILE_AAC_LOW, FF_PROFILE_AAC_SSR, FF_PROFILE_AAC_LTP }; ++static int AAC_OBJ_TYPE[5] = {FF_PROFILE_UNKNOWN, FF_PROFILE_AAC_MAIN, ++ FF_PROFILE_AAC_LOW, FF_PROFILE_AAC_SSR, ++ FF_PROFILE_AAC_LTP}; + /*-1 = reserved; 0 = freq. is writen explictly (increases header by 24 bits)*/ +-static int AAC_SAMP_FREQ[16] = +- { 96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350, -1, -1, 0}; ++static int AAC_SAMP_FREQ[16] = {96000, 88200, 64000, 48000, 44100, 32000, ++ 24000, 22050, 16000, 12000, 11025, 8000, ++ 7350, -1, -1, 0}; + + /*NORMAL AAC HEADER*/ +-/*2 bytes: object type index(5 bits) + sample frequency index(4bits) + channels(4 bits) + flags(3 bit) */ ++/*2 bytes: object type index(5 bits) + sample frequency index(4bits) + ++ * channels(4 bits) + flags(3 bit) */ + /*default = MAIN(1)+44100(4)+stereo(2)+flags(0) = 0x0A10*/ +-static uint8_t AAC_ESDS[2] = {0x0A,0x10}; ++static uint8_t AAC_ESDS[2] = {0x0A, 0x10}; + /* if samprate index == 15 AAC_ESDS[5]: +- * object type index(5 bits) + sample frequency index(4bits) + samprate(24bits) + channels(4 bits) + flags(3 bit) ++ * object type index(5 bits) + sample frequency index(4bits) + samprate(24bits) ++ * + channels(4 bits) + flags(3 bit) + */ + +- +-static audio_codec_t listSupCodecs[] = //list of software supported formats +-{ +- { +- .valid = 1, +- .bits = 32, +- .monotonic_pts = 0, +- .avi_4cc = WAVE_FORMAT_IEEE_FLOAT, +- .mkv_codec = "A_PCM/FLOAT/IEEE", +- .description = N_("PCM - uncompressed (float 32 bit)"), +- .bit_rate = 0, +- .codec_id = AV_CODEC_ID_PCM_F32LE, +- .codec_name = "pcm_f32le", +- .sample_format = AV_SAMPLE_FMT_FLT, +- .profile = FF_PROFILE_UNKNOWN, +- .mkv_codpriv = NULL, +- .codpriv_size = 0, +- .flags = 0, +- .name = "pcm" +- }, +- { +- .valid = 1, +- .bits = 0, +- .monotonic_pts= 0, +- .avi_4cc = WAVE_FORMAT_MPEG12, +- .mkv_codec = "A_MPEG/L2", +- .description = N_("MP2 (MPEG audio layer 2)"), +- .bit_rate = 160000, +- .codec_id = AV_CODEC_ID_MP2, +- .codec_name = "mp2", +- .sample_format = AV_SAMPLE_FMT_S16, +- .profile = FF_PROFILE_UNKNOWN, +- .mkv_codpriv = NULL, +- .codpriv_size = 0, +- .flags = 0, +- .name = "mp2" +- }, +- { +- .valid = 1, +- .bits = 0, +- .monotonic_pts= 0, +- .avi_4cc = WAVE_FORMAT_MP3, +- .mkv_codec = "A_MPEG/L3", +- .description = N_("MP3 (MPEG audio layer 3)"), +- .bit_rate = 160000, +- .codec_id = AV_CODEC_ID_MP3, +- .codec_name = "libmp3lame", +-#if LIBAVCODEC_VER_AT_LEAST(54,31) +- .sample_format = AV_SAMPLE_FMT_FLTP, ++static audio_codec_t listSupCodecs[] = // list of software supported formats ++ {{.valid = 1, ++ .bits = 32, ++ .monotonic_pts = 0, ++ .avi_4cc = WAVE_FORMAT_IEEE_FLOAT, ++ .mkv_codec = "A_PCM/FLOAT/IEEE", ++ .description = N_("PCM - uncompressed (float 32 bit)"), ++ .bit_rate = 0, ++ .codec_id = AV_CODEC_ID_PCM_F32LE, ++ .codec_name = "pcm_f32le", ++ .sample_format = AV_SAMPLE_FMT_FLT, ++ .profile = FF_PROFILE_UNKNOWN, ++ .mkv_codpriv = NULL, ++ .codpriv_size = 0, ++ .flags = 0, ++ .name = "pcm"}, ++ {.valid = 1, ++ .bits = 0, ++ .monotonic_pts = 0, ++ .avi_4cc = WAVE_FORMAT_MPEG12, ++ .mkv_codec = "A_MPEG/L2", ++ .description = N_("MP2 (MPEG audio layer 2)"), ++ .bit_rate = 160000, ++ .codec_id = AV_CODEC_ID_MP2, ++ .codec_name = "mp2", ++ .sample_format = AV_SAMPLE_FMT_S16, ++ .profile = FF_PROFILE_UNKNOWN, ++ .mkv_codpriv = NULL, ++ .codpriv_size = 0, ++ .flags = 0, ++ .name = "mp2"}, ++ {.valid = 1, ++ .bits = 0, ++ .monotonic_pts = 0, ++ .avi_4cc = WAVE_FORMAT_MP3, ++ .mkv_codec = "A_MPEG/L3", ++ .description = N_("MP3 (MPEG audio layer 3)"), ++ .bit_rate = 160000, ++ .codec_id = AV_CODEC_ID_MP3, ++ .codec_name = "libmp3lame", ++#if LIBAVCODEC_VER_AT_LEAST(54, 31) ++ .sample_format = AV_SAMPLE_FMT_FLTP, + #else +- .sample_format = AV_SAMPLE_FMT_S16, ++ .sample_format = AV_SAMPLE_FMT_S16, + #endif +- .profile = FF_PROFILE_UNKNOWN, +- .mkv_codpriv = NULL, +- .codpriv_size = 0, +- .flags = 0, +- .name = "mp3" +- }, +- { +- .valid = 1, +- .bits = 0, +- .monotonic_pts= 0, +- .avi_4cc = WAVE_FORMAT_AC3, +- .mkv_codec = "A_AC3", +- .description = N_("AC-3 (ATSC A/52A)"), +- .bit_rate = 160000, +- .codec_id = AV_CODEC_ID_AC3, +- .codec_name = "ac3", +-#if LIBAVCODEC_VER_AT_LEAST(54,31) +- .sample_format = AV_SAMPLE_FMT_FLTP, ++ .profile = FF_PROFILE_UNKNOWN, ++ .mkv_codpriv = NULL, ++ .codpriv_size = 0, ++ .flags = 0, ++ .name = "mp3"}, ++ {.valid = 1, ++ .bits = 0, ++ .monotonic_pts = 0, ++ .avi_4cc = WAVE_FORMAT_AC3, ++ .mkv_codec = "A_AC3", ++ .description = N_("AC-3 (ATSC A/52A)"), ++ .bit_rate = 160000, ++ .codec_id = AV_CODEC_ID_AC3, ++ .codec_name = "ac3", ++#if LIBAVCODEC_VER_AT_LEAST(54, 31) ++ .sample_format = AV_SAMPLE_FMT_FLTP, + #else +- .sample_format = AV_SAMPLE_FMT_FLT, ++ .sample_format = AV_SAMPLE_FMT_FLT, + #endif +- .profile = FF_PROFILE_UNKNOWN, +- .mkv_codpriv = NULL, +- .codpriv_size = 0, +- .flags = 0, +- .name = "ac3" +- }, +- { +- .valid = 1, +- .bits = 16, +- .monotonic_pts= 0, +- .avi_4cc = WAVE_FORMAT_AAC, +- .mkv_codec = "A_AAC", +- .description = N_("AAC (Advanced Audio Coding)"), +- .bit_rate = 64000, +- .codec_id = AV_CODEC_ID_AAC, +- .codec_name = "libvo_aacenc", +-#if LIBAVCODEC_VER_AT_LEAST(54,31) +- .sample_format = AV_SAMPLE_FMT_FLTP, ++ .profile = FF_PROFILE_UNKNOWN, ++ .mkv_codpriv = NULL, ++ .codpriv_size = 0, ++ .flags = 0, ++ .name = "ac3"}, ++ {.valid = 1, ++ .bits = 16, ++ .monotonic_pts = 0, ++ .avi_4cc = WAVE_FORMAT_AAC, ++ .mkv_codec = "A_AAC", ++ .description = N_("AAC (Advanced Audio Coding)"), ++ .bit_rate = 64000, ++ .codec_id = AV_CODEC_ID_AAC, ++ .codec_name = "libvo_aacenc", ++#if LIBAVCODEC_VER_AT_LEAST(54, 31) ++ .sample_format = AV_SAMPLE_FMT_FLTP, + #else +- .sample_format = AV_SAMPLE_FMT_S16, ++ .sample_format = AV_SAMPLE_FMT_S16, + #endif +- .profile = FF_PROFILE_AAC_LOW, +- .mkv_codpriv = AAC_ESDS, +- .codpriv_size = 2, +- .flags = 0, +- .name = "aac" +- }, +- { +- .valid = 1, +- .bits = 16, +- .monotonic_pts= 0, +- .avi_4cc = OGG_FORMAT_VORBIS, +- .mkv_codec = "A_VORBIS", +- .description = N_("Vorbis"), +- .bit_rate = 64000, +- .codec_id = AV_CODEC_ID_VORBIS, +- .codec_name = "libvorbis", +-#if LIBAVCODEC_VER_AT_LEAST(54,31) +- .sample_format = AV_SAMPLE_FMT_FLTP, ++ .profile = FF_PROFILE_AAC_LOW, ++ .mkv_codpriv = AAC_ESDS, ++ .codpriv_size = 2, ++ .flags = 0, ++ .name = "aac"}, ++ {.valid = 1, ++ .bits = 16, ++ .monotonic_pts = 0, ++ .avi_4cc = OGG_FORMAT_VORBIS, ++ .mkv_codec = "A_VORBIS", ++ .description = N_("Vorbis"), ++ .bit_rate = 64000, ++ .codec_id = AV_CODEC_ID_VORBIS, ++ .codec_name = "libvorbis", ++#if LIBAVCODEC_VER_AT_LEAST(54, 31) ++ .sample_format = AV_SAMPLE_FMT_FLTP, + #else +- .sample_format = AV_SAMPLE_FMT_S16, ++ .sample_format = AV_SAMPLE_FMT_S16, + #endif +- .profile = FF_PROFILE_UNKNOWN, +- .mkv_codpriv = NULL, +- .codpriv_size = 0, +- .flags = 0, +- .name = "vorb" +- } +-}; +- +-static int get_aac_obj_ind(int profile) +-{ +- int i = 0; +- +- for (i=0; i<5; i++) +- if(AAC_OBJ_TYPE[i] == profile) break; +- +- return i; +-} ++ .profile = FF_PROFILE_UNKNOWN, ++ .mkv_codpriv = NULL, ++ .codpriv_size = 0, ++ .flags = 0, ++ .name = "vorb"}}; + +-static int get_aac_samp_ind(int samprate) +-{ +- int i = 0; ++static int get_aac_obj_ind(int profile) { ++ int i = 0; + +- for (i=0; i<13; i++) +- if(AAC_SAMP_FREQ[i] == samprate) break; ++ for (i = 0; i < 5; i++) { ++ if (AAC_OBJ_TYPE[i] == profile) ++ break; ++ } ++ ++ return i; ++} + +- if (i>12) +- { +- printf("WARNING: invalid sample rate for AAC encoding\n"); +- printf("valid(96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11025, 8000, 7350)\n"); +- i=4; /*default 44100*/ +- } +- return i; ++static int get_aac_samp_ind(int samprate) { ++ int i = 0; ++ ++ for (i = 0; i < 13; i++) { ++ if (AAC_SAMP_FREQ[i] == samprate) ++ break; ++ } ++ ++ if (i > 12) { ++ printf("WARNING: invalid sample rate for AAC encoding\n"); ++ printf("valid(96000, 88200, 64000, 48000, 44100, 32000, 24000, 22050, " ++ "16000, 12000, 11025, 8000, 7350)\n"); ++ i = 4; /*default 44100*/ ++ } ++ return i; + } + + /* +@@ -211,14 +202,13 @@ static int get_aac_samp_ind(int samprate) + * + * returns: listSupCodecs size (number of elements) + */ +-int encoder_get_audio_codec_list_size() +-{ +- int size = sizeof(listSupCodecs)/sizeof(audio_codec_t); ++int encoder_get_audio_codec_list_size() { ++ int size = sizeof(listSupCodecs) / sizeof(audio_codec_t); + +- if(enc_verbosity > 3) +- printf("ENCODER: audio codec list size:%i\n", size); ++ if (enc_verbosity > 3) ++ printf("ENCODER: audio codec list size:%i\n", size); + +- return size; ++ return size; + } + + /* +@@ -231,7 +221,7 @@ int encoder_get_audio_codec_list_size() + * + * returns: listSupCodecs valid number of elements + */ +-//int encoder_get_audio_codec_valid_list_size() ++// int encoder_get_audio_codec_valid_list_size() + //{ + // int valid_size = 0; + // +@@ -244,7 +234,7 @@ int encoder_get_audio_codec_list_size() + // printf("ENCODER: audio codec valid list size:%i\n", valid_size); + // + // return valid_size; +-//} ++// } + + /* + * return the real (valid only) codec index +@@ -256,18 +246,16 @@ int encoder_get_audio_codec_list_size() + * + * returns: matching listSupCodecs index + */ +-static int get_real_index (int codec_ind) +-{ +- int i = 0; +- int ind = -1; +- for (i = 0; i < encoder_get_audio_codec_list_size(); ++i) +- { +- if(listSupCodecs[i].valid) +- ind++; +- if(ind == codec_ind) +- return i; +- } +- return (codec_ind); //should never arrive ++static int get_real_index(int codec_ind) { ++ int i = 0; ++ int ind = -1; ++ for (i = 0; i < encoder_get_audio_codec_list_size(); ++i) { ++ if (listSupCodecs[i].valid) ++ ind++; ++ if (ind == codec_ind) ++ return i; ++ } ++ return (codec_ind); // should never arrive + } + + /* +@@ -280,22 +268,19 @@ static int get_real_index (int codec_ind) + * + * returns: matching list index (with non valid removed) + */ +-static int get_list_index (int real_index) +-{ +- if( real_index < 0 || +- real_index >= encoder_get_audio_codec_list_size() || +- !listSupCodecs[real_index].valid ) +- return -1; //error: real index is not valid +- +- int i = 0; +- int ind = -1; +- for (i = 0; i<= real_index; ++i) +- { +- if(listSupCodecs[i].valid) +- ind++; +- } +- +- return (ind); ++static int get_list_index(int real_index) { ++ if (real_index < 0 || real_index >= encoder_get_audio_codec_list_size() || ++ !listSupCodecs[real_index].valid) ++ return -1; // error: real index is not valid ++ ++ int i = 0; ++ int ind = -1; ++ for (i = 0; i <= real_index; ++i) { ++ if (listSupCodecs[i].valid) ++ ind++; ++ } ++ ++ return (ind); + } + + /* +@@ -308,16 +293,14 @@ static int get_list_index (int real_index) + * + * returns: real index or -1 if none + */ +-int get_audio_codec_index(int codec_id) +-{ +- int i = 0; +- for(i = 0; i < encoder_get_audio_codec_list_size(); ++i ) +- { +- if(codec_id == listSupCodecs[i].codec_id) +- return i; +- } +- +- return -1; ++int get_audio_codec_index(int codec_id) { ++ int i = 0; ++ for (i = 0; i < encoder_get_audio_codec_list_size(); ++i) { ++ if (codec_id == listSupCodecs[i].codec_id) ++ return i; ++ } ++ ++ return -1; + } + + /* +@@ -330,9 +313,8 @@ int get_audio_codec_index(int codec_id) + * + * returns: real index or -1 if none + */ +-int get_audio_codec_list_index(int codec_id) +-{ +- return get_list_index(get_audio_codec_index(codec_id)); ++int get_audio_codec_list_index(int codec_id) { ++ return get_list_index(get_audio_codec_index(codec_id)); + } + + /* +@@ -345,17 +327,16 @@ int get_audio_codec_list_index(int codec_id) + * + * returns: list codec entry or NULL if none + */ +-audio_codec_t *encoder_get_audio_codec_defaults(int codec_ind) +-{ +- int real_index = get_real_index (codec_ind); +- +- if(real_index >= 0 && real_index < encoder_get_audio_codec_list_size()) +- return (&(listSupCodecs[real_index])); +- else +- { +- fprintf(stderr, "ENCODER: (audio codec defaults) bad codec index (%i)\n", codec_ind); +- return NULL; +- } ++audio_codec_t *encoder_get_audio_codec_defaults(int codec_ind) { ++ int real_index = get_real_index(codec_ind); ++ ++ if (real_index >= 0 && real_index < encoder_get_audio_codec_list_size()) ++ return (&(listSupCodecs[real_index])); ++ else { ++ fprintf(stderr, "ENCODER: (audio codec defaults) bad codec index (%i)\n", ++ codec_ind); ++ return NULL; ++ } + } + + /* +@@ -368,15 +349,14 @@ audio_codec_t *encoder_get_audio_codec_defaults(int codec_ind) + * + * returns: 1 true; 0 false + */ +-int encoder_check_webm_audio_codec(int codec_ind) +-{ +- int real_index = get_real_index (codec_ind); ++int encoder_check_webm_audio_codec(int codec_ind) { ++ int real_index = get_real_index(codec_ind); + +- int ret = 0; +- if(real_index >= 0 && real_index < encoder_get_audio_codec_list_size()) +- ret = (listSupCodecs[real_index].codec_id == AV_CODEC_ID_VORBIS) ? 1: 0; ++ int ret = 0; ++ if (real_index >= 0 && real_index < encoder_get_audio_codec_list_size()) ++ ret = (listSupCodecs[real_index].codec_id == AV_CODEC_ID_VORBIS) ? 1 : 0; + +- return ret; ++ return ret; + } + + /* +@@ -389,9 +369,8 @@ int encoder_check_webm_audio_codec(int codec_ind) + * + * returns: index for Vorbis codec or -1 if error + */ +-int encoder_get_webm_audio_codec_index() +-{ +- return get_audio_codec_list_index(AV_CODEC_ID_VORBIS); ++int encoder_get_webm_audio_codec_index() { ++ return get_audio_codec_list_index(AV_CODEC_ID_VORBIS); + } + + /* +@@ -404,22 +383,20 @@ int encoder_get_webm_audio_codec_index() + * + * returns: number of valid audio codecs in list + */ +-int encoder_set_valid_audio_codec_list () +-{ +- int ind = 0; +- int num_codecs = 0; +- for ( ind = 0; ind < encoder_get_audio_codec_list_size(); ++ind) +- { +- const AVCodec *codec = avcodec_find_encoder(listSupCodecs[ind].codec_id); +- if (!codec) +- { +- printf("ENCODER: no audio codec detected for %s\n", listSupCodecs[ind].description); +- listSupCodecs[ind].valid = 0; +- } +- else num_codecs++; +- } +- +- return num_codecs; ++int encoder_set_valid_audio_codec_list() { ++ int ind = 0; ++ int num_codecs = 0; ++ for (ind = 0; ind < encoder_get_audio_codec_list_size(); ++ind) { ++ const AVCodec *codec = avcodec_find_encoder(listSupCodecs[ind].codec_id); ++ if (!codec) { ++ printf("ENCODER: no audio codec detected for %s\n", ++ listSupCodecs[ind].description); ++ listSupCodecs[ind].valid = 0; ++ } else ++ num_codecs++; ++ } ++ ++ return num_codecs; + } + + /* +@@ -432,16 +409,15 @@ int encoder_set_valid_audio_codec_list () + * + * returns: list codec entry or NULL if none + */ +-const char *encoder_get_audio_codec_description(int codec_ind) +-{ +- int real_index = get_real_index (codec_ind); +- if(real_index >= 0 && real_index < encoder_get_audio_codec_list_size()) +- return (listSupCodecs[real_index].description); +- else +- { +- fprintf(stderr, "ENCODER: (audio codec description) bad codec index (%i)\n", codec_ind); +- return NULL; +- } ++const char *encoder_get_audio_codec_description(int codec_ind) { ++ int real_index = get_real_index(codec_ind); ++ if (real_index >= 0 && real_index < encoder_get_audio_codec_list_size()) ++ return (listSupCodecs[real_index].description); ++ else { ++ fprintf(stderr, "ENCODER: (audio codec description) bad codec index (%i)\n", ++ codec_ind); ++ return NULL; ++ } + } + + /* +@@ -454,16 +430,15 @@ const char *encoder_get_audio_codec_description(int codec_ind) + * + * returns: mkv codec entry or NULL if none + */ +-const char *encoder_get_audio_mkv_codec(int codec_ind) +-{ +- int real_index = get_real_index (codec_ind); +- if(real_index >= 0 && real_index < encoder_get_audio_codec_list_size()) +- return (listSupCodecs[real_index].mkv_codec); +- else +- { +- fprintf(stderr, "ENCODER: (audio mkv codec) bad codec index (%i)\n", codec_ind); +- return NULL; +- } ++const char *encoder_get_audio_mkv_codec(int codec_ind) { ++ int real_index = get_real_index(codec_ind); ++ if (real_index >= 0 && real_index < encoder_get_audio_codec_list_size()) ++ return (listSupCodecs[real_index].mkv_codec); ++ else { ++ fprintf(stderr, "ENCODER: (audio mkv codec) bad codec index (%i)\n", ++ codec_ind); ++ return NULL; ++ } + } + + /* +@@ -476,16 +451,15 @@ const char *encoder_get_audio_mkv_codec(int codec_ind) + * + * returns: bits entry from audio codec list + */ +-int encoder_get_audio_bits(int codec_ind) +-{ +- int real_index = get_real_index (codec_ind); +- if(real_index >= 0 && real_index < encoder_get_audio_codec_list_size()) +- return (listSupCodecs[real_index].bits); +- else +- { +- fprintf(stderr, "ENCODER: (get_audio_bits) bad codec index (%i)\n", codec_ind); +- return 0; +- } ++int encoder_get_audio_bits(int codec_ind) { ++ int real_index = get_real_index(codec_ind); ++ if (real_index >= 0 && real_index < encoder_get_audio_codec_list_size()) ++ return (listSupCodecs[real_index].bits); ++ else { ++ fprintf(stderr, "ENCODER: (get_audio_bits) bad codec index (%i)\n", ++ codec_ind); ++ return 0; ++ } + } + + /* +@@ -498,16 +472,15 @@ int encoder_get_audio_bits(int codec_ind) + * + * returns: bit_rate entry from audio codec list + */ +-int encoder_get_audio_bit_rate(int codec_ind) +-{ +- int real_index = get_real_index (codec_ind); +- if(real_index >= 0 && real_index < encoder_get_audio_codec_list_size()) +- return (listSupCodecs[real_index].bit_rate); +- else +- { +- fprintf(stderr, "ENCODER: (get_audio_bit_rate) bad codec index (%i)\n", codec_ind); +- return 0; +- } ++int encoder_get_audio_bit_rate(int codec_ind) { ++ int real_index = get_real_index(codec_ind); ++ if (real_index >= 0 && real_index < encoder_get_audio_codec_list_size()) ++ return (listSupCodecs[real_index].bit_rate); ++ else { ++ fprintf(stderr, "ENCODER: (get_audio_bit_rate) bad codec index (%i)\n", ++ codec_ind); ++ return 0; ++ } + } + + /* +@@ -520,16 +493,15 @@ int encoder_get_audio_bit_rate(int codec_ind) + * + * returns: pointer to mkvCodecPriv data + */ +-void *encoder_get_audio_mkvCodecPriv(int codec_ind) +-{ +- int real_index = get_real_index (codec_ind); +- if(real_index >= 0 && real_index < encoder_get_audio_codec_list_size()) +- return ((void *) listSupCodecs[real_index].mkv_codpriv); +- else +- { +- fprintf(stderr, "ENCODER: (mkvCodecPriv) bad codec index (%i)\n", codec_ind); +- return NULL; +- } ++void *encoder_get_audio_mkvCodecPriv(int codec_ind) { ++ int real_index = get_real_index(codec_ind); ++ if (real_index >= 0 && real_index < encoder_get_audio_codec_list_size()) ++ return ((void *)listSupCodecs[real_index].mkv_codpriv); ++ else { ++ fprintf(stderr, "ENCODER: (mkvCodecPriv) bad codec index (%i)\n", ++ codec_ind); ++ return NULL; ++ } + } + + /* +@@ -542,100 +514,99 @@ void *encoder_get_audio_mkvCodecPriv(int codec_ind) + * + * returns: mkvCodecPriv size + */ +-int encoder_set_audio_mkvCodecPriv(encoder_context_t *encoder_ctx) +-{ +- /*assertions*/ +- assert(encoder_ctx != NULL); +- +- /*assert audio encoder context is not null*/ +- assert( encoder_ctx->enc_audio_ctx); +- encoder_codec_data_t *audio_codec_data = (encoder_codec_data_t *) encoder_ctx->enc_audio_ctx->codec_data; +- /*assert video codec data is not null*/ +- assert(audio_codec_data); +- +- int codec_id = audio_codec_data->codec_context->codec_id; +- int real_index = get_audio_codec_index(codec_id); +- +- +- if (codec_id == AV_CODEC_ID_AAC) +- { +- int obj_type = get_aac_obj_ind(listSupCodecs[real_index].profile); +- int sampind = get_aac_samp_ind(encoder_ctx->audio_samprate); +- AAC_ESDS[0] = (uint8_t) ((obj_type & 0x1F) << 3 ) + ((sampind & 0x0F) >> 1); +- AAC_ESDS[1] = (uint8_t) ((sampind & 0x0F) << 7 ) + ((encoder_ctx->audio_channels & 0x0F) << 3); +- +- return listSupCodecs[real_index].codpriv_size; /*return size = 2 */ +- } +- else if(codec_id == AV_CODEC_ID_VORBIS) +- { +- //get the 3 first header packets +- uint8_t *header_start[3]; +- int header_len[3]; +- int first_header_size; +- +- first_header_size = 30; //theora = 42 +- if (avpriv_split_xiph_headers( +- audio_codec_data->codec_context->extradata, +- audio_codec_data->codec_context->extradata_size, +- first_header_size, header_start, header_len) < 0) +- { +- fprintf(stderr, "ENCODER: vorbis codec - Extradata corrupt.\n"); +- return -1; +- } +- +- //printf("Vorbis: header1: %i header2: %i header3:%i \n", header_len[0], header_len[1], header_len[2]); +- +- //get the allocation needed for headers size +- int header_lace_size[2]; +- header_lace_size[0]=0; +- header_lace_size[1]=0; +- int i; +- for (i = 0; i < header_len[0] / 255; i++) +- header_lace_size[0]++; +- header_lace_size[0]++; +- for (i = 0; i < header_len[1] / 255; i++) +- header_lace_size[1]++; +- header_lace_size[1]++; +- +- int priv_data_size = 1 + //number of packets -1 +- header_lace_size[0] + //first packet size +- header_lace_size[1] + //second packet size +- header_len[0] + //first packet header +- header_len[1] + //second packet header +- header_len[2]; //third packet header +- +- /*should check and clean before allocating ??*/ +- encoder_ctx->enc_audio_ctx->priv_data = calloc(priv_data_size, sizeof(uint8_t)); +- if(encoder_ctx->enc_audio_ctx->priv_data == NULL) +- { +- fprintf(stderr, "ENCODER: FATAL memory allocation failure (encoder_set_audio_mkvCodecPriv): %s\n", strerror(errno)); +- exit(-1); +- } +- //write header +- uint8_t* tmp = encoder_ctx->enc_audio_ctx->priv_data; +- *tmp++ = 0x02; //number of packets -1 +- //size of head 1 +- for (i = 0; i < header_len[0] / 0xff; i++) +- *tmp++ = 0xff; +- *tmp++ = header_len[0] % 0xff; +- //size of head 2 +- for (i = 0; i < header_len[1] / 0xff; i++) +- *tmp++ = 0xff; +- *tmp++ = header_len[1] % 0xff; +- //add headers +- for(i=0; i<3; i++) +- { +- memcpy(tmp, header_start[i] , header_len[i]); +- tmp += header_len[i]; +- } +- +- listSupCodecs[real_index].mkv_codpriv = encoder_ctx->enc_audio_ctx->priv_data; +- listSupCodecs[real_index].codpriv_size = priv_data_size; +- return listSupCodecs[real_index].codpriv_size; +- } +- +- +- return 0; ++int encoder_set_audio_mkvCodecPriv(encoder_context_t *encoder_ctx) { ++ /*assertions*/ ++ assert(encoder_ctx != NULL); ++ ++ /*assert audio encoder context is not null*/ ++ assert(encoder_ctx->enc_audio_ctx); ++ encoder_codec_data_t *audio_codec_data = ++ (encoder_codec_data_t *)encoder_ctx->enc_audio_ctx->codec_data; ++ /*assert video codec data is not null*/ ++ assert(audio_codec_data); ++ ++ int codec_id = audio_codec_data->codec_context->codec_id; ++ int real_index = get_audio_codec_index(codec_id); ++ ++ if (codec_id == AV_CODEC_ID_AAC) { ++ int obj_type = get_aac_obj_ind(listSupCodecs[real_index].profile); ++ int sampind = get_aac_samp_ind(encoder_ctx->audio_samprate); ++ AAC_ESDS[0] = (uint8_t)((obj_type & 0x1F) << 3) + ((sampind & 0x0F) >> 1); ++ AAC_ESDS[1] = (uint8_t)((sampind & 0x0F) << 7) + ++ ((encoder_ctx->audio_channels & 0x0F) << 3); ++ ++ return listSupCodecs[real_index].codpriv_size; /*return size = 2 */ ++ } else if (codec_id == AV_CODEC_ID_VORBIS) { ++ // get the 3 first header packets ++ uint8_t *header_start[3]; ++ int header_len[3]; ++ int first_header_size; ++ ++ first_header_size = 30; // theora = 42 ++ if (avpriv_split_xiph_headers( ++ audio_codec_data->codec_context->extradata, ++ audio_codec_data->codec_context->extradata_size, first_header_size, ++ header_start, header_len) < 0) { ++ fprintf(stderr, "ENCODER: vorbis codec - Extradata corrupt.\n"); ++ return -1; ++ } ++ ++ // printf("Vorbis: header1: %i header2: %i header3:%i \n", header_len[0], ++ // header_len[1], header_len[2]); ++ ++ // get the allocation needed for headers size ++ int header_lace_size[2]; ++ header_lace_size[0] = 0; ++ header_lace_size[1] = 0; ++ int i; ++ for (i = 0; i < header_len[0] / 255; i++) ++ header_lace_size[0]++; ++ header_lace_size[0]++; ++ for (i = 0; i < header_len[1] / 255; i++) ++ header_lace_size[1]++; ++ header_lace_size[1]++; ++ ++ int priv_data_size = 1 + // number of packets -1 ++ header_lace_size[0] + // first packet size ++ header_lace_size[1] + // second packet size ++ header_len[0] + // first packet header ++ header_len[1] + // second packet header ++ header_len[2]; // third packet header ++ ++ /*should check and clean before allocating ??*/ ++ encoder_ctx->enc_audio_ctx->priv_data = ++ calloc(priv_data_size, sizeof(uint8_t)); ++ if (encoder_ctx->enc_audio_ctx->priv_data == NULL) { ++ fprintf(stderr, ++ "ENCODER: FATAL memory allocation failure " ++ "(encoder_set_audio_mkvCodecPriv): %s\n", ++ strerror(errno)); ++ exit(-1); ++ } ++ // write header ++ uint8_t *tmp = encoder_ctx->enc_audio_ctx->priv_data; ++ *tmp++ = 0x02; // number of packets -1 ++ // size of head 1 ++ for (i = 0; i < header_len[0] / 0xff; i++) ++ *tmp++ = 0xff; ++ *tmp++ = header_len[0] % 0xff; ++ // size of head 2 ++ for (i = 0; i < header_len[1] / 0xff; i++) ++ *tmp++ = 0xff; ++ *tmp++ = header_len[1] % 0xff; ++ // add headers ++ for (i = 0; i < 3; i++) { ++ memcpy(tmp, header_start[i], header_len[i]); ++ tmp += header_len[i]; ++ } ++ ++ listSupCodecs[real_index].mkv_codpriv = ++ encoder_ctx->enc_audio_ctx->priv_data; ++ listSupCodecs[real_index].codpriv_size = priv_data_size; ++ return listSupCodecs[real_index].codpriv_size; ++ } ++ ++ return 0; + } + + /* +@@ -648,16 +619,16 @@ int encoder_set_audio_mkvCodecPriv(encoder_context_t *encoder_ctx) + * + * returns: codec name entry + */ +-const char *encoder_get_audio_codec_name(int codec_ind) +-{ +- int real_index = get_real_index (codec_ind); +- if(real_index >= 0 && real_index < encoder_get_audio_codec_list_size()) +- return (listSupCodecs[real_index].name); +- else +- { +- fprintf(stderr, "ENCODER: (audio codec name) bad codec index (%i)\n", codec_ind);; +- return NULL; +- } ++const char *encoder_get_audio_codec_name(int codec_ind) { ++ int real_index = get_real_index(codec_ind); ++ if (real_index >= 0 && real_index < encoder_get_audio_codec_list_size()) ++ return (listSupCodecs[real_index].name); ++ else { ++ fprintf(stderr, "ENCODER: (audio codec name) bad codec index (%i)\n", ++ codec_ind); ++ ; ++ return NULL; ++ } + } + + /* +@@ -670,17 +641,16 @@ const char *encoder_get_audio_codec_name(int codec_ind) + * + * returns: codec index or -1 if error + */ +-int encoder_get_audio_codec_ind_name(const char *codec_name) +-{ +- int real_index = 0; +- int index = -1; +- for(real_index = 0; real_index < encoder_get_audio_codec_list_size(); ++real_index) +- { +- if(listSupCodecs[real_index].valid) +- index++; +- if(strcasecmp(codec_name, listSupCodecs[real_index].name) == 0) +- return index; +- } +- +- return -1; ++int encoder_get_audio_codec_ind_name(const char *codec_name) { ++ int real_index = 0; ++ int index = -1; ++ for (real_index = 0; real_index < encoder_get_audio_codec_list_size(); ++ ++real_index) { ++ if (listSupCodecs[real_index].valid) ++ index++; ++ if (strcasecmp(codec_name, listSupCodecs[real_index].name) == 0) ++ return index; ++ } ++ ++ return -1; + } +diff --git a/gview_encoder/encoder.c b/gview_encoder/encoder.c +index 83d63a1..9d29669 100644 +--- a/gview_encoder/encoder.c ++++ b/gview_encoder/encoder.c +@@ -212,6 +212,7 @@ void __attribute__((destructor)) gviewencoder_fini() { + /* + * check that a given sample format is supported by the encoder + * args: ++ * enc_ctx - pointer to AVCodecContext + * codec - pointer to AVCodec + * sample_fmt - audio sample format + * +@@ -220,9 +221,21 @@ void __attribute__((destructor)) gviewencoder_fini() { + * + * returns: 1 - sample format is supported; 0 - is not supported + */ +-static int encoder_check_audio_sample_fmt(const AVCodec *codec, ++static int encoder_check_audio_sample_fmt(const AVCodecContext *enc_ctx, ++ const AVCodec *codec, + enum AVSampleFormat sample_fmt) { +- const enum AVSampleFormat *p = codec->sample_fmts; ++const enum AVSampleFormat *sample_fmts; ++ ++#if LIBAVCODEC_VER_AT_LEAST(61, 19) ++ ++avcodec_get_supported_config(enc_ctx, codec, ++ AV_CODEC_CONFIG_SAMPLE_FORMAT, 0, ++ (const void **) &(sample_fmts), NULL); ++#else ++ sample_fmts = codec->sample_fmts; ++#endif ++ ++ const enum AVSampleFormat *p = sample_fmts; + + while (*p != AV_SAMPLE_FMT_NONE) { + if (*p == sample_fmt) +@@ -235,6 +248,7 @@ static int encoder_check_audio_sample_fmt(const AVCodec *codec, + /* + * check that a given sample rate is supported by the encoder + * args: ++ * enc_ctx - pointer to AVCodecContext + * codec - pointer to AVCodec + * sample_rate - audio sample rate + * +@@ -243,15 +257,28 @@ static int encoder_check_audio_sample_fmt(const AVCodec *codec, + * + * returns: sample_rate if supported or max supported sample rate if not + */ +-static int select_sample_rate(const AVCodec *codec, int sample_rate) { ++static int select_sample_rate(const AVCodecContext *enc_ctx, ++ const AVCodec *codec, ++ int sample_rate) { + const int *p; + int best_samplerate = 0; ++ const int *supported_samplerates; ++ ++#if LIBAVCODEC_VER_AT_LEAST(61, 19) + +- if (!codec->supported_samplerates) ++ avcodec_get_supported_config(enc_ctx, codec, ++ AV_CODEC_CONFIG_SAMPLE_RATE, 0, ++ (const void **) &supported_samplerates, NULL); ++#else ++ supported_samplerates = codec->supported_samplerates; ++#endif ++ ++ p = supported_samplerates; ++ ++ if (!supported_samplerates) + return sample_rate; + +- p = codec->supported_samplerates; +- while (*p) { ++ while (*p != 0) { + if (*p == sample_rate) + return sample_rate; + +@@ -260,6 +287,7 @@ static int select_sample_rate(const AVCodec *codec, int sample_rate) { + } + return best_samplerate; + } ++ + /* + * video encoder initialization for raw input + * (don't set a codec but set the proper codec 4cc) +@@ -834,7 +862,9 @@ encoder_audio_init(encoder_context_t *encoder_ctx) { + audio_codec_data->codec_context->codec_type = AVMEDIA_TYPE_AUDIO; + + int best_samprate = +- select_sample_rate(audio_codec_data->codec, encoder_ctx->audio_samprate); ++ select_sample_rate(audio_codec_data->codec_context, ++ audio_codec_data->codec, ++ encoder_ctx->audio_samprate); + + if (best_samprate != encoder_ctx->audio_samprate) { + fprintf( +@@ -848,20 +878,24 @@ encoder_audio_init(encoder_context_t *encoder_ctx) { + (AVRational){1, encoder_ctx->audio_samprate}; + + /*check if codec supports sample format*/ +- if (!encoder_check_audio_sample_fmt(audio_codec_data->codec, ++ if (!encoder_check_audio_sample_fmt(audio_codec_data->codec_context, ++ audio_codec_data->codec, + audio_defaults->sample_format)) { + /*replace by a supported format*/ + switch (audio_defaults->sample_format) { + case AV_SAMPLE_FMT_S16: +- if (encoder_check_audio_sample_fmt(audio_codec_data->codec, ++ if (encoder_check_audio_sample_fmt(audio_codec_data->codec_context, ++ audio_codec_data->codec, + AV_SAMPLE_FMT_S16P)) { + fprintf(stderr, "ENCODER: changing sample format (S16 -> S16P)\n"); + audio_defaults->sample_format = AV_SAMPLE_FMT_S16P; +- } else if (encoder_check_audio_sample_fmt(audio_codec_data->codec, ++ } else if (encoder_check_audio_sample_fmt(audio_codec_data->codec_context, ++ audio_codec_data->codec, + AV_SAMPLE_FMT_FLT)) { + fprintf(stderr, "ENCODER: changing sample format (S16 -> FLT)\n"); + audio_defaults->sample_format = AV_SAMPLE_FMT_FLT; +- } else if (encoder_check_audio_sample_fmt(audio_codec_data->codec, ++ } else if (encoder_check_audio_sample_fmt(audio_codec_data->codec_context, ++ audio_codec_data->codec, + AV_SAMPLE_FMT_FLTP)) { + fprintf(stderr, "ENCODER: changing sample format (S16 -> FLTP)\n"); + audio_defaults->sample_format = AV_SAMPLE_FMT_FLTP; +@@ -877,15 +911,18 @@ encoder_audio_init(encoder_context_t *encoder_ctx) { + break; + + case AV_SAMPLE_FMT_FLT: +- if (encoder_check_audio_sample_fmt(audio_codec_data->codec, ++ if (encoder_check_audio_sample_fmt(audio_codec_data->codec_context, ++ audio_codec_data->codec, + AV_SAMPLE_FMT_S16)) { + fprintf(stderr, "ENCODER: changing sample format (FLT -> S16)\n"); + audio_defaults->sample_format = AV_SAMPLE_FMT_S16; +- } else if (encoder_check_audio_sample_fmt(audio_codec_data->codec, ++ } else if (encoder_check_audio_sample_fmt(audio_codec_data->codec_context, ++ audio_codec_data->codec, + AV_SAMPLE_FMT_S16P)) { + fprintf(stderr, "ENCODER: changing sample format (FLT -> S16P)\n"); + audio_defaults->sample_format = AV_SAMPLE_FMT_S16P; +- } else if (encoder_check_audio_sample_fmt(audio_codec_data->codec, ++ } else if (encoder_check_audio_sample_fmt(audio_codec_data->codec_context, ++ audio_codec_data->codec, + AV_SAMPLE_FMT_FLTP)) { + fprintf(stderr, "ENCODER: changing sample format (FLT -> FLTP)\n"); + audio_defaults->sample_format = AV_SAMPLE_FMT_FLTP; +@@ -901,15 +938,18 @@ encoder_audio_init(encoder_context_t *encoder_ctx) { + break; + + case AV_SAMPLE_FMT_FLTP: +- if (encoder_check_audio_sample_fmt(audio_codec_data->codec, ++ if (encoder_check_audio_sample_fmt(audio_codec_data->codec_context, ++ audio_codec_data->codec, + AV_SAMPLE_FMT_S16)) { + fprintf(stderr, "ENCODER: changing sample format (FLTP -> S16)\n"); + audio_defaults->sample_format = AV_SAMPLE_FMT_S16; +- } else if (encoder_check_audio_sample_fmt(audio_codec_data->codec, ++ } else if (encoder_check_audio_sample_fmt(audio_codec_data->codec_context, ++ audio_codec_data->codec, + AV_SAMPLE_FMT_S16P)) { + fprintf(stderr, "ENCODER: changing sample format (FLTP -> S16P)\n"); + audio_defaults->sample_format = AV_SAMPLE_FMT_S16P; +- } else if (encoder_check_audio_sample_fmt(audio_codec_data->codec, ++ } else if (encoder_check_audio_sample_fmt(audio_codec_data->codec_context, ++ audio_codec_data->codec, + AV_SAMPLE_FMT_FLT)) { + fprintf(stderr, "ENCODER: changing sample format (FLTP -> FLT)\n"); + audio_defaults->sample_format = AV_SAMPLE_FMT_FLT; +diff --git a/gview_render/CMakeLists.txt b/gview_render/CMakeLists.txt +index e63ba39..4c9e2f3 100644 +--- a/gview_render/CMakeLists.txt ++++ b/gview_render/CMakeLists.txt +@@ -17,6 +17,7 @@ set_target_properties( + SOVERSION ${LIBSOVERSION} + ) + ++add_definitions("-Wall") + + if(SDL2_FOUND) + target_sources(gviewrender PRIVATE render_sdl2.c) +diff --git a/gview_render/render_fx.c b/gview_render/render_fx.c +index d65a4b2..ff2c9d5 100644 +--- a/gview_render/render_fx.c ++++ b/gview_render/render_fx.c +@@ -1,18 +1,23 @@ +-/*******************************************************************************# +-# guvcview http://guvcview.sourceforge.net # # # # Paulo +-Assis # # # # This +-program is free software; you can redistribute it and/or modify # # it +-under the terms of the GNU General Public License as published by # # +-the Free Software Foundation; either version 2 of the License, or # +-# (at your option) any later version. # # # # This program 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 General Public License for +-more details. # # # # You should have received +-a copy of the GNU General Public License # # along with this +-program; if not, write to the Free Software # # Foundation, +-Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # # +-********************************************************************************/ ++/******************************************************************************# ++# guvcview http://guvcview.sourceforge.net # ++# # ++# Paulo Assis # ++# # ++# This program is free software; you can redistribute it and/or modify # ++# it under the terms of the GNU General Public License as published by # ++# the Free Software Foundation; either version 2 of the License, or # ++# (at your option) any later version. # ++# # ++# This program 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 General Public License for more details. # ++# # ++# You should have received a copy of the GNU General Public License # ++# along with this program; if not, write to the Free Software # ++# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # ++# # ++*******************************************************************************/ + + #include + #include +@@ -90,8 +95,8 @@ static void fx_yu12_mirror(uint8_t *frame, int width, int height) { + + int h = 0; + int w = 0; +- int y_sizeline = width; +- int c_sizeline = width / 2; ++ //int y_sizeline = width; ++ //int c_sizeline = width / 2; + + uint8_t *end = NULL; + uint8_t *end2 = NULL; +@@ -157,8 +162,8 @@ static void fx_yu12_half_mirror(uint8_t *frame, int width, int height) { + uint8_t *pu = frame + (width * height); + uint8_t *pv = pu + ((width * height) / 4); + +- uint8_t pixel = 0; +- uint8_t pixel2 = 0; ++ //uint8_t pixel = 0; ++ //uint8_t pixel2 = 0; + + /*mirror y*/ + for (h = 0; h < height; h++) { +@@ -384,11 +389,11 @@ static void fx_yu12_binary(uint8_t *frame, int width, int height) { + */ + static void fx_yu12_pieces(uint8_t *frame, int width, int height, + int piece_size) { +- int numx = width / piece_size; // number of pieces in x axis +- int numy = height / piece_size; // number of pieces in y axis ++ //int numx = width / piece_size; // number of pieces in x axis ++ //int numy = height / piece_size; // number of pieces in y axis + + uint8_t piece[(piece_size * piece_size * 3) / 2]; +- uint8_t *ppiece = piece; ++ //uint8_t *ppiece = piece; + + int i = 0, j = 0, w = 0, h = 0; + +@@ -400,8 +405,8 @@ static void fx_yu12_pieces(uint8_t *frame, int width, int height, + int rot = 0; + + uint8_t *py = NULL; +- uint8_t *pu = NULL; +- uint8_t *pv = NULL; ++ //uint8_t *pu = NULL; ++ //uint8_t *pv = NULL; + + for (h = 0; h < height; h += piece_size) { + for (w = 0; w < width; w += piece_size) { +diff --git a/gview_render/render_sdl2.c b/gview_render/render_sdl2.c +index a2d336e..e671777 100644 +--- a/gview_render/render_sdl2.c ++++ b/gview_render/render_sdl2.c +@@ -81,7 +81,8 @@ static int video_init(int width, int height, int flags, int win_w, int win_h) { + + + SDL_SetHint("SDL_HINT_RENDER_SCALE_QUALITY", "1"); +- ++ //SDL_SetHint("SDL_HINT_VIDEO_WAYLAND_ALLOW_LIBDECOR", "0"); ++ + sdl_window = SDL_CreateWindow("Guvcview Video", // window title + SDL_WINDOWPOS_UNDEFINED, // initial x position + SDL_WINDOWPOS_UNDEFINED, // initial y position +diff --git a/gview_render/render_sfml.cpp b/gview_render/render_sfml.cpp +index 11e8fd5..ac47d32 100644 +--- a/gview_render/render_sfml.cpp ++++ b/gview_render/render_sfml.cpp +@@ -149,8 +149,8 @@ static sf::View getLetterboxView(sf::View view, int windowWidth, int windowHeigh + } + + SFMLRender::SFMLRender(int width, int height, int flags, int win_w, int win_h) { +- int w = width; +- int h = height; ++ unsigned int w = width; ++ unsigned int h = height; + + if (win_w > 0) + w = win_w; +diff --git a/gview_v4l2core/CMakeLists.txt b/gview_v4l2core/CMakeLists.txt +index 1ca4aa1..5ec3198 100644 +--- a/gview_v4l2core/CMakeLists.txt ++++ b/gview_v4l2core/CMakeLists.txt +@@ -28,6 +28,8 @@ set_target_properties( + SOVERSION ${LIBSOVERSION} + ) + ++add_definitions("-Wall") ++ + pkg_check_modules(V4L2 REQUIRED + libv4l2 libudev libusb-1.0 libavcodec>=57.16 libavutil libpng) + +diff --git a/gview_v4l2core/colorspaces.c b/gview_v4l2core/colorspaces.c +index 6a6951a..f849608 100644 +--- a/gview_v4l2core/colorspaces.c ++++ b/gview_v4l2core/colorspaces.c +@@ -520,7 +520,7 @@ void vyuy_to_yu12(uint8_t *out, uint8_t *in, int width, int height) { + + int w = 0, h = 0; + int y_sizeline = width; +- int c_sizeline = width / 2; ++ //int c_sizeline = width / 2; + + uint8_t *in1 = in; // first line + uint8_t *in2 = in1 + (width * 2); // second line in yuyv buffer +@@ -570,7 +570,7 @@ void yuv422p_to_yu12(uint8_t *out, uint8_t *in, int width, int height) { + memcpy(out, in, width * height); + + int w = 0, h = 0; +- int c_sizeline = width / 2; ++ //int c_sizeline = width / 2; + + uint8_t *pu = out + (width * height); + uint8_t *inu1 = in + (width * height); +@@ -613,7 +613,7 @@ void yyuv_to_yu12(uint8_t *out, uint8_t *in, int width, int height) { + + int w = 0, h = 0; + int y_sizeline = width; +- int c_sizeline = width / 2; ++ //int c_sizeline = width / 2; + + uint8_t *in1 = in; // first line + uint8_t *in2 = in1 + (width * 2); // second line in yyuv buffer +diff --git a/gview_v4l2core/frame_decoder.c b/gview_v4l2core/frame_decoder.c +index b2ec055..feb3acb 100644 +--- a/gview_v4l2core/frame_decoder.c ++++ b/gview_v4l2core/frame_decoder.c +@@ -733,7 +733,7 @@ int decode_v4l2_frame(v4l2_dev_t *vd, v4l2_frame_buff_t *frame) { + */ + int format = vd->requested_fmt; + +- int framesizeIn = (width * height << 1); // 2 bytes per pixel ++ //int framesizeIn = (width * height << 1); // 2 bytes per pixel + switch (format) { + case V4L2_PIX_FMT_H264: + /* +diff --git a/gview_v4l2core/jpeg_decoder.c b/gview_v4l2core/jpeg_decoder.c +index eccfadf..15a0105 100644 +--- a/gview_v4l2core/jpeg_decoder.c ++++ b/gview_v4l2core/jpeg_decoder.c +@@ -21,12 +21,6 @@ + # # + *******************************************************************************/ + +-/******************************************************************************# +-# # +-# M/Jpeg decoding and frame capture taken from luvcview # +-# # +-*******************************************************************************/ +- + #include + #include + #include +@@ -1315,7 +1309,7 @@ int jpeg_init_decoder(int width, int height) { + #endif + { + fprintf(stderr, "V4L2_CORE: (mjpeg decoder) couldn't open codec\n"); +- ++ + #if LIBAVCODEC_VER_AT_LEAST(61, 3) + avcodec_free_context(&codec_data->context); + #else +@@ -1421,32 +1415,34 @@ int jpeg_decode(uint8_t *out_buf, uint8_t *in_buf, int size) { + codec_data->context->pix_fmt, jpeg_ctx->width, + jpeg_ctx->height, jpeg_ctx->tmp_frame, jpeg_ctx->pic_size); + #endif +- /* requested libavcodec output format is yuv422p ++ /* requested libavcodec output format is yuv422p + * but apparently for some cameras +- * (https://sourceforge.net/u/shicetu/uos-guvcview/ci/fbdc4b23f0072c5285383d09d2724dbf962d8a7f/) ++ * (https://sourceforge.net/u/shicetu/uos-guvcview/ci/fbdc4b23f0072c5285383d09d2724dbf962d8a7f/) + * it can turn out be in yuv420p */ +- if (codec_data->context->pix_fmt == AV_PIX_FMT_YUV422P || ++ if (codec_data->context->pix_fmt == AV_PIX_FMT_YUV422P || + codec_data->context->pix_fmt == AV_PIX_FMT_YUVJ422P) { +- +- yuv422p_to_yu12(out_buf, jpeg_ctx->tmp_frame, jpeg_ctx->width, jpeg_ctx->height); ++ ++ yuv422p_to_yu12(out_buf, jpeg_ctx->tmp_frame, jpeg_ctx->width, ++ jpeg_ctx->height); + return jpeg_ctx->pic_size; + +- } else if (codec_data->context->pix_fmt == AV_PIX_FMT_YUVJ420P || ++ } else if (codec_data->context->pix_fmt == AV_PIX_FMT_YUVJ420P || + codec_data->context->pix_fmt == AV_PIX_FMT_YUV420P) { + +- if (jpeg_ctx->pic_size > (size_t)(jpeg_ctx->width * jpeg_ctx->height * 3 / 2)) +- jpeg_ctx->pic_size = (size_t)(jpeg_ctx->width * jpeg_ctx->height * 3 / 2); ++ if (jpeg_ctx->pic_size > ++ (size_t)(jpeg_ctx->width * jpeg_ctx->height * 3 / 2)) ++ jpeg_ctx->pic_size = ++ (size_t)(jpeg_ctx->width * jpeg_ctx->height * 3 / 2); + + memcpy(out_buf, jpeg_ctx->tmp_frame, jpeg_ctx->pic_size); + return jpeg_ctx->pic_size; +- ++ + } else { +- fprintf(stderr, "JPEG_DECODER: output pixel format not supported: %li\n", ++ fprintf(stderr, "JPEG_DECODER: output pixel format not supported: %i\n", + codec_data->context->pix_fmt); + } ++ } + +- } +- + return 0; + } + +diff --git a/gview_v4l2core/v4l2_controls.c b/gview_v4l2core/v4l2_controls.c +index ffae7cd..beca130 100644 +--- a/gview_v4l2core/v4l2_controls.c ++++ b/gview_v4l2core/v4l2_controls.c +@@ -1208,7 +1208,7 @@ void set_control_defaults(v4l2_dev_t *vd) { + } + + v4l2_ctrl_t *current = vd->list_device_controls; +- v4l2_ctrl_t *next = current->next; ++ //v4l2_ctrl_t *next = current->next; + + if (verbosity > 0) + printf("V4L2_CORE: loading defaults\n"); +-- +2.51.1 + diff --git a/0002-Fix-desktop-file-for-cmake.patch b/0002-Fix-desktop-file-for-cmake.patch new file mode 100644 index 0000000..1f8a1d9 --- /dev/null +++ b/0002-Fix-desktop-file-for-cmake.patch @@ -0,0 +1,85 @@ +From 39f76eda4d66ef7b2303ce795e701e43fafadff2 Mon Sep 17 00:00:00 2001 +From: Paulo Assis +Date: Mon, 2 Dec 2024 14:19:01 +0000 +Subject: [PATCH 2/2] Fix desktop file for cmake + +--- + data/guvcview.desktop.in | 64 +++++++++++++++++++++++++++++++++++++--- + 1 file changed, 60 insertions(+), 4 deletions(-) + +diff --git a/data/guvcview.desktop.in b/data/guvcview.desktop.in +index c086c21..ca02856 100644 +--- a/data/guvcview.desktop.in ++++ b/data/guvcview.desktop.in +@@ -1,8 +1,64 @@ + [Desktop Entry] +-_Name=guvcview +-_GenericName=GTK UVC video viewer +-_X-GNOME-FullName=GTK UVC video viewer +-_Comment=A video viewer and capturer for the linux uvc driver ++Name=guvcview ++Name[cs]=guvcview ++Name[de]=GUVCView ++Name[en_AU]=guvcview ++Name[es]=guvcview ++Name[fr]=guvcview ++Name[it]=guvcview ++Name[lv]=guvcview ++Name[nl]=guvcview ++Name[pt]=guvcview ++Name[pt_BR]=guvcview ++Name[ru]=guvcview ++Name[si]=guvcview ++Name[sr]=Камерица ++Name[tr]=guvcview ++GenericName=GTK UVC video viewer ++GenericName[cs]=Prohlížeč videa GTK UVC ++GenericName[de]=UVC-Video-Betrachter in GTK ++GenericName[en_AU]=GTK UVC video viewer ++GenericName[es]=Visualizador GTK de vídeo UVC ++GenericName[fr]=Logiciel GTK de visualisation de vidéo UVC ++GenericName[it]=GTK UVC visualizzatore video ++GenericName[lv]=GTK UVC video skatītājs ++GenericName[nl]=GTK UVC videokijker ++GenericName[pt]=Visualizador de vídeo GTK UVC ++GenericName[pt_BR]=Visualizador de vídeo GTK UVC ++GenericName[ru]=GTK UVC видео обозреватель ++GenericName[si]=GTK UVC වීඩියෝ දකින්නා ++GenericName[sr]=ГТК УВЦ видео приказивач ++GenericName[tr]=GTK UVC video görüntüleyici ++X-GNOME-FullName=GTK UVC video viewer ++X-GNOME-FullName[cs]=Prohlížeč videa GTK UVC ++X-GNOME-FullName[de]=UVC-Video-Betrachter in GTK ++X-GNOME-FullName[en_AU]=GTK UVC video viewer ++X-GNOME-FullName[es]=Visualizador GTK de vídeo UVC ++X-GNOME-FullName[fr]=Logiciel GTK de visualisation de vidéo UVC ++X-GNOME-FullName[it]=GTK UVC visualizzatore video ++X-GNOME-FullName[lv]=GTK UVC video skatītājs ++X-GNOME-FullName[nl]=GTK UVC videokijker ++X-GNOME-FullName[pt]=Visualizador de vídeo GTK UVC ++X-GNOME-FullName[pt_BR]=Visualizador de vídeo GTK UVC ++X-GNOME-FullName[ru]=GTK UVC видео обозреватель ++X-GNOME-FullName[si]=GTK UVC වීඩියෝ දකින්නා ++X-GNOME-FullName[sr]=ГТК УВЦ видео приказивач ++X-GNOME-FullName[tr]=GTK UVC video görüntüleyici ++Comment=A video viewer and capturer for the linux uvc driver ++Comment[cs]=Prohlížení a zachytávání videa z linuxových uvc ovladačů ++Comment[de]=Ein Video-Betrachter und Aufnahmewerkzeug für den Linux-UVC-Treiber ++Comment[en_AU]=A video viewer and capturer for the linux uvc driver ++Comment[es]=Un visualizador y capturador de vídeo para el controlador UVC de Linux ++Comment[fr]=Logiciel de visualisation et de capture vidéo pour le pilote uvc Linux ++Comment[it]=Un visualizzatore e catturatore video per il driver uvc di linux ++Comment[lv]=Video skatītājs un uzņēmējs Linux UVC draiverim ++Comment[nl]=Een programma voor het bekijken en opnemen van video, voor het Linuxstuurprogramma uvc ++Comment[pt]=Um visualizador e capturador de de vídeo para o controlador linux uvc ++Comment[pt_BR]=Um visualizador e capturador de de vídeo para o controlador linux uvc ++Comment[ru]=Программа просмотра и записи видео для драйвера Linux UVC ++Comment[si]=ලිනක්ස් uvc ඩ්‍රයිවරය සඳහා වීඩියෝ පෙන්වන්නා සහ ග්‍රහණය කරන්නා ++Comment[sr]=Приказивач и снимач видеа за линуксов увц управљачки програм ++Comment[tr]=Linux uvc sürücüsü için video görüntüleyici ve yakalayıcı + TryExec=guvcview + Exec=guvcview + Icon=@DATADIR@/pixmaps/guvcview.png +-- +2.51.1 + diff --git a/_multibuild b/_multibuild new file mode 100644 index 0000000..de9a3e0 --- /dev/null +++ b/_multibuild @@ -0,0 +1,3 @@ + + qt5 + diff --git a/fix-linking.patch b/fix-linking.patch new file mode 100644 index 0000000..d7a2617 --- /dev/null +++ b/fix-linking.patch @@ -0,0 +1,26 @@ +diff --git a/gview_encoder/CMakeLists.txt b/gview_encoder/CMakeLists.txt +index 8942bae..a39fdaf 100644 +--- a/gview_encoder/CMakeLists.txt ++++ b/gview_encoder/CMakeLists.txt +@@ -24,7 +24,7 @@ set_target_properties( + + pkg_check_modules(FFMPEG REQUIRED libavcodec libavutil) + +-target_link_libraries(gviewencoder ${FFMPEG_LIBRARIES}) ++target_link_libraries(gviewencoder ${FFMPEG_LIBRARIES} m) + add_definitions(${FFMPEG_CFLAGS} ${FFMPEG_CFLAGS_OTHER}) + + include_directories(${CMAKE_SOURCE_DIR}/includes) +diff --git a/gview_v4l2core/CMakeLists.txt b/gview_v4l2core/CMakeLists.txt +index 1ca4aa1..e204238 100644 +--- a/gview_v4l2core/CMakeLists.txt ++++ b/gview_v4l2core/CMakeLists.txt +@@ -31,7 +31,7 @@ set_target_properties( + pkg_check_modules(V4L2 REQUIRED + libv4l2 libudev libusb-1.0 libavcodec>=57.16 libavutil libpng) + +-target_link_libraries(gviewv4l2core ${V4L2_LIBRARIES}) ++target_link_libraries(gviewv4l2core ${V4L2_LIBRARIES} m) + add_definitions(${V4L2_CFLAGS} ${V4L2_CFLAGS_OTHER}) + + add_compile_definitions(GETTEXT_PACKAGE_V4L2CORE="gview_v4l2core") diff --git a/fix-pkgconfig-path.patch b/fix-pkgconfig-path.patch new file mode 100644 index 0000000..549d885 --- /dev/null +++ b/fix-pkgconfig-path.patch @@ -0,0 +1,52 @@ +diff --git a/gview_audio/CMakeLists.txt b/gview_audio/CMakeLists.txt +index 9714745..3bea235 100644 +--- a/gview_audio/CMakeLists.txt ++++ b/gview_audio/CMakeLists.txt +@@ -42,7 +42,7 @@ if(INSTALL_DEVKIT) + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/gviewaudio.h TYPE INCLUDE) + install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/libgviewaudio.pc +- DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/pkgconfig ++ DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig + ) + endif() + +diff --git a/gview_encoder/CMakeLists.txt b/gview_encoder/CMakeLists.txt +index a39fdaf..dae9b1f 100644 +--- a/gview_encoder/CMakeLists.txt ++++ b/gview_encoder/CMakeLists.txt +@@ -36,7 +36,7 @@ if(INSTALL_DEVKIT) + + install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/libgviewencoder.pc +- DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/pkgconfig ++ DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig + ) + endif() + +diff --git a/gview_render/CMakeLists.txt b/gview_render/CMakeLists.txt +index e63ba39..8cc3e7d 100644 +--- a/gview_render/CMakeLists.txt ++++ b/gview_render/CMakeLists.txt +@@ -53,7 +53,7 @@ if(INSTALL_DEVKIT) + + install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/libgviewrender.pc +- DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/pkgconfig ++ DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig + ) + endif() + +diff --git a/gview_v4l2core/CMakeLists.txt b/gview_v4l2core/CMakeLists.txt +index e204238..8eed292 100644 +--- a/gview_v4l2core/CMakeLists.txt ++++ b/gview_v4l2core/CMakeLists.txt +@@ -44,7 +44,7 @@ if(INSTALL_DEVKIT) + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/gviewv4l2core.h TYPE INCLUDE) + install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/libgviewv4l2core.pc +- DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/pkgconfig ++ DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig + ) + endif() + diff --git a/guvcview-SUSE.patch b/guvcview-SUSE.patch new file mode 100644 index 0000000..b4d5445 --- /dev/null +++ b/guvcview-SUSE.patch @@ -0,0 +1,36 @@ +From: Luigi Baldoni +Date: 2017-07-28 17:04:22 +0200 +Subject: SUSE-specific paths + +Change filenames and paths to SUSE standards instead +of messing with them in the .spec file. + +Index: guvcview-src-2.0.8/Makefile.am +=================================================================== +--- guvcview-src-2.0.8.orig/Makefile.am ++++ guvcview-src-2.0.8/Makefile.am +@@ -27,14 +27,6 @@ pkgconfig_DATA = pkgconfig/libgviewv4l2c + + ACLOCAL_AMFLAGS = -I m4 + +-docdir = ${datadir}/doc/guvcview +-doc_DATA = \ +- README.md\ +- COPYING\ +- AUTHORS\ +- ChangeLog\ +- INSTALL +- + EXTRA_DIST = bootstrap.sh + + check-gettext: +Index: guvcview-src-2.0.8/data/icons/Makefile.am +=================================================================== +--- guvcview-src-2.0.8.orig/data/icons/Makefile.am ++++ guvcview-src-2.0.8/data/icons/Makefile.am +@@ -1,4 +1,4 @@ +-iconsdir = ${datadir}/pixmaps/guvcview ++iconsdir = ${datadir}/pixmaps/ + icons_DATA = \ + guvcview.png + diff --git a/guvcview-qt.desktop b/guvcview-qt.desktop new file mode 100644 index 0000000..4bd3729 --- /dev/null +++ b/guvcview-qt.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Name=guvcview-qt6 +GenericName=Qt UVC video viewer +Comment=A video viewer and capturer for the linux uvc driver +TryExec=guvcview-qt6 +Exec=guvcview-qt6 +Icon=/usr/share/pixmaps/guvcview.png +Terminal=false +Type=Application +Categories=Video;AudioVideo; +StartupNotify=true diff --git a/guvcview-qt5-nolibs_qt5names.patch b/guvcview-qt5-nolibs_qt5names.patch new file mode 100644 index 0000000..01f62fd --- /dev/null +++ b/guvcview-qt5-nolibs_qt5names.patch @@ -0,0 +1,83 @@ +From: Luigi Baldoni +Date: 2017-07-28 17:05:35 +0200 +Subject: Modifications for the -qt5 package + +Don't build libraries and rely on those supplied by the +regular (GTK+) package. +Also change a few filenames to avoid collisions. + +Index: guvcview-src-2.0.8/Makefile.am +=================================================================== +--- guvcview-src-2.0.8.orig/Makefile.am ++++ guvcview-src-2.0.8/Makefile.am +@@ -1,13 +1,8 @@ + ## Process this file with automake to produce Makefile.in + +-SUBDIRS = gview_v4l2core \ +- gview_audio \ +- gview_render \ +- gview_encoder \ +- guvcview \ ++SUBDIRS = guvcview \ + data \ +- po \ +- po/gview_v4l2core ++ po + + #Distribute these directories: + DIST_SUBDIRS = gview_v4l2core \ +@@ -19,12 +14,6 @@ DIST_SUBDIRS = gview_v4l2core \ + po \ + po/gview_v4l2core + +-pkgconfigdir = $(libdir)/pkgconfig +-pkgconfig_DATA = pkgconfig/libgviewv4l2core.pc \ +- pkgconfig/libgviewaudio.pc \ +- pkgconfig/libgviewrender.pc \ +- pkgconfig/libgviewencoder.pc +- + ACLOCAL_AMFLAGS = -I m4 + + EXTRA_DIST = bootstrap.sh +Index: guvcview-src-2.0.8/guvcview/Makefile.am +=================================================================== +--- guvcview-src-2.0.8.orig/guvcview/Makefile.am ++++ guvcview-src-2.0.8/guvcview/Makefile.am +@@ -57,14 +57,14 @@ guvcview_CPPFLAGS = $(guvcview_CFLAGS) \ + -fPIC + endif + +-guvcview_LDFLAGS = $(LIBINTL) ++guvcview_LDFLAGS = $(LIBINTL) \ ++ $(shell pkg-config --libs libgviewv4l2core) \ ++ $(shell pkg-config --libs libgviewrender) \ ++ $(shell pkg-config --libs libgviewaudio) \ ++ $(shell pkg-config --libs libgviewencoder) + +-guvcview_LDADD = ../gview_v4l2core/$(GVIEWV4L2CORE_LIBRARY_NAME).la \ +- ../gview_render/$(GVIEWRENDER_LIBRARY_NAME).la \ +- ../gview_audio/$(GVIEWAUDIO_LIBRARY_NAME).la \ +- ../gview_encoder/$(GVIEWENCODER_LIBRARY_NAME).la \ +- $(PTHREAD_LIBS) \ +- -lm ++guvcview_LDADD = -lpthread \ ++ -lm + if HAVE_GTK3 + guvcview_LDADD += $(GUIGTK3_LIBS) + endif +Index: guvcview-src-2.0.8/configure.ac +=================================================================== +--- guvcview-src-2.0.8.orig/configure.ac ++++ guvcview-src-2.0.8/configure.ac +@@ -73,9 +73,9 @@ GETTEXT_PACKAGE_V4L2CORE=gview_v4l2core + AC_SUBST(GETTEXT_PACKAGE_V4L2CORE) + AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE_V4L2CORE,"$GETTEXT_PACKAGE_V4L2CORE", [gview_v4l2core]) + +-GETTEXT_PACKAGE=guvcview ++GETTEXT_PACKAGE=guvcview-qt5 + AC_SUBST(GETTEXT_PACKAGE) +-AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [guvcview]) ++AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [guvcview-qt5]) + + IT_PROG_INTLTOOL([0.40]) + IT_PO_SUBDIR(po/gview_v4l2core) diff --git a/guvcview-src-2.1.0.tar.bz2 b/guvcview-src-2.1.0.tar.bz2 new file mode 100644 index 0000000..5762595 --- /dev/null +++ b/guvcview-src-2.1.0.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3d93e4c9fab8d1a7a9bde1a6dbbf04d6cf9d347c134b5128b4586a1d90b63cfb +size 775670 diff --git a/guvcview-src-2.2.1.tar.bz2 b/guvcview-src-2.2.1.tar.bz2 new file mode 100644 index 0000000..1e0d7c1 --- /dev/null +++ b/guvcview-src-2.2.1.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d2adc7ce762961e853c3e16b511bad61504492d12f3e2eb7e30da4a2f7ade5af +size 355747 diff --git a/guvcview-src-2.2.2.tar.bz2 b/guvcview-src-2.2.2.tar.bz2 new file mode 100644 index 0000000..829a9ea --- /dev/null +++ b/guvcview-src-2.2.2.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6a1b1348b99e79da957a0d9e237395a54757a09db7e0c0809f6c30668b69da3b +size 363756 diff --git a/guvcview.changes b/guvcview.changes new file mode 100644 index 0000000..8d36388 --- /dev/null +++ b/guvcview.changes @@ -0,0 +1,349 @@ +------------------------------------------------------------------- +Fri Nov 14 16:55:53 UTC 2025 - Martin Hauke + +- Update to version 2.2.2 + * Apply ffmpeg8 and musl patches by Paul Zander. + * Update to SFML 3.0 . + * Fix some spelling errors. + * Add support for OBSMEET4K. +- Drop patches: + * 0001-fix-deprecation-warning-with-ffpmeg-7.1-add-Wall-to-.patch + * 0002-Fix-desktop-file-for-cmake.patch + +------------------------------------------------------------------- +Wed Nov 12 19:15:51 UTC 2025 - Martin Hauke + +- Add desktop file for guvcview-qt6 + +------------------------------------------------------------------- +Tue Nov 4 14:01:22 UTC 2025 - Martin Hauke + +- Switch to cmake +- Drop multibuild; use a wrapper script instead +- Use %ldconfig_scriptlets +- Update to version 2.2.1 + * Fix encoder video timestamps + * Fix encoder video codec defaults + * Move from qt5 to qt6 + * Change build system from autoconf to cmake + * Add support for yuv420p pixel format for MJPG decoding +- Drop patches (not longer needed): + * 0001-Fix-build-with-GCC-14.patch + * guvcview-SUSE.patch + * guvcview-qt5-nolibs_qt5names.patch + * 0001-Fix-build-with-GCC-14.patch +- Add patches: + * 0001-fix-deprecation-warning-with-ffpmeg-7.1-add-Wall-to-.patch + * 0002-Fix-desktop-file-for-cmake.patch + * fix-linking.patch + * fix-pkgconfig-path.patch + +------------------------------------------------------------------- +Thu Mar 13 18:44:01 UTC 2025 - Jan Engelhardt + +- Use pkgconfig() to be impervious to package renames. + +------------------------------------------------------------------- +Tue Aug 27 18:06:06 UTC 2024 - Dave Plater + +- Revert to ffmpeg-7 + +------------------------------------------------------------------- +Tue Aug 27 10:47:09 UTC 2024 - Dave Plater + +- Force ffmpeg-6 library use in order to fix build + +------------------------------------------------------------------- +Tue Aug 27 08:07:37 UTC 2024 - Christophe Marin + +- Update to 2.1.0 + * Fix audio channels deprecated warning for avcodec >= 58 + * Add button click support for certain type of digital + microscopes + * Small fixes + * Fix minimum version for audio channels api deprecated + warning for avcodec >= 59 + * Fix COPYING to the same GPL version (v2) as the source files + * Add binary fx filter + * Make guvcview skip metadada devices + * Enable OSD crosshair size to be changed in config +- Add patch to fix build failure with GCC 14: + * 0001-Fix-build-with-GCC-14.patch +- Fix license. There's no GPL-3.0-only file that could impact + the binaries license. +- Spec cleanup + +------------------------------------------------------------------- +Tue Feb 27 11:16:13 UTC 2024 - Dominique Leuenberger + +- Use %patch -P N instead of deprecated %patchN. + +------------------------------------------------------------------- +Mon Aug 8 22:06:07 UTC 2022 - Atri Bhattacharya + +- Update to version 2.0.8: + * Fix libav API break (ticket #70) + * Update autoconf scripts + * Support for building against ffmpeg5. +- Changes from version 2.0.7: + * Fix audio encoder (tickets #64 and #65) + * Use current theme icons (get icon by name) +- Convert to multibuild with qt5 as additional flavor: + * Drop guvcview-qt5.spec, guvcview-qt5.changes, pre_checkin.sh + script. + * Drop hunks from guvcview-qt5-nolibs_qt5names.patch duplicated + in guvcview-SUSE.patch. + * Adapt BuildRequires for the additional flavour appropriately. +- Update so versions in keeping with upstream shlib versioning. +- Replace packageand type Supplements with RPM binary Supplements. +- Update guvcview-SUSE.patch to drop icon dir restructuring: no + longer needed after all theme-able application icons dropped. + +------------------------------------------------------------------- +Mon Feb 3 13:51:18 UTC 2020 - Dominique Leuenberger + +- BuildRequire pkgconfig(libudev) instead of libudev-devel: allow + OBS to shortcut through the -mini flavors. + +------------------------------------------------------------------- +Tue Feb 12 18:24:24 UTC 2019 - bjorn.lie@gmail.com + +- Update to version 2.0.6: + * No upstream changes provided, please see + https://sourceforge.net/p/guvcview/git-master/ci/master/tree/ +- No longer force use ffmpeg3 version of pkgconfig(libav*). +- Drop guvcview-qt5-ppc64_QVariant.patch: Fixed upstream. +- Rebase guvcview-qt5-nolibs_qt5names.patch with quilt. + +------------------------------------------------------------------- +Fri May 4 14:03:47 UTC 2018 - olaf@aepfle.de + +- Use ffmpeg3 versions of pkgconfig(libav*) + +------------------------------------------------------------------- +Mon Sep 11 18:48:13 UTC 2017 - jengelh@inai.de + +- Update summary of -devel subpackage. + +------------------------------------------------------------------- +Sat Jul 29 10:53:31 UTC 2017 - aloisio@gmx.com + +- Update to version 2.0.5 + * terminate configure if qt5 is enabled and moc is missing + * add sfml render + * fix aac encoder (replace experimental aac by libvo_aacenc) + * fix build against newer kernels + * disable window key pressed events if a string control has focus + * fix video monotonic pts flag value in encoder context + * fix audio cleanup + * add support for HEVC (h265) video codec + * fix muxed h264 support; fix raw output (alloc outbuf frame) + * add circular buffer for delayed audio frames pts + * remove support for older libavcodec versions (< 54.01) + * add support for VP9 + * fix motion estimation method for x264 [1-4] + * fix buggy behaviour for file names without extension + * add support for sfml render + * drop support for sdl1 based render + * Flavio Spagnuolo : fix matroska + clean up when audio is disabled + * fix segfault when destroying mutexes by unlocking already + unlocked mutexes + * fix libc readdir_r deprecated warning: replace by readdir + * add extra video fx filters + +- Dropped guvcview-2.0.4_ffmpeg-3.0.patch (merged upstream) + +- Split lang package contents between guvcview-lang and a new + libgviewv4l2core-lang + +- Added separate -qt5 and -qt5-lang packages and pre_checkin.sh + and guvcview-qt5-nolibs_qt5names.patch to support them + +- Added guvcview-qt5-ppc64_QVariant.patch to fix build on ppc64 + +- Replaced some in-spec commands with guvcview-SUSE.patch + +------------------------------------------------------------------- +Thu Mar 2 10:28:49 UTC 2017 - jengelh@inai.de + +- Rename %soname to %sover to better reflect its use +- Ensure description neutrality + +------------------------------------------------------------------- +Sun May 1 18:06:05 UTC 2016 - aloisio@gmx.com + +- Update to version 2.0.4: + * drop support for internal 422 packed format (use only 420 planar) + * add support for extra pixel formats, including be formats + * add command line option for requesting fps + * add support for control events + * add support for string, int64, bitmask and integer menu controls + * make sure we can't select unsuported pix formats from the gui + * fix status message for QT5 interface + * move mutexes to device handlers (context) + * v4l2core and audio api - don't access device data directly (use opaque structures) + * add constructor and destructor functions for v4l2core and encoder + Paulo Assis Mon, 22 Feb 2016 10:10:00 +0100 + 2.0.3: + * Add Qt5 interface (--enable-qt5) + * fix '-n' option (don't save frame when photo countdown reaches 0) + * restore exit_on_term option + * use AC_SYS_LARGEFILE m4 macro for enabling Large File Support (LFS) on 32 bit systems + * add color config for crosshair osd + * change rendering engine to use updateTexture instead of lock/unlock texture + * change rendering lib to avoid frame copy when using osd + Paulo Assis Mon, 4 Jan 2016 23:34:00 +0100 + +- Dropped guvcview-implicit-pointer-decl.patch + guvcview-no-return-in-nonvoid-function.patch + guvcview-voidreturn.patch + +- Added guvcview-2.0.4_ffmpeg-3.0.patch + +------------------------------------------------------------------- +Tue Sep 22 08:47:31 UTC 2015 - olaf@aepfle.de + +- Use pkgconfig for ffmpeg BuildRequires + +------------------------------------------------------------------- +Wed Aug 05 10:49:17 UTC 2015 - joerg.lorenzen@ki.tng.de + +- Update to version 2.0.2: + + fix mjpeg and h264 decoders (libav): init avpacket. + + fix wrong logic of enable switches (Marvin Schmidt ticket #12). + + create a frame queue and refactor frame grab/decode. + + fix jpeg decoder for older libavcodec api ( < 54.25). + + attach video capture to SIGUSR1 signal. + + add audio latency control to gui. + + change default portaudio latency to high latency. + + set device during initialization. + + use time for matroska segment uid if gsl is disabled. + + fix array index causing buffer overflow. + + restore CPPFLAGS after AC_CHECK_HEADERS. + + remove direct access to device data in v4l2core lib. + + make sure to stop encoder thread before exiting capture thread. + + avoid SIGFPE on bad channels or samprate data inside audio + capture callbacks. + + remove check for avcodec.h (it's needed for very old libavcodec + versions); set iyuv as default internal format (over yuyv). + + add basic support for continuous and stepwise frame sizes. + + add support for empty control list. + + add code for crossair osd. + + fix h264 demux from mjpg container. + + fix pan/tilt for logitech peripheral V3 (use raw control + instead of v4l2). + +------------------------------------------------------------------- +Fri Oct 31 11:53:42 UTC 2014 - joerg.lorenzen@ki.tng.de + +- Update to version 2.0.1: + + Fix audio clean bug (segfault when audio=none). + + Add --disable_libv4l2 option. + + Add support for internal yu12 planar format. + + Workaround uvcvideo bug (buf.bytesused=0 on kernels >=3.16). +- Changes since version 2.0.0: + + New version 2.0.0 (code rewriten from scratch). + + Move all core functions to 4 shared libs. + + Change options. + + Change config. + + Add sdl2 render. + + Use gsl for random number generation. +- Changes since version 1.7.3: + + Add silence frames to compensate audio drift (delay). + + Fix possible memory leak. + + Add video and image capture through system signals: + SIGUSR1 and SIGUSR2. + + Add true no_display mode (no X required). + + Small bug fixes. +- Changes since version 1.7.2: + + Add H264 decoding support. + + Sync translations. +- Changes since version 1.7.1: + + Fix avi muxer: fix opendml indexes (>= 1Gb). + + Update Italian translation. + +------------------------------------------------------------------- +Tue Jul 30 13:34:46 UTC 2013 - i@margueirte.su + +- build against libffmpeg-devel. + +------------------------------------------------------------------- +Sat Jul 20 20:41:27 UTC 2013 - zaitor@opensuse.org + +- Update to version 1.7.0: + + Refactor avi muxer (base it on libav muxer with opendml + support). + + Refactor mkv muxer (base it on libav muxer with webm support). + + Add VP8, Theora and Vorbis codecs. + + Add Webm support. + + Add a Top Menu. + + Move all file operations to the Top Menu. + +------------------------------------------------------------------- +Fri Sep 20 12:27:00 UTC 2012 - zaitor@opensuse.org + +- Update to version 1.6.1: + + Fix build with latest libavcodec. + + Fix audio codecs listing. + + Fix audio codecs (AC3 and AAC) input format for latest + libavcodec API (float). + + Add support for delayed frames in video encoding. +- Changes since version 1.6.0: + + Run audio in separate thread. + + Update audio buffer. + + Move pulse audio interface from simple to async API. + + Add pulse device list. + + Enable build of pulse API by default. +- Added new build dependency, intltool. + +------------------------------------------------------------------- +Sun May 20 14:28:10 UTC 2012 - zaitor@opensuse.org + +- Update to version 1.5.3: + + Update libavcodec API. + + Add libavutil dependency. + + Fix pulse interface. + + Update language catalogs. +- Drop guvcview-pulseaudio-fix.patch, fixed upstream. +- Change BuildRequires: pulseaudio-devel to libpulse-devel. + +------------------------------------------------------------------- +Sun Feb 26 15:52:45 UTC 2012 - zaitor@opensuse.org + +- Update to version 1.5.2: + + Move to pthreads (fix gthread API 2 issues). + + Add italian translation. + + Fix several libavcodec issues. + + Fix some gtk3 widgets. +- Drop guvcview-fix-glib-include.patch, fixed upstream. +- Add guvcview-pulseaudio-fix.patch: Fix pulseaudio interface. + +------------------------------------------------------------------- +Mon Jan 23 00:48:09 UTC 2012 - malcolmlewis@opensuse.org + +- Updated to version 1.5.1: + + Moved to gtk3. + + Make control window size dependent on screen resolution. + + Threaded coding patch - George Sedov . + + Fix h264 codec properties. +- Updates from version 1.5.0: + + Add a no display mode (--no_display). + + Fix build issues with newer versions (>=0.7.x) of ffmpeg + libavcodec. + + Add support for unix signals. + + Add VU meter OSD. + + Fix menu controls (linux 3.0). +- Add guvcview-fix-glib-include.patch: To fix only can be + included directly error for builds > 1210. + +------------------------------------------------------------------- +Mon Oct 3 19:28:19 UTC 2011 - malcolmlewis@opensuse.org + +- Fix guvcview.desktop file in spec file. + +------------------------------------------------------------------- +Fri Jul 1 02:06:44 UTC 2011 - malcolmlewis@opensuse.org + +- Initial build based on fc15 spec file. + diff --git a/guvcview.spec b/guvcview.spec new file mode 100644 index 0000000..df3542d --- /dev/null +++ b/guvcview.spec @@ -0,0 +1,208 @@ +# +# spec file for package guvcview +# +# Copyright (c) 2025 SUSE LLC and contributors +# Copyright (c) 2012 Malcolm J Lewis +# Copyright (c) 2013 Marguerite Su +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +%define sover 2_2-2 +Name: guvcview +Version: 2.2.2 +Release: 0 +Summary: GTK+ UVC Viewer and Capturer +# Reference to GPL-2.0 in some files? +License: GPL-2.0-or-later +Group: Productivity/Multimedia/Video/Players +URL: https://guvcview.sourceforge.net/ +#Git-Clone: git://git.code.sf.net/p/guvcview/git-master +Source0: https://sourceforge.net/projects/guvcview/files/source/guvcview-src-%{version}.tar.bz2 +Source1: guvcview-qt.desktop +Patch5: fix-linking.patch +Patch6: fix-pkgconfig-path.patch +BuildRequires: cmake +BuildRequires: fdupes +BuildRequires: gcc-c++ +BuildRequires: libpng-devel +BuildRequires: pkgconfig +BuildRequires: pkgconfig(Qt6Core) +BuildRequires: pkgconfig(Qt6Gui) +BuildRequires: pkgconfig(Qt6Widgets) +BuildRequires: pkgconfig(alsa) +BuildRequires: pkgconfig(gsl) +BuildRequires: pkgconfig(gtk+-3.0) +BuildRequires: pkgconfig(libavcodec) +BuildRequires: pkgconfig(libavutil) +BuildRequires: pkgconfig(libpulse) +BuildRequires: pkgconfig(libudev) +BuildRequires: pkgconfig(libusb-1.0) +BuildRequires: pkgconfig(libv4l2) +BuildRequires: pkgconfig(portaudio-2.0) +BuildRequires: pkgconfig(sdl2) +Recommends: %{name}-lang + +%description +A GTK interface for capturing and viewing video from devices +supported by the Linux UVC driver, although it should also work with +any v4l2 compatible device. + +%package -n libgviewaudio-%{sover} +Summary: GTK+ UVC Viewer and Capturer +Group: System/Libraries + +%description -n libgviewaudio-%{sover} +A GTK interface for capturing and viewing video from devices +supported by the Linux UVC driver, although it should also work with +any v4l2 compatible device. + +%package -n libgviewencoder-%{sover} +Summary: GTK+ UVC Viewer and Capturer +Group: System/Libraries + +%description -n libgviewencoder-%{sover} +A GTK interface for capturing and viewing video from devices +supported by the Linux UVC driver, although it should also work with +any v4l2 compatible device. + +%package -n libgviewrender-%{sover} +Summary: GTK+ UVC Viewer and Capturer +Group: System/Libraries + +%description -n libgviewrender-%{sover} +A GTK interface for capturing and viewing video from devices +supported by the Linux UVC driver, although it should also work with +any v4l2 compatible device. + +%package -n libgviewv4l2core-%{sover} +Summary: GTK+ UVC Viewer and Capturer +Group: System/Libraries +Recommends: libgviewv4l2core-lang + +%description -n libgviewv4l2core-%{sover} +A GTK interface for capturing and viewing video from devices +supported by the Linux UVC driver, although it should also work with +any v4l2 compatible device. + +%package devel +Summary: Development files for guvcview +Group: Development/Libraries/C and C++ +Requires: glibc-devel +Requires: libgviewaudio-%{sover} = %{version}-%{release} +Requires: libgviewencoder-%{sover} = %{version}-%{release} +Requires: libgviewrender-%{sover} = %{version}-%{release} +Requires: libgviewv4l2core-%{sover} = %{version}-%{release} +Requires: libpng-devel +Requires: pkgconfig(alsa) +Requires: pkgconfig(gsl) +Requires: pkgconfig(libavcodec) +Requires: pkgconfig(libavutil) +Requires: pkgconfig(libpulse) +Requires: pkgconfig(libudev) +Requires: pkgconfig(libusb-1.0) +Requires: pkgconfig(libv4l2) +Requires: pkgconfig(portaudio-2.0) +Requires: pkgconfig(sdl2) + +%description devel +A GTK interface for capturing and viewing video from devices +supported by the Linux UVC driver, although it should also work with +any v4l2 compatible device. + +This subpackage contains the header files for developing +applications that want to make use of the GUVC libraries. + +%lang_package + +%package -n libgviewv4l2core-lang +Summary: Languages for libgviewv4l2core +Group: System/Localization +Requires: libgviewv4l2core-%{sover} = %{version} +Provides: libgviewv4l2core-lang-all = %{version} +Supplements: (bundle-lang-other and libgviewv4l2core-%{sover}) +BuildArch: noarch + +%description -n libgviewv4l2core-lang +Provides translations to libgviewv4l2core. + +%prep +%autosetup -p1 -n %{name}-src-%{version} + +%build +%cmake \ + -DUSE_GTK3=ON \ + -DUSE_QT6=ON \ + -DUSE_SDL2=ON \ + -DINSTALL_DEVKIT=ON +%make_jobs + +%install +%cmake_install + +# wrapper for guvcview-qt6 +echo -e "#!/bin/sh\nexec %{_bindir}/guvcview --gui=qt6 \"\$@\"" > %{buildroot}%{_bindir}/guvcview-qt6 +chmod 755 %{buildroot}%{_bindir}/guvcview-qt6 + +install -Dpm 0644 %{SOURCE1} %{buildroot}%{_datadir}/applications/%{name}-qt6.desktop + +%find_lang %{name} %{?no_lang_C} +%find_lang gview_v4l2core libgviewv4l2core.lang %{?no_lang_C} + +%ldconfig_scriptlets -n libgviewaudio-%{sover} +%ldconfig_scriptlets -n libgviewencoder-%{sover} +%ldconfig_scriptlets -n libgviewrender-%{sover} +%ldconfig_scriptlets -n libgviewv4l2core-%{sover} + +%files +%license COPYING +%doc AUTHORS ChangeLog README.md +%{_bindir}/%{name} +%{_bindir}/%{name}-qt6 +%{_datadir}/applications/%{name}.desktop +%{_datadir}/applications/%{name}-qt6.desktop +%{_datadir}/appdata/%{name}.appdata.xml +%{_datadir}/pixmaps/%{name}.png +%{_mandir}/man1/%{name}.1%{?ext_man} + +%files -n libgviewaudio-%{sover} +%{_libdir}/libgviewaudio.so.* + +%files -n libgviewencoder-%{sover} +%{_libdir}/libgviewencoder.so.* + +%files -n libgviewrender-%{sover} +%{_libdir}/libgviewrender.so.* + +%files -n libgviewv4l2core-%{sover} +%{_libdir}/libgviewv4l2core.so.* + +%files devel +%{_includedir}/gviewaudio.h +%{_includedir}/gviewencoder.h +%{_includedir}/gviewrender.h +%{_includedir}/gviewv4l2core.h +%{_libdir}/libgviewaudio.so +%{_libdir}/libgviewencoder.so +%{_libdir}/libgviewrender.so +%{_libdir}/libgviewv4l2core.so +%{_libdir}/pkgconfig/libgviewaudio.pc +%{_libdir}/pkgconfig/libgviewencoder.pc +%{_libdir}/pkgconfig/libgviewrender.pc +%{_libdir}/pkgconfig/libgviewv4l2core.pc + +%files -n libgviewv4l2core-lang -f libgviewv4l2core.lang + +%files lang -f %{name}.lang + +%changelog -- 2.51.1