Compare commits
35 Commits
khorben/gt
...
master
Author | SHA1 | Date | |
---|---|---|---|
e3de8157ed | |||
8d2931f8ea | |||
88701c479b | |||
9e855dad62 | |||
3b5399a8d2 | |||
fd1e4419fa | |||
1e01aa9d63 | |||
444664a2cc | |||
df22589e2b | |||
17bb67ec85 | |||
077f40603c | |||
8d3b7beaa7 | |||
65d1cde81e | |||
b01deb9382 | |||
440003c108 | |||
e2a9ad3d0f | |||
26a9af0ed7 | |||
6c390be503 | |||
16795bbfc0 | |||
5c74d87c7e | |||
4046248133 | |||
a0fb95977e | |||
809d06dc3e | |||
ae0b7954b9 | |||
be0e7a87e0 | |||
8d49ceca6b | |||
77c0833c08 | |||
22c2a91474 | |||
d615ed3041 | |||
c64523749a | |||
5bb723df43 | |||
f535b36fd6 | |||
480c9feb77 | |||
a902394d19 | |||
b3c4caa076 |
|
@ -1,7 +1,8 @@
|
|||
dist=Makefile,deforaos-camera.desktop,deforaos-gallery.desktop
|
||||
dist=Makefile,org.defora.camera.desktop,org.defora.gallery.desktop
|
||||
|
||||
[deforaos-camera.desktop]
|
||||
#dist
|
||||
[org.defora.camera.desktop]
|
||||
install=$(PREFIX)/share/applications
|
||||
|
||||
[deforaos-gallery.desktop]
|
||||
[org.defora.gallery.desktop]
|
||||
install=$(PREFIX)/share/applications
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/sh
|
||||
#$Id$
|
||||
#Copyright (c) 2012-2015 Pierre Pronchery <khorben@defora.org>
|
||||
#Copyright (c) 2012-2024 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,17 +25,22 @@
|
|||
|
||||
|
||||
#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"
|
||||
XSLTPROC="xsltproc --nonet --xinclude"
|
||||
XMLLINT="xmllint --noent --nonet --xinclude --path ${PWD}"
|
||||
XSLTPROC="xsltproc --nonet --xinclude --path ${PWD}"
|
||||
|
||||
[ -f "$CONFIGSH" ] && . "$CONFIGSH"
|
||||
|
||||
|
||||
#functions
|
||||
|
@ -58,18 +63,20 @@ _docbook()
|
|||
ext="${ext##.}"
|
||||
case "$ext" in
|
||||
html)
|
||||
XSL="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"
|
||||
XSL="$XSL_HTML"
|
||||
[ -f "${source%.*}.xsl" ] && XSL="${source%.*}.xsl"
|
||||
[ -f "${target%.*}.xsl" ] && XSL="${target%.*}.xsl"
|
||||
if [ -f "${target%.*}.css.xml" ]; then
|
||||
XSLTPROC="$XSLTPROC --param custom.css.source \"${target%.*}.css.xml\" --param generate.css.header 1"
|
||||
XSLTPROC_PARAMS="--param custom.css.source \"${target%.*}.css.xml\" --param generate.css.header 1"
|
||||
elif [ -f "${source%.*}.css.xml" ]; then
|
||||
XSLTPROC="$XSLTPROC --param custom.css.source \"${source%.*}.css.xml\" --param generate.css.header 1"
|
||||
XSLTPROC_PARAMS="--param custom.css.source \"${source%.*}.css.xml\" --param generate.css.header 1"
|
||||
else
|
||||
XSLTPROC_PARAMS=
|
||||
fi
|
||||
$DEBUG $XSLTPROC -o "$target" "$XSL" "$source"
|
||||
$DEBUG $XSLTPROC $XSLTPROC_PARAMS -o "$target" "$XSL" "$source"
|
||||
;;
|
||||
pdf)
|
||||
XSL="http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl"
|
||||
XSL="$XSL_PDF"
|
||||
[ -f "${source%.*}.xsl" ] && XSL="${source%.*}.xsl"
|
||||
[ -f "${target%.*}.xsl" ] && XSL="${target%.*}.xsl"
|
||||
$DEBUG $XSLTPROC -o "${target%.*}.fo" "$XSL" "$source" &&
|
||||
|
@ -77,7 +84,7 @@ _docbook()
|
|||
$RM -- "${target%.*}.fo"
|
||||
;;
|
||||
1|2|3|4|5|6|7|8|9)
|
||||
XSL="http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl"
|
||||
XSL="$XSL_MAN"
|
||||
$DEBUG $XSLTPROC -o "$target" "$XSL" "$source"
|
||||
;;
|
||||
*)
|
||||
|
@ -114,7 +121,7 @@ _usage()
|
|||
clean=0
|
||||
install=0
|
||||
uninstall=0
|
||||
while getopts "ciuP:" name; do
|
||||
while getopts "ciO:uP:" name; do
|
||||
case "$name" in
|
||||
c)
|
||||
clean=1
|
||||
|
@ -123,6 +130,9 @@ while getopts "ciuP:" name; do
|
|||
uninstall=0
|
||||
install=1
|
||||
;;
|
||||
O)
|
||||
export "${OPTARG%%=*}"="${OPTARG#*=}"
|
||||
;;
|
||||
u)
|
||||
install=0
|
||||
uninstall=1
|
||||
|
@ -137,7 +147,7 @@ while getopts "ciuP:" name; do
|
|||
esac
|
||||
done
|
||||
shift $((OPTIND - 1))
|
||||
if [ $# -eq 0 ]; then
|
||||
if [ $# -lt 1 ]; then
|
||||
_usage
|
||||
exit $?
|
||||
fi
|
||||
|
@ -165,9 +175,9 @@ while [ $# -gt 0 ]; do
|
|||
source="${target#$OBJDIR}"
|
||||
source="${source%.*}.xml"
|
||||
xpath="string(/refentry/refmeta/manvolnum)"
|
||||
section=$($XMLLINT --xpath "$xpath" "$source")
|
||||
section=$($DEBUG $XMLLINT --xpath "$xpath" "$source")
|
||||
if [ $? -eq 0 -a -n "$section" ]; then
|
||||
instdir="$DATADIR/man/html$section"
|
||||
instdir="$MANDIR/html$section"
|
||||
fi
|
||||
;;
|
||||
pdf)
|
||||
|
|
132
po/es.po
132
po/es.po
|
@ -5,166 +5,166 @@
|
|||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Camera 0.1.0\n"
|
||||
"Project-Id-Version: Camera 0.3.1\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2020-01-18 14:16+0100\n"
|
||||
"PO-Revision-Date: 2015-02-16 07:20+0100\n"
|
||||
"POT-Creation-Date: 2024-07-30 02:46+0200\n"
|
||||
"PO-Revision-Date: 2025-02-20 17:45+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:203
|
||||
#: ../src/camera.c:213
|
||||
msgid "Snapshot"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/camera.c:206
|
||||
#: ../src/camera.c:216
|
||||
msgid "Gallery"
|
||||
msgstr ""
|
||||
msgstr "Galería"
|
||||
|
||||
#: ../src/camera.c:210 ../src/camera.c:217 ../src/camera.c:889
|
||||
#: ../src/camera.c:899
|
||||
#: ../src/camera.c:220 ../src/camera.c:227 ../src/camera.c:899
|
||||
#: ../src/camera.c:909
|
||||
msgid "Properties"
|
||||
msgstr "Propriedades"
|
||||
|
||||
#: ../src/camera.c:213 ../src/camera.c:706
|
||||
#: ../src/camera.c:223 ../src/camera.c:716
|
||||
msgid "Preferences"
|
||||
msgstr "Preferencias"
|
||||
|
||||
#: ../src/camera.c:293
|
||||
#: ../src/camera.c:303
|
||||
msgid "Fullscreen"
|
||||
msgstr ""
|
||||
msgstr "Pantalla completa"
|
||||
|
||||
#: ../src/camera.c:691
|
||||
#: ../src/camera.c:701
|
||||
msgid "Nearest"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/camera.c:692
|
||||
#: ../src/camera.c:702
|
||||
msgid "Tiles"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/camera.c:693
|
||||
#: ../src/camera.c:703
|
||||
msgid "Bilinear"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/camera.c:694
|
||||
#: ../src/camera.c:704
|
||||
msgid "Hyperbolic"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/camera.c:721
|
||||
#: ../src/camera.c:731
|
||||
msgid "Flip _horizontally"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/camera.c:724
|
||||
#: ../src/camera.c:734
|
||||
msgid "Flip _vertically"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/camera.c:727
|
||||
#: ../src/camera.c:737
|
||||
msgid "Keep aspect _ratio"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/camera.c:731
|
||||
#: ../src/camera.c:741
|
||||
msgid "Interpolation: "
|
||||
msgstr ""
|
||||
|
||||
#: ../src/camera.c:749
|
||||
#: ../src/camera.c:759
|
||||
msgid "Picture"
|
||||
msgstr ""
|
||||
msgstr "Imagen"
|
||||
|
||||
#: ../src/camera.c:755
|
||||
#: ../src/camera.c:765
|
||||
msgid "Format: "
|
||||
msgstr ""
|
||||
|
||||
#: ../src/camera.c:774
|
||||
#: ../src/camera.c:784
|
||||
msgid "Snapshots"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/camera.c:906
|
||||
#: ../src/camera.c:916
|
||||
msgid "Driver: "
|
||||
msgstr ""
|
||||
|
||||
#: ../src/camera.c:910
|
||||
#: ../src/camera.c:920
|
||||
msgid "Card: "
|
||||
msgstr ""
|
||||
|
||||
#: ../src/camera.c:914
|
||||
#: ../src/camera.c:924
|
||||
msgid "Bus info: "
|
||||
msgstr ""
|
||||
|
||||
#: ../src/camera.c:918
|
||||
#: ../src/camera.c:928
|
||||
msgid "Version: "
|
||||
msgstr ""
|
||||
|
||||
#: ../src/camera.c:931
|
||||
#: ../src/camera.c:941
|
||||
msgid "Capabilities: "
|
||||
msgstr ""
|
||||
|
||||
#: ../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
|
||||
#: ../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
|
||||
msgid "Could not save picture"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/camera.c:1085
|
||||
#: ../src/camera.c:1096
|
||||
msgid "Unknown error"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/camera.c:1189 ../src/camera.c:1193
|
||||
#: ../src/camera.c:1200 ../src/camera.c:1204
|
||||
msgid "Error"
|
||||
msgstr "Error"
|
||||
|
||||
#: ../src/camera.c:1422
|
||||
#: ../src/camera.c:1433
|
||||
msgid "Could not open the video capture device"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/camera.c:1463
|
||||
#: ../src/camera.c:1474
|
||||
msgid "Could not obtain the capabilities"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/camera.c:1467
|
||||
#: ../src/camera.c:1478
|
||||
msgid "Not a video capture device"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/camera.c:1480
|
||||
#: ../src/camera.c:1491
|
||||
msgid "Cropping not supported"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/camera.c:1485
|
||||
#: ../src/camera.c:1497
|
||||
msgid "Could not obtain the video capture format"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/camera.c:1489
|
||||
#: ../src/camera.c:1501
|
||||
msgid "Unsupported video capture type"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/camera.c:1500
|
||||
#: ../src/camera.c:1512
|
||||
msgid "Unsupported capabilities"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/camera.c:1535
|
||||
#: ../src/camera.c:1547
|
||||
msgid "Could not request buffers"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/camera.c:1538
|
||||
#: ../src/camera.c:1550
|
||||
msgid "Could not obtain enough buffers"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/camera.c:1542
|
||||
#: ../src/camera.c:1554
|
||||
msgid "Could not allocate buffers"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/camera.c:1558
|
||||
#: ../src/camera.c:1570
|
||||
msgid "Could not setup buffers"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/camera.c:1564
|
||||
#: ../src/camera.c:1576
|
||||
msgid "Could not map buffers"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/main.c:142
|
||||
#: ../src/main.c:152
|
||||
#, 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:99
|
||||
#: ../src/window.c:109
|
||||
msgid "Take _snapshot"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/window.c:102
|
||||
#: ../src/window.c:112
|
||||
msgid "_Gallery"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/window.c:105
|
||||
#: ../src/window.c:115
|
||||
msgid "_Properties"
|
||||
msgstr "_Propriedades"
|
||||
|
||||
#: ../src/window.c:108
|
||||
#: ../src/window.c:118
|
||||
msgid "_Close"
|
||||
msgstr "_Cerrar"
|
||||
|
||||
#: ../src/window.c:115
|
||||
#: ../src/window.c:125
|
||||
msgid "_Preferences"
|
||||
msgstr "_Preferencias"
|
||||
|
||||
#: ../src/window.c:122
|
||||
#: ../src/window.c:132
|
||||
msgid "_Fullscreen"
|
||||
msgstr ""
|
||||
msgstr "_Pantalla completa"
|
||||
|
||||
#: ../src/window.c:133
|
||||
#: ../src/window.c:143
|
||||
msgid "_Contents"
|
||||
msgstr "_Contenidos"
|
||||
|
||||
#: ../src/window.c:136 ../src/window.c:139
|
||||
#: ../src/window.c:146 ../src/window.c:149
|
||||
msgid "_About"
|
||||
msgstr "Acerca _de"
|
||||
|
||||
#: ../src/window.c:146
|
||||
#: ../src/window.c:156
|
||||
msgid "_File"
|
||||
msgstr "_Archivo"
|
||||
|
||||
#: ../src/window.c:147
|
||||
#: ../src/window.c:157
|
||||
msgid "_Edit"
|
||||
msgstr "_Editar"
|
||||
|
||||
#: ../src/window.c:148
|
||||
#: ../src/window.c:158
|
||||
msgid "_View"
|
||||
msgstr "_Ver"
|
||||
|
||||
#: ../src/window.c:149
|
||||
#: ../src/window.c:159
|
||||
msgid "_Help"
|
||||
msgstr "_Ayuda"
|
||||
|
||||
#: ../src/window.c:187
|
||||
#: ../src/window.c:197
|
||||
msgid "Webcam"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/window.c:192
|
||||
#: ../src/window.c:202
|
||||
msgid "Camera"
|
||||
msgstr ""
|
||||
msgstr "Cámara"
|
||||
|
||||
#: ../src/window.c:412
|
||||
#: ../src/window.c:422
|
||||
msgid "Simple webcam application for the DeforaOS desktop"
|
||||
msgstr ""
|
||||
|
||||
#: ../src/window.c:414
|
||||
#: ../src/window.c:424
|
||||
msgid "Simple camera application for the DeforaOS desktop"
|
||||
msgstr ""
|
||||
|
||||
#: ../tools/gallery.c:104
|
||||
#: ../tools/gallery.c:114
|
||||
#, c-format
|
||||
msgid "Usage: %s\n"
|
||||
msgstr "Usage: %s\n"
|
||||
|
|
122
po/fr.po
122
po/fr.po
|
@ -5,166 +5,166 @@
|
|||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Camera 0.1.0\n"
|
||||
"Project-Id-Version: Camera 0.3.1\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2020-01-18 14:16+0100\n"
|
||||
"PO-Revision-Date: 2013-01-18 22:31+0100\n"
|
||||
"POT-Creation-Date: 2024-07-30 02:46+0200\n"
|
||||
"PO-Revision-Date: 2025-02-20 17:45+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:203
|
||||
#: ../src/camera.c:213
|
||||
msgid "Snapshot"
|
||||
msgstr "Capture"
|
||||
|
||||
#: ../src/camera.c:206
|
||||
#: ../src/camera.c:216
|
||||
msgid "Gallery"
|
||||
msgstr "Gallerie"
|
||||
|
||||
#: ../src/camera.c:210 ../src/camera.c:217 ../src/camera.c:889
|
||||
#: ../src/camera.c:899
|
||||
#: ../src/camera.c:220 ../src/camera.c:227 ../src/camera.c:899
|
||||
#: ../src/camera.c:909
|
||||
msgid "Properties"
|
||||
msgstr "Propriétés"
|
||||
|
||||
#: ../src/camera.c:213 ../src/camera.c:706
|
||||
#: ../src/camera.c:223 ../src/camera.c:716
|
||||
msgid "Preferences"
|
||||
msgstr "Préférences"
|
||||
|
||||
#: ../src/camera.c:293
|
||||
#: ../src/camera.c:303
|
||||
msgid "Fullscreen"
|
||||
msgstr "Plein écran"
|
||||
|
||||
#: ../src/camera.c:691
|
||||
#: ../src/camera.c:701
|
||||
msgid "Nearest"
|
||||
msgstr "Approximative"
|
||||
|
||||
#: ../src/camera.c:692
|
||||
#: ../src/camera.c:702
|
||||
msgid "Tiles"
|
||||
msgstr "Mosaïque"
|
||||
|
||||
#: ../src/camera.c:693
|
||||
#: ../src/camera.c:703
|
||||
msgid "Bilinear"
|
||||
msgstr "Bilinéaire"
|
||||
|
||||
#: ../src/camera.c:694
|
||||
#: ../src/camera.c:704
|
||||
msgid "Hyperbolic"
|
||||
msgstr "Hyperbolique"
|
||||
|
||||
#: ../src/camera.c:721
|
||||
#: ../src/camera.c:731
|
||||
msgid "Flip _horizontally"
|
||||
msgstr "Retourner l'image _horizontalement"
|
||||
|
||||
#: ../src/camera.c:724
|
||||
#: ../src/camera.c:734
|
||||
msgid "Flip _vertically"
|
||||
msgstr "Retourner l'image _verticalement"
|
||||
|
||||
#: ../src/camera.c:727
|
||||
#: ../src/camera.c:737
|
||||
msgid "Keep aspect _ratio"
|
||||
msgstr "Préserver l'_aspect"
|
||||
|
||||
#: ../src/camera.c:731
|
||||
#: ../src/camera.c:741
|
||||
msgid "Interpolation: "
|
||||
msgstr "Interpolation : "
|
||||
|
||||
#: ../src/camera.c:749
|
||||
#: ../src/camera.c:759
|
||||
msgid "Picture"
|
||||
msgstr "Image"
|
||||
|
||||
#: ../src/camera.c:755
|
||||
#: ../src/camera.c:765
|
||||
msgid "Format: "
|
||||
msgstr "Format : "
|
||||
|
||||
#: ../src/camera.c:774
|
||||
#: ../src/camera.c:784
|
||||
msgid "Snapshots"
|
||||
msgstr "Captures"
|
||||
|
||||
#: ../src/camera.c:906
|
||||
#: ../src/camera.c:916
|
||||
msgid "Driver: "
|
||||
msgstr "Pilote : "
|
||||
|
||||
#: ../src/camera.c:910
|
||||
#: ../src/camera.c:920
|
||||
msgid "Card: "
|
||||
msgstr "Carte : "
|
||||
|
||||
#: ../src/camera.c:914
|
||||
#: ../src/camera.c:924
|
||||
msgid "Bus info: "
|
||||
msgstr "Bus : "
|
||||
|
||||
#: ../src/camera.c:918
|
||||
#: ../src/camera.c:928
|
||||
msgid "Version: "
|
||||
msgstr "Version : "
|
||||
|
||||
#: ../src/camera.c:931
|
||||
#: ../src/camera.c:941
|
||||
msgid "Capabilities: "
|
||||
msgstr "Capacités : "
|
||||
|
||||
#: ../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
|
||||
#: ../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
|
||||
msgid "Could not save picture"
|
||||
msgstr "Impossible d'enregistrer l'image"
|
||||
|
||||
#: ../src/camera.c:1085
|
||||
#: ../src/camera.c:1096
|
||||
msgid "Unknown error"
|
||||
msgstr "Erreur inconnue"
|
||||
|
||||
#: ../src/camera.c:1189 ../src/camera.c:1193
|
||||
#: ../src/camera.c:1200 ../src/camera.c:1204
|
||||
msgid "Error"
|
||||
msgstr "Erreur"
|
||||
|
||||
#: ../src/camera.c:1422
|
||||
#: ../src/camera.c:1433
|
||||
msgid "Could not open the video capture device"
|
||||
msgstr "Impossible d'ouvrir le périphérique de capture vidéo"
|
||||
|
||||
#: ../src/camera.c:1463
|
||||
#: ../src/camera.c:1474
|
||||
msgid "Could not obtain the capabilities"
|
||||
msgstr "Impossible d'obtenir les capacités"
|
||||
|
||||
#: ../src/camera.c:1467
|
||||
#: ../src/camera.c:1478
|
||||
msgid "Not a video capture device"
|
||||
msgstr "Pas de périphérique de capture vidéo"
|
||||
|
||||
#: ../src/camera.c:1480
|
||||
#: ../src/camera.c:1491
|
||||
msgid "Cropping not supported"
|
||||
msgstr "Recadrage non supporté"
|
||||
|
||||
#: ../src/camera.c:1485
|
||||
#: ../src/camera.c:1497
|
||||
msgid "Could not obtain the video capture format"
|
||||
msgstr "Impossible d'obtenir le format de capture vidéo"
|
||||
|
||||
#: ../src/camera.c:1489
|
||||
#: ../src/camera.c:1501
|
||||
msgid "Unsupported video capture type"
|
||||
msgstr "Type de capture vidéo non supporté"
|
||||
|
||||
#: ../src/camera.c:1500
|
||||
#: ../src/camera.c:1512
|
||||
msgid "Unsupported capabilities"
|
||||
msgstr "Capacités non supportées"
|
||||
|
||||
#: ../src/camera.c:1535
|
||||
#: ../src/camera.c:1547
|
||||
msgid "Could not request buffers"
|
||||
msgstr "Impossible de demander le cache"
|
||||
|
||||
#: ../src/camera.c:1538
|
||||
#: ../src/camera.c:1550
|
||||
msgid "Could not obtain enough buffers"
|
||||
msgstr "Impossible d'obtenir suffisamment de cache"
|
||||
|
||||
#: ../src/camera.c:1542
|
||||
#: ../src/camera.c:1554
|
||||
msgid "Could not allocate buffers"
|
||||
msgstr "Impossible d'allouer le cache"
|
||||
|
||||
#: ../src/camera.c:1558
|
||||
#: ../src/camera.c:1570
|
||||
msgid "Could not setup buffers"
|
||||
msgstr "Impossible de configurer le cache"
|
||||
|
||||
#: ../src/camera.c:1564
|
||||
#: ../src/camera.c:1576
|
||||
msgid "Could not map buffers"
|
||||
msgstr "Impossible d'étaler le cache"
|
||||
|
||||
#: ../src/main.c:142
|
||||
#: ../src/main.c:152
|
||||
#, 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:99
|
||||
#: ../src/window.c:109
|
||||
msgid "Take _snapshot"
|
||||
msgstr "_Prendre une photo"
|
||||
|
||||
#: ../src/window.c:102
|
||||
#: ../src/window.c:112
|
||||
msgid "_Gallery"
|
||||
msgstr "_Gallerie"
|
||||
|
||||
#: ../src/window.c:105
|
||||
#: ../src/window.c:115
|
||||
msgid "_Properties"
|
||||
msgstr "_Propriétés"
|
||||
|
||||
#: ../src/window.c:108
|
||||
#: ../src/window.c:118
|
||||
msgid "_Close"
|
||||
msgstr "_Fermer"
|
||||
|
||||
#: ../src/window.c:115
|
||||
#: ../src/window.c:125
|
||||
msgid "_Preferences"
|
||||
msgstr "_Préférences"
|
||||
|
||||
#: ../src/window.c:122
|
||||
#: ../src/window.c:132
|
||||
msgid "_Fullscreen"
|
||||
msgstr "_Plein écran"
|
||||
|
||||
#: ../src/window.c:133
|
||||
#: ../src/window.c:143
|
||||
msgid "_Contents"
|
||||
msgstr "_Sommaire"
|
||||
|
||||
#: ../src/window.c:136 ../src/window.c:139
|
||||
#: ../src/window.c:146 ../src/window.c:149
|
||||
msgid "_About"
|
||||
msgstr "À _propos"
|
||||
|
||||
#: ../src/window.c:146
|
||||
#: ../src/window.c:156
|
||||
msgid "_File"
|
||||
msgstr "_Fichier"
|
||||
|
||||
#: ../src/window.c:147
|
||||
#: ../src/window.c:157
|
||||
msgid "_Edit"
|
||||
msgstr "É_dition"
|
||||
|
||||
#: ../src/window.c:148
|
||||
#: ../src/window.c:158
|
||||
msgid "_View"
|
||||
msgstr "_Vue"
|
||||
|
||||
#: ../src/window.c:149
|
||||
#: ../src/window.c:159
|
||||
msgid "_Help"
|
||||
msgstr "_Aide"
|
||||
|
||||
#: ../src/window.c:187
|
||||
#: ../src/window.c:197
|
||||
msgid "Webcam"
|
||||
msgstr "Webcam"
|
||||
|
||||
#: ../src/window.c:192
|
||||
#: ../src/window.c:202
|
||||
msgid "Camera"
|
||||
msgstr "Caméra"
|
||||
|
||||
#: ../src/window.c:412
|
||||
#: ../src/window.c:422
|
||||
msgid "Simple webcam application for the DeforaOS desktop"
|
||||
msgstr "Webcam pour l'environnement DeforaOS"
|
||||
|
||||
#: ../src/window.c:414
|
||||
#: ../src/window.c:424
|
||||
msgid "Simple camera application for the DeforaOS desktop"
|
||||
msgstr "Caméra photo pour l'environnement DeforaOS"
|
||||
|
||||
#: ../tools/gallery.c:104
|
||||
#: ../tools/gallery.c:114
|
||||
#, c-format
|
||||
msgid "Usage: %s\n"
|
||||
msgstr "Usage: %s\n"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/sh
|
||||
#$Id$
|
||||
#Copyright (c) 2010-2015 Pierre Pronchery <khorben@defora.org>
|
||||
#Copyright (c) 2010-2020 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,6 +40,8 @@ MSGMERGE="msgmerge"
|
|||
RM="rm -f"
|
||||
XGETTEXT="xgettext --force-po"
|
||||
|
||||
[ -f "$CONFIGSH" ] && . "$CONFIGSH"
|
||||
|
||||
|
||||
#functions
|
||||
#debug
|
||||
|
@ -112,7 +114,7 @@ _gettext_pot()
|
|||
clean=0
|
||||
install=0
|
||||
uninstall=0
|
||||
while getopts "ciuP:" name; do
|
||||
while getopts "ciO:uP:" name; do
|
||||
case "$name" in
|
||||
c)
|
||||
clean=1
|
||||
|
@ -121,6 +123,9 @@ while getopts "ciuP:" name; do
|
|||
uninstall=0
|
||||
install=1
|
||||
;;
|
||||
O)
|
||||
export "${OPTARG%%=*}"="${OPTARG#*=}"
|
||||
;;
|
||||
u)
|
||||
install=0
|
||||
uninstall=1
|
||||
|
@ -135,7 +140,7 @@ while getopts "ciuP:" name; do
|
|||
esac
|
||||
done
|
||||
shift $(($OPTIND - 1))
|
||||
if [ $# -eq 0 ]; then
|
||||
if [ $# -lt 1 ]; then
|
||||
_usage
|
||||
exit $?
|
||||
fi
|
||||
|
|
15
project.conf
15
project.conf
|
@ -1,5 +1,5 @@
|
|||
package=Camera
|
||||
version=0.2.0
|
||||
version=0.3.1
|
||||
vendor=Desktop
|
||||
config=h,sh
|
||||
|
||||
|
@ -7,6 +7,19 @@ 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
|
||||
|
|
312
src/camera.c
312
src/camera.c
|
@ -1,17 +1,27 @@
|
|||
/* $Id$ */
|
||||
/* Copyright (c) 2012-2020 Pierre Pronchery <khorben@defora.org> */
|
||||
/* Copyright (c) 2012-2024 Pierre Pronchery <khorben@defora.org> */
|
||||
/* This file is part of DeforaOS Desktop Camera */
|
||||
/* 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.
|
||||
/* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* 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.
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
* 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. */
|
||||
|
||||
|
||||
|
||||
|
@ -84,6 +94,7 @@ struct _Camera
|
|||
|
||||
guint source;
|
||||
int fd;
|
||||
struct v4l2_buffer buf;
|
||||
struct v4l2_capability cap;
|
||||
struct v4l2_format format;
|
||||
|
||||
|
@ -112,7 +123,9 @@ struct _Camera
|
|||
GtkWidget * widget;
|
||||
GtkWidget * window;
|
||||
PangoFontDescription * bold;
|
||||
#if !GTK_CHECK_VERSION(3, 0, 0)
|
||||
#if GTK_CHECK_VERSION(3, 0, 0)
|
||||
cairo_surface_t * surface;
|
||||
#else
|
||||
GdkGC * gc;
|
||||
#endif
|
||||
#if GTK_CHECK_VERSION(2, 18, 0)
|
||||
|
@ -175,14 +188,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
|
||||
|
@ -259,7 +272,9 @@ Camera * camera_new(GtkWidget * window, GtkAccelGroup * group,
|
|||
camera->widget = NULL;
|
||||
camera->window = window;
|
||||
camera->bold = NULL;
|
||||
#if !GTK_CHECK_VERSION(3, 0, 0)
|
||||
#if GTK_CHECK_VERSION(3, 0, 0)
|
||||
camera->surface = NULL;
|
||||
#else
|
||||
camera->gc = NULL;
|
||||
#endif
|
||||
camera->pr_window = NULL;
|
||||
|
@ -318,14 +333,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
|
||||
|
@ -864,20 +879,52 @@ static void _properties_window(Camera * camera)
|
|||
GtkSizeGroup * group;
|
||||
GtkWidget * vbox;
|
||||
GtkWidget * hbox;
|
||||
char buf[64];
|
||||
char buf[256];
|
||||
const struct
|
||||
{
|
||||
unsigned int capability;
|
||||
char const * name;
|
||||
} capabilities[] =
|
||||
{
|
||||
{ V4L2_CAP_VIDEO_CAPTURE, "capture" },
|
||||
{ V4L2_CAP_VIDEO_OUTPUT, "output" },
|
||||
{ V4L2_CAP_VIDEO_OVERLAY, "overlay" },
|
||||
{ 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_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" },
|
||||
{ 0, NULL }
|
||||
#ifdef V4L2_CAP_TOUCH
|
||||
{ V4L2_CAP_TOUCH, "touch" }
|
||||
#endif
|
||||
};
|
||||
unsigned int i;
|
||||
char const * sep = "";
|
||||
|
@ -919,12 +966,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; capabilities[i].name != NULL; i++)
|
||||
for(i = 0; i < sizeof(capabilities) / sizeof(*capabilities); i++)
|
||||
if(camera->cap.capabilities & capabilities[i].capability)
|
||||
{
|
||||
strncat(buf, sep, sizeof(buf) - strlen(buf));
|
||||
strncat(buf, sep, sizeof(buf) - strlen(buf) - 1);
|
||||
strncat(buf, capabilities[i].name, sizeof(buf)
|
||||
- strlen(buf));
|
||||
- strlen(buf) - 1);
|
||||
sep = ", ";
|
||||
}
|
||||
buf[sizeof(buf) - 1] = '\0';
|
||||
|
@ -996,7 +1043,8 @@ 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);
|
||||
}
|
||||
|
@ -1128,7 +1176,11 @@ 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 GTK_CHECK_VERSION(3, 0, 0)
|
||||
if(camera->surface != NULL)
|
||||
cairo_surface_destroy(camera->surface);
|
||||
camera->surface = NULL;
|
||||
#else
|
||||
if(camera->pixmap != NULL)
|
||||
g_object_unref(camera->pixmap);
|
||||
camera->pixmap = NULL;
|
||||
|
@ -1139,15 +1191,20 @@ void camera_stop(Camera * camera)
|
|||
if((char *)camera->rgb_buffer != camera->raw_buffer)
|
||||
free(camera->rgb_buffer);
|
||||
camera->rgb_buffer = NULL;
|
||||
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);
|
||||
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);
|
||||
camera->raw_buffer = NULL;
|
||||
camera->raw_buffer_cnt = 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1224,29 +1281,38 @@ 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;
|
||||
if(_camera_ioctl(camera, VIDIOC_DQBUF, &buf) == -1)
|
||||
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)
|
||||
{
|
||||
_camera_error(camera, _("Could not save picture"), 1);
|
||||
_camera_error(camera, _("Could not dequeue buffer"), 1);
|
||||
camera->source = 0;
|
||||
return FALSE;
|
||||
}
|
||||
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 */
|
||||
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->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
|
||||
}
|
||||
|
||||
|
||||
|
@ -1264,6 +1330,7 @@ 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 */
|
||||
|
@ -1299,6 +1366,33 @@ 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)
|
||||
|
@ -1307,14 +1401,11 @@ static gboolean _camera_on_drawing_area_draw(GtkWidget * widget, cairo_t * cr,
|
|||
(void) widget;
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "DEBUG: %s() %p\n", __func__, camera->pixbuf);
|
||||
fprintf(stderr, "DEBUG: %s()\n", __func__);
|
||||
#endif
|
||||
if(camera->pixbuf != NULL)
|
||||
{
|
||||
gdk_cairo_set_source_pixbuf(cr, camera->pixbuf, 0, 0);
|
||||
cairo_paint(cr);
|
||||
}
|
||||
return TRUE;
|
||||
cairo_set_source_surface(cr, camera->surface, 0, 0);
|
||||
cairo_paint(cr);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1403,9 +1494,7 @@ 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)
|
||||
|
@ -1444,9 +1533,6 @@ 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;
|
||||
}
|
||||
|
||||
|
@ -1480,19 +1566,36 @@ 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"));
|
||||
/* check the current 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 */
|
||||
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)
|
||||
#ifdef NOTYET
|
||||
ret = _open_setup_mmap(camera);
|
||||
#else
|
||||
ret = _open_setup_read(camera);
|
||||
#endif
|
||||
{
|
||||
if((ret = _open_setup_mmap(camera)) != 0
|
||||
&& (camera->cap.capabilities
|
||||
& V4L2_CAP_READWRITE) != 0)
|
||||
{
|
||||
camera_stop(camera);
|
||||
ret = _open_setup_read(camera);
|
||||
}
|
||||
}
|
||||
else if((camera->cap.capabilities & V4L2_CAP_READWRITE) != 0)
|
||||
ret = _open_setup_read(camera);
|
||||
else
|
||||
|
@ -1516,12 +1619,14 @@ 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__);
|
||||
|
@ -1533,17 +1638,18 @@ 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"));
|
||||
if((camera->buffers = malloc(sizeof(*camera->buffers) * req.count))
|
||||
/* initialize the buffers */
|
||||
if((camera->buffers = calloc(req.count, sizeof(*camera->buffers)))
|
||||
== 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 */
|
||||
|
@ -1564,9 +1670,30 @@ 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)
|
||||
{
|
||||
|
@ -1584,7 +1711,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,
|
||||
|
@ -1627,7 +1754,8 @@ 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)
|
||||
#if GTK_CHECK_VERSION(3, 0, 0)
|
||||
cairo_t * cr;
|
||||
GtkAllocation * allocation = &camera->area_allocation;
|
||||
#endif
|
||||
int width = camera->format.fmt.pix.width;
|
||||
|
@ -1638,22 +1766,32 @@ 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);
|
||||
else
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
/* 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);
|
||||
|
@ -1661,7 +1799,12 @@ 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)
|
||||
#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
|
||||
gdk_pixbuf_render_to_drawable(camera->pixbuf, camera->pixmap,
|
||||
camera->gc, 0, 0, 0, 0, -1, -1,
|
||||
GDK_RGB_DITHER_NORMAL, 0, 0);
|
||||
|
@ -1669,9 +1812,20 @@ static gboolean _camera_on_refresh(gpointer data)
|
|||
}
|
||||
/* force a refresh */
|
||||
gtk_widget_queue_draw(camera->area);
|
||||
camera->source = g_io_add_watch(camera->channel, G_IO_IN,
|
||||
(camera->buffers != NULL) ? _camera_on_can_mmap
|
||||
: _camera_on_can_read, camera);
|
||||
/* 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);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
30
src/camera.h
30
src/camera.h
|
@ -1,17 +1,27 @@
|
|||
/* $Id$ */
|
||||
/* Copyright (c) 2012-2018 Pierre Pronchery <khorben@defora.org> */
|
||||
/* Copyright (c) 2012-2020 Pierre Pronchery <khorben@defora.org> */
|
||||
/* This file is part of DeforaOS Desktop Camera */
|
||||
/* 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.
|
||||
/* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* 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.
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
* 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. */
|
||||
|
||||
|
||||
|
||||
|
|
51
src/main.c
51
src/main.c
|
@ -1,17 +1,27 @@
|
|||
/* $Id$ */
|
||||
/* Copyright (c) 2012-2018 Pierre Pronchery <khorben@defora.org> */
|
||||
/* Copyright (c) 2012-2024 Pierre Pronchery <khorben@defora.org> */
|
||||
/* This file is part of DeforaOS Desktop Camera */
|
||||
/* 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.
|
||||
/* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* 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.
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
* 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. */
|
||||
|
||||
|
||||
|
||||
|
@ -20,8 +30,10 @@
|
|||
#include <locale.h>
|
||||
#include <libintl.h>
|
||||
#include <gtk/gtk.h>
|
||||
#if GTK_CHECK_VERSION(3, 0, 0)
|
||||
# include <gtk/gtkx.h>
|
||||
#if defined(GDK_WINDOWING_X11)
|
||||
# if GTK_CHECK_VERSION(3, 0, 0)
|
||||
# include <gtk/gtkx.h>
|
||||
# endif
|
||||
#endif
|
||||
#include <System.h>
|
||||
#include "camera.h"
|
||||
|
@ -57,7 +69,9 @@ 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)
|
||||
|
@ -85,6 +99,16 @@ 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;
|
||||
|
@ -117,14 +141,17 @@ 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 */
|
||||
|
|
|
@ -1,17 +1,27 @@
|
|||
/* $Id$ */
|
||||
/* Copyright (c) 2013 Pierre Pronchery <khorben@defora.org> */
|
||||
/* Copyright (c) 2013-2020 Pierre Pronchery <khorben@defora.org> */
|
||||
/* This file is part of DeforaOS Desktop Camera */
|
||||
/* 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.
|
||||
/* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* 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.
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
* 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. */
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,17 +1,27 @@
|
|||
/* $Id$ */
|
||||
/* Copyright (c) 2013 Pierre Pronchery <khorben@defora.org> */
|
||||
/* Copyright (c) 2013-2020 Pierre Pronchery <khorben@defora.org> */
|
||||
/* This file is part of DeforaOS Desktop Camera */
|
||||
/* 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.
|
||||
/* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* 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.
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
* 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. */
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -5,15 +5,27 @@ ldflags_force=`pkg-config --libs libDesktop` -lintl
|
|||
ldflags=-pie -Wl,-z,relro -Wl,-z,now
|
||||
dist=Makefile,camera.h,overlay.h,window.h
|
||||
|
||||
#for Gtk+ 3
|
||||
cflags_force=`pkg-config --cflags libDesktop gtk+-x11-3.0`
|
||||
ldflags_force=`pkg-config --libs libDesktop gtk+-x11-3.0` -lintl
|
||||
#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=binary
|
||||
sources=camera.c,overlay.c,window.c,main.c
|
||||
install=$(BINDIR)
|
||||
|
||||
#sources
|
||||
[camera.c]
|
||||
depends=overlay.h,camera.h,../config.h
|
||||
|
||||
|
|
|
@ -1,17 +1,27 @@
|
|||
/* $Id$ */
|
||||
/* Copyright (c) 2015-2018 Pierre Pronchery <khorben@defora.org> */
|
||||
/* Copyright (c) 2015-2020 Pierre Pronchery <khorben@defora.org> */
|
||||
/* This file is part of DeforaOS Desktop Camera */
|
||||
/* 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.
|
||||
/* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* 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.
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
* 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. */
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,17 +1,30 @@
|
|||
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
|
||||
|
|
31
src/window.c
31
src/window.c
|
@ -1,19 +1,29 @@
|
|||
/* $Id$ */
|
||||
static char const _copyright[] =
|
||||
"Copyright © 2012-2018 Pierre Pronchery <khorben@defora.org>";
|
||||
"Copyright © 2012-2020 Pierre Pronchery <khorben@defora.org>";
|
||||
/* This file is part of DeforaOS Desktop Camera */
|
||||
static char const _license[] =
|
||||
"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"
|
||||
"Redistribution and use in source and binary forms, with or without\n"
|
||||
"modification, are permitted provided that the following conditions are\n"
|
||||
"met:\n"
|
||||
"\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"
|
||||
"1. Redistributions of source code must retain the above copyright notice,\n"
|
||||
" this list of conditions and the following disclaimer.\n"
|
||||
"\n"
|
||||
"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/>.";
|
||||
"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.";
|
||||
|
||||
|
||||
|
||||
|
@ -191,6 +201,7 @@ 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(
|
||||
|
|
30
src/window.h
30
src/window.h
|
@ -1,17 +1,27 @@
|
|||
/* $Id$ */
|
||||
/* Copyright (c) 2013-2014 Pierre Pronchery <khorben@defora.org> */
|
||||
/* Copyright (c) 2013-2020 Pierre Pronchery <khorben@defora.org> */
|
||||
/* This file is part of DeforaOS Desktop Camera */
|
||||
/* 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.
|
||||
/* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* 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.
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
* 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. */
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/sh
|
||||
#$Id$
|
||||
#Copyright (c) 2016-2019 Pierre Pronchery <khorben@defora.org>
|
||||
#Copyright (c) 2016-2021 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,6 +25,7 @@
|
|||
|
||||
|
||||
#variables
|
||||
CONFIGSH="${0%/clint.sh}/../config.sh"
|
||||
CFLAGS=
|
||||
CPPFLAGS=
|
||||
PROGNAME="clint.sh"
|
||||
|
@ -32,19 +33,23 @@ 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()
|
||||
{
|
||||
ret=0
|
||||
subdirs="data doc src tests tools"
|
||||
res=0
|
||||
subdirs=
|
||||
|
||||
$DATE
|
||||
while read line; do
|
||||
|
@ -58,43 +63,58 @@ _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
|
||||
for filename in $($FIND "../$subdir" -type f | $SORT); do
|
||||
while read filename; do
|
||||
[ -n "$filename" ] || continue
|
||||
r=0
|
||||
case "$filename" in
|
||||
*.c)
|
||||
echo
|
||||
(_clint_lint "$filename";
|
||||
_clint_rtrim "$filename")
|
||||
_clint_lint "$filename" || r=$?
|
||||
_clint_rtrim "$filename"|| r=$?
|
||||
;;
|
||||
*.h)
|
||||
echo
|
||||
echo "$filename:"
|
||||
(_clint_rtrim "$filename")
|
||||
_clint_rtrim "$filename"|| r=$?
|
||||
;;
|
||||
*)
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
if [ $? -ne 0 ]; then
|
||||
if [ $r -eq 0 ]; then
|
||||
echo " OK"
|
||||
echo "$PROGNAME: $filename: OK" 1>&2
|
||||
else
|
||||
echo "FAIL"
|
||||
echo "$PROGNAME: $filename: FAIL" 1>&2
|
||||
ret=2
|
||||
else
|
||||
echo "OK"
|
||||
res=2
|
||||
fi
|
||||
done
|
||||
done << EOF
|
||||
$($FIND "../$subdir" -type f | $SORT)
|
||||
EOF
|
||||
done
|
||||
return $ret
|
||||
return $res
|
||||
}
|
||||
|
||||
_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()
|
||||
{
|
||||
|
@ -110,10 +130,14 @@ _debug()
|
|||
{
|
||||
echo "$@" 1>&3
|
||||
"$@"
|
||||
res=$?
|
||||
#ignore errors when the command is not available
|
||||
[ $res -eq 127 ] && return 0
|
||||
return $res
|
||||
}
|
||||
|
||||
|
||||
#error
|
||||
_error()
|
||||
{
|
||||
echo "$PROGNAME: $@" 1>&2
|
||||
return 2
|
||||
}
|
||||
|
||||
|
||||
|
@ -125,14 +149,6 @@ _usage()
|
|||
}
|
||||
|
||||
|
||||
#warning
|
||||
_warning()
|
||||
{
|
||||
echo "$PROGNAME: $@" 1>&2
|
||||
return 2
|
||||
}
|
||||
|
||||
|
||||
#main
|
||||
clean=0
|
||||
while getopts "cO:P:" name; do
|
||||
|
@ -162,9 +178,15 @@ fi
|
|||
[ $clean -ne 0 ] && exit 0
|
||||
|
||||
exec 3>&1
|
||||
ret=0
|
||||
while [ $# -gt 0 ]; do
|
||||
target="$1"
|
||||
dirname="${target%/*}"
|
||||
shift
|
||||
|
||||
_clint > "$target" || exit 2
|
||||
if [ -n "$dirname" -a "$dirname" != "$target" ]; then
|
||||
$MKDIR -- "$dirname" || ret=$?
|
||||
fi
|
||||
_clint > "$target" || ret=$?
|
||||
done
|
||||
exit $ret
|
||||
|
|
130
tests/fixme.sh
130
tests/fixme.sh
|
@ -1,6 +1,6 @@
|
|||
#!/bin/sh
|
||||
#$Id$
|
||||
#Copyright (c) 2017-2019 Pierre Pronchery <khorben@defora.org>
|
||||
#Copyright (c) 2017-2022 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,23 +25,30 @@
|
|||
|
||||
|
||||
#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
|
||||
|
@ -56,27 +63,14 @@ _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=
|
||||
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
|
||||
callback=$(_fixme_callback "$filename")
|
||||
[ -n "$callback" ] || continue
|
||||
($callback "$filename") 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
|
@ -88,54 +82,114 @@ _fixme()
|
|||
return $res
|
||||
}
|
||||
|
||||
_fixme_asm()
|
||||
_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()
|
||||
{
|
||||
res=0
|
||||
filename="$1"
|
||||
|
||||
#warnings
|
||||
$GREP -nH '/\*.*\(TODO\|XXX\)' "$filename"
|
||||
$GREP -nH "/\\*.*$REGEXP_WARNING" "$filename"
|
||||
#failures
|
||||
$GREP -nH '/\*.*FIXME' "$filename" && res=2
|
||||
$GREP -nH "/\\*.*$REGEXP_ERROR" "$filename" && res=2
|
||||
return $res
|
||||
}
|
||||
|
||||
_fixme_c()
|
||||
_fixme_callback_c()
|
||||
{
|
||||
res=0
|
||||
filename="$1"
|
||||
|
||||
#warnings
|
||||
$GREP -nH '/\(/\|\*\).*\(TODO\|XXX\)' "$filename"
|
||||
$GREP -nH "/\\(/\\|\\*\\).*$REGEXP_WARNING" "$filename"
|
||||
#failures
|
||||
$GREP -nH '/\(/\|\*\).*FIXME' "$filename" && res=2
|
||||
$GREP -nH "/\\(/\\|\\*\\).*$REGEXP_ERROR" "$filename" && res=2
|
||||
return $res
|
||||
}
|
||||
|
||||
_fixme_sh()
|
||||
_fixme_callback_python()
|
||||
{
|
||||
res=0
|
||||
filename="$1"
|
||||
#XXX avoid matching the regexp
|
||||
comment="#"
|
||||
|
||||
#warnings
|
||||
$GREP -nH "$comment.*\\(TODO\\|XXX\\)" "$filename"
|
||||
$GREP -nH "$comment.*$REGEXP_WARNING" "$filename"
|
||||
#failures
|
||||
$GREP -nH "$comment.*FIXME" "$filename" && res=2
|
||||
$GREP -nH "$comment.*$REGEXP_ERROR" "$filename" && res=2
|
||||
return $res
|
||||
}
|
||||
|
||||
_fixme_xml()
|
||||
_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()
|
||||
{
|
||||
res=0
|
||||
filename="$1"
|
||||
|
||||
#XXX limited to a single line
|
||||
#warnings
|
||||
$GREP -nH '<!--.*\(TODO\|XXX\)' "$filename"
|
||||
$GREP -nH "<!--.*$REGEXP_WARNING" "$filename"
|
||||
#failures
|
||||
$GREP -nH '<!--.*FIXME' "$filename" && res=2
|
||||
$GREP -nH "<!--.*$REGEXP_ERROR" "$filename" && res=2
|
||||
return $res
|
||||
}
|
||||
|
||||
|
@ -145,10 +199,14 @@ _debug()
|
|||
{
|
||||
echo "$@" 1>&3
|
||||
"$@"
|
||||
res=$?
|
||||
#ignore errors when the command is not available
|
||||
[ $res -eq 127 ] && return 0
|
||||
return $res
|
||||
}
|
||||
|
||||
|
||||
#error
|
||||
_error()
|
||||
{
|
||||
echo "$PROGNAME: $@" 1>&2
|
||||
return 2
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/sh
|
||||
#$Id$
|
||||
#Copyright (c) 2014-2017 Pierre Pronchery <khorben@defora.org>
|
||||
#Copyright (c) 2014-2021 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,26 +25,31 @@
|
|||
|
||||
|
||||
#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"
|
||||
HTMLLINT="xmllint --html --nonet"
|
||||
MKDIR="mkdir -p"
|
||||
SORT="sort -n"
|
||||
TR="tr"
|
||||
|
||||
[ -f "$CONFIGSH" ] && . "$CONFIGSH"
|
||||
|
||||
|
||||
#functions
|
||||
#htmllint
|
||||
_htmllint()
|
||||
{
|
||||
ret=0
|
||||
res=0
|
||||
subdirs=
|
||||
|
||||
$DATE
|
||||
echo
|
||||
while read line; do
|
||||
case "$line" in
|
||||
"["*)
|
||||
|
@ -56,19 +61,30 @@ _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
|
||||
for filename in $($FIND "../$subdir" -iname '*.html' -o -iname '*.htm' | $SORT); do
|
||||
while read filename; do
|
||||
[ -n "$filename" ] || continue
|
||||
echo
|
||||
$ECHO -n "$filename:"
|
||||
$DEBUG $HTMLLINT "$filename" 2>&1 > "$DEVNULL"
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "$filename:"
|
||||
echo " OK"
|
||||
echo "$PROGNAME: $filename: OK" 1>&2
|
||||
else
|
||||
echo "FAIL"
|
||||
echo "$PROGNAME: $filename: FAIL" 1>&2
|
||||
ret=2
|
||||
res=2
|
||||
fi
|
||||
done
|
||||
done << EOF
|
||||
$($FIND "../$subdir" -type f -a \( -iname '*.html' -o -iname '*.htm' \) | $SORT)
|
||||
EOF
|
||||
done
|
||||
return $ret
|
||||
return $res
|
||||
}
|
||||
|
||||
|
||||
|
@ -77,10 +93,14 @@ _debug()
|
|||
{
|
||||
echo "$@" 1>&3
|
||||
"$@"
|
||||
res=$?
|
||||
#ignore errors when the command is not available
|
||||
[ $res -eq 127 ] && return 0
|
||||
return $res
|
||||
}
|
||||
|
||||
|
||||
#error
|
||||
_error()
|
||||
{
|
||||
echo "$PROGNAME: $@" 1>&2
|
||||
return 2
|
||||
}
|
||||
|
||||
|
||||
|
@ -121,9 +141,15 @@ fi
|
|||
[ $clean -ne 0 ] && exit 0
|
||||
|
||||
exec 3>&1
|
||||
ret=0
|
||||
while [ $# -gt 0 ]; do
|
||||
target="$1"
|
||||
dirname="${target%/*}"
|
||||
shift
|
||||
|
||||
_htmllint > "$target" || exit 2
|
||||
if [ -n "$dirname" -a "$dirname" != "$target" ]; then
|
||||
$MKDIR -- "$dirname" || ret=$?
|
||||
fi
|
||||
_htmllint > "$target" || ret=$?
|
||||
done
|
||||
exit $ret
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
targets=clint.log,fixme.log,htmllint.log,xmllint.log
|
||||
dist=Makefile,htmllint.sh,xmllint.sh
|
||||
dist=Makefile,clint.sh,fixme.sh,htmllint.sh,xmllint.sh
|
||||
|
||||
#targets
|
||||
[clint.log]
|
||||
type=script
|
||||
script=./clint.sh
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/sh
|
||||
#$Id$
|
||||
#Copyright (c) 2014-2017 Pierre Pronchery <khorben@defora.org>
|
||||
#Copyright (c) 2014-2021 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,26 +25,31 @@
|
|||
|
||||
|
||||
#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"
|
||||
XMLLINT="xmllint --nonet --xinclude"
|
||||
|
||||
[ -f "$CONFIGSH" ] && . "$CONFIGSH"
|
||||
|
||||
|
||||
#functions
|
||||
#xmllint
|
||||
_xmllint()
|
||||
{
|
||||
ret=0
|
||||
res=0
|
||||
subdirs=
|
||||
|
||||
$DATE
|
||||
echo
|
||||
while read line; do
|
||||
case "$line" in
|
||||
"["*)
|
||||
|
@ -56,19 +61,30 @@ _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
|
||||
for filename in $($FIND "../$subdir" -name '*.xml' -o -name '*.xsl' | $SORT); do
|
||||
while read filename; do
|
||||
[ -n "$filename" ] || continue
|
||||
echo
|
||||
$ECHO -n "$filename:"
|
||||
$DEBUG $XMLLINT "$filename" 2>&1 > "$DEVNULL"
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "$filename:"
|
||||
echo " OK"
|
||||
echo "$PROGNAME: $filename: OK" 1>&2
|
||||
else
|
||||
echo "FAIL"
|
||||
echo "$PROGNAME: $filename: FAIL" 1>&2
|
||||
ret=2
|
||||
res=2
|
||||
fi
|
||||
done
|
||||
done << EOF
|
||||
$($FIND "../$subdir" -type f -a \( -iname '*.xml' -o -iname '*.xsl' \) | $SORT)
|
||||
EOF
|
||||
done
|
||||
return $ret
|
||||
return $res
|
||||
}
|
||||
|
||||
|
||||
|
@ -77,10 +93,14 @@ _debug()
|
|||
{
|
||||
echo "$@" 1>&3
|
||||
"$@"
|
||||
res=$?
|
||||
#ignore errors when the command is not available
|
||||
[ $res -eq 127 ] && return 0
|
||||
return $res
|
||||
}
|
||||
|
||||
|
||||
#error
|
||||
_error()
|
||||
{
|
||||
echo "$PROGNAME: $@" 1>&2
|
||||
return 2
|
||||
}
|
||||
|
||||
|
||||
|
@ -121,9 +141,15 @@ fi
|
|||
[ $clean -ne 0 ] && exit 0
|
||||
|
||||
exec 3>&1
|
||||
ret=0
|
||||
while [ $# -gt 0 ]; do
|
||||
target="$1"
|
||||
dirname="${target%/*}"
|
||||
shift
|
||||
|
||||
_xmllint > "$target" || exit 2
|
||||
if [ -n "$dirname" -a "$dirname" != "$target" ]; then
|
||||
$MKDIR -- "$dirname" || ret=$?
|
||||
fi
|
||||
_xmllint > "$target" || ret=$?
|
||||
done
|
||||
exit $ret
|
||||
|
|
|
@ -1,17 +1,27 @@
|
|||
/* $Id$ */
|
||||
/* Copyright (c) 2013-2018 Pierre Pronchery <khorben@defora.org> */
|
||||
/* Copyright (c) 2013-2020 Pierre Pronchery <khorben@defora.org> */
|
||||
/* This file is part of DeforaOS Desktop Camera */
|
||||
/* 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.
|
||||
/* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* 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.
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
* 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. */
|
||||
|
||||
|
||||
|
||||
|
@ -29,12 +39,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
|
||||
|
@ -63,14 +73,14 @@ static int _usage(void);
|
|||
static int _gallery(void)
|
||||
{
|
||||
char const * homedir;
|
||||
char const browser[] = BINDIR "/" BROWSER_PROGNAME;
|
||||
char const browser[] = BINDIR "/" PROGNAME_BROWSER;
|
||||
char const dcim[] = "DCIM";
|
||||
char * path;
|
||||
#if GTK_CHECK_VERSION(2, 6, 0)
|
||||
char * argv[] = { BROWSER_PROGNAME, "-T", "--", NULL, NULL };
|
||||
char * argv[] = { PROGNAME_BROWSER, "-T", "--", NULL, NULL };
|
||||
const int arg = 3;
|
||||
#else
|
||||
char * argv[] = { BROWSER_PROGNAME, "--", NULL, NULL };
|
||||
char * argv[] = { PROGNAME_BROWSER, "--", NULL, NULL };
|
||||
const int arg = 2;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,17 +1,30 @@
|
|||
targets=gallery
|
||||
cflags_force=`pkg-config --cflags gtk+-2.0`
|
||||
cflags_force=`pkg-config --cflags libDesktop`
|
||||
cflags=-W -Wall -g -O2 -fPIE -D_FORTIFY_SOURCE=2 -fstack-protector
|
||||
ldflags_force=`pkg-config --libs glib-2.0`
|
||||
ldflags_force=`pkg-config --libs libDesktop`
|
||||
ldflags=-pie -Wl,-z,relro -Wl,-z,now
|
||||
dist=Makefile
|
||||
|
||||
#for Gtk+ 3
|
||||
cflags_force=`pkg-config --cflags gtk+-3.0`
|
||||
#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
|
||||
[gallery]
|
||||
type=binary
|
||||
sources=gallery.c
|
||||
install=$(BINDIR)
|
||||
|
||||
#sources
|
||||
[gallery.c]
|
||||
depends=../config.h
|
||||
|
|
Loading…
Reference in New Issue
Block a user