Compare commits

..

No commits in common. "master" and "khorben/gtk3" have entirely different histories.

25 changed files with 421 additions and 873 deletions

View File

@ -1,8 +1,7 @@
dist=Makefile,org.defora.camera.desktop,org.defora.gallery.desktop
dist=Makefile,deforaos-camera.desktop,deforaos-gallery.desktop
#dist
[org.defora.camera.desktop]
[deforaos-camera.desktop]
install=$(PREFIX)/share/applications
[org.defora.gallery.desktop]
[deforaos-gallery.desktop]
install=$(PREFIX)/share/applications

View File

@ -1,6 +1,6 @@
#!/bin/sh
#$Id$
#Copyright (c) 2012-2024 Pierre Pronchery <khorben@defora.org>
#Copyright (c) 2012-2015 Pierre Pronchery <khorben@defora.org>
#
#Redistribution and use in source and binary forms, with or without
#modification, are permitted provided that the following conditions are met:
@ -25,22 +25,17 @@
#variables
CONFIGSH="${0%/docbook.sh}/../config.sh"
PREFIX="/usr/local"
[ -f "../config.sh" ] && . "../config.sh"
PROGNAME="docbook.sh"
XSL_HTML="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"
XSL_MAN="http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl"
XSL_PDF="http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl"
#executables
DEBUG="_debug"
FOP="fop"
INSTALL="install -m 0644"
MKDIR="mkdir -m 0755 -p"
RM="rm -f"
XMLLINT="xmllint --noent --nonet --xinclude --path ${PWD}"
XSLTPROC="xsltproc --nonet --xinclude --path ${PWD}"
[ -f "$CONFIGSH" ] && . "$CONFIGSH"
XMLLINT="xmllint"
XSLTPROC="xsltproc --nonet --xinclude"
#functions
@ -63,20 +58,18 @@ _docbook()
ext="${ext##.}"
case "$ext" in
html)
XSL="$XSL_HTML"
XSL="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"
[ -f "${source%.*}.xsl" ] && XSL="${source%.*}.xsl"
[ -f "${target%.*}.xsl" ] && XSL="${target%.*}.xsl"
if [ -f "${target%.*}.css.xml" ]; then
XSLTPROC_PARAMS="--param custom.css.source \"${target%.*}.css.xml\" --param generate.css.header 1"
XSLTPROC="$XSLTPROC --param custom.css.source \"${target%.*}.css.xml\" --param generate.css.header 1"
elif [ -f "${source%.*}.css.xml" ]; then
XSLTPROC_PARAMS="--param custom.css.source \"${source%.*}.css.xml\" --param generate.css.header 1"
else
XSLTPROC_PARAMS=
XSLTPROC="$XSLTPROC --param custom.css.source \"${source%.*}.css.xml\" --param generate.css.header 1"
fi
$DEBUG $XSLTPROC $XSLTPROC_PARAMS -o "$target" "$XSL" "$source"
$DEBUG $XSLTPROC -o "$target" "$XSL" "$source"
;;
pdf)
XSL="$XSL_PDF"
XSL="http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl"
[ -f "${source%.*}.xsl" ] && XSL="${source%.*}.xsl"
[ -f "${target%.*}.xsl" ] && XSL="${target%.*}.xsl"
$DEBUG $XSLTPROC -o "${target%.*}.fo" "$XSL" "$source" &&
@ -84,7 +77,7 @@ _docbook()
$RM -- "${target%.*}.fo"
;;
1|2|3|4|5|6|7|8|9)
XSL="$XSL_MAN"
XSL="http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl"
$DEBUG $XSLTPROC -o "$target" "$XSL" "$source"
;;
*)
@ -121,7 +114,7 @@ _usage()
clean=0
install=0
uninstall=0
while getopts "ciO:uP:" name; do
while getopts "ciuP:" name; do
case "$name" in
c)
clean=1
@ -130,9 +123,6 @@ while getopts "ciO:uP:" name; do
uninstall=0
install=1
;;
O)
export "${OPTARG%%=*}"="${OPTARG#*=}"
;;
u)
install=0
uninstall=1
@ -147,7 +137,7 @@ while getopts "ciO:uP:" name; do
esac
done
shift $((OPTIND - 1))
if [ $# -lt 1 ]; then
if [ $# -eq 0 ]; then
_usage
exit $?
fi
@ -175,9 +165,9 @@ while [ $# -gt 0 ]; do
source="${target#$OBJDIR}"
source="${source%.*}.xml"
xpath="string(/refentry/refmeta/manvolnum)"
section=$($DEBUG $XMLLINT --xpath "$xpath" "$source")
section=$($XMLLINT --xpath "$xpath" "$source")
if [ $? -eq 0 -a -n "$section" ]; then
instdir="$MANDIR/html$section"
instdir="$DATADIR/man/html$section"
fi
;;
pdf)

132
po/es.po
View File

@ -5,166 +5,166 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Camera 0.3.1\n"
"Project-Id-Version: Camera 0.1.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-07-30 02:46+0200\n"
"PO-Revision-Date: 2025-02-20 17:45+0100\n"
"POT-Creation-Date: 2020-01-18 14:16+0100\n"
"PO-Revision-Date: 2015-02-16 07:20+0100\n"
"Last-Translator: Pierre Pronchery <khorben@defora.org>\n"
"Language-Team: Spanish\n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: es\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: ../src/camera.c:213
#: ../src/camera.c:203
msgid "Snapshot"
msgstr ""
#: ../src/camera.c:216
#: ../src/camera.c:206
msgid "Gallery"
msgstr "Galería"
msgstr ""
#: ../src/camera.c:220 ../src/camera.c:227 ../src/camera.c:899
#: ../src/camera.c:909
#: ../src/camera.c:210 ../src/camera.c:217 ../src/camera.c:889
#: ../src/camera.c:899
msgid "Properties"
msgstr "Propriedades"
#: ../src/camera.c:223 ../src/camera.c:716
#: ../src/camera.c:213 ../src/camera.c:706
msgid "Preferences"
msgstr "Preferencias"
#: ../src/camera.c:303
#: ../src/camera.c:293
msgid "Fullscreen"
msgstr "Pantalla completa"
msgstr ""
#: ../src/camera.c:701
#: ../src/camera.c:691
msgid "Nearest"
msgstr ""
#: ../src/camera.c:702
#: ../src/camera.c:692
msgid "Tiles"
msgstr ""
#: ../src/camera.c:703
#: ../src/camera.c:693
msgid "Bilinear"
msgstr ""
#: ../src/camera.c:704
#: ../src/camera.c:694
msgid "Hyperbolic"
msgstr ""
#: ../src/camera.c:731
#: ../src/camera.c:721
msgid "Flip _horizontally"
msgstr ""
#: ../src/camera.c:734
#: ../src/camera.c:724
msgid "Flip _vertically"
msgstr ""
#: ../src/camera.c:737
#: ../src/camera.c:727
msgid "Keep aspect _ratio"
msgstr ""
#: ../src/camera.c:741
#: ../src/camera.c:731
msgid "Interpolation: "
msgstr ""
#: ../src/camera.c:759
#: ../src/camera.c:749
msgid "Picture"
msgstr "Imagen"
msgstr ""
#: ../src/camera.c:765
#: ../src/camera.c:755
msgid "Format: "
msgstr ""
#: ../src/camera.c:784
#: ../src/camera.c:774
msgid "Snapshots"
msgstr ""
#: ../src/camera.c:916
#: ../src/camera.c:906
msgid "Driver: "
msgstr ""
#: ../src/camera.c:920
#: ../src/camera.c:910
msgid "Card: "
msgstr ""
#: ../src/camera.c:924
#: ../src/camera.c:914
msgid "Bus info: "
msgstr ""
#: ../src/camera.c:928
#: ../src/camera.c:918
msgid "Version: "
msgstr ""
#: ../src/camera.c:941
#: ../src/camera.c:931
msgid "Capabilities: "
msgstr ""
#: ../src/camera.c:1005 ../src/camera.c:1009 ../src/camera.c:1029
#: ../src/camera.c:1048 ../src/camera.c:1074 ../src/camera.c:1094
#: ../src/camera.c:1247
#: ../src/camera.c:995 ../src/camera.c:999 ../src/camera.c:1018
#: ../src/camera.c:1037 ../src/camera.c:1063 ../src/camera.c:1083
#: ../src/camera.c:1236
msgid "Could not save picture"
msgstr ""
#: ../src/camera.c:1096
#: ../src/camera.c:1085
msgid "Unknown error"
msgstr ""
#: ../src/camera.c:1200 ../src/camera.c:1204
#: ../src/camera.c:1189 ../src/camera.c:1193
msgid "Error"
msgstr "Error"
#: ../src/camera.c:1433
#: ../src/camera.c:1422
msgid "Could not open the video capture device"
msgstr ""
#: ../src/camera.c:1474
#: ../src/camera.c:1463
msgid "Could not obtain the capabilities"
msgstr ""
#: ../src/camera.c:1478
#: ../src/camera.c:1467
msgid "Not a video capture device"
msgstr ""
#: ../src/camera.c:1491
#: ../src/camera.c:1480
msgid "Cropping not supported"
msgstr ""
#: ../src/camera.c:1497
#: ../src/camera.c:1485
msgid "Could not obtain the video capture format"
msgstr ""
#: ../src/camera.c:1501
#: ../src/camera.c:1489
msgid "Unsupported video capture type"
msgstr ""
#: ../src/camera.c:1512
#: ../src/camera.c:1500
msgid "Unsupported capabilities"
msgstr ""
#: ../src/camera.c:1547
#: ../src/camera.c:1535
msgid "Could not request buffers"
msgstr ""
#: ../src/camera.c:1550
#: ../src/camera.c:1538
msgid "Could not obtain enough buffers"
msgstr ""
#: ../src/camera.c:1554
#: ../src/camera.c:1542
msgid "Could not allocate buffers"
msgstr ""
#: ../src/camera.c:1570
#: ../src/camera.c:1558
msgid "Could not setup buffers"
msgstr ""
#: ../src/camera.c:1576
#: ../src/camera.c:1564
msgid "Could not map buffers"
msgstr ""
#: ../src/main.c:152
#: ../src/main.c:142
#, c-format
msgid ""
"Usage: %s [-d device][-O filename][-HhRrVvx]\n"
@ -179,71 +179,71 @@ msgid ""
" -x\tStart in embedded mode\n"
msgstr ""
#: ../src/window.c:109
#: ../src/window.c:99
msgid "Take _snapshot"
msgstr ""
#: ../src/window.c:112
#: ../src/window.c:102
msgid "_Gallery"
msgstr ""
#: ../src/window.c:115
#: ../src/window.c:105
msgid "_Properties"
msgstr "_Propriedades"
#: ../src/window.c:118
#: ../src/window.c:108
msgid "_Close"
msgstr "_Cerrar"
#: ../src/window.c:125
#: ../src/window.c:115
msgid "_Preferences"
msgstr "_Preferencias"
#: ../src/window.c:132
#: ../src/window.c:122
msgid "_Fullscreen"
msgstr "_Pantalla completa"
msgstr ""
#: ../src/window.c:143
#: ../src/window.c:133
msgid "_Contents"
msgstr "_Contenidos"
#: ../src/window.c:146 ../src/window.c:149
#: ../src/window.c:136 ../src/window.c:139
msgid "_About"
msgstr "Acerca _de"
#: ../src/window.c:156
#: ../src/window.c:146
msgid "_File"
msgstr "_Archivo"
#: ../src/window.c:157
#: ../src/window.c:147
msgid "_Edit"
msgstr "_Editar"
#: ../src/window.c:158
#: ../src/window.c:148
msgid "_View"
msgstr "_Ver"
#: ../src/window.c:159
#: ../src/window.c:149
msgid "_Help"
msgstr "_Ayuda"
#: ../src/window.c:197
#: ../src/window.c:187
msgid "Webcam"
msgstr ""
#: ../src/window.c:202
#: ../src/window.c:192
msgid "Camera"
msgstr "Cámara"
msgstr ""
#: ../src/window.c:422
#: ../src/window.c:412
msgid "Simple webcam application for the DeforaOS desktop"
msgstr ""
#: ../src/window.c:424
#: ../src/window.c:414
msgid "Simple camera application for the DeforaOS desktop"
msgstr ""
#: ../tools/gallery.c:114
#: ../tools/gallery.c:104
#, c-format
msgid "Usage: %s\n"
msgstr "Usage: %s\n"

122
po/fr.po
View File

@ -5,166 +5,166 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Camera 0.3.1\n"
"Project-Id-Version: Camera 0.1.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-07-30 02:46+0200\n"
"PO-Revision-Date: 2025-02-20 17:45+0100\n"
"POT-Creation-Date: 2020-01-18 14:16+0100\n"
"PO-Revision-Date: 2013-01-18 22:31+0100\n"
"Last-Translator: Pierre Pronchery <khorben@defora.org>\n"
"Language-Team: French\n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: fr\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#: ../src/camera.c:213
#: ../src/camera.c:203
msgid "Snapshot"
msgstr "Capture"
#: ../src/camera.c:216
#: ../src/camera.c:206
msgid "Gallery"
msgstr "Gallerie"
#: ../src/camera.c:220 ../src/camera.c:227 ../src/camera.c:899
#: ../src/camera.c:909
#: ../src/camera.c:210 ../src/camera.c:217 ../src/camera.c:889
#: ../src/camera.c:899
msgid "Properties"
msgstr "Propriétés"
#: ../src/camera.c:223 ../src/camera.c:716
#: ../src/camera.c:213 ../src/camera.c:706
msgid "Preferences"
msgstr "Préférences"
#: ../src/camera.c:303
#: ../src/camera.c:293
msgid "Fullscreen"
msgstr "Plein écran"
#: ../src/camera.c:701
#: ../src/camera.c:691
msgid "Nearest"
msgstr "Approximative"
#: ../src/camera.c:702
#: ../src/camera.c:692
msgid "Tiles"
msgstr "Mosaïque"
#: ../src/camera.c:703
#: ../src/camera.c:693
msgid "Bilinear"
msgstr "Bilinéaire"
#: ../src/camera.c:704
#: ../src/camera.c:694
msgid "Hyperbolic"
msgstr "Hyperbolique"
#: ../src/camera.c:731
#: ../src/camera.c:721
msgid "Flip _horizontally"
msgstr "Retourner l'image _horizontalement"
#: ../src/camera.c:734
#: ../src/camera.c:724
msgid "Flip _vertically"
msgstr "Retourner l'image _verticalement"
#: ../src/camera.c:737
#: ../src/camera.c:727
msgid "Keep aspect _ratio"
msgstr "Préserver l'_aspect"
#: ../src/camera.c:741
#: ../src/camera.c:731
msgid "Interpolation: "
msgstr "Interpolation : "
#: ../src/camera.c:759
#: ../src/camera.c:749
msgid "Picture"
msgstr "Image"
#: ../src/camera.c:765
#: ../src/camera.c:755
msgid "Format: "
msgstr "Format : "
#: ../src/camera.c:784
#: ../src/camera.c:774
msgid "Snapshots"
msgstr "Captures"
#: ../src/camera.c:916
#: ../src/camera.c:906
msgid "Driver: "
msgstr "Pilote : "
#: ../src/camera.c:920
#: ../src/camera.c:910
msgid "Card: "
msgstr "Carte : "
#: ../src/camera.c:924
#: ../src/camera.c:914
msgid "Bus info: "
msgstr "Bus : "
#: ../src/camera.c:928
#: ../src/camera.c:918
msgid "Version: "
msgstr "Version : "
#: ../src/camera.c:941
#: ../src/camera.c:931
msgid "Capabilities: "
msgstr "Capacités : "
#: ../src/camera.c:1005 ../src/camera.c:1009 ../src/camera.c:1029
#: ../src/camera.c:1048 ../src/camera.c:1074 ../src/camera.c:1094
#: ../src/camera.c:1247
#: ../src/camera.c:995 ../src/camera.c:999 ../src/camera.c:1018
#: ../src/camera.c:1037 ../src/camera.c:1063 ../src/camera.c:1083
#: ../src/camera.c:1236
msgid "Could not save picture"
msgstr "Impossible d'enregistrer l'image"
#: ../src/camera.c:1096
#: ../src/camera.c:1085
msgid "Unknown error"
msgstr "Erreur inconnue"
#: ../src/camera.c:1200 ../src/camera.c:1204
#: ../src/camera.c:1189 ../src/camera.c:1193
msgid "Error"
msgstr "Erreur"
#: ../src/camera.c:1433
#: ../src/camera.c:1422
msgid "Could not open the video capture device"
msgstr "Impossible d'ouvrir le périphérique de capture vidéo"
#: ../src/camera.c:1474
#: ../src/camera.c:1463
msgid "Could not obtain the capabilities"
msgstr "Impossible d'obtenir les capacités"
#: ../src/camera.c:1478
#: ../src/camera.c:1467
msgid "Not a video capture device"
msgstr "Pas de périphérique de capture vidéo"
#: ../src/camera.c:1491
#: ../src/camera.c:1480
msgid "Cropping not supported"
msgstr "Recadrage non supporté"
#: ../src/camera.c:1497
#: ../src/camera.c:1485
msgid "Could not obtain the video capture format"
msgstr "Impossible d'obtenir le format de capture vidéo"
#: ../src/camera.c:1501
#: ../src/camera.c:1489
msgid "Unsupported video capture type"
msgstr "Type de capture vidéo non supporté"
#: ../src/camera.c:1512
#: ../src/camera.c:1500
msgid "Unsupported capabilities"
msgstr "Capacités non supportées"
#: ../src/camera.c:1547
#: ../src/camera.c:1535
msgid "Could not request buffers"
msgstr "Impossible de demander le cache"
#: ../src/camera.c:1550
#: ../src/camera.c:1538
msgid "Could not obtain enough buffers"
msgstr "Impossible d'obtenir suffisamment de cache"
#: ../src/camera.c:1554
#: ../src/camera.c:1542
msgid "Could not allocate buffers"
msgstr "Impossible d'allouer le cache"
#: ../src/camera.c:1570
#: ../src/camera.c:1558
msgid "Could not setup buffers"
msgstr "Impossible de configurer le cache"
#: ../src/camera.c:1576
#: ../src/camera.c:1564
msgid "Could not map buffers"
msgstr "Impossible d'étaler le cache"
#: ../src/main.c:152
#: ../src/main.c:142
#, c-format
msgid ""
"Usage: %s [-d device][-O filename][-HhRrVvx]\n"
@ -189,71 +189,71 @@ msgstr ""
" -v\tNe pas retourner l'image verticalement\n"
" -x\tDémarrer en mode embarqué\n"
#: ../src/window.c:109
#: ../src/window.c:99
msgid "Take _snapshot"
msgstr "_Prendre une photo"
#: ../src/window.c:112
#: ../src/window.c:102
msgid "_Gallery"
msgstr "_Gallerie"
#: ../src/window.c:115
#: ../src/window.c:105
msgid "_Properties"
msgstr "_Propriétés"
#: ../src/window.c:118
#: ../src/window.c:108
msgid "_Close"
msgstr "_Fermer"
#: ../src/window.c:125
#: ../src/window.c:115
msgid "_Preferences"
msgstr "_Préférences"
#: ../src/window.c:132
#: ../src/window.c:122
msgid "_Fullscreen"
msgstr "_Plein écran"
#: ../src/window.c:143
#: ../src/window.c:133
msgid "_Contents"
msgstr "_Sommaire"
#: ../src/window.c:146 ../src/window.c:149
#: ../src/window.c:136 ../src/window.c:139
msgid "_About"
msgstr "À _propos"
#: ../src/window.c:156
#: ../src/window.c:146
msgid "_File"
msgstr "_Fichier"
#: ../src/window.c:157
#: ../src/window.c:147
msgid "_Edit"
msgstr "É_dition"
#: ../src/window.c:158
#: ../src/window.c:148
msgid "_View"
msgstr "_Vue"
#: ../src/window.c:159
#: ../src/window.c:149
msgid "_Help"
msgstr "_Aide"
#: ../src/window.c:197
#: ../src/window.c:187
msgid "Webcam"
msgstr "Webcam"
#: ../src/window.c:202
#: ../src/window.c:192
msgid "Camera"
msgstr "Caméra"
#: ../src/window.c:422
#: ../src/window.c:412
msgid "Simple webcam application for the DeforaOS desktop"
msgstr "Webcam pour l'environnement DeforaOS"
#: ../src/window.c:424
#: ../src/window.c:414
msgid "Simple camera application for the DeforaOS desktop"
msgstr "Caméra photo pour l'environnement DeforaOS"
#: ../tools/gallery.c:114
#: ../tools/gallery.c:104
#, c-format
msgid "Usage: %s\n"
msgstr "Usage: %s\n"

View File

@ -1,6 +1,6 @@
#!/bin/sh
#$Id$
#Copyright (c) 2010-2020 Pierre Pronchery <khorben@defora.org>
#Copyright (c) 2010-2015 Pierre Pronchery <khorben@defora.org>
#
#Redistribution and use in source and binary forms, with or without
#modification, are permitted provided that the following conditions are met:
@ -25,8 +25,8 @@
#variables
CONFIGSH="${0%/gettext.sh}/../config.sh"
PREFIX="/usr/local"
[ -f "../config.sh" ] && . "../config.sh"
LOCALEDIR="$PREFIX/share/locale"
POTFILES="POTFILES"
PROGNAME="gettext.sh"
@ -40,8 +40,6 @@ MSGMERGE="msgmerge"
RM="rm -f"
XGETTEXT="xgettext --force-po"
[ -f "$CONFIGSH" ] && . "$CONFIGSH"
#functions
#debug
@ -114,7 +112,7 @@ _gettext_pot()
clean=0
install=0
uninstall=0
while getopts "ciO:uP:" name; do
while getopts "ciuP:" name; do
case "$name" in
c)
clean=1
@ -123,9 +121,6 @@ while getopts "ciO:uP:" name; do
uninstall=0
install=1
;;
O)
export "${OPTARG%%=*}"="${OPTARG#*=}"
;;
u)
install=0
uninstall=1
@ -140,7 +135,7 @@ while getopts "ciO:uP:" name; do
esac
done
shift $(($OPTIND - 1))
if [ $# -lt 1 ]; then
if [ $# -eq 0 ]; then
_usage
exit $?
fi

View File

@ -1,5 +1,5 @@
package=Camera
version=0.3.1
version=0.2.0
vendor=Desktop
config=h,sh
@ -7,19 +7,6 @@ subdirs=data,doc,po,src,src/widget,tools,tests
targets=tests
dist=COPYING,Makefile,config.h,config.sh
#modes
[mode::debug]
title=Debug
[mode::embedded-debug]
title=Debug (embedded UI)
[mode::embedded-release]
title=Release (embedded UI)
[mode::release]
title=Release
#targets
[tests]
type=command

View File

@ -1,27 +1,17 @@
/* $Id$ */
/* Copyright (c) 2012-2024 Pierre Pronchery <khorben@defora.org> */
/* Copyright (c) 2012-2020 Pierre Pronchery <khorben@defora.org> */
/* This file is part of DeforaOS Desktop Camera */
/* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
/* 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, version 3 of the License.
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 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.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY ITS AUTHORS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. */
@ -94,7 +84,6 @@ struct _Camera
guint source;
int fd;
struct v4l2_buffer buf;
struct v4l2_capability cap;
struct v4l2_format format;
@ -123,9 +112,7 @@ struct _Camera
GtkWidget * widget;
GtkWidget * window;
PangoFontDescription * bold;
#if GTK_CHECK_VERSION(3, 0, 0)
cairo_surface_t * surface;
#else
#if !GTK_CHECK_VERSION(3, 0, 0)
GdkGC * gc;
#endif
#if GTK_CHECK_VERSION(2, 18, 0)
@ -188,14 +175,14 @@ static gboolean _camera_on_can_mmap(GIOChannel * channel,
GIOCondition condition, gpointer data);
static gboolean _camera_on_can_read(GIOChannel * channel,
GIOCondition condition, gpointer data);
static gboolean _camera_on_drawing_area_configure(GtkWidget * widget,
GdkEventConfigure * event, gpointer data);
#if GTK_CHECK_VERSION(3, 0, 0)
static gboolean _camera_on_drawing_area_draw(GtkWidget * widget, cairo_t * cr,
gpointer data);
static void _camera_on_drawing_area_size_allocate(GtkWidget * widget,
GdkRectangle * allocation, gpointer data);
#else
static gboolean _camera_on_drawing_area_configure(GtkWidget * widget,
GdkEventConfigure * event, gpointer data);
static gboolean _camera_on_drawing_area_expose(GtkWidget * widget,
GdkEventExpose * event, gpointer data);
#endif
@ -272,9 +259,7 @@ Camera * camera_new(GtkWidget * window, GtkAccelGroup * group,
camera->widget = NULL;
camera->window = window;
camera->bold = NULL;
#if GTK_CHECK_VERSION(3, 0, 0)
camera->surface = NULL;
#else
#if !GTK_CHECK_VERSION(3, 0, 0)
camera->gc = NULL;
#endif
camera->pr_window = NULL;
@ -333,14 +318,14 @@ Camera * camera_new(GtkWidget * window, GtkAccelGroup * group,
#if !GTK_CHECK_VERSION(3, 0, 0)
camera->pixmap = NULL;
#endif
g_signal_connect(camera->area, "configure-event", G_CALLBACK(
_camera_on_drawing_area_configure), camera);
#if GTK_CHECK_VERSION(3, 0, 0)
g_signal_connect(camera->area, "draw", G_CALLBACK(
_camera_on_drawing_area_draw), camera);
g_signal_connect(camera->area, "size-allocate", G_CALLBACK(
_camera_on_drawing_area_size_allocate), camera);
#else
g_signal_connect(camera->area, "configure-event", G_CALLBACK(
_camera_on_drawing_area_configure), camera);
g_signal_connect(camera->area, "expose-event", G_CALLBACK(
_camera_on_drawing_area_expose), camera);
#endif
@ -879,52 +864,20 @@ static void _properties_window(Camera * camera)
GtkSizeGroup * group;
GtkWidget * vbox;
GtkWidget * hbox;
char buf[256];
char buf[64];
const struct
{
unsigned int capability;
char const * name;
} capabilities[] =
{
{ V4L2_CAP_VIDEO_CAPTURE, "video capture" },
#ifdef V4L2_CAP_VIDEO_OUTPUT
{ V4L2_CAP_VIDEO_OUTPUT, "video output" },
#endif
#ifdef V4L2_CAP_VIDEO_OVERLAY
{ V4L2_CAP_VIDEO_OVERLAY, "video overlay" },
#endif
#ifdef V4L2_CAP_VBI_CAPTURE
{ V4L2_CAP_VBI_CAPTURE, "VBI capture" },
#endif
#ifdef V4L2_CAP_VBI_OUTPUT
{ V4L2_CAP_VBI_OUTPUT, "VBI output" },
#endif
#ifdef V4L2_CAP_RDS_CAPTURE
{ V4L2_CAP_RDS_CAPTURE, "RDS capture" },
#endif
#ifdef V4L2_CAP_RDS_OUTPUT
{ V4L2_CAP_RDS_OUTPUT, "RDS encoder" },
#endif
#ifdef V4L2_CAP_TUNER
{ V4L2_CAP_VIDEO_CAPTURE, "capture" },
{ V4L2_CAP_VIDEO_OUTPUT, "output" },
{ V4L2_CAP_VIDEO_OVERLAY, "overlay" },
{ V4L2_CAP_TUNER, "tuner" },
#endif
#ifdef V4L2_CAP_AUDIO
{ V4L2_CAP_AUDIO, "audio" },
#endif
#ifdef V4L2_CAP_RADIO
{ V4L2_CAP_RADIO, "radio" },
#endif
#ifdef V4L2_CAP_MODULATOR
{ V4L2_CAP_MODULATOR, "modulator" },
#endif
{ V4L2_CAP_READWRITE, "read/write" },
#ifdef V4L2_CAP_ASYNCIO
{ V4L2_CAP_ASYNCIO, "async I/O" },
#endif
{ V4L2_CAP_STREAMING, "streaming" },
#ifdef V4L2_CAP_TOUCH
{ V4L2_CAP_TOUCH, "touch" }
#endif
{ 0, NULL }
};
unsigned int i;
char const * sep = "";
@ -966,12 +919,12 @@ static void _properties_window(Camera * camera)
gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 0);
/* capabilities */
buf[0] = '\0';
for(i = 0; i < sizeof(capabilities) / sizeof(*capabilities); i++)
for(i = 0; capabilities[i].name != NULL; i++)
if(camera->cap.capabilities & capabilities[i].capability)
{
strncat(buf, sep, sizeof(buf) - strlen(buf) - 1);
strncat(buf, sep, sizeof(buf) - strlen(buf));
strncat(buf, capabilities[i].name, sizeof(buf)
- strlen(buf) - 1);
- strlen(buf));
sep = ", ";
}
buf[sizeof(buf) - 1] = '\0';
@ -1043,8 +996,7 @@ static int _snapshot_dcim(Camera * camera, char const * homedir,
if(mkdir(path, 0777) != 0 && errno != EEXIST)
{
error_set_code(-errno, "%s: %s: %s",
_("Could not save picture"), path,
strerror(errno));
_("Could not save picture"), path, strerror(errno));
free(path);
return -_camera_error(camera, error_get(NULL), 1);
}
@ -1176,11 +1128,7 @@ void camera_stop(Camera * camera)
if(camera->pixbuf != NULL)
g_object_unref(camera->pixbuf);
camera->pixbuf = NULL;
#if GTK_CHECK_VERSION(3, 0, 0)
if(camera->surface != NULL)
cairo_surface_destroy(camera->surface);
camera->surface = NULL;
#else
#if !GTK_CHECK_VERSION(3, 0, 0)
if(camera->pixmap != NULL)
g_object_unref(camera->pixmap);
camera->pixmap = NULL;
@ -1191,20 +1139,15 @@ void camera_stop(Camera * camera)
if((char *)camera->rgb_buffer != camera->raw_buffer)
free(camera->rgb_buffer);
camera->rgb_buffer = NULL;
if(camera->buffers_cnt > 0)
{
for(i = 0; i < camera->buffers_cnt; i++)
if(camera->buffers[i].start != MAP_FAILED)
munmap(camera->buffers[i].start,
camera->buffers[i].length);
free(camera->buffers);
camera->buffers = NULL;
camera->buffers_cnt = 0;
}
else
free(camera->raw_buffer);
for(i = 0; i < camera->buffers_cnt; i++)
if(camera->buffers[i].start != MAP_FAILED)
munmap(camera->buffers[i].start,
camera->buffers[i].length);
free(camera->buffers);
camera->buffers = NULL;
camera->buffers_cnt = 0;
free(camera->raw_buffer);
camera->raw_buffer = NULL;
camera->raw_buffer_cnt = 0;
}
@ -1281,38 +1224,29 @@ static gboolean _camera_on_can_mmap(GIOChannel * channel,
GIOCondition condition, gpointer data)
{
Camera * camera = data;
struct v4l2_buffer buf;
#ifdef DEBUG
fprintf(stderr, "DEBUG: %s()\n", __func__);
#endif
if(channel != camera->channel || condition != G_IO_IN)
return FALSE;
memset(&camera->buf, 0, sizeof(camera->buf));
camera->buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
camera->buf.memory = V4L2_MEMORY_MMAP;
if(_camera_ioctl(camera, VIDIOC_DQBUF, &camera->buf) == -1)
if(_camera_ioctl(camera, VIDIOC_DQBUF, &buf) == -1)
{
_camera_error(camera, _("Could not dequeue buffer"), 1);
camera->source = 0;
_camera_error(camera, _("Could not save picture"), 1);
return FALSE;
}
if(camera->buf.index >= camera->buffers_cnt)
{
#ifdef DEBUG
fprintf(stderr, "DEBUG: %s() %u >= %zu\n", __func__,
camera->buf.index, camera->buffers_cnt);
#endif
_camera_error(camera, _("Invalid buffer index"), 1);
camera->source = 0;
return FALSE;
}
camera->raw_buffer = camera->buffers[camera->buf.index].start;
camera->raw_buffer_cnt = camera->buffers[camera->buf.index].length;
#ifdef DEBUG
fprintf(stderr, "DEBUG: %s() %lu\n", __func__, camera->raw_buffer_cnt);
#endif
camera->raw_buffer = camera->buffers[buf.index].start;
camera->raw_buffer_cnt = buf.bytesused;
#if 0 /* FIXME the raw buffer is not meant to be free()'d */
camera->source = g_idle_add(_camera_on_refresh, camera);
return FALSE;
#else
_camera_on_refresh(camera);
camera->raw_buffer = NULL;
camera->raw_buffer_cnt = 0;
return TRUE;
#endif
}
@ -1330,7 +1264,6 @@ static gboolean _camera_on_can_read(GIOChannel * channel,
#endif
if(channel != camera->channel || condition != G_IO_IN)
return FALSE;
size = camera->raw_buffer_cnt;
status = g_io_channel_read_chars(channel, camera->raw_buffer,
camera->raw_buffer_cnt, &size, &error);
/* this status can be ignored */
@ -1366,33 +1299,6 @@ static gboolean _camera_on_can_read(GIOChannel * channel,
#if GTK_CHECK_VERSION(3, 0, 0)
/* camera_on_drawing_area_configure */
static gboolean _camera_on_drawing_area_configure(GtkWidget * widget,
GdkEventConfigure * event, gpointer data)
{
Camera * camera = data;
GtkAllocation * allocation = &camera->area_allocation;
cairo_t * cr;
(void) event;
gtk_widget_get_allocation(widget, allocation);
#ifdef DEBUG
fprintf(stderr, "DEBUG: %s() %dx%d\n", __func__, allocation->width,
allocation->height);
#endif
if(camera->surface != NULL)
cairo_surface_destroy(camera->surface);
camera->surface = gdk_window_create_similar_surface(
gtk_widget_get_window(widget), CAIRO_CONTENT_COLOR,
allocation->width, allocation->height);
cr = cairo_create(camera->surface);
cairo_set_source_rgb(cr, 0.0, 0.0, 0.0);
cairo_paint(cr);
cairo_destroy(cr);
return TRUE;
}
/* camera_on_drawing_area_draw */
static gboolean _camera_on_drawing_area_draw(GtkWidget * widget, cairo_t * cr,
gpointer data)
@ -1401,11 +1307,14 @@ static gboolean _camera_on_drawing_area_draw(GtkWidget * widget, cairo_t * cr,
(void) widget;
#ifdef DEBUG
fprintf(stderr, "DEBUG: %s()\n", __func__);
fprintf(stderr, "DEBUG: %s() %p\n", __func__, camera->pixbuf);
#endif
cairo_set_source_surface(cr, camera->surface, 0, 0);
cairo_paint(cr);
return FALSE;
if(camera->pixbuf != NULL)
{
gdk_cairo_set_source_pixbuf(cr, camera->pixbuf, 0, 0);
cairo_paint(cr);
}
return TRUE;
}
@ -1494,7 +1403,9 @@ static void _camera_on_gallery(gpointer data)
/* camera_on_open */
static int _open_setup(Camera * camera);
#ifdef NOTYET
static int _open_setup_mmap(Camera * camera);
#endif
static int _open_setup_read(Camera * camera);
static gboolean _camera_on_open(gpointer data)
@ -1533,6 +1444,9 @@ static gboolean _camera_on_open(gpointer data)
gtk_widget_set_sensitive(
GTK_WIDGET(_camera_toolbar[CT_PROPERTIES].widget),
TRUE);
/* FIXME allow the window to be smaller */
gtk_widget_set_size_request(camera->area, camera->format.fmt.pix.width,
camera->format.fmt.pix.height);
return FALSE;
}
@ -1566,36 +1480,19 @@ static int _open_setup(Camera * camera)
_("Cropping not supported"));
}
/* obtain the current format */
camera->format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
if(_camera_ioctl(camera, VIDIOC_G_FMT, &camera->format) == -1)
return -error_set_code(1, "%s: %s", camera->device,
_("Could not obtain the video capture format"));
/* try to set a specific format */
if(camera->format.fmt.pix.pixelformat != V4L2_PIX_FMT_YUYV)
{
camera->format.fmt.pix.pixelformat = V4L2_PIX_FMT_YUYV;
if(_camera_ioctl(camera, VIDIOC_S_FMT, &camera->format) == -1)
return -error_set_code(1, "%s: %s", camera->device,
_("Could not set the video capture format"));
/* refresh the current format */
if(_camera_ioctl(camera, VIDIOC_G_FMT, &camera->format) == -1)
return -error_set_code(1, "%s: %s", camera->device,
_("Could not obtain the video capture format"));
}
/* verify the current format */
/* check the current format */
if(camera->format.type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
return -error_set_code(1, "%s: %s", camera->device,
_("Unsupported video capture type"));
if((camera->cap.capabilities & V4L2_CAP_STREAMING) != 0)
{
if((ret = _open_setup_mmap(camera)) != 0
&& (camera->cap.capabilities
& V4L2_CAP_READWRITE) != 0)
{
camera_stop(camera);
ret = _open_setup_read(camera);
}
}
#ifdef NOTYET
ret = _open_setup_mmap(camera);
#else
ret = _open_setup_read(camera);
#endif
else if((camera->cap.capabilities & V4L2_CAP_READWRITE) != 0)
ret = _open_setup_read(camera);
else
@ -1619,14 +1516,12 @@ static int _open_setup(Camera * camera)
return 0;
}
#ifdef NOTYET
static int _open_setup_mmap(Camera * camera)
{
struct v4l2_requestbuffers req;
size_t i;
struct v4l2_buffer buf;
enum v4l2_buf_type type;
size_t cnt;
char * p;
#ifdef DEBUG
fprintf(stderr, "DEBUG: %s()\n", __func__);
@ -1638,18 +1533,17 @@ static int _open_setup_mmap(Camera * camera)
if(_camera_ioctl(camera, VIDIOC_REQBUFS, &req) == -1)
return -error_set_code(1, "%s: %s", camera->device,
_("Could not request buffers"));
#ifdef DEBUG
fprintf(stderr, "DEBUG: %s() frames=%u\n", __func__, req.count);
#endif
if(req.count < 2)
return -error_set_code(1, "%s: %s", camera->device,
_("Could not obtain enough buffers"));
/* initialize the buffers */
if((camera->buffers = calloc(req.count, sizeof(*camera->buffers)))
if((camera->buffers = malloc(sizeof(*camera->buffers) * req.count))
== NULL)
return -error_set_code(1, "%s: %s", camera->device,
_("Could not allocate buffers"));
camera->buffers_cnt = req.count;
/* initialize the buffers */
memset(camera->buffers, 0, sizeof(*camera->buffers)
* camera->buffers_cnt);
for(i = 0; i < camera->buffers_cnt; i++)
camera->buffers[i].start = MAP_FAILED;
/* map the buffers */
@ -1670,30 +1564,9 @@ static int _open_setup_mmap(Camera * camera)
_("Could not map buffers"));
camera->buffers[i].length = buf.length;
}
for(i = 0; i < camera->buffers_cnt; i++)
{
memset(&camera->buf, 0, sizeof(camera->buf));
camera->buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
camera->buf.memory = V4L2_MEMORY_MMAP;
camera->buf.index = i;
if(_camera_ioctl(camera, VIDIOC_QBUF, &camera->buf) == -1)
return -error_set_code(1, "%s: %s", camera->device,
_("Could not queue buffers"));
}
/* start the stream */
type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
if(_camera_ioctl(camera, VIDIOC_STREAMON, &type) == -1)
return -error_set_code(1, "%s: %s", camera->device,
_("Could not start the stream"));
/* allocate the RGB buffer */
cnt = camera->format.fmt.pix.width * camera->format.fmt.pix.height * 3;
if((p = realloc(camera->rgb_buffer, cnt)) == NULL)
return error_set_code(-errno, "%s: %s", camera->device,
strerror(errno));
camera->rgb_buffer = (unsigned char *)p;
camera->rgb_buffer_cnt = cnt;
return 0;
}
#endif
static int _open_setup_read(Camera * camera)
{
@ -1711,7 +1584,7 @@ static int _open_setup_read(Camera * camera)
strerror(errno));
camera->raw_buffer = p;
camera->raw_buffer_cnt = cnt;
/* allocate the RGB buffer */
/* allocate the rgb buffer */
cnt = camera->format.fmt.pix.width * camera->format.fmt.pix.height * 3;
if((p = realloc(camera->rgb_buffer, cnt)) == NULL)
return error_set_code(-errno, "%s: %s", camera->device,
@ -1754,8 +1627,7 @@ static void _refresh_vflip(Camera * camera, GdkPixbuf ** pixbuf);
static gboolean _camera_on_refresh(gpointer data)
{
Camera * camera = data;
#if GTK_CHECK_VERSION(3, 0, 0)
cairo_t * cr;
#if !GTK_CHECK_VERSION(3, 0, 0)
GtkAllocation * allocation = &camera->area_allocation;
#endif
int width = camera->format.fmt.pix.width;
@ -1766,32 +1638,22 @@ static gboolean _camera_on_refresh(gpointer data)
camera->format.fmt.pix.pixelformat);
#endif
_refresh_convert(camera);
#if !GTK_CHECK_VERSION(3, 0, 0)
if(camera->hflip == FALSE
&& camera->vflip == FALSE
&& width == allocation->width
&& height == allocation->height
&& camera->overlays_cnt == 0)
{
/* render directly */
#if GTK_CHECK_VERSION(3, 0, 0)
cr = cairo_create(camera->surface);
camera->pixbuf = gdk_pixbuf_new_from_data(camera->rgb_buffer,
GDK_COLORSPACE_RGB, FALSE, 8, width, height,
width * 3, NULL, NULL);
gdk_cairo_set_source_pixbuf(cr, camera->pixbuf, 0.0, 0.0);
cairo_paint(cr);
cairo_destroy(cr);
#else
gdk_draw_rgb_image(camera->pixmap, camera->gc, 0, 0,
width, height, GDK_RGB_DITHER_NORMAL,
camera->rgb_buffer, width * 3);
#endif
}
else
#endif
{
/* render after scaling */
if(camera->pixbuf != NULL)
g_object_unref(camera->pixbuf);
/* render after scaling */
camera->pixbuf = gdk_pixbuf_new_from_data(camera->rgb_buffer,
GDK_COLORSPACE_RGB, FALSE, 8, width, height,
width * 3, NULL, NULL);
@ -1799,12 +1661,7 @@ static gboolean _camera_on_refresh(gpointer data)
_refresh_vflip(camera, &camera->pixbuf);
_refresh_scale(camera, &camera->pixbuf);
_refresh_overlays(camera, camera->pixbuf);
#if GTK_CHECK_VERSION(3, 0, 0)
cr = cairo_create(camera->surface);
gdk_cairo_set_source_pixbuf(cr, camera->pixbuf, 0.0, 0.0);
cairo_paint(cr);
cairo_destroy(cr);
#else
#if !GTK_CHECK_VERSION(3, 0, 0)
gdk_pixbuf_render_to_drawable(camera->pixbuf, camera->pixmap,
camera->gc, 0, 0, 0, 0, -1, -1,
GDK_RGB_DITHER_NORMAL, 0, 0);
@ -1812,20 +1669,9 @@ static gboolean _camera_on_refresh(gpointer data)
}
/* force a refresh */
gtk_widget_queue_draw(camera->area);
/* read from the camera again */
if(camera->buffers != NULL)
{
if(_camera_ioctl(camera, VIDIOC_QBUF, &camera->buf) == -1)
{
fprintf(stderr, "%s\n", strerror(errno));
_camera_error(camera, _("Could not queue buffer"), 1);
}
camera->source = g_io_add_watch(camera->channel, G_IO_IN,
_camera_on_can_mmap, camera);
}
else
camera->source = g_io_add_watch(camera->channel, G_IO_IN,
_camera_on_can_read, camera);
camera->source = g_io_add_watch(camera->channel, G_IO_IN,
(camera->buffers != NULL) ? _camera_on_can_mmap
: _camera_on_can_read, camera);
return FALSE;
}

View File

@ -1,27 +1,17 @@
/* $Id$ */
/* Copyright (c) 2012-2020 Pierre Pronchery <khorben@defora.org> */
/* Copyright (c) 2012-2018 Pierre Pronchery <khorben@defora.org> */
/* This file is part of DeforaOS Desktop Camera */
/* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
/* 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, version 3 of the License.
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 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.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY ITS AUTHORS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. */

View File

@ -1,27 +1,17 @@
/* $Id$ */
/* Copyright (c) 2012-2024 Pierre Pronchery <khorben@defora.org> */
/* Copyright (c) 2012-2018 Pierre Pronchery <khorben@defora.org> */
/* This file is part of DeforaOS Desktop Camera */
/* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
/* 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, version 3 of the License.
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 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.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY ITS AUTHORS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. */
@ -30,10 +20,8 @@
#include <locale.h>
#include <libintl.h>
#include <gtk/gtk.h>
#if defined(GDK_WINDOWING_X11)
# if GTK_CHECK_VERSION(3, 0, 0)
# include <gtk/gtkx.h>
# endif
#if GTK_CHECK_VERSION(3, 0, 0)
# include <gtk/gtkx.h>
#endif
#include <System.h>
#include "camera.h"
@ -69,9 +57,7 @@ static int _usage(void);
/* camera */
static int _camera_embedded(char const * device, int hflip, int vflip,
int ratio, char const * overlay);
#if defined(GDK_WINDOWING_X11)
static void _embedded_on_embedded(gpointer data);
#endif
static int _camera(int embedded, char const * device, int hflip, int vflip,
int ratio, char const * overlay)
@ -99,16 +85,6 @@ static int _camera(int embedded, char const * device, int hflip, int vflip,
static int _camera_embedded(char const * device, int hflip, int vflip,
int ratio, char const * overlay)
{
#if !defined(GDK_WINDOWING_X11)
(void) device;
(void) hflip;
(void) vflip;
(void) ratio;
(void) overlay;
error_set_code(-ENOSYS, "%s", strerror(ENOSYS));
return -1;
#else
GtkWidget * window;
GtkWidget * widget;
Camera * camera;
@ -141,17 +117,14 @@ static int _camera_embedded(char const * device, int hflip, int vflip,
camera_delete(camera);
gtk_widget_destroy(window);
return 0;
#endif
}
#if defined(GDK_WINDOWING_X11)
static void _embedded_on_embedded(gpointer data)
{
GtkWidget * widget = data;
gtk_widget_show(widget);
}
#endif
/* error */

View File

@ -1,27 +1,17 @@
/* $Id$ */
/* Copyright (c) 2013-2020 Pierre Pronchery <khorben@defora.org> */
/* Copyright (c) 2013 Pierre Pronchery <khorben@defora.org> */
/* This file is part of DeforaOS Desktop Camera */
/* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
/* 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, version 3 of the License.
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 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.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY ITS AUTHORS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. */

View File

@ -1,27 +1,17 @@
/* $Id$ */
/* Copyright (c) 2013-2020 Pierre Pronchery <khorben@defora.org> */
/* Copyright (c) 2013 Pierre Pronchery <khorben@defora.org> */
/* This file is part of DeforaOS Desktop Camera */
/* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
/* 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, version 3 of the License.
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 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.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY ITS AUTHORS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. */

View File

@ -5,27 +5,15 @@ ldflags_force=`pkg-config --libs libDesktop` -lintl
ldflags=-pie -Wl,-z,relro -Wl,-z,now
dist=Makefile,camera.h,overlay.h,window.h
#modes
[mode::debug]
#for Gtk+ 3
cflags_force=`pkg-config --cflags libDesktop gtk+-x11-3.0`
ldflags_force=`pkg-config --libs libDesktop gtk+-x11-3.0` -lintl
[mode::embedded-debug]
cppflags_force=-DEMBEDDED
[mode::embedded-release]
cppflags_force=-DEMBEDDED -DNDEBUG
cflags=-W -Wall -O2 -fPIE -D_FORTIFY_SOURCE=2 -fstack-protector
[mode::release]
cppflags_force=-DNDEBUG
cflags=-W -Wall -O2 -fPIE -D_FORTIFY_SOURCE=2 -fstack-protector
#targets
[camera]
type=binary
sources=camera.c,overlay.c,window.c,main.c
install=$(BINDIR)
#sources
[camera.c]
depends=overlay.h,camera.h,../config.h

View File

@ -1,27 +1,17 @@
/* $Id$ */
/* Copyright (c) 2015-2020 Pierre Pronchery <khorben@defora.org> */
/* Copyright (c) 2015-2018 Pierre Pronchery <khorben@defora.org> */
/* This file is part of DeforaOS Desktop Camera */
/* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
/* 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, version 3 of the License.
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 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.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY ITS AUTHORS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. */

View File

@ -1,30 +1,17 @@
targets=camera
cflags_force=`pkg-config --cflags libDesktop` -fPIC
cflags=-W -Wall -g -O2 -D_FORTIFY_SOURCE=2 -fstack-protector
#ldflags_force=`pkg-config --libs libDesktop` -lintl
ldflags_force=`pkg-config --libs libDesktop` -lintl
ldflags=-Wl,-z,relro -Wl,-z,now
#for Gtk+ 3
#cflags_force=-W `pkg-config --cflags libDesktop gtk+-x11-3.0`
#ldflags_force=`pkg-config --libs libDesktop gtk+-x11-3.0` -lintl
dist=Makefile
#modes
[mode::debug]
[mode::embedded-debug]
cppflags_force=-DEMBEDDED
[mode::embedded-release]
cppflags_force=-DEMBEDDED -DNDEBUG
cflags=-W -Wall -O2 -fPIE -D_FORTIFY_SOURCE=2 -fstack-protector
[mode::release]
cppflags_force=-DNDEBUG
cflags=-W -Wall -O2 -fPIE -D_FORTIFY_SOURCE=2 -fstack-protector
#targets
[camera]
type=plugin
sources=camera.c
install=$(LIBDIR)/Desktop/widget
#sources
[widget.c]
depends=../camera.h,../camera.c,../overlay.h,../overlay.c

View File

@ -1,29 +1,19 @@
/* $Id$ */
static char const _copyright[] =
"Copyright © 2012-2020 Pierre Pronchery <khorben@defora.org>";
"Copyright © 2012-2018 Pierre Pronchery <khorben@defora.org>";
/* This file is part of DeforaOS Desktop Camera */
static char const _license[] =
"Redistribution and use in source and binary forms, with or without\n"
"modification, are permitted provided that the following conditions are\n"
"met:\n"
"This program is free software: you can redistribute it and/or modify\n"
"it under the terms of the GNU General Public License as published by\n"
"the Free Software Foundation, version 3 of the License.\n"
"\n"
"1. Redistributions of source code must retain the above copyright notice,\n"
" this list of conditions and the following disclaimer.\n"
"This program is distributed in the hope that it will be useful,\n"
"but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
"GNU General Public License for more details.\n"
"\n"
"2. Redistributions in binary form must reproduce the above copyright notice,\n"
" this list of conditions and the following disclaimer in the documentation\n"
" and/or other materials provided with the distribution.\n"
"\n"
"THIS SOFTWARE IS PROVIDED BY ITS AUTHORS AND CONTRIBUTORS \"AS IS\" AND ANY\n"
"EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n"
"WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n"
"DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY\n"
"DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n"
"(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n"
"LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n"
"ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n"
"(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\n"
"THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.";
"You should have received a copy of the GNU General Public License\n"
"along with this program. If not, see <http://www.gnu.org/licenses/>.";
@ -201,7 +191,6 @@ CameraWindow * camerawindow_new(char const * device)
# endif
gtk_window_set_title(GTK_WINDOW(camera->window), _("Camera"));
#endif
gtk_window_set_default_size(GTK_WINDOW(camera->window), 640, 480);
g_signal_connect_swapped(camera->window, "delete-event", G_CALLBACK(
_camerawindow_on_closex), camera);
g_signal_connect(camera->window, "window-state-event", G_CALLBACK(

View File

@ -1,27 +1,17 @@
/* $Id$ */
/* Copyright (c) 2013-2020 Pierre Pronchery <khorben@defora.org> */
/* Copyright (c) 2013-2014 Pierre Pronchery <khorben@defora.org> */
/* This file is part of DeforaOS Desktop Camera */
/* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
/* 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, version 3 of the License.
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 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.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY ITS AUTHORS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. */

View File

@ -1,6 +1,6 @@
#!/bin/sh
#$Id$
#Copyright (c) 2016-2021 Pierre Pronchery <khorben@defora.org>
#Copyright (c) 2016-2019 Pierre Pronchery <khorben@defora.org>
#
#Redistribution and use in source and binary forms, with or without
#modification, are permitted provided that the following conditions are met:
@ -25,7 +25,6 @@
#variables
CONFIGSH="${0%/clint.sh}/../config.sh"
CFLAGS=
CPPFLAGS=
PROGNAME="clint.sh"
@ -33,23 +32,19 @@ PROJECTCONF="../project.conf"
#executables
DATE="date"
DEBUG="_debug"
ECHO="/bin/echo"
FIND="find"
GREP="grep"
LINT="lint -g"
MKDIR="mkdir -p"
SORT="sort -n"
TR="tr"
[ -f "$CONFIGSH" ] && . "$CONFIGSH"
#functions
#clint
_clint()
{
res=0
subdirs=
ret=0
subdirs="data doc src tests tools"
$DATE
while read line; do
@ -63,58 +58,43 @@ _clint()
;;
esac
done < "$PROJECTCONF"
if [ ! -n "$subdirs" ]; then
_error "Could not locate directories to analyze"
return $?
fi
for subdir in $subdirs; do
[ -d "../$subdir" ] || continue
while read filename; do
[ -n "$filename" ] || continue
r=0
for filename in $($FIND "../$subdir" -type f | $SORT); do
case "$filename" in
*.c)
echo
_clint_lint "$filename" || r=$?
_clint_rtrim "$filename"|| r=$?
(_clint_lint "$filename";
_clint_rtrim "$filename")
;;
*.h)
echo
echo "$filename:"
_clint_rtrim "$filename"|| r=$?
(_clint_rtrim "$filename")
;;
*)
continue
;;
esac
if [ $r -eq 0 ]; then
echo " OK"
echo "$PROGNAME: $filename: OK" 1>&2
else
if [ $? -ne 0 ]; then
echo "FAIL"
echo "$PROGNAME: $filename: FAIL" 1>&2
res=2
ret=2
else
echo "OK"
fi
done << EOF
$($FIND "../$subdir" -type f | $SORT)
EOF
done
done
return $res
return $ret
}
_clint_lint()
{(
{
filename="$1"
$ECHO -n "${filename%/*}/"
echo -n "${filename%/*}/"
$DEBUG $LINT $CPPFLAGS $CFLAGS "$filename" 2>&1
ret=$?
if [ $ret -eq 127 ]; then
#XXX ignore errors when $LINT is not available
ret=0
fi
return $ret
)}
}
_clint_rtrim()
{
@ -130,14 +110,10 @@ _debug()
{
echo "$@" 1>&3
"$@"
}
#error
_error()
{
echo "$PROGNAME: $@" 1>&2
return 2
res=$?
#ignore errors when the command is not available
[ $res -eq 127 ] && return 0
return $res
}
@ -149,6 +125,14 @@ _usage()
}
#warning
_warning()
{
echo "$PROGNAME: $@" 1>&2
return 2
}
#main
clean=0
while getopts "cO:P:" name; do
@ -178,15 +162,9 @@ fi
[ $clean -ne 0 ] && exit 0
exec 3>&1
ret=0
while [ $# -gt 0 ]; do
target="$1"
dirname="${target%/*}"
shift
if [ -n "$dirname" -a "$dirname" != "$target" ]; then
$MKDIR -- "$dirname" || ret=$?
fi
_clint > "$target" || ret=$?
_clint > "$target" || exit 2
done
exit $ret

View File

@ -1,6 +1,6 @@
#!/bin/sh
#$Id$
#Copyright (c) 2017-2022 Pierre Pronchery <khorben@defora.org>
#Copyright (c) 2017-2019 Pierre Pronchery <khorben@defora.org>
#
#Redistribution and use in source and binary forms, with or without
#modification, are permitted provided that the following conditions are met:
@ -25,30 +25,23 @@
#variables
CONFIGSH="${0%/fixme.sh}/../config.sh"
PROGNAME="fixme.sh"
PROJECTCONF="../project.conf"
REGEXP_ERROR="FIXME"
REGEXP_WARNING="\\(TODO\|XXX\\)"
#executables
DATE="date"
DEBUG="_debug"
FIND="find"
GREP="grep"
HEAD="head"
MKDIR="mkdir -p"
SORT="sort -n"
TR="tr"
[ -f "$CONFIGSH" ] && . "$CONFIGSH"
#functions
#fixme
_fixme()
{
res=0
subdirs=
$DATE
echo
@ -63,14 +56,27 @@ _fixme()
;;
esac
done < "$PROJECTCONF"
if [ ! -n "$subdirs" ]; then
_error "Could not locate directories to analyze"
return $?
fi
for subdir in $subdirs; do
[ -d "../$subdir" ] || continue
for filename in $($FIND "../$subdir" -type f | $SORT); do
callback=$(_fixme_callback "$filename")
callback=
ext=${filename##*/}
ext=${ext%.in}
ext=${ext##*.}
case "$ext" in
asm|S)
callback="_fixme_asm"
;;
c|cc|cpp|cxx|h|js)
callback="_fixme_c"
;;
conf|sh)
callback="_fixme_sh"
;;
htm|html|xml)
callback="_fixme_xml"
;;
esac
[ -n "$callback" ] || continue
($callback "$filename") 2>&1
if [ $? -ne 0 ]; then
@ -82,114 +88,54 @@ _fixme()
return $res
}
_fixme_callback()
{
filename="$1"
ext=${filename##*/}
ext=${ext%.in}
ext=${ext##*.}
callback=
case "$ext" in
asm|S)
echo "_fixme_callback_asm"
return 0
;;
c|cc|cpp|cxx|go|h|js|v)
echo "_fixme_callback_c"
return 0
;;
conf|sh)
echo "_fixme_callback_sh"
return 0
;;
py)
echo "_fixme_callback_python"
return 0
;;
htm|html|xml|xsl)
echo "_fixme_callback_xml"
return 0
;;
esac
case $($HEAD -n 1 "$filename") in
"#!/bin/sh"*|"#! /bin/sh"*|\
"#!/usr/bin/env bash"*|"#! /usr/bin/env bash"*)
echo "_fixme_callback_sh"
return 0
;;
"#!/usr/bin/env python"*|"#! /usr/bin/env python"*)
echo "_fixme_callback_python"
return 0
;;
"<!DOCTYPE"*|"<!doctype"*|"<HTML"*|"<html"*|"<?xml"*)
echo "_fixme_callback_xml"
return 0
;;
esac
return 2
}
_fixme_callback_asm()
_fixme_asm()
{
res=0
filename="$1"
#warnings
$GREP -nH "/\\*.*$REGEXP_WARNING" "$filename"
$GREP -nH '/\*.*\(TODO\|XXX\)' "$filename"
#failures
$GREP -nH "/\\*.*$REGEXP_ERROR" "$filename" && res=2
$GREP -nH '/\*.*FIXME' "$filename" && res=2
return $res
}
_fixme_callback_c()
_fixme_c()
{
res=0
filename="$1"
#warnings
$GREP -nH "/\\(/\\|\\*\\).*$REGEXP_WARNING" "$filename"
$GREP -nH '/\(/\|\*\).*\(TODO\|XXX\)' "$filename"
#failures
$GREP -nH "/\\(/\\|\\*\\).*$REGEXP_ERROR" "$filename" && res=2
$GREP -nH '/\(/\|\*\).*FIXME' "$filename" && res=2
return $res
}
_fixme_callback_python()
_fixme_sh()
{
res=0
filename="$1"
#XXX avoid matching the regexp
comment="#"
#warnings
$GREP -nH "$comment.*$REGEXP_WARNING" "$filename"
$GREP -nH "$comment.*\\(TODO\\|XXX\\)" "$filename"
#failures
$GREP -nH "$comment.*$REGEXP_ERROR" "$filename" && res=2
$GREP -nH "$comment.*FIXME" "$filename" && res=2
return $res
}
_fixme_callback_sh()
{
res=0
filename="$1"
comment="#"
#warnings
$GREP -nH "$comment.*$REGEXP_WARNING" "$filename"
#failures
$GREP -nH "$comment.*$REGEXP_ERROR" "$filename" && res=2
return $res
}
_fixme_callback_xml()
_fixme_xml()
{
res=0
filename="$1"
#XXX limited to a single line
#warnings
$GREP -nH "<!--.*$REGEXP_WARNING" "$filename"
$GREP -nH '<!--.*\(TODO\|XXX\)' "$filename"
#failures
$GREP -nH "<!--.*$REGEXP_ERROR" "$filename" && res=2
$GREP -nH '<!--.*FIXME' "$filename" && res=2
return $res
}
@ -199,14 +145,10 @@ _debug()
{
echo "$@" 1>&3
"$@"
}
#error
_error()
{
echo "$PROGNAME: $@" 1>&2
return 2
res=$?
#ignore errors when the command is not available
[ $res -eq 127 ] && return 0
return $res
}

View File

@ -1,6 +1,6 @@
#!/bin/sh
#$Id$
#Copyright (c) 2014-2021 Pierre Pronchery <khorben@defora.org>
#Copyright (c) 2014-2017 Pierre Pronchery <khorben@defora.org>
#
#Redistribution and use in source and binary forms, with or without
#modification, are permitted provided that the following conditions are met:
@ -25,31 +25,26 @@
#variables
CONFIGSH="${0%/htmllint.sh}/../config.sh"
DEVNULL="/dev/null"
PROGNAME="htmllint.sh"
PROJECTCONF="../project.conf"
#executables
DATE="date"
DEBUG="_debug"
ECHO="/bin/echo"
FIND="find"
HTMLLINT="xmllint --html --nonet"
MKDIR="mkdir -p"
HTMLLINT="xmllint --html"
SORT="sort -n"
TR="tr"
[ -f "$CONFIGSH" ] && . "$CONFIGSH"
#functions
#htmllint
_htmllint()
{
res=0
subdirs=
ret=0
$DATE
echo
while read line; do
case "$line" in
"["*)
@ -61,30 +56,19 @@ _htmllint()
;;
esac
done < "$PROJECTCONF"
if [ ! -n "$subdirs" ]; then
_error "Could not locate directories to analyze"
return $?
fi
for subdir in $subdirs; do
[ -d "../$subdir" ] || continue
while read filename; do
[ -n "$filename" ] || continue
echo
$ECHO -n "$filename:"
for filename in $($FIND "../$subdir" -iname '*.html' -o -iname '*.htm' | $SORT); do
$DEBUG $HTMLLINT "$filename" 2>&1 > "$DEVNULL"
if [ $? -eq 0 ]; then
echo " OK"
echo "$PROGNAME: $filename: OK" 1>&2
echo "$filename:"
else
echo "FAIL"
echo "$PROGNAME: $filename: FAIL" 1>&2
res=2
ret=2
fi
done << EOF
$($FIND "../$subdir" -type f -a \( -iname '*.html' -o -iname '*.htm' \) | $SORT)
EOF
done
done
return $res
return $ret
}
@ -93,14 +77,10 @@ _debug()
{
echo "$@" 1>&3
"$@"
}
#error
_error()
{
echo "$PROGNAME: $@" 1>&2
return 2
res=$?
#ignore errors when the command is not available
[ $res -eq 127 ] && return 0
return $res
}
@ -141,15 +121,9 @@ fi
[ $clean -ne 0 ] && exit 0
exec 3>&1
ret=0
while [ $# -gt 0 ]; do
target="$1"
dirname="${target%/*}"
shift
if [ -n "$dirname" -a "$dirname" != "$target" ]; then
$MKDIR -- "$dirname" || ret=$?
fi
_htmllint > "$target" || ret=$?
_htmllint > "$target" || exit 2
done
exit $ret

View File

@ -1,7 +1,6 @@
targets=clint.log,fixme.log,htmllint.log,xmllint.log
dist=Makefile,clint.sh,fixme.sh,htmllint.sh,xmllint.sh
dist=Makefile,htmllint.sh,xmllint.sh
#targets
[clint.log]
type=script
script=./clint.sh

View File

@ -1,6 +1,6 @@
#!/bin/sh
#$Id$
#Copyright (c) 2014-2021 Pierre Pronchery <khorben@defora.org>
#Copyright (c) 2014-2017 Pierre Pronchery <khorben@defora.org>
#
#Redistribution and use in source and binary forms, with or without
#modification, are permitted provided that the following conditions are met:
@ -25,31 +25,26 @@
#variables
CONFIGSH="${0%/xmllint.sh}/../config.sh"
DEVNULL="/dev/null"
PROGNAME="xmllint.sh"
PROJECTCONF="../project.conf"
#executables
DATE="date"
DEBUG="_debug"
ECHO="/bin/echo"
FIND="find"
MKDIR="mkdir -p"
SORT="sort -n"
TR="tr"
XMLLINT="xmllint --nonet --xinclude"
[ -f "$CONFIGSH" ] && . "$CONFIGSH"
XMLLINT="xmllint"
#functions
#xmllint
_xmllint()
{
res=0
subdirs=
ret=0
$DATE
echo
while read line; do
case "$line" in
"["*)
@ -61,30 +56,19 @@ _xmllint()
;;
esac
done < "$PROJECTCONF"
if [ ! -n "$subdirs" ]; then
_error "Could not locate directories to analyze"
return $?
fi
for subdir in $subdirs; do
[ -d "../$subdir" ] || continue
while read filename; do
[ -n "$filename" ] || continue
echo
$ECHO -n "$filename:"
for filename in $($FIND "../$subdir" -name '*.xml' -o -name '*.xsl' | $SORT); do
$DEBUG $XMLLINT "$filename" 2>&1 > "$DEVNULL"
if [ $? -eq 0 ]; then
echo " OK"
echo "$PROGNAME: $filename: OK" 1>&2
echo "$filename:"
else
echo "FAIL"
echo "$PROGNAME: $filename: FAIL" 1>&2
res=2
ret=2
fi
done << EOF
$($FIND "../$subdir" -type f -a \( -iname '*.xml' -o -iname '*.xsl' \) | $SORT)
EOF
done
done
return $res
return $ret
}
@ -93,14 +77,10 @@ _debug()
{
echo "$@" 1>&3
"$@"
}
#error
_error()
{
echo "$PROGNAME: $@" 1>&2
return 2
res=$?
#ignore errors when the command is not available
[ $res -eq 127 ] && return 0
return $res
}
@ -141,15 +121,9 @@ fi
[ $clean -ne 0 ] && exit 0
exec 3>&1
ret=0
while [ $# -gt 0 ]; do
target="$1"
dirname="${target%/*}"
shift
if [ -n "$dirname" -a "$dirname" != "$target" ]; then
$MKDIR -- "$dirname" || ret=$?
fi
_xmllint > "$target" || ret=$?
_xmllint > "$target" || exit 2
done
exit $ret

View File

@ -1,27 +1,17 @@
/* $Id$ */
/* Copyright (c) 2013-2020 Pierre Pronchery <khorben@defora.org> */
/* Copyright (c) 2013-2018 Pierre Pronchery <khorben@defora.org> */
/* This file is part of DeforaOS Desktop Camera */
/* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
/* 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, version 3 of the License.
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 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.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY ITS AUTHORS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. */
@ -39,12 +29,12 @@
#define _(string) gettext(string)
/* constants */
#ifndef PROGNAME_BROWSER
# define PROGNAME_BROWSER "browser"
#endif
#ifndef PROGNAME_GALLERY
# define PROGNAME_GALLERY "gallery"
#endif
#ifndef BROWSER_PROGNAME
# define BROWSER_PROGNAME "browser"
#endif
#ifndef PREFIX
# define PREFIX "/usr/local"
#endif
@ -73,14 +63,14 @@ static int _usage(void);
static int _gallery(void)
{
char const * homedir;
char const browser[] = BINDIR "/" PROGNAME_BROWSER;
char const browser[] = BINDIR "/" BROWSER_PROGNAME;
char const dcim[] = "DCIM";
char * path;
#if GTK_CHECK_VERSION(2, 6, 0)
char * argv[] = { PROGNAME_BROWSER, "-T", "--", NULL, NULL };
char * argv[] = { BROWSER_PROGNAME, "-T", "--", NULL, NULL };
const int arg = 3;
#else
char * argv[] = { PROGNAME_BROWSER, "--", NULL, NULL };
char * argv[] = { BROWSER_PROGNAME, "--", NULL, NULL };
const int arg = 2;
#endif

View File

@ -1,30 +1,17 @@
targets=gallery
cflags_force=`pkg-config --cflags libDesktop`
cflags_force=`pkg-config --cflags gtk+-2.0`
cflags=-W -Wall -g -O2 -fPIE -D_FORTIFY_SOURCE=2 -fstack-protector
ldflags_force=`pkg-config --libs libDesktop`
ldflags_force=`pkg-config --libs glib-2.0`
ldflags=-pie -Wl,-z,relro -Wl,-z,now
dist=Makefile
#modes
[mode::debug]
#for Gtk+ 3
cflags_force=`pkg-config --cflags gtk+-3.0`
[mode::embedded-debug]
cppflags_force=-DEMBEDDED
[mode::embedded-release]
cppflags_force=-DEMBEDDED -DNDEBUG
cflags=-W -Wall -O2 -fPIE -D_FORTIFY_SOURCE=2 -fstack-protector
[mode::release]
cppflags_force=-DNDEBUG
cflags=-W -Wall -O2 -fPIE -D_FORTIFY_SOURCE=2 -fstack-protector
#targets
[gallery]
type=binary
sources=gallery.c
install=$(BINDIR)
#sources
[gallery.c]
depends=../config.h