aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2010-04-01 09:24:40 (GMT)
committerGerd Hoffmann <kraxel@redhat.com>2010-04-01 09:24:40 (GMT)
commit0232cfd283801fe5bc7af5e4d29a70a429dc3421 (patch)
tree448c4204767c204a09eb0698abc20593e1ce5c2d
parente1757de76ecabf37c0ce59ed534b13ec630b3ec6 (diff)
v3.86
-rw-r--r--Changes14
-rw-r--r--Makefile2
-rw-r--r--Makefile.clean2
-rw-r--r--Makefile.in2
-rw-r--r--common/commands.c22
-rwxr-xr-xconfigure2
-rw-r--r--configure.ac2
-rw-r--r--console/fbtv.c2
-rw-r--r--debian/changelog17
-rw-r--r--debian/control21
-rw-r--r--debian/xawtv-plugin-alsa.files1
-rw-r--r--frequencies/backup/pal-bcast-cn.list282
-rw-r--r--frequencies/pal-bcast-cn.list281
-rw-r--r--libng/color_lut.c4
-rw-r--r--libng/color_yuv2rgb.c4
-rw-r--r--libng/contrib-plugins/bilinear.c11
-rw-r--r--libng/contrib-plugins/cubic.c11
-rw-r--r--libng/contrib-plugins/flt-smooth.c6
-rw-r--r--libng/contrib-plugins/linear-blend.c5
-rw-r--r--libng/contrib-plugins/linedoubler.c3
-rw-r--r--libng/grab-ng.c6
-rw-r--r--libng/grab-ng.h17
-rw-r--r--libng/plugins/conv-audio.c2
-rw-r--r--libng/plugins/drv0-bsd.c32
-rw-r--r--libng/plugins/drv0-v4l2.c29
-rw-r--r--libng/plugins/drv1-v4l.c30
-rw-r--r--libng/plugins/flt-invert.c6
-rw-r--r--libng/plugins/read-dv.c4
-rw-r--r--libng/plugins/read-qt.c2
-rw-r--r--libng/plugins/write-dv.c4
-rw-r--r--libng/plugins/write-qt.c4
-rw-r--r--libng/writefile.c2
-rw-r--r--structs/struct-dump.c5
-rw-r--r--todo/tmohan/webcam.c.orig993
-rw-r--r--x11/MoTV-fixed31
-rw-r--r--x11/Subdir.mk2
-rw-r--r--x11/Xawtv.ad27
-rw-r--r--x11/blit.c12
-rw-r--r--x11/motv.c5
-rw-r--r--x11/xt.c147
-rw-r--r--xawtv.spec2
41 files changed, 760 insertions, 1296 deletions
diff --git a/Changes b/Changes
index c23ea0a..3fe9994 100644
--- a/Changes
+++ b/Changes
@@ -1,4 +1,18 @@
+3.85 => 3.86
+============
+
+ * tweaked font sets.
+ * some FreeBSD fixes.
+ * various minor build fixes
+
+
+3.84 => 3.85
+============
+
+ * added UYVY support.
+
+
3.83 => 3.84
============
diff --git a/Makefile b/Makefile
index d4377c7..abc1322 100644
--- a/Makefile
+++ b/Makefile
@@ -12,7 +12,7 @@ build all install: $(arch)/Makefile
clean distclean:
-test -d "$(arch)" && rm -rf "$(arch)"
-tarball rpm checkit release port snapshot:
+tarball rpm checkit release port snapshot snap:
./configure
$(MAKE) $@
diff --git a/Makefile.clean b/Makefile.clean
index d4377c7..abc1322 100644
--- a/Makefile.clean
+++ b/Makefile.clean
@@ -12,7 +12,7 @@ build all install: $(arch)/Makefile
clean distclean:
-test -d "$(arch)" && rm -rf "$(arch)"
-tarball rpm checkit release port snapshot:
+tarball rpm checkit release port snapshot snap:
./configure
$(MAKE) $@
diff --git a/Makefile.in b/Makefile.in
index d663962..3bcc65a 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -174,7 +174,7 @@ tarball: distclean
rpm: tarball
rpm -ta ../xawtv_$(VERSION).tar.gz
-snapshot: distclean
+snapshot snap: distclean
(cd ..; tar cvzf $(HOME)/snapshot/xawtv-`date +%Y%m%d`.tar.gz \
xawtv-$(VERSION))
diff --git a/common/commands.c b/common/commands.c
index 429aef4..9b33bc9 100644
--- a/common/commands.c
+++ b/common/commands.c
@@ -1269,9 +1269,10 @@ vdr_handler(char *name, int argc, char **argv)
{
char line[80];
struct addrinfo ask;
- int i;
+ int i,rc;
unsigned int l,len;
+ reconnect:
if (-1 == vdr_sock) {
memset(&ask,0,sizeof(ask));
ask.ai_family = PF_UNSPEC;
@@ -1279,6 +1280,8 @@ vdr_handler(char *name, int argc, char **argv)
vdr_sock = tcp_connect(&ask,"localhost","2001");
if (-1 == vdr_sock)
return -1;
+ if (debug)
+ fprintf(stderr,"vdr: connected\n");
/* skip greeting line */
if (-1 == tcp_readbuf(vdr_sock,3,line,sizeof(line)))
@@ -1302,7 +1305,14 @@ vdr_handler(char *name, int argc, char **argv)
}
strcpy(line+len,"\r\n");
len += 2;
- if (len != write(vdr_sock,line,len)) {
+ if (len != (rc = write(vdr_sock,line,len))) {
+ if (-1 == rc && EPIPE == errno) {
+ if (debug)
+ fprintf(stderr,"tcp: write: broken pipe, trying reconnect\n");
+ close(vdr_sock);
+ vdr_sock = -1;
+ goto reconnect;
+ }
if (debug)
perror("tcp: write");
goto oops;
@@ -1315,6 +1325,14 @@ vdr_handler(char *name, int argc, char **argv)
goto oops;
if (debug)
fprintf(stderr,"vdr: << %s",line);
+
+#if 0
+ /* play nicely and close the handle -- vdr can handle only one
+ * connection at the same time. Drawback is that it increases
+ * latencies ... */
+ close(vdr_sock);
+ vdr_sock = -1;
+#endif
return 0;
oops:
diff --git a/configure b/configure
index 63eff74..7d38310 100755
--- a/configure
+++ b/configure
@@ -6049,7 +6049,7 @@ if test $ac_cv_lib_GL_glXChooseVisual = yes; then
cat >>confdefs.h <<\_ACEOF
#define HAVE_GL 1
_ACEOF
- FOUND_GL="yes"; LIBGL="-lGLU -lGL -lm"
+ FOUND_GL="yes"; LIBGL="-lGL -lm"
fi
else
diff --git a/configure.ac b/configure.ac
index eedbb60..49d490c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -253,7 +253,7 @@ AC_SUBST(LIBGL)
LIBGL=""
if test "$enable_gl" != "no"; then
AC_CHECK_LIB(GL, glXChooseVisual,
- AC_DEFINE(HAVE_GL,1,"have opengl") FOUND_GL="yes"; LIBGL="-lGLU -lGL -lm",,
+ AC_DEFINE(HAVE_GL,1,"have opengl") FOUND_GL="yes"; LIBGL="-lGL -lm",,
$X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS -lm)
else
echo "*** OpenGL disabled"
diff --git a/console/fbtv.c b/console/fbtv.c
index 2a20090..9697219 100644
--- a/console/fbtv.c
+++ b/console/fbtv.c
@@ -449,7 +449,7 @@ static void do_capture(int from, int to, int tmp_switch)
off.bytesperline = fb_fix.line_length;
if (off.width*2 > off.bytesperline)
off.width = off.bytesperline/2;
- off.fmtid = VIDEO_YUV422;
+ off.fmtid = VIDEO_YUYV;
drv->overlay(h_drv,&off,0,starty,NULL,0,0);
gfx_scaler_on(starty*off.bytesperline,off.bytesperline,
off.width,off.height,
diff --git a/debian/changelog b/debian/changelog
index 74ecd47..3471d7d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,11 +1,18 @@
-xawtv (3.83) unstable; urgency=low
+xawtv (3.86) unstable; urgency=low
- * new release (closes: #175886, #171884).
+ * new release (closes: #175886, #171884, #178691, #171354)
+ (closes: #178940, #179371, #175886).
* added danish template (closes: #175424).
* fixed radio description text (closes: #175115).
- * splitted alsa and quicktime plugins into separate sub-packages.
-
- -- Gerd Knorr <kraxel@debian.org> Fri, 17 Jan 2003 18:51:34 +0100
+ * splitted quicktime plugin into separate sub-package.
+ * rebuild seems to fix #183567 - not sure how this happened in
+ the first place as shared libary dependencies are autogenerated
+ by debhelper ... (closes: #183567).
+ * rebuild should also fixup the vorbis mess
+ (closes: #179379, #178851).
+ * fixed dependencies (closes: #179372, #184956, #184959, #144403).
+
+ -- Gerd Knorr <kraxel@debian.org> Tue, 18 Mar 2003 10:12:33 +0100
xawtv (3.82) unstable; urgency=low
diff --git a/debian/control b/debian/control
index f704386..c574a19 100644
--- a/debian/control
+++ b/debian/control
@@ -1,15 +1,15 @@
Source: xawtv
Section: graphics
Priority: extra
-Build-Depends: libjpeg-dev, libncurses5-dev, xlibs-dev (>= 4.0.1), liblircclient-dev, debhelper, xutils, xbase-clients, aalib1-dev, libasound2-dev, libzvbi-dev (>= 0.2.1), libquicktime-dev, libxaw7-dev
+Build-Depends: libjpeg-dev, libncurses5-dev, xlibs-dev (>= 4.0.1), liblircclient-dev, debhelper (>= 2.0), xutils, xbase-clients, aalib1-dev, libasound2-dev, libzvbi-dev (>= 0.2.1), libquicktime-dev, libxaw7-dev
Maintainer: Gerd Knorr <kraxel@debian.org>
Standards-Version: 3.5.7.1
Package: xawtv
Section: x11
Architecture: any
-Depends: ${shlibs:Depends}, v4l-conf, xutils, debconf, scantv, xawtv-plugins (=${Source-Version}), tv-fonts, pia
-Suggests: xawtv-plugin-qt (=${Source-Version}), xawtv-plugin-alsa (=${Source-Version})
+Depends: ${shlibs:Depends}, v4l-conf, xutils, debconf, scantv, xawtv-plugins (=${Source-Version}), pia
+Suggests: xawtv-plugin-qt (=${Source-Version}), tv-fonts
Description: X11 TV application
TV application for X11. Supports video4linux
devices and the Xvideo extension.
@@ -97,26 +97,23 @@ Description: quicktime plugin for xawtv and motv
this plugin is needed to record quicktime movies with
xawtv and motv.
-Package: xawtv-plugin-alsa
-Architecture: any
-Depends: ${shlibs:Depends}
-Description: alsa plugin for xawtv and motv
- this plugin adds alsa mixer support to xawtv and motv.
-
Package: xawtv-plugins
Architecture: any
Depends: ${shlibs:Depends}
Description: plugins for xawtv and motv
- a few image processing plugins.
+ A number of plugins for xawtv and motv: driver interfaces for
+ hardware access (video4linux API, ...), plugins for reading/writing
+ movie files and some image processing filters.
Package: webcam
Section: net
Architecture: any
-Depends: ${shlibs:Depends}, ftp, xawtv-plugins (=${Source-Version})
+Depends: ${shlibs:Depends}, xawtv-plugins (=${Source-Version})
+Reommends: ftp, ssh
Description: capture and upload images
webcam captures images from a video4linux device like
bttv, annotates them and and uploads them to a webserver
- using ftp in a endless loop.
+ using ftp or ssh in a endless loop.
Package: alevtd
Section: net
diff --git a/debian/xawtv-plugin-alsa.files b/debian/xawtv-plugin-alsa.files
deleted file mode 100644
index d70dde6..0000000
--- a/debian/xawtv-plugin-alsa.files
+++ /dev/null
@@ -1 +0,0 @@
-/usr/lib/xawtv/snd-alsa.so
diff --git a/frequencies/backup/pal-bcast-cn.list b/frequencies/backup/pal-bcast-cn.list
new file mode 100644
index 0000000..5ec6383
--- /dev/null
+++ b/frequencies/backup/pal-bcast-cn.list
@@ -0,0 +1,282 @@
+[1]
+freq = 49750
+
+[2]
+freq = 57750
+
+[3]
+freq = 65750
+
+[4]
+freq = 77250
+
+[5]
+freq = 85250
+
+[6]
+freq = 112250
+
+[7]
+freq = 120250
+
+[8]
+freq = 128250
+
+[9]
+freq = 136250
+
+[10]
+freq = 144250
+
+[11]
+freq = 152250
+
+[12]
+freq = 160250
+
+[13]
+freq = 168250
+
+[14]
+freq = 176250
+
+[15]
+freq = 184250
+
+[16]
+freq = 192250
+
+[17]
+freq = 200250
+
+[18]
+freq = 208250
+
+[19]
+freq = 216250
+
+[20]
+freq = 224250
+
+[21]
+freq = 232250
+
+[22]
+freq = 240250
+
+[23]
+freq = 248250
+
+[24]
+freq = 256250
+
+[25]
+freq = 264250
+
+[26]
+freq = 272250
+
+[27]
+freq = 280250
+
+[28]
+freq = 288250
+
+[29]
+freq = 296250
+
+[30]
+freq = 304250
+
+[31]
+freq = 312250
+
+[32]
+freq = 320250
+
+[33]
+freq = 328250
+
+[34]
+freq = 336250
+
+[35]
+freq = 344250
+
+[36]
+freq = 352250
+
+[37]
+freq = 360250
+
+[38]
+freq = 368250
+
+[39]
+freq = 376250
+
+[40]
+freq = 384250
+
+[41]
+freq = 392250
+
+[42]
+freq = 400250
+
+[43]
+freq = 408250
+
+[44]
+freq = 416250
+
+[45]
+freq = 424250
+
+[46]
+freq = 432250
+
+[47]
+freq = 440250
+
+[48]
+freq = 448250
+
+[49]
+freq = 456250
+
+[50]
+freq = 463250
+
+[51]
+freq = 471250
+
+[52]
+freq = 479250
+
+[53]
+freq = 487250
+
+[54]
+freq = 495250
+
+[55]
+freq = 503250
+
+[56]
+freq = 511250
+
+[57]
+freq = 519250
+
+[58]
+freq = 527250
+
+[59]
+freq = 535250
+
+[60]
+freq = 543250
+
+[61]
+freq = 551250
+
+[62]
+freq = 559250
+
+[63]
+freq = 607250
+
+[64]
+freq = 615250
+
+[65]
+freq = 623250
+
+[66]
+freq = 631250
+
+[67]
+freq = 639250
+
+[68]
+freq = 647250
+
+[69]
+freq = 655250
+
+[70]
+freq = 663250
+
+[71]
+freq = 671250
+
+[72]
+freq = 679250
+
+[73]
+freq = 687250
+
+[74]
+freq = 695250
+
+[75]
+freq = 703250
+
+[76]
+freq = 711250
+
+[77]
+freq = 719250
+
+[78]
+freq = 727250
+
+[79]
+freq = 735250
+
+[80]
+freq = 743250
+
+[81]
+freq = 751250
+
+[82]
+freq = 759250
+
+[83]
+freq = 767250
+
+[84]
+freq = 775250
+
+[85]
+freq = 783250
+
+[86]
+freq = 791250
+
+[87]
+freq = 799250
+
+[88]
+freq = 807250
+
+[89]
+freq = 815250
+
+[90]
+freq = 823250
+
+[91]
+freq = 831250
+
+[92]
+freq = 839250
+
+[93]
+freq = 847250
+
+[94]
+freq = 855250
+
diff --git a/frequencies/pal-bcast-cn.list b/frequencies/pal-bcast-cn.list
index 5ec6383..307418f 100644
--- a/frequencies/pal-bcast-cn.list
+++ b/frequencies/pal-bcast-cn.list
@@ -14,269 +14,320 @@ freq = 77250
freq = 85250
[6]
-freq = 112250
+freq = 168250
[7]
-freq = 120250
+freq = 176250
[8]
-freq = 128250
+freq = 184250
[9]
-freq = 136250
+freq = 192250
[10]
-freq = 144250
+freq = 200250
[11]
-freq = 152250
+freq = 208250
[12]
-freq = 160250
+freq = 216250
[13]
-freq = 168250
+freq = 471250
[14]
-freq = 176250
+freq = 479250
[15]
-freq = 184250
+freq = 487250
[16]
-freq = 192250
+freq = 495250
[17]
-freq = 200250
+freq = 503250
[18]
-freq = 208250
+freq = 511250
[19]
-freq = 216250
+freq = 519250
[20]
-freq = 224250
+freq = 527250
[21]
-freq = 232250
+freq = 535250
[22]
-freq = 240250
+freq = 543250
[23]
-freq = 248250
+freq = 551250
[24]
-freq = 256250
+freq = 559250
[25]
-freq = 264250
+freq = 607250
[26]
-freq = 272250
+freq = 615250
[27]
-freq = 280250
+freq = 623250
[28]
-freq = 288250
+freq = 631250
[29]
-freq = 296250
+freq = 639250
[30]
-freq = 304250
+freq = 647250
[31]
-freq = 312250
+freq = 655250
[32]
-freq = 320250
+freq = 663250
[33]
-freq = 328250
+freq = 671250
[34]
-freq = 336250
+freq = 679250
[35]
-freq = 344250
+freq = 687250
[36]
-freq = 352250
+freq = 695250
[37]
-freq = 360250
+freq = 703250
[38]
-freq = 368250
+freq = 711250
[39]
-freq = 376250
+freq = 719250
[40]
-freq = 384250
+freq = 727250
[41]
-freq = 392250
+freq = 735250
[42]
-freq = 400250
+freq = 743250
[43]
-freq = 408250
+freq = 751250
[44]
-freq = 416250
+freq = 759250
[45]
-freq = 424250
+freq = 767250
[46]
-freq = 432250
+freq = 775250
[47]
-freq = 440250
+freq = 783250
[48]
-freq = 448250
+freq = 791250
[49]
-freq = 456250
+freq = 799250
[50]
-freq = 463250
+freq = 807250
[51]
-freq = 471250
+freq = 815250
[52]
-freq = 479250
+freq = 823250
[53]
-freq = 487250
+freq = 831250
[54]
-freq = 495250
+freq = 839250
[55]
-freq = 503250
+freq = 847250
[56]
-freq = 511250
+freq = 855250
[57]
-freq = 519250
+freq = 863250
[58]
-freq = 527250
+freq = 871250
[59]
-freq = 535250
+freq = 879250
[60]
-freq = 543250
+freq = 887250
[61]
-freq = 551250
+freq = 895250
[62]
-freq = 559250
+freq = 903250
[63]
-freq = 607250
+freq = 911250
[64]
-freq = 615250
+freq = 919250
[65]
-freq = 623250
+freq = 927250
[66]
-freq = 631250
+freq = 935250
[67]
-freq = 639250
+freq = 943250
[68]
-freq = 647250
+freq = 951250
-[69]
-freq = 655250
+[A1]
+freq = 112250
-[70]
-freq = 663250
+[A2]
+freq = 120250
-[71]
-freq = 671250
+[A3]
+freq = 128250
-[72]
-freq = 679250
+[A4]
+freq = 136250
-[73]
-freq = 687250
+[A5]
+freq = 144250
-[74]
-freq = 695250
+[A6]
+freq = 152250
-[75]
-freq = 703250
+[A7]
+freq = 160250
-[76]
-freq = 711250
+[B1]
+freq = 224250
-[77]
-freq = 719250
+[B2]
+freq = 232250
-[78]
-freq = 727250
+[B3]
+freq = 240250
-[79]
-freq = 735250
+[B4]
+freq = 248250
-[80]
-freq = 743250
+[B5]
+freq = 256250
-[81]
-freq = 751250
+[B6]
+freq = 264250
-[82]
-freq = 759250
+[B7]
+freq = 272250
-[83]
-freq = 767250
+[B8]
+freq = 280250
-[84]
-freq = 775250
+[B9]
+freq = 288250
-[85]
-freq = 783250
+[B10]
+freq = 296250
-[86]
-freq = 791250
+[B11]
+freq = 304250
-[87]
-freq = 799250
+[B12]
+freq = 312250
-[88]
-freq = 807250
+[B13]
+freq = 320250
-[89]
-freq = 815250
+[B14]
+freq = 328250
-[90]
-freq = 823250
+[B15]
+freq = 336250
-[91]
-freq = 831250
+[B16]
+freq = 344250
-[92]
-freq = 839250
+[B17]
+freq = 352250
-[93]
-freq = 847250
+[B18]
+freq = 360250
-[94]
-freq = 855250
+[B19]
+freq = 368250
+
+[B20]
+freq = 376250
+
+[B21]
+freq = 384250
+
+[B22]
+freq = 392250
+
+[B23]
+freq = 400250
+
+[B24]
+freq = 408250
+
+[B25]
+freq = 416250
+
+[B26]
+freq = 424250
+
+[B27]
+freq = 432250
+
+[B28]
+freq = 440250
+
+[B29]
+freq = 448250
+
+[B30]
+freq = 456250
+
+[B31]
+freq = 463250
+
+[C1]
+freq = 567250
+
+[C2]
+freq = 575250
+
+[C3]
+freq = 583250
+
+[C4]
+freq = 591250
+
+[C5]
+freq = 599250
diff --git a/libng/color_lut.c b/libng/color_lut.c
index 72de486..81a5328 100644
--- a/libng/color_lut.c
+++ b/libng/color_lut.c
@@ -181,7 +181,7 @@ static struct ng_video_conv lut2_list[] = {
priv: gray_to_lut2,
}, {
NG_GENERIC_PACKED,
- fmtid_in: VIDEO_YUV422,
+ fmtid_in: VIDEO_YUYV,
priv: ng_yuv422_to_lut2,
},{
init: ng_conv_nop_init,
@@ -219,7 +219,7 @@ static struct ng_video_conv lut4_list[] = {
priv: gray_to_lut4,
}, {
NG_GENERIC_PACKED,
- fmtid_in: VIDEO_YUV422,
+ fmtid_in: VIDEO_YUYV,
priv: ng_yuv422_to_lut4,
},{
init: ng_conv_nop_init,
diff --git a/libng/color_yuv2rgb.c b/libng/color_yuv2rgb.c
index 37eebfc..be78548 100644
--- a/libng/color_yuv2rgb.c
+++ b/libng/color_yuv2rgb.c
@@ -384,12 +384,12 @@ ng_yuv422p_to_lut4(void *h, struct ng_video_buf *out, struct ng_video_buf *in)
static struct ng_video_conv conv_list[] = {
{
NG_GENERIC_PACKED,
- fmtid_in: VIDEO_YUV422,
+ fmtid_in: VIDEO_YUYV,
fmtid_out: VIDEO_RGB24,
priv: yuv422_to_rgb24,
},{
NG_GENERIC_PACKED,
- fmtid_in: VIDEO_YUV422,
+ fmtid_in: VIDEO_YUYV,
fmtid_out: VIDEO_GRAY,
priv: yuv422_to_gray,
},{
diff --git a/libng/contrib-plugins/bilinear.c b/libng/contrib-plugins/bilinear.c
index 243208b..73a6425 100644
--- a/libng/contrib-plugins/bilinear.c
+++ b/libng/contrib-plugins/bilinear.c
@@ -70,12 +70,15 @@ fini (void *handle)
static struct ng_filter filter = {
name:"bilinear deinterlace",
fmts:
- (1 << VIDEO_GRAY) |
+ (1 << VIDEO_GRAY) |
(1 << VIDEO_RGB15_NATIVE) |
(1 << VIDEO_RGB16_NATIVE) |
- (1 << VIDEO_BGR24) |
- (1 << VIDEO_RGB24) |
- (1 << VIDEO_BGR32) | (1 << VIDEO_RGB32) | (1 << VIDEO_YUV422),
+ (1 << VIDEO_BGR24) |
+ (1 << VIDEO_RGB24) |
+ (1 << VIDEO_BGR32) |
+ (1 << VIDEO_RGB32) |
+ (1 << VIDEO_YUYV) |
+ (1 << VIDEO_UYVY),
init:init,
frame:frame,
fini:fini,
diff --git a/libng/contrib-plugins/cubic.c b/libng/contrib-plugins/cubic.c
index 6c67682..b31ce5f 100644
--- a/libng/contrib-plugins/cubic.c
+++ b/libng/contrib-plugins/cubic.c
@@ -106,13 +106,14 @@ static struct ng_filter filter = {
name:"cubic interpolation",
fmts:
(1 << VIDEO_GRAY) |
- (1 << VIDEO_RGB15_NATIVE) |
- (1 << VIDEO_RGB16_NATIVE) |
+ (1 << VIDEO_RGB15_NATIVE) |
+ (1 << VIDEO_RGB16_NATIVE) |
(1 << VIDEO_BGR24) |
(1 << VIDEO_RGB24) |
- (1 << VIDEO_BGR32) |
- (1 << VIDEO_RGB32) |
- (1 << VIDEO_YUV422),
+ (1 << VIDEO_BGR32) |
+ (1 << VIDEO_RGB32) |
+ (1 << VIDEO_YUYV) |
+ (1 << VIDEO_UYVY),
init: init,
frame: frame,
fini: fini,
diff --git a/libng/contrib-plugins/flt-smooth.c b/libng/contrib-plugins/flt-smooth.c
index a1d865d..4c431e6 100644
--- a/libng/contrib-plugins/flt-smooth.c
+++ b/libng/contrib-plugins/flt-smooth.c
@@ -484,7 +484,8 @@ frame(void *h, struct ng_video_buf *in)
break;
case VIDEO_BGR32:
case VIDEO_RGB32:
- case VIDEO_YUV422:
+ case VIDEO_YUYV:
+ case VIDEO_UYVY:
smooth_native_32bit((unsigned int*)last,
(unsigned int*)dst,
(unsigned int*)src,
@@ -589,7 +590,8 @@ static struct ng_filter filter = {
(1 << VIDEO_RGB24) |
(1 << VIDEO_BGR32) |
(1 << VIDEO_RGB32) |
- (1 << VIDEO_YUV422),
+ (1 << VIDEO_YUYV) |
+ (1 << VIDEO_UYVY),
init: init,
frame: frame,
fini: fini,
diff --git a/libng/contrib-plugins/linear-blend.c b/libng/contrib-plugins/linear-blend.c
index 9377ae6..7b5ee36 100644
--- a/libng/contrib-plugins/linear-blend.c
+++ b/libng/contrib-plugins/linear-blend.c
@@ -151,7 +151,10 @@ static struct ng_filter filter = {
(1 << VIDEO_RGB16_NATIVE) |
(1 << VIDEO_BGR24) |
(1 << VIDEO_RGB24) |
- (1 << VIDEO_BGR32) | (1 << VIDEO_RGB32) | (1 << VIDEO_YUV422),
+ (1 << VIDEO_BGR32) |
+ (1 << VIDEO_RGB32) |
+ (1 << VIDEO_YUYV) |
+ (1 << VIDEO_UYVY),
init:init,
frame:frame,
fini:fini,
diff --git a/libng/contrib-plugins/linedoubler.c b/libng/contrib-plugins/linedoubler.c
index 114fdf8..30b0672 100644
--- a/libng/contrib-plugins/linedoubler.c
+++ b/libng/contrib-plugins/linedoubler.c
@@ -71,7 +71,8 @@ static struct ng_filter filter = {
(1 << VIDEO_RGB24) |
(1 << VIDEO_BGR32) |
(1 << VIDEO_RGB32) |
- (1 << VIDEO_YUV422),
+ (1 << VIDEO_YUYV) |
+ (1 << VIDEO_UYVY),
init: init,
frame: frame,
fini: fini,
diff --git a/libng/grab-ng.c b/libng/grab-ng.c
index 333c46e..1f02a2e 100644
--- a/libng/grab-ng.c
+++ b/libng/grab-ng.c
@@ -52,11 +52,12 @@ const unsigned int ng_vfmt_to_depth[] = {
32, /* RGB32 */
16, /* LUT2 */
32, /* LUT4 */
- 16, /* YUV422 */
+ 16, /* YUYV */
16, /* YUV422P */
12, /* YUV420P */
0, /* MJPEG */
0, /* JPEG */
+ 16, /* UYVY */
};
const char* ng_vfmt_to_desc[] = {
@@ -73,11 +74,12 @@ const char* ng_vfmt_to_desc[] = {
"32 bit TrueColor (BE: -rgb)",
"16 bit TrueColor (lut)",
"32 bit TrueColor (lut)",
- "16 bit YUV 4:2:2 (packed)",
+ "16 bit YUV 4:2:2 (packed, YUYV)",
"16 bit YUV 4:2:2 (planar)",
"12 bit YUV 4:2:0 (planar)",
"MJPEG (AVI)",
"JPEG (JFIF)",
+ "16 bit YUV 4:2:2 (packed, UYVY)",
};
/* --------------------------------------------------------------------- */
diff --git a/libng/grab-ng.h b/libng/grab-ng.h
index e7efa2a..a6a0587 100644
--- a/libng/grab-ng.h
+++ b/libng/grab-ng.h
@@ -51,12 +51,13 @@ extern char ng_v4l_conf[256];
#define VIDEO_RGB32 10 /* -rgb-rgb-rgb (BE) */
#define VIDEO_LUT2 11 /* lookup-table 2 byte depth */
#define VIDEO_LUT4 12 /* lookup-table 4 byte depth */
-#define VIDEO_YUV422 13 /* YUV 4:2:2 */
+#define VIDEO_YUYV 13 /* 4:2:2 */
#define VIDEO_YUV422P 14 /* YUV 4:2:2 (planar) */
#define VIDEO_YUV420P 15 /* YUV 4:2:0 (planar) */
#define VIDEO_MJPEG 16 /* MJPEG (AVI) */
#define VIDEO_JPEG 17 /* JPEG (JFIF) */
-#define VIDEO_FMT_COUNT 18
+#define VIDEO_UYVY 18 /* 4:2:2 */
+#define VIDEO_FMT_COUNT 19
#define AUDIO_NONE 0
#define AUDIO_U8_MONO 1
@@ -103,14 +104,14 @@ extern char ng_v4l_conf[256];
/* --------------------------------------------------------------------- */
-extern const unsigned int ng_vfmt_to_depth[];
-extern const char* ng_vfmt_to_desc[];
+extern const unsigned int ng_vfmt_to_depth[VIDEO_FMT_COUNT];
+extern const char* ng_vfmt_to_desc[VIDEO_FMT_COUNT];
-extern const unsigned int ng_afmt_to_channels[];
-extern const unsigned int ng_afmt_to_bits[];
-extern const char* ng_afmt_to_desc[];
+extern const unsigned int ng_afmt_to_channels[AUDIO_FMT_COUNT];
+extern const unsigned int ng_afmt_to_bits[AUDIO_FMT_COUNT];
+extern const char* ng_afmt_to_desc[AUDIO_FMT_COUNT];
-extern const char* ng_attr_to_desc[];
+extern const char* ng_attr_to_desc[ATTR_ID_COUNT];
/* --------------------------------------------------------------------- */
diff --git a/libng/plugins/conv-audio.c b/libng/plugins/conv-audio.c
index ebfd2e5..1aebc3e 100644
--- a/libng/plugins/conv-audio.c
+++ b/libng/plugins/conv-audio.c
@@ -139,6 +139,8 @@ static void mp3_enc_fini(void *handle)
free(h);
}
+/* ---------------------------------------------------------------------- */
+
static struct ng_audio_conv mp3_list[] = {
{
/* --- compress --- */
diff --git a/libng/plugins/drv0-bsd.c b/libng/plugins/drv0-bsd.c
index 46395b7..22340a9 100644
--- a/libng/plugins/drv0-bsd.c
+++ b/libng/plugins/drv0-bsd.c
@@ -86,7 +86,7 @@ static int bsd_overlay(void *handle, struct ng_video_fmt *fmt, int x, int y,
static void catchsignal(int signal);
static void siginit(void);
static int bsd_setformat(void *handle, struct ng_video_fmt *fmt);
-static int bsd_startvideo(void *handle, int fps, int buffers);
+static int bsd_startvideo(void *handle, int fps, unsigned int buffers);
static void bsd_stopvideo(void *handle);
static struct ng_video_buf* bsd_nextframe(void *handle);
static struct ng_video_buf* bsd_getimage(void *handle);
@@ -154,8 +154,27 @@ static int norms_map[] = {
BT848_IFORM_F_RSVD,
};
+static struct STRTAB audio[] = {
+ { 0, "Tuner" },
+ { 1, "Extern" },
+ { 2, "Intern" },
+ { -1, NULL }
+};
+static int audio_map[] = {
+ AUDIO_TUNER,
+ AUDIO_EXTERN,
+ AUDIO_INTERN,
+};
+
static struct ng_attribute bsd_attr[] = {
{
+ id: ATTR_ID_COUNT+1,
+ name: "audio",
+ type: ATTR_TYPE_CHOICE,
+ choices: audio,
+ read: bsd_read_attr,
+ write: bsd_write_attr,
+ },{
id: ATTR_ID_NORM,
name: "norm",
type: ATTR_TYPE_CHOICE,
@@ -511,6 +530,12 @@ static int bsd_read_attr(struct ng_attribute *attr)
if (-1 != xioctl(h->tfd,get,&arg))
value = arg;
break;
+ case ATTR_ID_COUNT+1: /* AUDIO */
+ if (-1 != xioctl(h->tfd, BT848_GAUDIO, &arg))
+ for (i = 0; i < sizeof(audio_map)/sizeof(int); i++)
+ if (arg == audio_map[i])
+ value = i;
+ break;
default:
break;
}
@@ -542,6 +567,9 @@ static void bsd_write_attr(struct ng_attribute *attr, int value)
arg = value;
xioctl(h->tfd,set,&arg);
break;
+ case ATTR_ID_COUNT+1: /* audio */
+ xioctl(h->tfd, BT848_SAUDIO,&audio_map[value]);
+ break;
default:
break;
}
@@ -741,7 +769,7 @@ set_capture(struct bsd_handle *h, int state)
}
}
-static int bsd_startvideo(void *handle, int fps, int buffers)
+static int bsd_startvideo(void *handle, int fps, unsigned int buffers)
{
struct bsd_handle *h = handle;
diff --git a/libng/plugins/drv0-v4l2.c b/libng/plugins/drv0-v4l2.c
index 205eaf1..032d2a8 100644
--- a/libng/plugins/drv0-v4l2.c
+++ b/libng/plugins/drv0-v4l2.c
@@ -129,22 +129,19 @@ struct ng_vid_driver v4l2_driver = {
};
static __u32 xawtv_pixelformat[VIDEO_FMT_COUNT] = {
- 0, /* unused */
- V4L2_PIX_FMT_HI240, /* RGB8 */
- V4L2_PIX_FMT_GREY, /* GRAY8 */
- V4L2_PIX_FMT_RGB555, /* RGB15_LE */
- V4L2_PIX_FMT_RGB565, /* RGB16_LE */
- V4L2_PIX_FMT_RGB555X, /* RGB15_BE */
- V4L2_PIX_FMT_RGB565X, /* RGB16_BE */
- V4L2_PIX_FMT_BGR24, /* BGR24 */
- V4L2_PIX_FMT_BGR32, /* BGR32 */
- V4L2_PIX_FMT_RGB24, /* RGB24 */
- 0, /* RGB32 */
- 0, /* LUT 2 */
- 0, /* LUT 4 */
- V4L2_PIX_FMT_YUYV, /* YUV422 */
- V4L2_PIX_FMT_YUV422P, /* YUV422P */
- V4L2_PIX_FMT_YUV420, /* YUV420P */
+ [ VIDEO_RGB08 ] = V4L2_PIX_FMT_HI240,
+ [ VIDEO_GRAY ] = V4L2_PIX_FMT_GREY,
+ [ VIDEO_RGB15_LE ] = V4L2_PIX_FMT_RGB555,
+ [ VIDEO_RGB16_LE ] = V4L2_PIX_FMT_RGB565,
+ [ VIDEO_RGB15_BE ] = V4L2_PIX_FMT_RGB555X,
+ [ VIDEO_RGB16_BE ] = V4L2_PIX_FMT_RGB565X,
+ [ VIDEO_BGR24 ] = V4L2_PIX_FMT_BGR24,
+ [ VIDEO_BGR32 ] = V4L2_PIX_FMT_BGR32,
+ [ VIDEO_RGB24 ] = V4L2_PIX_FMT_RGB24,
+ [ VIDEO_YUYV ] = V4L2_PIX_FMT_YUYV,
+ [ VIDEO_UYVY ] = V4L2_PIX_FMT_UYVY,
+ [ VIDEO_YUV422P ] = V4L2_PIX_FMT_YUV422P,
+ [ VIDEO_YUV420P ] = V4L2_PIX_FMT_YUV420,
};
static struct STRTAB stereo[] = {
diff --git a/libng/plugins/drv1-v4l.c b/libng/plugins/drv1-v4l.c
index 9998969..2998113 100644
--- a/libng/plugins/drv1-v4l.c
+++ b/libng/plugins/drv1-v4l.c
@@ -101,22 +101,16 @@ static struct STRTAB norms_bttv[] = {
};
static unsigned short format2palette[VIDEO_FMT_COUNT] = {
- 0, /* unused */
- VIDEO_PALETTE_HI240, /* RGB8 */
- VIDEO_PALETTE_GREY, /* GRAY8 */
- VIDEO_PALETTE_RGB555, /* RGB15_LE */
- VIDEO_PALETTE_RGB565, /* RGB16_LE */
- 0,
- 0,
- VIDEO_PALETTE_RGB24, /* BGR24 */
- VIDEO_PALETTE_RGB32, /* BGR32 */
- 0,
- 0,
- 0, /* LUT 2 */
- 0, /* LUT 4 */
- VIDEO_PALETTE_YUV422, /* YUV422 */
- VIDEO_PALETTE_YUV422P, /* YUV422P */
- VIDEO_PALETTE_YUV420P, /* YUV420P */
+ [ VIDEO_RGB08 ] = VIDEO_PALETTE_HI240,
+ [ VIDEO_GRAY ] = VIDEO_PALETTE_GREY,
+ [ VIDEO_RGB15_LE ] = VIDEO_PALETTE_RGB555,
+ [ VIDEO_RGB16_LE ] = VIDEO_PALETTE_RGB565,
+ [ VIDEO_BGR24 ] = VIDEO_PALETTE_RGB24,
+ [ VIDEO_BGR32 ] = VIDEO_PALETTE_RGB32,
+ [ VIDEO_YUYV ] = VIDEO_PALETTE_YUV422,
+ [ VIDEO_UYVY ] = VIDEO_PALETTE_UYVY,
+ [ VIDEO_YUV422P ] = VIDEO_PALETTE_YUV422P,
+ [ VIDEO_YUV420P ] = VIDEO_PALETTE_YUV420P,
};
/* pass 0/1 by reference */
@@ -957,6 +951,10 @@ static int
mm_setparams(struct v4l_handle *h, struct ng_video_fmt *fmt)
{
unsigned int i;
+
+ /* buffers available ? */
+ if (h->mbuf.frames < 1)
+ return -1;
/* verify parameters */
xioctl(h->fd,VIDIOCGCAP,&h->capability);
diff --git a/libng/plugins/flt-invert.c b/libng/plugins/flt-invert.c
index af97b01..b064597 100644
--- a/libng/plugins/flt-invert.c
+++ b/libng/plugins/flt-invert.c
@@ -84,7 +84,8 @@ frame(void *handle, struct ng_video_buf *in)
case VIDEO_RGB24:
case VIDEO_BGR32:
case VIDEO_RGB32:
- case VIDEO_YUV422:
+ case VIDEO_YUYV:
+ case VIDEO_UYVY:
invert_bytes(dst,src,cnt);
break;
case VIDEO_RGB15_NATIVE:
@@ -119,7 +120,8 @@ static struct ng_filter filter = {
(1 << VIDEO_RGB24) |
(1 << VIDEO_BGR32) |
(1 << VIDEO_RGB32) |
- (1 << VIDEO_YUV422),
+ (1 << VIDEO_YUYV) |
+ (1 << VIDEO_UYVY),
init: init,
frame: frame,
fini: fini,
diff --git a/libng/plugins/read-dv.c b/libng/plugins/read-dv.c
index f0901bf..6b92fd5 100644
--- a/libng/plugins/read-dv.c
+++ b/libng/plugins/read-dv.c
@@ -46,7 +46,7 @@ struct dv_handle {
static enum color_space_e fmtid_to_colorspace[VIDEO_FMT_COUNT] = {
[ 0 ... VIDEO_FMT_COUNT-1 ] = UNSET,
- [ VIDEO_YUV422 ] = e_dv_color_yuv,
+ [ VIDEO_YUYV ] = e_dv_color_yuv,
[ VIDEO_RGB24 ] = e_dv_color_rgb,
[ VIDEO_BGR32 ] = e_dv_color_bgr0,
};
@@ -211,7 +211,7 @@ static struct ng_video_buf* dv_vdata(void *handle, unsigned int drop)
buf = ng_malloc_video_buf(&h->vfmt,h->vfmt.bytesperline*h->vfmt.height);
switch (h->vfmt.fmtid) {
- case VIDEO_YUV422:
+ case VIDEO_YUYV:
pixels[0] = buf->data;
pitches[0] = buf->fmt.width*2;
break;
diff --git a/libng/plugins/read-qt.c b/libng/plugins/read-qt.c
index c3d5981..b114823 100644
--- a/libng/plugins/read-qt.c
+++ b/libng/plugins/read-qt.c
@@ -17,7 +17,7 @@
static int fmtid_to_cmodel[VIDEO_FMT_COUNT] = {
[ VIDEO_RGB24 ] = BC_RGB888,
[ VIDEO_BGR24 ] = BC_BGR888,
- [ VIDEO_YUV422 ] = BC_YUV422,
+ [ VIDEO_YUYV ] = BC_YUV422,
[ VIDEO_YUV420P ] = BC_YUV420P,
};
diff --git a/libng/plugins/write-dv.c b/libng/plugins/write-dv.c
index a40e219..2d8611b 100644
--- a/libng/plugins/write-dv.c
+++ b/libng/plugins/write-dv.c
@@ -146,7 +146,7 @@ dv_video(void *handle, struct ng_video_buf *buf)
frame = dv_get_frame(h,h->fvideo);
pixels[0] = buf->data;
switch (buf->fmt.fmtid) {
- case VIDEO_YUV422:
+ case VIDEO_YUYV:
dv_encode_full_frame(h->enc,pixels,e_dv_color_yuv,frame->obuf);
break;
case VIDEO_RGB24:
@@ -191,7 +191,7 @@ static const struct ng_format_list dv_vformats[] = {
name: "dv",
ext: "dv",
desc: "digital video",
- fmtid: VIDEO_YUV422,
+ fmtid: VIDEO_YUYV,
},{
/* EOF */
}
diff --git a/libng/plugins/write-qt.c b/libng/plugins/write-qt.c
index 6600b48..b2113ad 100644
--- a/libng/plugins/write-qt.c
+++ b/libng/plugins/write-qt.c
@@ -187,7 +187,7 @@ qt_close(void *handle)
static int cmodels[] = {
[BC_BGR888] = VIDEO_BGR24,
[BC_RGB888] = VIDEO_RGB24,
- [BC_YUV422] = VIDEO_YUV422,
+ [BC_YUV422] = VIDEO_YUYV,
[BC_YUV422P] = VIDEO_YUV422P,
[BC_YUV420P] = VIDEO_YUV420P,
};
@@ -219,7 +219,7 @@ static const struct ng_format_list qt_vformats[] = {
},{
name: "yuv2",
ext: "mov",
- fmtid: VIDEO_YUV422,
+ fmtid: VIDEO_YUYV,
priv: &qt_yuv2,
},{
name: "yv12",
diff --git a/libng/writefile.c b/libng/writefile.c
index 4570d26..92516e9 100644
--- a/libng/writefile.c
+++ b/libng/writefile.c
@@ -580,7 +580,7 @@ static const struct ng_format_list raw_vformats[] = {
},{
name: "422",
ext: "raw",
- fmtid: VIDEO_YUV422,
+ fmtid: VIDEO_YUYV,
},{
name: "422p",
ext: "raw",
diff --git a/structs/struct-dump.c b/structs/struct-dump.c
index 5650812..0ee7fc8 100644
--- a/structs/struct-dump.c
+++ b/structs/struct-dump.c
@@ -43,7 +43,7 @@ int print_struct(FILE *fp, struct struct_desc *desc, void *data,
int16_t s16;
uint8_t u8;
int8_t s8;
- int al = sizeof(long)-1; /* struct + union alignment */
+ int al = sizeof(long)-1; /* struct + union + 64bit alignment */
void *p;
unsigned int i,j,first;
@@ -149,6 +149,7 @@ int print_struct(FILE *fp, struct struct_desc *desc, void *data,
ptr += 4;
break;
case BITS64:
+ ptr = (void*)(((intptr_t)ptr + al) & ~al);
u64 = *((uint64_t*)ptr);
first = 1;
fprintf(fp,"0x%" PRIx64 " [",u64);
@@ -165,11 +166,13 @@ int print_struct(FILE *fp, struct struct_desc *desc, void *data,
break;
case UINT64:
+ ptr = (void*)(((intptr_t)ptr + al) & ~al);
u64 = *((uint64_t*)ptr);
fprintf(fp,"%" PRIu64,u64);
ptr += 8;
break;
case SINT64:
+ ptr = (void*)(((intptr_t)ptr + al) & ~al);
s64 = *((int64_t*)ptr);
fprintf(fp,"%" PRId64,s64);
ptr += 8;
diff --git a/todo/tmohan/webcam.c.orig b/todo/tmohan/webcam.c.orig
deleted file mode 100644
index c80caab..0000000
--- a/todo/tmohan/webcam.c.orig
+++ /dev/null
@@ -1,993 +0,0 @@
-/*
- * (c) 1998-2002 Gerd Knorr
- *
- * capture a image, compress as jpeg and upload to the webserver
- * using the ftp utility or ssh
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <limits.h>
-#include <pthread.h>
-#include <math.h>
-#include <sys/time.h>
-#include <sys/mman.h>
-#include <sys/ioctl.h>
-#include <sys/stat.h>
-
-#include "grab-ng.h"
-#include "jpeglib.h"
-#include "ftp.h"
-#include "parseconfig.h"
-#include "list.h"
-
-
-/* ---------------------------------------------------------------------- */
-/* configuration */
-
-int daemonize = 0;
-char *archive = NULL;
-char *tmpdir;
-struct list_head connections;
-
-char *grab_text = "webcam %Y-%m-%d %H:%M:%S"; /* strftime */
-char *grab_infofile = NULL;
-int grab_width = 320;
-int grab_height = 240;
-int grab_delay = 3;
-int grab_wait = 0;
-int grab_rotate = 0;
-int grab_top = 0;
-int grab_left = 0;
-int grab_bottom = -1;
-int grab_right = -1;
-int grab_quality = 75;
-int grab_trigger = 0;
-int grab_times = -1;
-int grab_fg_r = 255;
-int grab_fg_g = 255;
-int grab_fg_b = 255;
-int grab_bg_r = -1;
-int grab_bg_g = -1;
-int grab_bg_b = -1;
-char *grab_input = NULL;
-char *grab_norm = NULL;
-
-/* ---------------------------------------------------------------------- */
-/* jpeg stuff */
-
-static int
-write_file (int fd, char *data, int width, int height)
-{
- struct jpeg_compress_struct cinfo;
- struct jpeg_error_mgr jerr;
- FILE *fp;
- int i;
- unsigned char *line;
-
- fp = fdopen (fd, "w");
- cinfo.err = jpeg_std_error (&jerr);
- jpeg_create_compress (&cinfo);
- jpeg_stdio_dest (&cinfo, fp);
- cinfo.image_width = width;
- cinfo.image_height = height;
- cinfo.input_components = 3;
- cinfo.in_color_space = JCS_RGB;
- jpeg_set_defaults (&cinfo);
- jpeg_set_quality (&cinfo, grab_quality, TRUE);
- jpeg_start_compress (&cinfo, TRUE);
-
- for (i = 0, line = data; i < height; i++, line += width * 3)
- jpeg_write_scanlines (&cinfo, &line, 1);
-
- jpeg_finish_compress (&(cinfo));
- jpeg_destroy_compress (&(cinfo));
- fclose (fp);
-
- return 0;
-}
-
-/* ---------------------------------------------------------------------- */
-/* image transfer */
-
-struct xfer_ops;
-
-struct xfer_state
-{
- char *name;
- struct list_head list;
-
- /* xfer options */
- char *host;
- char *user;
- char *pass;
- char *dir;
- char *file;
- char *tmpfile;
- int debug;
-
- /* ftp options */
- int passive, autologin;
-
- /* function pointers + private date */
- struct xfer_ops *ops;
- void *data;
-};
-
-struct xfer_ops
-{
- int (*open) (struct xfer_state *);
- void (*info) (struct xfer_state *);
- int (*xfer) (struct xfer_state *, char *image, int width, int height);
- void (*close) (struct xfer_state *);
-};
-
-static int
-ftp_open (struct xfer_state *s)
-{
- s->data = ftp_init (s->name, s->autologin, s->passive, s->debug);
- ftp_connect (s->data, s->host, s->user, s->pass, s->dir);
- return 0;
-}
-
-static void
-ftp_info (struct xfer_state *s)
-{
- fprintf (stderr, "ftp config [%s]:\n %s@%s:%s\n %s => %s\n",
- s->name, s->user, s->host, s->dir, s->tmpfile, s->file);
-}
-
-static int
-ftp_xfer (struct xfer_state *s, char *image, int width, int height)
-{
- char filename[1024];
- int fh;
-
- sprintf (filename, "%s/webcamXXXXXX", tmpdir);
- if (-1 == (fh = mkstemp (filename)))
- {
- perror ("mkstemp");
- exit (1);
- }
- write_file (fh, image, width, height);
- if (ftp_connected (s->data))
- ftp_connect (s->data, s->host, s->user, s->pass, s->dir);
- ftp_upload (s->data, filename, s->file, s->tmpfile);
- unlink (filename);
- return 0;
-}
-
-static void
-ftp_close (struct xfer_state *s)
-{
- ftp_fini (s->data);
-}
-
-static struct xfer_ops ftp_ops = {
- open:ftp_open,
- info:ftp_info,
- xfer:ftp_xfer,
- close:ftp_close,
-};
-
-static int
-ssh_open (struct xfer_state *s)
-{
- s->data =
- malloc (strlen (s->user) + strlen (s->host) + strlen (s->tmpfile) * 2 +
- strlen (s->dir) + strlen (s->file) + 32);
- sprintf (s->data, "ssh %s@%s \"cat >%s && mv %s %s/%s\"", s->user, s->host,
- s->tmpfile, s->tmpfile, s->dir, s->file);
- return 0;
-}
-
-static void
-ssh_info (struct xfer_state *s)
-{
- fprintf (stderr, "ssh config [%s]:\n %s@%s:%s\n %s => %s\n",
- s->name, s->user, s->host, s->dir, s->tmpfile, s->file);
-}
-
-static int
-ssh_xfer (struct xfer_state *s, char *image, int width, int height)
-{
- char filename[1024];
- char *cmd = s->data;
- unsigned char buf[4096];
- FILE *sshp, *imgdata;
- int len, fh;
-
- sprintf (filename, "%s/webcamXXXXXX", tmpdir);
- if (-1 == (fh = mkstemp (filename)))
- {
- perror ("mkstemp");
- exit (1);
- }
- write_file (fh, image, width, height);
-
- if ((sshp = popen (cmd, "w")) == NULL)
- {
- perror ("popen");
- exit (1);
- }
- if ((imgdata = fopen (filename, "rb")) == NULL)
- {
- perror ("fopen");
- exit (1);
- }
- for (;;)
- {
- len = fread (buf, 1, sizeof (buf), imgdata);
- if (len <= 0)
- break;
- fwrite (buf, 1, len, sshp);
- }
- fclose (imgdata);
- pclose (sshp);
-
- unlink (filename);
- return 0;
-}
-
-static void
-ssh_close (struct xfer_state *s)
-{
- char *cmd = s->data;
- free (cmd);
-}
-
-static struct xfer_ops ssh_ops = {
- open:ssh_open,
- info:ssh_info,
- xfer:ssh_xfer,
- close:ssh_close,
-};
-
-static int
-local_open (struct xfer_state *s)
-{
- char *t;
-
- if (s->dir != NULL && s->dir[0] != '\0')
- {
- t = malloc (strlen (s->tmpfile) + strlen (s->dir) + 2);
- sprintf (t, "%s/%s", s->dir, s->tmpfile);
- s->tmpfile = t;
-
- t = malloc (strlen (s->file) + strlen (s->dir) + 2);
- sprintf (t, "%s/%s", s->dir, s->file);
- s->file = t;
- }
- return 0;
-}
-
-static void
-local_info (struct xfer_state *s)
-{
- fprintf (stderr, "write config [%s]:\n local transfer %s => %s\n",
- s->name, s->tmpfile, s->file);
-}
-
-static int
-local_xfer (struct xfer_state *s, char *image, int width, int height)
-{
- int fh;
-
- if (-1 == (fh = open (s->tmpfile, O_CREAT | O_WRONLY | O_TRUNC, 0666)))
- {
- fprintf (stderr, "open %s: %s\n", s->tmpfile, strerror (errno));
- exit (1);
- }
- write_file (fh, image, width, height);
- if (rename (s->tmpfile, s->file))
- {
- fprintf (stderr, "can't move %s -> %s\n", s->tmpfile, s->file);
- exit (1);
- }
- return 0;
-}
-
-static void
-local_close (struct xfer_state *s)
-{
- /* nothing */
-}
-
-static struct xfer_ops local_ops = {
- open:local_open,
- info:local_info,
- xfer:local_xfer,
- close:local_close,
-};
-
-/* ---------------------------------------------------------------------- */
-/* capture stuff */
-
-const struct ng_vid_driver *drv;
-void *h_drv;
-struct ng_video_fmt fmt, gfmt;
-struct ng_video_conv *conv;
-void *hconv;
-
-static void
-grab_init (void)
-{
- struct ng_attribute *attr;
- int val, i;
-
- drv = ng_vid_open (ng_dev.video, NULL, NULL, 0, &h_drv);
- if (NULL == drv)
- {
- fprintf (stderr, "no grabber device available\n");
- exit (1);
- }
- if (!(drv->capabilities (h_drv) & CAN_CAPTURE))
- {
- fprintf (stderr, "device does'nt support capture\n");
- exit (1);
- }
-
- if (grab_input)
- {
- attr = ng_attr_byid (drv->list_attrs (h_drv), ATTR_ID_INPUT);
- val = ng_attr_getint (attr, grab_input);
- if (-1 == val)
- {
- fprintf (stderr, "invalid input: %s\n", grab_input);
- exit (1);
- }
- attr->write (attr, val);
- }
- if (grab_norm)
- {
- attr = ng_attr_byid (drv->list_attrs (h_drv), ATTR_ID_NORM);
- val = ng_attr_getint (attr, grab_norm);
- if (-1 == val)
- {
- fprintf (stderr, "invalid norm: %s\n", grab_norm);
- exit (1);
- }
- attr->write (attr, val);
- }
-
- /* try native */
- fmt.fmtid = VIDEO_RGB24;
- fmt.width = grab_width;
- fmt.height = grab_height;
- if (0 == drv->setformat (h_drv, &fmt))
- return;
-
- /* check all available conversion functions */
- fmt.bytesperline = fmt.width * ng_vfmt_to_depth[fmt.fmtid] / 8;
- for (i = 0;;)
- {
- conv = ng_conv_find_to (fmt.fmtid, &i);
- if (NULL == conv)
- break;
- gfmt = fmt;
- gfmt.fmtid = conv->fmtid_in;
- gfmt.bytesperline = 0;
- if (0 == drv->setformat (h_drv, &gfmt))
- {
- fmt.width = gfmt.width;
- fmt.height = gfmt.height;
- hconv = conv->init (&fmt, conv->priv);
- return;
- }
- }
- fprintf (stderr, "can't get rgb24 data\n");
- exit (1);
-}
-
-static unsigned char *
-grab_one (int *width, int *height)
-{
- static struct ng_video_buf *cap, *buf;
-
- if (NULL != buf)
- ng_release_video_buf (buf);
- if (NULL == (cap = drv->getimage (h_drv)))
- {
- fprintf (stderr, "capturing image failed\n");
- exit (1);
- }
-
- if (NULL != conv)
- {
- buf = ng_malloc_video_buf (&fmt, 3 * fmt.width * fmt.height);
- conv->frame (hconv, buf, cap);
- buf->info = cap->info;
- ng_release_video_buf (cap);
- }
- else
- {
- buf = cap;
- }
-
- *width = buf->fmt.width;
- *height = buf->fmt.height;
- return buf->data;
-}
-
-/* ---------------------------------------------------------------------- */
-
-#define MSG_MAXLEN 256
-
-#define CHAR_HEIGHT 11
-#define CHAR_WIDTH 6
-#define CHAR_START 4
-#include "font-6x11.h"
-
-static char *
-get_message (void)
-{
- static char buffer[MSG_MAXLEN + 1];
- FILE *fp;
- char *p;
-
- if (NULL == grab_infofile)
- return grab_text;
-
- if (NULL == (fp = fopen (grab_infofile, "r")))
- {
- fprintf (stderr, "open %s: %s\n", grab_infofile, strerror (errno));
- return grab_text;
- }
-
- fgets (buffer, MSG_MAXLEN, fp);
- fclose (fp);
- if (NULL != (p = strchr (buffer, '\n')))
- *p = '\0';
- return buffer;
-}
-
-static void
-add_text (char *image, int width, int height)
-{
- time_t t;
- struct tm *tm;
- char line[MSG_MAXLEN + 1], *ptr;
- int i, x, y, f, len;
-
- time (&t);
- tm = localtime (&t);
- len = strftime (line, MSG_MAXLEN, get_message (), tm);
- fprintf (stderr, "%s\n", line);
-
- for (y = 0; y < CHAR_HEIGHT; y++)
- {
- ptr = image + 3 * width * (height - CHAR_HEIGHT - 2 + y) + 12;
- for (x = 0; x < len; x++)
- {
- f = fontdata[line[x] * CHAR_HEIGHT + y];
- for (i = CHAR_WIDTH - 1; i >= 0; i--)
- {
- if (f & (CHAR_START << i))
- {
- ptr[0] = grab_fg_r;
- ptr[1] = grab_fg_g;
- ptr[2] = grab_fg_b;
- }
- else if (grab_bg_r != -1)
- {
- ptr[0] = grab_bg_r;
- ptr[1] = grab_bg_g;
- ptr[2] = grab_bg_b;
- }
- ptr += 3;
- }
- }
- }
-}
-
-/* ---------------------------------------------------------------------- */
-/* Frederic Helin <Frederic.Helin@inrialpes.fr> - 15/07/2002 */
-/* Correction fonction of stereographic radial distortion */
-
-int grab_dist_on = 0;
-int grab_dist_k = 700;
-int grab_dist_cx = -1;
-int grab_dist_cy = -1;
-int grab_dist_zoom = 50;
-int grab_dist_sensorw = 640;
-int grab_dist_sensorh = 480;
-
-static unsigned char *
-correct_distor (unsigned char *in, int width, int height,
- int grab_zoom, int grap_k, int cx, int cy,
- int grab_sensorw, int grab_sensorh)
-{
- static unsigned char *corrimg = NULL;
-
- int i, j, di, dj;
- float dr, cr, ca, sensor_w, sensor_h, sx, zoom, k;
-
- sensor_w = grab_dist_sensorw / 100.0;
- sensor_h = grab_dist_sensorh / 100.0;
- zoom = grab_zoom / 100.0;
- k = grap_k / 100.0;
-
- if (corrimg == NULL && (corrimg = malloc (width * height * 3)) == NULL)
- {
- fprintf (stderr, "out of memory\n");
- exit (1);
- }
-
- sensor_w = 6.4;
- sensor_h = 4.8;
-
- // calc ratio x/y
- sx = width * sensor_h / (height * sensor_w);
-
- // calc new value of k in the coordonates systeme of computer
- k = k * height / sensor_h;
-
- // Clear image
- for (i = 0; i < height * width * 3; i++)
- corrimg[i] = 255;
-
- for (j = 0; j < height; j++)
- {
- for (i = 0; i < width; i++)
- {
-
- // compute radial distortion / parameters of center of image
- cr = sqrt ((i - cx) / sx * (i - cx) / sx + (j - cy) * (j - cy));
- ca = atan (cr / k / zoom);
- dr = k * tan (ca / 2);
-
- if (i == cx && j == cy)
- {
- di = cx;
- dj = cy;
- }
- else
- {
- di = (i - cx) * dr / cr + cx;
- dj = (j - cy) * dr / cr + cy;
- }
-
- if (dj < height && di < width && di >= 0 && dj >= 0 &&
- j < height && i < width && i >= 0 && j >= 0)
- {
- corrimg[3 * (j * width + i)] = in[3 * (dj * width + di)];
- corrimg[3 * (j * width + i) + 1] = in[3 * (dj * width + di) + 1];
- corrimg[3 * (j * width + i) + 2] = in[3 * (dj * width + di) + 2];
- }
- }
- }
- return corrimg;
-}
-
-/* ---------------------------------------------------------------------- */
-
-static unsigned int
-compare_images (unsigned char *last, unsigned char *current,
- int width, int height)
-{
- unsigned char *p1 = last;
- unsigned char *p2 = current;
- int avg, diff, max, i = width * height * 3;
-
- for (max = 0, avg = 0; --i; p1++, p2++)
- {
- diff = (*p1 < *p2) ? (*p2 - *p1) : (*p1 - *p2);
- avg += diff;
- if (diff > max)
- max = diff;
- }
- avg = avg / width / height;
- fprintf (stderr, "compare: max=%d,avg=%d\n", max, avg);
- /* return avg */
- return max;
-}
-
-
-static unsigned char *
-rotate_image (unsigned char *in, int *wp, int *hp, int rot,
- int top, int left, int bottom, int right)
-{
- static unsigned char *rotimg = NULL;
-
- int i, j;
-
- int w = *wp;
- int ow = (right - left);
- int oh = (bottom - top);
-
- if (rotimg == NULL && (rotimg = malloc (ow * oh * 3)) == NULL)
- {
- fprintf (stderr, "out of memory\n");
- exit (1);
- }
- switch (rot)
- {
- default:
- case 0:
- for (j = 0; j < oh; j++)
- {
- int ir = (j + top) * w + left;
- int or = j * ow;
- for (i = 0; i < ow; i++)
- {
- rotimg[3 * (or + i)] = in[3 * (ir + i)];
- rotimg[3 * (or + i) + 1] = in[3 * (ir + i) + 1];
- rotimg[3 * (or + i) + 2] = in[3 * (ir + i) + 2];
- }
- }
- *wp = ow;
- *hp = oh;
- break;
- case 1:
- for (i = 0; i < ow; i++)
- {
- int rr = (ow - 1 - i) * oh;
- int ic = i + left;
- for (j = 0; j < oh; j++)
- {
- rotimg[3 * (rr + j)] = in[3 * ((j + top) * w + ic)];
- rotimg[3 * (rr + j) + 1] = in[3 * ((j + top) * w + ic) + 1];
- rotimg[3 * (rr + j) + 2] = in[3 * ((j + top) * w + ic) + 2];
- }
- }
- *wp = oh;
- *hp = ow;
- break;
- case 2:
- for (j = 0; j < oh; j++)
- {
- int ir = (j + top) * w;
- for (i = 0; i < ow; i++)
- {
- rotimg[3 * ((oh - 1 - j) * ow + (ow - 1 - i))] =
- in[3 * (ir + i + left)];
- rotimg[3 * ((oh - 1 - j) * ow + (ow - 1 - i)) + 1] =
- in[3 * (ir + i + left) + 1];
- rotimg[3 * ((oh - 1 - j) * ow + (ow - 1 - i)) + 2] =
- in[3 * (ir + i + left) + 2];
- }
- }
- *wp = ow;
- *hp = oh;
- break;
- case 3:
- for (i = 0; i < ow; i++)
- {
- int rr = i * oh;
- int ic = i + left;
- rr += oh - 1;
- for (j = 0; j < oh; j++)
- {
- rotimg[3 * (rr - j)] = in[3 * ((j + top) * w + ic)];
- rotimg[3 * (rr - j) + 1] = in[3 * ((j + top) * w + ic) + 1];
- rotimg[3 * (rr - j) + 2] = in[3 * ((j + top) * w + ic) + 2];
- }
- }
- *wp = oh;
- *hp = ow;
- break;
- }
- return rotimg;
-}
-
-
-/* ---------------------------------------------------------------------- */
-
-static int
-make_dirs (char *filename)
-{
- char *dirname, *h;
- int retval = -1;
-
- dirname = strdup (filename);
- if (NULL == dirname)
- goto done;
- h = strrchr (dirname, '/');
- if (NULL == h)
- goto done;
- *h = 0;
-
- if (-1 == (retval = mkdir (dirname, 0777)))
- if (ENOENT == errno)
- if (0 == make_dirs (dirname))
- retval = mkdir (dirname, 0777);
-
-done:
- free (dirname);
- return retval;
-}
-
-int
-main (int argc, char *argv[])
-{
- unsigned char *image, *val, *gimg, *lastimg = NULL;
- int width, height, i, fh;
- char filename[1024];
- char **sections;
- struct list_head *item;
- struct xfer_state *s;
-
- /* read config */
- if (argc > 1)
- {
- strcpy (filename, argv[1]);
- }
- else
- {
- sprintf (filename, "%s/%s", getenv ("HOME"), ".webcamrc");
- }
- fprintf (stderr, "reading config file: %s\n", filename);
- cfg_parse_file (filename);
- ng_init ();
-
- if (NULL != (val = cfg_get_str ("grab", "device")))
- ng_dev.video = val;
- if (NULL != (val = cfg_get_str ("grab", "text")))
- grab_text = val;
- if (NULL != (val = cfg_get_str ("grab", "infofile")))
- grab_infofile = val;
- if (NULL != (val = cfg_get_str ("grab", "input")))
- grab_input = val;
- if (NULL != (val = cfg_get_str ("grab", "norm")))
- grab_norm = val;
- if (-1 != (i = cfg_get_int ("grab", "width")))
- grab_width = i;
- if (-1 != (i = cfg_get_int ("grab", "height")))
- grab_height = i;
- if (-1 != (i = cfg_get_int ("grab", "delay")))
- grab_delay = i;
- if (-1 != (i = cfg_get_int ("grab", "wait")))
- grab_wait = i;
- if (-1 != (i = cfg_get_int ("grab", "rotate")))
- grab_rotate = i;
- if (-1 != (i = cfg_get_int ("grab", "top")))
- grab_top = i;
- if (-1 != (i = cfg_get_int ("grab", "left")))
- grab_left = i;
- grab_bottom = cfg_get_int ("grab", "bottom");
- grab_right = cfg_get_int ("grab", "right");
- if (-1 != (i = cfg_get_int ("grab", "quality")))
- grab_quality = i;
- if (-1 != (i = cfg_get_int ("grab", "trigger")))
- grab_trigger = i;
- if (-1 != (i = cfg_get_int ("grab", "once")))
- grab_times = 1;
- if (-1 != (i = cfg_get_int ("grab", "times")))
- grab_times = i;
- if (NULL != (val = cfg_get_str ("grab", "archive")))
- archive = val;
-
- if (-1 != (i = cfg_get_int ("grab", "fg_red")))
- if (i >= 0 && i <= 255)
- grab_fg_r = i;
- if (-1 != (i = cfg_get_int ("grab", "fg_green")))
- if (i >= 0 && i <= 255)
- grab_fg_g = i;
- if (-1 != (i = cfg_get_int ("grab", "fg_blue")))
- if (i >= 0 && i <= 255)
- grab_fg_b = i;
- if (-1 != (i = cfg_get_int ("grab", "bg_red")))
- if (i >= 0 && i <= 255)
- grab_bg_r = i;
- if (-1 != (i = cfg_get_int ("grab", "bg_green")))
- if (i >= 0 && i <= 255)
- grab_bg_g = i;
- if (-1 != (i = cfg_get_int ("grab", "bg_blue")))
- if (i >= 0 && i <= 255)
- grab_bg_b = i;
-
- if (-1 != (i = cfg_get_int ("grab", "distor")))
- grab_dist_on = i;
- if (-1 != (i = cfg_get_int ("grab", "distor_k")))
- grab_dist_k = i;
- if (-1 != (i = cfg_get_int ("grab", "distor_cx")))
- grab_dist_cx = i;
- if (-1 != (i = cfg_get_int ("grab", "distor_cy")))
- grab_dist_cy = i;
- if (-1 != (i = cfg_get_int ("grab", "distor_zoom")))
- grab_dist_zoom = i;
- if (-1 != (i = cfg_get_int ("grab", "distor_sensorw")))
- grab_dist_sensorw = i;
- if (-1 != (i = cfg_get_int ("grab", "distor_sensorh")))
- grab_dist_sensorh = i;
-
- if (grab_top < 0)
- grab_top = 0;
- if (grab_left < 0)
- grab_left = 0;
- if (grab_bottom > grab_height)
- grab_bottom = grab_height;
- if (grab_right > grab_width)
- grab_right = grab_width;
- if (grab_bottom < 0)
- grab_bottom = grab_height;
- if (grab_right < 0)
- grab_right = grab_width;
- if (grab_top >= grab_bottom)
- grab_top = 0;
- if (grab_left >= grab_right)
- grab_left = 0;
-
- if (grab_dist_k < 1 || grab_dist_k > 10000)
- grab_dist_k = 700;
- if (grab_dist_cx < 0 || grab_dist_cx > grab_width)
- grab_dist_cx = grab_width / 2;
- if (grab_dist_cy < 0 || grab_dist_cy > grab_height)
- grab_dist_cy = grab_height / 2;
- if (grab_dist_zoom < 1 || grab_dist_zoom > 1000)
- grab_dist_zoom = 100;
- if (grab_dist_sensorw < 1 || grab_dist_sensorw > 9999)
- grab_dist_sensorw = 640;
- if (grab_dist_sensorh < 1 || grab_dist_sensorh > 9999)
- grab_dist_sensorh = 480;
-
- INIT_LIST_HEAD (&connections);
- for (sections = cfg_list_sections (); *sections != NULL; sections++)
- {
- if (0 == strcasecmp (*sections, "grab"))
- continue;
-
- /* init + set defaults */
- s = malloc (sizeof (*s));
- memset (s, 0, sizeof (*s));
- s->name = *sections;
- s->host = "www";
- s->user = "webcam";
- s->pass = "xxxxxx";
- s->dir = "public_html/images";
- s->file = "webcam.jpeg";
- s->tmpfile = "uploading.jpeg";
- s->passive = 1;
- s->autologin = 0;
- s->ops = &ftp_ops;
-
- /* from config */
- if (NULL != (val = cfg_get_str (*sections, "host")))
- s->host = val;
- if (NULL != (val = cfg_get_str (*sections, "user")))
- s->user = val;
- if (NULL != (val = cfg_get_str (*sections, "pass")))
- s->pass = val;
- if (NULL != (val = cfg_get_str (*sections, "dir")))
- s->dir = val;
- if (NULL != (val = cfg_get_str (*sections, "file")))
- s->file = val;
- if (NULL != (val = cfg_get_str (*sections, "tmp")))
- s->tmpfile = val;
- if (-1 != (i = cfg_get_int (*sections, "passive")))
- s->passive = i;
- if (-1 != (i = cfg_get_int (*sections, "auto")))
- s->autologin = i;
- if (-1 != (i = cfg_get_int (*sections, "debug")))
- s->debug = i;
- if (-1 != (i = cfg_get_int (*sections, "local")))
- if (i)
- s->ops = &local_ops;
- if (-1 != (i = cfg_get_int (*sections, "ssh")))
- if (i)
- s->ops = &ssh_ops;
-
- /* all done */
- list_add_tail (&s->list, &connections);
- }
-
- /* init everything */
- grab_init ();
- sleep (grab_wait);
- tmpdir = (NULL != getenv ("TMPDIR")) ? getenv ("TMPDIR") : "/tmp";
- list_for_each (item, &connections)
- {
- s = list_entry (item, struct xfer_state, list);
- s->ops->open (s);
- }
-
- /* print config */
- fprintf (stderr, "video4linux webcam v1.5 - (c) 1998-2002 Gerd Knorr\n");
- fprintf (stderr, "grabber config:\n size %dx%d [%s]\n",
- fmt.width, fmt.height, ng_vfmt_to_desc[gfmt.fmtid]);
- fprintf (stderr, " input %s, norm %s, jpeg quality %d\n",
- grab_input, grab_norm, grab_quality);
- fprintf (stderr, " rotate=%d, top=%d, left=%d, bottom=%d, right=%d\n",
- grab_rotate, grab_top, grab_left, grab_bottom, grab_right);
- list_for_each (item, &connections)
- {
- s = list_entry (item, struct xfer_state, list);
- s->ops->info (s);
- }
-
- /* run as daemon - detach from terminal */
- if (daemonize)
- {
- switch (fork ())
- {
- case -1:
- perror ("fork");
- exit (1);
- case 0:
- close (0);
- close (1);
- close (2);
- setsid ();
- break;
- default:
- exit (0);
- }
- }
-
- /* main loop */
- for (;;)
- {
- /* grab a new one */
- gimg = grab_one (&width, &height);
-
- if (grab_dist_on)
- gimg = correct_distor (gimg, width, height,
- grab_dist_zoom, grab_dist_k,
- grab_dist_cx, grab_dist_cy,
- grab_dist_sensorw, grab_dist_sensorh);
-
- image = rotate_image (gimg, &width, &height, grab_rotate,
- grab_top, grab_left, grab_bottom, grab_right);
-
- if (grab_trigger)
- {
- /* look if it has changed */
- if (NULL != lastimg)
- {
- i = compare_images (lastimg, image, width, height);
- if (i < grab_trigger)
- continue;
- }
- else
- {
- lastimg = malloc (width * height * 3);
- }
- memcpy (lastimg, image, width * height * 3);
- }
-
- /* ok, label it and upload */
- add_text (image, width, height);
- list_for_each (item, &connections)
- {
- s = list_entry (item, struct xfer_state, list);
- s->ops->xfer (s, image, width, height);
- }
- if (archive)
- {
- time_t t;
- struct tm *tm;
-
- time (&t);
- tm = localtime (&t);
- strftime (filename, sizeof (filename) - 1, archive, tm);
- again:
- if (-1 == (fh = open (filename, O_CREAT | O_WRONLY | O_TRUNC, 0666)))
- {
- if (ENOENT == errno)
- {
- if (0 == make_dirs (filename))
- goto again;
- }
- fprintf (stderr, "open %s: %s\n", filename, strerror (errno));
- exit (1);
- }
- write_file (fh, image, width, height);
- }
-
- if (-1 != grab_times && --grab_times == 0)
- break;
- if (grab_delay > 0)
- sleep (grab_delay);
- }
- list_for_each (item, &connections)
- {
- s = list_entry (item, struct xfer_state, list);
- s->ops->close (s);
- }
- return 0;
-}
diff --git a/x11/MoTV-fixed b/x11/MoTV-fixed
index 36742e4..afd0149 100644
--- a/x11/MoTV-fixed
+++ b/x11/MoTV-fixed
@@ -1,32 +1,33 @@
+
! ----------------------------------------------------------------------------
! fonts
*renderTable:
*renderTable.fontType: FONT_IS_FONTSET
*renderTable.fontName: \
- -adobe-helvetica-medium-r-normal-*-14-*-*-*-p-*-iso8859-*, \
- -cronyx-helvetica-medium-r-normal-*-14-*-*-*-p-*-koi8-r, \
- -*-lucida-medium-r-normal-*-14-*-*-*-p-*-iso8859-*, \
- -gnu-unifont-medium-r-normal--16-*-*-*-p-*-*-*, \
- -efont-biwidth-medium-r-normal--16-*-*-*-*-*-*-*, \
- -*-*-medium-r-normal-*-14-*-*-*-p-*-*-*, \
- -*-*-medium-r-normal-*-16-*-*-*-p-*-*-*, \
- -*-*-*-*-*-*-14-*-*-*-*-*-*-*, \
- -*-*-*-*-*-*-16-*-*-*-*-*-*-*, \
- *
+ -adobe-helvetica-medium-r-normal-*-14-*-*-*-p-*-iso8859-*, \
+ -cronyx-helvetica-medium-r-normal-*-14-*-*-*-p-*-koi8-r, \
+ -*-lucida-medium-r-normal-*-14-*-*-*-p-*-iso8859-*, \
+ -gnu-unifont-medium-r-normal--16-*-*-*-p-*-*-*, \
+ -efont-biwidth-medium-r-normal--16-*-*-*-*-*-*-*, \
+ -*-*-medium-r-normal-*-14-*-*-*-p-*-*-*, \
+ -*-*-medium-r-normal-*-16-*-*-*-p-*-*-*, \
+ -*-*-*-*-*-*-14-*-*-*-*-*-*-*, \
+ -*-*-*-*-*-*-16-*-*-*-*-*-*-*,*
MoTV.onscreen.label.renderTable:
MoTV.onscreen.label.renderTable.fontType: FONT_IS_FONTSET
MoTV.onscreen.label.renderTable.fontName: \
- -*-ledfixed-medium-r-semicondensed--39-*-*-*-*-*, \
- -*-fixed-medium-r-normal--20-*-*-*-*-*-*, \
- *
+ -*-ledfixed-medium-r-semicondensed--39-*-*-*-c-*-*-*, \
+ -*-bitstream vera sans-medium-r-normal--39-*-*-*-*-*-*-*, \
+ -*-luxi sans-medium-r-normal--39-*-*-*-*-*-*-*, \
+ -*-*-r-normal--39-*-*-*-*-*-*-*, \
+ -*-*-*-*--39-*-*-*-*-*-*-*,*
MoTV.vtx.label.renderTable:
MoTV.vtx.label.renderTable.fontType: FONT_IS_FONTSET
MoTV.vtx.label.renderTable.fontName: \
- -*-fixed-medium-r-normal--20-*-*-*-*-*-*, \
- *
+ -*-fixed-medium-r-normal--20-*-*-*-*-*-*, *
! ----------------------------------------------------------------------------
diff --git a/x11/Subdir.mk b/x11/Subdir.mk
index b20aeb8..ea2e8b5 100644
--- a/x11/Subdir.mk
+++ b/x11/Subdir.mk
@@ -98,7 +98,7 @@ x11/motv : LDLIBS += \
$(MOTIF_LIBS) $(VBI_LIBS) $(GL_LIBS) -ljpeg -lm
x11/mtt : LDLIBS += $(THREAD_LIBS) $(MOTIF_LIBS) $(VBI_LIBS)
x11/v4lctl : LDLIBS += $(THREAD_LIBS) $(ATHENA_LIBS) -ljpeg -lm
-x11/pia : LDLIBS += $(ATHENA_LIBS) $(GL_LIBS) $(QT_LIBS) -ljpeg -lm
+x11/pia : LDLIBS += $(ATHENA_LIBS) $(GL_LIBS) -ljpeg -lm
x11/rootv : LDLIBS += $(ATHENA_LIBS)
x11/xawtv-remote : LDLIBS += $(ATHENA_LIBS)
x11/propwatch : LDLIBS += $(ATHENA_LIBS)
diff --git a/x11/Xawtv.ad b/x11/Xawtv.ad
index 3c6538e..cdcb3f0 100644
--- a/x11/Xawtv.ad
+++ b/x11/Xawtv.ad
@@ -4,11 +4,25 @@
Xawtv*international: true
Xawtv*font: 7x13bold
-Xawtv*fontSet: -*-lucidatypewriter-bold-r-normal-*-14-*-*-*-m-*-iso8859-*,-*-courier-bold-r-normal-*-14-*-*-*-m-*-iso8859-*,-gnu-unifont-bold-r-normal--16-*-*-*-c-*-*-*,-efont-biwidth-bold-r-normal--16-*-*-*-*-*-*-*,-*-*-bold-r-normal-*-16-*-*-*-m-*-*-*,-*-*-bold-r-normal-*-16-*-*-*-c-*-*-*,-*-*-*-*-*-*-16-*-*-*-*-*-*-*,*
+Xawtv*fontSet: \
+ -*-lucidatypewriter-bold-r-normal-*-14-*-*-*-m-*-iso8859-*, \
+ -*-courier-bold-r-normal-*-14-*-*-*-m-*-iso8859-*, \
+ -gnu-unifont-bold-r-normal--16-*-*-*-c-*-*-*, \
+ -efont-biwidth-bold-r-normal--16-*-*-*-*-*-*-*, \
+ -*-*-bold-r-normal-*-16-*-*-*-m-*-*-*, \
+ -*-*-bold-r-normal-*-16-*-*-*-c-*-*-*, \
+ -*-*-*-*-*-*-16-*-*-*-*-*-*-*, *
TopLevelShell*international: true
TopLevelShell*font: 7x13bold
-TopLevelShell*fontSet: -*-lucidatypewriter-bold-r-normal-*-14-*-*-*-m-*-iso8859-*,-*-courier-bold-r-normal-*-14-*-*-*-m-*-iso8859-*,-gnu-unifont-bold-r-normal--16-*-*-*-c-*-*-*,-efont-biwidth-bold-r-normal--16-*-*-*-*-*-*-*,-*-*-bold-r-normal-*-16-*-*-*-m-*-*-*,-*-*-bold-r-normal-*-16-*-*-*-c-*-*-*,-*-*-*-*-*-*-16-*-*-*-*-*-*-*,*
+TopLevelShell*fontSet: \
+ -*-lucidatypewriter-bold-r-normal-*-14-*-*-*-m-*-iso8859-*, \
+ -*-courier-bold-r-normal-*-14-*-*-*-m-*-iso8859-*, \
+ -gnu-unifont-bold-r-normal--16-*-*-*-c-*-*-*, \
+ -efont-biwidth-bold-r-normal--16-*-*-*-*-*-*-*, \
+ -*-*-bold-r-normal-*-16-*-*-*-m-*-*-*, \
+ -*-*-bold-r-normal-*-16-*-*-*-c-*-*-*, \
+ -*-*-*-*-*-*-16-*-*-*-*-*-*-*,*
*popup_help.title: Welcome to xawtv!
xawtv.tv.help: \
@@ -368,8 +382,13 @@ xawtv.onscreen*background: black
xawtv.onscreen*borderColor: black
xawtv.onscreen*foreground: lightgreen
xawtv.onscreen.label.justify: left
-xawtv.onscreen.label.font: -*-ledfixed-medium-r-semicondensed--39-*
-xawtv.onscreen.label.fontSet: -*-ledfixed-medium-r-semicondensed--39-*,-*-*-*-R-*-*-*-120-*-*-*-*
+xawtv.onscreen.label.font: -*-ledfixed-medium-r-*--39-*-*-*-c-*-*-*
+xawtv.onscreen.label.fontSet: \
+ -*-ledfixed-medium-r-semicondensed--39-*-*-*-c-*-*-*, \
+ -*-bitstream vera sans-medium-r-normal--39-*-*-*-*-*-*-*, \
+ -*-luxi sans-medium-r-normal--39-*-*-*-*-*-*-*, \
+ -*-*-r-normal--39-*-*-*-*-*-*-*, \
+ -*-*-*-*--39-*-*-*-*-*-*-*,*
xawtv.vtx.allowShellResize: true
xawtv.vtx.label.resize: true
diff --git a/x11/blit.c b/x11/blit.c
index d2bd37b..7b0ac76 100644
--- a/x11/blit.c
+++ b/x11/blit.c
@@ -24,7 +24,6 @@
#if HAVE_GL
# include <GL/gl.h>
-# include <GL/glu.h>
# include <GL/glx.h>
#endif
@@ -378,9 +377,14 @@ void xv_image_init(Display *dpy)
(fo[i].id >> 24) & 0xff,
(fo[i].format == XvPacked) ? "packed" : "planar");
if (0x32595559 == fo[i].id) {
- im_formats[VIDEO_YUV422] = fo[i].id;
+ im_formats[VIDEO_YUYV] = fo[i].id;
if (debug)
- fprintf(stderr," [ok: %s]",ng_vfmt_to_desc[VIDEO_YUV422]);
+ fprintf(stderr," [ok: %s]",ng_vfmt_to_desc[VIDEO_YUYV]);
+ }
+ if (0x59565955 == fo[i].id) {
+ im_formats[VIDEO_UYVY] = fo[i].id;
+ if (debug)
+ fprintf(stderr," [ok: %s]",ng_vfmt_to_desc[VIDEO_UYVY]);
}
if (0x30323449 == fo[i].id) {
im_formats[VIDEO_YUV420P] = fo[i].id;
@@ -594,7 +598,7 @@ static int gl_resize(int iw, int ih, int ww, int wh,
glViewport(0, 0, ww, wh);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
- gluOrtho2D(0.0, ww, 0.0, wh);
+ glOrtho(0.0, ww, 0.0, wh, -1, 1);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
diff --git a/x11/motv.c b/x11/motv.c
index 1acb8d5..003303b 100644
--- a/x11/motv.c
+++ b/x11/motv.c
@@ -2244,7 +2244,8 @@ chscan_timeout(XtPointer client_data, XtIntervalId *id)
/* all done */
x11_vbi_stop();
chtimer = 0;
- do_va_cmd(2,"setchannel",channels[0]->name);
+ if (count)
+ do_va_cmd(2,"setchannel",channels[0]->name);
XtDestroyWidget(chdlg);
chdlg = NULL;
return;
@@ -2438,7 +2439,7 @@ pref_mix1(void)
on = XmToggleButtonGetState(pref_mix_toggle);
if (!list_empty(&ng_mix_drivers)) {
- mix = list_entry(&ng_mix_drivers.next,struct ng_mix_driver,list);
+ mix = list_entry(ng_mix_drivers.next,struct ng_mix_driver,list);
info = mix->probe();
}
if (NULL != info && on) {
diff --git a/x11/xt.c b/x11/xt.c
index 06c7c02..5aab373 100644
--- a/x11/xt.c
+++ b/x11/xt.c
@@ -739,6 +739,9 @@ xt_siginit(void)
act.sa_handler = termsig;
sigaction(SIGINT,&act,&old);
sigaction(SIGTERM,&act,&old);
+
+ act.sa_handler = SIG_IGN;
+ sigaction(SIGPIPE,&act,&old);
if (debug) {
act.sa_handler = segfault;
@@ -777,14 +780,6 @@ xscreensaver_timefunc(XtPointer clientData, XtIntervalId *id)
/*----------------------------------------------------------------------*/
-Boolean
-MyResize(XtPointer client_data)
-{
- /* needed for program-triggered resizes (fullscreen mode) */
- video_new_size();
- return TRUE;
-}
-
#ifdef HAVE_LIBXXF86VM
static void
vidmode_timer(XtPointer clientData, XtIntervalId *id)
@@ -817,6 +812,72 @@ set_vidmode(XF86VidModeModeInfo *mode)
#endif
static void
+do_modeswitch(int fs_state, int *vp_width, int *vp_height)
+{
+ if (fs_state) {
+ /* enter fullscreen mode */
+ *vp_width = swidth;
+ *vp_height = sheight;
+
+#ifdef HAVE_LIBXXF86VM
+ if (have_vm) {
+ int i;
+ XF86VidModeGetModeLine(dpy,XDefaultScreen(dpy),&vm_dot,&vm_line);
+ XF86VidModeGetAllModeLines(dpy,XDefaultScreen(dpy),
+ &vm_count,&vm_modelines);
+ vm_fullscreen = NULL;
+ for (i = 0; i < vm_count; i++) {
+ if (fs_width == vm_modelines[i]->hdisplay &&
+ fs_height == vm_modelines[i]->vdisplay)
+ vm_fullscreen = vm_modelines[i];
+ if (vm_line.hdisplay == vm_modelines[i]->hdisplay &&
+ vm_line.vdisplay == vm_modelines[i]->vdisplay)
+ vm_current = vm_modelines[i];
+ }
+ if (debug) {
+ fprintf(stderr,"vm: current=%dx%d",
+ vm_current->hdisplay,vm_current->vdisplay);
+ if (vm_fullscreen)
+ fprintf(stderr,"fullscreen=%dx%d",
+ vm_fullscreen->hdisplay,vm_fullscreen->vdisplay);
+ fprintf(stderr,"\n");
+ }
+ if (vm_current && vm_fullscreen &&
+ vm_fullscreen->hdisplay != vm_current->hdisplay &&
+ vm_fullscreen->vdisplay != vm_current->vdisplay) {
+ set_vidmode(vm_fullscreen);
+ vm_switched = 1;
+ *vp_width = vm_fullscreen->hdisplay;
+ *vp_height = vm_fullscreen->vdisplay;
+ } else {
+ vm_switched = 0;
+ *vp_width = vm_current->hdisplay;
+ *vp_height = vm_current->vdisplay;
+ }
+ }
+#endif
+ } else {
+ /* leave fullscreen mode */
+#ifdef HAVE_LIBXXF86VM
+ if (have_vm && vm_switched) {
+ set_vidmode(vm_current);
+ vm_switched = 0;
+ }
+#endif
+ }
+}
+
+/*----------------------------------------------------------------------*/
+
+Boolean
+MyResize(XtPointer client_data)
+{
+ /* needed for program-triggered resizes (fullscreen mode) */
+ video_new_size();
+ return TRUE;
+}
+
+static void
do_screensaver(int fs_state)
{
static int timeout,interval,prefer_blanking,allow_exposures;
@@ -863,12 +924,16 @@ do_fullscreen(void)
Window root,child;
int wpx,wpy,mask;
+ unsigned int vp_width, vp_height;
if (use_wm_fullscreen && wm_fullscreen) {
/* full service for us, next to nothing to do */
fs = !fs;
if (debug)
fprintf(stderr,"fullscreen %s via netwm\n", fs ? "on" : "off");
+
+ do_modeswitch(fs,&vp_width,&vp_height);
+ XSync(dpy,False);
wm_fullscreen(dpy,XtWindow(app_shell),fs);
if (0 == fs && on_timer) {
@@ -883,13 +948,8 @@ do_fullscreen(void)
if (fs) {
if (debug)
fprintf(stderr,"turning fs off (%dx%d+%d+%d)\n",w,h,x,y);
-#ifdef HAVE_LIBXXF86VM
- if (have_vm && vm_switched) {
- set_vidmode(vm_current);
- vm_switched = 0;
- }
-#endif
-
+ do_modeswitch(0,&vp_width,&vp_height);
+
if (on_timer) {
XtPopdown(on_shell);
XtRemoveTimeOut(on_timer);
@@ -911,62 +971,23 @@ do_fullscreen(void)
0, 0, 0, 0, rpx, rpy);
fs = 0;
} else {
- unsigned int vp_width, vp_height;
int vp_x, vp_y;
if (debug)
fprintf(stderr,"turning fs on\n");
- vp_x = 0;
- vp_y = 0;
- vp_width = swidth;
- vp_height = sheight;
XQueryPointer(dpy, RootWindowOfScreen(XtScreen(tv)),
&root, &child, &rpx, &rpy, &wpx, &wpy, &mask);
-#ifdef HAVE_LIBXXF86VM
- if (have_vm) {
- int i;
- XF86VidModeGetModeLine(dpy,XDefaultScreen(dpy),&vm_dot,&vm_line);
- XF86VidModeGetAllModeLines(dpy,XDefaultScreen(dpy),
- &vm_count,&vm_modelines);
- vm_fullscreen = NULL;
- for (i = 0; i < vm_count; i++) {
- if (fs_width == vm_modelines[i]->hdisplay &&
- fs_height == vm_modelines[i]->vdisplay)
- vm_fullscreen = vm_modelines[i];
- if (vm_line.hdisplay == vm_modelines[i]->hdisplay &&
- vm_line.vdisplay == vm_modelines[i]->vdisplay)
- vm_current = vm_modelines[i];
- }
- if (debug) {
- fprintf(stderr,"vm: current=%dx%d",
- vm_current->hdisplay,vm_current->vdisplay);
- if (vm_fullscreen)
- fprintf(stderr,"fullscreen=%dx%d",
- vm_fullscreen->hdisplay,vm_fullscreen->vdisplay);
- fprintf(stderr,"\n");
- }
- if (vm_current && vm_fullscreen &&
- vm_fullscreen->hdisplay != vm_current->hdisplay &&
- vm_fullscreen->vdisplay != vm_current->vdisplay) {
- set_vidmode(vm_fullscreen);
- vm_switched = 1;
- vp_width = vm_fullscreen->hdisplay;
- vp_height = vm_fullscreen->vdisplay;
- } else {
- vm_switched = 0;
- vp_width = vm_current->hdisplay;
- vp_height = vm_current->vdisplay;
- }
- if (vp_width < sheight || vp_width < swidth) {
- /* move viewpoint, make sure the pointer is in there */
- warp_pointer = 1;
- XWarpPointer(dpy, None, RootWindowOfScreen(XtScreen(tv)),
- 0, 0, 0, 0, vp_width/2, vp_height/2);
- XF86VidModeSetViewPort(dpy,XDefaultScreen(dpy),0,0);
- }
+ vp_x = 0;
+ vp_y = 0;
+ do_modeswitch(1,&vp_width,&vp_height);
+ if (vp_width < sheight || vp_width < swidth) {
+ /* move viewpoint, make sure the pointer is in there */
+ warp_pointer = 1;
+ XWarpPointer(dpy, None, RootWindowOfScreen(XtScreen(tv)),
+ 0, 0, 0, 0, vp_width/2, vp_height/2);
+ XF86VidModeSetViewPort(dpy,XDefaultScreen(dpy),0,0);
}
-#endif
XtVaGetValues(app_shell,
XtNx, &x,
XtNy, &y,
diff --git a/xawtv.spec b/xawtv.spec
index 7efc295..7dad5fa 100644
--- a/xawtv.spec
+++ b/xawtv.spec
@@ -1,7 +1,7 @@
Name: xawtv
Group: Applications/Multimedia
Autoreqprov: on
-Version: 3.85
+Version: 3.86
Release: 0
License: GPL
Summary: v4l applications

Privacy Policy