aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2010-04-01 09:24:35 (GMT)
committerGerd Hoffmann <kraxel@redhat.com>2010-04-01 09:24:35 (GMT)
commitcd7382baf50d1f055264748ac67f13c98d2f4205 (patch)
tree83470b86a32c893fa73b353036b4f91d01977ceb
parentfc44df6ca9cad3b3e154f38c3a43397afacbc82b (diff)
v3.27
-rw-r--r--Changes253
-rw-r--r--KNOWN_PROBLEMS35
-rw-r--r--Makefile9
-rw-r--r--Makefile.clean9
-rw-r--r--Makefile.in45
-rw-r--r--README30
-rw-r--r--README.bttv5
-rw-r--r--README.lirc5
-rw-r--r--README.recording73
-rw-r--r--README.xfree461
-rw-r--r--Sound-FAQ88
-rw-r--r--TODO33
-rw-r--r--acconfig.h15
-rw-r--r--build-test19
-rw-r--r--capture-test2
-rw-r--r--config.h.in36
-rwxr-xr-xconfigure825
-rw-r--r--configure.in113
-rw-r--r--contrib/cc/Makefile8
-rw-r--r--contrib/cc/cc.c641
-rw-r--r--contrib/dot.lircrc92
-rw-r--r--contrib/r@dio.mp31
-rw-r--r--contrib/vtx2xawtv/README.vtx2xawtv29
-rw-r--r--contrib/vtx2xawtv/vtx2xawtv44
-rw-r--r--debian/alevtd.files2
-rw-r--r--debian/changelog109
-rw-r--r--debian/control81
-rw-r--r--debian/copyright21
-rw-r--r--debian/fbtv.files2
-rw-r--r--debian/fbtv.menu2
-rw-r--r--debian/radio.files2
-rw-r--r--debian/radio.menu2
-rw-r--r--debian/rules59
-rw-r--r--debian/streamer.files1
-rw-r--r--debian/v4l-conf.files2
-rw-r--r--debian/webcam.files2
-rw-r--r--debian/xawtv-tools.files6
-rw-r--r--debian/xawtv.config67
-rw-r--r--debian/xawtv.files13
-rw-r--r--debian/xawtv.menu2
-rw-r--r--debian/xawtv.postinst74
-rw-r--r--debian/xawtv.postrm4
-rw-r--r--debian/xawtv.reset9
-rw-r--r--debian/xawtv.templates52
-rw-r--r--font/Makefile59
-rw-r--r--font/Makefile.in24
-rw-r--r--font/fonts.dir4
-rw-r--r--font/led-latin2.bdf6
-rw-r--r--http/Makefile.in52
-rw-r--r--http/about.html28
-rw-r--r--http/alevt.css159
-rw-r--r--http/alevtd.man80
-rw-r--r--http/bottom.html14
-rw-r--r--http/httpd.h83
-rw-r--r--http/main.c719
-rw-r--r--http/page.c279
-rw-r--r--http/request.c192
-rw-r--r--http/response.c189
-rw-r--r--http/top.html7
-rw-r--r--i2c/Makefile17
-rw-r--r--i2c/Makefile.in4
-rw-r--r--libvbi/Makefile.in38
-rw-r--r--libvbi/README6
-rw-r--r--libvbi/cache.c264
-rw-r--r--libvbi/cache.h40
-rw-r--r--libvbi/dllist.h53
-rw-r--r--libvbi/exp-gfx.c275
-rw-r--r--libvbi/exp-html.c296
-rw-r--r--libvbi/exp-txt.c232
-rw-r--r--libvbi/export.c366
-rw-r--r--libvbi/export.h62
-rw-r--r--libvbi/fdset.c99
-rw-r--r--libvbi/fdset.h27
-rw-r--r--libvbi/font.c3
-rw-r--r--libvbi/font.h18
-rw-r--r--libvbi/font1.xbm292
-rw-r--r--libvbi/font2.xbm292
-rw-r--r--libvbi/fontsize.h4
-rw-r--r--libvbi/hamm.c237
-rw-r--r--libvbi/hamm.h9
-rw-r--r--libvbi/lang.c250
-rw-r--r--libvbi/lang.h22
-rw-r--r--libvbi/misc.c72
-rw-r--r--libvbi/misc.h46
-rw-r--r--libvbi/os.h15
-rw-r--r--libvbi/vbi.c531
-rw-r--r--libvbi/vbi.h53
-rw-r--r--libvbi/vt.h68
-rw-r--r--log825
-rw-r--r--man/Makefile.in10
-rw-r--r--man/fbtv.man7
-rw-r--r--man/rootv.man34
-rw-r--r--man/xawtv-remote.man26
-rw-r--r--man/xawtv.man81
-rw-r--r--oldstuff/vtx/Makefile (renamed from vtx/Makefile)0
-rw-r--r--oldstuff/vtx/README (renamed from vtx/README)0
-rw-r--r--oldstuff/vtx/cct.h (renamed from vtx/cct.h)0
-rw-r--r--oldstuff/vtx/fileio.c (renamed from vtx/fileio.c)0
-rw-r--r--oldstuff/vtx/fileio.h (renamed from vtx/fileio.h)0
-rw-r--r--oldstuff/vtx/main.c (renamed from vtx/main.c)0
-rw-r--r--oldstuff/vtx/misc.h (renamed from vtx/misc.h)0
-rw-r--r--oldstuff/vtx/sys/vtx.h (renamed from vtx/sys/vtx.h)0
-rw-r--r--oldstuff/vtx/vtx.cgi (renamed from vtx/vtx.cgi)0
-rw-r--r--oldstuff/vtx/vtx.sh (renamed from vtx/vtx.sh)0
-rw-r--r--oldstuff/vtx/vtx_assert.h (renamed from vtx/vtx_assert.h)0
-rw-r--r--oldstuff/vtx/vtxdecode.c (renamed from vtx/vtxdecode.c)0
-rw-r--r--oldstuff/vtx/vtxdecode.h (renamed from vtx/vtxdecode.h)0
-rw-r--r--oldstuff/vtx/vtxtools.c (renamed from vtx/vtxtools.c)0
-rw-r--r--oldstuff/vtx/vtxtools.h (renamed from vtx/vtxtools.h)0
-rw-r--r--radio/Makefile.in23
-rw-r--r--src/Makefile.in85
-rw-r--r--src/MoTV.ad55
-rw-r--r--src/Xawtv.ad52
-rw-r--r--src/capture.c537
-rw-r--r--src/capture.h34
-rw-r--r--src/channel.c81
-rw-r--r--src/channel.c.orig567
-rw-r--r--src/channel.h12
-rw-r--r--src/colorspace.c2
-rw-r--r--src/colorspace.c.rej29
-rw-r--r--src/commands.c165
-rw-r--r--src/commands.h21
-rw-r--r--src/conf.c13
-rw-r--r--src/fbtools.c10
-rw-r--r--src/fbtools.h6
-rw-r--r--src/fbtv.c70
-rw-r--r--src/fix19
-rw-r--r--src/frequencies.c149
-rw-r--r--src/grab-bsd.c581
-rw-r--r--src/grab-ng.c89
-rw-r--r--src/grab-ng.h132
-rw-r--r--src/grab-v4l.c687
-rw-r--r--src/grab-v4l2.c223
-rw-r--r--src/grab.c174
-rw-r--r--src/grab.h48
-rw-r--r--src/lirc.c15
-rw-r--r--src/lirc.h4
-rw-r--r--src/log11
-rw-r--r--src/main.c1404
-rw-r--r--src/matrox.c13
-rw-r--r--src/matrox.h2
-rw-r--r--src/mjpeg.c11
-rw-r--r--src/motif.c409
-rw-r--r--src/parseconfig.c15
-rw-r--r--src/parseconfig.h2
-rw-r--r--src/rootv.c178
-rw-r--r--src/scantv.c298
-rw-r--r--src/sound.c112
-rw-r--r--src/sound.h24
-rw-r--r--src/streamer.c561
-rw-r--r--src/streamerdiff134
-rw-r--r--src/toolbox.c67
-rw-r--r--src/toolbox.h15
-rw-r--r--src/v4l-conf.c6
-rw-r--r--src/v4lctl.c25
-rw-r--r--src/webcam.c158
-rw-r--r--src/webcam.h5
-rw-r--r--src/wmhooks.c74
-rw-r--r--src/wmhooks.h2
-rw-r--r--src/writeavi.c573
-rw-r--r--src/writeavi.h31
-rw-r--r--src/writefile.c271
-rw-r--r--src/writefile.h1
-rw-r--r--src/writeqt.c224
-rw-r--r--src/x11.c29
-rw-r--r--src/x11.h4
-rw-r--r--src/xawtv-remote.c49
-rw-r--r--src/xt.c524
-rw-r--r--src/xt.h94
-rw-r--r--src/xv.c48
-rw-r--r--src/xv.h2
-rw-r--r--src/xvideo.c11
-rw-r--r--tools/Makefile.in26
-rw-r--r--tools/dump-mixers.c13
-rw-r--r--tools/record.c35
-rw-r--r--tools/showriff.c601
-rw-r--r--tools/showriff.man31
-rw-r--r--videodev2.h227
-rw-r--r--webcam/Makefile21
-rw-r--r--webcam/Makefile.in43
-rw-r--r--webcam/font_8x8.h2569
-rw-r--r--webcam/ftp.c264
-rw-r--r--webcam/ftp.h6
-rw-r--r--webcam/parseconfig.c205
-rw-r--r--webcam/parseconfig.h6
-rw-r--r--webcam/webcam.c644
-rw-r--r--webcam/webcam.man103
-rw-r--r--xawtv.spec82
-rw-r--r--xawtv.spec.in80
189 files changed, 16980 insertions, 6798 deletions
diff --git a/Changes b/Changes
index 669fe30..ea53e24 100644
--- a/Changes
+++ b/Changes
@@ -1,4 +1,257 @@
+3.27 => 3.27
+============
+
+ * (hopefully) fixed rpm build problems.
+ * started adding ioctl tracking to the v4l code.
+ * fixed a bug in overlay code (uninitialized video_picture.depth)
+
+
+3.25 => 3.26
+============
+
+ * initialization order bug in volume control fixed (thanks to
+ rolf.siebrecht@t-online.de).
+ * added a few options to scantv, allowing it to be used
+ non-interactive.
+ * added GUI support for the rewritten capture code, recording
+ movies with xawtv works again.
+
+
+3.24 => 3.25 [non-public release]
+=================================
+
+ * teached the v4l code to turn off (and back on) overlay when fiddeling
+ with SPICT and SWIN ioctls for read() capture. Mixing overlay and
+ read() capture works now without funny effects.
+ * fixed a bug in grabdisplay error handling (which made xawtv die with
+ "aiee: grab_fps==0" because it forgot to clean up on capture errors).
+ * started a major rewrite of the core capture code. See grab-ng.h
+ Step one:
+ - rewrote the movie output code.
+ - writeavi.c is reentrant now.
+ - Added quicktime support (lousely based on W. Michael Petullo's
+ quicktime patches).
+ - Added support for recording image files with audio in a separate
+ wav file.
+ - xawtv's movie recording is temporarely broken, GUI updates not in
+ place yet. You'll have to use streamer for now, sorry.
+
+
+3.23 => 3.24
+============
+
+ * -xvport does _really_ work now...
+ * Improved the OpenBSD port. Clipping works better now, single frame
+ capture works.
+ * decreased the timeout for hiding the mouse pointer.
+ * fixed onscreen display logic.
+ * removed 320x240 capture size limit for yuv (Xvideo-scaled) grabdisplay
+ mode.
+ * fixed rate control (and killed the anonying but harmless error message
+ in grabdisplay mode).
+ * Added cc.c patches (Adam <adam@cfar.umd.edu>).
+
+
+3.22 => 3.23
+============
+
+ * added -xvport option to set the Xv port.
+ * Killed all the old mouse pointer handling code and the assorted config
+ config options / cmd line switches. Replaced it with a simple timeout
+ logic: If you don't move the mouse for some time xawtv will hide the
+ pointer. Any pointer motion event will show the pointer again.
+ * new xawtv-remote command: showtime.
+
+
+3.21 => 3.22
+============
+
+ * FastText for alevtd (Malcolm Parsons <malcolm@bits.bris.ac.uk>).
+ * xawtv-remote patch (Adam <adam@cfar.umd.edu>)
+ * misc bugfixes
+ * netwm support (Dirk Mueller <dmuell@gmx.net>)
+
+
+3.20 => 3.21
+============
+
+ * specfile fixed (app-defaults are missing).
+ * compile fix for alevtd.
+ * bugfix in v4l2 code.
+ * removed the boring core dump from the source tree.
+
+
+3.19 => 3.20
+============
+
+ * minor man-page updates.
+ * OpenBSD port starts working: xawtv compiles, overlay works.
+ Clipping doesnt work for some reason (Its me or the driver?).
+ As FreeBSD uses the same driver it should be easy to make xawtv
+ work there too.
+ * Plenty of autoconf tweaks to make the whole package compile
+ cleanly on BSD.
+ * converted a number of structs to "field: value" style
+ initialization.
+ * Added audio= option to ~/.xawtv
+ * manpage updates.
+
+
+3.18 => 3.19
+============
+
+ * Added libvbi (vbi decoding code from alevt)
+ * Added scantv: does a channel scan, picks up the station id from
+ vbi, writes a xawtv config file.
+ * minor webcam tweaks
+ * Added alevtd - a http server for videotext pages.
+
+
+3.17 => 3.18
+============
+
+ * off-by-one bug in colorspace.c fixed.
+ * Documentation updates
+ * webcam patches from les Niles <lniles@narus.com>
+ * libjpeg dependency changed from optional to required (webcam
+ never worked without libjpeg before, and libjpeg is present
+ on nearly any linux system anyway, so...)
+ * Added triggers to the webcam - compare the current image with the
+ last uploaded one, try to figure if it has changed and upload only
+ if it has...
+
+
+3.16 => 3.17
+============
+
+ * new -w switch for streamer (Santiago Garcia Mantinan <manty@i.am>)
+
+
+3.15 => 3.16
+============
+
+ * The 3.15 tarball had a big binary included by mistake.
+ * Some v4l2 fixes.
+
+
+3.14 => 3.15
+============
+
+ * fixed a bug in the channel editor (did'nt saved the input for
+ new channels)
+ * shuffled around some code -- split Xaw and general Xt/X11 code.
+ * added max size check to v4l2 overlay code.
+ * added (un)mute to rootv
+
+
+3.13 => 3.14
+============
+
+ * Added a "fix-aspect-ratio" option (quick guide: add
+ "radio=4:3" to the [global] section).
+ * fixed a few bugs in the new avi recording code.
+ audio+video should work again.
+ * A fullscreen option in the config file enables the VidMode
+ extention now.
+ * added read()-based capture support to the webcam. Untested.
+
+
+3.12 => 3.13
+============
+
+ * some xvideo finetuning
+ * Added xvideo support to v4lctl
+ * Added rootv utility
+ * Added debian package information
+ * Added small script to pick up channels from videotext (*.de,
+ Kabel1 pages, from Kai Fett, it is in contrib/vtx2xawtv)
+ * webcam: moved ftp code to another source file, made it runtime
+ configurable, wrote a man-page
+ * wrote a manpage for showriff
+
+
+3.11 => 3.12
+============
+
+ * Added the missing -D_REENTRANT to the Makefile
+ * picked up the r@dio.mp3 client from the v4l list, put it
+ into the contrib directory.
+ * avi recording fix (audio+video stream length are identical now).
+ * xawtv-remote protocol supports more than one command now. Commands
+ are separated by a zero-length string, i.e. 'xawtv-remote foo "" bar'
+ * new xawtv-remote command: vtx (interface for subtitles). Check
+ the man-page for details.
+ * webcam fixes.
+
+
+3.10 => 3.11
+============
+
+ * fbtv grabdisplay fix, added G400 (works with G200 code too).
+ * lirc code update (Ilya Konstantinov <future@galanet.net>). You might
+ have to upgrade lirc to compile this version.
+ * fixed the bool ressources. They are /really/ boolean now,
+ i.e. "xawtv.vidmode: true" works now.
+ * fixed a few bugs in the new recording code.
+ * added support for freq= in ~/.xawtv. Untested.
+ * avi writing code fix (broken size for one header field,
+ found by David Gesswein <djg@drs-esg.com>). Now the windows media
+ player accepts xawtv's movies, cool...
+ * Added command line parsing to showriff. Added a option to make it
+ not stop on errors.
+ * Fixed avi initialization code. It forgot to reset some counters,
+ and thats why xawtv wrote broken avi files if you've recorded more
+ than one...
+ * Added new command to xawtv-remote: webcam.
+
+
+3.09 => 3.10
+============
+
+ * fixed pthread compile problems.
+ * first cut of the new recording code is active. It still needs
+ some tweaking, but the basics work. v4l2 is'nt updated yet.
+ audio+video syncronisation should work better. It is also possible
+ to start/stop xawtv's avi-recording with xawtv-remote (see manpage).
+
+
+3.08 => 3.09
+============
+
+ * extended showriff a bit
+ * fixed broken rpm build
+ * started rewriting the capture code. Switching over to threads,
+ hope I get the audio/video syncronisation issues fixed this way.
+ Right now it is dead code only...
+
+
+3.07 => 3.08
+============
+
+ * reverted the frequency table split for europe. Turned out this
+ was a bad idea...
+ * Added options to enable dga/vidmode/... extentions. Vidmode is
+ off by default now. This is the X Extention used for switching
+ video modes, i.e. you'll have to start xawtv with "-vm" now to
+ make it switching the video mode when going to fullscreen mode.
+ * Added chroma keying support.
+ * OpenDML support for avi. Now the intresting question: Who can
+ playback or at least read these files? I don't know how to test
+ this stuff...
+ * Documentation updates
+
+
+3.06 => 3.07
+============
+
+ * added troggle-mouse option (turn on/off mouse when swithing to
+ fullscreen).
+ * Added "stay on bottom". The "stay-on-top" command does now cycle
+ between normal, top and bottom.
+ * Added support for more than two capture buffers to grab-v4l.c
+
+
3.06 => 3.07
============
diff --git a/KNOWN_PROBLEMS b/KNOWN_PROBLEMS
index 67d4eac..75a88d8 100644
--- a/KNOWN_PROBLEMS
+++ b/KNOWN_PROBLEMS
@@ -1,4 +1,34 @@
+For some people xawtv failes with
+ Error: Couldn't find per display information
+
+This is probably some library compatibility problem. I've never seen
+this myself. According to a report I've received upgrading Xfree86 to
+4.0 fixed this. Probaby xawtv does'nt work with 3.3.x libraries if it
+was compiled against the 4.0.x versions.
+
+--
+
+libXaw3d is buggy. It bombs when xawtv wants to use a visual with a
+different color depth than the default visual. Looks like this:
+
+bogomips kraxel ~# xawtv
+This is xawtv-3.08, running on Linux/i686 (2.2.13)
+visual: id=0x22 class=3 (PseudoColor), depth=8
+visual: id=0x23 class=1 (GrayScale), depth=8
+visual: id=0x24 class=4 (TrueColor), depth=24
+switching visual (0x24)
+[ ... more messages ... ]
+X Error of failed request: BadValue (integer parameter out of range for operation)
+ Major opcode of failed request: 91 (X_QueryColors)
+ Value in failed request: 0xd3d3d3
+ Serial number of failed request: 63
+ Current serial number in output stream: 63
+
+workaround: ./configure --disable-xaw3d
+
+--
+
Some people report xawtv segfaults with glibc 2.1
(got success reports too). I don't know what the
reason for this problem is. From the stack traces
@@ -8,5 +38,10 @@ some incompatibility between glibc and the X11 libs.
I've got one report that upgrading the X11 libs from
3.3.2 to 3.3.3 fixed the problem.
+
+HTH,
+
Gerd
+--
+Gerd Knorr <kraxel@goldbach.in-berlin.de>
diff --git a/Makefile b/Makefile
index 5cc4c36..c20aae5 100644
--- a/Makefile
+++ b/Makefile
@@ -1,2 +1,9 @@
default:
- ./configure && make dep && make
+ ./configure && $(MAKE) dep && $(MAKE)
+
+
+#########################################################
+# just for me, some maintaining jobs. Don't use them
+
+checkit diff release port:
+ ./configure && $(MAKE) $@
diff --git a/Makefile.clean b/Makefile.clean
new file mode 100644
index 0000000..c20aae5
--- /dev/null
+++ b/Makefile.clean
@@ -0,0 +1,9 @@
+default:
+ ./configure && $(MAKE) dep && $(MAKE)
+
+
+#########################################################
+# just for me, some maintaining jobs. Don't use them
+
+checkit diff release port:
+ ./configure && $(MAKE) $@
diff --git a/Makefile.in b/Makefile.in
index 48cc655..bd26575 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,35 +1,40 @@
-SUBDIRS=src man radio font tools #i2c webcam
+SUBDIRS=libvbi src man radio font tools webcam http #i2c vtx
-all dep depend install clean distclean realclean::
- set -e; for dir in $(SUBDIRS); do make -C $$dir $@; done
+all build dep depend install clean distclean realclean::
+ set -e; for dir in $(SUBDIRS); do $(MAKE) -C $$dir $@; done
distclean realclean::
- -rm -f *~ config.cache config.h config.log config.status Makefile
- @echo "default:" > Makefile
- @echo " ./configure && make dep && make" >> Makefile
+ -rm -f *~ debian/*~ config.cache config.h config.log config.status Makefile
+ cp Makefile.clean Makefile
-###########################################
-# just for me, some maintaining jobs...
+#########################################################
+# just for me, some maintaining jobs. Don't use them
-DEST=$(HOME)/www/v4l
RPM=/home/ftp/rpm
VERSION=@XAWTV_VERSION@
-tar: distclean
+realclean::
find . -name snap0*.ppm -print | xargs -i rm -f
find . -name snap0*.jpeg -print | xargs -i rm -f
- make -C vtx distclean
- cd ..;tar cvzf $(DEST)/xawtv-$(VERSION).tar.gz xawtv-$(VERSION)
- rm -f $(RPM)/SOURCES/xawtv-*.tar.gz
- cp $(DEST)/xawtv-$(VERSION).tar.gz $(RPM)/SOURCES
-
-diff: distclean
- echo $(VERSION)
- (cd /tmp; tar xvzf `ls -t $(HOME)/2/src/Archives/xawtv-*.tar.gz | head -n 1`)
- (cd ..; diff -urN /tmp/xawtv-* xawtv-$(VERSION) | gzip > $(DEST)/xawtv-$(VERSION).diff.gz)
+ find . -name .nfs* -print | xargs -i rm -f
+ set -e; for dir in i2c; do make -C $$dir distclean; done
+
+checkit: distclean
+ dpkg-buildpackage -tc -us -uc -rfakeroot
+ rpm -ta ../xawtv_*.tar.gz
+ lintian ../xawtv_*.changes
+
+diff:
+ (cd /tmp; tar xvzf `ls -t $(HOME)/debian/Archive/xawtv_*.tar.gz | head -n 1`)
+ (cd ..; diff -urN /tmp/xawtv-* xawtv-$(VERSION) | gzip > xawtv_$(VERSION).diff.gz)
rm -rf /tmp/xawtv-*
-dist: tar diff
+release: realclean diff
+ make -C font bdf
+ dpkg-buildpackage -tc -rfakeroot
+
+port:
+ dpkg-buildpackage -b -tc -rfakeroot
diff --git a/README b/README
index d260f3b..f15857b 100644
--- a/README
+++ b/README
@@ -78,10 +78,8 @@ usage
bttv
----
-bttv is'nt bundled with xawtv any more. You can get my current bttv
-code as separate tar file from http://www.in-berlin.de/User/kraxel/v4l/
-Number scheme is Ralph's version it is based on plus a small letter
-(i.e. bttv-0.6.3e for example).
+bttv is'nt bundled with xawtv any more. You can the latest version
+from http://www.strusel007.de/linux/bttv/
v4l-conf
@@ -92,8 +90,8 @@ video mode (size and color depth). This requires root priviliges,
becauce it is easy to crash the box by passing bogous values there.
It requires the X-Server with DGA support up and running or a
framebuffer device. It is a temporary hack, this problem will be
-solved in a better way with a X11 extention. The XFree86 snapshots
-(3.9.x) already have some working code.
+solved in a better way with a X11 extention. See README.xfree4
+for details.
Try "v4l-conf -h" for a short description. It is installed suid-root,
and xawtv runs it at startup. Should work out-of-the-box without
@@ -195,14 +193,7 @@ webcam
This is a webcam tool. Captures a image, annotates with a text +
current time and uploads it to the webserver using ftp in an endless
loop. Needs the ftp utility. Should survive dropped ftp-connections
-(webserver reboot) without problems.
-
-It is'nt compiled by default, you can compile it with "make webcam".
-All config options are compile time options, check out the #defines in
-webcam.c. For normal operation, webcam is simply started without
-arguments (and it should work until someone kills it). If the number
-of arguments is non-zero, webcam prints the complete communication
-with the ftp utility to stderr (for debugging purpurses).
+(webserver reboot) without problems. It has a man-page...
perl
@@ -216,15 +207,14 @@ nifty tool to do a channel scan (decodes the station ID from vbi).
resources
=========
-http://www.in-berlin.de/User/kraxel/xawtv.html - xawtv [me]
+http://www.strusel007.de/linux/xawtv/ - xawtv [me]
http://user.exit.de/froese/ - alevt [Edgar]
-http://www.thp.uni-koeln.de/~rjkm/linux/bttv.html - bttv [Ralph]
-http://www.ee.up.ac.za/~justin/v4l2/ - bttv2 [Justin]
+http://www.metzlerbros.de/bttv.html - bttv [Ralph]
+http://bttv-v4l2.sourceforge.net/ - bttv2 [Justin]
http://roadrunner.swansea.uk.linux.org/v4l.shtml - v4l [Alan]
-http://millennium.diads.com/bdirks/v4l2.htm - v4l2 [Bill]
+http://www.thedirks.org/v4l2/ - v4l2 [Bill]
http://www.tk.uni-linz.ac.at/~simon/private/i2c/ - i2c [Simon]
-http://www-nrg.ee.lbl.gov/vic/ - vic
-http://FreeTV.Notrix.de
+http://www-mice.cs.ucl.ac.uk/multimedia/software/vic/ - vic
Have fun!
diff --git a/README.bttv b/README.bttv
index 46de961..a4136c8 100644
--- a/README.bttv
+++ b/README.bttv
@@ -2,6 +2,11 @@
Some hints to get the bttv driver up and running
================================================
+[ Note1: this applies to 0.6.x versions, 0.7.x (also kernel 2.4.x)
+ users should check out the README included there instead.
+ Note2: If you have trouble with 0.6.x, try to upgrade to 0.7.x
+ first. The list of supported cards is much longer. ]
+
You need configured kernel sources to compile the bttv driver. The
driver uses some Makefile magic to compile the modules with your
kernel's configuration (wrt. module-versions, SMP, ...). If you
diff --git a/README.lirc b/README.lirc
index f7d0473..d7826d6 100644
--- a/README.lirc
+++ b/README.lirc
@@ -14,9 +14,8 @@ i.e. if you stick the following lines into your .lircrc ...
end
... this should have the same effect like "xawtv-remote volume mute".
-Check the xawtv-remote manpage for a more complete list.
-
-And please don't ask /me/ how to make lirc work, I don't use it.
+Check the xawtv-remote manpage for a more complete list. A sample
+config file is in the contrib directory.
Gerd
diff --git a/README.recording b/README.recording
new file mode 100644
index 0000000..51b3412
--- /dev/null
+++ b/README.recording
@@ -0,0 +1,73 @@
+
+Audio
+=====
+
+If you don't get sound when recording avi movies, double-check the
+mixer settings first. The record source defaults to micro on many
+linux sound drivers, you probably have to change this to line-in with
+one of the available mixer tools.
+
+/me uses kmix (because it is small). The inputs where the sound cards
+record from have a red background color. With the right mouse botton
+you'll get a menu where you can change the settings.
+
+
+Video
+=====
+
+xawtv/streamer handle video recording with tree processes. Process #1
+is the main process. It does the video capture. It also does color
+space conversion / byteswapping / video compression if needed. The
+processed video frames are stored in a shared memory area. The shared
+memory is organizes as ring buffer wiht (by default) 8 buffers.
+
+Process #2 will simply write out the frames from the shared memory to
+the hard disk. This way Process #1 can continue to work even if
+writing to the hard disk blocks (at least until the ring buffer is
+full). Process #2 also handles the sound recording.
+
+Process #3 calls sync() from time to time. The default intervall
+linux uses (5 seconds) is to big. If the kernel tries to flush 5
+seconds uncompressed video to the hard disk, recording will loose some
+frames because the kernel is very busy with this...
+
+
+While recording you'll see lines like this one on stderr:
+
++--+-+-+-+-+-+-+-+-+-+-+-+s-+-+-+-+-++--+-+-+-+-+-+ 25/25 (-2)
+
+ "+" = Process #1 has written one frame to the shmem ring buffer
+ "-" = Process #2 has written a frame from the ring buffer to disk.
+ "o" = Frame lost: Process #1 couldn't put a frame into the ring
+ buffer because it was full.
+ "s" = Process #3 called sync().
+
+25/25 = # of frames stored in the ring buffer / # of frames captured
+ last second.
+ (-2) = 2 frames lost (in total)
+
+
+When recording uncompressed video (avi15/avi24), most likely the hard
+disk is the bottleneck. If you see a few o's from time to time,
+increasing the number of buffers might help. If you see alot of o's,
+your harddisk is to slow.
+
+For compressed video (mjpeg) it is very unlikely that you see any
+"o"'s. The bottleneck is the CPU which has to handle all the
+compressing. If the CPU can't keep up, the number of captured
+frames/sec will be lower than the the rate you've asked for. Again:
+if this only happens from time to time, increasing the number of
+buffers might help. This time the number of capture buffers of the
+hardware driver (for bttv this requires version 0.7.15 or newer).
+
+
+both
+====
+
+Yes, I know, there are some syncronisation problems. Unfortunality it
+is'nt trivial to fix them...
+
+ Gerd
+
+--
+Gerd Knorr <kraxel@goldbach.in-berlin.de>
diff --git a/README.xfree4 b/README.xfree4
new file mode 100644
index 0000000..85748b3
--- /dev/null
+++ b/README.xfree4
@@ -0,0 +1,61 @@
+
+XFree86 4.0 tips & tricks
+=========================
+
+
+DGA problems
+------------
+
+Release 4.0 has DGA turned off by default. You'll have turn it on
+in XF86Config, otherwise v4l-conf will not work correctly. It should
+work for most cards this way, althrouth some drivers don't handle DGA
+correctly in 4.0 (that's why it is off...)
+
+If DGA doesn't work for you, you have to configure bttv by hand (or
+use Xvideo, see below). v4l-conf has the "-a" switch for this.
+
+
+using Xvideo
+------------
+
+XFree86 4.0 comes with a new X11 extention for video support. The
+X-Server will handle the grabber board then, not xawtv. This has the
+advantage that the X-Server knows about the video. Window moves can
+be handled without redraw problems. The refresh triggered by xawtv
+to fix it isn't required any more. It is possible to use the video
+scalers of modern graphics boards (see below).
+
+To use Xvideo you have to load the video4linux module into the X-Server.
+Just adding 'Load "v4l"' to the Modules section of XF86Config will do.
+You have to make sure xawtv is compiled on a box with with XFree86 4.0
+installed. xawtv needs the new client libraries for Xvideo support.
+
+
+using hardware scaling
+----------------------
+
+Starting with XFree86 4.0.1 the Xvideo extention supports hardware-scaled
+video, i.e. the video isn't written directly to the visible area of the
+video memory. Instead the bt848 hardware writes yuv data to offscreen
+memory. The graphic card's video scaler does color space conversion and
+video scaling. This way fullscreen video works in 1024x768 (and greater)
+without a black border because we are not limited to the maximum size
+supported by the bt848 hardware any more.
+
+As this is very new stuff not all drivers support video scaling yet.
+Right now it works with the mga driver (matrox G200+G400) only.
+
+You also need a bttv version newer than 0.7.16 (the 2.2.x kernel version
+is /way/ to old, kernel 2.4.x is fine). If both bttv driver and xfree86
+gfx driver support it, xfree86's video4linux driver will use hardware
+scaling automagically.
+
+
+drawbacks
+---------
+
+capturing images/video doesn't work if xawtv runs using the Xvideo
+extention. With the '-noxv' switch Xvideo can be disabled.
+
+ Gerd
+
diff --git a/Sound-FAQ b/Sound-FAQ
index 5b9b940..64611f4 100644
--- a/Sound-FAQ
+++ b/Sound-FAQ
@@ -8,20 +8,20 @@ completely by the bt8xx chip, which is common on all boards. But
sound is handled in slightly different ways on each board.
To handle the grabber boards correctly, there is a array tvcards[] in
-bttv.c, which holds the informations required for each board. Sound
-will work only, if the correct entry is used (for video it often makes
-no difference). The bttv driver prints a line to the kernel log,
-telling which card type is used. Like this one:
+bttv-cards.c, which holds the informations required for each board.
+Sound will work only, if the correct entry is used (for video it often
+makes no difference). The bttv driver prints a line to the kernel
+log, telling which card type is used. Like this one:
- bttv0: model: BT848(Hauppauge old)
+ bttv0: model: BT848(Hauppauge old) [autodetected]
You should verify this is correct. If it is'nt, you have to pass the
correct board type as insmod argument, "insmod bttv card=2" for
-example. The file MODULES in the driver directory has a list of valid
-arguments. If your card is'nt listed there, you might check the
-source code for new entries which are not listed yet. If there is'nt
-one for your card, you can check if one of the existing entries does
-work for you (just trial and error...).
+example. The file CARDLIST has a list of valid arguments for card.
+If your card is'nt listed there, you might check the source code for
+new entries which are not listed yet. If there is'nt one for your
+card, you can check if one of the existing entries does work for you
+(just trial and error...).
Some boards have an extra processor for sound to do stereo decoding
and other nice features. The msp34xx chips are used by Hauppauge for
@@ -32,13 +32,13 @@ you might want to check the video4linux mailing list archive first...
Of course you need a correctly installed soundcard unless you have the
speakers connected directly to the grabber board. Hint: check the
-mixer settings too...
+mixer settings too. ALSA for example has everything muted by default.
How sound works in detail
=========================
-Still does'nt work? Looks like some driver hacking is required.
+Still doesn't work? Looks like some driver hacking is required.
Below is a do-it-yourself description for you.
The bt8xx chips have 32 general purpose pins, and registers to control
@@ -48,43 +48,71 @@ bt848 chip. Another one is the data register (BT848_GPIO_DATA), where
you can get/set the status if these pins. They can be used for input
and output.
-All grabber board vendors use these pins to control an external chip
+Most grabber board vendors use these pins to control an external chip
which does the sound routing. But every board is a little different.
These pins are also used by some companies to drive remote control
-receiver chips.
+receiver chips. Some boards use the i2c bus instead of the gpio pins
+to connect the mux chip.
As mentioned above, there is a array which holds the required
informations for each known board. You basically have to create a new
-line for your board. What is in there:
+line for your board. The important fields are these two:
struct tvcard
{
- char *name;
- int inputs; /* number of video inputs */
- int tuner; /* which of them is the tuner */
- int svhs; /* which of them is the svhs input */
+ [ ... ]
u32 gpiomask;
- u32 muxsel[8]; /* video mux */
- u32 audiomux[6]; /* audio mux: Tuner, Radio, external, internal, mute, stereo */
- u32 gpiomask2; /* GPIO MUX mask (this is video) */
+ u32 audiomux[5]; /* audio mux: tuner, radio, external, internal, mute */
};
-gpiomask has all bits set which are used to control the audio mux.
-This value basically goes to the gpio output enable register. It is
-also used to mask bits when switching the audio mux (which is done by
-read-modify-write on the gpio data register).
+gpiomask specifies which pins are used to control the audio mux chip.
+The corresponding bits in the output enable register
+(BT848_GPIO_OUT_EN) will be set as these pins must be driven by the
+bt848 chip.
+
+The audiomux[] array holds the data values for the different inputs
+(i.e. which pins must be high/low for tuner/mute/...). This will be
+written to the data register (BT848_GPIO_DATA) to switch the audio
+mux.
+
What you have to do is figure out the correct values for gpiomask and
the audiomux array. If you have Windows and the drivers four your
card installed, you might to check out if you can read these registers
values used by the windows driver. A tool to do this is available
-from ftp://telepresence.dmem.strath.ac.uk/pub/bt848/winutil
-If you hav'nt Windows installed, this is a trial and error game...
+from ftp://telepresence.dmem.strath.ac.uk/pub/bt848/winutil (doesn't
+work with bt878 boards according to some reports I received). You
+might also dig around in the *.ini files of the Windows applications.
+You can have a look at the board to see which of the gpio pins are
+connected at all and then start trial-and-error ...
+
+
+Starting with release 0.7.41 bttv has a number of insmod options to
+make the gpio debugging easier:
+
+bttv_gpio=0/1 enable/disable gpio debug messages
+gpiomask=n set the gpiomask value
+audiomux=i,j,... set the values of the audiomux array
+audioall=a set the values of the audiomux array (one
+ value for all array elements, useful to check
+ out which effect the particular value has).
+
+The messages printed with bttv_gpio=1 look like this:
+
+ bttv0: gpio: en=00000027, out=00000024 in=00ffffd8 [audio: off]
+
+en = output _en_able register (BT848_GPIO_OUT_EN)
+out = _out_put bits of the data register (BT848_GPIO_DATA),
+ i.e. BT848_GPIO_DATA & BT848_GPIO_OUT_EN
+in = _in_put bits of the data register,
+ i.e. BT848_GPIO_DATA & ~BT848_GPIO_OUT_EN
Good luck,
Gerd
-PS: If you have a new working entry, mail it to Ralph. So it can be
- included into next driver version...
+PS: If you have a new working entry, mail it to me.
+
+--
+Gerd Knorr <kraxel@goldbach.in-berlin.de>
diff --git a/TODO b/TODO
index 571b32a..cc136b5 100644
--- a/TODO
+++ b/TODO
@@ -3,18 +3,27 @@ TODO list isn't exactly right for this. It is more a collection of
ideas I'm thinking about. It *might* mean I have plans to implement
this in near future.
- * frequency= option for .xawtv
- * volume= option for .xawtv
+
+general
+=======
+
+ * volume= option for .xawtv (not trivial - to make this a useful feature
+ it should be a station-specific offset to the overall volume. Try to
+ get this right for every soundcard / high + low volume / ... ).
+ * mono/stereo config file options.
* videotext decoder (for station ID, maybe subtitles)
- * grayscale avi recording (anybody knows how to do this? 256 color
- with a gray palette?)
- * keep-aspect-ratio option
* switch to another toolkit, Xaw keyboard/menu support sucks
- (gtk maybe?)
- * use threads (instead of fork()ing off children)
- * mjpeg compression has alot of (partly design) problems, have to think
- about how to handle this in a clever way...
- * config file args for avi-params, numerate movies?
- * grab-v4l: use more than two buffers
- * i18n
+ gtk? Motif?
+ * config file args for avi-params?
+ * i18n/locale
+ * hotkeys/remote commands for mono/stereo/...
+ * two (more?) channel lists: "all" & "frequently used".
+
+avi
+===
+
+ * grayscale avi recording (anybody knows how to do this? 256 color
+ with a gray palette?)
+ * OpenDML index support
+ * showriff has problems with files > 2 GB. Not sure if it's me or glibc...
diff --git a/acconfig.h b/acconfig.h
index 334dcef..5097c08 100644
--- a/acconfig.h
+++ b/acconfig.h
@@ -1,8 +1,17 @@
/* MIT shared memory extention */
#undef HAVE_MITSHM
-/* jpeg lib */
-#undef HAVE_LIBJPEG
-
/* lirc lib */
#undef HAVE_LIBLIRC_CLIENT
+
+/* quicktime lib */
+#undef HAVE_LIBQUICKTIME
+
+/* Define if you have the Xdpms library (-lXdpms). */
+#undef HAVE_LIBXDPMS
+
+/* large file support */
+#undef HAVE_LFS
+
+/* ipv6 struct sockaddr_storage */
+#undef HAVE_SOCKADDR_STORAGE
diff --git a/build-test b/build-test
index 4451c4f..c661a28 100644
--- a/build-test
+++ b/build-test
@@ -19,10 +19,6 @@ autoheader || exit 1
./configure && make || exit 1
make distclean
-# no jpeg
-./configure --disable-jpeg && make || exit 1
-make distclean
-
# no lirc
./configure --disable-lirc && make || exit 1
make distclean
@@ -36,17 +32,18 @@ make distclean
make distclean
# library link order
-./configure && make CC="gcc -static" || exit 1
-make distclean
+#./configure && make CC="gcc -static" || exit 1
+#make distclean
-# 2.0.x
-kernel=`echo /usr/src/kernel/2.0.*`
+# 2.2.x kernel headers
+kernel=`echo /usr/src/kernel/2.2.17`
./configure && make CC="gcc -I$kernel/include" || exit 1
make distclean
-# egcs
-#CC=egcs ./configure && make || exit 1
-#make distclean
+# 2.4.x kernel headers
+kernel=`echo /usr/src/kernel/2.4.*`
+./configure && make CC="gcc -I$kernel/include" || exit 1
+make distclean
##########################################################################
diff --git a/capture-test b/capture-test
index 86c8fd4..e4fd2bb 100644
--- a/capture-test
+++ b/capture-test
@@ -3,7 +3,7 @@
# test capture...
#
STREAMER=src/streamer
-PLAYBACK="xanim +f +Sr +Ze -Zr"
+PLAYBACK="xanim +f +Sr +Ze -Zr -Av"
DEST=/media/test
#DEST=/usr/data/test
diff --git a/config.h.in b/config.h.in
index 00fdfd2..d44d73b 100644
--- a/config.h.in
+++ b/config.h.in
@@ -6,12 +6,39 @@
/* MIT shared memory extention */
#undef HAVE_MITSHM
-/* jpeg lib */
-#undef HAVE_LIBJPEG
-
/* lirc lib */
#undef HAVE_LIBLIRC_CLIENT
+/* quicktime lib */
+#undef HAVE_LIBQUICKTIME
+
+/* Define if you have the Xdpms library (-lXdpms). */
+#undef HAVE_LIBXDPMS
+
+/* large file support */
+#undef HAVE_LFS
+
+/* ipv6 struct sockaddr_storage */
+#undef HAVE_SOCKADDR_STORAGE
+
+/* Define if you have the ftello function. */
+#undef HAVE_FTELLO
+
+/* Define if you have the getnameinfo function. */
+#undef HAVE_GETNAMEINFO
+
+/* Define if you have the getpt function. */
+#undef HAVE_GETPT
+
+/* Define if you have the <endian.h> header file. */
+#undef HAVE_ENDIAN_H
+
+/* Define if you have the <soundcard.h> header file. */
+#undef HAVE_SOUNDCARD_H
+
+/* Define if you have the <sys/soundcard.h> header file. */
+#undef HAVE_SYS_SOUNDCARD_H
+
/* Define if you have the Xdpms library (-lXdpms). */
#undef HAVE_LIBXDPMS
@@ -23,3 +50,6 @@
/* Define if you have the Xxf86vm library (-lXxf86vm). */
#undef HAVE_LIBXXF86VM
+
+/* Define if you have the efence library (-lefence). */
+#undef HAVE_LIBEFENCE
diff --git a/configure b/configure
index 9f44a0e..3aacc9a 100755
--- a/configure
+++ b/configure
@@ -12,7 +12,7 @@ ac_help=
ac_default_prefix=/usr/local
# Any additions from configure.in:
ac_help="$ac_help
- --enable-jpeg jpeg support (for snapshots)"
+ --enable-xaw3d use Xaw3D"
ac_help="$ac_help
--enable-xfree-ext use XFree extentions (DGA,VidMode,DPMS)"
ac_help="$ac_help
@@ -20,6 +20,12 @@ ac_help="$ac_help
ac_help="$ac_help
--enable-lirc lirc support"
ac_help="$ac_help
+ --enable-quicktime quicktime support"
+ac_help="$ac_help
+ --enable-efence link against ElectricFence (malloc debug)"
+ac_help="$ac_help
+ --enable-motif enable experimental motif support"
+ac_help="$ac_help
--with-x use the X Window System"
# Initialize some variables set by options.
@@ -535,9 +541,9 @@ fi
-# Check whether --enable-jpeg or --disable-jpeg was given.
-if test "${enable_jpeg+set}" = set; then
- enableval="$enable_jpeg"
+# Check whether --enable-xaw3d or --disable-xaw3d was given.
+if test "${enable_xaw3d+set}" = set; then
+ enableval="$enable_xaw3d"
:
fi
@@ -559,13 +565,31 @@ if test "${enable_lirc+set}" = set; then
:
fi
+# Check whether --enable-quicktime or --disable-quicktime was given.
+if test "${enable_quicktime+set}" = set; then
+ enableval="$enable_quicktime"
+ :
+fi
+
+# Check whether --enable-efence or --disable-efence was given.
+if test "${enable_efence+set}" = set; then
+ enableval="$enable_efence"
+ :
+fi
+
+# Check whether --enable-motif or --disable-motif was given.
+if test "${enable_motif+set}" = set; then
+ enableval="$enable_motif"
+ :
+fi
+
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:569: checking for $ac_word" >&5
+echo "configure:593: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -595,7 +619,7 @@ if test -z "$CC"; then
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:599: checking for $ac_word" >&5
+echo "configure:623: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -646,7 +670,7 @@ fi
# Extract the first word of "cl", so it can be a program name with args.
set dummy cl; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:650: checking for $ac_word" >&5
+echo "configure:674: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -678,7 +702,7 @@ fi
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:682: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:706: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
ac_ext=c
# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -689,12 +713,12 @@ cross_compiling=$ac_cv_prog_cc_cross
cat > conftest.$ac_ext << EOF
-#line 693 "configure"
+#line 717 "configure"
#include "confdefs.h"
main(){return(0);}
EOF
-if { (eval echo configure:698: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:722: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
ac_cv_prog_cc_works=yes
# If we can't run a trivial program, we are probably using a cross compiler.
if (./conftest; exit) 2>/dev/null; then
@@ -720,12 +744,12 @@ if test $ac_cv_prog_cc_works = no; then
{ echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:724: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:748: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
cross_compiling=$ac_cv_prog_cc_cross
echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:729: checking whether we are using GNU C" >&5
+echo "configure:753: checking whether we are using GNU C" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -734,7 +758,7 @@ else
yes;
#endif
EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:738: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:762: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gcc=yes
else
ac_cv_prog_gcc=no
@@ -753,7 +777,7 @@ ac_test_CFLAGS="${CFLAGS+set}"
ac_save_CFLAGS="$CFLAGS"
CFLAGS=
echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:757: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:781: checking whether ${CC-cc} accepts -g" >&5
if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -785,7 +809,7 @@ else
fi
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:789: checking how to run the C preprocessor" >&5
+echo "configure:813: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
@@ -800,13 +824,13 @@ else
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
cat > conftest.$ac_ext <<EOF
-#line 804 "configure"
+#line 828 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:810: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:834: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@@ -817,13 +841,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
-#line 821 "configure"
+#line 845 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:827: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:851: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@@ -834,13 +858,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -nologo -E"
cat > conftest.$ac_ext <<EOF
-#line 838 "configure"
+#line 862 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:844: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:868: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
@@ -896,7 +920,7 @@ ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:900: checking for a BSD compatible install" >&5
+echo "configure:924: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -953,7 +977,7 @@ do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:957: checking for $ac_word" >&5
+echo "configure:981: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_DEPEND'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -986,12 +1010,385 @@ test -n "$DEPEND" || DEPEND="true"
+echo $ac_n "checking for open64""... $ac_c" 1>&6
+echo "configure:1015: checking for open64" >&5
+if eval "test \"`echo '$''{'ac_cv_func_open64'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1020 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char open64(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char open64();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_open64) || defined (__stub___open64)
+choke me
+#else
+open64();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:1043: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_open64=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_open64=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'open64`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ cat >> confdefs.h <<\EOF
+#define HAVE_LFS 1
+EOF
+
+ CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64"
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+for ac_func in ftello getpt getnameinfo
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:1069: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1074 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:1097: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+cat > conftest.$ac_ext <<EOF
+#line 1122 "configure"
+#include "confdefs.h"
+#include <sys/socket.h>
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "sockaddr_storage" >/dev/null 2>&1; then
+ rm -rf conftest*
+ cat >> confdefs.h <<\EOF
+#define HAVE_SOCKADDR_STORAGE 1
+EOF
+
+fi
+rm -f conftest*
+
+for ac_hdr in endian.h soundcard.h sys/soundcard.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:1140: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1145 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1150: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=yes"
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+done
+
+
+echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6
+echo "configure:1178: checking for pthread_create in -lpthread" >&5
+ac_lib_var=`echo pthread'_'pthread_create | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lpthread $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 1186 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char pthread_create();
+
+int main() {
+pthread_create()
+; return 0; }
+EOF
+if { (eval echo configure:1197: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ LIBPTHREAD="-lpthread"
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+if test "$LIBPTHREAD" = ""; then
+ echo $ac_n "checking for pthread_create in -lc_r""... $ac_c" 1>&6
+echo "configure:1219: checking for pthread_create in -lc_r" >&5
+ac_lib_var=`echo c_r'_'pthread_create | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lc_r $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 1227 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char pthread_create();
+
+int main() {
+pthread_create()
+; return 0; }
+EOF
+if { (eval echo configure:1238: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ LIBPTHREAD="-lc_r"
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+fi
+echo $ac_n "checking for main in -lossaudio""... $ac_c" 1>&6
+echo "configure:1260: checking for main in -lossaudio" >&5
+ac_lib_var=`echo ossaudio'_'main | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lossaudio $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 1268 "configure"
+#include "confdefs.h"
+
+int main() {
+main()
+; return 0; }
+EOF
+if { (eval echo configure:1275: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ LIBSOUND="-lossaudio"
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+echo $ac_n "checking for initscr in -lncurses""... $ac_c" 1>&6
+echo "configure:1296: checking for initscr in -lncurses" >&5
+ac_lib_var=`echo ncurses'_'initscr | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lncurses $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 1304 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char initscr();
+
+int main() {
+initscr()
+; return 0; }
+EOF
+if { (eval echo configure:1315: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ LIBCURSES="-lncurses"
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+if test "$LIBCURSES" = ""; then
+ echo $ac_n "checking for initscr in -lcurses""... $ac_c" 1>&6
+echo "configure:1337: checking for initscr in -lcurses" >&5
+ac_lib_var=`echo curses'_'initscr | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lcurses $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 1345 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char initscr();
+
+int main() {
+initscr()
+; return 0; }
+EOF
+if { (eval echo configure:1356: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ LIBCURSES="-lcurses"
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+fi
+if test "$LIBCURSES" = ""; then
+ echo "Oops: (n)curses library not found. You need this one, please install."
+ exit 1
+fi
+
+
+
+
+
+
# If we find X, set shell vars x_includes and x_libraries to the
# paths, otherwise set no_x=yes.
# Uses ac_ vars as temps to allow command line to override cache and checks.
# --without-x overrides everything else, but does not touch the cache.
echo $ac_n "checking for X""... $ac_c" 1>&6
-echo "configure:995: checking for X" >&5
+echo "configure:1392: checking for X" >&5
# Check whether --with-x or --without-x was given.
if test "${with_x+set}" = set; then
@@ -1053,12 +1450,12 @@ if test "$ac_x_includes" = NO; then
# First, try using that file with no special directory specified.
cat > conftest.$ac_ext <<EOF
-#line 1057 "configure"
+#line 1454 "configure"
#include "confdefs.h"
#include <$x_direct_test_include>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1062: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1459: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -1127,14 +1524,14 @@ if test "$ac_x_libraries" = NO; then
ac_save_LIBS="$LIBS"
LIBS="-l$x_direct_test_library $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1131 "configure"
+#line 1528 "configure"
#include "confdefs.h"
int main() {
${x_direct_test_function}()
; return 0; }
EOF
-if { (eval echo configure:1138: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1535: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
LIBS="$ac_save_LIBS"
# We can link X programs with no special library path.
@@ -1240,17 +1637,17 @@ else
case "`(uname -sr) 2>/dev/null`" in
"SunOS 5"*)
echo $ac_n "checking whether -R must be followed by a space""... $ac_c" 1>&6
-echo "configure:1244: checking whether -R must be followed by a space" >&5
+echo "configure:1641: checking whether -R must be followed by a space" >&5
ac_xsave_LIBS="$LIBS"; LIBS="$LIBS -R$x_libraries"
cat > conftest.$ac_ext <<EOF
-#line 1247 "configure"
+#line 1644 "configure"
#include "confdefs.h"
int main() {
; return 0; }
EOF
-if { (eval echo configure:1254: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1651: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ac_R_nospace=yes
else
@@ -1266,14 +1663,14 @@ rm -f conftest*
else
LIBS="$ac_xsave_LIBS -R $x_libraries"
cat > conftest.$ac_ext <<EOF
-#line 1270 "configure"
+#line 1667 "configure"
#include "confdefs.h"
int main() {
; return 0; }
EOF
-if { (eval echo configure:1277: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1674: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
ac_R_space=yes
else
@@ -1305,7 +1702,7 @@ rm -f conftest*
# libraries were built with DECnet support. And karl@cs.umb.edu says
# the Alpha needs dnet_stub (dnet does not exist).
echo $ac_n "checking for dnet_ntoa in -ldnet""... $ac_c" 1>&6
-echo "configure:1309: checking for dnet_ntoa in -ldnet" >&5
+echo "configure:1706: checking for dnet_ntoa in -ldnet" >&5
ac_lib_var=`echo dnet'_'dnet_ntoa | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -1313,7 +1710,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldnet $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1317 "configure"
+#line 1714 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -1324,7 +1721,7 @@ int main() {
dnet_ntoa()
; return 0; }
EOF
-if { (eval echo configure:1328: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1725: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -1346,7 +1743,7 @@ fi
if test $ac_cv_lib_dnet_dnet_ntoa = no; then
echo $ac_n "checking for dnet_ntoa in -ldnet_stub""... $ac_c" 1>&6
-echo "configure:1350: checking for dnet_ntoa in -ldnet_stub" >&5
+echo "configure:1747: checking for dnet_ntoa in -ldnet_stub" >&5
ac_lib_var=`echo dnet_stub'_'dnet_ntoa | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -1354,7 +1751,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldnet_stub $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1358 "configure"
+#line 1755 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -1365,7 +1762,7 @@ int main() {
dnet_ntoa()
; return 0; }
EOF
-if { (eval echo configure:1369: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1766: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -1394,12 +1791,12 @@ fi
# The nsl library prevents programs from opening the X display
# on Irix 5.2, according to dickey@clark.net.
echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6
-echo "configure:1398: checking for gethostbyname" >&5
+echo "configure:1795: checking for gethostbyname" >&5
if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1403 "configure"
+#line 1800 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char gethostbyname(); below. */
@@ -1422,7 +1819,7 @@ gethostbyname();
; return 0; }
EOF
-if { (eval echo configure:1426: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1823: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_gethostbyname=yes"
else
@@ -1443,7 +1840,7 @@ fi
if test $ac_cv_func_gethostbyname = no; then
echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6
-echo "configure:1447: checking for gethostbyname in -lnsl" >&5
+echo "configure:1844: checking for gethostbyname in -lnsl" >&5
ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -1451,7 +1848,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lnsl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1455 "configure"
+#line 1852 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -1462,7 +1859,7 @@ int main() {
gethostbyname()
; return 0; }
EOF
-if { (eval echo configure:1466: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1863: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -1492,12 +1889,12 @@ fi
# -lsocket must be given before -lnsl if both are needed.
# We assume that if connect needs -lnsl, so does gethostbyname.
echo $ac_n "checking for connect""... $ac_c" 1>&6
-echo "configure:1496: checking for connect" >&5
+echo "configure:1893: checking for connect" >&5
if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1501 "configure"
+#line 1898 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char connect(); below. */
@@ -1520,7 +1917,7 @@ connect();
; return 0; }
EOF
-if { (eval echo configure:1524: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1921: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_connect=yes"
else
@@ -1541,7 +1938,7 @@ fi
if test $ac_cv_func_connect = no; then
echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6
-echo "configure:1545: checking for connect in -lsocket" >&5
+echo "configure:1942: checking for connect in -lsocket" >&5
ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -1549,7 +1946,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lsocket $X_EXTRA_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1553 "configure"
+#line 1950 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -1560,7 +1957,7 @@ int main() {
connect()
; return 0; }
EOF
-if { (eval echo configure:1564: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1961: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -1584,12 +1981,12 @@ fi
# gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX.
echo $ac_n "checking for remove""... $ac_c" 1>&6
-echo "configure:1588: checking for remove" >&5
+echo "configure:1985: checking for remove" >&5
if eval "test \"`echo '$''{'ac_cv_func_remove'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1593 "configure"
+#line 1990 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char remove(); below. */
@@ -1612,7 +2009,7 @@ remove();
; return 0; }
EOF
-if { (eval echo configure:1616: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2013: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_remove=yes"
else
@@ -1633,7 +2030,7 @@ fi
if test $ac_cv_func_remove = no; then
echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6
-echo "configure:1637: checking for remove in -lposix" >&5
+echo "configure:2034: checking for remove in -lposix" >&5
ac_lib_var=`echo posix'_'remove | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -1641,7 +2038,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lposix $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1645 "configure"
+#line 2042 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -1652,7 +2049,7 @@ int main() {
remove()
; return 0; }
EOF
-if { (eval echo configure:1656: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2053: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -1676,12 +2073,12 @@ fi
# BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.
echo $ac_n "checking for shmat""... $ac_c" 1>&6
-echo "configure:1680: checking for shmat" >&5
+echo "configure:2077: checking for shmat" >&5
if eval "test \"`echo '$''{'ac_cv_func_shmat'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1685 "configure"
+#line 2082 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char shmat(); below. */
@@ -1704,7 +2101,7 @@ shmat();
; return 0; }
EOF
-if { (eval echo configure:1708: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2105: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_shmat=yes"
else
@@ -1725,7 +2122,7 @@ fi
if test $ac_cv_func_shmat = no; then
echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6
-echo "configure:1729: checking for shmat in -lipc" >&5
+echo "configure:2126: checking for shmat in -lipc" >&5
ac_lib_var=`echo ipc'_'shmat | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -1733,7 +2130,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lipc $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1737 "configure"
+#line 2134 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -1744,7 +2141,7 @@ int main() {
shmat()
; return 0; }
EOF
-if { (eval echo configure:1748: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2145: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -1777,7 +2174,7 @@ fi
# libraries we check for below, so use a different variable.
# --interran@uluru.Stanford.EDU, kb@cs.umb.edu.
echo $ac_n "checking for IceConnectionNumber in -lICE""... $ac_c" 1>&6
-echo "configure:1781: checking for IceConnectionNumber in -lICE" >&5
+echo "configure:2178: checking for IceConnectionNumber in -lICE" >&5
ac_lib_var=`echo ICE'_'IceConnectionNumber | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -1785,7 +2182,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lICE $X_EXTRA_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1789 "configure"
+#line 2186 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -1796,7 +2193,7 @@ int main() {
IceConnectionNumber()
; return 0; }
EOF
-if { (eval echo configure:1800: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2197: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -1829,8 +2226,9 @@ fi
-echo $ac_n "checking for Xaw3dComputeTopShadowRGB in -lXaw3d""... $ac_c" 1>&6
-echo "configure:1834: checking for Xaw3dComputeTopShadowRGB in -lXaw3d" >&5
+if test "$enable_xaw3d" != "no"; then
+ echo $ac_n "checking for Xaw3dComputeTopShadowRGB in -lXaw3d""... $ac_c" 1>&6
+echo "configure:2232: checking for Xaw3dComputeTopShadowRGB in -lXaw3d" >&5
ac_lib_var=`echo Xaw3d'_'Xaw3dComputeTopShadowRGB | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -1838,7 +2236,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lXaw3d $X_LIBS $X_PRE_LIBS -lXext -lXmu -lXt -lX11 $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1842 "configure"
+#line 2240 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -1849,7 +2247,7 @@ int main() {
Xaw3dComputeTopShadowRGB()
; return 0; }
EOF
-if { (eval echo configure:1853: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2251: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -1870,13 +2268,16 @@ else
XAWLIB=Xaw
fi
+else
+ echo "*** Xaw3D disabled"
+ XAWLIB=Xaw
+fi
-JPEG=""
-if test "$enable_jpeg" != "no"; then
- echo $ac_n "checking for jpeg_start_compress in -ljpeg""... $ac_c" 1>&6
-echo "configure:1880: checking for jpeg_start_compress in -ljpeg" >&5
+GFXLIBS="";
+echo $ac_n "checking for jpeg_start_compress in -ljpeg""... $ac_c" 1>&6
+echo "configure:2281: checking for jpeg_start_compress in -ljpeg" >&5
ac_lib_var=`echo jpeg'_'jpeg_start_compress | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -1884,7 +2285,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ljpeg $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1888 "configure"
+#line 2289 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -1895,7 +2296,7 @@ int main() {
jpeg_start_compress()
; return 0; }
EOF
-if { (eval echo configure:1899: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2300: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -1910,23 +2311,72 @@ LIBS="$ac_save_LIBS"
fi
if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
echo "$ac_t""yes" 1>&6
- cat >> confdefs.h <<\EOF
-#define HAVE_LIBJPEG 1
-EOF
- JPEG="-ljpeg"
+ GFXLIBS="-ljpeg"; JPEG="found"
else
echo "$ac_t""no" 1>&6
fi
+if test "$JPEG" != "found"; then
+ echo "Oops: jpeg library not found. You need this one, please install."
+ exit 1
+fi
+
+if test "$enable_efence" = "yes"; then
+ echo "*** ElectricFence (malloc debugger) enabled"
+ echo $ac_n "checking for EF_Print in -lefence""... $ac_c" 1>&6
+echo "configure:2328: checking for EF_Print in -lefence" >&5
+ac_lib_var=`echo efence'_'EF_Print | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
else
- echo "*** jpeg disabled"
+ ac_save_LIBS="$LIBS"
+LIBS="-lefence $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 2336 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char EF_Print();
+
+int main() {
+EF_Print()
+; return 0; }
+EOF
+if { (eval echo configure:2347: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ ac_tr_lib=HAVE_LIB`echo efence | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+ cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+ LIBS="-lefence $LIBS"
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+
fi
LIRC=""
if test "$enable_lirc" != "no"; then
echo $ac_n "checking for lirc_init in -llirc_client""... $ac_c" 1>&6
-echo "configure:1930: checking for lirc_init in -llirc_client" >&5
+echo "configure:2380: checking for lirc_init in -llirc_client" >&5
ac_lib_var=`echo lirc_client'_'lirc_init | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -1934,7 +2384,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-llirc_client $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1938 "configure"
+#line 2388 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -1945,7 +2395,7 @@ int main() {
lirc_init()
; return 0; }
EOF
-if { (eval echo configure:1949: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2399: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -1972,9 +2422,101 @@ else
echo "*** lirc disabled"
fi
+if test "$enable_quicktime" != "no"; then
+ echo $ac_n "checking for png_read_info in -lpng""... $ac_c" 1>&6
+echo "configure:2428: checking for png_read_info in -lpng" >&5
+ac_lib_var=`echo png'_'png_read_info | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lpng $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 2436 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char png_read_info();
+
+int main() {
+png_read_info()
+; return 0; }
+EOF
+if { (eval echo configure:2447: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ GFXLIBS="-lpng $GFXLIBS"; PNG="found"
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ if test "$PNG" = "found"; then
+ echo $ac_n "checking for quicktime_open in -lquicktime""... $ac_c" 1>&6
+echo "configure:2469: checking for quicktime_open in -lquicktime" >&5
+ac_lib_var=`echo quicktime'_'quicktime_open | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lquicktime -lglib -ljpeg -lpng $LIBPTHREAD $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 2477 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char quicktime_open();
+
+int main() {
+quicktime_open()
+; return 0; }
+EOF
+if { (eval echo configure:2488: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ GFXLIBS="-lquicktime -lglib $GFXLIBS";cat >> confdefs.h <<\EOF
+#define HAVE_LIBQUICKTIME 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ else
+ echo "*** libpng not found: no quicktime support, sorry"
+ fi
+else
+ echo "*** quicktime disabled"
+fi
+
if test "$enable_xfree_ext" != "no"; then
echo $ac_n "checking for XF86DGAQueryExtension in -lXxf86dga""... $ac_c" 1>&6
-echo "configure:1978: checking for XF86DGAQueryExtension in -lXxf86dga" >&5
+echo "configure:2520: checking for XF86DGAQueryExtension in -lXxf86dga" >&5
ac_lib_var=`echo Xxf86dga'_'XF86DGAQueryExtension | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -1982,7 +2524,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lXxf86dga $X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1986 "configure"
+#line 2528 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -1993,7 +2535,7 @@ int main() {
XF86DGAQueryExtension()
; return 0; }
EOF
-if { (eval echo configure:1997: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2539: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -2021,7 +2563,7 @@ else
fi
echo $ac_n "checking for XF86VidModeQueryExtension in -lXxf86vm""... $ac_c" 1>&6
-echo "configure:2025: checking for XF86VidModeQueryExtension in -lXxf86vm" >&5
+echo "configure:2567: checking for XF86VidModeQueryExtension in -lXxf86vm" >&5
ac_lib_var=`echo Xxf86vm'_'XF86VidModeQueryExtension | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -2029,7 +2571,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lXxf86vm $X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2033 "configure"
+#line 2575 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -2040,7 +2582,7 @@ int main() {
XF86VidModeQueryExtension()
; return 0; }
EOF
-if { (eval echo configure:2044: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2586: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -2068,7 +2610,7 @@ else
fi
echo $ac_n "checking for DPMSQueryExtension in -lXdpms""... $ac_c" 1>&6
-echo "configure:2072: checking for DPMSQueryExtension in -lXdpms" >&5
+echo "configure:2614: checking for DPMSQueryExtension in -lXdpms" >&5
ac_lib_var=`echo Xdpms'_'DPMSQueryExtension | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -2076,7 +2618,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lXdpms $X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2080 "configure"
+#line 2622 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -2087,7 +2629,7 @@ int main() {
DPMSQueryExtension()
; return 0; }
EOF
-if { (eval echo configure:2091: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2633: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -2114,13 +2656,58 @@ else
echo "$ac_t""no" 1>&6
fi
+ if test "$ac_cv_lib_Xdpms_DPMSQueryExtension" = "no"; then
+ echo $ac_n "checking for DPMSQueryExtension in -lXext""... $ac_c" 1>&6
+echo "configure:2662: checking for DPMSQueryExtension in -lXext" >&5
+ac_lib_var=`echo Xext'_'DPMSQueryExtension | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lXext $X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 2670 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char DPMSQueryExtension();
+
+int main() {
+DPMSQueryExtension()
+; return 0; }
+EOF
+if { (eval echo configure:2681: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ cat >> confdefs.h <<\EOF
+#define HAVE_LIBXDPMS 1
+EOF
+
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+ fi
else
echo "*** XFree extentions disabled"
fi
if test "$enable_xvideo" != "no"; then
echo $ac_n "checking for XvQueryExtension in -lXv""... $ac_c" 1>&6
-echo "configure:2124: checking for XvQueryExtension in -lXv" >&5
+echo "configure:2711: checking for XvQueryExtension in -lXv" >&5
ac_lib_var=`echo Xv'_'XvQueryExtension | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -2128,7 +2715,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lXv $X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2132 "configure"
+#line 2719 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -2139,7 +2726,7 @@ int main() {
XvQueryExtension()
; return 0; }
EOF
-if { (eval echo configure:2143: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2730: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -2170,8 +2757,14 @@ else
echo "*** Xvideo extention disabled"
fi
+
+MOTIF=""
+if test "$enable_motif" = "yes"; then
+ MOTIF="motv"
+fi
+
echo $ac_n "checking for XShmAttach in -lXext""... $ac_c" 1>&6
-echo "configure:2175: checking for XShmAttach in -lXext" >&5
+echo "configure:2768: checking for XShmAttach in -lXext" >&5
ac_lib_var=`echo Xext'_'XShmAttach | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -2179,7 +2772,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lXext $X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2183 "configure"
+#line 2776 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -2190,7 +2783,7 @@ int main() {
XShmAttach()
; return 0; }
EOF
-if { (eval echo configure:2194: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2787: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -2214,8 +2807,26 @@ else
fi
+XAWTV_VERSION="`(cd $srcdir; pwd) | sed -e 's/.*-//'`"
+
+
+echo $ac_n "checking for X11 config directory""... $ac_c" 1>&6
+echo "configure:2815: checking for X11 config directory" >&5
+x11conf=/usr/X11R6/lib/X11
+if test -d /etc/X11; then
+ x11conf=/etc/X11
+fi
+echo "$ac_t""$x11conf" 1>&6
+
+
+echo $ac_n "checking for X11 app-defaults directory""... $ac_c" 1>&6
+echo "configure:2824: checking for X11 app-defaults directory" >&5
+resdir=/usr/X11R6/lib/X11/app-defaults
+if test -d /etc/X11/app-defaults; then
+ resdir=/etc/X11/app-defaults
+fi
+echo "$ac_t""$resdir" 1>&6
-XAWTV_VERSION="`pwd | sed -e 's/.*xawtv-\([a-z0-9.]\+\).*/\1/'`"
trap '' 1 2 15
@@ -2320,7 +2931,8 @@ ac_given_srcdir=$srcdir
ac_given_INSTALL="$INSTALL"
trap 'rm -fr `echo "Makefile src/Makefile tools/Makefile radio/Makefile
- man/Makefile i2c/Makefile font/Makefile webcam/Makefile xawtv.spec config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
+ man/Makefile i2c/Makefile font/Makefile webcam/Makefile
+ http/Makefile libvbi/Makefile xawtv.spec config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
EOF
cat >> $CONFIG_STATUS <<EOF
@@ -2358,15 +2970,21 @@ s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
s%@INSTALL_DATA@%$INSTALL_DATA%g
s%@DEPEND@%$DEPEND%g
+s%@LIBPTHREAD@%$LIBPTHREAD%g
+s%@LIBSOUND@%$LIBSOUND%g
+s%@LIBCURSES@%$LIBCURSES%g
s%@X_CFLAGS@%$X_CFLAGS%g
s%@X_PRE_LIBS@%$X_PRE_LIBS%g
s%@X_LIBS@%$X_LIBS%g
s%@X_EXTRA_LIBS@%$X_EXTRA_LIBS%g
s%@x_libraries@%$x_libraries%g
s%@XAWLIB@%$XAWLIB%g
-s%@JPEG@%$JPEG%g
+s%@GFXLIBS@%$GFXLIBS%g
s%@LIRC@%$LIRC%g
+s%@MOTIF@%$MOTIF%g
s%@XAWTV_VERSION@%$XAWTV_VERSION%g
+s%@x11conf@%$x11conf%g
+s%@resdir@%$resdir%g
CEOF
EOF
@@ -2409,7 +3027,8 @@ EOF
cat >> $CONFIG_STATUS <<EOF
CONFIG_FILES=\${CONFIG_FILES-"Makefile src/Makefile tools/Makefile radio/Makefile
- man/Makefile i2c/Makefile font/Makefile webcam/Makefile xawtv.spec"}
+ man/Makefile i2c/Makefile font/Makefile webcam/Makefile
+ http/Makefile libvbi/Makefile xawtv.spec"}
EOF
cat >> $CONFIG_STATUS <<\EOF
for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
diff --git a/configure.in b/configure.in
index 19f5795..43e8096 100644
--- a/configure.in
+++ b/configure.in
@@ -8,14 +8,20 @@ AC_CONFIG_HEADER(config.h)
dnl ---------------------------------------------------------------------
dnl Options
-AC_ARG_ENABLE(jpeg,
- [ --enable-jpeg jpeg support (for snapshots)])
+AC_ARG_ENABLE(xaw3d,
+ [ --enable-xaw3d use Xaw3D])
AC_ARG_ENABLE(xfree-ext,
[ --enable-xfree-ext use XFree extentions (DGA,VidMode,DPMS)])
AC_ARG_ENABLE(xvideo,
[ --enable-xvideo use the Xvideo extention])
AC_ARG_ENABLE(lirc,
[ --enable-lirc lirc support])
+AC_ARG_ENABLE(quicktime,
+ [ --enable-quicktime quicktime support])
+AC_ARG_ENABLE(efence,
+ [ --enable-efence link against ElectricFence (malloc debug)])
+AC_ARG_ENABLE(motif,
+ [ --enable-motif enable experimental motif support])
dnl ---------------------------------------------------------------------
@@ -29,6 +35,34 @@ AC_CHECK_PROGS(DEPEND,gccmakedep makedepend,true)
dnl ---------------------------------------------------------------------
+dnl Checks for functions
+
+AC_CHECK_FUNC(open64,
+ AC_DEFINE(HAVE_LFS)
+ CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64")
+AC_CHECK_FUNCS(ftello getpt getnameinfo)
+AC_EGREP_HEADER(sockaddr_storage,sys/socket.h,AC_DEFINE(HAVE_SOCKADDR_STORAGE))
+AC_CHECK_HEADERS(endian.h soundcard.h sys/soundcard.h)
+
+AC_CHECK_LIB(pthread,pthread_create,LIBPTHREAD="-lpthread")
+if test "$LIBPTHREAD" = ""; then
+ AC_CHECK_LIB(c_r,pthread_create,LIBPTHREAD="-lc_r")
+fi
+AC_CHECK_LIB(ossaudio,main,LIBSOUND="-lossaudio")
+AC_CHECK_LIB(ncurses,initscr,LIBCURSES="-lncurses")
+if test "$LIBCURSES" = ""; then
+ AC_CHECK_LIB(curses,initscr,LIBCURSES="-lcurses")
+fi
+if test "$LIBCURSES" = ""; then
+ echo "Oops: (n)curses library not found. You need this one, please install."
+ exit 1
+fi
+AC_SUBST(LIBPTHREAD)
+AC_SUBST(LIBSOUND)
+AC_SUBST(LIBCURSES)
+
+
+dnl ---------------------------------------------------------------------
dnl X11 checks
AC_PATH_XTRA
@@ -41,17 +75,27 @@ AC_SUBST(X_EXTRA_LIBS)
AC_SUBST(X_LIBS)
AC_SUBST(x_libraries)
-AC_CHECK_LIB(Xaw3d, Xaw3dComputeTopShadowRGB,
- XAWLIB=Xaw3d, XAWLIB=Xaw,
- $X_LIBS $X_PRE_LIBS -lXext -lXmu -lXt -lX11)
+if test "$enable_xaw3d" != "no"; then
+ AC_CHECK_LIB(Xaw3d, Xaw3dComputeTopShadowRGB,
+ XAWLIB=Xaw3d, XAWLIB=Xaw,
+ $X_LIBS $X_PRE_LIBS -lXext -lXmu -lXt -lX11)
+else
+ echo "*** Xaw3D disabled"
+ XAWLIB=Xaw
+fi
AC_SUBST(XAWLIB)
-AC_SUBST(JPEG)
-JPEG=""
-if test "$enable_jpeg" != "no"; then
- AC_CHECK_LIB(jpeg, jpeg_start_compress,AC_DEFINE(HAVE_LIBJPEG) JPEG="-ljpeg",,)
-else
- echo "*** jpeg disabled"
+AC_SUBST(GFXLIBS)
+GFXLIBS="";
+AC_CHECK_LIB(jpeg, jpeg_start_compress, GFXLIBS="-ljpeg"; JPEG="found",,)
+if test "$JPEG" != "found"; then
+ echo "Oops: jpeg library not found. You need this one, please install."
+ exit 1
+fi
+
+if test "$enable_efence" = "yes"; then
+ echo "*** ElectricFence (malloc debugger) enabled"
+ AC_CHECK_LIB(efence, EF_Print)
fi
AC_SUBST(LIRC)
@@ -63,6 +107,19 @@ else
echo "*** lirc disabled"
fi
+if test "$enable_quicktime" != "no"; then
+ AC_CHECK_LIB(png, png_read_info, GFXLIBS="-lpng $GFXLIBS"; PNG="found")
+ if test "$PNG" = "found"; then
+ AC_CHECK_LIB(quicktime, quicktime_open,
+ GFXLIBS="-lquicktime -lglib $GFXLIBS";AC_DEFINE(HAVE_LIBQUICKTIME),,
+ -lglib -ljpeg -lpng $LIBPTHREAD)
+ else
+ echo "*** libpng not found: no quicktime support, sorry"
+ fi
+else
+ echo "*** quicktime disabled"
+fi
+
if test "$enable_xfree_ext" != "no"; then
AC_CHECK_LIB(Xxf86dga, XF86DGAQueryExtension,,,
$X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS)
@@ -70,6 +127,10 @@ if test "$enable_xfree_ext" != "no"; then
$X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS)
AC_CHECK_LIB(Xdpms, DPMSQueryExtension,,,
$X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS)
+ if test "$ac_cv_lib_Xdpms_DPMSQueryExtension" = "no"; then
+ AC_CHECK_LIB(Xext, DPMSQueryExtension,AC_DEFINE(HAVE_LIBXDPMS),,
+ $X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS)
+ fi
else
echo "*** XFree extentions disabled"
fi
@@ -81,13 +142,37 @@ else
echo "*** Xvideo extention disabled"
fi
+AC_SUBST(MOTIF)
+MOTIF=""
+if test "$enable_motif" = "yes"; then
+ MOTIF="motv"
+fi
+
AC_CHECK_LIB(Xext, XShmAttach,AC_DEFINE(HAVE_MITSHM),,
$X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS)
-
-XAWTV_VERSION="`pwd | sed -e 's/.*xawtv-\([[a-z0-9.]]\+\).*/\1/'`"
+XAWTV_VERSION="`(cd $srcdir; pwd) | sed -e 's/.*-//'`"
AC_SUBST(XAWTV_VERSION)
dnl ---------------------------------------------------------------------
+AC_MSG_CHECKING(for X11 config directory)
+x11conf=/usr/X11R6/lib/X11
+if test -d /etc/X11; then
+ x11conf=/etc/X11
+fi
+AC_MSG_RESULT($x11conf)
+AC_SUBST(x11conf)
+
+AC_MSG_CHECKING(for X11 app-defaults directory)
+resdir=/usr/X11R6/lib/X11/app-defaults
+if test -d /etc/X11/app-defaults; then
+ resdir=/etc/X11/app-defaults
+fi
+AC_MSG_RESULT($resdir)
+AC_SUBST(resdir)
+
+
+dnl ---------------------------------------------------------------------
AC_OUTPUT(Makefile src/Makefile tools/Makefile radio/Makefile
- man/Makefile i2c/Makefile font/Makefile webcam/Makefile xawtv.spec)
+ man/Makefile i2c/Makefile font/Makefile webcam/Makefile
+ http/Makefile libvbi/Makefile xawtv.spec)
diff --git a/contrib/cc/Makefile b/contrib/cc/Makefile
new file mode 100644
index 0000000..24e6c44
--- /dev/null
+++ b/contrib/cc/Makefile
@@ -0,0 +1,8 @@
+
+CC=gcc
+CFLAGS=-Wall -g -O2
+
+all: cc
+
+clean:
+ -rm -f cc *~
diff --git a/contrib/cc/cc.c b/contrib/cc/cc.c
new file mode 100644
index 0000000..80c9ec0
--- /dev/null
+++ b/contrib/cc/cc.c
@@ -0,0 +1,641 @@
+/* cc.c -- closed caption decoder
+ * Mike Baker (mbm@linux.com)
+ * (based on code by timecop@japan.co.jp)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <unistd.h>
+#include <string.h>
+#include <ctype.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <sys/ioctl.h>
+#include <sys/types.h>
+#include <sys/time.h>
+#include <getopt.h>
+
+
+
+
+//#define XWIN 1 // visual debugging
+
+#ifdef XWIN
+ #include <X11/X.h>
+ #include <X11/Xlib.h>
+ #include <X11/Xutil.h>
+ #include <X11/Xproto.h>
+ Display *dpy;
+ Window Win,Root;
+ char dpyname[256] = "";
+ GC WinGC;
+ GC WinGC0;
+ GC WinGC1;
+ int x;
+#endif
+
+
+//XDSdecode
+char info[8][25][256];
+char newinfo[8][25][256];
+char *infoptr=newinfo[0][0];
+int mode,type;
+char infochecksum;
+
+//ccdecode
+char *ratings[] = {"(NOT RATED)","TV-Y","TV-Y7","TV-G","TV-PG","TV-14","TV-MA","(NOT RATED)"};
+int rowdata[] = {11,-1,1,2,3,4,12,13,14,15,5,6,7,8,9,10};
+char *specialchar[] = {"","","","","(TM)","","","o/~ ",""," ","","","","","",""};
+char *modes[]={"current","future","channel","miscellaneous","public service","reserved","invalid","invalid","invalid","invalid"};
+int lastcode;
+int ccmode=1; //cc1 or cc2
+char ccbuf[3][256]; //cc is 32 columns per row, this allows for extra characters
+int keywords=0;
+char *keyword[32];
+
+
+//args (this should probably be put into a structure later)
+char useraw=0;
+char usexds=0;
+char usecc=0;
+char plain=0;
+char usesen=0;
+
+char rawline=-1;
+
+int sen;
+int inval;
+
+int parityok(int n) /* check parity for 2 bytes packed in n */
+{
+ int mask=0;
+ int j, k;
+ for (k = 1, j = 0; j < 7; j++) {
+ if (n & (1<<j))
+ k++;
+ }
+ if ((k & 1) == ((n>>7)&1))
+ mask|=0x00FF;
+ for (k = 1, j = 8; j < 15; j++) {
+ if (n & (1<<j))
+ k++;
+ }
+ if ((k & 1) == ((n>>15)&1))
+ mask|=0xFF00;
+ return mask;
+}
+
+int decodebit(unsigned char *data, int threshold)
+{
+ int i, sum = 0;
+ for (i = 0; i < 23; i++)
+ sum += data[i];
+ return (sum > threshold*23);
+}
+
+int decode(unsigned char *vbiline)
+{
+ int max[7], min[7], val[7], i, clk, tmp, sample, packedbits = 0;
+
+ for (clk=0; clk<7; clk++)
+ max[clk] = min[clk] = val[clk] = -1;
+ clk = tmp = 0;
+ i=30;
+
+ while (i < 600 && clk < 7) { /* find and lock all 7 clocks */
+ sample = vbiline[i];
+ if (max[clk] < 0) { /* find maximum value before drop */
+ if (sample > 85 && sample > val[clk])
+ (val[clk] = sample, tmp = i); /* mark new maximum found */
+ else if (val[clk] - sample > 30) /* far enough */
+ (max[clk] = tmp, i = tmp + 10);
+ } else { /* find minimum value after drop */
+ if (sample < 85 && sample < val[clk])
+ (val[clk] = sample, tmp = i); /* mark new minimum found */
+ else if (sample - val[clk] > 30) /* searched far enough */
+ (min[clk++] = tmp, i = tmp + 10);
+ }
+ i++;
+ }
+
+ i=min[6]=min[5]-max[5]+max[6];
+
+ if (clk != 7 || vbiline[max[3]] - vbiline[min[5]] < 45) /* failure to locate clock lead-in */
+ return -1;
+
+#ifdef XWIN
+ for (clk=0;clk<7;clk++)
+ {
+ XDrawLine(dpy,Win,WinGC,min[clk]/2,0,min[clk]/2,128);
+ XDrawLine(dpy,Win,WinGC1,max[clk]/2,0,max[clk]/2,128);
+ }
+ XFlush(dpy);
+#endif
+
+
+ /* calculate threshold */
+ for (i=0,sample=0;i<7;i++)
+ sample=(sample + vbiline[min[i]] + vbiline[max[i]])/3;
+
+ for(i=min[6];vbiline[i]<sample;i++);
+
+#ifdef XWIN
+ for (clk=i;clk<i+57*18;clk+=57)
+ XDrawLine(dpy,Win,WinGC,clk/2,0,clk/2,128);
+ XFlush(dpy);
+#endif
+
+
+ tmp = i+57;
+ for (i = 0; i < 16; i++)
+ if(decodebit(&vbiline[tmp + i * 57], sample))
+ packedbits |= 1<<i;
+ return packedbits&parityok(packedbits);
+} /* decode */
+
+int XDSdecode(int data)
+{
+ int b1, b2, length;
+
+ if (data == -1)
+ return -1;
+
+ b1 = data & 0x7F;
+ b2 = (data>>8) & 0x7F;
+
+ if (b1 < 15) // start packet
+ {
+ mode = b1;
+ type = b2;
+ infochecksum = b1 + b2 + 15;
+ if (mode > 8 || type > 20)
+ {
+// printf("%% Unsupported mode %s(%d) [%d]\n",modes[(mode-1)>>1],mode,type);
+ mode=0; type=0;
+ }
+ infoptr = newinfo[mode][type];
+ }
+ else if (b1 == 15) // eof (next byte is checksum)
+ {
+#if 0 //debug
+ if (mode == 0)
+ {
+ length=infoptr - newinfo[0][0];
+ infoptr[1]=0;
+ printf("LEN: %d\n",length);
+ for (y=0;y<length;y++)
+ printf(" %03d",newinfo[0][0][y]);
+ printf(" --- %s\n",newinfo[0][0]);
+ }
+#endif
+ if (mode == 0) return 0;
+ if (b2 != 128-((infochecksum%128)&0x7F)) return 0;
+
+ length = infoptr - newinfo[mode][type];
+
+ //don't bug the user with repeated data
+ //only parse it if it's different
+ if (strncmp(info[mode][type],newinfo[mode][type],length-1))
+ {
+ infoptr = info[mode][type];
+ memcpy(info[mode][type],newinfo[mode][type],length+1);
+ printf("\33[33m%%");
+ switch ((mode<<8) + type)
+ {
+ case 0x0101:
+ printf(" TIMECODE: %d/%02d %d:%02d",
+ infoptr[3]&0x0f,infoptr[2]&0x1f,infoptr[1]&0x1f,infoptr[0]&0x3f);
+ case 0x0102:
+ if ((infoptr[1]&0x3f)>5)
+ break;
+ printf(" LENGTH: %d:%02d:%02d of %d:%02d:00",
+ infoptr[3]&0x3f,infoptr[2]&0x3f,infoptr[4]&0x3f,infoptr[1]&0x3f,infoptr[0]&0x3f);
+ break;
+ case 0x0103:
+ infoptr[length] = 0;
+ printf(" TITLE: %s",infoptr);
+ break;
+ case 0x0105:
+ printf(" RATING: %s (%d)",ratings[infoptr[0]&0x07],infoptr[0]);
+ if ((infoptr[0]&0x07)>0)
+ {
+ if (infoptr[0]&0x20) printf(" VIOLENCE");
+ if (infoptr[0]&0x10) printf(" SEXUAL");
+ if (infoptr[0]&0x08) printf(" LANGUAGE");
+ }
+ break;
+ case 0x0501:
+ infoptr[length] = 0;
+ printf(" NETWORK: %s",infoptr);
+ break;
+ case 0x0502:
+ infoptr[length] = 0;
+ printf(" CALL: %s",infoptr);
+ break;
+ case 0x0701:
+ printf(" CUR.TIME: %d:%02d %d/%02d/%04d UTC",infoptr[1]&0x1F,infoptr[0]&0x3f,infoptr[3]&0x0f,infoptr[2]&0x1f,(infoptr[5]&0x3f)+1990);
+ break;
+ case 0x0704: //timezone
+ printf(" TIMEZONE: UTC-%d",infoptr[0]&0x1f);
+ break;
+ case 0x0104: //program genere
+ break;
+ case 0x0110:
+ case 0x0111:
+ case 0x0112:
+ case 0x0113:
+ case 0x0114:
+ case 0x0115:
+ case 0x0116:
+ case 0x0117:
+ infoptr[length+1] = 0;
+ printf(" DESC: %s",infoptr);
+ break;
+ }
+ printf("\33[0m\n");
+ fflush(stdout);
+ }
+ mode = 0; type = 0;
+ }
+ else if( (infoptr - newinfo[mode][type]) < 250 ) // must be a data packet, check if we're in a supported mode
+ {
+ infoptr[0] = b1; infoptr++;
+ infoptr[0] = b2; infoptr++;
+ infochecksum += b1 + b2;
+ }
+ return 0;
+}
+
+int webtv_check(char * buf,int len)
+{
+ unsigned long sum;
+ unsigned long nwords;
+ unsigned short csum=0;
+ char temp[9];
+ int nbytes=0;
+
+ while (buf[0]!='<' && len > 6) //search for the start
+ {
+ buf++; len--;
+ }
+
+ if (len == 6) //failure to find start
+ return 0;
+
+
+ while (nbytes+6 <= len)
+ {
+ //look for end of object checksum, it's enclosed in []'s and there shouldn't be any [' after
+ if (buf[nbytes] == '[' && buf[nbytes+5] == ']' && buf[nbytes+6] != '[')
+ break;
+ else
+ nbytes++;
+ }
+ if (nbytes+6>len) //failure to find end
+ return 0;
+
+ nwords = nbytes >> 1; sum = 0;
+
+ //add up all two byte words
+ while (nwords-- > 0) {
+ sum += *buf++ << 8;
+ sum += *buf++;
+ }
+ if (nbytes & 1) {
+ sum += *buf << 8;
+ }
+ csum = (unsigned short)(sum >> 16);
+ while(csum !=0) {
+ sum = csum + (sum & 0xffff);
+ csum = (unsigned short)(sum >> 16);
+ }
+ sprintf(temp,"%04X\n",(int)~sum&0xffff);
+ buf++;
+ if(!strncmp(buf,temp,4))
+ {
+ buf[5]=0;
+ printf("\33[35mWEBTV: %s\33[0m\n",buf-nbytes-1);
+ fflush(stdout);
+ }
+ return 0;
+}
+
+int CCdecode(int data)
+{
+ int b1, b2, row, len, x,y;
+ if (data == -1) //invalid data. flush buffers to be safe.
+ {
+ memset(ccbuf[1],0,255);
+ memset(ccbuf[2],0,255);
+ return -1;
+ }
+ b1 = data & 0x7f;
+ b2 = (data>>8) & 0x7f;
+ len = strlen(ccbuf[ccmode]);
+
+ if (b1&0x60 && data != lastcode) // text
+ {
+ ccbuf[ccmode][len++]=b1;
+ if (b2&0x60) ccbuf[ccmode][len++]=b2;
+ if (b1 == ']' || b2 == ']')
+ webtv_check(ccbuf[ccmode],len);
+ }
+ else if ((b1&0x10) && (b2>0x1F) && (data != lastcode)) //codes are always transmitted twice (apparently not, ignore the second occurance)
+ {
+ ccmode=((b1>>3)&1)+1;
+ len = strlen(ccbuf[ccmode]);
+
+ if (b2 & 0x40) //preamble address code (row & indent)
+ {
+ row=rowdata[((b1<<1)&14)|((b2>>5)&1)];
+ if (len!=0)
+ ccbuf[ccmode][len++]='\n';
+
+ if (b2&0x10) //row contains indent flag
+ for (x=0;x<(b2&0x0F)<<1;x++)
+ ccbuf[ccmode][len++]=' ';
+ }
+ else
+ {
+ switch (b1 & 0x07)
+ {
+ case 0x00: //attribute
+ printf("<ATTRIBUTE %d %d>\n",b1,b2);
+ fflush(stdout);
+ break;
+ case 0x01: //midrow or char
+ switch (b2&0x70)
+ {
+ case 0x20: //midrow attribute change
+ switch (b2&0x0e)
+ {
+ case 0x00: //italics off
+ if (!plain)
+ strcat(ccbuf[ccmode],"\33[0m ");
+ break;
+ case 0x0e: //italics on
+ if (!plain)
+ strcat(ccbuf[ccmode],"\33[36m ");
+ break;
+ }
+ if (b2&0x01) { //underline
+ if (!plain)
+ strcat(ccbuf[ccmode],"\33[4m");
+ } else {
+ if (!plain)
+ strcat(ccbuf[ccmode],"\33[24m");
+ }
+ break;
+ case 0x30: //special character..
+ strcat(ccbuf[ccmode],specialchar[b2&0x0f]);
+ break;
+ }
+ break;
+ case 0x04: //misc
+ case 0x05: //misc + F
+// printf("ccmode %d cmd %02x\n",ccmode,b2);
+ switch (b2)
+ {
+ case 0x21: //backspace
+ ccbuf[ccmode][len--]=0;
+ break;
+
+ /* these codes are insignifigant if we're ignoring positioning */
+ case 0x25: //2 row caption
+ case 0x26: //3 row caption
+ case 0x27: //4 row caption
+ case 0x29: //resume direct caption
+ case 0x2B: //resume text display
+ case 0x2C: //erase displayed memory
+ break;
+
+ case 0x2D: //carriage return
+ if (ccmode==2)
+ break;
+ case 0x2F: //end caption + swap memory
+ case 0x20: //resume caption (new caption)
+ if (!strlen(ccbuf[ccmode]))
+ break;
+ for (x=0;x<strlen(ccbuf[ccmode]);x++)
+ for (y=0;y<keywords;y++)
+ if (!strncasecmp(keyword[y], ccbuf[ccmode]+x, strlen(keyword[y])))
+ printf("\a");
+ printf("%s\33[m\n",ccbuf[ccmode]);
+ fflush(stdout);
+ /* FALL */
+ case 0x2A: //text restart
+ case 0x2E: //erase non-displayed memory
+ memset(ccbuf[ccmode],0,255);
+ break;
+ }
+ break;
+ case 0x07: //misc (TAB)
+ for(x=0;x<(b2&0x03);x++)
+ ccbuf[ccmode][len++]=' ';
+ break;
+ }
+ }
+ }
+ lastcode=data;
+ return 0;
+}
+int RAW(int data)
+{
+ int b1, b2;
+ if (data == -1)
+ return -1;
+ b1 = data & 0x7f;
+ b2 = (data>>8) & 0x7f;
+ fprintf(stderr,"%c%c",b1,b2);
+ return 0;
+}
+int sentence(int data)
+{
+ int b1, b2;
+ if (data == -1)
+ return -1;
+ b1 = data & 0x7f;
+ b2 = (data>>8) & 0x7f;
+ inval++;
+ if (data==lastcode)
+ {
+ if (sen==1)
+ {
+ printf(" ");
+ sen=0;
+ }
+ if (inval>10 && sen)
+ {
+ printf("\n");
+ fflush(stdout);
+ sen=0;
+ }
+ return 0;
+ }
+ lastcode=data;
+
+ if (b1&96)
+ {
+ inval=0;
+ if (sen==2 && b1!='.' && b2!='.' && b1!='!' && b2!='!' && b1!='?' && b2!='?' && b1!=')' && b2!=')')
+ {
+ printf("\n");
+ fflush(stdout);
+ sen=1;
+ }
+ else if (b1=='.' || b2=='.' || b1=='!' || b2=='!' || b1=='?' || b2=='?' || b1==')' || b2==')')
+ sen=2;
+ else
+ sen=1;
+ printf("%c%c",tolower(b1),tolower(b2));
+
+ }
+ return 0;
+}
+#ifdef XWIN
+unsigned long getColor(char *colorName, float dim)
+{
+ XColor Color;
+ XWindowAttributes Attributes;
+
+ XGetWindowAttributes(dpy, Root, &Attributes);
+ Color.pixel = 0;
+
+ XParseColor (dpy, Attributes.colormap, colorName, &Color);
+ Color.red=(unsigned short)(Color.red/dim);
+ Color.blue=(unsigned short)(Color.blue/dim);
+ Color.green=(unsigned short)(Color.green/dim);
+ Color.flags=DoRed | DoGreen | DoBlue;
+ XAllocColor (dpy, Attributes.colormap, &Color);
+
+ return Color.pixel;
+}
+#endif
+int main(int argc,char **argv)
+{
+ char *vbifile = "/dev/vbi";
+ unsigned char buf[65536];
+ char arg;
+ int args=0;
+ int vbifd;
+ fd_set rfds;
+
+ int x;
+
+ #ifdef XWIN
+ dpy=XOpenDisplay(dpyname);
+ Root=DefaultRootWindow(dpy);
+ Win = XCreateSimpleWindow(dpy, Root, 10, 10, 1024, 128,0,0,0);
+ WinGC = XCreateGC(dpy, Win, 0, NULL);
+ WinGC0 = XCreateGC(dpy, Win, 0, NULL);
+ WinGC1 = XCreateGC(dpy, Win, 0, NULL);
+ XSetForeground(dpy, WinGC, getColor("blue",1));
+ XSetForeground(dpy, WinGC0, getColor("green",1));
+ XSetForeground(dpy, WinGC1, getColor("red",1));
+ #endif
+
+ for (;;) //commandline parsing
+ {
+ if (-1 == (arg = getopt(argc, argv, "h?xspckd:r:")))
+ break;
+ switch (arg)
+ {
+ case '?':
+ case 'h':
+ printf("CCDecoder 0.9.1 (mbm@linux.com)\n"
+ "\tx\tdecode XDS info\n"
+ "\tc\tdecode Closed Caption (includes webtv)\n"
+ "\tp (plain) \tdo not display underline and italic\n"
+ "\tr arg\traw dump of arg\n");
+ exit(0);
+ case 'x':
+ usexds=1; args++;
+ break;
+ case 's':
+ usesen=1; args++;
+ break;
+ case 'c':
+ usecc=1; args++;
+ break;
+ case 'k':
+ keyword[keywords++]=optarg;
+ break;
+ case 'p':
+ plain=1; args++;
+ break;
+ case 'r':
+ useraw=1; args++;
+ rawline=atoi(optarg);
+ #if XWIN
+ XMapWindow(dpy, Win);
+ #endif
+ break;
+ case 'd':
+ vbifile = optarg;
+ break;
+ }
+ }
+
+ if ((vbifd = open(vbifile, O_RDONLY)) < 0) {
+ perror(vbifile);
+ exit(1);
+ }
+
+ else if (!args)
+ exit(0);
+ for (x=0;x<keywords;x++)
+ printf("Keyword(%d): %s\n",x,keyword[x]);
+
+ //mainloop
+ while(1){
+ FD_ZERO(&rfds);
+ FD_SET(vbifd, &rfds);
+ select(FD_SETSIZE, &rfds, NULL, NULL, NULL);
+ if (FD_ISSET(vbifd, &rfds)) {
+ if (read(vbifd, buf , 65536)!=65536)
+ printf("read error\n");
+ if (useraw)
+ {
+ #ifdef XWIN
+ XClearArea(dpy,Win,0,0,1024,128,0);
+ XDrawLine(dpy,Win,WinGC1,0,128-85/2,1024,128-85/2);
+ for (x=0;x<1024;x++)
+ if (buf[2048 * rawline+x*2]/2<128 && buf[2048 * rawline+x*2+2]/2 < 128)
+ XDrawLine(dpy,Win,WinGC0,x,128-buf[2048 * rawline+x*2]/2,x+1,128-buf[2048 * rawline+x*2+2]/2);
+ #endif
+ RAW(decode(&buf[2048 * rawline]));
+ #ifdef XWIN
+ XFlush(dpy);
+ usleep(100);
+ #endif
+ }
+ if (usexds)
+ XDSdecode(decode(&buf[2048 * 27]));
+ if (usecc)
+ CCdecode(decode(&buf[2048 * 11]));
+ if (usesen)
+ sentence(decode(&buf[2048 * 11]));
+ #ifdef XWIN
+ XFlush(dpy);
+ usleep(100);
+ #endif
+ }
+ }
+ return 0;
+}
diff --git a/contrib/dot.lircrc b/contrib/dot.lircrc
new file mode 100644
index 0000000..cb779c8
--- /dev/null
+++ b/contrib/dot.lircrc
@@ -0,0 +1,92 @@
+begin
+ prog = xawtv
+ button = CH+
+ config = setstation next
+end
+begin
+ prog = xawtv
+ button = CH-
+ config = setstation prev
+end
+begin
+ prog = xawtv
+ button = VOL+
+ config = volume inc
+end
+begin
+ prog = xawtv
+ button = VOL-
+ config = volume dec
+end
+begin
+ prog = xawtv
+ button = MUTE
+ config = volume mute
+end
+begin
+ prog = xawtv
+ button = FULL_SCREEN
+ config = fullscreen toggle
+end
+begin
+ prog = xawtv
+ button = SOURCE
+ config = setinput next
+end
+begin
+ prog = xawtv
+ button = RESERVED
+ config = quit
+end
+
+
+begin
+ prog = xawtv
+ button = 1
+ config = keypad 1
+end
+begin
+ prog = xawtv
+ button = 2
+ config = keypad 2
+end
+begin
+ prog = xawtv
+ button = 3
+ config = keypad 3
+end
+begin
+ prog = xawtv
+ button = 4
+ config = keypad 4
+end
+begin
+ prog = xawtv
+ button = 5
+ config = keypad 5
+end
+begin
+ prog = xawtv
+ button = 6
+ config = keypad 6
+end
+begin
+ prog = xawtv
+ button = 7
+ config = keypad 7
+end
+begin
+ prog = xawtv
+ button = 8
+ config = keypad 8
+end
+begin
+ prog = xawtv
+ button = 9
+ config = keypad 9
+end
+begin
+ prog = xawtv
+ button = 0
+ config = keypad 0
+end
diff --git a/contrib/r@dio.mp3 b/contrib/r@dio.mp3
new file mode 100644
index 0000000..4768494
--- /dev/null
+++ b/contrib/r@dio.mp3
@@ -0,0 +1 @@
+see http://www.nbc-vbi.de.vu for up-to-date versions
diff --git a/contrib/vtx2xawtv/README.vtx2xawtv b/contrib/vtx2xawtv/README.vtx2xawtv
new file mode 100644
index 0000000..c2da660
--- /dev/null
+++ b/contrib/vtx2xawtv/README.vtx2xawtv
@@ -0,0 +1,29 @@
+ vtx2xawtv
+ Public Domain, von Kai Fett
+ K@i-Fett.de
+
+Schonmal drber gergert, da das Erfassen der Sendernamen ewgig
+lange dauert und noch dazu nervenaufreibend ist? Insbesondere bei den
+"Privaten", die die Hlfte der Zeit Werbung und damit kein Senderlogo
+zeigen?
+
+Das geht auch einfacher: Kabel 1 bietet ab Videotextseite 600 eine
+Kanalbersicht der Telekom, die sich herrlich zur Weiterverarbeitung
+mit Perl eignet:
+
+- Zunchst packt man die fr seinen Ort passenden Seiten in Text-
+ dateien, z.B. in alevt mit Taste 's', oder mit vbidecode und
+ vtx2ascii -a. Bitte die Seiten als ASCII abspeichern!
+
+- Dann piped man diese Textdateien durch das beiliegende Script
+ vtx2xawtv, und fgt den Output an seine Konfigurationsdatei an:
+
+ cat vtx*.txt | ./vtx2xawtv >> ~/.xawtv
+
+Schon hat man alle Sender mit der offiziellen Senderbezeichnung in
+xawtv zur Verfgung.
+
+ber Feedback wrde ich mich freuen!
+
+Viel Spa
+ Kai \ No newline at end of file
diff --git a/contrib/vtx2xawtv/vtx2xawtv b/contrib/vtx2xawtv/vtx2xawtv
new file mode 100644
index 0000000..2f66556
--- /dev/null
+++ b/contrib/vtx2xawtv/vtx2xawtv
@@ -0,0 +1,44 @@
+#!/usr/bin/perl
+#
+# vtx2xawtv - Konvertiert Kabel1-Kanalliste ins .xawtv-Format
+#
+# 1) Mit Videotext-Tool aus dem Kabel1-Text die Seiten mit
+# den Kanal-Listen aufrufen und abspeichern, z.B. als
+# vtx1.txt bis vtx3.txt
+#
+# 2) Diese Seiten durch vtx2xawtv pipen:
+#
+# cat vtx?.txt | vtx2xawtv >> ~/.xawtv
+#
+#
+# Have Fun,
+# Kai (K@i-Fett.de)
+#
+# PS: Dieses Scriptchen ist natrlich Public Domain, es wre aber schn,
+# wenn mein Name in weiteren Versionen drinbleibt.
+#
+#############################################################################
+ #
+while(<STDIN>){ #
+ if (/\*/) { #
+ #
+ # Zeile in 3 Teile zerlegen, jeweils feste Breite #
+ #
+ /(.........................)(..)(...)/; #
+ $name=$1; $typ=$2;
+ $chan=$3;
+
+ $name=~s/\(.*\)//; # Bemerkungen in Klammern lschen
+ $name=~s/(\ )*$//; # Leerzeichen am Ende...
+ $name=~s/^(\ )//; # ...und am Anfang lschen
+
+ if ($typ=~/K/){$typ='E'} # Die Kabel1-Liste notiert
+ if ($typ=~/S/ and $chan<21){$typ='SE'} # die Kanle etwas
+ if ($typ=~/S/ and $chan>20){$typ='S'} # anders als xawtv
+
+ $chan=~s/(\ )*$//; # Auch wieder fllende
+ $chan=~s/^(\ )*//; # und fhrende Leerzeichen abschneiden
+
+ print "[$name]\nchannel=$typ$chan\n\n"; # Und im xawtv-Format ausgeben.
+ }
+} \ No newline at end of file
diff --git a/debian/alevtd.files b/debian/alevtd.files
new file mode 100644
index 0000000..0ef949a
--- /dev/null
+++ b/debian/alevtd.files
@@ -0,0 +1,2 @@
+usr/bin/alevtd
+usr/share/man/man1/alevtd.1
diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 0000000..176c8e9
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,109 @@
+xawtv (3.27) unstable; urgency=low
+
+ * new release.
+ * xawtv postinst script fixes (closes: #80611, #80578)
+
+ -- Gerd Knorr <kraxel@debian.org> Sat, 30 Dec 2000 15:07:25 +0100
+
+xawtv (3.26) unstable; urgency=low
+
+ * new release
+ * added debconf support
+
+ -- Gerd Knorr <kraxel@debian.org> Thu, 21 Dec 2000 22:58:42 +0100
+
+xawtv (3.24) unstable; urgency=low
+
+ * new release
+ * updated (build) dependences to require xfree4 libraries + xutils
+ (mkfontdir+bdftopcf have been moved)
+ * build binary packages with Xvideo support
+ [i386 only, powerpc has no xfree4 packages yet]
+
+ -- Gerd Knorr <kraxel@debian.org> Sat, 4 Nov 2000 15:56:55 +0100
+
+xawtv (3.23) unstable; urgency=low
+
+ * new release
+ * fixed (build) dependences (closes: #69918, #74428)
+
+ -- Gerd Knorr <kraxel@debian.org> Sat, 21 Oct 2000 22:41:37 +0200
+
+xawtv (3.22) unstable; urgency=low
+
+ * new release
+ * added liblircclient-dev to build-depends, compiled packages
+ with lirc support
+
+ -- Gerd Knorr <kraxel@debian.org> Sun, 1 Oct 2000 17:40:52 +0200
+
+xawtv (3.21) unstable; urgency=low
+
+ * new release
+
+ -- Gerd Knorr <kraxel@debian.org> Wed, 6 Sep 2000 00:04:21 +0200
+
+xawtv (3.20) unstable; urgency=low
+
+ * new release
+ * packaging bug fixed: v4l-conf was not installed suid-root because
+ dh_fixperm killed my suid bit...
+
+ -- Gerd Knorr <kraxel@debian.org> Wed, 6 Sep 2000 00:04:11 +0200
+
+xawtv (3.19) unstable; urgency=low
+
+ * new release. Starting with this release /me maintains debian package,
+ i.e. xawtv is a native debian package now. Going to close a number of
+ bugs...
+ * closes: #48118 - not xawtv's fault, it is a driver problem.
+ * closes: #52538 - This can be changed with keypad-ntsc in ~/.xawtv,
+ see man-page. Don't remember which version introduces this, seems
+ I forgot this one in the Changes file...
+ * closes: #54906 - It's not a bug, it's a feature. xawtv uses the
+ maximun size supported by the driver which is 844x576 with bttv.
+ If one needs a fixed 4:3 aspect ratio, this can be set in the
+ config file (>= version 3.14)
+ * closes: #55956 - same as 54906 ...
+ * closes: #57161, #52351 (packaging is completely different)
+ * closes: #61590 - was fixed in 3.11
+ * closes: #61698, #65802 - bug in the 2.2.x kernel bttv driver
+ * closes: #64064 - this is newer than 3.14 :-)
+
+ -- Gerd Knorr <kraxel@debian.org> Sun, 20 Aug 2000 23:47:15 +0200
+
+xawtv (3.18) unstable; urgency=low
+
+ * new release.
+
+ -- Gerd Knorr <kraxel@goldbach.in-berlin.de> Wed, 16 Aug 2000 21:39:03 +0200
+
+xawtv (3.17) unstable; urgency=low
+
+ * new release.
+
+ -- Gerd Knorr <kraxel@goldbach.in-berlin.de> Thu, 22 Jun 2000 23:43:00 +0200
+
+xawtv (3.16) unstable; urgency=low
+
+ * new release.
+
+ -- Gerd Knorr <kraxel@goldbach.in-berlin.de> Mon, 5 Jun 2000 21:35:30 +0200
+
+xawtv (3.15) unstable; urgency=low
+
+ * new release.
+
+ -- Gerd Knorr <kraxel@goldbach.in-berlin.de> Thu, 1 Jun 2000 22:58:00 +0200
+
+xawtv (3.14) unstable; urgency=low
+
+ * new release.
+
+ -- Gerd Knorr <kraxel@goldbach.in-berlin.de> Mon, 8 May 2000 23:13:03 +0200
+
+xawtv (3.13) unstable; urgency=low
+
+ * deianized.
+
+ -- Gerd Knorr <kraxel@goldbach.in-berlin.de> Sun, 16 Apr 2000 15:57:04 +0200
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..7512332
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,81 @@
+Source: xawtv
+Section: graphics
+Priority: extra
+Build-Depends: libjpeg62-dev, libncurses5-dev, xlibs-dev (>= 4.0.1), xaw3dg-dev, liblircclient-dev, debhelper, xutils
+Maintainer: Gerd Knorr <kraxel@debian.org>
+Standards-Version: 3.0.1
+
+Package: xawtv
+Section: x11
+Architecture: any
+Depends: ${shlibs:Depends}, v4l-conf, xutils, debconf, pciutils
+Description: X11 TV application
+ TV application for X11. Supports video4linux
+ devices and the Xvideo extension.
+ .
+ For Xvideo support xawtv must be compiled with
+ the XFree86 4.0+ client libraries installed.
+
+Package: fbtv
+Architecture: any
+Depends: ${shlibs:Depends}, v4l-conf
+Suggests: xawtv
+Description: linux console (fbcon) TV application
+ TV application for the linux console, requires a
+ framebuffer device (vesafb, matroxfb, atyfb, ...)
+ and a video4linux driver like bttv.
+
+Package: streamer
+Architecture: any
+Depends: ${shlibs:Depends}
+Suggests: xawtv
+Description: capture tool (images / movies)
+ A tool to capture single/multiple images or
+ record movies from a video4linux device.
+
+Package: radio
+Section: sound
+Architecture: any
+Depends: ${shlibs:Depends}
+Description: ncurses-bases radio application
+ This is a ncurses-based radio application. It
+ supports the video4linux API.
+
+Package: v4l-conf
+Architecture: any
+Depends: ${shlibs:Depends}
+Description: tool to configure video4linux drivers
+ This is a small tool to configure a video4linux
+ device driver. It is required to make the video
+ overlay work in fbtv and xawtv.
+
+Package: xawtv-tools
+Architecture: any
+Depends: ${shlibs:Depends}
+Description: Miscellaneous tools distributed with xawtv
+ This package has a few tools you might find useful. They
+ have not to do very much to do with xawtv. I've used/wrote
+ them for debugging:
+ * propwatch - monitors properties of X11 windows. If you
+ want to know how to keep track of xawtv's
+ _XAWTV_STATION property, look at this.
+ * dump-mixers - dump mixer settings to stdout
+ * record - console sound recorder. Has a simple input
+ level meter which might be useful to trouble
+ shoot sound problems.
+ * showriff - display the structure of RIFF files (avi, wav).
+
+Package: webcam
+Architecture: any
+Depends: ${shlibs:Depends},ftp
+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.
+
+Package: alevtd
+Architecture: any
+Depends: ${shlibs:Depends}
+Description: http daemon for videotext pages
+ alevtd is http daemon which servers videotext pages as
+ HTML.
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 0000000..c7e3fa1
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,21 @@
+This is xawtv, written and maintained by Gerd Knorr <kraxel@goldbach.in-berlin.de>
+
+The original source can always be found at:
+ ftp://ftp.debian.org/dists/unstable/main/source/
+
+Copyright (C) 1997-2000 Gerd Knorr
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License with
+ the Debian GNU/Linux distribution in file /usr/share/common-licenses/GPL;
+ if not, write to the Free Software Foundation, Inc., 59 Temple Place,
+ Suite 330, Boston, MA 02111-1307 USA
diff --git a/debian/fbtv.files b/debian/fbtv.files
new file mode 100644
index 0000000..eb6259f
--- /dev/null
+++ b/debian/fbtv.files
@@ -0,0 +1,2 @@
+usr/bin/fbtv
+usr/share/man/man1/fbtv.1
diff --git a/debian/fbtv.menu b/debian/fbtv.menu
new file mode 100644
index 0000000..1f6d778
--- /dev/null
+++ b/debian/fbtv.menu
@@ -0,0 +1,2 @@
+?package(fbtv):needs=vc section=Apps/Viewers \
+ title="fbtv" command="/usr/bin/fbtv"
diff --git a/debian/radio.files b/debian/radio.files
new file mode 100644
index 0000000..0b6c05f
--- /dev/null
+++ b/debian/radio.files
@@ -0,0 +1,2 @@
+usr/bin/radio
+usr/share/man/man1/radio.1
diff --git a/debian/radio.menu b/debian/radio.menu
new file mode 100644
index 0000000..2f69034
--- /dev/null
+++ b/debian/radio.menu
@@ -0,0 +1,2 @@
+?package(radio):needs=text section=Apps/Sound \
+ title="radio" command="/usr/bin/radio"
diff --git a/debian/rules b/debian/rules
new file mode 100644
index 0000000..79b4559
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,59 @@
+#!/usr/bin/make -f
+# Sample debian/rules that uses debhelper.
+# GNU copyright 1997 to 1999 by Joey Hess.
+
+#export DH_VERBOSE=1
+export DH_COMPAT=2
+ROOT=$(shell echo `pwd`/debian/tmp)
+
+build:
+ test -f config.h || ./configure --prefix=/usr --mandir=/usr/share/man \
+ --disable-quicktime
+ $(MAKE) $@
+
+clean::
+ -$(MAKE) distclean
+ dh_clean
+
+install: build
+ $(MAKE) ROOT=$(ROOT) $@
+ dh_movefiles
+
+binary-indep: install
+ # nop
+
+binary-arch: install
+ dh_installdebconf
+ dh_installdocs README* Changes UPDATE_TO_v3.0 \
+ Programming-FAQ Trouble-Shooting Sound-FAQ \
+ contrib/dot.lircrc contrib/frequencies*
+ dh_installdocs -p xawtv-tools tools/README
+ dh_installdocs -p webcam webcam/webcam.cgi
+# dh_installexamples
+ dh_installmenu
+# dh_installemacsen
+# dh_installpam
+# dh_installinit
+# dh_installcron
+# dh_installmanpages
+# dh_installinfo
+ dh_undocumented -p xawtv scantv.1
+ dh_undocumented -p xawtv-tools record.1 dump-mixers.1
+ dh_undocumented -p streamer streamer.1
+ dh_installchangelogs
+# dh_link
+# dh_strip
+ dh_compress
+ dh_fixperms -Xv4l-conf
+ # You may want to make some executables suid here.
+ dh_suidregister
+# dh_makeshlibs
+ dh_installdeb
+# dh_perl
+ dh_shlibdeps
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install
diff --git a/debian/streamer.files b/debian/streamer.files
new file mode 100644
index 0000000..7698b4d
--- /dev/null
+++ b/debian/streamer.files
@@ -0,0 +1 @@
+usr/bin/streamer
diff --git a/debian/v4l-conf.files b/debian/v4l-conf.files
new file mode 100644
index 0000000..814c162
--- /dev/null
+++ b/debian/v4l-conf.files
@@ -0,0 +1,2 @@
+usr/bin/v4l-conf
+usr/share/man/man1/v4l-conf.1
diff --git a/debian/webcam.files b/debian/webcam.files
new file mode 100644
index 0000000..013bead
--- /dev/null
+++ b/debian/webcam.files
@@ -0,0 +1,2 @@
+usr/bin/webcam
+usr/share/man/man1/webcam.1
diff --git a/debian/xawtv-tools.files b/debian/xawtv-tools.files
new file mode 100644
index 0000000..743dad0
--- /dev/null
+++ b/debian/xawtv-tools.files
@@ -0,0 +1,6 @@
+usr/bin/showriff
+usr/bin/propwatch
+usr/bin/dump-mixers
+usr/bin/record
+usr/share/man/man1/propwatch.1
+usr/share/man/man1/showriff.1
diff --git a/debian/xawtv.config b/debian/xawtv.config
new file mode 100644
index 0000000..a0e262f
--- /dev/null
+++ b/debian/xawtv.config
@@ -0,0 +1,67 @@
+#!/bin/sh
+
+# debconf lib
+. /usr/share/debconf/confmodule
+
+# init variables
+mkdev="true"
+mkcfg="true"
+tvnorm=""
+freqtab=""
+doscan="false"
+
+# look around a bit ...
+pcidev=`lspci -n 2>/dev/null | cut -d" " -f 4`
+for card in $pcidev; do
+ case $card in
+ 109e:0350) doscan="true" ;; # bt848
+ 109e:0351) doscan="true" ;; # bt849
+ 109e:036e) doscan="true" ;; # bt878
+ 109e:036f) doscan="true" ;; # bt879
+ esac
+done
+test -c /dev/.devfsd && mkdev="false"
+test -c /dev/video0 && mkdev="false"
+
+# create v4l devices ?
+if test "$mkdev" = "true"; then
+ db_input medium xawtv/makedev
+ db_go
+ db_get xawtv/makedev
+ mkdev="$RET"
+fi
+
+# build xawtv config
+db_input medium xawtv/build-config
+db_go
+db_get xawtv/build-config
+mkcfg="$RET"
+
+if test "$mkcfg" = "true" -a -s /etc/X11/xawtvrc; then
+ # overwrite old file?
+ db_input medium xawtv/overwrite-config
+ db_go
+ db_get xawtv/overwrite-config
+ mkcfg="$RET"
+fi
+
+if test "$mkcfg" = "true"; then
+ # configuration
+ db_input medium xawtv/tvnorm
+ db_go
+ db_get xawtv/tvnorm
+ tvnorm="$RET"
+ db_input medium xawtv/freqtab
+ db_go
+ db_get xawtv/freqtab
+ freqtab="$RET"
+fi
+
+if test "$mkcfg" = "true" -a "$doscan" = "true"; then
+ # channel scan?
+ db_input medium xawtv/channel-scan
+ db_go
+ db_get xawtv/channel-scan
+ doscan="$RET"
+fi
+
diff --git a/debian/xawtv.files b/debian/xawtv.files
new file mode 100644
index 0000000..693831b
--- /dev/null
+++ b/debian/xawtv.files
@@ -0,0 +1,13 @@
+/usr/bin/xawtv
+/usr/bin/xawtv-remote
+/usr/bin/v4lctl
+/usr/bin/rootv
+/usr/bin/scantv
+/usr/share/man/man1/v4lctl.1
+/usr/share/man/man1/xawtv.1
+/usr/share/man/man1/rootv.1
+/usr/share/man/man1/xawtv-remote.1
+/usr/X11R6/lib/X11/fonts/misc/led-latin1.pcf
+/usr/X11R6/lib/X11/fonts/misc/led-latin2.pcf
+/usr/X11R6/lib/X11/fonts/misc/led-koi8.pcf
+/etc/X11/app-defaults/Xawtv
diff --git a/debian/xawtv.menu b/debian/xawtv.menu
new file mode 100644
index 0000000..8ac227a
--- /dev/null
+++ b/debian/xawtv.menu
@@ -0,0 +1,2 @@
+?package(xawtv):needs=x11 section=Apps/Viewers \
+ title="xawtv" command="/usr/bin/xawtv"
diff --git a/debian/xawtv.postinst b/debian/xawtv.postinst
new file mode 100644
index 0000000..6fd7f18
--- /dev/null
+++ b/debian/xawtv.postinst
@@ -0,0 +1,74 @@
+#!/bin/sh
+
+# debconf lib
+. /usr/share/debconf/confmodule
+
+# init variables
+mkdev="true"
+mkcfg="true"
+tvnorm=""
+freqtab=""
+doscan="false"
+
+# look around a bit ...
+pcidev=`lspci -n 2>/dev/null | cut -d" " -f 4`
+for card in $pcidev; do
+ case $card in
+ 109e:0350) doscan="true" ;; # bt848
+ 109e:0351) doscan="true" ;; # bt849
+ 109e:036e) doscan="true" ;; # bt878
+ 109e:036f) doscan="true" ;; # bt879
+ esac
+done
+test -c /dev/.devfsd && mkdev="false"
+test -c /dev/video0 && mkdev="false"
+
+# create v4l devices ?
+if test "$mkdev" = "true"; then
+ db_get xawtv/makedev
+ mkdev="$RET"
+fi
+
+# build xawtv config
+db_get xawtv/build-config
+mkcfg="$RET"
+
+if test "$mkcfg" = "true" -a -s /etc/X11/xawtvrc; then
+ # overwrite old file?
+ db_get xawtv/overwrite-config
+ mkcfg="$RET"
+fi
+
+if test "$mkcfg" = "true"; then
+ # configuration
+ db_get xawtv/tvnorm
+ tvnorm="$RET"
+ db_get xawtv/freqtab
+ freqtab="$RET"
+fi
+
+if test "$mkcfg" = "true" -a "$doscan" = "true"; then
+ # channel scan?
+ db_get xawtv/channel-scan
+ doscan="$RET"
+fi
+
+#########################################################
+
+# create special files
+if test "$mkdev" = "true"; then
+ (cd /dev;/sbin/MAKEDEV v4l)
+fi
+
+# create default config
+if test "$mkcfg" = "true"; then
+ cmd="scantv -n $tvnorm -f $freqtab -o /etc/X11/xawtvrc"
+ test "$doscan" = "false" && cmd="$cmd -s"
+ $cmd
+fi
+
+# install new X11 fonts
+(cd /usr/X11R6/lib/X11/fonts/misc; /usr/X11R6/bin/mkfontdir)
+#xset fp rehash 2>/dev/null || true
+#DEBHELPER#
+
diff --git a/debian/xawtv.postrm b/debian/xawtv.postrm
new file mode 100644
index 0000000..43bd814
--- /dev/null
+++ b/debian/xawtv.postrm
@@ -0,0 +1,4 @@
+#!/bin/sh
+(cd /usr/X11R6/lib/X11/fonts/misc && mkfontdir)
+xset fp rehash || true
+#DEBHELPER#
diff --git a/debian/xawtv.reset b/debian/xawtv.reset
new file mode 100644
index 0000000..4af1d93
--- /dev/null
+++ b/debian/xawtv.reset
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+# debconf lib
+. /usr/share/debconf/confmodule
+
+questions=`grep "^Template:" xawtv.templates | cut -d" " -f2`
+for q in $questions; do
+ db_reset $q
+done
diff --git a/debian/xawtv.templates b/debian/xawtv.templates
new file mode 100644
index 0000000..72cc93f
--- /dev/null
+++ b/debian/xawtv.templates
@@ -0,0 +1,52 @@
+Template: xawtv/makedev
+Type: boolean
+Default: true
+Description: Create video4linux (/dev/video*) special files?
+
+Template: xawtv/build-config
+Type: boolean
+Default: false
+Description: Create a default configuration for xawtv?
+ You can create a system-wide configuration file
+ for xawtv with reasonable default values for the
+ country you live in (which TV norm is used for
+ example).
+ .
+ It is not required to have a global configuration
+ file, but it will be more comfortable for your
+ users if they find a working default configuration.
+
+Template: xawtv/overwrite-config
+Type: boolean
+Default: false
+Description: overwrite the existing config file?
+ I've found there is already a system-wide configuration
+ file. It was probably created during a previous install.
+
+Template: xawtv/tvnorm
+Type: select
+Choices: PAL, SECAM, NTSC
+Description: Which TV norm is used in your country?
+
+Template: xawtv/freqtab
+Type: select
+Choices: us-bcast, us-cable, us-cable-hrc, japan-bcast, japan-cable, europe-west, europe-east, italy, newzealand, australia, ireland, france, china-bcast
+Description: Which frequency table should be used?
+ A frequency table is just a list of TV channel
+ names/numbers and the corresponding broadcast
+ frequencies for these channels. Different regions
+ use different standards here...
+
+Template: xawtv/channel-scan
+Type: boolean
+Default: yes
+Description: scan for TV stations?
+ I can do a scan of all channels and put a list of
+ the TV stations I've found into the config file.
+ .
+ This requires a working bttv driver. If bttv isn't
+ configured correctly I might not find the TV stations.
+ .
+ I'll try to pick up the channel names from videotext.
+ This will work with PAL only.
+
diff --git a/font/Makefile b/font/Makefile
new file mode 100644
index 0000000..87fc573
--- /dev/null
+++ b/font/Makefile
@@ -0,0 +1,59 @@
+# Generated automatically from Makefile.in by configure.
+srcdir=.
+
+ROOT=
+prefix=/usr/X11R6
+FONTDIR=$(ROOT)$(prefix)/lib/X11/fonts/misc
+PCF=led-latin1.pcf led-latin2.pcf led-koi8.pcf
+
+all build: $(PCF)
+ mkfontdir
+
+install: all
+ mkdir -p $(R)$(FONTDIR)
+ for file in $(PCF); do \
+ install -m 644 $$file $(R)$(FONTDIR); \
+ done
+ if test "$(ROOT)" = ""; then \
+ (cd $(FONTDIR); mkfontdir); \
+ xset fp rehash; \
+ true; \
+ fi
+
+%.pcf: %.bdf
+ bdftopcf -o $@ $<
+
+dep:
+
+clean:
+ rm -f $(PCF)
+
+distclean: clean
+ rm -f Makefile *~ *.bak
+
+
+###########################################################################
+# don't use these, unless you know what you are doing...
+
+SERVER=tcp/goldbach:7100
+
+bdf: led-latin1.bdf led-latin2.bdf led-koi8.bdf
+
+led-latin1.bdf:
+ perl ./bigfont.pl -s $(SERVER) -fn \
+ "-misc-fixed-medium-r-semicondensed--13-*-iso8859-1" > led-latin1.bdf
+
+led-latin2.bdf:
+ perl ./bigfont.pl -s $(SERVER) -fn \
+ "-misc-fixed-medium-r-semicondensed--13-*-iso8859-2" > led-latin2.bdf
+
+led-koi8.bdf:
+ perl ./bigfont.pl -s $(SERVER) -fn \
+ "-misc-fixed-medium-r-semicondensed--13-*-koi8-r" > led-koi8.bdf
+
+
+realclean: clean
+ rm -f *.bdf fonts.dir
+
+dist: realclean bdf
+
diff --git a/font/Makefile.in b/font/Makefile.in
index 5f71704..112cd49 100644
--- a/font/Makefile.in
+++ b/font/Makefile.in
@@ -2,11 +2,11 @@ srcdir=@srcdir@
VPATH=$(srcdir)
ROOT=
-prefix=$(ROOT)/usr/X11R6
-FONTDIR=$(prefix)/lib/X11/fonts/misc
+prefix=/usr/X11R6
+FONTDIR=$(ROOT)$(prefix)/lib/X11/fonts/misc
PCF=led-latin1.pcf led-latin2.pcf led-koi8.pcf
-all: $(PCF)
+all build: $(PCF)
mkfontdir
install: all
@@ -29,29 +29,31 @@ clean:
rm -f $(PCF)
distclean: clean
- rm -f Makefile *~
+ rm -f Makefile *~ *.bak
+
###########################################################################
# don't use these, unless you know what you are doing...
SERVER=tcp/goldbach:7100
-bdf:
+bdf: led-latin1.bdf led-latin2.bdf led-koi8.bdf
+
+led-latin1.bdf:
perl ./bigfont.pl -s $(SERVER) -fn \
"-misc-fixed-medium-r-semicondensed--13-*-iso8859-1" > led-latin1.bdf
+
+led-latin2.bdf:
perl ./bigfont.pl -s $(SERVER) -fn \
"-misc-fixed-medium-r-semicondensed--13-*-iso8859-2" > led-latin2.bdf
+
+led-koi8.bdf:
perl ./bigfont.pl -s $(SERVER) -fn \
"-misc-fixed-medium-r-semicondensed--13-*-koi8-r" > led-koi8.bdf
-# perl ./bigfont.pl -s $(SERVER) -fn "6x10" > led-6x10.bdf
-# perl ./bigfont.pl -s $(SERVER) -fn \
-# "-adobe-helvetica-medium-r-normal--10-*" > led-helv-10.bdf
-# perl ./bigfont.pl -s $(SERVER) -fn \
-# "-adobe-helvetica-medium-r-normal--12-*" > led-helv-12.bdf
realclean: clean
- rm -f *~ *.bdf fonts.dir
+ rm -f *.bdf fonts.dir
dist: realclean bdf
diff --git a/font/fonts.dir b/font/fonts.dir
deleted file mode 100644
index d1a1f4d..0000000
--- a/font/fonts.dir
+++ /dev/null
@@ -1,4 +0,0 @@
-3
-led-latin1.pcf -xxl-ledfixed-medium-r-semicondensed--39-120-75-75-c-180-iso8859-1
-led-latin2.pcf -xxl-ledfixed-medium-r-semicondensed--39-120-75-75-c-180-iso8859-2
-led-koi8.pcf -xxl-ledfixed-medium-r-semicondensed--39-120-75-75-c-180-koi8-r
diff --git a/font/led-latin2.bdf b/font/led-latin2.bdf
index b242da0..70a2449 100644
--- a/font/led-latin2.bdf
+++ b/font/led-latin2.bdf
@@ -4184,10 +4184,10 @@ STARTCHAR hyphen
ENCODING 173
SWIDTH 1440 0
DWIDTH 18 0
-BBX 15 3 0 12
+BBX 9 3 3 12
BITMAP
-db6c00
-db6c00
+db0000
+db0000
000000
ENDCHAR
STARTCHAR registered
diff --git a/http/Makefile.in b/http/Makefile.in
new file mode 100644
index 0000000..6b24543
--- /dev/null
+++ b/http/Makefile.in
@@ -0,0 +1,52 @@
+srcdir=@srcdir@
+VPATH=$(srcdir)
+
+ROOT=
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+bindir=$(ROOT)@bindir@
+mandir=$(ROOT)@mandir@
+
+CC=@CC@
+DEPEND=@DEPEND@
+INSTALL=@INSTALL@
+INSTALL_PROGRAM=@INSTALL_PROGRAM@
+INSTALL_DATA=@INSTALL_DATA@
+INSTALL_DIR=mkdir -p
+
+CFLAGS=-Wall -g -O2 -I. -I$(srcdir)/../libvbi -L../libvbi
+LDLIBS=-lvbi
+
+PROG=alevtd
+OBJS=main.o request.o response.o page.o
+HTML=alevt.css.h top.html.h bottom.html.h about.html.h
+
+%.h : %
+ perl -ne 's/\"/\\\"/g; chop; print "\"$$_\\n\"\n"' $< > $@
+
+all build: $(PROG)
+
+$(PROG): $(OBJS)
+ $(CC) $(CFLAGS) -o $@ $(OBJS) $(LDLIBS)
+
+main.o: httpd.h
+request.o: httpd.h
+response.o: httpd.h
+page.o: httpd.h $(HTML)
+
+install: all
+ $(INSTALL_DIR) $(bindir) $(mandir)/man1
+ $(INSTALL_PROGRAM) -s alevtd $(bindir)
+ install -m 644 $(srcdir)/alevtd.man $(mandir)/man1/alevtd.1
+
+clean:
+ rm -f $(OBJS) $(HTML)
+
+realclean distclean: clean
+ rm -f $(PROG) Makefile *~ *.bak
+
+dep depend:
+ $(DEPEND) -- $(CFLAGS) -- *.c
+
+#-------------------------------------------------------------------------
+# DO NOT DELETE THIS LINE -- make depend depends on it.
diff --git a/http/about.html b/http/about.html
new file mode 100644
index 0000000..9726069
--- /dev/null
+++ b/http/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
+<html><head>
+<title>about alevtd</title>
+<link rel="stylesheet" type="text/css" href="/alevt.css">
+</head>
+<body>
+<b>about the alevt http daemon</b>
+<p>
+This daemon serves videotext pages as HTML.&nbsp; The vbi decoder is
+taken from <a href="http://user.exit.de/froese/">alevt
+1.5.1</a>.&nbsp; Source code of this deamon comes with <a
+href="http://www.strusel007.de/linux/xawtv/">xawtv</a>.
+<p>
+&copy; 1999-2000 Gerd Knorr &lt;kraxel@goldbach.in-berlin.de&gt; [http server]
+<br>
+&copy; 1998-2000 Edgar Toernig &lt;froese@gmx.de&gt; [vbi decoding, alevt]
+<hr noshade size=1>
+<a href="/100/">100</a> &nbsp;
+<a href="/200/">200</a> &nbsp;
+<a href="/300/">300</a> &nbsp;
+<a href="/400/">400</a> &nbsp;
+<a href="/500/">500</a> &nbsp;
+<a href="/600/">600</a> &nbsp;
+<a href="/700/">700</a> &nbsp;
+<a href="/800/">800</a> &nbsp;
+<a href="/about.html">about</a>
+</body>
+</html>
diff --git a/http/alevt.css b/http/alevt.css
new file mode 100644
index 0000000..08648b4
--- /dev/null
+++ b/http/alevt.css
@@ -0,0 +1,159 @@
+body { background-color: white; color: black }
+
+pre.vt { border: 1pt solid black; padding: 12pt }
+pre.vt { background-color: #c0c0c0; width: auto; float: left }
+pre.vt { white-space: pre }
+
+div.quick { clear: both }
+
+/* please don't re-color my links (underline is fine) */
+/* it would be that simple in theory,
+ but Mozilla/4 does not understand "inherit" *grumble*
+span a { color: inherit; background-color: inherit }
+*/
+
+/* videotext colors */
+span.c00 { color: #000000; background-color: #000000 }
+span.c10 { color: #ff0000; background-color: #000000 }
+span.c20 { color: #00ff00; background-color: #000000 }
+span.c30 { color: #ffff00; background-color: #000000 }
+span.c40 { color: #0000ff; background-color: #000000 }
+span.c50 { color: #ff00ff; background-color: #000000 }
+span.c60 { color: #00ffff; background-color: #000000 }
+span.c70 { color: #ffffff; background-color: #000000 }
+
+span.c01 { color: #000000; background-color: #ff0000 }
+span.c11 { color: #ff0000; background-color: #ff0000 }
+span.c21 { color: #00ff00; background-color: #ff0000 }
+span.c31 { color: #ffff00; background-color: #ff0000 }
+span.c41 { color: #0000ff; background-color: #ff0000 }
+span.c51 { color: #ff00ff; background-color: #ff0000 }
+span.c61 { color: #00ffff; background-color: #ff0000 }
+span.c71 { color: #ffffff; background-color: #ff0000 }
+
+span.c02 { color: #000000; background-color: #00ff00 }
+span.c12 { color: #ff0000; background-color: #00ff00 }
+span.c22 { color: #00ff00; background-color: #00ff00 }
+span.c32 { color: #ffff00; background-color: #00ff00 }
+span.c42 { color: #0000ff; background-color: #00ff00 }
+span.c52 { color: #ff00ff; background-color: #00ff00 }
+span.c62 { color: #00ffff; background-color: #00ff00 }
+span.c72 { color: #ffffff; background-color: #00ff00 }
+
+span.c03 { color: #000000; background-color: #ffff00 }
+span.c13 { color: #ff0000; background-color: #ffff00 }
+span.c23 { color: #00ff00; background-color: #ffff00 }
+span.c33 { color: #ffff00; background-color: #ffff00 }
+span.c43 { color: #0000ff; background-color: #ffff00 }
+span.c53 { color: #ff00ff; background-color: #ffff00 }
+span.c63 { color: #00ffff; background-color: #ffff00 }
+span.c73 { color: #ffffff; background-color: #ffff00 }
+
+span.c04 { color: #000000; background-color: #0000ff }
+span.c14 { color: #ff0000; background-color: #0000ff }
+span.c24 { color: #00ff00; background-color: #0000ff }
+span.c34 { color: #ffff00; background-color: #0000ff }
+span.c44 { color: #0000ff; background-color: #0000ff }
+span.c54 { color: #ff00ff; background-color: #0000ff }
+span.c64 { color: #00ffff; background-color: #0000ff }
+span.c74 { color: #ffffff; background-color: #0000ff }
+
+span.c05 { color: #000000; background-color: #ff00ff }
+span.c15 { color: #ff0000; background-color: #ff00ff }
+span.c25 { color: #00ff00; background-color: #ff00ff }
+span.c35 { color: #ffff00; background-color: #ff00ff }
+span.c45 { color: #0000ff; background-color: #ff00ff }
+span.c55 { color: #ff00ff; background-color: #ff00ff }
+span.c65 { color: #00ffff; background-color: #ff00ff }
+span.c75 { color: #ffffff; background-color: #ff00ff }
+
+span.c06 { color: #000000; background-color: #00ffff }
+span.c16 { color: #ff0000; background-color: #00ffff }
+span.c26 { color: #00ff00; background-color: #00ffff }
+span.c36 { color: #ffff00; background-color: #00ffff }
+span.c46 { color: #0000ff; background-color: #00ffff }
+span.c56 { color: #ff00ff; background-color: #00ffff }
+span.c66 { color: #00ffff; background-color: #00ffff }
+span.c76 { color: #ffffff; background-color: #00ffff }
+
+span.c07 { color: #000000; background-color: #ffffff }
+span.c17 { color: #ff0000; background-color: #ffffff }
+span.c27 { color: #00ff00; background-color: #ffffff }
+span.c37 { color: #ffff00; background-color: #ffffff }
+span.c47 { color: #0000ff; background-color: #ffffff }
+span.c57 { color: #ff00ff; background-color: #ffffff }
+span.c67 { color: #00ffff; background-color: #ffffff }
+span.c77 { color: #ffffff; background-color: #ffffff }
+
+/* The same again for all the links... */
+span.c00 a { color: #000000; background-color: #000000 }
+span.c10 a { color: #ff0000; background-color: #000000 }
+span.c20 a { color: #00ff00; background-color: #000000 }
+span.c30 a { color: #ffff00; background-color: #000000 }
+span.c40 a { color: #0000ff; background-color: #000000 }
+span.c50 a { color: #ff00ff; background-color: #000000 }
+span.c60 a { color: #00ffff; background-color: #000000 }
+span.c70 a { color: #ffffff; background-color: #000000 }
+
+span.c01 a { color: #000000; background-color: #ff0000 }
+span.c11 a { color: #ff0000; background-color: #ff0000 }
+span.c21 a { color: #00ff00; background-color: #ff0000 }
+span.c31 a { color: #ffff00; background-color: #ff0000 }
+span.c41 a { color: #0000ff; background-color: #ff0000 }
+span.c51 a { color: #ff00ff; background-color: #ff0000 }
+span.c61 a { color: #00ffff; background-color: #ff0000 }
+span.c71 a { color: #ffffff; background-color: #ff0000 }
+
+span.c02 a { color: #000000; background-color: #00ff00 }
+span.c12 a { color: #ff0000; background-color: #00ff00 }
+span.c22 a { color: #00ff00; background-color: #00ff00 }
+span.c32 a { color: #ffff00; background-color: #00ff00 }
+span.c42 a { color: #0000ff; background-color: #00ff00 }
+span.c52 a { color: #ff00ff; background-color: #00ff00 }
+span.c62 a { color: #00ffff; background-color: #00ff00 }
+span.c72 a { color: #ffffff; background-color: #00ff00 }
+
+span.c03 a { color: #000000; background-color: #ffff00 }
+span.c13 a { color: #ff0000; background-color: #ffff00 }
+span.c23 a { color: #00ff00; background-color: #ffff00 }
+span.c33 a { color: #ffff00; background-color: #ffff00 }
+span.c43 a { color: #0000ff; background-color: #ffff00 }
+span.c53 a { color: #ff00ff; background-color: #ffff00 }
+span.c63 a { color: #00ffff; background-color: #ffff00 }
+span.c73 a { color: #ffffff; background-color: #ffff00 }
+
+span.c04 a { color: #000000; background-color: #0000ff }
+span.c14 a { color: #ff0000; background-color: #0000ff }
+span.c24 a { color: #00ff00; background-color: #0000ff }
+span.c34 a { color: #ffff00; background-color: #0000ff }
+span.c44 a { color: #0000ff; background-color: #0000ff }
+span.c54 a { color: #ff00ff; background-color: #0000ff }
+span.c64 a { color: #00ffff; background-color: #0000ff }
+span.c74 a { color: #ffffff; background-color: #0000ff }
+
+span.c05 a { color: #000000; background-color: #ff00ff }
+span.c15 a { color: #ff0000; background-color: #ff00ff }
+span.c25 a { color: #00ff00; background-color: #ff00ff }
+span.c35 a { color: #ffff00; background-color: #ff00ff }
+span.c45 a { color: #0000ff; background-color: #ff00ff }
+span.c55 a { color: #ff00ff; background-color: #ff00ff }
+span.c65 a { color: #00ffff; background-color: #ff00ff }
+span.c75 a { color: #ffffff; background-color: #ff00ff }
+
+span.c06 a { color: #000000; background-color: #00ffff }
+span.c16 a { color: #ff0000; background-color: #00ffff }
+span.c26 a { color: #00ff00; background-color: #00ffff }
+span.c36 a { color: #ffff00; background-color: #00ffff }
+span.c46 a { color: #0000ff; background-color: #00ffff }
+span.c56 a { color: #ff00ff; background-color: #00ffff }
+span.c66 a { color: #00ffff; background-color: #00ffff }
+span.c76 a { color: #ffffff; background-color: #00ffff }
+
+span.c07 a { color: #000000; background-color: #ffffff }
+span.c17 a { color: #ff0000; background-color: #ffffff }
+span.c27 a { color: #00ff00; background-color: #ffffff }
+span.c37 a { color: #ffff00; background-color: #ffffff }
+span.c47 a { color: #0000ff; background-color: #ffffff }
+span.c57 a { color: #ff00ff; background-color: #ffffff }
+span.c67 a { color: #00ffff; background-color: #ffffff }
+span.c77 a { color: #ffffff; background-color: #ffffff }
diff --git a/http/alevtd.man b/http/alevtd.man
new file mode 100644
index 0000000..f84564f
--- /dev/null
+++ b/http/alevtd.man
@@ -0,0 +1,80 @@
+.TH alevtd 1 "(c) 2000 Gerd Knorr"
+.SH NAME
+alevtd - webserver for videotext pages
+.SH SYNOPSIS
+.B alevtd [ options ]
+.SH DESCRIPTION
+.B alevtd
+is http daemon which serves videotext pages as HTML. Tune in some
+station with a utility like v4lctl or some TV application. Then
+start it and point your browser to http://localhost:5654/
+.SH OPTIONS
+.TP
+.B -h
+print a short \fBh\fPelp text and the default values for all options.
+.TP
+.B -d
+enable \fBd\fPebug output.
+.TP
+.B -s
+Write a start/stop notice and serious errors to the \fBs\fPyslog.
+Specify this option twice to get a verbose log (additional log
+events like dropped connections).
+.TP
+.B -t sec
+set network \fBt\fPimeout to >sec< seconds.
+.TP
+.B -c n
+set the number of allowed parallel \fBc\fPonnections to >n<. This is
+a per-thread limit.
+.TP
+.B -p port
+listen on \fBp\fPort >port< for incoming connections. Default 5654.
+.TP
+.B -n hostname
+set the host\fBn\fPame which the server should use (required
+for redirects).
+.TP
+.B -i ip
+bind to \fBI\fPP-address >ip<.
+.TP
+.B -l log
+\fBl\fPog all requests to the logfile >log< (common log format).
+Using "-" as filename makes webfsd print the access log to stdout,
+which is only useful together with the -F switch (see below).
+.TP
+.B -L log
+same as above, but additional flush every line. Useful if you
+want monitor the logfile with tail -f.
+.TP
+.B -u user
+set \fBu\fPid to >user< (after binding to the tcp port). This
+option is allowed for root only.
+.TP
+.B -g group
+set \fBg\fPid to >group< (after binding to the tcp port). This
+option is allowed for root only.
+.TP
+.B -F
+don't run as daemon. webfsd will not fork into background, not detach
+from terminal and report errors to stderr.
+.SH SEE ALSO
+alevt(1), xawtv(1), v4lctl(1)
+.SH AUTHOR
+Gerd Knorr <kraxel@goldbach.in-berlin.de>
+.SH COPYRIGHT
+Copyright (C) 2000 Gerd Knorr <kraxel@goldbach.in-berlin.de>
+.P
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+.P
+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.
+.P
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
diff --git a/http/bottom.html b/http/bottom.html
new file mode 100644
index 0000000..34a2a8e
--- /dev/null
+++ b/http/bottom.html
@@ -0,0 +1,14 @@
+</pre>
+<div class=quick>
+<a href="/100/">100</a> &nbsp;
+<a href="/200/">200</a> &nbsp;
+<a href="/300/">300</a> &nbsp;
+<a href="/400/">400</a> &nbsp;
+<a href="/500/">500</a> &nbsp;
+<a href="/600/">600</a> &nbsp;
+<a href="/700/">700</a> &nbsp;
+<a href="/800/">800</a> &nbsp;
+<a href="/about.html">about</a>
+</div>
+</body>
+</html>
diff --git a/http/httpd.h b/http/httpd.h
new file mode 100644
index 0000000..20d2fe1
--- /dev/null
+++ b/http/httpd.h
@@ -0,0 +1,83 @@
+#include <sys/stat.h>
+
+#define STATE_READ_HEADER 1
+#define STATE_PARSE_HEADER 2
+#define STATE_WRITE_HEADER 3
+#define STATE_WRITE_BODY 4
+#define STATE_FINISHED 7
+
+#define STATE_KEEPALIVE 8
+#define STATE_CLOSE 9
+
+#define MAX_HEADER 4096
+#define BR_HEADER 512
+
+struct REQUEST {
+ int fd; /* socket handle */
+ int state; /* what to to ??? */
+ time_t ping; /* last read/write (for timeouts) */
+ int keep_alive;
+
+#ifdef HAVE_SOCKADDR_STORAGE
+ struct sockaddr_storage peer; /* client (log) */
+#else
+ struct sockaddr peer;
+#endif
+ char peerhost[65];
+ char peerserv[9];
+
+ /* request */
+ char hreq[MAX_HEADER+1]; /* request header */
+ int lreq; /* request length */
+ int hdata; /* data in hreq */
+ char type[16]; /* req type */
+ char uri[1024]; /* req uri */
+ char hostname[65]; /* hostname */
+ char path[1024]; /* file path */
+ int major,minor; /* http version */
+
+ /* response */
+ int status; /* status code (log) */
+ int bc; /* byte counter (log) */
+ char hres[MAX_HEADER+1]; /* response header */
+ int lres; /* header length */
+ char *mime; /* mime type */
+ char *body;
+ int lbody;
+ int free_the_mallocs;
+ int head_only;
+ off_t written;
+
+ /* linked list */
+ struct REQUEST *next;
+};
+
+/* --- main.c --------------------------------------------------- */
+
+extern int debug;
+extern int tcp_port;
+extern char *server_name;
+extern char server_host[];
+extern time_t now,start;
+
+extern struct vbi *vbi;
+extern struct export *fmt;
+
+void xperror(int loglevel, char *txt, char *peerhost);
+void xerror(int loglevel, char *txt, char *peerhost);
+
+/* --- request.c ------------------------------------------------ */
+
+void read_request(struct REQUEST *req, int pipelined);
+void parse_request(struct REQUEST *req);
+
+/* --- response.c ----------------------------------------------- */
+
+void mkerror(struct REQUEST *req, int status, int ka);
+void mkredirect(struct REQUEST *req);
+void mkheader(struct REQUEST *req, int status, time_t mtime);
+void write_request(struct REQUEST *req);
+
+/* --- page.c ----------------------------------------------- */
+
+void buildpage(struct REQUEST *req);
diff --git a/http/main.c b/http/main.c
new file mode 100644
index 0000000..18e6ab6
--- /dev/null
+++ b/http/main.c
@@ -0,0 +1,719 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+#include <signal.h>
+#include <syslog.h>
+#include <fcntl.h>
+#include <pwd.h>
+#include <grp.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <sys/signal.h>
+#include <sys/utsname.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <netdb.h>
+
+#include "httpd.h"
+
+/* libvbi */
+#include "vt.h"
+#include "misc.h"
+#include "fdset.h"
+#include "vbi.h"
+#include "lang.h"
+#include "dllist.h"
+#include "export.h"
+
+/* ---------------------------------------------------------------------- */
+/* public variables - server configuration */
+
+char *server_name = "alevt/1.5.1";
+
+int debug = 0;
+int dontdetach = 0;
+int timeout = 60;
+int keepalive_time = 5;
+int tcp_port = 0;
+char *listen_ip = NULL;
+char *listen_port = "5654";
+char server_host[256];
+char user[17];
+char group[17];
+char *logfile = NULL;
+FILE *log = NULL;
+int flushlog = 0;
+int usesyslog = 0;
+int have_tty = 1;
+int max_conn = 32;
+
+time_t now,start;
+int slisten;
+
+struct vbi *vbi;
+struct export *fmt;
+void vbi_handler(struct vbi *vbi, int fd);
+
+static void
+dummy_client(struct dl_head *reqs, struct vt_event *ev)
+{
+ struct vt_page *vtp;
+
+ if (!debug)
+ return;
+
+ switch (ev->type) {
+ case EV_PAGE:
+ vtp = ev->p1;
+ fprintf(stderr,"page %x.%02x \r", vtp->pgno, vtp->subno);
+ break;
+ }
+}
+
+/* ---------------------------------------------------------------------- */
+
+static int termsig,got_sighup;
+
+static void catchsig(int sig)
+{
+ if (SIGTERM == sig || SIGINT == sig)
+ termsig = sig;
+ if (SIGHUP == sig)
+ got_sighup = 1;
+}
+
+/* ---------------------------------------------------------------------- */
+
+static void
+usage(char *name)
+{
+ char *h;
+ struct passwd *pw;
+ struct group *gr;
+
+ h = strrchr(name,'/');
+ fprintf(stderr,
+ "alevt http daemon.\n"
+ "\n"
+ "usage: %s [ options ]\n"
+ "\n"
+ "Options:\n"
+ " -h print this text\n"
+ " -6 16 vbi lines (depending on the bttv version\n"
+ " -9 19 vbi lines one of these two should work)\n"
+ " -d enable debug output [%s]\n"
+ " -F do not fork into background [%s]\n"
+ " -s enable syslog (start/stop/errors) [%s]\n"
+ " -t sec set network timeout [%i]\n"
+ " -c n set max. allowed connections [%i]\n"
+ " -p port use tcp-port >port< [%s]\n"
+ " -n host server hostname is >host< [%s]\n"
+ " -i ip bind to IP-address >ip< [%s]\n"
+ " -l log write access log to file >log< [%s]\n"
+ " -L log same as above + flush every line\n",
+ h ? h+1 : name,
+ debug ? "on" : "off",
+ dontdetach ? "on" : "off",
+ usesyslog ? "on" : "off",
+ timeout, max_conn,
+ listen_port,
+ server_host,
+ listen_ip ? listen_ip : "any",
+ logfile ? logfile : "none");
+ if (getuid() == 0) {
+ pw = getpwuid(0);
+ gr = getgrgid(getgid());
+ fprintf(stderr,
+ " -u user run as user >user< [%s]\n"
+ " -g group run as group >group< [%s]\n",
+ pw ? pw->pw_name : "???",
+ gr ? gr->gr_name : "???");
+ }
+ exit(1);
+}
+
+static void
+fix_ug()
+{
+ struct passwd *pw = NULL;
+ struct group *gr = NULL;
+
+ /* root is allowed to use any uid/gid,
+ * others will get their real uid/gid */
+ if (0 == getuid() && strlen(user) > 0) {
+ if (NULL == (pw = getpwnam(user)))
+ pw = getpwuid(atoi(user));
+ } else {
+ pw = getpwuid(getuid());
+ }
+ if (0 == getuid() && strlen(group) > 0) {
+ if (NULL == (gr = getgrnam(group)))
+ gr = getgrgid(atoi(group));
+ } else {
+ gr = getgrgid(getgid());
+ }
+
+ if (NULL == pw) {
+ xerror(LOG_ERR,"user unknown",NULL);
+ exit(1);
+ }
+ if (NULL == gr) {
+ xerror(LOG_ERR,"group unknown",NULL);
+ exit(1);
+ }
+
+ /* set group */
+ if (getegid() != gr->gr_gid || getgid() != gr->gr_gid)
+ setgid(gr->gr_gid);
+ if (getegid() != gr->gr_gid || getgid() != gr->gr_gid) {
+ xerror(LOG_ERR,"setgid failed",NULL);
+ exit(1);
+ }
+ strncpy(group,gr->gr_name,16);
+
+ /* set user */
+ if (geteuid() != pw->pw_uid || getuid() != pw->pw_uid)
+ setuid(pw->pw_uid);
+ if (geteuid() != pw->pw_uid || getuid() != pw->pw_uid) {
+ xerror(LOG_ERR,"setuid failed",NULL);
+ exit(1);
+ }
+ strncpy(user,pw->pw_name,16);
+}
+
+/* ---------------------------------------------------------------------- */
+
+static void
+access_log(struct REQUEST *req, time_t now)
+{
+ char timestamp[32];
+
+ /* common log format: host ident authuser date request status bytes */
+ strftime(timestamp,31,"[%d/%b/%Y:%H:%M:%S +0000]",gmtime(&now));
+ if (0 == req->status)
+ req->status = 400; /* bad request */
+ if (400 == req->status) {
+ fprintf(log,"%s - - %s \"-\" 400 %d\n",
+ req->peerhost,
+ timestamp,
+ req->bc);
+ } else {
+ fprintf(log,"%s - - %s \"%s %s HTTP/%d.%d\" %d %d\n",
+ req->peerhost,
+ timestamp,
+ req->type,
+ req->uri,
+ req->major,
+ req->minor,
+ req->status,
+ req->bc);
+ }
+ if (flushlog)
+ fflush(log);
+}
+
+/*
+ * loglevel usage
+ * ERR : fatal errors (which are followed by exit(1))
+ * WARNING: this should'nt happen error (oom, ...)
+ * NOTICE : start/stop of the daemon
+ * INFO : "normal" errors (canceled downloads, timeouts,
+ * stuff what happens all the time)
+ */
+
+static void
+syslog_init()
+{
+ openlog("alevtd",LOG_PID, LOG_DAEMON);
+}
+
+static void
+syslog_start()
+{
+ syslog(LOG_NOTICE,
+ "started (listen on %s:%d, user=%s, group=%s)\n",
+ listen_ip,tcp_port,user,group);
+}
+
+static void
+syslog_stop()
+{
+ if (termsig)
+ syslog(LOG_NOTICE,"stopped on signal %d\n",termsig);
+ else
+ syslog(LOG_NOTICE,"stopped\n");
+ closelog();
+}
+
+void
+xperror(int loglevel, char *txt, char *peerhost)
+{
+ if (LOG_INFO == loglevel && usesyslog < 2 && !debug)
+ return;
+ if (have_tty) {
+ if (NULL == peerhost)
+ perror(txt);
+ else
+ fprintf(stderr,"%s: %s (peer=%s)\n",txt,strerror(errno),
+ peerhost);
+ }
+ if (usesyslog) {
+ if (NULL == peerhost)
+ syslog(loglevel,"%s: %s\n",txt,strerror(errno));
+ else
+ syslog(loglevel,"%s: %s (peer=%s)\n",txt,strerror(errno),
+ peerhost);
+ }
+}
+
+void
+xerror(int loglevel, char *txt, char *peerhost)
+{
+ if (LOG_INFO == loglevel && usesyslog < 2 && !debug)
+ return;
+ if (have_tty) {
+ if (NULL == peerhost)
+ fprintf(stderr,"%s\n",txt);
+ else
+ fprintf(stderr,"%s (peer=%s)\n",txt,peerhost);
+ }
+ if (usesyslog) {
+ if (NULL == peerhost)
+ syslog(loglevel,"%s\n",txt);
+ else
+ syslog(loglevel,"%s (peer=%s)\n",txt,peerhost);
+ }
+}
+
+/* ---------------------------------------------------------------------- */
+/* main loop */
+
+void*
+mainloop(void)
+{
+ struct REQUEST *conns = NULL;
+ int curr_conn = 0;
+
+ struct REQUEST *req,*prev,*tmp;
+ struct timeval tv;
+ int max,length;
+ fd_set rd,wr;
+
+ for (;!termsig;) {
+ if (got_sighup) {
+ if (NULL != logfile && 0 != strcmp(logfile,"-")) {
+ if (debug)
+ fprintf(stderr,"got SIGHUP, reopen logfile %s\n",logfile);
+ if (log) fclose(log);
+ if (NULL == (log = fopen(logfile,"a")))
+ xperror(LOG_WARNING,"reopen access log",NULL);
+ }
+ got_sighup = 0;
+ }
+ FD_ZERO(&rd);
+ FD_ZERO(&wr);
+ FD_SET(vbi->fd,&rd);
+ max = vbi->fd;
+ /* add listening socket */
+ if (curr_conn < max_conn) {
+ FD_SET(slisten,&rd);
+ max = slisten;
+ }
+ /* add connection sockets */
+ for (req = conns; req != NULL; req = req->next) {
+ switch (req->state) {
+ case STATE_KEEPALIVE:
+ case STATE_READ_HEADER:
+ FD_SET(req->fd,&rd);
+ if (req->fd > max)
+ max = req->fd;
+ break;
+ case STATE_WRITE_HEADER:
+ case STATE_WRITE_BODY:
+ FD_SET(req->fd,&wr);
+ if (req->fd > max)
+ max = req->fd;
+ break;
+ }
+ }
+ /* go! */
+ tv.tv_sec = keepalive_time;
+ tv.tv_usec = 0;
+ if (-1 == select(max+1,&rd,&wr,NULL,(curr_conn > 0) ? &tv : NULL)) {
+ if (debug)
+ perror("select");
+ continue;
+ }
+ now = time(NULL);
+
+ /* vbi data? */
+ if (FD_ISSET(vbi->fd,&rd))
+ vbi_handler(vbi,vbi->fd);
+
+ /* new connection ? */
+ if (FD_ISSET(slisten,&rd)) {
+ req = malloc(sizeof(struct REQUEST));
+ if (NULL == req) {
+ /* oom: let the request sit in the listen queue */
+ if (debug)
+ fprintf(stderr,"oom\n");
+ } else {
+ memset(req,0,sizeof(struct REQUEST));
+ if (-1 == (req->fd = accept(slisten,NULL,NULL))) {
+ if (EAGAIN != errno)
+ xperror(LOG_WARNING,"accept",NULL);
+ free(req);
+ } else {
+ fcntl(req->fd,F_SETFL,O_NONBLOCK);
+ req->state = STATE_READ_HEADER;
+ req->ping = now;
+ req->next = conns;
+ conns = req;
+ curr_conn++;
+ if (debug)
+ fprintf(stderr,"%03d: new request (%d)\n",req->fd,curr_conn);
+ length = sizeof(req->peer);
+ if (-1 == getpeername(req->fd,(struct sockaddr*)&(req->peer),&length)) {
+ xperror(LOG_WARNING,"getpeername",NULL);
+ req->state = STATE_CLOSE;
+ }
+ getnameinfo((struct sockaddr*)&req->peer,length,
+ req->peerhost,64,req->peerserv,8,
+ NI_NUMERICHOST | NI_NUMERICSERV);
+ if (debug)
+ fprintf(stderr,"%03d: connect from (%s)\n",
+ req->fd,req->peerhost);
+ }
+ }
+ }
+
+ /* check active connections */
+ for (req = conns, prev = NULL; req != NULL;) {
+ /* I/O */
+ if (FD_ISSET(req->fd,&rd)) {
+ if (req->state == STATE_KEEPALIVE)
+ req->state = STATE_READ_HEADER;
+ read_request(req,0);
+ req->ping = now;
+ }
+ if (FD_ISSET(req->fd,&wr)) {
+ write_request(req);
+ req->ping = now;
+ }
+
+ /* check timeouts */
+ if (req->state == STATE_KEEPALIVE) {
+ if (now > req->ping + keepalive_time) {
+ if (debug)
+ fprintf(stderr,"%03d: keepalive timeout\n",req->fd);
+ req->state = STATE_CLOSE;
+ }
+ } else {
+ if (now > req->ping + timeout) {
+ if (req->state == STATE_READ_HEADER) {
+ mkerror(req,408,0);
+ } else {
+ xerror(LOG_INFO,"network timeout",req->peerhost);
+ req->state = STATE_CLOSE;
+ }
+ }
+ }
+
+ /* header parsing */
+header_parsing:
+ if (req->state == STATE_PARSE_HEADER) {
+ parse_request(req);
+ if (req->state == STATE_WRITE_HEADER)
+ write_request(req);
+ }
+
+ /* handle finished requests */
+ if (req->state == STATE_FINISHED && !req->keep_alive)
+ req->state = STATE_CLOSE;
+ if (req->state == STATE_FINISHED) {
+ if (log)
+ access_log(req,now);
+ /* cleanup */
+ if (req->free_the_mallocs)
+ free(req->body);
+ req->free_the_mallocs = 0;
+ req->body = NULL;
+ req->written = 0;
+ req->head_only = 0;
+
+ if (req->hdata == req->lreq) {
+ /* ok, wait for the next one ... */
+ if (debug)
+ fprintf(stderr,"%03d: keepalive wait\n",req->fd);
+ req->state = STATE_KEEPALIVE;
+ req->hdata = 0;
+ req->lreq = 0;
+ } else {
+ /* there is a pipelined request in the queue ... */
+ if (debug)
+ fprintf(stderr,"%03d: keepalive pipeline\n",req->fd);
+ req->state = STATE_READ_HEADER;
+ memmove(req->hreq,req->hreq+req->lreq,
+ req->hdata-req->lreq);
+ req->hdata -= req->lreq;
+ req->lreq = 0;
+ read_request(req,1);
+ goto header_parsing;
+ }
+ }
+
+ /* connections to close */
+ if (req->state == STATE_CLOSE) {
+ if (log)
+ access_log(req,now);
+ /* cleanup */
+ close(req->fd);
+ curr_conn--;
+ if (debug)
+ fprintf(stderr,"%03d: done (%d)\n",req->fd,curr_conn);
+ /* unlink from list */
+ tmp = req;
+ if (prev == NULL) {
+ conns = req->next;
+ req = conns;
+ } else {
+ prev->next = req->next;
+ req = req->next;
+ }
+ /* free memory */
+ if (tmp->free_the_mallocs)
+ free(tmp->body);
+ free(tmp);
+ } else {
+ prev = req;
+ req = req->next;
+ }
+ }
+ }
+ return NULL;
+}
+
+/* ---------------------------------------------------------------------- */
+
+int
+main(int argc, char *argv[])
+{
+ struct sigaction act,old;
+ struct addrinfo ask,*res;
+#ifdef HAVE_SOCKADDR_STORAGE
+ struct sockaddr_storage ss;
+#else
+ struct sockaddr ss;
+#endif
+ int c, opt, rc, ss_len;
+ int bttv = -1;
+ char host[INET6_ADDRSTRLEN+1];
+ char serv[16];
+
+ gethostname(server_host,255);
+ memset(&ask,0,sizeof(ask));
+ ask.ai_flags = AI_CANONNAME;
+ if (0 == (rc = getaddrinfo(server_host, NULL, &ask, &res))) {
+ if (res->ai_canonname)
+ strcpy(server_host,res->ai_canonname);
+ }
+
+ /* parse options */
+ for (;;) {
+ if (-1 == (c = getopt(argc,argv,"69hsdFp:n:i:t:c:u:g:l:L:")))
+ break;
+ switch (c) {
+ case 'h':
+ usage(argv[0]);
+ break;
+ case '6':
+ bttv = 0;
+ break;
+ case '9':
+ bttv = 1;
+ break;
+ case 's':
+ usesyslog++;
+ break;
+ case 'd':
+ debug++;
+ break;
+ case 'F':
+ dontdetach++;
+ break;
+ case 'n':
+ strcpy(server_host,optarg);
+ break;
+ case 'i':
+ listen_ip = optarg;
+ break;
+ case 'p':
+ listen_port = optarg;
+ break;
+ case 't':
+ timeout = atoi(optarg);
+ break;
+ case 'c':
+ max_conn = atoi(optarg);
+ break;
+ case 'u':
+ strncpy(user,optarg,16);
+ break;
+ case 'g':
+ strncpy(group,optarg,16);
+ break;
+ case 'L':
+ flushlog = 1;
+ /* fall through */
+ case 'l':
+ logfile = optarg;
+ break;
+ default:
+ exit(1);
+ }
+ }
+ if (usesyslog)
+ syslog_init();
+
+ /* open vbi device */
+ fdset_init(fds);
+ vbi = vbi_open("/dev/vbi", cache_open(), 0, bttv);
+ if (vbi == 0) {
+ xperror(LOG_ERR,"cannot open /dev/vbi",NULL);
+ exit(1);
+ }
+ fmt = export_open("ascii");
+ vbi_add_handler(vbi, dummy_client, NULL);
+#if 0
+ if (vbi->cache)
+ vbi->cache->op->mode(vbi->cache, CACHE_MODE_ERC, erc);
+#endif
+
+ /* bind to socket */
+ slisten = -1;
+ memset(&ask,0,sizeof(ask));
+ ask.ai_flags = AI_PASSIVE;
+ if (listen_ip)
+ ask.ai_flags |= AI_CANONNAME;
+ ask.ai_socktype = SOCK_STREAM;
+
+ /* try ipv6 first ... */
+ ask.ai_family = PF_INET6;
+ if (0 != (rc = getaddrinfo(listen_ip, listen_port, &ask, &res))) {
+ if (debug)
+ fprintf(stderr,"getaddrinfo (ipv6): %s\n",gai_strerror(rc));
+ } else {
+ if (-1 == (slisten = socket(res->ai_family, res->ai_socktype,
+ res->ai_protocol)) && debug)
+ xperror(LOG_ERR,"socket (ipv6)",NULL);
+ }
+
+ /* ... failing that try ipv4 */
+ if (-1 == slisten) {
+ ask.ai_family = PF_INET;
+ if (0 != (rc = getaddrinfo(listen_ip, listen_port, &ask, &res))) {
+ fprintf(stderr,"getaddrinfo (ipv4): %s\n",gai_strerror(rc));
+ exit(1);
+ }
+ if (-1 == (slisten = socket(res->ai_family, res->ai_socktype,
+ res->ai_protocol))) {
+ xperror(LOG_ERR,"socket (ipv4)",NULL);
+ exit(1);
+ }
+ }
+
+ memcpy(&ss,res->ai_addr,res->ai_addrlen);
+ ss_len = res->ai_addrlen;
+ if (res->ai_canonname)
+ strcpy(server_host,res->ai_canonname);
+ if (0 != (rc = getnameinfo((struct sockaddr*)&ss,ss_len,
+ host,INET6_ADDRSTRLEN,serv,15,
+ NI_NUMERICHOST | NI_NUMERICSERV))) {
+ fprintf(stderr,"getnameinfo: %s\n",gai_strerror(rc));
+ exit(1);
+ }
+
+ tcp_port = atoi(serv);
+ opt = 1;
+ setsockopt(slisten,SOL_SOCKET,SO_REUSEADDR,&opt,sizeof(opt));
+ fcntl(slisten,F_SETFL,O_NONBLOCK);
+
+ if (-1 == bind(slisten, (struct sockaddr*) &ss, ss_len)) {
+ xperror(LOG_ERR,"bind",NULL);
+ exit(1);
+ }
+ if (-1 == listen(slisten, 2*max_conn)) {
+ xperror(LOG_ERR,"listen",NULL);
+ exit(1);
+ }
+
+ /* change user/group - also does chroot */
+ fix_ug();
+
+ if (logfile) {
+ if (0 == strcmp(logfile,"-")) {
+ log = stdout;
+ } else {
+ if (NULL == (log = fopen(logfile,"a")))
+ xperror(LOG_WARNING,"open access log",NULL);
+ }
+ }
+
+ if (debug) {
+ fprintf(stderr,
+ "alevt http server started\n"
+ " ipv6 : %s\n"
+ " node : %s\n"
+ " ipaddr: %s\n"
+ " port : %d\n"
+ " user : %s\n"
+ " group : %s\n",
+ res->ai_family == PF_INET6 ? "yes" : "no",
+ server_host,host,tcp_port,user,group);
+ }
+
+ /* run as daemon - detach from terminal */
+ if ((!debug) && (!dontdetach)) {
+ switch (fork()) {
+ case -1:
+ xperror(LOG_ERR,"fork",NULL);
+ exit(1);
+ case 0:
+ close(0); close(1); close(2); setsid();
+ have_tty = 0;
+ break;
+ default:
+ exit(0);
+ }
+ }
+ if (usesyslog) {
+ syslog_start();
+ atexit(syslog_stop);
+ }
+
+ /* setup signal handler */
+ memset(&act,0,sizeof(act));
+ sigemptyset(&act.sa_mask);
+ act.sa_handler = SIG_IGN;
+ sigaction(SIGPIPE,&act,&old);
+ act.sa_handler = catchsig;
+ sigaction(SIGHUP,&act,&old);
+ sigaction(SIGTERM,&act,&old);
+ if (debug)
+ sigaction(SIGINT,&act,&old);
+
+ /* go! */
+ start = time(NULL);
+ mainloop();
+
+ if (log)
+ fclose(log);
+ if (debug)
+ fprintf(stderr,"bye...\n");
+ exit(0);
+}
diff --git a/http/page.c b/http/page.c
new file mode 100644
index 0000000..33c20b0
--- /dev/null
+++ b/http/page.c
@@ -0,0 +1,279 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <ctype.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+
+#include "httpd.h"
+
+/* libvbi */
+#include "vt.h"
+#include "misc.h"
+#include "fdset.h"
+#include "vbi.h"
+#include "lang.h"
+#include "dllist.h"
+#include "export.h"
+
+void fmt_page(struct export *e, struct fmt_page *pg, struct vt_page *vtp);
+
+#define BUFSIZE 4096
+
+/* ---------------------------------------------------------------------- */
+
+static char stylesheet[] =
+#include "alevt.css.h"
+;
+
+static char page_about[] =
+#include "about.html.h"
+;
+
+static char page_top[] =
+#include "top.html.h"
+;
+
+static char page_bottom[] =
+#include "bottom.html.h"
+;
+
+/* ---------------------------------------------------------------------- */
+
+static void vbipage(struct REQUEST *req, struct vt_page *page)
+{
+ char *out;
+ int size,len,x,y;
+ int color,lcolor,link;
+ struct fmt_page pg[1];
+
+ struct fmt_char l[W+2];
+#define L (l+1)
+
+ fmt_page(fmt,pg,page);
+ size = 2*BUFSIZE;
+ out = malloc(size);
+ len = 0;
+
+ len += sprintf(out+len,page_top,page->pgno,page->subno);
+ for (y = 0; y < H; y++) {
+ if (~pg->hid & (1 << y)) { /* !hidden */
+ for (x = 0; x < W; ++x) {
+ struct fmt_char c = pg->data[y][x];
+ switch (c.ch) {
+ case 0x00:
+ case 0xa0:
+ c.ch = ' ';
+ break;
+ case 0x7f:
+ c.ch = '*';
+ break;
+ case BAD_CHAR:
+ c.ch = '?';
+ break;
+ default:
+ if (c.attr & EA_GRAPHIC)
+ c.ch = '#';
+ break;
+ }
+ L[x] = c;
+ }
+
+ /* delay fg and attr changes as far as possible */
+ for (x = 0; x < W; ++x)
+ if (L[x].ch == ' ') {
+ L[x].fg = L[x-1].fg;
+ l[x].attr = L[x-1].attr;
+ }
+
+ /* move fg and attr changes to prev bg change point */
+ for (x = W-1; x >= 0; x--)
+ if (L[x].ch == ' ' && L[x].bg == L[x+1].bg) {
+ L[x].fg = L[x+1].fg;
+ L[x].attr = L[x+1].attr;
+ }
+
+ /* now emit the whole line */
+ lcolor = -1; link = -1;
+ for (x = 0; x < W; ++x) {
+ /* close link tags */
+ if (link >= 0) {
+ if (0 == link)
+ len += sprintf(out+len,"</a>");
+ link--;
+ }
+
+ /* color handling */
+ color = (L[x].fg&0x0f) * 10 + (L[x].bg&0x0f);
+ if (color != lcolor) {
+ if (-1 != lcolor)
+ len += sprintf(out+len,"</span>");
+ len += sprintf(out+len,"<span class=\"c%02d\">",color);
+ lcolor = color;
+ }
+
+ /* check for refences to other pages */
+ if (y > 0 && -1 == link && x < W-2 &&
+ isdigit(L[x].ch) &&
+ isdigit(L[x+1].ch) &&
+ isdigit(L[x+2].ch) &&
+ !isdigit(L[x+3].ch) &&
+ !isdigit(L[x-1].ch)) {
+ len += sprintf(out+len,"<a href=\"/%c%c%c/\">",
+ L[x].ch, L[x+1].ch, L[x+2].ch);
+ link = 2;
+ }
+ if (y > 0 && -1 == link && x < W-1 &&
+ '>' == L[x].ch &&
+ '>' == L[x+1].ch) {
+ len += sprintf(out+len,"<a href=\"/%03x/\">",
+ page->pgno+1);
+ link = 1;
+ }
+ if (y > 0 && -1 == link && x < W-1 &&
+ '<' == L[x].ch &&
+ '<' == L[x+1].ch) {
+ len += sprintf(out+len,"<a href=\"/%03x/\">",
+ page->pgno-1);
+ link = 1;
+ }
+ /* check for refences to other subpages */
+ if (y > 0 && -1 == link && x < W-2 &&
+ page->subno > 0 &&
+ isdigit(L[x].ch) &&
+ '/' == L[x+1].ch &&
+ isdigit(L[x+2].ch) &&
+ !isdigit(L[x+3].ch) &&
+ !isdigit(L[x-1].ch)) {
+ if (L[x].ch == L[x+2].ch) {
+ len += sprintf(out+len,"<a href=\"01.html\">");
+ } else {
+ len += sprintf(out+len,"<a href=\"%02x.html\">",
+ L[x].ch+1-'0');
+ }
+ link = 2;
+ }
+ /* check for FastText links */
+ if (page->flof && -1 == link && x<W-2 &&
+ 24 == y &&
+ L[x].fg>0 &&
+ L[x].fg<8 &&
+ x>0 &&
+ !isspace(L[x].ch)) {
+ link=(L[x].fg==6?3:L[x].fg-1);
+ if(page->link[link].subno == ANY_SUB)
+ {
+ len+=sprintf(out+len,"<a href=\"/%03x/\">",
+ page->link[link].pgno);
+ }
+ else
+ {
+ len+=sprintf(out+len,"<a href=\"/%03x/%02x.html\">",
+ page->link[link].pgno,
+ page->link[link].subno);
+ }
+ link=0;
+ while((L[x+link].fg == L[x].fg) && (x+link<W))
+ {
+ link++;
+ }
+ link--;
+ if(link<1)
+ {
+ link=1;
+ }
+ }
+ out[len++] = L[x].ch;
+ }
+ /* close any tags + put newline */
+ if (link >= 0)
+ len += sprintf(out+len,"</a>");
+ if (-1 != lcolor)
+ len += sprintf(out+len,"</span>");
+ out[len++] = '\n';
+
+ /* check bufsize */
+ if (len + BUFSIZE > size) {
+ size += BUFSIZE;
+ out = realloc(out,size);
+ }
+ }
+ }
+ len += sprintf(out+len,"%s",page_bottom);
+
+ req->mime = "text/html; charset=\"iso-8859-1\"";
+ req->body = out;
+ req->lbody = len;
+ req->free_the_mallocs = 1;
+ mkheader(req,200,-1);
+}
+
+/* ---------------------------------------------------------------------- */
+
+void buildpage(struct REQUEST *req)
+{
+ int pagenr, subpage;
+ struct vt_page *page;
+
+ /* style sheet */
+ if (0 == strcmp(req->path,"/alevt.css")) {
+ req->mime = "text/css";
+ req->body = stylesheet;
+ req->lbody = sizeof(stylesheet);
+ mkheader(req,200,start);
+ return;
+ }
+
+ /* about */
+ if (0 == strcmp(req->path,"/about.html")) {
+ req->mime = "text/html; charset=\"iso-8859-1\"";
+ req->body = page_about;
+ req->lbody = sizeof(page_about);
+ mkheader(req,200,start);
+ return;
+ }
+
+ /* entry page */
+ if (0 == strcmp(req->path,"/")) {
+ strcpy(req->path,"/100/");
+ mkredirect(req);
+ return;
+ }
+
+ /* page with subpages */
+ if (2 == sscanf(req->path,"/%3x/%2x.html",&pagenr,&subpage)) {
+ if (debug)
+ fprintf(stderr,"trying %03x/%02x\n",pagenr,subpage);
+ page = vbi->cache->op->get(vbi->cache,pagenr,subpage);
+ if (NULL != page) {
+ vbipage(req,page);
+ return;
+ }
+ mkerror(req,404,1);
+ return;
+ }
+
+ /* ... without subpage */
+ if (1 == sscanf(req->path,"/%3x/",&pagenr)) {
+ if (debug)
+ fprintf(stderr,"trying %03x\n",pagenr);
+ page = vbi->cache->op->get(vbi->cache,pagenr,0);
+ if (NULL != page) {
+ vbipage(req,page);
+ return;
+ }
+ page = vbi->cache->op->get(vbi->cache,pagenr,ANY_SUB);
+ if (NULL != page) {
+ sprintf(req->path,"/%03x/%02x.html",pagenr,page->subno);
+ mkredirect(req);
+ return;
+ }
+ mkerror(req,404,1);
+ return;
+ }
+
+ mkerror(req,404,1);
+ return;
+}
diff --git a/http/request.c b/http/request.c
new file mode 100644
index 0000000..d37960b
--- /dev/null
+++ b/http/request.c
@@ -0,0 +1,192 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <syslog.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+
+#include "httpd.h"
+
+/* ---------------------------------------------------------------------- */
+
+void
+read_request(struct REQUEST *req, int pipelined)
+{
+ int rc;
+ char *h;
+
+ restart:
+ rc = read(req->fd, req->hreq + req->hdata, MAX_HEADER - req->hdata);
+ switch (rc) {
+ case -1:
+ if (errno == EAGAIN) {
+ if (pipelined)
+ break; /* check if there is already a full request */
+ else
+ return;
+ }
+ if (errno == EINTR)
+ goto restart;
+ xperror(LOG_INFO,"read",req->peerhost);
+ /* fall through */
+ case 0:
+ req->state = STATE_CLOSE;
+ return;
+ default:
+ req->hdata += rc;
+ req->hreq[req->hdata] = 0;
+ }
+
+ /* check if this looks like a http request after
+ the first few bytes... */
+ if (req->hdata < 5)
+ return;
+ if (strncmp(req->hreq,"GET ",4) != 0 &&
+ strncmp(req->hreq,"PUT ",4) != 0 &&
+ strncmp(req->hreq,"HEAD ",5) != 0 &&
+ strncmp(req->hreq,"POST ",5) != 0) {
+ mkerror(req,400,0);
+ return;
+ }
+
+ /* header complete ?? */
+ if (NULL != (h = strstr(req->hreq,"\r\n\r\n")) ||
+ NULL != (h = strstr(req->hreq,"\n\n"))) {
+ if (*h == '\r') {
+ h += 4;
+ *(h-2) = 0;
+ } else {
+ h += 2;
+ *(h-1) = 0;
+ }
+ req->lreq = h - req->hreq;
+ req->state = STATE_PARSE_HEADER;
+ return;
+ }
+
+ if (req->hdata == MAX_HEADER) {
+ /* oops: buffer full, but found no complete request ... */
+ mkerror(req,400,0);
+ return;
+ }
+ return;
+}
+
+/* ---------------------------------------------------------------------- */
+
+static int
+unhex(unsigned char c)
+{
+ if (c < '@')
+ return c - '0';
+ return (c & 0x0f) + 9;
+}
+
+static void
+unquote(unsigned char *dst, unsigned char *src)
+{
+ int i,j,q,n=strlen(src);
+
+ q=0;
+ for (i=0, j=0; i<n; i++, j++) {
+ if (src[i] == '?')
+ q = 1;
+ if (q && src[i] == '+') {
+ dst[j] = ' ';
+ } else if (src[i] == '%') {
+ dst[j] = (unhex(src[i+1]) << 4) | unhex(src[i+2]);
+ i += 2;
+ } else {
+ dst[j] = src[i];
+ }
+ }
+ dst[j] = 0;
+}
+
+void
+parse_request(struct REQUEST *req)
+{
+ char filename[2048], proto[5], *h;
+ int port;
+
+ if (debug > 2)
+ fprintf(stderr,"%s\n",req->hreq);
+
+ /* parse request. Hehe, scanf is powerfull :-) */
+ if (4 != sscanf(req->hreq, "%4[A-Z] %255[^ \t\r\n] HTTP/%d.%d",
+ req->type,filename,&(req->major),&(req->minor))) {
+ mkerror(req,400,0);
+ return;
+ }
+ if (filename[0] == '/') {
+ strcpy(req->uri,filename);
+ } else {
+ port = 0;
+ *proto = 0;
+ if (4 != sscanf(filename,"%4[a-zA-Z]://%64[a-zA-Z0-9.-]:%d%255[^ \t\r\n]",
+ proto,req->hostname,&port,req->uri) &&
+ 3 != sscanf(filename,"%4[a-zA-Z]://%64[a-zA-Z0-9.-]%255[^ \t\r\n]",
+ proto,req->hostname,req->uri)) {
+ mkerror(req,400,0);
+ return;
+ }
+ if (*proto != 0 && 0 != strcasecmp(proto,"http")) {
+ mkerror(req,400,0);
+ return;
+ }
+ }
+
+ unquote(req->path,req->uri);
+ if (debug)
+ fprintf(stderr,"%03d: %s \"%s\" HTTP/%d.%d\n",
+ req->fd, req->type, req->path, req->major, req->minor);
+
+ if (0 != strcmp(req->type,"GET") &&
+ 0 != strcmp(req->type,"HEAD")) {
+ mkerror(req,501,0);
+ return;
+ }
+
+ if (0 == strcmp(req->type,"HEAD")) {
+ req->head_only = 1;
+ }
+
+ /* checks */
+ if (req->path[0] != '/') {
+ mkerror(req,400,0);
+ return;
+ }
+
+ /* parse header lines */
+ req->keep_alive = req->minor;
+ for (h = req->hreq; h - req->hreq < req->lreq;) {
+ h = strchr(h,'\n');
+ if (NULL == h)
+ break;
+ h++;
+
+ if (0 == strncasecmp(h,"Connection: ",12)) {
+ req->keep_alive = (0 == strncasecmp(h+12,"Keep-Alive",10));
+
+ } else if (0 == strncasecmp(h,"Host: ",6)) {
+ sscanf(h+6,"%64[a-zA-Z0-9.-]",req->hostname);
+ }
+ }
+
+ /* take care about the hostname */
+ strncpy(req->hostname,server_host,64);
+ for (h = req->hostname; *h != 0; h++) {
+ if (*h < 'A' || *h > 'Z')
+ continue;
+ *h += 32;
+ }
+
+ /* handle request (more to come) */
+ buildpage(req);
+ return;
+}
diff --git a/http/response.c b/http/response.c
new file mode 100644
index 0000000..fc5f674
--- /dev/null
+++ b/http/response.c
@@ -0,0 +1,189 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <syslog.h>
+
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+
+#include "httpd.h"
+
+/* ---------------------------------------------------------------------- */
+
+static struct HTTP_STATUS {
+ int status;
+ char *head;
+ char *body;
+} http[] = {
+ { 200, "200 OK", NULL },
+ { 400, "400 Bad Request", "*PLONK*\n" },
+ { 404, "404 Not Found", "File or directory not found\n" },
+ { 408, "408 Request Timeout", "Request Timeout\n" },
+ { 500, "500 Internal Server Error", "Sorry folks\n" },
+ { 501, "501 Not Implemented", "Sorry folks\n" },
+ { 0, NULL, NULL }
+};
+
+/* ---------------------------------------------------------------------- */
+
+#define RESPONSE_START \
+ "HTTP/1.1 %s\r\n" \
+ "Server: %s\r\n" \
+ "Connection: %s\r\n" \
+ "Accept-Ranges: bytes\r\n"
+#define RFCTIME \
+ "%a, %d %b %Y %H:%M:%S GMT"
+#define BOUNDARY \
+ "XXX_CUT_HERE_%ld_XXX"
+
+void
+mkerror(struct REQUEST *req, int status, int ka)
+{
+ int i;
+ for (i = 0; http[i].status != 0; i++)
+ if (http[i].status == status)
+ break;
+ req->status = status;
+ req->body = http[i].body;
+ req->lbody = strlen(req->body);
+ if (!ka)
+ req->keep_alive = 0;
+ req->lres = sprintf(req->hres,
+ RESPONSE_START
+ "Content-Type: text/plain\r\n"
+ "Content-Length: %d\r\n",
+ http[i].head,server_name,
+ req->keep_alive ? "Keep-Alive" : "Close",
+ req->lbody);
+ if (401 == status)
+ req->lres += sprintf(req->hres+req->lres,
+ "WWW-Authenticate: Basic, realm=\"webfs\"\r\n");
+ req->lres += strftime(req->hres+req->lres,80,
+ "Date: " RFCTIME "\r\n\r\n",
+ gmtime(&now));
+ req->state = STATE_WRITE_HEADER;
+ if (debug)
+ fprintf(stderr,"%03d: error: %d, connection=%s\n",
+ req->fd, status, req->keep_alive ? "Keep-Alive" : "Close");
+}
+
+void
+mkredirect(struct REQUEST *req)
+{
+ req->status = 302;
+ req->body = req->path;
+ req->lbody = strlen(req->body);
+ req->lres = sprintf(req->hres,
+ RESPONSE_START
+ "Location: http://%s:%d%s\r\n"
+ "Content-Type: text/plain\r\n"
+ "Content-Length: %d\r\n",
+ "302 Redirect",server_name,
+ req->keep_alive ? "Keep-Alive" : "Close",
+ req->hostname,tcp_port,req->path,
+ req->lbody);
+ req->lres += strftime(req->hres+req->lres,80,
+ "Date: " RFCTIME "\r\n\r\n",
+ gmtime(&now));
+ req->state = STATE_WRITE_HEADER;
+ if (debug)
+ fprintf(stderr,"%03d: 302 redirect: %s, connection=%s\n",
+ req->fd, req->path, req->keep_alive ? "Keep-Alive" : "Close");
+}
+
+void
+mkheader(struct REQUEST *req, int status, time_t mtime)
+{
+ int i;
+ for (i = 0; http[i].status != 0; i++)
+ if (http[i].status == status)
+ break;
+ req->status = status;
+ req->lres = sprintf(req->hres,
+ RESPONSE_START,
+ http[i].head,server_name,
+ req->keep_alive ? "Keep-Alive" : "Close");
+ req->lres += sprintf(req->hres+req->lres,
+ "Content-Type: %s\r\n"
+ "Content-Length: %d\r\n",
+ req->mime,
+ req->lbody);
+ if (mtime != -1)
+ req->lres += strftime(req->hres+req->lres,80,
+ "Last-Modified: " RFCTIME "\r\n",
+ gmtime(&mtime));
+ req->lres += strftime(req->hres+req->lres,80,
+ "Date: " RFCTIME "\r\n\r\n",
+ gmtime(&now));
+ req->state = STATE_WRITE_HEADER;
+ if (debug)
+ fprintf(stderr,"%03d: %d, connection=%s\n",
+ req->fd, status, req->keep_alive ? "Keep-Alive" : "Close");
+}
+
+/* ---------------------------------------------------------------------- */
+
+void write_request(struct REQUEST *req)
+{
+ int rc;
+
+ for (;;) {
+ switch (req->state) {
+ case STATE_WRITE_HEADER:
+ rc = write(req->fd,req->hres + req->written,
+ req->lres - req->written);
+ switch (rc) {
+ case -1:
+ if (errno == EAGAIN)
+ return;
+ if (errno == EINTR)
+ continue;
+ xperror(LOG_INFO,"write",req->peerhost);
+ /* fall through */
+ case 0:
+ req->state = STATE_CLOSE;
+ return;
+ default:
+ req->written += rc;
+ req->bc += rc;
+ if (req->written != req->lres)
+ return;
+ }
+ req->written = 0;
+ if (req->head_only) {
+ req->state = STATE_FINISHED;
+ return;
+ } else {
+ req->state = STATE_WRITE_BODY;
+ }
+ break;
+ case STATE_WRITE_BODY:
+ rc = write(req->fd,req->body + req->written,
+ req->lbody - req->written);
+ switch (rc) {
+ case -1:
+ if (errno == EAGAIN)
+ return;
+ if (errno == EINTR)
+ continue;
+ xperror(LOG_INFO,"write",req->peerhost);
+ /* fall through */
+ case 0:
+ req->state = STATE_CLOSE;
+ return;
+ default:
+ req->written += rc;
+ req->bc += rc;
+ if (req->written != req->lbody)
+ return;
+ }
+ req->state = STATE_FINISHED;
+ return;
+ } /* switch(state) */
+ } /* for (;;) */
+}
diff --git a/http/top.html b/http/top.html
new file mode 100644
index 0000000..a67ab20
--- /dev/null
+++ b/http/top.html
@@ -0,0 +1,7 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
+<html><head>
+<title>page %03x/%02x</title>
+<link rel="stylesheet" type="text/css" href="/alevt.css">
+</head>
+<body>
+<pre class=vt>
diff --git a/i2c/Makefile b/i2c/Makefile
deleted file mode 100644
index e0dc809..0000000
--- a/i2c/Makefile
+++ /dev/null
@@ -1,17 +0,0 @@
-# Generated automatically from Makefile.in by configure.
-srcdir=.
-
-PROGS=detect eeprom #scan
-
-CC=gcc
-CFLAGS=-Wall
-
-all: $(PROGS)
-
-clean:
- rm -f $(PROGS) *~
-
-distclean realclean: clean
- rm -f Makefile
-
-dep depend install:
diff --git a/i2c/Makefile.in b/i2c/Makefile.in
index 907250d..151e1bd 100644
--- a/i2c/Makefile.in
+++ b/i2c/Makefile.in
@@ -9,9 +9,9 @@ CFLAGS=-Wall
all: $(PROGS)
clean:
- rm -f $(PROGS) *~
+ rm -f $(PROGS)
distclean realclean: clean
- rm -f Makefile
+ rm -f Makefile *~ *.bak
dep depend install:
diff --git a/libvbi/Makefile.in b/libvbi/Makefile.in
new file mode 100644
index 0000000..a100d8b
--- /dev/null
+++ b/libvbi/Makefile.in
@@ -0,0 +1,38 @@
+srcdir=@srcdir@
+VPATH=$(srcdir)
+
+OS:=$(shell uname -s | tr "A-Z" "a-z")
+
+CC=@CC@
+DEPEND=@DEPEND@
+
+CFLAGS=-Wall -O2 -g
+
+ifeq ($(OS),openbsd)
+ CFLAGS += -DBSD
+endif
+
+# from alevt
+OBJS=vbi.o fdset.o misc.o hamm.o lang.o cache.o \
+ font.o export.o exp-gfx.o exp-html.o exp-txt.o
+
+all build: libvbi.a
+
+libvbi.a: $(OBJS)
+ rm -f $@
+ ar -r $@ $^
+ ranlib $@
+
+clean:
+ rm -f libvbi.a $(OBJS)
+
+distclean realclean: clean
+ rm -f Makefile *~ *.bak
+
+install:
+
+depend dep:
+ $(DEPEND) -- $(CFLAGS) -- *.c
+
+#-------------------------------------------------------------------------
+# DO NOT DELETE THIS LINE -- make depend depends on it.
diff --git a/libvbi/README b/libvbi/README
new file mode 100644
index 0000000..b77bfa5
--- /dev/null
+++ b/libvbi/README
@@ -0,0 +1,6 @@
+This is for vbi decoding. Taken from alevt 1.5.1.
+Changes:
+ * Makefile written from scratch.
+ * cache.c: removed help pages.
+ * vbi.c: removed "static" from vbi_handler
+ * export.c: removed "static" from fmt_page
diff --git a/libvbi/cache.c b/libvbi/cache.c
new file mode 100644
index 0000000..8d63cb8
--- /dev/null
+++ b/libvbi/cache.c
@@ -0,0 +1,264 @@
+#include <stdlib.h>
+#include <string.h>
+#include "misc.h"
+#include "dllist.h"
+#include "cache.h"
+#if 0 /* kraxel */
+#include "help.h"
+#endif
+
+/*
+ There are some subtleties in this cache.
+
+ - Simple hash is used.
+ - All subpages of a page are in the same hash chain.
+ - The newest subpage is at the front.
+
+
+ Hmm... maybe a tree would be better...
+*/
+
+//static struct cache_ops cops;
+
+static inline int
+hash(int pgno)
+{
+ // very simple...
+ return pgno % HASH_SIZE;
+}
+
+static void
+do_erc(struct vt_page *ovtp, struct vt_page *nvtp)
+{
+ int l, c;
+
+ if (nvtp->errors == 0 && ovtp->lines == nvtp->lines)
+ return;
+
+ for (l = 0; l < H; ++l)
+ {
+ if (~nvtp->lines & (1 << l))
+ memcpy(nvtp->data[l], ovtp->data[l], W);
+ else if (ovtp->lines & (1 << l))
+ for (c = 0; c < W; ++c)
+ if (nvtp->data[l][c] == BAD_CHAR)
+ nvtp->data[l][c] = ovtp->data[l][c];
+ }
+ nvtp->lines |= ovtp->lines;
+}
+
+static void
+cache_close(struct cache *ca)
+{
+ struct cache_page *cp;
+ int i;
+
+ for (i = 0; i < HASH_SIZE; ++i)
+ while (not dl_empty(ca->hash + i))
+ {
+ cp = $ ca->hash[i].first;
+ dl_remove(cp->node);
+ free(cp);
+ }
+ free(ca);
+}
+
+static void
+cache_reset(struct cache *ca)
+{
+ struct cache_page *cp, *cpn;
+ int i;
+
+ for (i = 0; i < HASH_SIZE; ++i)
+ for (cp = $ ca->hash[i].first; cpn = $ cp->node->next; cp = cpn)
+ if (cp->page->pgno / 256 != 9) // don't remove help pages
+ {
+ dl_remove(cp->node);
+ free(cp);
+ ca->npages--;
+ }
+ memset(ca->hi_subno, 0, sizeof(ca->hi_subno[0]) * 0x900);
+}
+
+
+
+/*
+ Get a page from the cache.
+ If subno is SUB_ANY, the newest subpage of that page is returned
+*/
+
+static struct vt_page *
+cache_get(struct cache *ca, int pgno, int subno)
+{
+ struct cache_page *cp;
+ int h = hash(pgno);
+
+ for (cp = $ ca->hash[h].first; cp->node->next; cp = $ cp->node->next)
+ if (cp->page->pgno == pgno)
+ if (subno == ANY_SUB || cp->page->subno == subno)
+ {
+ // found, move to front (make it 'new')
+ dl_insert_first(ca->hash + h, dl_remove(cp->node));
+ return cp->page;
+ }
+ return 0;
+}
+
+
+/*
+ Put a page in the cache.
+ If it's already there, it is updated.
+*/
+
+static struct vt_page *
+cache_put(struct cache *ca, struct vt_page *vtp)
+{
+ struct cache_page *cp;
+ int h = hash(vtp->pgno);
+
+ for (cp = $ ca->hash[h].first; cp->node->next; cp = $ cp->node->next)
+ if (cp->page->pgno == vtp->pgno && cp->page->subno == vtp->subno)
+ break;
+
+ if (cp->node->next)
+ {
+ // move to front.
+ dl_insert_first(ca->hash + h, dl_remove(cp->node));
+ if (ca->erc)
+ do_erc(cp->page, vtp);
+ }
+ else
+ {
+ cp = malloc(sizeof(*cp));
+ if (cp == 0)
+ return 0;
+ if (vtp->subno >= ca->hi_subno[vtp->pgno])
+ ca->hi_subno[vtp->pgno] = vtp->subno + 1;
+ ca->npages++;
+ dl_insert_first(ca->hash + h, cp->node);
+ }
+
+ *cp->page = *vtp;
+ return cp->page;
+}
+
+
+/////////////////////////////////
+// this is for browsing the cache
+/////////////////////////////////
+
+/*
+ Same as cache_get but doesn't make the found entry new
+*/
+
+static struct vt_page *
+cache_lookup(struct cache *ca, int pgno, int subno)
+{
+ struct cache_page *cp;
+ int h = hash(pgno);
+
+ for (cp = $ ca->hash[h].first; cp->node->next; cp = $ cp->node->next)
+ if (cp->page->pgno == pgno)
+ if (subno == ANY_SUB || cp->page->subno == subno)
+ return cp->page;
+ return 0;
+}
+
+
+
+static struct vt_page *
+cache_foreach_pg(struct cache *ca, int pgno, int subno, int dir,
+ int (*func)(), void *data)
+{
+ struct vt_page *vtp, *s_vtp = 0;
+
+ if (ca->npages == 0)
+ return 0;
+
+ if (vtp = cache_lookup(ca, pgno, subno))
+ subno = vtp->subno;
+ else if (subno == ANY_SUB)
+ subno = dir < 0 ? 0 : 99999;
+
+ for (;;)
+ {
+ subno += dir;
+ while (subno < 0 || subno >= ca->hi_subno[pgno])
+ {
+ pgno += dir;
+ if (pgno < 0x100)
+ pgno = 0x9ff;
+ if (pgno > 0x9ff)
+ pgno = 0x100;
+ subno = dir < 0 ? ca->hi_subno[pgno] - 1 : 0;
+ }
+ if (vtp = cache_lookup(ca, pgno, subno))
+ {
+ if (s_vtp == vtp)
+ return 0;
+ if (s_vtp == 0)
+ s_vtp = vtp;
+ if (func(data, vtp))
+ return vtp;
+ }
+ }
+}
+
+static int
+cache_mode(struct cache *ca, int mode, int arg)
+{
+ int res = -1;
+
+ switch (mode)
+ {
+ case CACHE_MODE_ERC:
+ res = ca->erc;
+ ca->erc = arg ? 1 : 0;
+ break;
+ }
+ return res;
+}
+
+
+static struct cache_ops cops =
+{
+ cache_close,
+ cache_get,
+ cache_put,
+ cache_reset,
+ cache_foreach_pg,
+ cache_mode,
+};
+
+
+struct cache *
+cache_open(void)
+{
+ struct cache *ca;
+ struct vt_page *vtp;
+ int i;
+
+ if (not(ca = malloc(sizeof(*ca))))
+ goto fail1;
+
+ for (i = 0; i < HASH_SIZE; ++i)
+ dl_init(ca->hash + i);
+
+ memset(ca->hi_subno, 0, sizeof(ca->hi_subno));
+ ca->erc = 1;
+ ca->npages = 0;
+ ca->op = &cops;
+
+#if 0 /* kraxel */
+ for (vtp = help_pages; vtp->pgno >= 0; vtp++)
+ cache_put(ca, vtp);
+#endif
+
+ return ca;
+
+fail2:
+ free(ca);
+fail1:
+ return 0;
+}
+
diff --git a/libvbi/cache.h b/libvbi/cache.h
new file mode 100644
index 0000000..320719d
--- /dev/null
+++ b/libvbi/cache.h
@@ -0,0 +1,40 @@
+#ifndef CACHE_H
+#define CACHE_H
+
+#include "vt.h"
+#include "misc.h"
+#include "dllist.h"
+
+#define HASH_SIZE 113
+
+struct cache
+{
+ struct dl_head hash[HASH_SIZE];
+ int erc; // error reduction circuit on
+ int npages;
+ u16 hi_subno[0x9ff + 1]; // 0:pg not in cache, 1-3f80:highest subno + 1
+ struct cache_ops *op;
+};
+
+struct cache_page
+{
+ struct dl_node node[1];
+ struct vt_page page[1];
+};
+
+struct cache_ops
+{
+ void (*close)(struct cache *ca);
+ struct vt_page *(*get)(struct cache *ca, int pgno, int subno);
+ struct vt_page *(*put)(struct cache *ca, struct vt_page *vtp);
+ void (*reset)(struct cache *ca);
+ struct vt_page *(*foreach_pg)(struct cache *ca, int pgno, int subno,
+ int dir, int (*func)(), void *data);
+ int (*mode)(struct cache *ca, int mode, int arg);
+};
+
+struct cache *cache_open(void);
+
+#define CACHE_MODE_ERC 1
+
+#endif
diff --git a/libvbi/dllist.h b/libvbi/dllist.h
new file mode 100644
index 0000000..f6e3f67
--- /dev/null
+++ b/libvbi/dllist.h
@@ -0,0 +1,53 @@
+#ifndef DLLIST_H
+#define DLLIST_H
+
+struct dl_node
+{
+ struct dl_node *next;
+ struct dl_node *prev;
+};
+
+struct dl_head
+{
+ struct dl_node *first;
+ struct dl_node *null;
+ struct dl_node *last;
+};
+
+static inline struct dl_head *
+dl_init(struct dl_head *h)
+{
+ h->first = (struct dl_node *)&h->null;
+ h->null = 0;
+ h->last = (struct dl_node *)&h->first;
+ return h;
+}
+
+static inline struct dl_node *
+dl_remove(struct dl_node *n)
+{
+ n->prev->next = n->next;
+ n->next->prev = n->prev;
+ return n;
+}
+
+static inline struct dl_node *
+dl_insert_after(struct dl_node *p, struct dl_node *n)
+{
+ n->next = p->next;
+ n->prev = p;
+ p->next = n;
+ n->next->prev = n;
+ return n;
+}
+
+#define dl_empty(h) ((h)->first->next == 0)
+#define dl_insert_before(p, n) dl_insert_after((p)->prev, (n))
+#define dl_insert_first(h, n) ({ struct dl_node *_n = (n); \
+ dl_insert_before((h)->first, _n); })
+#define dl_insert_last(h, n) ({ struct dl_node *_n = (n); \
+ dl_insert_after((h)->last, _n); })
+#define dl_remove_first(h) dl_remove((h)->first) // mustn't be empty!
+#define dl_remove_last(h) dl_remove((h)->last) // mustn't be empty!
+
+#endif /* DLLIST_H */
diff --git a/libvbi/exp-gfx.c b/libvbi/exp-gfx.c
new file mode 100644
index 0000000..d335eff
--- /dev/null
+++ b/libvbi/exp-gfx.c
@@ -0,0 +1,275 @@
+/* Copyright 1999 by Paul Ortyl <ortylp@from.pl> */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "lang.h"
+#include "export.h"
+
+#ifdef WITH_PNG
+#include <png.h>
+#endif
+
+#include "font.h"
+#define WW (W*CW) /* pixel width of window */
+#define WH (H*CH) /* pixel hegiht of window */
+
+
+static int gfx_open(struct export *e);
+static int gfx_option(struct export *e, int opt, char *arg);
+static int ppm_output(struct export *e, char *name, struct fmt_page *pg);
+#ifdef WITH_PNG
+static int png_output(struct export *e, char *name, struct fmt_page *pg);
+#endif
+
+
+static char *gfx_opts[] = // module options
+{
+ //"compression=<level>", // set compression level
+ 0
+};
+
+/*struct gfx_data // private data in struct export
+{
+};
+*/
+
+struct export_module export_ppm[1] = // exported module definition
+{
+ "ppm", // id
+ "ppm", // extension
+ gfx_opts, // options
+ 0, // size
+ gfx_open, // open
+ 0, // close
+ gfx_option, // option
+ ppm_output // output
+};
+
+#ifdef WITH_PNG
+struct export_module export_png[1] = // exported module definition
+{
+ "png", // id
+ "png", // extension
+ gfx_opts, // options
+ 0, // size
+ gfx_open, // open
+ 0, // close
+ gfx_option, // option
+ png_output // output
+};
+#endif
+
+///////////////////////////////////////////////////////
+
+#define D ((struct gfx_data *)e->data)
+
+static int
+gfx_open(struct export *e)
+{
+ //e->reveal=1; // the default should be the same in all formats
+ return 0;
+}
+
+static int
+gfx_option(struct export *e, int opt, char *arg)
+{
+ switch (opt)
+ {
+ // no options at the moment...
+ }
+ return 0;
+}
+
+
+static inline void
+draw_char(unsigned char * colour_matrix,
+ int fg, int bg, int c, int dbl, int _x, int _y,
+ int sep)
+{
+ int x,y;
+ unsigned char* src= (latin1 ? font1_bits : font2_bits);
+ int dest_x=_x*CW;
+ int dest_y=_y*CH;
+
+ for(y=0;y<(CH<<dbl); y++)
+ {
+ for(x=0;x<CW; x++)
+ {
+ int bitnr, bit, maskbitnr, maskbit;
+ bitnr=(c/32*CH + (y>>dbl))*CW*32+ c%32*CW +x;
+ bit=(*(src+bitnr/8))&(1<<bitnr%8);
+ if (sep)
+ {
+ maskbitnr=(0xa0/32*CH + (y>>dbl))*CW*32+ 0xa0%32*CW +x;
+ maskbit=(*(src+maskbitnr/8))&(1<<maskbitnr%8);
+ *(colour_matrix+WW*(dest_y+y)+dest_x+x)=
+ (char)((bit && (!maskbit)) ? fg : bg);
+ }
+ else
+ *(colour_matrix+WW*(dest_y+y)+dest_x+x)=
+ (char)(bit ? fg : bg);
+ }
+ }
+ return;
+}
+
+static void
+prepare_colour_matrix(//*struct export *e,
+ struct fmt_page *pg,
+ unsigned char *colour_matrix)
+{
+ int x, y;
+ // bzero(colour_matrix, WH*WW);
+ for (y = 0; y < H; ++y)
+ {
+ for (x = 0; x < W; ++x)
+ {
+ if (pg->dbl & (1<<(y-1)))
+ {
+ if (pg->data[y-1][x].attr & EA_HDOUBLE)
+ draw_char(colour_matrix, pg->data[y][x].fg,
+ pg->data[y][x].bg, pg->data[y][x].ch,
+ (0),
+ x, y,
+ ((pg->data[y][x].attr & EA_SEPARATED) ? 1 : 0)
+ );
+ }
+ else
+ {
+ draw_char(colour_matrix, pg->data[y][x].fg,
+ pg->data[y][x].bg, pg->data[y][x].ch,
+ ((pg->data[y][x].attr & EA_DOUBLE) ? 1 : 0),
+ x, y,
+ ((pg->data[y][x].attr & EA_SEPARATED) ? 1 : 0)
+ );
+ }
+ }
+ }
+ return;
+}
+
+static int
+ppm_output(struct export *e, char *name, struct fmt_page *pg)
+{
+ FILE *fp;
+ long n;
+ const u8 rgb1[][3]={{0,0,0},
+ {1,0,0},
+ {0,1,0},
+ {1,1,0},
+ {0,0,1},
+ {1,0,1},
+ {0,1,1},
+ {1,1,1}};
+
+ unsigned char *colour_matrix;
+
+ if (!(colour_matrix=malloc(WH*WW)))
+ {
+ export_error("cannot allocate memory");
+ return 0;
+ }
+
+ prepare_colour_matrix(/*e,*/ pg, (unsigned char *)colour_matrix);
+
+ if (not(fp = fopen(name, "w")))
+ {
+ free(colour_matrix);
+ export_error("cannot create file");
+ return -1;
+ }
+
+ fprintf(fp,"P6 %d %d 1\n", WW, WH);
+
+ for(n=0;n<WH*WW;n++)
+ {
+ if (!fwrite(rgb1[(int) *(colour_matrix+n)], 3, 1, fp))
+ {
+ export_error("error while writting to file");
+ free(colour_matrix);
+ fclose(fp);
+ return -1;
+ }
+ }
+
+ free(colour_matrix);
+ fclose(fp);
+ return 0;
+}
+
+#ifdef WITH_PNG
+static int
+png_output(struct export *e, char *name, struct fmt_page *pg)
+{
+ FILE *fp;
+ int x;
+ png_structp png_ptr;
+ png_infop info_ptr;
+ png_byte *row_pointers[WH];
+ const u8 rgb8[][3]={{ 0, 0, 0},
+ {255, 0, 0},
+ { 0,255, 0},
+ {255,255, 0},
+ { 0, 0,255},
+ {255, 0,255},
+ { 0,255,255},
+ {255,255,255}};
+ unsigned char *colour_matrix;
+
+ if (!(colour_matrix=malloc(WH*WW)))
+ {
+ export_error("cannot allocate memory");
+ return -1;
+ }
+
+ prepare_colour_matrix(/*e,*/ pg, (unsigned char *)colour_matrix);
+
+ if (not(fp = fopen(name, "w")))
+ {
+ free(colour_matrix);
+ export_error("cannot create file");
+ return -1;
+ }
+
+ png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING,
+ NULL, NULL, NULL);
+ if (!png_ptr)
+ {
+ free(colour_matrix);
+ fclose(fp);
+ export_error("libpng init error");
+ return -1;
+ }
+ info_ptr = png_create_info_struct(png_ptr);
+ if (!info_ptr)
+ {
+ png_destroy_write_struct(&png_ptr,
+ (png_infopp)NULL);
+ free(colour_matrix);
+ fclose(fp);
+ export_error("libpng init error");
+ return -1;
+ }
+ png_init_io(png_ptr, fp);
+ png_set_compression_level(png_ptr, Z_BEST_COMPRESSION);
+ png_set_compression_mem_level(png_ptr, 9);
+ png_set_compression_window_bits(png_ptr, 15);
+ png_set_IHDR(png_ptr, info_ptr, WW, WH,
+ 8, PNG_COLOR_TYPE_PALETTE , PNG_INTERLACE_NONE,
+ PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
+ png_set_PLTE(png_ptr, info_ptr,(png_color*) rgb8 , 8);
+ png_write_info(png_ptr, info_ptr);
+
+ for(x=0; x<WH; x++)
+ { row_pointers[x]=colour_matrix+x*WW; }
+ png_write_image(png_ptr, row_pointers);
+ png_write_end(png_ptr, info_ptr);
+ png_destroy_write_struct(&png_ptr, &info_ptr);
+
+ free(colour_matrix);
+ fclose(fp);
+ return 0;
+}
+#endif
diff --git a/libvbi/exp-html.c b/libvbi/exp-html.c
new file mode 100644
index 0000000..c016b57
--- /dev/null
+++ b/libvbi/exp-html.c
@@ -0,0 +1,296 @@
+/* Copyright 1999 by Paul Ortyl <ortylp@from.pl> */
+
+#include <stdio.h>
+#include <string.h>
+#include "lang.h"
+#include "export.h"
+
+static int html_open(struct export *e);
+static int html_option(struct export *e, int opt, char *arg);
+static int html_output(struct export *e, char *name, struct fmt_page *pg);
+
+static char *html_opts[] = // module options
+{
+ "gfx-chr=<char>", // substitute <char> for gfx-symbols
+ "bare", // no headers
+ 0
+};
+
+struct html_data // private data in struct export
+{
+ u8 gfx_chr;
+ u8 bare;
+};
+
+struct export_module export_html[1] = // exported module definition
+{
+ "html", // id
+ "html", // extension
+ html_opts, // options
+ sizeof(struct html_data), // size
+ html_open, // open
+ 0, // close
+ html_option, // option
+ html_output // output
+};
+
+#define D ((struct html_data *)e->data)
+
+static int
+html_open(struct export *e)
+{
+ D->gfx_chr = '#';
+ D->bare = 0;
+ //e->reveal=1; // the default should be the same for all formats.
+ return 0;
+}
+
+static int
+html_option(struct export *e, int opt, char *arg)
+{
+
+ switch (opt)
+ {
+ case 1: // gfx-chr=
+ D->gfx_chr = *arg ?: ' ';
+ break;
+ case 2: // bare (no headers)
+ D->bare=1;
+ break;
+ }
+ return 0;
+}
+
+///////////////////////////////////////////////////////
+
+#define HTML_BLACK "#000000"
+#define HTML_RED "#FF0000"
+#define HTML_GREEN "#00FF00"
+#define HTML_YELLOW "#FFFF00"
+#define HTML_BLUE "#0000FF"
+#define HTML_MAGENTA "#FF00FF"
+#define HTML_CYAN "#00FFFF"
+#define HTML_WHITE "#FFFFFF"
+
+#undef UNREADABLE_HTML //no '\n'
+#define STRIPPED_HTML //only necessary fields in header
+
+static int html_output(struct export *e, char *name, struct fmt_page *pg)
+{
+
+ const char* html_colours[]={ HTML_BLACK,
+ HTML_RED,
+ HTML_GREEN,
+ HTML_YELLOW,
+ HTML_BLUE,
+ HTML_MAGENTA,
+ HTML_CYAN,
+ HTML_WHITE};
+ FILE *fp;
+ int x, y;
+
+#ifdef UNREADABLE_HTML
+#define HTML_NL
+#else
+#define HTML_NL fputc('\n',fp);
+#endif
+
+ if (not(fp = fopen(name, "w")))
+ {
+ export_error("cannot create file");
+ return -1;
+ }
+
+if (!D->bare)
+ {
+#ifndef STRIPPED_HTML
+ fputs("<!doctype html public \"-//w3c//dtd html 4.0 transitional//en\">",fp);
+ HTML_NL
+#endif
+ fputs("<html><head>",fp);
+ HTML_NL
+#ifndef STRIPPED_HTML
+ fputs("<meta http-equiv=\"Content-Type\" content=\"text/html;",fp);
+ fprintf(fp,"charset=iso-8859-%d\">",(latin1 ? 1 : 2));
+ HTML_NL
+ fputs("<meta name=\"GENERATOR\" content=\"alevt-cap\">",fp);
+ HTML_NL
+#else
+ fprintf(fp,"<meta charset=iso-8859-%d\">",(latin1 ? 1 : 2));
+ HTML_NL
+#endif
+ fputs("<head>",fp);
+ fputs("<body text=\"#FFFFFF\" bgcolor=\"#000000\">",fp);
+ HTML_NL
+ } //bare
+
+ fputs("<tt><b>",fp);
+ HTML_NL
+
+
+ // write tables in form of HTML format
+ for (y = 0; y < 25; ++y)
+ {
+ int last_nonblank=0;
+ int first_unprinted=0;
+ int last_space=1;
+ // previous char was &nbsp
+ // is used for deciding to put semicolon or not
+ int nbsp=0;
+
+ // for output filled with ' ' up to 40 chars
+ // set last_nonblank=39
+ for (x = 0 ; x < 40; ++x)
+ {
+ if (pg->data[y][x].attr & EA_GRAPHIC)
+ {pg->data[y][x].ch= D->gfx_chr;}
+
+ if (pg->data[y][x].ch!=' ')
+ {
+ last_nonblank=x; // <-----
+ }
+ }
+
+ for (x = 0 ; x <= last_nonblank ; ++x)
+ {
+ if (pg->data[y][x].ch==' ')
+ {
+ // if single space between blinking/colour words
+ // then make the space blinking/colour too
+ if ((x)&&(x<39))
+ {
+ if ((pg->data[y][x-1].ch!=' ')
+ &&(pg->data[y][x+1].ch!=' ')
+ &&(pg->data[y][x-1].attr & EA_BLINK)
+ &&(pg->data[y][x+1].attr & EA_BLINK))
+ {pg->data[y][x].attr |= EA_BLINK;}
+ else
+ {pg->data[y][x].attr &= ~EA_BLINK;}
+
+ if ((pg->data[y][x-1].ch!=' ')
+ &&(pg->data[y][x+1].ch!=' ')
+ &&(pg->data[y][x-1].fg==pg->data[y][x+1].fg))
+ {pg->data[y][x].fg=pg->data[y][x-1].fg;}
+ else
+ pg->data[y][x].fg=7;
+ }
+ else
+ {
+ pg->data[y][x].attr &= ~EA_BLINK;
+ pg->data[y][x].fg=7;
+ }
+ }
+ else
+ {
+ // if foreground is black set the foreground to previous
+ // background colour to let it be visible
+ if (!pg->data[y][x].fg)
+ {pg->data[y][x].fg=pg->data[y][x].bg;}
+ }
+ //check if attributes changed,
+ //if yes then print chars and update first_unprinted
+ //if not then go to next char
+ if (x)
+ {
+ if (((
+ (pg->data[y][x].attr & EA_BLINK)
+ ==
+ (pg->data[y][x-1].attr & EA_BLINK)
+ )
+ &&
+ (
+ pg->data[y][x].fg == pg->data[y][x-1].fg
+ ))
+ &&(x!=last_nonblank))
+
+ { continue; }
+ }
+ else continue;
+
+ {
+ int z=first_unprinted;
+ // last_space=0;
+ for(;(pg->data[y][z].ch==' ') && (z<x);z++)
+ {
+ if (last_space)
+ {
+ fprintf(fp,"&nbsp");
+ last_space=0;
+ nbsp=1;
+ }
+ else
+ {
+ fputc(' ',fp);
+ last_space=1;
+ nbsp=0;
+ }
+ }
+
+ first_unprinted=z;
+
+ if (z==x) continue;
+
+ if (pg->data[y][first_unprinted].attr & EA_BLINK)
+ {
+ fprintf(fp,"<blink>");
+ nbsp=0;
+ }
+
+ if (pg->data[y][first_unprinted].fg!=7)
+ {
+ fprintf(fp,"<font color=%s>",
+ html_colours[pg->data[y][first_unprinted].fg]);
+ nbsp=0;
+ }
+ for(;(z<x)||(z==last_nonblank);z++)
+ {
+
+ if (pg->data[y][z].ch==' ')
+ {
+ for(;(pg->data[y][z].ch==' ') && (z<x);z++)
+ {
+ if (last_space)
+ {
+ fprintf(fp,"&nbsp");
+ last_space=0;
+ nbsp=1;
+ }
+ else
+ {
+ fputc(' ',fp);
+ last_space=1;
+ nbsp=0;
+ }
+ }
+ z--;
+ }
+ else
+ {
+ //if previous nbsp --> put semicolon!!!
+ if (nbsp) fputc(';',fp);
+ fputc(pg->data[y][z].ch,fp);
+ last_space=0;
+ nbsp=0;
+ }
+ }
+ if (pg->data[y][first_unprinted].fg!=7)
+ {
+ fprintf(fp,"</font>");
+ }
+ if (pg->data[y][first_unprinted].attr & EA_BLINK)
+ fprintf(fp,"</blink>");
+
+ first_unprinted=z;
+ }
+ }
+ fputs("<br>",fp);
+ HTML_NL
+ }
+ fputs("</b></tt>",fp);
+ if (!D->bare)
+ fputs("</body></html>",fp);
+ fclose(fp);
+ return 0;
+}
+//////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////
diff --git a/libvbi/exp-txt.c b/libvbi/exp-txt.c
new file mode 100644
index 0000000..bec6c23
--- /dev/null
+++ b/libvbi/exp-txt.c
@@ -0,0 +1,232 @@
+#include <stdio.h>
+#include <string.h>
+#include "os.h"
+#include "export.h"
+
+static int txt_open(struct export *e);
+static int txt_option(struct export *e, int opt, char *arg);
+static int txt_output(struct export *e, char *name, struct fmt_page *pg);
+
+static char *txt_opts[] = // module options
+{
+ "color", // generate ansi color codes (and attributes)
+ "gfx-chr=<char>", // substitute <char> for gfx-symbols
+ "fg=<0-7|none>", // assume term has <x> as foreground color
+ "bg=<0-7|none>", // assume term has <x> as background color
+ 0
+};
+
+struct txt_data // private data in struct export
+{
+ u8 color;
+ u8 gfx_chr;
+ u8 def_fg;
+ u8 def_bg;
+ struct fmt_char curr[1];
+ FILE *fp;
+};
+
+struct export_module export_txt[1] = // exported module definition
+{
+ "ascii", // id
+ "txt", // extension
+ txt_opts, // options
+ sizeof(struct txt_data), // data size
+ txt_open, // open
+ 0, // close
+ txt_option, // option
+ txt_output, // output
+};
+
+struct export_module export_ansi[1] = // exported module definition
+{
+ "ansi", // id
+ "txt", // extension
+ txt_opts, // options
+ sizeof(struct txt_data), // data size
+ txt_open, // open
+ 0, // close
+ txt_option, // option
+ txt_output, // output
+};
+
+///////////////////////////////////////////////////////
+
+#define D ((struct txt_data *)e->data)
+
+
+#ifdef BSD
+char *
+stpcpy(char *dst, const char *src)
+{
+ while (*dst = *src++)
+ dst++;
+ return dst;
+}
+#endif
+
+
+static int
+txt_open(struct export *e)
+{
+ D->gfx_chr = '#';
+ D->def_fg = -1;
+ D->def_bg = -1;
+ if (e->mod == export_ansi)
+ D->color = 1;
+ return 0;
+}
+
+static int
+txt_option(struct export *e, int opt, char *arg)
+{
+ switch (opt)
+ {
+ case 1: // color
+ D->color = 1;
+ break;
+ case 2: // gfx-chr=
+ D->gfx_chr = *arg ?: ' ';
+ break;
+ case 3: // fg=
+ D->def_fg = *arg - '0';
+ break;
+ case 4: // bg=
+ D->def_bg = *arg - '0';
+ break;
+ }
+ return 0;
+}
+
+
+static void
+put_attr(struct export *e, struct fmt_char *new)
+{
+ char buf[64];
+ char *p = buf;
+ int fg, bg, attr;
+ int reset = 0;
+
+ if (D->color)
+ {
+ fg = D->curr->fg ^ new->fg;
+ bg = D->curr->bg ^ new->bg;
+ attr = (D->curr->attr ^ new->attr) & (EA_BLINK | EA_DOUBLE);
+
+ if (fg | bg | attr)
+ {
+ if (~new->attr & attr) // reset some attributes -> reset all.
+ reset = 1;
+ if (fg && new->fg == D->def_fg) // switch to def fg -> reset all
+ reset = 1;
+ if (bg && new->bg == D->def_bg) // switch to def bg -> reset all
+ reset = 1;
+
+ p = stpcpy(buf, "\e[");
+ if (reset)
+ {
+ p = stpcpy(p, ";"); // "0;" but 0 isn't neccesary
+ attr = -1; // set all attributes
+ fg = new->fg ^ D->def_fg; // set fg if != default fg
+ bg = new->bg ^ D->def_bg; // set bg if != default bg
+ }
+ if (attr & new->attr & EA_BLINK)
+ p = stpcpy(p, "5;"); // blink
+ if (attr & new->attr & EA_DOUBLE)
+ p = stpcpy(p, "1;"); // bold
+ if (fg)
+ p += sprintf(p, "%d;", new->fg + 30); // fg-color
+ if (bg)
+ p += sprintf(p, "%d;", new->bg + 40); // bg-color
+ p[-1] = 'm'; // replace last ;
+ *D->curr = *new;
+ }
+ }
+ *p++ = new->ch;
+ *p = 0;
+ fputs(buf, D->fp);
+}
+
+
+static int
+txt_output(struct export *e, char *name, struct fmt_page *pg)
+{
+ struct fmt_char def_c[1];
+ struct fmt_char l[W+2];
+ #define L (l+1)
+ FILE *fp;
+ int x, y;
+ int x2, x3;
+
+ D->fp = fopen(name, "w");
+ if (not D->fp)
+ {
+ export_error("cannot create file");
+ return -1;
+ }
+
+ /* initialize default colors. these have to be restored at EOL. */
+ def_c->ch = '\n';
+ def_c->fg = D->def_fg;
+ def_c->bg = D->def_bg;
+ def_c->attr = E_DEF_ATTR;
+ *D->curr = *def_c;
+ L[-1] = L[W] = *def_c;
+
+ for (y = 0; y < H; y++)
+ if (~pg->hid & (1 << y)) // not hidden
+ {
+ // character conversion
+ for (x = 0; x < W; ++x)
+ {
+ struct fmt_char c = pg->data[y][x];
+
+ switch (c.ch)
+ {
+ case 0x00: case 0xa0: c.ch = ' '; break;
+ /*
+ case 0x9f: c.ch = ' ';
+ c.bg = c.fg; break;
+ case 0x15: case 0x8a: c.ch = '|'; break;
+ case 0x03: case 0x0c: case 0x90: c.ch = '-'; break;
+ case 0x04: case 0x08:
+ */
+ case 0x7f: c.ch = '*'; break;
+ case BAD_CHAR: c.ch = '?'; break;
+ default:
+ if (c.attr & EA_GRAPHIC)
+ c.ch = D->gfx_chr;
+ //c.bg = c.fg, c.ch = ' ';
+ break;
+ }
+ L[x] = c;
+ }
+
+ if (D->color)
+ {
+ // optimize color and attribute changes
+
+ // delay fg and attr changes as far as possible
+ for (x = 0; x < W; ++x)
+ if (L[x].ch == ' ')
+ {
+ L[x].fg = L[x-1].fg;
+ l[x].attr = L[x-1].attr;
+ }
+
+ // move fg and attr changes to prev bg change point
+ for (x = W-1; x >= 0; x--)
+ if (L[x].ch == ' ' && L[x].bg == L[x+1].bg)
+ {
+ L[x].fg = L[x+1].fg;
+ L[x].attr = L[x+1].attr;
+ }
+ }
+
+ // now emit the whole line (incl EOL)
+ for (x = 0; x < W+1; ++x)
+ put_attr(e, L + x);
+ }
+ fclose(D->fp);
+ return 0;
+}
diff --git a/libvbi/export.c b/libvbi/export.c
new file mode 100644
index 0000000..8d8e292
--- /dev/null
+++ b/libvbi/export.c
@@ -0,0 +1,366 @@
+#include <stdarg.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include "vt.h"
+#include "misc.h"
+#include "export.h"
+
+extern struct export_module export_txt[1];
+extern struct export_module export_ansi[1];
+extern struct export_module export_html[1];
+extern struct export_module export_png[1];
+extern struct export_module export_ppm[1];
+
+struct export_module *modules[] =
+{
+ export_txt,
+ export_ansi,
+ export_html,
+ export_ppm,
+#ifdef WITH_PNG
+ export_png,
+#endif
+ 0
+};
+
+static char *glbl_opts[] =
+{
+ "reveal", // show hidden text
+ "hide", // don't show hidden text (default)
+ 0
+};
+
+static char errbuf[64];
+
+void
+export_error(char *str, ...)
+{
+ va_list args;
+
+ va_start(args, str);
+ vsnprintf(errbuf, sizeof(errbuf)-1, str, args);
+}
+
+char *
+export_errstr(void)
+{
+ return errbuf;
+}
+
+
+static int
+find_opt(char **opts, char *opt, char *arg)
+{
+ int err = 0;
+ char buf[256];
+ char **oo, *o, *a;
+
+ if (oo = opts)
+ while (o = *oo++)
+ {
+ if (a = strchr(o, '='))
+ {
+ a = buf + (a - o);
+ o = strcpy(buf, o);
+ *a++ = 0;
+ }
+ if (strcasecmp(o, opt) == 0)
+ {
+ if ((a != 0) == (arg != 0))
+ return oo - opts;
+ err = -1;
+ }
+ }
+ return err;
+}
+
+
+struct export *
+export_open(char *fmt)
+{
+ struct export_module **eem, *em;
+ struct export *e;
+ char *opt, *optend, *optarg;
+ int opti;
+
+ if (fmt = strdup(fmt))
+ {
+ if (opt = strchr(fmt, ','))
+ *opt++ = 0;
+ for (eem = modules; em = *eem; eem++)
+ if (strcasecmp(em->fmt_name, fmt) == 0)
+ break;
+ if (em)
+ {
+ if (e = malloc(sizeof(*e) + em->local_size))
+ {
+ e->mod = em;
+ e->fmt_str = fmt;
+ e->reveal = 0;
+ memset(e + 1, 0, em->local_size);
+ if (not em->open || em->open(e) == 0)
+ {
+ for (; opt; opt = optend)
+ {
+ if (optend = strchr(opt, ','))
+ *optend++ = 0;
+ if (not *opt)
+ continue;
+ if (optarg = strchr(opt, '='))
+ *optarg++ = 0;
+ if ((opti = find_opt(glbl_opts, opt, optarg)) > 0)
+ {
+ if (opti == 1) // reveal
+ e->reveal = 1;
+ else if (opti == 2) // hide
+ e->reveal = 0;
+ }
+ else if (opti == 0 &&
+ (opti = find_opt(em->options, opt, optarg)) > 0)
+ {
+ if (em->option(e, opti, optarg))
+ break;
+ }
+ else
+ {
+ if (opti == 0)
+ export_error("%s: unknown option", opt);
+ else if (optarg)
+ export_error("%s: takes no arg", opt);
+ else
+ export_error("%s: missing arg", opt);
+ break;
+ }
+ }
+ if (opt == 0)
+ return e;
+
+ if (em->close)
+ em->close(e);
+ }
+ free(e);
+ }
+ else
+ export_error("out of memory");
+ }
+ else
+ export_error("unknown format: %s", fmt);
+ free(fmt);
+ }
+ else
+ export_error("out of memory");
+ return 0;
+}
+
+
+void
+export_close(struct export *e)
+{
+ if (e->mod->close)
+ e->mod->close(e);
+ free(e->fmt_str);
+ free(e);
+}
+
+
+static char *
+hexnum(char *buf, unsigned int num)
+{
+ char *p = buf + 5;
+
+ num &= 0xffff;
+ *--p = 0;
+ do
+ {
+ *--p = "0123456789abcdef"[num % 16];
+ num /= 16;
+ } while (num);
+ return p;
+}
+
+static char *
+adjust(char *p, char *str, char fill, int width)
+{
+ int l = width - strlen(str);
+
+ while (l > 0)
+ *p++ = fill;
+ while (*p = *str++)
+ p++;
+ return p;
+}
+
+char *
+export_mkname(struct export *e, char *fmt, struct vt_page *vtp, char *usr)
+{
+ char bbuf[1024];
+ char *p = bbuf;
+
+ while (*p = *fmt++)
+ if (*p++ == '%')
+ {
+ char buf[32], buf2[32];
+ int width = 0;
+
+ p--;
+ while (*fmt >= '0' && *fmt <= '9')
+ width = width*10 + *fmt++ - '0';
+
+ switch (*fmt++)
+ {
+ case '%':
+ p = adjust(p, "%", '%', width);
+ break;
+ case 'e': // extension
+ p = adjust(p, e->mod->extension, '.', width);
+ break;
+ case 'p': // pageno[.subno]
+ if (vtp->subno)
+ p = adjust(p,strcat(strcat(hexnum(buf, vtp->pgno),
+ "."), hexnum(buf2, vtp->subno)), ' ', width);
+ else
+ p = adjust(p, hexnum(buf, vtp->pgno), ' ', width);
+ break;
+ case 'S': // subno
+ p = adjust(p, hexnum(buf, vtp->subno), '0', width);
+ break;
+ case 'P': // pgno
+ p = adjust(p, hexnum(buf, vtp->pgno), '0', width);
+ break;
+ case 's': // user strin
+ p = adjust(p, usr, ' ', width);
+ break;
+ //TODO: add date, channel name, ...
+ }
+ }
+ p = strdup(bbuf);
+ if (not p)
+ export_error("out of memory");
+ return p;
+}
+
+
+void
+fmt_page(struct export *e, struct fmt_page *pg, struct vt_page *vtp)
+{
+ char buf[16];
+ int x, y;
+ u8 c, *p = vtp->data[0];
+
+ pg->dbl = 0;
+
+ sprintf(buf, "\2%x.%02x\7", vtp->pgno, vtp->subno & 0xff);
+
+ for (y = 0; y < H; y++)
+ {
+ struct fmt_char c;
+ int last_ch = ' ';
+ int dbl = 0, hold = 0;
+
+ c.fg = 7;
+ c.bg = 0;
+ c.attr = 0;
+
+ for (x = 0; x < W; ++x)
+ {
+ c.ch = *p++;
+ if (y == 0 && x < 8)
+ c.ch = buf[x];
+ switch (c.ch)
+ {
+ case 0x00 ... 0x07: /* alpha + fg color */
+ c.fg = c.ch & 7;
+ c.attr &= ~(EA_GRAPHIC | EA_SEPARATED | EA_CONCEALED);
+ goto ctrl;
+ case 0x08: /* flash */
+ c.attr |= EA_BLINK;
+ goto ctrl;
+ case 0x09: /* steady */
+ c.attr &= ~EA_BLINK;
+ goto ctrl;
+ case 0x0a: /* end box */
+ case 0x0b: /* start box */
+ goto ctrl;
+ case 0x0c: /* normal height */
+ c.attr &= EA_DOUBLE;
+ goto ctrl;
+ case 0x0d: /* double height */
+ c.attr |= EA_DOUBLE;
+ dbl = 1;
+ goto ctrl;
+ case 0x10 ... 0x17: /* gfx + fg color */
+ c.fg = c.ch & 7;
+ c.attr |= EA_GRAPHIC;
+ c.attr &= ~EA_CONCEALED;
+ goto ctrl;
+ case 0x18: /* conceal */
+ c.attr |= EA_CONCEALED;
+ goto ctrl;
+ case 0x19: /* contiguous gfx */
+ c.attr &= ~EA_SEPARATED;
+ goto ctrl;
+ case 0x1a: /* separate gfx */
+ c.attr |= EA_SEPARATED;
+ goto ctrl;
+ case 0x1c: /* black bf */
+ c.bg = 0;
+ goto ctrl;
+ case 0x1d: /* new bg */
+ c.bg = c.fg;
+ goto ctrl;
+ case 0x1e: /* hold gfx */
+ hold = 1;
+ goto ctrl;
+ case 0x1f: /* release gfx */
+ hold = 0;
+ goto ctrl;
+
+ case 0x0e: /* SO */
+ case 0x0f: /* SI */
+ case 0x1b: /* ESC */
+ c.ch = ' ';
+ break;
+
+ ctrl:
+ c.ch = ' ';
+ if (hold && (c.attr & EA_GRAPHIC))
+ c.ch = last_ch;
+ break;
+ }
+ if (c.attr & EA_GRAPHIC)
+ if ((c.ch & 0xa0) == 0x20)
+ {
+ last_ch = c.ch;
+ c.ch += (c.ch & 0x40) ? 32 : -32;
+ }
+ if (c.attr & EA_CONCEALED)
+ if (not e->reveal)
+ c.ch = ' ';
+ pg->data[y][x] = c;
+ }
+ if (dbl)
+ {
+ pg->dbl |= 1 << y;
+ for (x = 0; x < W; ++x)
+ {
+ if (~pg->data[y][x].attr & EA_DOUBLE)
+ pg->data[y][x].attr |= EA_HDOUBLE;
+ pg->data[y+1][x] = pg->data[y][x];
+ pg->data[y+1][x].ch = ' ';
+ }
+ y++;
+ p += W;
+ }
+ }
+ pg->hid = pg->dbl << 1;
+}
+
+int
+export(struct export *e, struct vt_page *vtp, char *name)
+{
+ struct fmt_page pg[1];
+
+ fmt_page(e, pg, vtp);
+ return e->mod->output(e, name, pg);
+}
diff --git a/libvbi/export.h b/libvbi/export.h
new file mode 100644
index 0000000..d2ec738
--- /dev/null
+++ b/libvbi/export.h
@@ -0,0 +1,62 @@
+#ifndef EXPORT_H
+#define EXPORT_H
+
+#include "vt.h"
+#include "misc.h"
+
+struct fmt_char
+{
+ u8 ch, fg, bg, attr;
+};
+
+#define EA_DOUBLE 1 // double height char
+#define EA_HDOUBLE 2 // single height char in double height line
+#define EA_BLINK 4 // blink
+#define EA_CONCEALED 8 // concealed
+#define EA_GRAPHIC 16 // graphic symbol
+#define EA_SEPARATED 32 // use separated graphic symbol
+
+#define E_DEF_FG 7
+#define E_DEF_BG 0
+#define E_DEF_ATTR 0
+
+struct fmt_page
+{
+ struct vt_page *vtp;
+ u32 dbl, hid;
+ struct fmt_char data[H][W];
+};
+
+struct export
+{
+ struct export_module *mod; // module type
+ char *fmt_str; // saved option string (splitted)
+ // global options
+ int reveal; // reveal hidden chars
+ // local data for module's use. initialized to 0.
+ struct { int dummy; } data[0];
+};
+
+struct export_module
+{
+ char *fmt_name; // the format type name (ASCII/HTML/PNG/...)
+ char *extension; // the default file name extension
+ char **options; // module options
+ int local_size;
+ int (*open)(struct export *fmt);
+ void (*close)(struct export *fmt);
+ int (*option)(struct export *fmt, int opt, char *arg);
+ int (*output)(struct export *fmt, char *name, struct fmt_page *pg);
+};
+
+
+extern struct export_module *modules[]; // list of modules (for help msgs)
+void export_error(char *str, ...); // set error
+char *export_errstr(void); // return last error
+char *export_mkname(struct export *e, char *fmt, struct vt_page *vtp, char *usr);
+
+struct export *export_open(char *fmt);
+void export_close(struct export *e);
+int export(struct export *e, struct vt_page *vtp, char *user_str);
+
+#endif
diff --git a/libvbi/fdset.c b/libvbi/fdset.c
new file mode 100644
index 0000000..a74ca6b
--- /dev/null
+++ b/libvbi/fdset.c
@@ -0,0 +1,99 @@
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/time.h>
+
+#include "dllist.h"
+#include "misc.h"
+#include "fdset.h"
+
+struct fdset fds[1]; /* global fd list */
+
+int
+fdset_init(struct fdset *fds)
+{
+ dl_init(fds->list);
+ fds->del_count = 0;
+ return 0;
+}
+
+int
+fdset_add_fd(struct fdset *fds, int fd, void *handler, void *data)
+{
+ struct fdset_node *fn;
+
+ if (fd < 0)
+ return -1;
+ if (handler == 0)
+ return -1;
+
+ for (fn = $ fds->list->first; fn->node->next; fn = $ fn->node->next)
+ if (fn->fd == fd)
+ return -1;
+
+ if (not(fn = malloc(sizeof(*fn))))
+ return -1;
+ fn->fd = fd;
+ fn->handler = handler;
+ fn->data = data;
+ dl_insert_last(fds->list, fn->node);
+ return 0;
+}
+
+int
+fdset_del_fd(struct fdset *fds, int fd)
+{
+ struct fdset_node *fn;
+
+ for (fn = $ fds->list->first; fn->node->next; fn = $ fn->node->next)
+ if (fn->fd == fd)
+ {
+ dl_remove(fn->node);
+ free(fn);
+ fds->del_count++;
+ return 0;
+ }
+ return -1;
+}
+
+int
+fdset_select(struct fdset *fds, int timeout)
+{
+ struct fdset_node *fn;
+ fd_set rfds[1];
+ struct timeval tv[1], *tvp = 0;
+ int max_fd, x, del_count;
+
+ FD_ZERO(rfds);
+ max_fd = 0;
+ for (fn = $ fds->list->first; fn->node->next; fn = $ fn->node->next)
+ {
+ FD_SET(fn->fd, rfds);
+ if (fn->fd >= max_fd)
+ max_fd = fn->fd + 1;
+ }
+
+ if (timeout >= 0)
+ {
+ tv->tv_sec = timeout/1000;
+ tv->tv_usec = timeout%1000*1000;
+ tvp = tv;
+ }
+
+ x = select(max_fd, rfds, 0, 0, tvp);
+ if (x <= 0)
+ return x;
+
+ /* A little bit complicated. A called handler may modify the fdset... */
+restart:
+ del_count = fds->del_count;
+ for (fn = $ fds->list->first; fn->node->next; fn = $ fn->node->next)
+ if (FD_ISSET(fn->fd, rfds))
+ {
+ FD_CLR(fn->fd, rfds);
+ fn->handler(fn->data, fn->fd);
+ if (fds->del_count != del_count)
+ goto restart;
+ }
+
+ return 1;
+}
diff --git a/libvbi/fdset.h b/libvbi/fdset.h
new file mode 100644
index 0000000..38892d9
--- /dev/null
+++ b/libvbi/fdset.h
@@ -0,0 +1,27 @@
+#ifndef FDSET_H
+#define FDSET_H
+
+#include "dllist.h"
+
+struct fdset
+{
+ struct dl_head list[1];
+ int del_count;
+};
+
+struct fdset_node /*internal*/
+{
+ struct dl_node node[1];
+ int fd;
+ void (*handler)(void *data, int fd);
+ void *data;
+};
+
+extern struct fdset fds[1]; /* global fd list */
+
+int fdset_init(struct fdset *fds);
+int fdset_add_fd(struct fdset *fds, int fd, void *handler, void *data);
+int fdset_del_fd(struct fdset *fds, int fd);
+int fdset_select(struct fdset *fds, int timeout /*millisec*/);
+
+#endif
diff --git a/libvbi/font.c b/libvbi/font.c
new file mode 100644
index 0000000..a6d5012
--- /dev/null
+++ b/libvbi/font.c
@@ -0,0 +1,3 @@
+#define static /* I want them global */
+#include "font1.xbm"
+#include "font2.xbm"
diff --git a/libvbi/font.h b/libvbi/font.h
new file mode 100644
index 0000000..064ee6b
--- /dev/null
+++ b/libvbi/font.h
@@ -0,0 +1,18 @@
+#ifndef FONT_H
+#define FONT_H
+
+#include "fontsize.h" /* the #defines from font?.xbm */
+
+#if font1_width != font2_width || font1_height != font2_height
+#error different font sizes.
+#endif
+
+extern unsigned char font1_bits[];
+extern unsigned char font2_bits[];
+
+#define font_width font1_width
+#define font_height font1_height
+#define CW (font_width/32) /* pixel width of a character */
+#define CH (font_height/8) /* pixel height of a character */
+
+#endif
diff --git a/libvbi/font1.xbm b/libvbi/font1.xbm
new file mode 100644
index 0000000..ead23ce
--- /dev/null
+++ b/libvbi/font1.xbm
@@ -0,0 +1,292 @@
+#define font1_width 288
+#define font1_height 128
+static unsigned char font1_bits[] = {
+0x00,0x1e,0xc0,0xff,0x0f,0xe0,0x01,0xfc,0xff,0x00,0x1e,0xc0,0xff,0x0f,0xe0,0x01,
+0xfc,0xff,0x00,0x1e,0xc0,0xff,0x0f,0xe0,0x01,0xfc,0xff,0x00,0x1e,0xc0,0xff,0x0f,
+0xe0,0x01,0xfc,0xff,0x00,0x1e,0xc0,0xff,0x0f,0xe0,0x01,0xfc,0xff,0x00,0x1e,0xc0,
+0xff,0x0f,0xe0,0x01,0xfc,0xff,0x00,0x1e,0xc0,0xff,0x0f,0xe0,0x01,0xfc,0xff,0x00,
+0x1e,0xc0,0xff,0x0f,0xe0,0x01,0xfc,0xff,0x00,0x1e,0xc0,0xff,0x0f,0xe0,0x01,0xfc,
+0xff,0x00,0x1e,0xc0,0xff,0x0f,0xe0,0x01,0xfc,0xff,0x00,0x1e,0xc0,0xff,0x0f,0xe0,
+0x01,0xfc,0xff,0x00,0x1e,0xc0,0xff,0x0f,0xe0,0x01,0xfc,0xff,0x00,0x1e,0xc0,0xff,
+0x0f,0xe0,0x01,0xfc,0xff,0x00,0x1e,0xc0,0xff,0x0f,0xe0,0x01,0xfc,0xff,0x00,0x1e,
+0xc0,0xff,0x0f,0xe0,0x01,0xfc,0xff,0x00,0x1e,0xc0,0xff,0x0f,0xe0,0x01,0xfc,0xff,
+0x00,0x1e,0xc0,0xff,0x0f,0xe0,0x01,0xfc,0xff,0x00,0x1e,0xc0,0xff,0x0f,0xe0,0x01,
+0xfc,0xff,0x00,0x1e,0xc0,0xff,0x0f,0xe0,0x01,0xfc,0xff,0x00,0x1e,0xc0,0xff,0x0f,
+0xe0,0x01,0xfc,0xff,0x00,0x00,0x00,0x00,0xf0,0xe0,0xc1,0x83,0x07,0xf0,0xe1,0xc3,
+0x87,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0xf0,0xe0,0xc1,0x83,0x07,0xf0,
+0xe1,0xc3,0x87,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0xf0,0xe0,0xc1,0x83,
+0x07,0xf0,0xe1,0xc3,0x87,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0xf0,0xe0,
+0xc1,0x83,0x07,0xf0,0xe1,0xc3,0x87,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,
+0xf0,0xe0,0xc1,0x83,0x07,0xf0,0xe1,0xc3,0x87,0xff,0xff,0xff,0xff,0xff,0x00,0x00,
+0x00,0x00,0xf0,0xe0,0xc1,0x83,0x07,0xf0,0xe1,0xc3,0x87,0xff,0xff,0xff,0xff,0xff,
+0x00,0x00,0x00,0x00,0xf0,0xe0,0xc1,0x83,0x07,0xf0,0xe1,0xc3,0x87,0xff,0xff,0xff,
+0xff,0xff,0x00,0x00,0x00,0x00,0xf0,0xe0,0xc1,0x83,0x07,0xf0,0xe1,0xc3,0x87,0xff,
+0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0xf0,0xe0,0xc1,0x83,0x07,0xf0,0xe1,0xc3,
+0x87,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0xf0,0xe0,0xc1,0x83,0x07,0xf0,
+0xe1,0xc3,0x87,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0xf0,0xe0,0xc1,0x83,
+0x07,0xf0,0xe1,0xc3,0x87,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0xf0,0xe0,
+0xc1,0x83,0x07,0xf0,0xe1,0xc3,0x87,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0x1e,
+0x3c,0x78,0xf0,0xe0,0xc1,0x83,0x07,0x0f,0x1e,0x3c,0x78,0xf0,0xe0,0xc1,0x83,0x07,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x0f,0x1e,0x3c,0x78,0xf0,0xe0,0xc1,0x83,0x07,0x0f,0x1e,0x3c,0x78,0xf0,
+0xe0,0xc1,0x83,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0x1e,0x3c,0x78,0xf0,0xe0,0xc1,0x83,0x07,0x0f,
+0x1e,0x3c,0x78,0xf0,0xe0,0xc1,0x83,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0x1e,0x3c,0x78,0xf0,0xe0,
+0xc1,0x83,0x07,0x0f,0x1e,0x3c,0x78,0xf0,0xe0,0xc1,0x83,0x07,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0x1e,
+0x3c,0x78,0xf0,0xe0,0xc1,0x83,0x07,0x0f,0x1e,0x3c,0x78,0xf0,0xe0,0xc1,0x83,0x07,
+0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x98,0x01,0x00,0x03,0x00,0x00,0x06,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x98,0x01,0xc0,0x07,0x00,0x0e,
+0x06,0x30,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x30,0xf0,0xe1,0x03,0xc6,
+0x1f,0x0e,0x7f,0x7c,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x3e,0x00,0x78,0x98,0x61,
+0x63,0x0c,0x00,0x1b,0x06,0x18,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x66,0x38,
+0x18,0x33,0x06,0xc7,0x00,0x03,0x63,0xc6,0x8c,0x01,0x00,0x00,0x06,0x80,0x01,0x63,
+0x00,0x78,0x90,0x60,0x63,0xc8,0x10,0x1b,0x03,0x0c,0x60,0x00,0x00,0x00,0x00,0x00,
+0x00,0x40,0xc3,0x3c,0x00,0x03,0x86,0xc7,0x80,0x01,0x60,0xc6,0x8c,0x61,0xc0,0x00,
+0x03,0x00,0x03,0x63,0x00,0x78,0x00,0xf0,0x67,0xc0,0x18,0x0e,0x00,0x0c,0x60,0x98,
+0xc1,0x00,0x00,0x00,0x00,0x60,0xc3,0x30,0x80,0x01,0xc6,0xc6,0x80,0x01,0x60,0xc6,
+0x8c,0x61,0xc0,0x80,0xc1,0x0f,0x06,0x30,0x00,0x30,0x00,0x60,0xc3,0x07,0x0c,0x37,
+0x00,0x0c,0x60,0xf0,0xc0,0x00,0x00,0x00,0x00,0x30,0xdb,0x30,0xc0,0xc0,0x63,0xc6,
+0x8f,0x1f,0x30,0x7c,0xf8,0x01,0x00,0xc0,0x00,0x00,0x0c,0x18,0x00,0x30,0x00,0x60,
+0x03,0x0c,0x86,0x1d,0x00,0x0c,0x60,0xfc,0xf3,0x03,0xc0,0x1f,0x00,0x18,0xdb,0x30,
+0x60,0x00,0xe6,0x0f,0x98,0x31,0x18,0xc6,0x80,0x01,0x00,0x60,0x00,0x00,0x18,0x18,
+0x00,0x30,0x00,0x60,0x03,0x0c,0x83,0x19,0x00,0x0c,0x60,0xf0,0xc0,0x00,0x00,0x00,
+0x00,0x0c,0xc3,0x30,0x30,0x00,0x06,0x06,0x98,0x31,0x0c,0xc6,0x80,0x01,0x00,0xc0,
+0xc0,0x0f,0x0c,0x18,0x00,0x00,0x00,0xf0,0x27,0x8c,0x81,0x19,0x00,0x0c,0x60,0x98,
+0xc1,0x80,0x01,0x00,0x00,0x06,0xc3,0x30,0x18,0x00,0x06,0x06,0x98,0x31,0x0c,0xc6,
+0x80,0x61,0xc0,0x80,0x01,0x00,0x06,0x00,0x00,0x30,0x00,0x60,0x63,0xcc,0x98,0x19,
+0x00,0x18,0x30,0x00,0x00,0x80,0x01,0x00,0x06,0x03,0x66,0x30,0x18,0x33,0x06,0xc6,
+0x98,0x31,0x0c,0xc6,0xc0,0x60,0xc0,0x00,0x03,0x00,0x03,0x18,0x00,0x30,0x00,0x60,
+0xc3,0x47,0x18,0x37,0x00,0x30,0x18,0x00,0x00,0x80,0x01,0x00,0x06,0x01,0x3c,0xfc,
+0xf8,0xe3,0x03,0x8f,0x0f,0x1f,0x0c,0x7c,0x78,0x00,0xc0,0x00,0x06,0x80,0x01,0x18,
+0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x0e,0x00,0x00,0x20,0xf8,0xc1,0xe3,0xc3,0x9f,0x3f,
+0x3c,0xc6,0x78,0xc0,0x73,0xe6,0x61,0x98,0x31,0x3e,0x7e,0xf8,0xf8,0xe1,0xf3,0xcf,
+0xd8,0xb0,0x61,0xc3,0x86,0xfd,0xe3,0x01,0x80,0x07,0x1b,0x00,0x7c,0x70,0x30,0x63,
+0xc6,0x86,0x19,0x33,0x66,0xc6,0x30,0x80,0x61,0xc6,0xe0,0x9c,0x33,0x63,0xcc,0x8c,
+0x31,0x33,0xb6,0xcd,0xd8,0xb0,0x61,0xc3,0x86,0x0d,0x63,0x20,0x00,0x86,0x31,0x00,
+0xc6,0xd8,0x30,0x33,0xc4,0x8c,0x11,0x23,0x43,0xc6,0x30,0x80,0x61,0xc6,0xe0,0x9f,
+0x37,0x63,0xcc,0x8c,0x31,0x33,0x96,0xc9,0xd8,0xb0,0x61,0x66,0x86,0x85,0x61,0x60,
+0x00,0x06,0x00,0x00,0xc6,0x8c,0x31,0x33,0xc0,0x8c,0x05,0x0b,0x03,0xc6,0x30,0x80,
+0x61,0xc3,0xe0,0x9f,0x3f,0x63,0xcc,0x8c,0x31,0x63,0x80,0xc1,0xd8,0xb0,0x61,0x3c,
+0xcc,0xc0,0x60,0xe0,0x00,0x06,0x00,0x00,0xf6,0x8c,0xf1,0x31,0xc0,0x8c,0x07,0x0f,
+0x03,0xfe,0x30,0x80,0xe1,0xc1,0x60,0x9b,0x3d,0x63,0x7c,0x8c,0xf1,0xc1,0x81,0xc1,
+0xd8,0xb0,0x61,0x18,0x78,0x60,0x60,0xc0,0x01,0x06,0x00,0x00,0xf6,0xfc,0x31,0x33,
+0xc0,0x8c,0x05,0x0b,0x7b,0xc6,0x30,0x80,0xe1,0xc1,0x60,0x98,0x39,0x63,0x0c,0x8c,
+0xb1,0x01,0x83,0xc1,0xd8,0xb0,0x6d,0x18,0x30,0x30,0x60,0x80,0x03,0x06,0x00,0x00,
+0xf6,0x8c,0x31,0x33,0xc0,0x8c,0x01,0x03,0x63,0xc6,0x30,0x98,0x61,0xc3,0x60,0x98,
+0x31,0x63,0x0c,0x8c,0x31,0x03,0x86,0xc1,0xd8,0xb0,0x6d,0x3c,0x30,0x18,0x60,0x00,
+0x07,0x06,0x00,0x00,0x76,0x8c,0x31,0x33,0xc4,0x8c,0x11,0x03,0x63,0xc6,0x30,0x98,
+0x61,0xc6,0x68,0x98,0x31,0x63,0x0c,0xac,0x31,0x33,0x86,0xc1,0x98,0x99,0x7f,0x66,
+0x30,0x0c,0x62,0x00,0x0e,0x06,0x00,0x00,0x06,0x8c,0x31,0x63,0xc6,0x86,0x19,0x03,
+0x66,0xc6,0x30,0x98,0x61,0xc6,0x6c,0x98,0x31,0x63,0x0c,0xec,0x31,0x33,0x86,0xc1,
+0x18,0x0f,0x33,0xc3,0x30,0x0c,0x63,0x00,0x0c,0x06,0x00,0x00,0x7c,0x8c,0xf9,0xc1,
+0xe3,0xc3,0x9f,0x07,0x5c,0xc6,0x78,0xf0,0x70,0xe6,0x6f,0x98,0x31,0x3e,0x1e,0xf8,
+0x38,0xe3,0xc3,0x83,0x0f,0x06,0x33,0xc3,0x78,0xfc,0xe3,0x01,0x88,0x07,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x38,0x00,0x00,0x07,0x00,0x0e,
+0x00,0x0e,0x30,0x80,0x71,0xc0,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
+0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x83,0xc1,0x01,0x37,0x00,0x00,0x00,0x30,0x00,
+0x00,0x06,0x00,0x1b,0x00,0x0c,0x30,0x80,0x61,0x80,0x01,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x80,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x80,0x01,0x83,0x1d,0x7f,
+0x00,0x00,0x30,0x00,0x00,0x06,0x00,0x13,0x00,0x0c,0x00,0x00,0x60,0x80,0x01,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x80,
+0x01,0x03,0x00,0x7f,0x00,0x78,0xf0,0xe0,0x83,0x87,0x0f,0x03,0x6e,0x6c,0x38,0xc0,
+0x61,0x86,0xe1,0x8c,0x1d,0x3e,0x76,0xb8,0xd9,0xe1,0xe3,0xc7,0xcc,0xb0,0x61,0xc3,
+0x8c,0xf9,0xc3,0x80,0x01,0x03,0x00,0x7f,0x00,0xc0,0xb0,0x31,0xc6,0xc6,0x98,0x07,
+0x33,0xdc,0x30,0x80,0x61,0x83,0xe1,0x1f,0x33,0x63,0xcc,0xcc,0x70,0x33,0x86,0xc1,
+0xcc,0xb0,0x61,0x66,0x8c,0x99,0x71,0x80,0x01,0x0e,0x00,0x7f,0x00,0xf8,0x30,0x33,
+0x60,0xc6,0x1f,0x03,0x33,0xcc,0x30,0x80,0xe1,0x81,0x61,0x1b,0x33,0x63,0xcc,0xcc,
+0x30,0x63,0x80,0xc1,0xcc,0xb0,0x61,0x3c,0x8c,0xc1,0xc0,0x80,0x01,0x03,0x00,0x7f,
+0x00,0xcc,0x30,0x33,0x60,0xc6,0x00,0x03,0x33,0xcc,0x30,0x80,0xe1,0x81,0x61,0x1b,
+0x33,0x63,0xcc,0xcc,0x30,0xc0,0x81,0xc1,0xcc,0xb0,0x6d,0x18,0x8c,0x61,0xc0,0x80,
+0x01,0x03,0x00,0x7f,0x00,0xcc,0x30,0x33,0x60,0xc6,0x00,0x03,0x33,0xcc,0x30,0x80,
+0x61,0x83,0x61,0x1b,0x33,0x63,0xcc,0xcc,0x30,0x00,0x83,0xc1,0x8c,0x99,0x6d,0x3c,
+0x8c,0x31,0xc0,0x80,0x01,0x03,0x00,0x7f,0x00,0xcc,0x30,0x33,0x66,0xc6,0x18,0x03,
+0x33,0xcc,0x30,0x80,0x61,0x86,0x61,0x1b,0x33,0x63,0xcc,0xcc,0x30,0x30,0x86,0xcd,
+0x0c,0x8f,0x7f,0x66,0x8c,0x19,0xc3,0x80,0x01,0x03,0x00,0x7f,0x00,0xb8,0xf1,0xe1,
+0xc3,0x8d,0x8f,0x07,0x3e,0xce,0x78,0x80,0x71,0xc6,0x63,0x1b,0x33,0x3e,0x7c,0xf8,
+0x78,0xe0,0x03,0x87,0x1b,0x06,0x33,0xc3,0xf8,0xf9,0x83,0x83,0xc1,0x01,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x98,0x01,0x00,0x00,0x00,
+0x00,0x00,0x0c,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x01,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x33,0x00,0x00,0x98,
+0x01,0x00,0x00,0x00,0x00,0x00,0x0c,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x1e,0x00,0x00,0xf0,0x00,0x00,0x00,0x00,0x00,0x00,0x1e,0xe0,0x01,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x1e,0xc0,0xff,0x0f,0xe0,0x01,0xfc,0xff,0x00,0x1e,0xc0,0xff,0x0f,0xe0,0x01,
+0xfc,0xff,0x00,0x1e,0xc0,0xff,0x0f,0xe0,0x01,0xfc,0xff,0x00,0x1e,0xc0,0xff,0x0f,
+0xe0,0x01,0xfc,0xff,0x00,0x1e,0xc0,0xff,0x0f,0xe0,0x01,0xfc,0xff,0x00,0x1e,0xc0,
+0xff,0x0f,0xe0,0x01,0xfc,0xff,0x00,0x1e,0xc0,0xff,0x0f,0xe0,0x01,0xfc,0xff,0x00,
+0x1e,0xc0,0xff,0x0f,0xe0,0x01,0xfc,0xff,0x00,0x1e,0xc0,0xff,0x0f,0xe0,0x01,0xfc,
+0xff,0x00,0x1e,0xc0,0xff,0x0f,0xe0,0x01,0xfc,0xff,0x00,0x1e,0xc0,0xff,0x0f,0xe0,
+0x01,0xfc,0xff,0x00,0x1e,0xc0,0xff,0x0f,0xe0,0x01,0xfc,0xff,0x00,0x1e,0xc0,0xff,
+0x0f,0xe0,0x01,0xfc,0xff,0x00,0x1e,0xc0,0xff,0x0f,0xe0,0x01,0xfc,0xff,0x00,0x1e,
+0xc0,0xff,0x0f,0xe0,0x01,0xfc,0xff,0x00,0x1e,0xc0,0xff,0x0f,0xe0,0x01,0xfc,0xff,
+0x00,0x1e,0xc0,0xff,0x0f,0xe0,0x01,0xfc,0xff,0x00,0x1e,0xc0,0xff,0x0f,0xe0,0x01,
+0xfc,0xff,0x00,0x1e,0xc0,0xff,0x0f,0xe0,0x01,0xfc,0xff,0x00,0x1e,0xc0,0xff,0x0f,
+0xe0,0x01,0xfc,0xff,0x00,0x00,0x00,0x00,0xf0,0xe0,0xc1,0x83,0x07,0xf0,0xe1,0xc3,
+0x87,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0xf0,0xe0,0xc1,0x83,0x07,0xf0,
+0xe1,0xc3,0x87,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0xf0,0xe0,0xc1,0x83,
+0x07,0xf0,0xe1,0xc3,0x87,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0xf0,0xe0,
+0xc1,0x83,0x07,0xf0,0xe1,0xc3,0x87,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,
+0xf0,0xe0,0xc1,0x83,0x07,0xf0,0xe1,0xc3,0x87,0xff,0xff,0xff,0xff,0xff,0x00,0x00,
+0x00,0x00,0xf0,0xe0,0xc1,0x83,0x07,0xf0,0xe1,0xc3,0x87,0xff,0xff,0xff,0xff,0xff,
+0x00,0x00,0x00,0x00,0xf0,0xe0,0xc1,0x83,0x07,0xf0,0xe1,0xc3,0x87,0xff,0xff,0xff,
+0xff,0xff,0x00,0x00,0x00,0x00,0xf0,0xe0,0xc1,0x83,0x07,0xf0,0xe1,0xc3,0x87,0xff,
+0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0xf0,0xe0,0xc1,0x83,0x07,0xf0,0xe1,0xc3,
+0x87,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0xf0,0xe0,0xc1,0x83,0x07,0xf0,
+0xe1,0xc3,0x87,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0xf0,0xe0,0xc1,0x83,
+0x07,0xf0,0xe1,0xc3,0x87,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0xf0,0xe0,
+0xc1,0x83,0x07,0xf0,0xe1,0xc3,0x87,0xff,0xff,0xff,0xff,0xff,0xf0,0xe1,0xc3,0x87,
+0x0f,0x1f,0x3e,0x7c,0xf8,0xf0,0xe1,0xc3,0x87,0x0f,0x1f,0x3e,0x7c,0xf8,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xf0,0xe1,0xc3,0x87,0x0f,0x1f,0x3e,0x7c,0xf8,0xf0,0xe1,0xc3,0x87,0x0f,0x1f,0x3e,
+0x7c,0xf8,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xf0,0xe1,0xc3,0x87,0x0f,0x1f,0x3e,0x7c,0xf8,0xf0,0xe1,0xc3,
+0x87,0x0f,0x1f,0x3e,0x7c,0xf8,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xe1,0xc3,0x87,0x0f,0x1f,0x3e,0x7c,
+0xf8,0xf0,0xe1,0xc3,0x87,0x0f,0x1f,0x3e,0x7c,0xf8,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xe1,0xc3,0x87,
+0x0f,0x1f,0x3e,0x7c,0xf8,0xf0,0xe1,0xc3,0x87,0x0f,0x1f,0x3e,0x7c,0xf8,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x01,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x10,0x01,0x60,0xc0,0x01,0x00,0x80,0x19,0x3e,0x00,0x00,0x70,
+0x00,0x00,0x00,0x00,0x00,0x7f,0x38,0x00,0x70,0xf0,0xc1,0x00,0x00,0x00,0x00,0x80,
+0x18,0x70,0x00,0x60,0xc0,0x80,0x07,0x00,0x10,0x31,0x60,0x60,0x03,0x60,0x98,0x19,
+0x63,0x3c,0xf8,0xc0,0x00,0x80,0x01,0x00,0x1f,0x00,0x6c,0x00,0xd8,0x80,0x61,0x00,
+0x80,0x3f,0x00,0xc0,0x1c,0xd8,0x00,0x60,0xc0,0x00,0x06,0x0c,0x10,0x31,0xf8,0x61,
+0x22,0xc8,0x8c,0x19,0x06,0x7e,0x8c,0xf1,0x00,0xc0,0x03,0x80,0x31,0x00,0x6c,0x00,
+0x60,0xc0,0x00,0x00,0xc0,0x36,0x00,0x60,0x18,0x88,0x00,0x60,0xc8,0x10,0x27,0x0c,
+0x10,0x01,0x0c,0x63,0x60,0x8c,0x87,0x19,0x1c,0xdb,0x04,0x99,0x00,0xe0,0x07,0x80,
+0x20,0x00,0x38,0x30,0x30,0x80,0x01,0xc0,0xcc,0x36,0x00,0x30,0x18,0xd8,0x00,0x60,
+0xcc,0x18,0x36,0x00,0xff,0x31,0x0c,0xf0,0xc0,0x07,0x83,0x19,0x36,0xff,0x74,0xf1,
+0xc0,0xa0,0x05,0x80,0x2e,0x00,0x00,0x30,0x98,0xb0,0x01,0xc0,0xcc,0x36,0x00,0x38,
+0x18,0x70,0x80,0x61,0xc6,0x8c,0x1b,0x0c,0x10,0x31,0x0c,0x60,0x60,0xec,0x9f,0x19,
+0x63,0xbd,0x14,0x01,0x60,0x80,0x01,0x80,0x2a,0x00,0x00,0xfc,0xf8,0xe0,0x00,0xc0,
+0x8c,0x37,0x00,0x0c,0x3c,0x00,0x00,0x03,0x03,0x06,0x0c,0x0c,0x10,0x31,0x0c,0x60,
+0x60,0x0c,0x83,0x19,0x63,0xc3,0x14,0xf9,0xf0,0x87,0xe1,0xbf,0x26,0x00,0x00,0x30,
+0x00,0x00,0x00,0xc0,0x0c,0x36,0x0c,0xfe,0x00,0xf8,0xf0,0x87,0x01,0x03,0x06,0x06,
+0x10,0x79,0x0c,0x63,0x60,0xec,0x9f,0x19,0x36,0xe7,0x74,0x01,0xf0,0x87,0x01,0x80,
+0x2a,0x00,0x00,0x30,0x00,0x00,0x00,0xc0,0x0c,0x36,0x0c,0xee,0x00,0x00,0xf0,0xc7,
+0x8c,0x01,0x33,0x03,0x10,0x79,0xf8,0x61,0x60,0x0c,0x83,0x19,0x1c,0xff,0x04,0x01,
+0x60,0x80,0x01,0x80,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x0f,0x36,0x00,0x70,
+0x00,0x00,0x00,0x63,0xce,0x9c,0x39,0x63,0x10,0x79,0x60,0x70,0xc6,0x07,0x83,0x19,
+0x30,0x7e,0x8c,0x01,0xc0,0x80,0x01,0x80,0x31,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,
+0x18,0x36,0x00,0x38,0x00,0x00,0x80,0x21,0x4d,0xb6,0x34,0x63,0xff,0x31,0x60,0xf0,
+0x63,0x0c,0x83,0x19,0x63,0x3c,0xf8,0x00,0x00,0x00,0x00,0x00,0x1f,0x00,0x00,0xfc,
+0x00,0x00,0x00,0xc0,0x00,0x36,0x00,0x18,0x00,0x00,0x00,0x80,0x0f,0x18,0x3e,0x3e,
+0x10,0x01,0x00,0x00,0x20,0x08,0x80,0x19,0x3e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x0c,0x00,0x00,0x00,0x00,
+0x0c,0x0c,0x30,0x00,0x10,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,
+0x00,0x00,0x00,0x00,0x0c,0x3e,0x30,0x00,0x10,0x01,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x01,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x18,0x60,0xe0,0xe0,0x66,0x0c,0x07,0x00,0x00,0x18,0x60,0xe0,0x30,0xc6,0x00,0x06,
+0x0f,0x33,0x00,0xb8,0x31,0x00,0x83,0x83,0x9b,0x31,0x00,0x80,0x18,0x80,0xc1,0x61,
+0x0c,0x83,0x07,0x00,0x30,0x30,0xb0,0xb1,0x03,0x00,0x05,0x00,0x00,0x30,0x30,0xb0,
+0x01,0x80,0x01,0x83,0x19,0x00,0x00,0xec,0x60,0x80,0xc1,0xc6,0x0e,0x00,0x00,0xc0,
+0x30,0xc0,0x40,0x01,0x80,0x01,0x03,0x00,0x10,0x20,0x40,0x00,0x00,0x01,0x07,0x3e,
+0x00,0xfe,0xfc,0xf9,0xf3,0x07,0x00,0x00,0x00,0x1e,0x3c,0x8c,0xf1,0xe1,0xc3,0x87,
+0x0f,0x1f,0x00,0x7c,0x8c,0x19,0x33,0x66,0x6c,0x18,0x1f,0x1c,0x38,0x70,0xe0,0xc0,
+0x81,0x03,0x07,0x1b,0x3c,0xcc,0x98,0x31,0x63,0xc6,0x83,0x07,0x0f,0x0c,0x6c,0x9c,
+0x19,0x33,0x66,0xcc,0x98,0x31,0x00,0xe6,0x8c,0x19,0x33,0x66,0x6c,0x18,0x33,0x36,
+0x6c,0xd8,0xb0,0x61,0xc3,0x86,0x8d,0x19,0x66,0x8c,0x18,0x31,0x62,0x84,0x01,0x03,
+0x06,0x0c,0xcc,0xbc,0x19,0x33,0x66,0xcc,0x98,0x31,0x63,0xe6,0x8c,0x19,0x33,0x66,
+0x6c,0x18,0x33,0x63,0xc6,0x8c,0x19,0x33,0x66,0xcc,0x98,0x19,0x43,0x2c,0x58,0xb0,
+0x60,0x81,0x01,0x03,0x06,0x0c,0xcc,0xfc,0x19,0x33,0x66,0xcc,0x98,0x31,0x36,0xf6,
+0x8c,0x19,0x33,0x66,0xcc,0x0c,0x33,0x73,0xc6,0x8c,0x19,0x33,0x66,0xcc,0x98,0x3f,
+0x03,0x3c,0x78,0xf0,0xe0,0x81,0x01,0x03,0x06,0x0c,0xde,0xec,0x19,0x33,0x66,0xcc,
+0x98,0x31,0x1c,0xd6,0x8c,0x19,0x33,0x66,0x8c,0x07,0x1f,0x3b,0xfe,0xfc,0xf9,0xf3,
+0xe7,0xcf,0x9f,0x19,0x03,0x2c,0x58,0xb0,0x60,0x81,0x01,0x03,0x06,0x0c,0xde,0xcc,
+0x19,0x33,0x66,0xcc,0x98,0x31,0x08,0xd6,0x8c,0x19,0x33,0x66,0x0c,0x03,0x03,0x1b,
+0xc6,0x8c,0x19,0x33,0x66,0xcc,0x98,0x19,0x03,0x0c,0x18,0x30,0x60,0x80,0x01,0x03,
+0x06,0x0c,0xcc,0x8c,0x19,0x33,0x66,0xcc,0x98,0x31,0x1c,0xde,0x8c,0x19,0x33,0x66,
+0x0c,0x03,0x03,0x33,0xc6,0x8c,0x19,0x33,0x66,0xcc,0x98,0x19,0x43,0x8c,0x18,0x31,
+0x62,0x84,0x01,0x03,0x06,0x0c,0xcc,0x8c,0x19,0x33,0x66,0xcc,0x98,0x31,0x36,0xce,
+0x8c,0x19,0x33,0x66,0x0c,0x03,0x03,0x63,0xc6,0x8c,0x19,0x33,0x66,0xcc,0x98,0x19,
+0x66,0xcc,0x98,0x31,0x63,0x86,0x01,0x03,0x06,0x0c,0x6c,0x8c,0x19,0x33,0x66,0xcc,
+0x98,0x31,0x63,0xce,0x8c,0x19,0x33,0x66,0x0c,0x03,0x03,0x6b,0xc6,0x8c,0x19,0x33,
+0x66,0xcc,0x98,0x39,0x3c,0xfe,0xfc,0xf9,0xf3,0xc7,0x83,0x07,0x0f,0x1e,0x3c,0x8c,
+0xf1,0xe1,0xc3,0x87,0x0f,0x1f,0x00,0x7c,0xf8,0xf0,0xe1,0xc3,0x87,0x87,0x07,0x3b,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x3e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x0c,0x60,0x40,0x00,0x00,0x00,0x07,0x00,0x00,0x0c,0xc0,0x40,
+0x00,0x60,0x00,0x0c,0x06,0x00,0x00,0x00,0x30,0x80,0x01,0x01,0x00,0x00,0x00,0x00,
+0x18,0xc0,0xc0,0x00,0x00,0x06,0x00,0x00,0x18,0x30,0xe0,0xe0,0x66,0x86,0x0d,0x00,
+0x00,0x18,0x60,0xe0,0x30,0xc6,0x00,0x06,0x0f,0x33,0x70,0xb8,0x61,0xc0,0x80,0x83,
+0x9b,0x31,0x00,0x00,0x30,0x60,0xe0,0x61,0x06,0x03,0x00,0x63,0x30,0x18,0xb0,0xb1,
+0x03,0x00,0x07,0x00,0x00,0x30,0x30,0xb0,0x01,0x80,0x01,0x83,0x19,0x00,0x60,0xec,
+0xc0,0x60,0xc0,0xc6,0x0e,0x00,0x00,0x80,0x60,0x30,0x30,0x03,0x80,0x81,0x07,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0xf0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0c,0xc0,0x00,0x00,0x00,0x00,
+0x00,0x00,0x03,0x00,0x3c,0x78,0xf0,0xe0,0xc1,0x83,0x87,0x1d,0x3e,0x7c,0xf8,0xf0,
+0xe1,0xc3,0x81,0x03,0x07,0x0e,0x60,0xec,0xf0,0xe1,0xc3,0x87,0x0f,0x1f,0x0c,0x7c,
+0xcc,0x98,0x31,0x63,0xc6,0x18,0x1f,0x63,0x60,0xc0,0x80,0x01,0x03,0x06,0x0c,0x37,
+0x63,0xc6,0x8c,0x19,0x33,0x86,0x01,0x03,0x06,0x0c,0x7c,0x98,0x19,0x33,0x66,0xcc,
+0x98,0x31,0x00,0xe6,0xcc,0x98,0x31,0x63,0xc6,0x18,0x33,0x63,0x7c,0xf8,0xf0,0xe1,
+0xc3,0x87,0x0f,0x36,0x03,0xfe,0xfc,0xf9,0xf3,0x87,0x01,0x03,0x06,0x0c,0x66,0x98,
+0x19,0x33,0x66,0xcc,0x98,0x31,0x3f,0xf6,0xcc,0x98,0x31,0x63,0xc6,0x18,0x33,0x63,
+0x66,0xcc,0x98,0x31,0x63,0xc6,0x8c,0x1f,0x03,0x06,0x0c,0x18,0x30,0x80,0x01,0x03,
+0x06,0x0c,0x66,0x98,0x19,0x33,0x66,0xcc,0x98,0x31,0x00,0xd6,0xcc,0x98,0x31,0x63,
+0xc6,0x18,0x33,0x63,0x66,0xcc,0x98,0x31,0x63,0xc6,0xcc,0x06,0x03,0x06,0x0c,0x18,
+0x30,0x80,0x01,0x03,0x06,0x0c,0x66,0x98,0x19,0x33,0x66,0xcc,0x98,0x31,0x0c,0xde,
+0xcc,0x98,0x31,0x63,0xc6,0x18,0x33,0x63,0x66,0xcc,0x98,0x31,0x63,0xc6,0xcc,0x0e,
+0x63,0xc6,0x8c,0x19,0x33,0x86,0x01,0x03,0x06,0x0c,0x66,0x98,0x19,0x33,0x66,0xcc,
+0x98,0x31,0x0c,0xce,0xcc,0x98,0x31,0x63,0xc6,0x18,0x33,0x63,0xdc,0xb8,0x71,0xe3,
+0xc6,0x8d,0x9b,0x3b,0x3e,0x7c,0xf8,0xf0,0xe1,0xc3,0x83,0x07,0x0f,0x1e,0xdc,0x98,
+0xf1,0xe1,0xc3,0x87,0x0f,0x1f,0x00,0x7c,0xb8,0x71,0xe3,0xc6,0x8d,0x1f,0x1f,0x7e,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x00,
+0x00,0x18,0x03,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,
+0x00,0x00,0x00,0x00,0x00,0x0c,0x03,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x1e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x87,0x07,0x1f,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+};
diff --git a/libvbi/font2.xbm b/libvbi/font2.xbm
new file mode 100644
index 0000000..739fb06
--- /dev/null
+++ b/libvbi/font2.xbm
@@ -0,0 +1,292 @@
+#define font2_width 288
+#define font2_height 128
+static unsigned char font2_bits[] = {
+0x00,0x1e,0xc0,0xff,0x0f,0xe0,0x01,0xfc,0xff,0x00,0x1e,0xc0,0xff,0x0f,0xe0,0x01,
+0xfc,0xff,0x00,0x1e,0xc0,0xff,0x0f,0xe0,0x01,0xfc,0xff,0x00,0x1e,0xc0,0xff,0x0f,
+0xe0,0x01,0xfc,0xff,0x00,0x1e,0xc0,0xff,0x0f,0xe0,0x01,0xfc,0xff,0x00,0x1e,0xc0,
+0xff,0x0f,0xe0,0x01,0xfc,0xff,0x00,0x1e,0xc0,0xff,0x0f,0xe0,0x01,0xfc,0xff,0x00,
+0x1e,0xc0,0xff,0x0f,0xe0,0x01,0xfc,0xff,0x00,0x1e,0xc0,0xff,0x0f,0xe0,0x01,0xfc,
+0xff,0x00,0x1e,0xc0,0xff,0x0f,0xe0,0x01,0xfc,0xff,0x00,0x1e,0xc0,0xff,0x0f,0xe0,
+0x01,0xfc,0xff,0x00,0x1e,0xc0,0xff,0x0f,0xe0,0x01,0xfc,0xff,0x00,0x1e,0xc0,0xff,
+0x0f,0xe0,0x01,0xfc,0xff,0x00,0x1e,0xc0,0xff,0x0f,0xe0,0x01,0xfc,0xff,0x00,0x1e,
+0xc0,0xff,0x0f,0xe0,0x01,0xfc,0xff,0x00,0x1e,0xc0,0xff,0x0f,0xe0,0x01,0xfc,0xff,
+0x00,0x1e,0xc0,0xff,0x0f,0xe0,0x01,0xfc,0xff,0x00,0x1e,0xc0,0xff,0x0f,0xe0,0x01,
+0xfc,0xff,0x00,0x1e,0xc0,0xff,0x0f,0xe0,0x01,0xfc,0xff,0x00,0x1e,0xc0,0xff,0x0f,
+0xe0,0x01,0xfc,0xff,0x00,0x00,0x00,0x00,0xf0,0xe0,0xc1,0x83,0x07,0xf0,0xe1,0xc3,
+0x87,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0xf0,0xe0,0xc1,0x83,0x07,0xf0,
+0xe1,0xc3,0x87,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0xf0,0xe0,0xc1,0x83,
+0x07,0xf0,0xe1,0xc3,0x87,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0xf0,0xe0,
+0xc1,0x83,0x07,0xf0,0xe1,0xc3,0x87,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,
+0xf0,0xe0,0xc1,0x83,0x07,0xf0,0xe1,0xc3,0x87,0xff,0xff,0xff,0xff,0xff,0x00,0x00,
+0x00,0x00,0xf0,0xe0,0xc1,0x83,0x07,0xf0,0xe1,0xc3,0x87,0xff,0xff,0xff,0xff,0xff,
+0x00,0x00,0x00,0x00,0xf0,0xe0,0xc1,0x83,0x07,0xf0,0xe1,0xc3,0x87,0xff,0xff,0xff,
+0xff,0xff,0x00,0x00,0x00,0x00,0xf0,0xe0,0xc1,0x83,0x07,0xf0,0xe1,0xc3,0x87,0xff,
+0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0xf0,0xe0,0xc1,0x83,0x07,0xf0,0xe1,0xc3,
+0x87,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0xf0,0xe0,0xc1,0x83,0x07,0xf0,
+0xe1,0xc3,0x87,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0xf0,0xe0,0xc1,0x83,
+0x07,0xf0,0xe1,0xc3,0x87,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0xf0,0xe0,
+0xc1,0x83,0x07,0xf0,0xe1,0xc3,0x87,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0x1e,
+0x3c,0x78,0xf0,0xe0,0xc1,0x83,0x07,0x0f,0x1e,0x3c,0x78,0xf0,0xe0,0xc1,0x83,0x07,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x0f,0x1e,0x3c,0x78,0xf0,0xe0,0xc1,0x83,0x07,0x0f,0x1e,0x3c,0x78,0xf0,
+0xe0,0xc1,0x83,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0x1e,0x3c,0x78,0xf0,0xe0,0xc1,0x83,0x07,0x0f,
+0x1e,0x3c,0x78,0xf0,0xe0,0xc1,0x83,0x07,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0x1e,0x3c,0x78,0xf0,0xe0,
+0xc1,0x83,0x07,0x0f,0x1e,0x3c,0x78,0xf0,0xe0,0xc1,0x83,0x07,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0x1e,
+0x3c,0x78,0xf0,0xe0,0xc1,0x83,0x07,0x0f,0x1e,0x3c,0x78,0xf0,0xe0,0xc1,0x83,0x07,
+0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x98,0x01,0x00,0x03,0x00,0x00,0x06,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x98,0x01,0xc0,0x07,0x00,0x0e,
+0x06,0x30,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3c,0x30,0xf0,0xe1,0x03,0xc6,
+0x1f,0x0e,0x7f,0x7c,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x3e,0x00,0x78,0x98,0x61,
+0x63,0x0c,0x00,0x1b,0x06,0x18,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x66,0x38,
+0x18,0x33,0x06,0xc7,0x00,0x03,0x63,0xc6,0x8c,0x01,0x00,0x00,0x06,0x80,0x01,0x63,
+0x00,0x78,0x90,0x60,0x63,0xc8,0x10,0x1b,0x03,0x0c,0x60,0x00,0x00,0x00,0x00,0x00,
+0x00,0x40,0xc3,0x3c,0x00,0x03,0x86,0xc7,0x80,0x01,0x60,0xc6,0x8c,0x61,0xc0,0x00,
+0x03,0x00,0x03,0x63,0x00,0x78,0x00,0xf0,0x67,0xc0,0x18,0x0e,0x00,0x0c,0x60,0x98,
+0xc1,0x00,0x00,0x00,0x00,0x60,0xc3,0x30,0x80,0x01,0xc6,0xc6,0x80,0x01,0x60,0xc6,
+0x8c,0x61,0xc0,0x80,0xc1,0x0f,0x06,0x30,0x00,0x30,0x00,0x60,0xc3,0x07,0x0c,0x37,
+0x00,0x0c,0x60,0xf0,0xc0,0x00,0x00,0x00,0x00,0x30,0xdb,0x30,0xc0,0xc0,0x63,0xc6,
+0x8f,0x1f,0x30,0x7c,0xf8,0x01,0x00,0xc0,0x00,0x00,0x0c,0x18,0x00,0x30,0x00,0x60,
+0x03,0x0c,0x86,0x1d,0x00,0x0c,0x60,0xfc,0xf3,0x03,0xc0,0x1f,0x00,0x18,0xdb,0x30,
+0x60,0x00,0xe6,0x0f,0x98,0x31,0x18,0xc6,0x80,0x01,0x00,0x60,0x00,0x00,0x18,0x18,
+0x00,0x30,0x00,0x60,0x03,0x0c,0x83,0x19,0x00,0x0c,0x60,0xf0,0xc0,0x00,0x00,0x00,
+0x00,0x0c,0xc3,0x30,0x30,0x00,0x06,0x06,0x98,0x31,0x0c,0xc6,0x80,0x01,0x00,0xc0,
+0xc0,0x0f,0x0c,0x18,0x00,0x00,0x00,0xf0,0x27,0x8c,0x81,0x19,0x00,0x0c,0x60,0x98,
+0xc1,0x80,0x01,0x00,0x00,0x06,0xc3,0x30,0x18,0x00,0x06,0x06,0x98,0x31,0x0c,0xc6,
+0x80,0x61,0xc0,0x80,0x01,0x00,0x06,0x00,0x00,0x30,0x00,0x60,0x63,0xcc,0x98,0x19,
+0x00,0x18,0x30,0x00,0x00,0x80,0x01,0x00,0x06,0x03,0x66,0x30,0x18,0x33,0x06,0xc6,
+0x98,0x31,0x0c,0xc6,0xc0,0x60,0xc0,0x00,0x03,0x00,0x03,0x18,0x00,0x30,0x00,0x60,
+0xc3,0x47,0x18,0x37,0x00,0x30,0x18,0x00,0x00,0x80,0x01,0x00,0x06,0x01,0x3c,0xfc,
+0xf8,0xe3,0x03,0x8f,0x0f,0x1f,0x0c,0x7c,0x78,0x00,0xc0,0x00,0x06,0x80,0x01,0x18,
+0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x0e,0x00,0x00,0x20,0xf8,0xc1,0xe3,0xc3,0x9f,0x3f,
+0x3c,0xc6,0x78,0xc0,0x73,0xe6,0x61,0x98,0x31,0x3e,0x7e,0xf8,0xf8,0xe1,0xf3,0xcf,
+0xd8,0xb0,0x61,0xc3,0x86,0xfd,0xe3,0x01,0x80,0x07,0x1b,0x00,0x7c,0x70,0x30,0x63,
+0xc6,0x86,0x19,0x33,0x66,0xc6,0x30,0x80,0x61,0xc6,0xe0,0x9c,0x33,0x63,0xcc,0x8c,
+0x31,0x33,0xb6,0xcd,0xd8,0xb0,0x61,0xc3,0x86,0x0d,0x63,0x20,0x00,0x86,0x31,0x00,
+0xc6,0xd8,0x30,0x33,0xc4,0x8c,0x11,0x23,0x43,0xc6,0x30,0x80,0x61,0xc6,0xe0,0x9f,
+0x37,0x63,0xcc,0x8c,0x31,0x33,0x96,0xc9,0xd8,0xb0,0x61,0x66,0x86,0x85,0x61,0x60,
+0x00,0x06,0x00,0x00,0xc6,0x8c,0x31,0x33,0xc0,0x8c,0x05,0x0b,0x03,0xc6,0x30,0x80,
+0x61,0xc3,0xe0,0x9f,0x3f,0x63,0xcc,0x8c,0x31,0x63,0x80,0xc1,0xd8,0xb0,0x61,0x3c,
+0xcc,0xc0,0x60,0xe0,0x00,0x06,0x00,0x00,0xf6,0x8c,0xf1,0x31,0xc0,0x8c,0x07,0x0f,
+0x03,0xfe,0x30,0x80,0xe1,0xc1,0x60,0x9b,0x3d,0x63,0x7c,0x8c,0xf1,0xc1,0x81,0xc1,
+0xd8,0xb0,0x61,0x18,0x78,0x60,0x60,0xc0,0x01,0x06,0x00,0x00,0xf6,0xfc,0x31,0x33,
+0xc0,0x8c,0x05,0x0b,0x7b,0xc6,0x30,0x80,0xe1,0xc1,0x60,0x98,0x39,0x63,0x0c,0x8c,
+0xb1,0x01,0x83,0xc1,0xd8,0xb0,0x6d,0x18,0x30,0x30,0x60,0x80,0x03,0x06,0x00,0x00,
+0xf6,0x8c,0x31,0x33,0xc0,0x8c,0x01,0x03,0x63,0xc6,0x30,0x98,0x61,0xc3,0x60,0x98,
+0x31,0x63,0x0c,0x8c,0x31,0x03,0x86,0xc1,0xd8,0xb0,0x6d,0x3c,0x30,0x18,0x60,0x00,
+0x07,0x06,0x00,0x00,0x76,0x8c,0x31,0x33,0xc4,0x8c,0x11,0x03,0x63,0xc6,0x30,0x98,
+0x61,0xc6,0x68,0x98,0x31,0x63,0x0c,0xac,0x31,0x33,0x86,0xc1,0x98,0x99,0x7f,0x66,
+0x30,0x0c,0x62,0x00,0x0e,0x06,0x00,0x00,0x06,0x8c,0x31,0x63,0xc6,0x86,0x19,0x03,
+0x66,0xc6,0x30,0x98,0x61,0xc6,0x6c,0x98,0x31,0x63,0x0c,0xec,0x31,0x33,0x86,0xc1,
+0x18,0x0f,0x33,0xc3,0x30,0x0c,0x63,0x00,0x0c,0x06,0x00,0x00,0x7c,0x8c,0xf9,0xc1,
+0xe3,0xc3,0x9f,0x07,0x5c,0xc6,0x78,0xf0,0x70,0xe6,0x6f,0x98,0x31,0x3e,0x1e,0xf8,
+0x38,0xe3,0xc3,0x83,0x0f,0x06,0x33,0xc3,0x78,0xfc,0xe3,0x01,0x88,0x07,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x38,0x00,0x00,0x07,0x00,0x0e,
+0x00,0x0e,0x30,0x80,0x71,0xc0,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,
+0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x83,0xc1,0x01,0x37,0x00,0x00,0x00,0x30,0x00,
+0x00,0x06,0x00,0x1b,0x00,0x0c,0x30,0x80,0x61,0x80,0x01,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x80,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x80,0x01,0x83,0x1d,0x7f,
+0x00,0x00,0x30,0x00,0x00,0x06,0x00,0x13,0x00,0x0c,0x00,0x00,0x60,0x80,0x01,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x80,
+0x01,0x03,0x00,0x7f,0x00,0x78,0xf0,0xe0,0x83,0x87,0x0f,0x03,0x6e,0x6c,0x38,0xc0,
+0x61,0x86,0xe1,0x8c,0x1d,0x3e,0x76,0xb8,0xd9,0xe1,0xe3,0xc7,0xcc,0xb0,0x61,0xc3,
+0x8c,0xf9,0xc3,0x80,0x01,0x03,0x00,0x7f,0x00,0xc0,0xb0,0x31,0xc6,0xc6,0x98,0x07,
+0x33,0xdc,0x30,0x80,0x61,0x83,0xe1,0x1f,0x33,0x63,0xcc,0xcc,0x70,0x33,0x86,0xc1,
+0xcc,0xb0,0x61,0x66,0x8c,0x99,0x71,0x80,0x01,0x0e,0x00,0x7f,0x00,0xf8,0x30,0x33,
+0x60,0xc6,0x1f,0x03,0x33,0xcc,0x30,0x80,0xe1,0x81,0x61,0x1b,0x33,0x63,0xcc,0xcc,
+0x30,0x63,0x80,0xc1,0xcc,0xb0,0x61,0x3c,0x8c,0xc1,0xc0,0x80,0x01,0x03,0x00,0x7f,
+0x00,0xcc,0x30,0x33,0x60,0xc6,0x00,0x03,0x33,0xcc,0x30,0x80,0xe1,0x81,0x61,0x1b,
+0x33,0x63,0xcc,0xcc,0x30,0xc0,0x81,0xc1,0xcc,0xb0,0x6d,0x18,0x8c,0x61,0xc0,0x80,
+0x01,0x03,0x00,0x7f,0x00,0xcc,0x30,0x33,0x60,0xc6,0x00,0x03,0x33,0xcc,0x30,0x80,
+0x61,0x83,0x61,0x1b,0x33,0x63,0xcc,0xcc,0x30,0x00,0x83,0xc1,0x8c,0x99,0x6d,0x3c,
+0x8c,0x31,0xc0,0x80,0x01,0x03,0x00,0x7f,0x00,0xcc,0x30,0x33,0x66,0xc6,0x18,0x03,
+0x33,0xcc,0x30,0x80,0x61,0x86,0x61,0x1b,0x33,0x63,0xcc,0xcc,0x30,0x30,0x86,0xcd,
+0x0c,0x8f,0x7f,0x66,0x8c,0x19,0xc3,0x80,0x01,0x03,0x00,0x7f,0x00,0xb8,0xf1,0xe1,
+0xc3,0x8d,0x8f,0x07,0x3e,0xce,0x78,0x80,0x71,0xc6,0x63,0x1b,0x33,0x3e,0x7c,0xf8,
+0x78,0xe0,0x03,0x87,0x1b,0x06,0x33,0xc3,0xf8,0xf9,0x83,0x83,0xc1,0x01,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x98,0x01,0x00,0x00,0x00,
+0x00,0x00,0x0c,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x01,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x33,0x00,0x00,0x98,
+0x01,0x00,0x00,0x00,0x00,0x00,0x0c,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x1e,0x00,0x00,0xf0,0x00,0x00,0x00,0x00,0x00,0x00,0x1e,0xe0,0x01,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x1e,0xc0,0xff,0x0f,0xe0,0x01,0xfc,0xff,0x00,0x1e,0xc0,0xff,0x0f,0xe0,0x01,
+0xfc,0xff,0x00,0x1e,0xc0,0xff,0x0f,0xe0,0x01,0xfc,0xff,0x00,0x1e,0xc0,0xff,0x0f,
+0xe0,0x01,0xfc,0xff,0x00,0x1e,0xc0,0xff,0x0f,0xe0,0x01,0xfc,0xff,0x00,0x1e,0xc0,
+0xff,0x0f,0xe0,0x01,0xfc,0xff,0x00,0x1e,0xc0,0xff,0x0f,0xe0,0x01,0xfc,0xff,0x00,
+0x1e,0xc0,0xff,0x0f,0xe0,0x01,0xfc,0xff,0x00,0x1e,0xc0,0xff,0x0f,0xe0,0x01,0xfc,
+0xff,0x00,0x1e,0xc0,0xff,0x0f,0xe0,0x01,0xfc,0xff,0x00,0x1e,0xc0,0xff,0x0f,0xe0,
+0x01,0xfc,0xff,0x00,0x1e,0xc0,0xff,0x0f,0xe0,0x01,0xfc,0xff,0x00,0x1e,0xc0,0xff,
+0x0f,0xe0,0x01,0xfc,0xff,0x00,0x1e,0xc0,0xff,0x0f,0xe0,0x01,0xfc,0xff,0x00,0x1e,
+0xc0,0xff,0x0f,0xe0,0x01,0xfc,0xff,0x00,0x1e,0xc0,0xff,0x0f,0xe0,0x01,0xfc,0xff,
+0x00,0x1e,0xc0,0xff,0x0f,0xe0,0x01,0xfc,0xff,0x00,0x1e,0xc0,0xff,0x0f,0xe0,0x01,
+0xfc,0xff,0x00,0x1e,0xc0,0xff,0x0f,0xe0,0x01,0xfc,0xff,0x00,0x1e,0xc0,0xff,0x0f,
+0xe0,0x01,0xfc,0xff,0x00,0x00,0x00,0x00,0xf0,0xe0,0xc1,0x83,0x07,0xf0,0xe1,0xc3,
+0x87,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0xf0,0xe0,0xc1,0x83,0x07,0xf0,
+0xe1,0xc3,0x87,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0xf0,0xe0,0xc1,0x83,
+0x07,0xf0,0xe1,0xc3,0x87,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0xf0,0xe0,
+0xc1,0x83,0x07,0xf0,0xe1,0xc3,0x87,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,
+0xf0,0xe0,0xc1,0x83,0x07,0xf0,0xe1,0xc3,0x87,0xff,0xff,0xff,0xff,0xff,0x00,0x00,
+0x00,0x00,0xf0,0xe0,0xc1,0x83,0x07,0xf0,0xe1,0xc3,0x87,0xff,0xff,0xff,0xff,0xff,
+0x00,0x00,0x00,0x00,0xf0,0xe0,0xc1,0x83,0x07,0xf0,0xe1,0xc3,0x87,0xff,0xff,0xff,
+0xff,0xff,0x00,0x00,0x00,0x00,0xf0,0xe0,0xc1,0x83,0x07,0xf0,0xe1,0xc3,0x87,0xff,
+0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0xf0,0xe0,0xc1,0x83,0x07,0xf0,0xe1,0xc3,
+0x87,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0xf0,0xe0,0xc1,0x83,0x07,0xf0,
+0xe1,0xc3,0x87,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0xf0,0xe0,0xc1,0x83,
+0x07,0xf0,0xe1,0xc3,0x87,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0xf0,0xe0,
+0xc1,0x83,0x07,0xf0,0xe1,0xc3,0x87,0xff,0xff,0xff,0xff,0xff,0xf0,0xe1,0xc3,0x87,
+0x0f,0x1f,0x3e,0x7c,0xf8,0xf0,0xe1,0xc3,0x87,0x0f,0x1f,0x3e,0x7c,0xf8,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xf0,0xe1,0xc3,0x87,0x0f,0x1f,0x3e,0x7c,0xf8,0xf0,0xe1,0xc3,0x87,0x0f,0x1f,0x3e,
+0x7c,0xf8,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xf0,0xe1,0xc3,0x87,0x0f,0x1f,0x3e,0x7c,0xf8,0xf0,0xe1,0xc3,
+0x87,0x0f,0x1f,0x3e,0x7c,0xf8,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xe1,0xc3,0x87,0x0f,0x1f,0x3e,0x7c,
+0xf8,0xf0,0xe1,0xc3,0x87,0x0f,0x1f,0x3e,0x7c,0xf8,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf0,0xe1,0xc3,0x87,
+0x0f,0x1f,0x3e,0x7c,0xf8,0xf0,0xe1,0xc3,0x87,0x0f,0x1f,0x3e,0x7c,0xf8,0xff,0xff,
+0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
+0xff,0x01,0x00,0x00,0x00,0x00,0x00,0x0c,0x00,0x00,0xcc,0x00,0x30,0x03,0x03,0x80,
+0x19,0x00,0x00,0x00,0x00,0x00,0x80,0x01,0x00,0x00,0x33,0x00,0x01,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x10,0x01,0x98,0x01,0x00,0x00,0x00,0x06,0x3e,0xc6,0x78,0x00,
+0xe0,0x81,0x01,0x00,0x0f,0x00,0x38,0x00,0x00,0x00,0xc0,0x00,0x00,0x00,0x1e,0x80,
+0x00,0x00,0x00,0x0c,0x80,0x19,0x00,0x00,0x10,0x21,0xf0,0xf0,0x00,0xc0,0x1b,0x1f,
+0x63,0x00,0xf8,0xf0,0xf9,0xf7,0x0f,0xc0,0xbf,0x7f,0x6c,0x00,0x00,0xe0,0x60,0x80,
+0x33,0x18,0x0c,0xc0,0x00,0x00,0x80,0x0c,0xc6,0x0c,0x00,0x18,0x10,0x71,0x00,0x60,
+0x20,0x88,0x99,0x31,0x06,0x00,0x8c,0x19,0xdb,0x36,0x0c,0xc0,0xb0,0x61,0x6c,0x00,
+0x00,0xc0,0x00,0x00,0x33,0x0c,0x00,0x60,0xd8,0x00,0xc0,0x06,0x63,0x86,0x19,0x18,
+0x10,0xd9,0x00,0x60,0x60,0x8c,0x8d,0x31,0x1c,0x00,0x8c,0x19,0xcb,0x14,0x06,0x40,
+0x98,0x30,0x38,0x00,0x00,0xc0,0x03,0x00,0x1b,0x00,0x00,0x30,0x70,0x00,0xc0,0x00,
+0x00,0x00,0x0f,0x00,0xff,0x8d,0x01,0xe0,0xc1,0x87,0x01,0x03,0x36,0x00,0x18,0x30,
+0xc0,0x00,0x03,0x00,0x0c,0x18,0x00,0x78,0x00,0xc0,0x01,0x00,0x03,0x1f,0x00,0x38,
+0xf8,0xf0,0xf1,0xe3,0x0f,0x80,0x3f,0x7f,0x10,0x8d,0x01,0xe0,0x60,0x8c,0x01,0x0e,
+0x63,0x00,0x70,0xe0,0xc0,0x80,0x01,0x00,0x06,0x3f,0x00,0xc0,0x00,0xc0,0x00,0x00,
+0x83,0x31,0x00,0x0c,0x8c,0x19,0xc3,0x60,0x06,0x80,0x19,0x33,0x10,0xfd,0x01,0x60,
+0x60,0x8c,0x01,0x18,0x63,0x00,0xc0,0x80,0xc1,0xc0,0xe0,0x3f,0x03,0x06,0x00,0xf8,
+0x00,0xe0,0x00,0x00,0x03,0x03,0x00,0xfe,0x18,0x30,0xc0,0x00,0x03,0x00,0x0c,0x18,
+0x10,0x8d,0x01,0x70,0x60,0x8c,0x01,0x30,0x36,0x00,0x80,0x01,0xc3,0x60,0x00,0x80,
+0x01,0x03,0x00,0xcc,0x00,0xf0,0x00,0x00,0x03,0x0e,0x00,0xee,0x70,0xe0,0xc0,0x80,
+0x01,0x00,0x06,0x0c,0x10,0x8d,0x01,0x78,0x64,0x8c,0x91,0x31,0x1c,0x00,0x8c,0x19,
+0xc3,0x30,0x08,0xc0,0xa0,0x41,0x00,0xcc,0x00,0xc0,0x00,0x00,0x03,0x18,0x00,0x70,
+0xc0,0x80,0xc1,0xc0,0x00,0x00,0x03,0x06,0x10,0x8d,0x01,0x60,0xc6,0x87,0x99,0x31,
+0x30,0x00,0x8c,0x19,0xc3,0x30,0x0c,0xc0,0xb0,0x61,0x00,0xcc,0x00,0xc0,0x00,0x00,
+0x83,0x31,0x00,0x38,0x8c,0x19,0xc3,0x66,0x0c,0x80,0x31,0x63,0xff,0x8d,0x01,0xf0,
+0x67,0xcc,0x1f,0x1f,0x63,0x00,0xf8,0xf0,0xe1,0xf1,0x0f,0xc0,0xbf,0x7f,0x00,0xb8,
+0xc1,0xe0,0x01,0x80,0x07,0x1f,0x00,0x18,0xf8,0xf0,0x81,0xe3,0x0f,0x80,0x3f,0x7f,
+0x10,0xc1,0x00,0x00,0x20,0x08,0x00,0x00,0x3e,0x00,0x00,0x80,0x01,0x00,0x00,0x00,
+0x00,0x00,0x00,0xc0,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x0c,0x00,0x00,0x03,0x00,
+0x00,0x00,0x00,0x00,0x10,0x81,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xc1,0x01,0x00,0x00,0x00,0x00,0x00,0x06,
+0x00,0xe0,0x01,0x00,0x00,0x00,0x00,0x00,0x10,0x01,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0xf0,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x01,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x60,0x80,0xe1,0x30,0x66,0x0c,0x06,0x18,0x00,0xcc,0x60,0x00,0x30,0xc6,0x0c,0x06,
+0x0f,0x33,0x00,0x60,0x98,0x01,0x83,0x83,0x99,0x31,0x00,0x66,0x20,0x80,0xc1,0x66,
+0x0c,0x03,0x00,0x00,0x30,0xc0,0xb0,0xe1,0x03,0x00,0x03,0x0c,0x00,0x78,0x30,0x00,
+0x00,0x80,0x07,0x83,0x19,0x1e,0x00,0x30,0xf0,0x80,0xc1,0xc6,0x0c,0x00,0x00,0x3c,
+0x50,0xc0,0x60,0x03,0x80,0x01,0x00,0x00,0x7e,0x00,0x40,0x00,0x00,0xc1,0x07,0x1e,
+0x00,0x78,0xfc,0xf9,0xf3,0xe7,0x0f,0x00,0x00,0x1f,0x3c,0x8c,0x19,0xe3,0xc3,0x87,
+0x0f,0x1f,0x00,0x7e,0xac,0x19,0x33,0x66,0x6c,0xd8,0x3f,0x1c,0xcc,0x70,0xe0,0xc0,
+0x81,0x83,0x01,0x33,0x3c,0xcc,0x98,0x31,0x63,0xc6,0x8c,0x07,0x0f,0x36,0x6c,0x9c,
+0x39,0x33,0x66,0xcc,0x98,0x31,0x00,0xcc,0x8c,0x19,0x33,0x66,0x6c,0xd8,0x36,0x36,
+0xcc,0xd8,0xb0,0x61,0xc3,0x86,0x81,0x21,0x66,0x86,0x18,0x31,0x62,0xc4,0x08,0x03,
+0x06,0x66,0xcc,0xbc,0x79,0x33,0x66,0xcc,0x98,0x31,0x63,0xcc,0x8c,0x19,0x33,0x66,
+0x6c,0x58,0x26,0x63,0xcc,0x8c,0x19,0x33,0x66,0x8c,0x81,0x01,0x43,0x06,0x58,0xb0,
+0x60,0xc1,0x02,0x03,0x06,0x66,0xcc,0xfc,0xf9,0x33,0x66,0xcc,0x98,0x31,0x36,0xcc,
+0x8c,0x19,0x33,0x66,0xcc,0x0c,0x06,0x73,0x7c,0x8c,0x19,0x33,0x66,0x8c,0x81,0x01,
+0x03,0x06,0x78,0xf0,0xe0,0xc1,0x03,0x03,0x06,0x66,0xde,0xec,0xd9,0x33,0x66,0xcc,
+0x98,0x31,0x1c,0x7c,0x8c,0x19,0x33,0x66,0x8c,0x07,0x06,0x3b,0x6c,0xfc,0xf9,0xf3,
+0xe7,0x8f,0x81,0x01,0x03,0x06,0x58,0xb0,0x60,0xc1,0x02,0x03,0x06,0x66,0xde,0xcc,
+0x99,0x33,0x66,0xcc,0x98,0x31,0x08,0x6c,0x8c,0x19,0x33,0x66,0x0c,0x03,0x06,0x1b,
+0xcc,0x8c,0x19,0x33,0x66,0x8c,0x81,0x01,0x03,0x06,0x18,0x30,0x60,0xc0,0x00,0x03,
+0x06,0x66,0xcc,0x8c,0x19,0x33,0x66,0xcc,0x98,0x31,0x1c,0xcc,0x8c,0x19,0x33,0x66,
+0x0c,0x03,0x06,0x33,0xcc,0x8c,0x19,0x33,0x66,0x8c,0x91,0x21,0x43,0x86,0x18,0x31,
+0x62,0xc4,0x08,0x03,0x06,0x66,0xcc,0x8c,0x19,0x33,0x66,0xcc,0x98,0x31,0x36,0xcc,
+0x8c,0x19,0x33,0x66,0x0c,0x03,0x06,0x63,0xcc,0x8c,0x19,0x33,0x66,0x8c,0x19,0x33,
+0x66,0xcc,0x98,0x31,0x63,0xc6,0x0c,0x03,0x06,0x36,0x6c,0x8c,0x19,0x33,0x66,0xcc,
+0x98,0x31,0x63,0xcc,0x8c,0x19,0x33,0x66,0x0c,0x03,0x06,0x6b,0xce,0x8c,0x19,0x33,
+0x66,0xcc,0x1f,0x1e,0x3c,0x78,0xfc,0xf9,0xf3,0xe7,0x8f,0x07,0x0f,0x1f,0x3c,0x8c,
+0x19,0xe3,0xc3,0x87,0x0f,0x1f,0x00,0xce,0xf8,0xf0,0xe1,0xc3,0x87,0x07,0x0f,0x3b,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0xc0,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x18,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x00,0x80,
+0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x0f,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x3e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x60,0x40,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0xc0,0x00,
+0x00,0x00,0x00,0x0c,0x06,0x03,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,
+0x30,0xc0,0x00,0x00,0x00,0x06,0x00,0x18,0x00,0x30,0xe0,0x30,0x63,0x06,0x00,0x18,
+0x00,0x00,0x60,0x00,0x30,0x06,0x00,0x06,0x0f,0x3b,0x70,0xc0,0x00,0x00,0x83,0x83,
+0x99,0x31,0x00,0x00,0x48,0x60,0x60,0x66,0x06,0x03,0x04,0x00,0x30,0x18,0xb0,0xe1,
+0x01,0x80,0x03,0x0c,0x00,0x66,0x30,0x00,0x00,0xc0,0x0c,0x83,0x19,0x36,0x60,0x60,
+0x30,0x83,0xc1,0xc6,0x0c,0x00,0x00,0xcc,0x48,0x30,0x30,0x03,0x80,0x01,0x06,0x00,
+0x18,0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x00,0x3c,0x00,0x00,0x00,0x80,0x07,0x00,
+0x00,0x30,0xf0,0x00,0xe0,0x01,0x00,0x00,0x00,0x00,0x0c,0x78,0x30,0x00,0x00,0x00,
+0x00,0x00,0x06,0x00,0x76,0x78,0xf0,0xe0,0xc1,0x03,0x03,0x1f,0x3e,0x7c,0xf8,0xf0,
+0xe1,0xc3,0x87,0x03,0x07,0x3c,0x60,0xec,0xd8,0xe1,0xc3,0x87,0x0f,0x1f,0x0c,0x76,
+0xcc,0x98,0x31,0x63,0xc6,0x98,0x1f,0x00,0xdc,0xc0,0x80,0x01,0x03,0x06,0x83,0x31,
+0x63,0xc6,0x8c,0x19,0x33,0x66,0x0c,0x03,0x06,0x36,0x7c,0x98,0x31,0x33,0x66,0xcc,
+0x98,0x31,0x00,0xdc,0xcc,0x98,0x31,0x63,0xc6,0x18,0x06,0x00,0xcc,0xf8,0xf0,0xe1,
+0xc3,0x07,0x83,0x01,0x03,0x06,0xfc,0xf9,0xf3,0xe7,0x0f,0x03,0x06,0x33,0x66,0x98,
+0x31,0x33,0x66,0xcc,0x98,0x31,0x3f,0xcc,0xcc,0x98,0x31,0x63,0xc6,0x18,0x06,0x00,
+0x0c,0xcc,0x98,0x31,0x63,0x06,0x83,0x01,0x03,0x06,0x0c,0x18,0x30,0x60,0x00,0x03,
+0x06,0x33,0x66,0x98,0x31,0x33,0x66,0xcc,0x98,0x31,0x00,0x0c,0xcc,0x98,0x31,0x63,
+0xc6,0x18,0x06,0x00,0x0c,0xcc,0x98,0x31,0x63,0x06,0x83,0x01,0x03,0x06,0x0c,0x18,
+0x30,0x60,0x00,0x03,0x06,0x33,0x66,0x98,0x31,0x33,0x66,0xcc,0x98,0x31,0x0c,0x0c,
+0xcc,0x98,0x31,0x63,0xc6,0x18,0x06,0x00,0x0c,0xcc,0x98,0x31,0x63,0x06,0x83,0x31,
+0x63,0xc6,0x8c,0x19,0x33,0x66,0x0c,0x03,0x06,0x33,0x66,0x98,0x31,0x33,0x66,0xcc,
+0x98,0x31,0x0c,0x0c,0xcc,0x98,0x31,0x63,0xc6,0x18,0x36,0x00,0x1e,0xb8,0x71,0xe3,
+0xc6,0x8d,0x07,0x1f,0x3e,0x7c,0xf8,0xf0,0xe1,0xc3,0x87,0x07,0x0f,0x6e,0xdc,0x98,
+0x31,0xe3,0xc3,0x87,0x0f,0x1f,0x00,0x1e,0xb8,0x71,0xe3,0xc6,0x8d,0x1f,0x1c,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x60,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x18,0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0xc0,
+0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x0c,0x1e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x1e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0x07,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+};
diff --git a/libvbi/fontsize.h b/libvbi/fontsize.h
new file mode 100644
index 0000000..12a4027
--- /dev/null
+++ b/libvbi/fontsize.h
@@ -0,0 +1,4 @@
+#define font1_width 288
+#define font1_height 128
+#define font2_width 288
+#define font2_height 128
diff --git a/libvbi/hamm.c b/libvbi/hamm.c
new file mode 100644
index 0000000..b0f89bc
--- /dev/null
+++ b/libvbi/hamm.c
@@ -0,0 +1,237 @@
+#include "vt.h"
+#include "hamm.h"
+
+// table to decode hamm8/4 encoded bytes.
+// the low 4 bits are the (corrected) data bits
+// bit 8 is set if there was a single bit error
+// bit 12 is set if there was an uncorrectable error
+
+// the idea: you may add up to 15 words and get the
+// number of single bit errors in b8-b11 and the number
+// of double errors in b12-b15
+
+static unsigned short hammtab[256] =
+{
+ 0x0101, 0x100f, 0x0001, 0x0101, 0x100f, 0x0100, 0x0101, 0x100f,
+ 0x100f, 0x0102, 0x0101, 0x100f, 0x010a, 0x100f, 0x100f, 0x0107,
+ 0x100f, 0x0100, 0x0101, 0x100f, 0x0100, 0x0000, 0x100f, 0x0100,
+ 0x0106, 0x100f, 0x100f, 0x010b, 0x100f, 0x0100, 0x0103, 0x100f,
+ 0x100f, 0x010c, 0x0101, 0x100f, 0x0104, 0x100f, 0x100f, 0x0107,
+ 0x0106, 0x100f, 0x100f, 0x0107, 0x100f, 0x0107, 0x0107, 0x0007,
+ 0x0106, 0x100f, 0x100f, 0x0105, 0x100f, 0x0100, 0x010d, 0x100f,
+ 0x0006, 0x0106, 0x0106, 0x100f, 0x0106, 0x100f, 0x100f, 0x0107,
+ 0x100f, 0x0102, 0x0101, 0x100f, 0x0104, 0x100f, 0x100f, 0x0109,
+ 0x0102, 0x0002, 0x100f, 0x0102, 0x100f, 0x0102, 0x0103, 0x100f,
+ 0x0108, 0x100f, 0x100f, 0x0105, 0x100f, 0x0100, 0x0103, 0x100f,
+ 0x100f, 0x0102, 0x0103, 0x100f, 0x0103, 0x100f, 0x0003, 0x0103,
+ 0x0104, 0x100f, 0x100f, 0x0105, 0x0004, 0x0104, 0x0104, 0x100f,
+ 0x100f, 0x0102, 0x010f, 0x100f, 0x0104, 0x100f, 0x100f, 0x0107,
+ 0x100f, 0x0105, 0x0105, 0x0005, 0x0104, 0x100f, 0x100f, 0x0105,
+ 0x0106, 0x100f, 0x100f, 0x0105, 0x100f, 0x010e, 0x0103, 0x100f,
+ 0x100f, 0x010c, 0x0101, 0x100f, 0x010a, 0x100f, 0x100f, 0x0109,
+ 0x010a, 0x100f, 0x100f, 0x010b, 0x000a, 0x010a, 0x010a, 0x100f,
+ 0x0108, 0x100f, 0x100f, 0x010b, 0x100f, 0x0100, 0x010d, 0x100f,
+ 0x100f, 0x010b, 0x010b, 0x000b, 0x010a, 0x100f, 0x100f, 0x010b,
+ 0x010c, 0x000c, 0x100f, 0x010c, 0x100f, 0x010c, 0x010d, 0x100f,
+ 0x100f, 0x010c, 0x010f, 0x100f, 0x010a, 0x100f, 0x100f, 0x0107,
+ 0x100f, 0x010c, 0x010d, 0x100f, 0x010d, 0x100f, 0x000d, 0x010d,
+ 0x0106, 0x100f, 0x100f, 0x010b, 0x100f, 0x010e, 0x010d, 0x100f,
+ 0x0108, 0x100f, 0x100f, 0x0109, 0x100f, 0x0109, 0x0109, 0x0009,
+ 0x100f, 0x0102, 0x010f, 0x100f, 0x010a, 0x100f, 0x100f, 0x0109,
+ 0x0008, 0x0108, 0x0108, 0x100f, 0x0108, 0x100f, 0x100f, 0x0109,
+ 0x0108, 0x100f, 0x100f, 0x010b, 0x100f, 0x010e, 0x0103, 0x100f,
+ 0x100f, 0x010c, 0x010f, 0x100f, 0x0104, 0x100f, 0x100f, 0x0109,
+ 0x010f, 0x100f, 0x000f, 0x010f, 0x100f, 0x010e, 0x010f, 0x100f,
+ 0x0108, 0x100f, 0x100f, 0x0105, 0x100f, 0x010e, 0x010d, 0x100f,
+ 0x100f, 0x010e, 0x010f, 0x100f, 0x010e, 0x000e, 0x100f, 0x010e,
+};
+
+
+
+#if 0 // this information is contained in hamm24par bit 5
+// simple parity table (sum of 1 bits modulo 2)
+
+static char odd_parity[256] =
+{
+ 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0,
+ 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1,
+ 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1,
+ 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0,
+ 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1,
+ 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0,
+ 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0,
+ 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1,
+ 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1,
+ 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0,
+ 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0,
+ 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1,
+ 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0,
+ 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1,
+ 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1,
+ 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0
+};
+#endif
+
+
+
+// this table generates the parity checks for hamm24/18 decoding.
+// bit 0 is for test A, 1 for B, ...
+// thanks to R. Gancarz for this fine table *g*
+
+static char hamm24par[3][256] =
+{
+ { // parities of first byte
+ 0, 33, 34, 3, 35, 2, 1, 32, 36, 5, 6, 39, 7, 38, 37, 4,
+ 37, 4, 7, 38, 6, 39, 36, 5, 1, 32, 35, 2, 34, 3, 0, 33,
+ 38, 7, 4, 37, 5, 36, 39, 6, 2, 35, 32, 1, 33, 0, 3, 34,
+ 3, 34, 33, 0, 32, 1, 2, 35, 39, 6, 5, 36, 4, 37, 38, 7,
+ 39, 6, 5, 36, 4, 37, 38, 7, 3, 34, 33, 0, 32, 1, 2, 35,
+ 2, 35, 32, 1, 33, 0, 3, 34, 38, 7, 4, 37, 5, 36, 39, 6,
+ 1, 32, 35, 2, 34, 3, 0, 33, 37, 4, 7, 38, 6, 39, 36, 5,
+ 36, 5, 6, 39, 7, 38, 37, 4, 0, 33, 34, 3, 35, 2, 1, 32,
+ 40, 9, 10, 43, 11, 42, 41, 8, 12, 45, 46, 15, 47, 14, 13, 44,
+ 13, 44, 47, 14, 46, 15, 12, 45, 41, 8, 11, 42, 10, 43, 40, 9,
+ 14, 47, 44, 13, 45, 12, 15, 46, 42, 11, 8, 41, 9, 40, 43, 10,
+ 43, 10, 9, 40, 8, 41, 42, 11, 15, 46, 45, 12, 44, 13, 14, 47,
+ 15, 46, 45, 12, 44, 13, 14, 47, 43, 10, 9, 40, 8, 41, 42, 11,
+ 42, 11, 8, 41, 9, 40, 43, 10, 14, 47, 44, 13, 45, 12, 15, 46,
+ 41, 8, 11, 42, 10, 43, 40, 9, 13, 44, 47, 14, 46, 15, 12, 45,
+ 12, 45, 46, 15, 47, 14, 13, 44, 40, 9, 10, 43, 11, 42, 41, 8
+ }, { // parities of second byte
+ 0, 41, 42, 3, 43, 2, 1, 40, 44, 5, 6, 47, 7, 46, 45, 4,
+ 45, 4, 7, 46, 6, 47, 44, 5, 1, 40, 43, 2, 42, 3, 0, 41,
+ 46, 7, 4, 45, 5, 44, 47, 6, 2, 43, 40, 1, 41, 0, 3, 42,
+ 3, 42, 41, 0, 40, 1, 2, 43, 47, 6, 5, 44, 4, 45, 46, 7,
+ 47, 6, 5, 44, 4, 45, 46, 7, 3, 42, 41, 0, 40, 1, 2, 43,
+ 2, 43, 40, 1, 41, 0, 3, 42, 46, 7, 4, 45, 5, 44, 47, 6,
+ 1, 40, 43, 2, 42, 3, 0, 41, 45, 4, 7, 46, 6, 47, 44, 5,
+ 44, 5, 6, 47, 7, 46, 45, 4, 0, 41, 42, 3, 43, 2, 1, 40,
+ 48, 25, 26, 51, 27, 50, 49, 24, 28, 53, 54, 31, 55, 30, 29, 52,
+ 29, 52, 55, 30, 54, 31, 28, 53, 49, 24, 27, 50, 26, 51, 48, 25,
+ 30, 55, 52, 29, 53, 28, 31, 54, 50, 27, 24, 49, 25, 48, 51, 26,
+ 51, 26, 25, 48, 24, 49, 50, 27, 31, 54, 53, 28, 52, 29, 30, 55,
+ 31, 54, 53, 28, 52, 29, 30, 55, 51, 26, 25, 48, 24, 49, 50, 27,
+ 50, 27, 24, 49, 25, 48, 51, 26, 30, 55, 52, 29, 53, 28, 31, 54,
+ 49, 24, 27, 50, 26, 51, 48, 25, 29, 52, 55, 30, 54, 31, 28, 53,
+ 28, 53, 54, 31, 55, 30, 29, 52, 48, 25, 26, 51, 27, 50, 49, 24
+ }, { // parities of third byte
+ 63, 14, 13, 60, 12, 61, 62, 15, 11, 58, 57, 8, 56, 9, 10, 59,
+ 10, 59, 56, 9, 57, 8, 11, 58, 62, 15, 12, 61, 13, 60, 63, 14,
+ 9, 56, 59, 10, 58, 11, 8, 57, 61, 12, 15, 62, 14, 63, 60, 13,
+ 60, 13, 14, 63, 15, 62, 61, 12, 8, 57, 58, 11, 59, 10, 9, 56,
+ 8, 57, 58, 11, 59, 10, 9, 56, 60, 13, 14, 63, 15, 62, 61, 12,
+ 61, 12, 15, 62, 14, 63, 60, 13, 9, 56, 59, 10, 58, 11, 8, 57,
+ 62, 15, 12, 61, 13, 60, 63, 14, 10, 59, 56, 9, 57, 8, 11, 58,
+ 11, 58, 57, 8, 56, 9, 10, 59, 63, 14, 13, 60, 12, 61, 62, 15,
+ 31, 46, 45, 28, 44, 29, 30, 47, 43, 26, 25, 40, 24, 41, 42, 27,
+ 42, 27, 24, 41, 25, 40, 43, 26, 30, 47, 44, 29, 45, 28, 31, 46,
+ 41, 24, 27, 42, 26, 43, 40, 25, 29, 44, 47, 30, 46, 31, 28, 45,
+ 28, 45, 46, 31, 47, 30, 29, 44, 40, 25, 26, 43, 27, 42, 41, 24,
+ 40, 25, 26, 43, 27, 42, 41, 24, 28, 45, 46, 31, 47, 30, 29, 44,
+ 29, 44, 47, 30, 46, 31, 28, 45, 41, 24, 27, 42, 26, 43, 40, 25,
+ 30, 47, 44, 29, 45, 28, 31, 46, 42, 27, 24, 41, 25, 40, 43, 26,
+ 43, 26, 25, 40, 24, 41, 42, 27, 31, 46, 45, 28, 44, 29, 30, 47
+ }
+};
+
+
+
+// table to extract the lower 4 bit from hamm24/18 encoded bytes
+
+static char hamm24val[256] =
+{
+ 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1,
+ 2, 2, 2, 2, 3, 3, 3, 3, 2, 2, 2, 2, 3, 3, 3, 3,
+ 4, 4, 4, 4, 5, 5, 5, 5, 4, 4, 4, 4, 5, 5, 5, 5,
+ 6, 6, 6, 6, 7, 7, 7, 7, 6, 6, 6, 6, 7, 7, 7, 7,
+ 8, 8, 8, 8, 9, 9, 9, 9, 8, 8, 8, 8, 9, 9, 9, 9,
+ 10, 10, 10, 10, 11, 11, 11, 11, 10, 10, 10, 10, 11, 11, 11, 11,
+ 12, 12, 12, 12, 13, 13, 13, 13, 12, 12, 12, 12, 13, 13, 13, 13,
+ 14, 14, 14, 14, 15, 15, 15, 15, 14, 14, 14, 14, 15, 15, 15, 15,
+ 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1,
+ 2, 2, 2, 2, 3, 3, 3, 3, 2, 2, 2, 2, 3, 3, 3, 3,
+ 4, 4, 4, 4, 5, 5, 5, 5, 4, 4, 4, 4, 5, 5, 5, 5,
+ 6, 6, 6, 6, 7, 7, 7, 7, 6, 6, 6, 6, 7, 7, 7, 7,
+ 8, 8, 8, 8, 9, 9, 9, 9, 8, 8, 8, 8, 9, 9, 9, 9,
+ 10, 10, 10, 10, 11, 11, 11, 11, 10, 10, 10, 10, 11, 11, 11, 11,
+ 12, 12, 12, 12, 13, 13, 13, 13, 12, 12, 12, 12, 13, 13, 13, 13,
+ 14, 14, 14, 14, 15, 15, 15, 15, 14, 14, 14, 14, 15, 15, 15, 15
+};
+
+
+
+// mapping from parity checks made by table hamm24par to error
+// results return by hamm24.
+// (0 = no error, 0x0100 = single bit error, 0x1000 = double error)
+
+static short hamm24err[64] =
+{
+ 0x0000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
+ 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
+ 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
+ 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
+ 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
+ 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
+ 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100, 0x0100,
+ 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000,
+};
+
+
+
+// mapping from parity checks made by table hamm24par to faulty bit
+// in the decoded 18 bit word.
+
+static int hamm24cor[64] =
+{
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+ 0x00000, 0x00000, 0x00000, 0x00001, 0x00000, 0x00002, 0x00004, 0x00008,
+ 0x00000, 0x00010, 0x00020, 0x00040, 0x00080, 0x00100, 0x00200, 0x00400,
+ 0x00000, 0x00800, 0x01000, 0x02000, 0x04000, 0x08000, 0x10000, 0x20000,
+ 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000, 0x00000,
+};
+
+
+
+int
+hamm8(u8 *p, int *err)
+{
+ int a = hammtab[p[0]];
+ *err += a;
+ return a & 15;
+}
+
+int
+hamm16(u8 *p, int *err)
+{
+ int a = hammtab[p[0]];
+ int b = hammtab[p[1]];
+ *err += a;
+ *err += b;
+ return (a & 15) | (b & 15) * 16;
+}
+
+int
+hamm24(u8 *p, int *err)
+{
+ int e = hamm24par[0][p[0]] ^ hamm24par[1][p[1]] ^ hamm24par[2][p[2]];
+ int x = hamm24val[p[0]] + p[1] % 128 * 16 + p[2] % 128 * 2048;
+
+ *err += hamm24err[e];
+ return x ^ hamm24cor[e];
+}
+
+int
+chk_parity(u8 *p, int n)
+{
+ int err;
+
+ for (err = 0; n--; p++)
+ if (hamm24par[0][*p] & 32)
+ *p &= 0x7f;
+ else
+ *p = BAD_CHAR, err++;
+ return err;
+}
diff --git a/libvbi/hamm.h b/libvbi/hamm.h
new file mode 100644
index 0000000..d6c8918
--- /dev/null
+++ b/libvbi/hamm.h
@@ -0,0 +1,9 @@
+#ifndef HAMM_H
+#define HAMM_H
+
+int hamm8(u8 *p, int *err);
+int hamm16(u8 *p, int *err);
+int hamm24(u8 *p, int *err);
+int chk_parity(u8 *p, int n);
+
+#endif
diff --git a/libvbi/lang.c b/libvbi/lang.c
new file mode 100644
index 0000000..b0587fe
--- /dev/null
+++ b/libvbi/lang.c
@@ -0,0 +1,250 @@
+#include <string.h>
+#include "misc.h"
+#include "vt.h"
+#include "lang.h"
+
+int latin1 = -1;
+
+static u8 lang_char[256];
+
+static u8 lang_chars[1+8+8][16] =
+{
+ { 0, 0x23,0x24,0x40,0x5b,0x5c,0x5d,0x5e,0x5f,0x60,0x7b,0x7c,0x7d,0x7e },
+
+ // for latin-1 font
+ // English (100%)
+ { 0, '', '$', '@', '', '', '', '', '#', '', '', '', '', '' },
+ // German (100%)
+ { 0, '#', '$', '', '', '', '', '^', '_', '', '', '', '', '' },
+ // Swedish/Finnish/Hungarian (100%)
+ { 0, '#', '', '', '', '', '', '', '_', '', '', '', '', '' },
+ // Italian (100%)
+ { 0, '', '$', '', '', '', '', '', '#', '', '', '', '', '' },
+ // French (100%)
+ { 0, '', '', '', '', '', '', '', '#', '', '', '', '', '' },
+ // Portuguese/Spanish (100%)
+ { 0, '', '$', '', '', '', '', '', '', '', '', '', '', '' },
+ // Czech/Slovak (60%)
+ { 0, '#', 'u', 'c', 't', 'z', '', '', 'r', '', '', 'e', '', 's' },
+ // reserved (English mapping)
+ { 0, '', '$', '@', '', '', '', '', '#', '', '', '', '', '' },
+
+ // for latin-2 font
+ // Polish (100%)
+ { 0, '#', '', '', '', '', '', '', '', '', '', '', '', '' },
+ // German (100%)
+ { 0, '#', '$', '', '', '', '', '^', '_', '', '', '', '', '' },
+ // Estonian (100%)
+ { 0, '#', '', '', '', '', '', '', '', '', '', '', '', '' },
+ // Lettish/Lithuanian (90%)
+ { 0, '#', '$', '', '', '', '', '', '', '', '', 'u', '', 'i' },
+ // French (90%)
+ { 0, '', 'i', 'a', '', '', 'u', '', '#', 'e', '', '', 'u', '' },
+ // Serbian/Croation/Slovenian (100%)
+ { 0, '#', '', '', '', '', '', '', '', '', '', '', '', '' },
+ // Czech/Slovak (100%)
+ { 0, '#', '', '', '', '', '', '', '', '', '', '', '', '' },
+ // Rumanian (95%)
+ { 0, '#', '', '', '', '', '', '', 'i', '', '', '', '', '' },
+};
+
+/* Yankable latin charset :-)
+ !"#$%&'()*+,-./0123456789:;<=>?
+ @ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_
+ `abcdefghijklmnopqrstuvwxyz{|}~
+
+
+
+*/
+
+
+
+static struct mark { u8 *g0, *latin1, *latin2; } marks[16] =
+{
+ /* none */ { "#",
+ "",
+ "$" },
+ /* grave - ` */ { " aeiouAEIOU",
+ "`",
+ "`aeiouAEIOU" },
+ /* acute - ' */ { " aceilnorsuyzACEILNORSUYZ",
+ "'clnrszCLNRSZ",
+ "'ݬ" },
+ /* cirumflex - ^ */ { " aeiouAEIOU",
+ "^",
+ "^euEU" },
+ /* tilde - ~ */ { " anoANO",
+ "~",
+ "~anoANO" },
+ /* ??? - */ { "",
+ "",
+ "" },
+ /* breve - u */ { "aA",
+ "aA",
+ "" },
+ /* abovedot - */ { "zZ",
+ "zZ",
+ "" },
+ /* diaeresis */ { "aeiouAEIOU",
+ "",
+ "iI" },
+ /* ??? - . */ { "",
+ "",
+ "" },
+ /* ringabove - */ { " auAU",
+ "uU",
+ "aA" },
+ /* cedilla - */ { "cstCST",
+ "stST",
+ "Ǫ" },
+ /* ??? - _ */ { " ",
+ "_",
+ "_" },
+ /* dbl acute - " */ { " ouOU",
+ "\"ouOU",
+ "\"" },
+ /* ogonek - \, */ { "aeAE",
+ "aeAE",
+ "" },
+ /* caron - v */ { "cdelnrstzCDELNRSTZ",
+ "cdelnrstzCDELNRSTZ",
+ "̥ة" },
+};
+
+static u8 g2map_latin1[] =
+ /*0123456789abcdef*/
+ " $#'\" "
+ "׵'\""
+ " `^~ ._\" "
+ "_ "
+ " ЪH ILL TNn"
+ "Kdhiill tn\x7f";
+
+static u8 g2map_latin2[] =
+ /*0123456789abcdef*/
+ " icL$Y#'\"< "
+ " u '\"> "
+ " `^~ ._"
+ "- RC "
+ " aH iLO opTNn"
+ "K dhiilo ptn\x7f";
+
+
+
+void
+lang_init(void)
+{
+ int i;
+
+ memset(lang_char, 0, sizeof(lang_char));
+ for (i = 1; i <= 13; i++)
+ lang_char[lang_chars[0][i]] = i;
+}
+
+
+void
+conv2latin(u8 *p, int n, int lang)
+{
+ int c, gfx = 0;
+
+ while (n--)
+ {
+ if (lang_char[c = *p])
+ {
+ if (not gfx || (c & 0xa0) != 0x20)
+ *p = lang_chars[lang + 1][lang_char[c]];
+ }
+ else if ((c & 0xe8) == 0)
+ gfx = c & 0x10;
+ p++;
+ }
+}
+
+
+
+void
+init_enhance(struct enhance *eh)
+{
+ eh->next_des = 0;
+}
+
+void
+add_enhance(struct enhance *eh, int dcode, u32 *t)
+{
+ if (dcode == eh->next_des)
+ {
+ memcpy(eh->trip + dcode * 13, t, 13 * sizeof(*t));
+ eh->next_des++;
+ }
+ else
+ eh->next_des = -1;
+}
+
+void
+enhance(struct enhance *eh, struct vt_page *vtp)
+{
+ int row = 0;
+ u32 *p, *e;
+
+ if (eh->next_des < 1)
+ return;
+
+ for (p = eh->trip, e = p + eh->next_des * 13; p < e; p++)
+ if (*p % 2048 != 2047)
+ {
+ int adr = *p % 64;
+ int mode = *p / 64 % 32;
+ int data = *p / 2048 % 128;
+
+ //printf("%2x,%d,%d ", mode, adr, data);
+ if (adr < 40)
+ {
+ // col functions
+ switch (mode)
+ {
+ case 15: // char from G2 set
+ if (adr < W && row < H)
+ if (latin1)
+ vtp->data[row][adr] = g2map_latin1[data-32];
+ else
+ vtp->data[row][adr] = g2map_latin2[data-32];
+ break;
+ case 16 ... 31: // char from G0 set with diacritical mark
+ if (adr < W && row < H)
+ {
+ struct mark *mark = marks + (mode - 16);
+ u8 *x;
+
+ if (x = strchr(mark->g0, data))
+ if (latin1)
+ data = mark->latin1[x - mark->g0];
+ else
+ data = mark->latin2[x - mark->g0];
+ vtp->data[row][adr] = data;
+ }
+ break;
+ }
+ }
+ else
+ {
+ // row functions
+ if ((adr -= 40) == 0)
+ adr = 24;
+
+ switch (mode)
+ {
+ case 1: // full row color
+ row = adr;
+ break;
+ case 4: // set active position
+ row = adr;
+ break;
+ case 7: // address row 0 (+ full row color)
+ if (adr == 23)
+ row = 0;
+ break;
+ }
+ }
+ }
+ //printf("\n");
+}
diff --git a/libvbi/lang.h b/libvbi/lang.h
new file mode 100644
index 0000000..7377d28
--- /dev/null
+++ b/libvbi/lang.h
@@ -0,0 +1,22 @@
+#ifndef LANG_H
+#define LANG_H
+
+#include "misc.h"
+#include "vt.h"
+
+extern int latin1;
+
+struct enhance
+{
+ int next_des; // next expected designation code
+ u32 trip[13*16]; // tripplets
+};
+
+void lang_init(void);
+void conv2latin(u8 *p, int n, int lang);
+
+void init_enhance(struct enhance *eh);
+void add_enhance(struct enhance *eh, int dcode, u32 *data);
+void enhance(struct enhance *eh, struct vt_page *vtp);
+
+#endif LANG_H
diff --git a/libvbi/misc.c b/libvbi/misc.c
new file mode 100644
index 0000000..a47e8b0
--- /dev/null
+++ b/libvbi/misc.c
@@ -0,0 +1,72 @@
+#include <stdio.h>
+#include <stdarg.h>
+#include "misc.h"
+
+char *prgname = 0;
+
+extern char *strrchr(const char *, int);
+NORETURN(exit(int));
+
+void
+setprgname(char *str)
+{
+ char *x = strrchr(str, '/');
+
+ prgname = x ? x+1 : str;
+}
+
+static void
+print_prgname(void)
+{
+ if (prgname && *prgname)
+ fprintf(stderr, "%s: ", prgname);
+}
+
+void
+error(const char *str, ...)
+{
+ va_list args;
+
+ va_start(args, str);
+ print_prgname();
+ vfprintf(stderr, str, args);
+ fputc('\n', stderr);
+}
+
+void
+ioerror(const char *str)
+{
+ print_prgname();
+ perror(str);
+// fputc('\n', stderr);
+}
+
+void
+fatal(const char *str, ...)
+{
+ va_list args;
+
+ va_start(args, str);
+ print_prgname();
+ vfprintf(stderr, str, args);
+ fputc('\n', stderr);
+ exit(2);
+}
+
+void
+fatal_ioerror(const char *str)
+{
+ print_prgname();
+ perror(str);
+// fputc('\n', stderr);
+ exit(2);
+}
+
+
+void
+out_of_mem(int size)
+{
+ if (size > 0)
+ fatal("out of memory allocating %d bytes.", size);
+ fatal("out of memory.");
+}
diff --git a/libvbi/misc.h b/libvbi/misc.h
new file mode 100644
index 0000000..e9183a6
--- /dev/null
+++ b/libvbi/misc.h
@@ -0,0 +1,46 @@
+#ifndef MISC_H
+#define MISC_H
+
+//////////////////////////
+// generic macros/typedefs
+//////////////////////////
+
+#define $ (void *)
+#define NELEM(x) ((int)(sizeof(x)/sizeof(*(x))))
+#define NORETURN(x) void x __attribute__((__noreturn__))
+#define DEFINE(x) typeof(x) x
+#define OFFSET_OF(type, elem) ((u8 *)&((type *)0)->elem - (u8 *)0)
+#define BASE_OF(type, elem, p) ((type *)((u8 *)(p) - OFFSET_OF(type, elem)))
+
+#define not !
+#define elif else if
+#define Case break; case
+#define Default break; default
+#define streq(a, b) (strcmp((a), (b)) == 0)
+#define min(a,b) ({ typeof(a) _a = a; typeof(b) _b = b; _a < _b ? _a : _b; })
+#define max(a,b) ({ typeof(a) _a = a; typeof(b) _b = b; _a > _b ? _a : _b; })
+#define bound(a,b,c) ({ typeof(a) _a = a; typeof(b) _b = b; typeof(c) _c = c; \
+ _b < _a ? _a : _b > _c ? _c : _b; })
+
+typedef unsigned char u8;
+typedef unsigned short u16;
+typedef unsigned int u32;
+
+typedef signed char s8;
+typedef signed short s16;
+typedef signed int s32;
+
+////////////////////////
+// prototypes for misc.c
+////////////////////////
+
+extern char *prgname;
+void setprgname(char *argv_0);
+
+NORETURN(fatal(const char *str, ...));
+NORETURN(fatal_ioerror(const char *str));
+NORETURN(out_of_mem(int size));
+void error(const char *str, ...);
+void ioerror(const char *str);
+
+#endif
diff --git a/libvbi/os.h b/libvbi/os.h
new file mode 100644
index 0000000..e2fbc32
--- /dev/null
+++ b/libvbi/os.h
@@ -0,0 +1,15 @@
+#ifndef OS_H
+#define OS_H
+
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBsd__) \
+ || defined(__bsdi__)
+#define BSD
+#define DEFAULT_SMALL_BUF
+#endif
+
+#if defined(__linux__)
+/* people with the 2.2 kernel's bttv driver may want to define this... */
+//#define DEFAULT_SMALL_BUF
+#endif
+
+#endif /* OS_H */
diff --git a/libvbi/vbi.c b/libvbi/vbi.c
new file mode 100644
index 0000000..b006ad0
--- /dev/null
+++ b/libvbi/vbi.c
@@ -0,0 +1,531 @@
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <sys/ioctl.h>
+#include "os.h"
+#include "vt.h"
+#include "misc.h"
+#include "vbi.h"
+#include "fdset.h"
+#include "hamm.h"
+#include "lang.h"
+
+
+#define BPL 2048
+#define FAC (1<<16)
+#define STEP 335062 // (int)(35.468950/6.9375*FAC+.5) // PAL!
+
+#define BASE_VIDIOCPRIVATE 192
+#define BTTV_VERSION _IOR('v' , BASE_VIDIOCPRIVATE+6, int)
+#define BTTV_VBISIZE _IOR('v' , BASE_VIDIOCPRIVATE+8, int)
+
+
+static u8 rawbuf[BPL*19*2]; // one global buffer for raw vbi data
+ // (putting this on the stack may trash the mm-system)
+
+int vbi_big_buf = -1;
+int vbi_fine_tune = 0; // delay decoding n/10 bit length
+
+
+
+static void
+out_of_sync(struct vbi *vbi)
+{
+ int i;
+
+ // discard all in progress pages
+ for (i = 0; i < 8; ++i)
+ vbi->rpage[i].page->flags &= ~PG_ACTIVE;
+}
+
+
+// send an event to all clients
+
+static void
+vbi_send(struct vbi *vbi, int type, int i1, int i2, int i3, void *p1)
+{
+ struct vt_event ev[1];
+ struct vbi_client *cl, *cln;
+
+ ev->resource = vbi;
+ ev->type = type;
+ ev->i1 = i1;
+ ev->i2 = i2;
+ ev->i3 = i3;
+ ev->p1 = p1;
+
+ for (cl = $ vbi->clients->first; cln = $ cl->node->next; cl = cln)
+ cl->handler(cl->data, ev);
+}
+
+static void
+vbi_send_page(struct vbi *vbi, struct raw_page *rvtp, int page)
+{
+ struct vt_page *cvtp = 0;
+
+ if (rvtp->page->flags & PG_ACTIVE)
+ {
+ if (rvtp->page->pgno % 256 != page)
+ {
+ rvtp->page->flags &= ~PG_ACTIVE;
+ enhance(rvtp->enh, rvtp->page);
+ if (vbi->cache)
+ cvtp = vbi->cache->op->put(vbi->cache, rvtp->page);
+ vbi_send(vbi, EV_PAGE, 0, 0, 0, cvtp ?: rvtp->page);
+ }
+ }
+}
+
+// fine tune pll
+// this routines tries to adjust the sampling point of the decoder.
+// it collects parity and hamming errors and moves the sampling point
+// a 10th of a bitlength left or right.
+
+#define PLL_SAMPLES 4 // number of err vals to collect
+#define PLL_ERROR 4 // if this err val is crossed, readjust
+//#define PLL_ADJUST 4 // max/min adjust (10th of bitlength)
+
+static void
+pll_add(struct vbi *vbi, int n, int err)
+{
+ if (vbi->pll_fixed)
+ return;
+
+ if (err > PLL_ERROR*2/3) // limit burst errors
+ err = PLL_ERROR*2/3;
+
+ vbi->pll_err += err;
+ vbi->pll_cnt += n;
+ if (vbi->pll_cnt < PLL_SAMPLES)
+ return;
+
+ if (vbi->pll_err > PLL_ERROR)
+ {
+ if (vbi->pll_err > vbi->pll_lerr)
+ vbi->pll_dir = -vbi->pll_dir;
+ vbi->pll_lerr = vbi->pll_err;
+
+ vbi->pll_adj += vbi->pll_dir;
+ if (vbi->pll_adj < -PLL_ADJUST || vbi->pll_adj > PLL_ADJUST)
+ {
+ vbi->pll_adj = 0;
+ vbi->pll_dir = -1;
+ vbi->pll_lerr = 0;
+ }
+
+ if (debug)
+ printf("pll_adj = %2d\n", vbi->pll_adj);
+ }
+ vbi->pll_cnt = 0;
+ vbi->pll_err = 0;
+}
+
+void
+vbi_pll_reset(struct vbi *vbi, int fine_tune)
+{
+ vbi->pll_fixed = fine_tune >= -PLL_ADJUST && fine_tune <= PLL_ADJUST;
+
+ vbi->pll_err = 0;
+ vbi->pll_lerr = 0;
+ vbi->pll_cnt = 0;
+ vbi->pll_dir = -1;
+ vbi->pll_adj = 0;
+ if (vbi->pll_fixed)
+ vbi->pll_adj = fine_tune;
+ if (debug)
+ if (vbi->pll_fixed)
+ printf("pll_reset (fixed@%d)\n", vbi->pll_adj);
+ else
+ printf("pll_reset (auto)\n");
+}
+
+// process one videotext packet
+
+static int
+vt_line(struct vbi *vbi, u8 *p)
+{
+ struct vt_page *cvtp;
+ struct raw_page *rvtp;
+ int hdr, mag, mag8, pkt, i;
+ int err = 0;
+
+ hdr = hamm16(p, &err);
+ if (err & 0xf000)
+ return -4;
+
+ mag = hdr & 7;
+ mag8 = mag?: 8;
+ pkt = (hdr >> 3) & 0x1f;
+ p += 2;
+
+ rvtp = vbi->rpage + mag;
+ cvtp = rvtp->page;
+
+ switch (pkt)
+ {
+ case 0:
+ {
+ int b1, b2, b3, b4;
+
+ b1 = hamm16(p, &err); // page number
+ b2 = hamm16(p+2, &err); // subpage number + flags
+ b3 = hamm16(p+4, &err); // subpage number + flags
+ b4 = hamm16(p+6, &err); // language code + more flags
+
+ if (vbi->ppage->page->flags & PG_MAGSERIAL)
+ vbi_send_page(vbi, vbi->ppage, b1);
+ vbi_send_page(vbi, rvtp, b1);
+
+ if (err & 0xf000)
+ return 4;
+
+ cvtp->errors = (err >> 8) + chk_parity(p + 8, 32);;
+ cvtp->pgno = mag8 * 256 + b1;
+ cvtp->subno = (b2 + b3 * 256) & 0x3f7f;
+ cvtp->lang = "\0\4\2\6\1\5\3\7"[b4 >> 5] + (latin1 ? 0 : 8);
+ cvtp->flags = b4 & 0x1f;
+ cvtp->flags |= b3 & 0xc0;
+ cvtp->flags |= (b2 & 0x80) >> 2;
+ cvtp->lines = 1;
+ cvtp->flof = 0;
+ vbi->ppage = rvtp;
+
+ pll_add(vbi, 1, cvtp->errors);
+
+ conv2latin(p + 8, 32, cvtp->lang);
+ vbi_send(vbi, EV_HEADER, cvtp->pgno, cvtp->subno, cvtp->flags, p);
+
+ if (b1 == 0xff)
+ return 0;
+
+ cvtp->flags |= PG_ACTIVE;
+ init_enhance(rvtp->enh);
+ memcpy(cvtp->data[0]+0, p, 40);
+ memset(cvtp->data[0]+40, ' ', sizeof(cvtp->data)-40);
+ return 0;
+ }
+
+ case 1 ... 24:
+ {
+ pll_add(vbi, 1, err = chk_parity(p, 40));
+
+ if (~cvtp->flags & PG_ACTIVE)
+ return 0;
+
+ cvtp->errors += err;
+ cvtp->lines |= 1 << pkt;
+ conv2latin(p, 40, cvtp->lang);
+ memcpy(cvtp->data[pkt], p, 40);
+ return 0;
+ }
+ case 26:
+ {
+ int d, t[13];
+
+ if (~cvtp->flags & PG_ACTIVE)
+ return 0;
+
+ d = hamm8(p, &err);
+ if (err & 0xf000)
+ return 4;
+
+ for (i = 0; i < 13; ++i)
+ t[i] = hamm24(p + 1 + 3*i, &err);
+ if (err & 0xf000)
+ return 4;
+
+ //printf("enhance on %x/%x\n", cvtp->pgno, cvtp->subno);
+ add_enhance(rvtp->enh, d, t);
+ return 0;
+ }
+ case 27:
+ {
+ // FLOF data (FastText)
+ int b1,b2,b3,x;
+
+ if (~cvtp->flags & PG_ACTIVE)
+ return 0; // -1 flushes all pages. we may never resync again :(
+
+ b1 = hamm8(p, &err);
+ b2 = hamm8(p + 37, &err);
+ if (err & 0xf000)
+ return 4;
+ if (b1 != 0 || not(b2 & 8))
+ return 0;
+
+ for (i = 0; i < 6; ++i)
+ {
+ err = 0;
+ b1 = hamm16(p+1+6*i, &err);
+ b2 = hamm16(p+3+6*i, &err);
+ b3 = hamm16(p+5+6*i, &err);
+ if (err & 0xf000)
+ return 1;
+ x = (b2 >> 7) | ((b3 >> 5) & 0x06);
+ cvtp->link[i].pgno = ((mag ^ x) ?: 8) * 256 + b1;
+ cvtp->link[i].subno = (b2 + b3 * 256) & 0x3f7f;
+ }
+ cvtp->flof = 1;
+ return 0;
+ }
+ case 30:
+ {
+ if (mag8 != 8)
+ return 0;
+
+ p[0] = hamm8(p, &err); // designation code
+ p[1] = hamm16(p+1, &err); // initial page
+ p[3] = hamm16(p+3, &err); // initial subpage + mag
+ p[5] = hamm16(p+5, &err); // initial subpage + mag
+ if (err & 0xf000)
+ return 4;
+
+ err += chk_parity(p+20, 20);
+ conv2latin(p+20, 20, 0);
+
+ vbi_send(vbi, EV_XPACKET, mag8, pkt, err, p);
+ return 0;
+ }
+ default:
+ // unused at the moment...
+ //vbi_send(vbi, EV_XPACKET, mag8, pkt, err, p);
+ return 0;
+ }
+ return 0;
+}
+
+
+
+// process one raw vbi line
+
+static int
+vbi_line(struct vbi *vbi, u8 *p)
+{
+ u8 data[43], min, max;
+ int dt[256], hi[6], lo[6];
+ int i, n, sync, thr;
+
+ /* remove DC. edge-detector */
+ for (i = 40; i < 240; ++i)
+ dt[i] = p[i+STEP/FAC] - p[i]; // amplifies the edges best.
+
+ /* set barrier */
+ for (i = 240; i < 256; i += 2)
+ dt[i] = 100, dt[i+1] = -100;
+
+ /* find 6 rising and falling edges */
+ for (i = 40, n = 0; n < 6; ++n)
+ {
+ while (dt[i] < 32)
+ i++;
+ hi[n] = i;
+ while (dt[i] > -32)
+ i++;
+ lo[n] = i;
+ }
+ if (i >= 240)
+ return -1; // not enough periods found
+
+ i = hi[5] - hi[1]; // length of 4 periods (8 bits), normally 40.9
+ if (i < 39 || i > 42)
+ return -1; // bad frequency
+
+ /* AGC and sync-reference */
+ min = 255, max = 0, sync = 0;
+ for (i = hi[4]; i < hi[5]; ++i)
+ if (p[i] > max)
+ max = p[i], sync = i;
+ for (i = lo[4]; i < lo[5]; ++i)
+ if (p[i] < min)
+ min = p[i];
+ thr = (min + max) / 2;
+
+ p += sync;
+
+ /* search start-byte 11100100 */
+ for (i = 4*STEP + vbi->pll_adj*STEP/10; i < 16*STEP; i += STEP)
+ if (p[i/FAC] > thr && p[(i+STEP)/FAC] > thr) // two ones is enough...
+ {
+ /* got it... */
+ memset(data, 0, sizeof(data));
+
+ for (n = 0; n < 43*8; ++n, i += STEP)
+ if (p[i/FAC] > thr)
+ data[n/8] |= 1 << (n%8);
+
+ if (data[0] != 0x27) // really 11100100? (rev order!)
+ return -1;
+
+ if (i = vt_line(vbi, data+1))
+ if (i < 0)
+ pll_add(vbi, 2, -i);
+ else
+ pll_add(vbi, 1, i);
+ return 0;
+ }
+ return -1;
+}
+
+
+
+// called when new vbi data is waiting
+
+void
+vbi_handler(struct vbi *vbi, int fd)
+{
+ int n, i;
+ u32 seq;
+
+ n = read(vbi->fd, rawbuf, vbi->bufsize);
+
+ if (dl_empty(vbi->clients))
+ return;
+
+ if (n != vbi->bufsize)
+ return;
+
+ seq = *(u32 *)&rawbuf[n - 4];
+ if (vbi->seq+1 != seq)
+ {
+ out_of_sync(vbi);
+ if (seq < 3 && vbi->seq >= 3)
+ vbi_reset(vbi);
+ }
+ vbi->seq = seq;
+
+ if (seq > 1) // the first may contain data from prev channel
+ for (i = 0; i+BPL <= n; i += BPL)
+ vbi_line(vbi, rawbuf + i);
+}
+
+
+
+int
+vbi_add_handler(struct vbi *vbi, void *handler, void *data)
+{
+ struct vbi_client *cl;
+
+ if (not(cl = malloc(sizeof(*cl))))
+ return -1;
+ cl->handler = handler;
+ cl->data = data;
+ dl_insert_last(vbi->clients, cl->node);
+ return 0;
+}
+
+
+
+void
+vbi_del_handler(struct vbi *vbi, void *handler, void *data)
+{
+ struct vbi_client *cl;
+
+ for (cl = $ vbi->clients->first; cl->node->next; cl = $ cl->node->next)
+ if (cl->handler == handler && cl->data == data)
+ {
+ dl_remove(cl->node);
+ break;
+ }
+ return;
+}
+
+
+
+struct vbi *
+vbi_open(char *vbi_name, struct cache *ca, int fine_tune, int big_buf)
+{
+ static int inited = 0;
+ struct vbi *vbi;
+
+ if (not inited)
+ lang_init();
+ inited = 1;
+
+ if (not(vbi = malloc(sizeof(*vbi))))
+ {
+ error("out of memory");
+ goto fail1;
+ }
+
+ if ((vbi->fd = open(vbi_name, O_RDONLY)) == -1)
+ {
+ ioerror(vbi_name);
+ goto fail2;
+ }
+
+ if ((vbi->bufsize = ioctl(vbi->fd, BTTV_VBISIZE)) == -1)
+ {
+ // big_buf == -1 default, 0 small, 1 large buffer
+#ifdef DEFAULT_SMALL_BUF
+ vbi->bufsize = big_buf==1 ? 19*2*2048 : 16*2*2048; // small is def
+#else
+ vbi->bufsize = big_buf!=0 ? 19*2*2048 : 16*2*2048; // large is def
+#endif
+ }
+ else if (vbi->bufsize < BPL || vbi->bufsize > (int)sizeof(rawbuf)
+ || vbi->bufsize % BPL != 0)
+ {
+ error("illegal size of bttv driver's buffer (%d bytes)", vbi->bufsize);
+ goto fail3;
+ }
+ else if (big_buf != -1)
+ error("-oldbttv/-newbttv option ignored.");
+
+ vbi->cache = ca;
+
+ dl_init(vbi->clients);
+ vbi->seq = 0;
+ out_of_sync(vbi);
+ vbi->ppage = vbi->rpage;
+
+ vbi_pll_reset(vbi, fine_tune);
+ fdset_add_fd(fds, vbi->fd, vbi_handler, vbi);
+ return vbi;
+
+fail3:
+ close(vbi->fd);
+fail2:
+ free(vbi);
+fail1:
+ return 0;
+}
+
+
+
+void
+vbi_close(struct vbi *vbi)
+{
+ fdset_del_fd(fds, vbi->fd);
+ if (vbi->cache)
+ vbi->cache->op->close(vbi->cache);
+ close(vbi->fd);
+ free(vbi);
+}
+
+
+struct vt_page *
+vbi_query_page(struct vbi *vbi, int pgno, int subno)
+{
+ struct vt_page *vtp = 0;
+
+ if (vbi->cache)
+ vtp = vbi->cache->op->get(vbi->cache, pgno, subno);
+ if (vtp == 0)
+ {
+ // EV_PAGE will come later...
+ return 0;
+ }
+
+ vbi_send(vbi, EV_PAGE, 1, 0, 0, vtp);
+ return vtp;
+}
+
+void
+vbi_reset(struct vbi *vbi)
+{
+ if (vbi->cache)
+ vbi->cache->op->reset(vbi->cache);
+ vbi_send(vbi, EV_RESET, 0, 0, 0, 0);
+}
diff --git a/libvbi/vbi.h b/libvbi/vbi.h
new file mode 100644
index 0000000..87c0590
--- /dev/null
+++ b/libvbi/vbi.h
@@ -0,0 +1,53 @@
+#ifndef VBI_H
+#define VBI_H
+
+#include "vt.h"
+#include "dllist.h"
+#include "cache.h"
+#include "lang.h"
+
+#define PLL_ADJUST 4
+
+struct raw_page
+{
+ struct vt_page page[1];
+ struct enhance enh[1];
+};
+
+struct vbi
+{
+ int fd;
+ struct cache *cache;
+ struct dl_head clients[1];
+ int bufsize; // 32*2k or 38*2k (depending on bttv version)
+ u32 seq;
+ struct raw_page rpage[8]; // one for each magazin
+ struct raw_page *ppage; // points to page of previous pkt0
+ /*
+ struct vt_page page[8]; // one for each magazin
+ struct vt_page *ppage; // points to page of previous pkt0
+ */
+ int pll_fixed; // 0 = auto, 1..2*PLL_ADJUST+1 = fixed
+ int pll_adj;
+ int pll_dir;
+ int pll_cnt;
+ int pll_err, pll_lerr;
+};
+
+struct vbi_client
+{
+ struct dl_node node[1];
+ void (*handler)(void *data, struct vt_event *ev);
+ void *data;
+};
+
+struct vbi *vbi_open(char *vbi_dev_name, struct cache *ca, int fine_tune,
+ int big_buf);
+void vbi_close(struct vbi *vbi);
+void vbi_reset(struct vbi *vbi);
+int vbi_add_handler(struct vbi *vbi, void *handler, void *data);
+void vbi_del_handler(struct vbi *vbi, void *handler, void *data);
+struct vt_page *vbi_query_page(struct vbi *vbi, int pgno, int subno);
+void vbi_pll_reset(struct vbi *vbi, int fine_tune);
+
+#endif
diff --git a/libvbi/vt.h b/libvbi/vt.h
new file mode 100644
index 0000000..0fda7a3
--- /dev/null
+++ b/libvbi/vt.h
@@ -0,0 +1,68 @@
+#ifndef VT_H
+#define VT_H
+
+#include "misc.h"
+
+#define W 40
+#define H 25
+#define BAD_CHAR 0xb8 // substitute for chars with bad parity
+
+extern int debug;
+
+struct vt_event
+{
+ int type;
+ void *resource; /* struct xio_win *, struct vbi *, ... */
+ int i1, i2, i3, i4;
+ void *p1;
+};
+
+#define EV_CLOSE 1
+#define EV_KEY 2 // i1:KEY_xxx i2:shift-flag
+#define EV_MOUSE 3 // i1:button i2:shift-flag i3:x i4:y
+#define EV_SELECTION 4 // i1:len p1:data
+#define EV_PAGE 5 // p1:vt_page i1:query-flag
+#define EV_HEADER 6 // i1:pgno i2:subno i3:flags p1:data
+#define EV_XPACKET 7 // i1:mag i2:pkt i3:errors p1:data
+#define EV_RESET 8 // ./.
+#define EV_TIMER 9 // ./.
+
+#define KEY_F(i) (1000+i)
+#define KEY_LEFT 2001
+#define KEY_RIGHT 2002
+#define KEY_UP 2003
+#define KEY_DOWN 2004
+#define KEY_PUP 2005
+#define KEY_PDOWN 2006
+#define KEY_DEL 2007
+#define KEY_INS 2008
+
+struct vt_page
+{
+ int pgno, subno; // the wanted page number
+ int lang; // language code
+ int flags; // misc flags (see PG_xxx below)
+ int errors; // number of single bit errors in page
+ u32 lines; // 1 bit for each line received
+ u8 data[25][40]; // page contents
+ int flof; // page has FastText links
+ struct {
+ int pgno;
+ int subno;
+ } link[6]; // FastText links (FLOF)
+};
+
+#define PG_SUPPHEADER 0x01 // C7 row 0 is not to be displayed
+#define PG_UPDATE 0x02 // C8 row 1-28 has modified (editors flag)
+#define PG_OUTOFSEQ 0x04 // C9 page out of numerical order
+#define PG_NODISPLAY 0x08 // C10 rows 1-24 is not to be displayed
+#define PG_MAGSERIAL 0x10 // C11 serial trans. (any pkt0 terminates page)
+#define PG_ERASE 0x20 // C4 clear previously stored lines
+#define PG_NEWSFLASH 0x40 // C5 box it and insert into normal video pict.
+#define PG_SUBTITLE 0x80 // C6 box it and insert into normal video pict.
+// my flags
+#define PG_ACTIVE 0x100 // currently fetching this page
+
+#define ANY_SUB 0x3f7f // universal subpage number
+
+#endif
diff --git a/log b/log
new file mode 100644
index 0000000..345d724
--- /dev/null
+++ b/log
@@ -0,0 +1,825 @@
+dpkg-buildpackage: source package is xawtv
+dpkg-buildpackage: source version is 3.20
+dpkg-buildpackage: source maintainer is Gerd Knorr <kraxel@debian.org>
+ debian/rules clean DEB_BUILD_ARCH=powerpc DEB_BUILD_GNU_CPU=powerpc DEB_BUILD_GNU_SYSTEM=linux DEB_BUILD_GNU_TYPE=powerpc-linux DEB_HOST_ARCH=powerpc DEB_HOST_GNU_CPU=powerpc DEB_HOST_GNU_SYSTEM=linux DEB_HOST_GNU_TYPE=powerpc-linux
+make distclean
+make[1]: Entering directory `/home/kraxel/debian/xawtv-3.20'
+make[1]: *** No rule to make target `distclean'. Stop.
+make[1]: Leaving directory `/home/kraxel/debian/xawtv-3.20'
+make: [clean] Error 2 (ignored)
+dh_clean
+ rm -f debian/substvars debian/postinst.debhelper debian/postrm.debhelper debian/preinst.debhelper debian/prerm.debhelper
+ rm -rf debian/tmp
+ rm -f debian/fbtv.substvars debian/fbtv.postinst.debhelper debian/fbtv.postrm.debhelper debian/fbtv.preinst.debhelper debian/fbtv.prerm.debhelper
+ rm -rf debian/fbtv
+ rm -f debian/streamer.substvars debian/streamer.postinst.debhelper debian/streamer.postrm.debhelper debian/streamer.preinst.debhelper debian/streamer.prerm.debhelper
+ rm -rf debian/streamer
+ rm -f debian/radio.substvars debian/radio.postinst.debhelper debian/radio.postrm.debhelper debian/radio.preinst.debhelper debian/radio.prerm.debhelper
+ rm -rf debian/radio
+ rm -f debian/v4l-conf.substvars debian/v4l-conf.postinst.debhelper debian/v4l-conf.postrm.debhelper debian/v4l-conf.preinst.debhelper debian/v4l-conf.prerm.debhelper
+ rm -rf debian/v4l-conf
+ rm -f debian/xawtv-tools.substvars debian/xawtv-tools.postinst.debhelper debian/xawtv-tools.postrm.debhelper debian/xawtv-tools.preinst.debhelper debian/xawtv-tools.prerm.debhelper
+ rm -rf debian/xawtv-tools
+ rm -f debian/webcam.substvars debian/webcam.postinst.debhelper debian/webcam.postrm.debhelper debian/webcam.preinst.debhelper debian/webcam.prerm.debhelper
+ rm -rf debian/webcam
+ rm -f debian/alevtd.substvars debian/alevtd.postinst.debhelper debian/alevtd.postrm.debhelper debian/alevtd.preinst.debhelper debian/alevtd.prerm.debhelper
+ rm -rf debian/alevtd
+ rm -f debian/files
+ find . -type f -a \( -name \#\*\# -o -name \*\~ -o -name DEADJOE -o -name \*.orig -o -name \*.rej -o -name \*.bak -o -name .\*.orig -o -name .\*.rej -o -name .SUMS -o -name TAGS -o -name core -o \( -path \*/.deps/\* -a -name \*.P \) \) -exec rm -f {} \;
+ dpkg-source -b xawtv-3.20
+dpkg-source: building xawtv in xawtv_3.20.tar.gz
+dpkg-source: building xawtv in xawtv_3.20.tar.gz
+dpkg-source: building xawtv in xawtv_3.20.tar.gz
+dpkg-source: building xawtv in xawtv_3.20.dsc
+ debian/rules build DEB_BUILD_ARCH=powerpc DEB_BUILD_GNU_CPU=powerpc DEB_BUILD_GNU_SYSTEM=linux DEB_BUILD_GNU_TYPE=powerpc-linux DEB_HOST_ARCH=powerpc DEB_HOST_GNU_CPU=powerpc DEB_HOST_GNU_SYSTEM=linux DEB_HOST_GNU_TYPE=powerpc-linux
+test -f config.h || ./configure --prefix=/usr --mandir=/usr/share/man
+creating cache ./config.cache
+checking for gcc... gcc
+checking whether the C compiler (gcc ) works... yes
+checking whether the C compiler (gcc ) is a cross-compiler... no
+checking whether we are using GNU C... yes
+checking whether gcc accepts -g... yes
+checking how to run the C preprocessor... gcc -E
+checking for a BSD compatible install... /usr/bin/install -c
+checking for gccmakedep... gccmakedep
+checking for open64... yes
+checking for ftello... yes
+checking for getpt... yes
+checking for getnameinfo... yes
+checking for endian.h... yes
+checking for soundcard.h... no
+checking for sys/soundcard.h... yes
+checking for pthread_create in -lpthread... yes
+checking for pthread_create in -lc_r... no
+checking for main in -lossaudio... no
+checking for X... libraries /usr/X11R6/lib, headers /usr/X11R6/include
+checking for dnet_ntoa in -ldnet... no
+checking for dnet_ntoa in -ldnet_stub... no
+checking for gethostbyname... yes
+checking for connect... yes
+checking for remove... yes
+checking for shmat... yes
+checking for IceConnectionNumber in -lICE... yes
+checking for Xaw3dComputeTopShadowRGB in -lXaw3d... yes
+checking for jpeg_start_compress in -ljpeg... yes
+checking for lirc_init in -llirc_client... no
+checking for XF86DGAQueryExtension in -lXxf86dga... yes
+checking for XF86VidModeQueryExtension in -lXxf86vm... yes
+checking for DPMSQueryExtension in -lXdpms... yes
+checking for XvQueryExtension in -lXv... no
+checking for XShmAttach in -lXext... yes
+updating cache ./config.cache
+creating ./config.status
+creating Makefile
+creating src/Makefile
+creating tools/Makefile
+creating radio/Makefile
+creating man/Makefile
+creating i2c/Makefile
+creating font/Makefile
+creating webcam/Makefile
+creating http/Makefile
+creating libvbi/Makefile
+creating xawtv.spec
+creating config.h
+make build
+make[1]: Entering directory `/home/kraxel/debian/xawtv-3.20'
+set -e; for dir in libvbi src man radio font tools webcam http ; do make -C $dir build; done
+make[2]: Entering directory `/home/kraxel/debian/xawtv-3.20/libvbi'
+gcc -Wall -O2 -g -c -o vbi.o vbi.c
+vbi.c: In function `vbi_send':
+vbi.c:59: warning: suggest parentheses around assignment used as truth value
+vbi.c: In function `vbi_pll_reset':
+vbi.c:137: warning: suggest explicit braces to avoid ambiguous `else'
+vbi.c: In function `vbi_line':
+vbi.c:361: warning: suggest parentheses around assignment used as truth value
+vbi.c:361: warning: suggest explicit braces to avoid ambiguous `else'
+gcc -Wall -O2 -g -c -o fdset.o fdset.c
+gcc -Wall -O2 -g -c -o misc.o misc.c
+gcc -Wall -O2 -g -c -o hamm.o hamm.c
+gcc -Wall -O2 -g -c -o lang.o lang.c
+lang.c: In function `enhance':
+lang.c:206: warning: suggest explicit braces to avoid ambiguous `else'
+lang.c:218: warning: suggest parentheses around assignment used as truth value
+lang.c:218: warning: suggest explicit braces to avoid ambiguous `else'
+gcc -Wall -O2 -g -c -o cache.o cache.c
+cache.c: In function `cache_reset':
+cache.c:73: warning: suggest parentheses around assignment used as truth value
+cache.c: In function `cache_foreach_pg':
+cache.c:178: warning: suggest parentheses around assignment used as truth value
+cache.c:195: warning: suggest parentheses around assignment used as truth value
+cache.c: In function `cache_open':
+cache.c:238: warning: unused variable `vtp'
+cache.c:260: warning: label `fail2' defined but not used
+gcc -Wall -O2 -g -c -o font.o font.c
+gcc -Wall -O2 -g -c -o export.o export.c
+export.c: In function `find_opt':
+export.c:59: warning: suggest parentheses around assignment used as truth value
+export.c:60: warning: suggest parentheses around assignment used as truth value
+export.c:62: warning: suggest parentheses around assignment used as truth value
+export.c: In function `export_open':
+export.c:87: warning: suggest parentheses around assignment used as truth value
+export.c:89: warning: suggest parentheses around assignment used as truth value
+export.c:91: warning: suggest parentheses around assignment used as truth value
+export.c:96: warning: suggest parentheses around assignment used as truth value
+export.c:106: warning: suggest parentheses around assignment used as truth value
+export.c:110: warning: suggest parentheses around assignment used as truth value
+export.c: In function `adjust':
+export.c:189: warning: suggest parentheses around assignment used as truth value
+export.c: In function `export_mkname':
+export.c:200: warning: suggest parentheses around assignment used as truth value
+export.c: In function `fmt_page':
+export.c:249: warning: unused variable `c'
+gcc -Wall -O2 -g -c -o exp-gfx.o exp-gfx.c
+exp-gfx.c:40: warning: missing braces around initializer
+exp-gfx.c:40: warning: (near initialization for `export_ppm[0]')
+gcc -Wall -O2 -g -c -o exp-html.o exp-html.c
+exp-html.c:27: warning: missing braces around initializer
+exp-html.c:27: warning: (near initialization for `export_html[0]')
+gcc -Wall -O2 -g -c -o exp-txt.o exp-txt.c
+exp-txt.c:31: warning: missing braces around initializer
+exp-txt.c:31: warning: (near initialization for `export_txt[0]')
+exp-txt.c:43: warning: missing braces around initializer
+exp-txt.c:43: warning: (near initialization for `export_ansi[0]')
+exp-txt.c: In function `put_attr':
+exp-txt.c:125: warning: implicit declaration of function `stpcpy'
+exp-txt.c:125: warning: assignment makes pointer from integer without a cast
+exp-txt.c:128: warning: assignment makes pointer from integer without a cast
+exp-txt.c:134: warning: assignment makes pointer from integer without a cast
+exp-txt.c:136: warning: assignment makes pointer from integer without a cast
+exp-txt.c: In function `txt_output':
+exp-txt.c:159: warning: unused variable `x3'
+exp-txt.c:159: warning: unused variable `x2'
+exp-txt.c:157: warning: unused variable `fp'
+rm -f libvbi.a
+ar -r libvbi.a vbi.o fdset.o misc.o hamm.o lang.o cache.o font.o export.o exp-gfx.o exp-html.o exp-txt.o
+ranlib libvbi.a
+make[2]: Leaving directory `/home/kraxel/debian/xawtv-3.20/libvbi'
+make[2]: Entering directory `/home/kraxel/debian/xawtv-3.20/src'
+gcc -g -Wall -Wstrict-prototypes -g -O2 -D_FILE_OFFSET_BITS=64 -I./.. -I.. -I/usr/X11R6/include -D_REENTRANT -DVERSION='"xawtv-3.20"' -I./../libvbi -L../libvbi -c -o main.o main.c
+In file included from main.c:38:
+/usr/X11R6/include/X11/Xaw/XawInit.h:29: warning: function declaration isn't a prototype
+gcc -g -Wall -Wstrict-prototypes -g -O2 -D_FILE_OFFSET_BITS=64 -I./.. -I.. -I/usr/X11R6/include -D_REENTRANT -DVERSION='"xawtv-3.20"' -I./../libvbi -L../libvbi -c -o xt.o xt.c
+gcc -g -Wall -Wstrict-prototypes -g -O2 -D_FILE_OFFSET_BITS=64 -I./.. -I.. -I/usr/X11R6/include -D_REENTRANT -DVERSION='"xawtv-3.20"' -I./../libvbi -L../libvbi -c -o toolbox.o toolbox.c
+In file included from toolbox.c:18:
+/usr/X11R6/include/X11/Xaw/XawInit.h:29: warning: function declaration isn't a prototype
+gcc -g -Wall -Wstrict-prototypes -g -O2 -D_FILE_OFFSET_BITS=64 -I./.. -I.. -I/usr/X11R6/include -D_REENTRANT -DVERSION='"xawtv-3.20"' -I./../libvbi -L../libvbi -c -o conf.o conf.c
+In file included from conf.c:20:
+/usr/X11R6/include/X11/Xaw/XawInit.h:29: warning: function declaration isn't a prototype
+gcc -g -Wall -Wstrict-prototypes -g -O2 -D_FILE_OFFSET_BITS=64 -I./.. -I.. -I/usr/X11R6/include -D_REENTRANT -DVERSION='"xawtv-3.20"' -I./../libvbi -L../libvbi -c -o x11.o x11.c
+gcc -g -Wall -Wstrict-prototypes -g -O2 -D_FILE_OFFSET_BITS=64 -I./.. -I.. -I/usr/X11R6/include -D_REENTRANT -DVERSION='"xawtv-3.20"' -I./../libvbi -L../libvbi -c -o xv.o xv.c
+gcc -g -Wall -Wstrict-prototypes -g -O2 -D_FILE_OFFSET_BITS=64 -I./.. -I.. -I/usr/X11R6/include -D_REENTRANT -DVERSION='"xawtv-3.20"' -I./../libvbi -L../libvbi -c -o complete.o complete.c
+gcc -g -Wall -Wstrict-prototypes -g -O2 -D_FILE_OFFSET_BITS=64 -I./.. -I.. -I/usr/X11R6/include -D_REENTRANT -DVERSION='"xawtv-3.20"' -I./../libvbi -L../libvbi -c -o wmhooks.o wmhooks.c
+gcc -g -Wall -Wstrict-prototypes -g -O2 -D_FILE_OFFSET_BITS=64 -I./.. -I.. -I/usr/X11R6/include -D_REENTRANT -DVERSION='"xawtv-3.20"' -I./../libvbi -L../libvbi -c -o channel.o channel.c
+In file included from channel.c:34:
+/usr/X11R6/include/X11/Xaw/XawInit.h:29: warning: function declaration isn't a prototype
+gcc -g -Wall -Wstrict-prototypes -g -O2 -D_FILE_OFFSET_BITS=64 -I./.. -I.. -I/usr/X11R6/include -D_REENTRANT -DVERSION='"xawtv-3.20"' -I./../libvbi -L../libvbi -c -o sound.o sound.c
+gcc -g -Wall -Wstrict-prototypes -g -O2 -D_FILE_OFFSET_BITS=64 -I./.. -I.. -I/usr/X11R6/include -D_REENTRANT -DVERSION='"xawtv-3.20"' -I./../libvbi -L../libvbi -c -o grab.o grab.c
+gcc -g -Wall -Wstrict-prototypes -g -O2 -D_FILE_OFFSET_BITS=64 -I./.. -I.. -I/usr/X11R6/include -D_REENTRANT -DVERSION='"xawtv-3.20"' -I./../libvbi -L../libvbi -c -o grab-v4l.o grab-v4l.c
+gcc -g -Wall -Wstrict-prototypes -g -O2 -D_FILE_OFFSET_BITS=64 -I./.. -I.. -I/usr/X11R6/include -D_REENTRANT -DVERSION='"xawtv-3.20"' -I./../libvbi -L../libvbi -c -o grab-v4l2.o grab-v4l2.c
+gcc -g -Wall -Wstrict-prototypes -g -O2 -D_FILE_OFFSET_BITS=64 -I./.. -I.. -I/usr/X11R6/include -D_REENTRANT -DVERSION='"xawtv-3.20"' -I./../libvbi -L../libvbi -c -o grab-bsd.o grab-bsd.c
+gcc -g -Wall -Wstrict-prototypes -g -O2 -D_FILE_OFFSET_BITS=64 -I./.. -I.. -I/usr/X11R6/include -D_REENTRANT -DVERSION='"xawtv-3.20"' -I./../libvbi -L../libvbi -c -o colorspace.o colorspace.c
+gcc -g -Wall -Wstrict-prototypes -g -O2 -D_FILE_OFFSET_BITS=64 -I./.. -I.. -I/usr/X11R6/include -D_REENTRANT -DVERSION='"xawtv-3.20"' -I./../libvbi -L../libvbi -c -o webcam.o webcam.c
+gcc -g -Wall -Wstrict-prototypes -g -O2 -D_FILE_OFFSET_BITS=64 -I./.. -I.. -I/usr/X11R6/include -D_REENTRANT -DVERSION='"xawtv-3.20"' -I./../libvbi -L../libvbi -c -o frequencies.o frequencies.c
+gcc -g -Wall -Wstrict-prototypes -g -O2 -D_FILE_OFFSET_BITS=64 -I./.. -I.. -I/usr/X11R6/include -D_REENTRANT -DVERSION='"xawtv-3.20"' -I./../libvbi -L../libvbi -c -o writefile.o writefile.c
+gcc -g -Wall -Wstrict-prototypes -g -O2 -D_FILE_OFFSET_BITS=64 -I./.. -I.. -I/usr/X11R6/include -D_REENTRANT -DVERSION='"xawtv-3.20"' -I./../libvbi -L../libvbi -c -o commands.o commands.c
+gcc -g -Wall -Wstrict-prototypes -g -O2 -D_FILE_OFFSET_BITS=64 -I./.. -I.. -I/usr/X11R6/include -D_REENTRANT -DVERSION='"xawtv-3.20"' -I./../libvbi -L../libvbi -c -o parseconfig.o parseconfig.c
+gcc -g -Wall -Wstrict-prototypes -g -O2 -D_FILE_OFFSET_BITS=64 -I./.. -I.. -I/usr/X11R6/include -D_REENTRANT -DVERSION='"xawtv-3.20"' -I./../libvbi -L../libvbi -c -o mjpeg.o mjpeg.c
+gcc -g -Wall -Wstrict-prototypes -g -O2 -D_FILE_OFFSET_BITS=64 -I./.. -I.. -I/usr/X11R6/include -D_REENTRANT -DVERSION='"xawtv-3.20"' -I./../libvbi -L../libvbi -c -o capture.o capture.c
+gcc -g -Wall -Wstrict-prototypes -g -O2 -D_FILE_OFFSET_BITS=64 -I./.. -I.. -I/usr/X11R6/include -D_REENTRANT -DVERSION='"xawtv-3.20"' -I./../libvbi -L../libvbi -c -o writeavi.o writeavi.c
+gcc -g -Wall -Wstrict-prototypes -g -O2 -D_FILE_OFFSET_BITS=64 -I./.. -I.. -I/usr/X11R6/include -D_REENTRANT -DVERSION='"xawtv-3.20"' -I./../libvbi -L../libvbi -c -o lirc.o lirc.c
+gcc -g -Wall -Wstrict-prototypes -g -O2 -D_FILE_OFFSET_BITS=64 -I./.. -I.. -I/usr/X11R6/include -D_REENTRANT -DVERSION='"xawtv-3.20"' -I./../libvbi -L../libvbi -o xawtv main.o xt.o toolbox.o conf.o x11.o xv.o complete.o wmhooks.o channel.o sound.o grab.o grab-v4l.o grab-v4l2.o grab-bsd.o colorspace.o webcam.o frequencies.o writefile.o commands.o parseconfig.o mjpeg.o capture.o writeavi.o lirc.o -ljpeg -L/usr/X11R6/lib -lXdpms -lXxf86vm -lXxf86dga -lXaw3d -lXmu -lXt -lSM -lICE -lXext -lX11 -lpthread
+test -f Xawtv.ad || cp -v ./Xawtv.ad .
+gcc -g -Wall -Wstrict-prototypes -g -O2 -D_FILE_OFFSET_BITS=64 -I./.. -I.. -I/usr/X11R6/include -D_REENTRANT -DVERSION='"xawtv-3.20"' -I./../libvbi -L../libvbi -c -o xawtv-remote.o xawtv-remote.c
+gcc -g -Wall -Wstrict-prototypes -g -O2 -D_FILE_OFFSET_BITS=64 -I./.. -I.. -I/usr/X11R6/include -D_REENTRANT -DVERSION='"xawtv-3.20"' -I./../libvbi -L../libvbi -o xawtv-remote xawtv-remote.o -L/usr/X11R6/lib -lXdpms -lXxf86vm -lXxf86dga -lXmu -lXt -lSM -lICE -lXext -lX11
+gcc -g -Wall -Wstrict-prototypes -g -O2 -D_FILE_OFFSET_BITS=64 -I./.. -I.. -I/usr/X11R6/include -D_REENTRANT -DVERSION='"xawtv-3.20"' -I./../libvbi -L../libvbi -c -o v4l-conf.o v4l-conf.c
+v4l-conf.c:75: warning: function declaration isn't a prototype
+gcc -g -Wall -Wstrict-prototypes -g -O2 -D_FILE_OFFSET_BITS=64 -I./.. -I.. -I/usr/X11R6/include -D_REENTRANT -DVERSION='"xawtv-3.20"' -I./../libvbi -L../libvbi -o v4l-conf v4l-conf.o -L/usr/X11R6/lib -lXdpms -lXxf86vm -lXxf86dga -lXext -lX11
+gcc -g -Wall -Wstrict-prototypes -g -O2 -D_FILE_OFFSET_BITS=64 -I./.. -I.. -I/usr/X11R6/include -D_REENTRANT -DVERSION='"xawtv-3.20"' -I./../libvbi -L../libvbi -c -o v4lctl.o v4lctl.c
+gcc -g -Wall -Wstrict-prototypes -g -O2 -D_FILE_OFFSET_BITS=64 -I./.. -I.. -I/usr/X11R6/include -D_REENTRANT -DVERSION='"xawtv-3.20"' -I./../libvbi -L../libvbi -DNO_X11=1 -c -o channel-no-x11.o channel.c
+gcc -g -Wall -Wstrict-prototypes -g -O2 -D_FILE_OFFSET_BITS=64 -I./.. -I.. -I/usr/X11R6/include -D_REENTRANT -DVERSION='"xawtv-3.20"' -I./../libvbi -L../libvbi -o v4lctl v4lctl.o channel-no-x11.o xv.o sound.o grab.o grab-v4l.o grab-v4l2.o grab-bsd.o colorspace.o webcam.o frequencies.o writefile.o commands.o parseconfig.o mjpeg.o -ljpeg -L/usr/X11R6/lib -lXdpms -lXxf86vm -lXxf86dga -lXaw3d -lXmu -lXt -lSM -lICE -lXext -lX11 -lpthread
+gcc -g -Wall -Wstrict-prototypes -g -O2 -D_FILE_OFFSET_BITS=64 -I./.. -I.. -I/usr/X11R6/include -D_REENTRANT -DVERSION='"xawtv-3.20"' -I./../libvbi -L../libvbi -c -o streamer.o streamer.c
+gcc -g -Wall -Wstrict-prototypes -g -O2 -D_FILE_OFFSET_BITS=64 -I./.. -I.. -I/usr/X11R6/include -D_REENTRANT -DVERSION='"xawtv-3.20"' -I./../libvbi -L../libvbi -o streamer streamer.o channel-no-x11.o sound.o grab.o grab-v4l.o grab-v4l2.o grab-bsd.o colorspace.o webcam.o frequencies.o writefile.o commands.o parseconfig.o mjpeg.o capture.o writeavi.o -ljpeg -lpthread
+gcc -g -Wall -Wstrict-prototypes -g -O2 -D_FILE_OFFSET_BITS=64 -I./.. -I.. -I/usr/X11R6/include -D_REENTRANT -DVERSION='"xawtv-3.20"' -I./../libvbi -L../libvbi -c -o fbtv.o fbtv.c
+gcc -g -Wall -Wstrict-prototypes -g -O2 -D_FILE_OFFSET_BITS=64 -I./.. -I.. -I/usr/X11R6/include -D_REENTRANT -DVERSION='"xawtv-3.20"' -I./../libvbi -L../libvbi -c -o fbtools.o fbtools.c
+gcc -g -Wall -Wstrict-prototypes -g -O2 -D_FILE_OFFSET_BITS=64 -I./.. -I.. -I/usr/X11R6/include -D_REENTRANT -DVERSION='"xawtv-3.20"' -I./../libvbi -L../libvbi -c -o matrox.o matrox.c
+gcc -g -Wall -Wstrict-prototypes -g -O2 -D_FILE_OFFSET_BITS=64 -I./.. -I.. -I/usr/X11R6/include -D_REENTRANT -DVERSION='"xawtv-3.20"' -I./../libvbi -L../libvbi -o fbtv fbtv.o fbtools.o channel-no-x11.o matrox.o sound.o grab.o grab-v4l.o grab-v4l2.o grab-bsd.o colorspace.o webcam.o frequencies.o writefile.o commands.o parseconfig.o mjpeg.o capture.o writeavi.o lirc.o -ljpeg -lncurses -lm -lpthread
+gcc -g -Wall -Wstrict-prototypes -g -O2 -D_FILE_OFFSET_BITS=64 -I./.. -I.. -I/usr/X11R6/include -D_REENTRANT -DVERSION='"xawtv-3.20"' -I./../libvbi -L../libvbi xvideo.c -L/usr/X11R6/lib -lXdpms -lXxf86vm -lXxf86dga -lXaw3d -lXmu -lXt -lSM -lICE -lXext -lX11 -lpthread -o xvideo
+xvideo.c:4: warning: function declaration isn't a prototype
+gcc -g -Wall -Wstrict-prototypes -g -O2 -D_FILE_OFFSET_BITS=64 -I./.. -I.. -I/usr/X11R6/include -D_REENTRANT -DVERSION='"xawtv-3.20"' -I./../libvbi -L../libvbi -c -o rootv.o rootv.c
+rootv.c:4: warning: function declaration isn't a prototype
+gcc -g -Wall -Wstrict-prototypes -g -O2 -D_FILE_OFFSET_BITS=64 -I./.. -I.. -I/usr/X11R6/include -D_REENTRANT -DVERSION='"xawtv-3.20"' -I./../libvbi -L../libvbi -o rootv rootv.o parseconfig.o -L/usr/X11R6/lib -lXdpms -lXxf86vm -lXxf86dga -lXext -lX11
+gcc -g -Wall -Wstrict-prototypes -g -O2 -D_FILE_OFFSET_BITS=64 -I./.. -I.. -I/usr/X11R6/include -D_REENTRANT -DVERSION='"xawtv-3.20"' -I./../libvbi -L../libvbi -c -o scantv.o scantv.c
+In file included from ../libvbi/vbi.h:6,
+ from scantv.c:35:
+../libvbi/cache.h:32: warning: function declaration isn't a prototype
+gcc -g -Wall -Wstrict-prototypes -g -O2 -D_FILE_OFFSET_BITS=64 -I./.. -I.. -I/usr/X11R6/include -D_REENTRANT -DVERSION='"xawtv-3.20"' -I./../libvbi -L../libvbi -o scantv scantv.o channel-no-x11.o xv.o sound.o grab.o grab-v4l.o grab-v4l2.o grab-bsd.o colorspace.o webcam.o frequencies.o writefile.o commands.o parseconfig.o mjpeg.o -lvbi -ljpeg -L/usr/X11R6/lib -lXdpms -lXxf86vm -lXxf86dga -lXaw3d -lXmu -lXt -lSM -lICE -lXext -lX11 -lpthread
+make[2]: Leaving directory `/home/kraxel/debian/xawtv-3.20/src'
+make[2]: Entering directory `/home/kraxel/debian/xawtv-3.20/man'
+make[2]: Nothing to be done for `build'.
+make[2]: Leaving directory `/home/kraxel/debian/xawtv-3.20/man'
+make[2]: Entering directory `/home/kraxel/debian/xawtv-3.20/radio'
+gcc -g -Wall -g -O2 -D_FILE_OFFSET_BITS=64 -I./.. -I.. -c -o radio.o radio.c
+gcc -g -Wall -g -O2 -D_FILE_OFFSET_BITS=64 -I./.. -I.. -o radio radio.o -lncurses
+make[2]: Leaving directory `/home/kraxel/debian/xawtv-3.20/radio'
+make[2]: Entering directory `/home/kraxel/debian/xawtv-3.20/font'
+bdftopcf -o led-latin1.pcf led-latin1.bdf
+bdftopcf -o led-latin2.pcf led-latin2.bdf
+bdftopcf -o led-koi8.pcf led-koi8.bdf
+mkfontdir
+make[2]: Leaving directory `/home/kraxel/debian/xawtv-3.20/font'
+make[2]: Entering directory `/home/kraxel/debian/xawtv-3.20/tools'
+gcc -g -Wall -I./.. -I.. -D_XOPEN_SOURCE=500 -g -O2 -D_FILE_OFFSET_BITS=64 -I/usr/X11R6/include -c -o dump-mixers.o dump-mixers.c
+gcc -g -Wall -I./.. -I.. -D_XOPEN_SOURCE=500 -g -O2 -D_FILE_OFFSET_BITS=64 -I/usr/X11R6/include -o dump-mixers dump-mixers.o
+gcc -g -Wall -I./.. -I.. -D_XOPEN_SOURCE=500 -g -O2 -D_FILE_OFFSET_BITS=64 -I/usr/X11R6/include -c -o record.o record.c
+gcc -g -Wall -I./.. -I.. -D_XOPEN_SOURCE=500 -g -O2 -D_FILE_OFFSET_BITS=64 -I/usr/X11R6/include -o record record.o -lncurses
+gcc -g -Wall -I./.. -I.. -D_XOPEN_SOURCE=500 -g -O2 -D_FILE_OFFSET_BITS=64 -I/usr/X11R6/include -c -o showriff.o showriff.c
+gcc -g -Wall -I./.. -I.. -D_XOPEN_SOURCE=500 -g -O2 -D_FILE_OFFSET_BITS=64 -I/usr/X11R6/include -o showriff showriff.o
+gcc -g -Wall -I./.. -I.. -D_XOPEN_SOURCE=500 -g -O2 -D_FILE_OFFSET_BITS=64 -I/usr/X11R6/include -c -o propwatch.o propwatch.c
+gcc -g -Wall -I./.. -I.. -D_XOPEN_SOURCE=500 -g -O2 -D_FILE_OFFSET_BITS=64 -I/usr/X11R6/include -o propwatch propwatch.o -L/usr/X11R6/lib -lXdpms -lXxf86vm -lXxf86dga -lXaw3d -lXmu -lXt -lSM -lICE -lXext -lX11
+make[2]: Leaving directory `/home/kraxel/debian/xawtv-3.20/tools'
+make[2]: Entering directory `/home/kraxel/debian/xawtv-3.20/webcam'
+gcc -O2 -Wall -I./.. -I.. -D_GNU_SOURCE -c -o webcam.o webcam.c
+gcc -O2 -Wall -I./.. -I.. -D_GNU_SOURCE -c -o ftp.o ftp.c
+gcc -O2 -Wall -I./.. -I.. -D_GNU_SOURCE -c -o parseconfig.o parseconfig.c
+gcc -O2 -Wall -I./.. -I.. -D_GNU_SOURCE -o webcam webcam.o ftp.o parseconfig.o -ljpeg
+make[2]: Leaving directory `/home/kraxel/debian/xawtv-3.20/webcam'
+make[2]: Entering directory `/home/kraxel/debian/xawtv-3.20/http'
+gcc -Wall -g -O2 -I. -I./../libvbi -L../libvbi -c -o main.o main.c
+gcc -Wall -g -O2 -I. -I./../libvbi -L../libvbi -c -o request.o request.c
+gcc -Wall -g -O2 -I. -I./../libvbi -L../libvbi -c -o response.o response.c
+perl -ne 's/\"/\\\"/g; chop; print "\"$_\\n\"\n"' alevt.css > alevt.css.h
+perl -ne 's/\"/\\\"/g; chop; print "\"$_\\n\"\n"' top.html > top.html.h
+perl -ne 's/\"/\\\"/g; chop; print "\"$_\\n\"\n"' bottom.html > bottom.html.h
+perl -ne 's/\"/\\\"/g; chop; print "\"$_\\n\"\n"' about.html > about.html.h
+gcc -Wall -g -O2 -I. -I./../libvbi -L../libvbi -c -o page.o page.c
+gcc -Wall -g -O2 -I. -I./../libvbi -L../libvbi -o alevtd main.o request.o response.o page.o -lvbi
+make[2]: Leaving directory `/home/kraxel/debian/xawtv-3.20/http'
+make[1]: Leaving directory `/home/kraxel/debian/xawtv-3.20'
+ debian/rules binary DEB_BUILD_ARCH=powerpc DEB_BUILD_GNU_CPU=powerpc DEB_BUILD_GNU_SYSTEM=linux DEB_BUILD_GNU_TYPE=powerpc-linux DEB_HOST_ARCH=powerpc DEB_HOST_GNU_CPU=powerpc DEB_HOST_GNU_SYSTEM=linux DEB_HOST_GNU_TYPE=powerpc-linux
+test -f config.h || ./configure --prefix=/usr --mandir=/usr/share/man
+make build
+make[1]: Entering directory `/home/kraxel/debian/xawtv-3.20'
+set -e; for dir in libvbi src man radio font tools webcam http ; do make -C $dir build; done
+make[2]: Entering directory `/home/kraxel/debian/xawtv-3.20/libvbi'
+make[2]: Nothing to be done for `build'.
+make[2]: Leaving directory `/home/kraxel/debian/xawtv-3.20/libvbi'
+make[2]: Entering directory `/home/kraxel/debian/xawtv-3.20/src'
+make[2]: Nothing to be done for `build'.
+make[2]: Leaving directory `/home/kraxel/debian/xawtv-3.20/src'
+make[2]: Entering directory `/home/kraxel/debian/xawtv-3.20/man'
+make[2]: Nothing to be done for `build'.
+make[2]: Leaving directory `/home/kraxel/debian/xawtv-3.20/man'
+make[2]: Entering directory `/home/kraxel/debian/xawtv-3.20/radio'
+make[2]: Nothing to be done for `build'.
+make[2]: Leaving directory `/home/kraxel/debian/xawtv-3.20/radio'
+make[2]: Entering directory `/home/kraxel/debian/xawtv-3.20/font'
+mkfontdir
+make[2]: Leaving directory `/home/kraxel/debian/xawtv-3.20/font'
+make[2]: Entering directory `/home/kraxel/debian/xawtv-3.20/tools'
+make[2]: Nothing to be done for `build'.
+make[2]: Leaving directory `/home/kraxel/debian/xawtv-3.20/tools'
+make[2]: Entering directory `/home/kraxel/debian/xawtv-3.20/webcam'
+make[2]: Nothing to be done for `build'.
+make[2]: Leaving directory `/home/kraxel/debian/xawtv-3.20/webcam'
+make[2]: Entering directory `/home/kraxel/debian/xawtv-3.20/http'
+make[2]: Nothing to be done for `build'.
+make[2]: Leaving directory `/home/kraxel/debian/xawtv-3.20/http'
+make[1]: Leaving directory `/home/kraxel/debian/xawtv-3.20'
+make install ROOT=/home/kraxel/debian/xawtv-3.20/debian/tmp
+make[1]: Entering directory `/home/kraxel/debian/xawtv-3.20'
+set -e; for dir in libvbi src man radio font tools webcam http ; do make -C $dir install; done
+make[2]: Entering directory `/home/kraxel/debian/xawtv-3.20/libvbi'
+make[2]: Nothing to be done for `install'.
+make[2]: Leaving directory `/home/kraxel/debian/xawtv-3.20/libvbi'
+make[2]: Entering directory `/home/kraxel/debian/xawtv-3.20/src'
+mkdir -p /home/kraxel/debian/xawtv-3.20/debian/tmp/usr/bin
+mkdir -p /home/kraxel/debian/xawtv-3.20/debian/tmp/usr/X11R6/lib/X11/app-defaults
+/usr/bin/install -c -s xawtv /home/kraxel/debian/xawtv-3.20/debian/tmp/usr/bin
+/usr/bin/install -c -s xawtv-remote /home/kraxel/debian/xawtv-3.20/debian/tmp/usr/bin
+/usr/bin/install -c -s fbtv /home/kraxel/debian/xawtv-3.20/debian/tmp/usr/bin;
+/usr/bin/install -c -s streamer /home/kraxel/debian/xawtv-3.20/debian/tmp/usr/bin
+/usr/bin/install -c -s v4lctl /home/kraxel/debian/xawtv-3.20/debian/tmp/usr/bin
+/usr/bin/install -c -s rootv /home/kraxel/debian/xawtv-3.20/debian/tmp/usr/bin
+/usr/bin/install -c -s scantv /home/kraxel/debian/xawtv-3.20/debian/tmp/usr/bin
+/usr/bin/install -c -s -m4711 -o root -g root v4l-conf /home/kraxel/debian/xawtv-3.20/debian/tmp/usr/bin
+/usr/bin/install -c -m 644 ./Xawtv.ad /home/kraxel/debian/xawtv-3.20/debian/tmp/usr/X11R6/lib/X11/app-defaults/Xawtv
+make[2]: Leaving directory `/home/kraxel/debian/xawtv-3.20/src'
+make[2]: Entering directory `/home/kraxel/debian/xawtv-3.20/man'
+mkdir -p /home/kraxel/debian/xawtv-3.20/debian/tmp/usr/share/man/man1
+for page in ./*.man; do \
+ dest=`basename $page .man`; \
+ /usr/bin/install -c -m 644 $page /home/kraxel/debian/xawtv-3.20/debian/tmp/usr/share/man/man1/$dest.1; \
+done
+make[2]: Leaving directory `/home/kraxel/debian/xawtv-3.20/man'
+make[2]: Entering directory `/home/kraxel/debian/xawtv-3.20/radio'
+mkdir -p /home/kraxel/debian/xawtv-3.20/debian/tmp/usr/bin
+/usr/bin/install -c -s radio /home/kraxel/debian/xawtv-3.20/debian/tmp/usr/bin
+/usr/bin/install -c -m 644 ./radio.man /home/kraxel/debian/xawtv-3.20/debian/tmp/usr/share/man/man1/radio.1
+make[2]: Leaving directory `/home/kraxel/debian/xawtv-3.20/radio'
+make[2]: Entering directory `/home/kraxel/debian/xawtv-3.20/font'
+mkfontdir
+mkdir -p /home/kraxel/debian/xawtv-3.20/debian/tmp/usr/X11R6/lib/X11/fonts/misc
+for file in led-latin1.pcf led-latin2.pcf led-koi8.pcf; do \
+ install -m 644 $file /home/kraxel/debian/xawtv-3.20/debian/tmp/usr/X11R6/lib/X11/fonts/misc; \
+done
+if test "/home/kraxel/debian/xawtv-3.20/debian/tmp" = ""; then \
+ (cd /home/kraxel/debian/xawtv-3.20/debian/tmp/usr/X11R6/lib/X11/fonts/misc; mkfontdir); \
+ xset fp rehash; \
+ true; \
+fi
+make[2]: Leaving directory `/home/kraxel/debian/xawtv-3.20/font'
+make[2]: Entering directory `/home/kraxel/debian/xawtv-3.20/tools'
+mkdir -p /home/kraxel/debian/xawtv-3.20/debian/tmp/usr/bin
+mkdir -p /home/kraxel/debian/xawtv-3.20/debian/tmp/usr/share/man/man1
+/usr/bin/install -c -s dump-mixers /home/kraxel/debian/xawtv-3.20/debian/tmp/usr/bin
+/usr/bin/install -c -s record /home/kraxel/debian/xawtv-3.20/debian/tmp/usr/bin
+/usr/bin/install -c -s showriff /home/kraxel/debian/xawtv-3.20/debian/tmp/usr/bin
+/usr/bin/install -c -s propwatch /home/kraxel/debian/xawtv-3.20/debian/tmp/usr/bin
+for page in ./*.man; do \
+ dest=`basename $page .man`; \
+ /usr/bin/install -c -m 644 $page /home/kraxel/debian/xawtv-3.20/debian/tmp/usr/share/man/man1/$dest.1; \
+done
+make[2]: Leaving directory `/home/kraxel/debian/xawtv-3.20/tools'
+make[2]: Entering directory `/home/kraxel/debian/xawtv-3.20/webcam'
+mkdir -p /home/kraxel/debian/xawtv-3.20/debian/tmp/usr/bin
+mkdir -p /home/kraxel/debian/xawtv-3.20/debian/tmp/usr/share/man/man1
+/usr/bin/install -c -s webcam /home/kraxel/debian/xawtv-3.20/debian/tmp/usr/bin
+/usr/bin/install -c -m 644 ./webcam.man /home/kraxel/debian/xawtv-3.20/debian/tmp/usr/share/man/man1/webcam.1
+make[2]: Leaving directory `/home/kraxel/debian/xawtv-3.20/webcam'
+make[2]: Entering directory `/home/kraxel/debian/xawtv-3.20/http'
+mkdir -p /home/kraxel/debian/xawtv-3.20/debian/tmp/usr/bin /home/kraxel/debian/xawtv-3.20/debian/tmp/usr/share/man/man1
+/usr/bin/install -c -s alevtd /home/kraxel/debian/xawtv-3.20/debian/tmp/usr/bin
+install -m 644 ./alevtd.man /home/kraxel/debian/xawtv-3.20/debian/tmp/usr/share/man/man1/alevtd.1
+make[2]: Leaving directory `/home/kraxel/debian/xawtv-3.20/http'
+make[1]: Leaving directory `/home/kraxel/debian/xawtv-3.20'
+dh_movefiles
+ install -d debian/fbtv
+ rm -f debian/movelist
+ (cd debian/tmp >/dev/null ; find usr/bin/fbtv ! -type d -and ! -type l -print || true) >> debian/movelist
+ (cd debian/tmp >/dev/null ; find usr/share/man/man1/fbtv.1 ! -type d -and ! -type l -print || true) >> debian/movelist
+ (cd debian/tmp >/dev/null ; find usr/bin/fbtv ! -type d -and -type l -print || true) >> debian/movelist
+ (cd debian/tmp >/dev/null ; find usr/share/man/man1/fbtv.1 ! -type d -and -type l -print || true) >> debian/movelist
+ (cd debian/tmp >/dev/null ; tar --create --remove-files --files-from=../movelist --file -) | (cd debian/fbtv >/dev/null ;tar xpf -)
+ rm -f debian/movelist
+ install -d debian/streamer
+ rm -f debian/movelist
+ (cd debian/tmp >/dev/null ; find usr/bin/streamer ! -type d -and ! -type l -print || true) >> debian/movelist
+ (cd debian/tmp >/dev/null ; find usr/bin/streamer ! -type d -and -type l -print || true) >> debian/movelist
+ (cd debian/tmp >/dev/null ; tar --create --remove-files --files-from=../movelist --file -) | (cd debian/streamer >/dev/null ;tar xpf -)
+ rm -f debian/movelist
+ install -d debian/radio
+ rm -f debian/movelist
+ (cd debian/tmp >/dev/null ; find usr/bin/radio ! -type d -and ! -type l -print || true) >> debian/movelist
+ (cd debian/tmp >/dev/null ; find usr/share/man/man1/radio.1 ! -type d -and ! -type l -print || true) >> debian/movelist
+ (cd debian/tmp >/dev/null ; find usr/bin/radio ! -type d -and -type l -print || true) >> debian/movelist
+ (cd debian/tmp >/dev/null ; find usr/share/man/man1/radio.1 ! -type d -and -type l -print || true) >> debian/movelist
+ (cd debian/tmp >/dev/null ; tar --create --remove-files --files-from=../movelist --file -) | (cd debian/radio >/dev/null ;tar xpf -)
+ rm -f debian/movelist
+ install -d debian/v4l-conf
+ rm -f debian/movelist
+ (cd debian/tmp >/dev/null ; find usr/bin/v4l-conf ! -type d -and ! -type l -print || true) >> debian/movelist
+ (cd debian/tmp >/dev/null ; find usr/share/man/man1/v4l-conf.1 ! -type d -and ! -type l -print || true) >> debian/movelist
+ (cd debian/tmp >/dev/null ; find usr/bin/v4l-conf ! -type d -and -type l -print || true) >> debian/movelist
+ (cd debian/tmp >/dev/null ; find usr/share/man/man1/v4l-conf.1 ! -type d -and -type l -print || true) >> debian/movelist
+ (cd debian/tmp >/dev/null ; tar --create --remove-files --files-from=../movelist --file -) | (cd debian/v4l-conf >/dev/null ;tar xpf -)
+ rm -f debian/movelist
+ install -d debian/xawtv-tools
+ rm -f debian/movelist
+ (cd debian/tmp >/dev/null ; find usr/bin/showriff ! -type d -and ! -type l -print || true) >> debian/movelist
+ (cd debian/tmp >/dev/null ; find usr/bin/propwatch ! -type d -and ! -type l -print || true) >> debian/movelist
+ (cd debian/tmp >/dev/null ; find usr/bin/dump-mixers ! -type d -and ! -type l -print || true) >> debian/movelist
+ (cd debian/tmp >/dev/null ; find usr/bin/record ! -type d -and ! -type l -print || true) >> debian/movelist
+ (cd debian/tmp >/dev/null ; find usr/share/man/man1/propwatch.1 ! -type d -and ! -type l -print || true) >> debian/movelist
+ (cd debian/tmp >/dev/null ; find usr/share/man/man1/showriff.1 ! -type d -and ! -type l -print || true) >> debian/movelist
+ (cd debian/tmp >/dev/null ; find usr/bin/showriff ! -type d -and -type l -print || true) >> debian/movelist
+ (cd debian/tmp >/dev/null ; find usr/bin/propwatch ! -type d -and -type l -print || true) >> debian/movelist
+ (cd debian/tmp >/dev/null ; find usr/bin/dump-mixers ! -type d -and -type l -print || true) >> debian/movelist
+ (cd debian/tmp >/dev/null ; find usr/bin/record ! -type d -and -type l -print || true) >> debian/movelist
+ (cd debian/tmp >/dev/null ; find usr/share/man/man1/propwatch.1 ! -type d -and -type l -print || true) >> debian/movelist
+ (cd debian/tmp >/dev/null ; find usr/share/man/man1/showriff.1 ! -type d -and -type l -print || true) >> debian/movelist
+ (cd debian/tmp >/dev/null ; tar --create --remove-files --files-from=../movelist --file -) | (cd debian/xawtv-tools >/dev/null ;tar xpf -)
+ rm -f debian/movelist
+ install -d debian/webcam
+ rm -f debian/movelist
+ (cd debian/tmp >/dev/null ; find usr/bin/webcam ! -type d -and ! -type l -print || true) >> debian/movelist
+ (cd debian/tmp >/dev/null ; find usr/share/man/man1/webcam.1 ! -type d -and ! -type l -print || true) >> debian/movelist
+ (cd debian/tmp >/dev/null ; find usr/bin/webcam ! -type d -and -type l -print || true) >> debian/movelist
+ (cd debian/tmp >/dev/null ; find usr/share/man/man1/webcam.1 ! -type d -and -type l -print || true) >> debian/movelist
+ (cd debian/tmp >/dev/null ; tar --create --remove-files --files-from=../movelist --file -) | (cd debian/webcam >/dev/null ;tar xpf -)
+ rm -f debian/movelist
+ install -d debian/alevtd
+ rm -f debian/movelist
+ (cd debian/tmp >/dev/null ; find usr/bin/alevtd ! -type d -and ! -type l -print || true) >> debian/movelist
+ (cd debian/tmp >/dev/null ; find usr/share/man/man1/alevtd.1 ! -type d -and ! -type l -print || true) >> debian/movelist
+ (cd debian/tmp >/dev/null ; find usr/bin/alevtd ! -type d -and -type l -print || true) >> debian/movelist
+ (cd debian/tmp >/dev/null ; find usr/share/man/man1/alevtd.1 ! -type d -and -type l -print || true) >> debian/movelist
+ (cd debian/tmp >/dev/null ; tar --create --remove-files --files-from=../movelist --file -) | (cd debian/alevtd >/dev/null ;tar xpf -)
+ rm -f debian/movelist
+# nop
+dh_installdocs README* Changes UPDATE_TO_v3.0 \
+ Programming-FAQ Trouble-Shooting Sound-FAQ \
+ contrib/dot.lircrc contrib/frequencies*
+ install -g 0 -o 0 -d debian/tmp/usr/share/doc/xawtv
+ cp -a README README.bttv README.de README.lirc README.recording README.xfree4 Changes UPDATE_TO_v3.0 Programming-FAQ Trouble-Shooting Sound-FAQ contrib/dot.lircrc contrib/frequencies-europe contrib/frequencies-japan debian/tmp/usr/share/doc/xawtv/
+ chown -R 0.0 debian/tmp/usr/share/doc
+ chmod -R go=rX debian/tmp/usr/share/doc
+ chmod -R u\+rw debian/tmp/usr/share/doc
+ install -g 0 -o 0 -m 644 -p debian/copyright debian/tmp/usr/share/doc/xawtv/copyright
+ echo "# Automatically added by dh_installdocs">> debian/postinst.debhelper
+ sed "s/#PACKAGE#/xawtv/g" /usr/share/debhelper/autoscripts/postinst-doc >> debian/postinst.debhelper
+ echo '# End automatically added section' >> debian/postinst.debhelper
+ echo "# Automatically added by dh_installdocs">> debian/prerm.debhelper
+ sed "s/#PACKAGE#/xawtv/g" /usr/share/debhelper/autoscripts/prerm-doc >> debian/prerm.debhelper
+ echo '# End automatically added section' >> debian/prerm.debhelper
+ install -g 0 -o 0 -d debian/fbtv/usr/share/doc/fbtv
+ install -g 0 -o 0 -m 644 -p debian/copyright debian/fbtv/usr/share/doc/fbtv/copyright
+ echo "# Automatically added by dh_installdocs">> debian/fbtv.postinst.debhelper
+ sed "s/#PACKAGE#/fbtv/g" /usr/share/debhelper/autoscripts/postinst-doc >> debian/fbtv.postinst.debhelper
+ echo '# End automatically added section' >> debian/fbtv.postinst.debhelper
+ echo "# Automatically added by dh_installdocs">> debian/fbtv.prerm.debhelper
+ sed "s/#PACKAGE#/fbtv/g" /usr/share/debhelper/autoscripts/prerm-doc >> debian/fbtv.prerm.debhelper
+ echo '# End automatically added section' >> debian/fbtv.prerm.debhelper
+ install -g 0 -o 0 -d debian/streamer/usr/share/doc/streamer
+ install -g 0 -o 0 -m 644 -p debian/copyright debian/streamer/usr/share/doc/streamer/copyright
+ echo "# Automatically added by dh_installdocs">> debian/streamer.postinst.debhelper
+ sed "s/#PACKAGE#/streamer/g" /usr/share/debhelper/autoscripts/postinst-doc >> debian/streamer.postinst.debhelper
+ echo '# End automatically added section' >> debian/streamer.postinst.debhelper
+ echo "# Automatically added by dh_installdocs">> debian/streamer.prerm.debhelper
+ sed "s/#PACKAGE#/streamer/g" /usr/share/debhelper/autoscripts/prerm-doc >> debian/streamer.prerm.debhelper
+ echo '# End automatically added section' >> debian/streamer.prerm.debhelper
+ install -g 0 -o 0 -d debian/radio/usr/share/doc/radio
+ install -g 0 -o 0 -m 644 -p debian/copyright debian/radio/usr/share/doc/radio/copyright
+ echo "# Automatically added by dh_installdocs">> debian/radio.postinst.debhelper
+ sed "s/#PACKAGE#/radio/g" /usr/share/debhelper/autoscripts/postinst-doc >> debian/radio.postinst.debhelper
+ echo '# End automatically added section' >> debian/radio.postinst.debhelper
+ echo "# Automatically added by dh_installdocs">> debian/radio.prerm.debhelper
+ sed "s/#PACKAGE#/radio/g" /usr/share/debhelper/autoscripts/prerm-doc >> debian/radio.prerm.debhelper
+ echo '# End automatically added section' >> debian/radio.prerm.debhelper
+ install -g 0 -o 0 -d debian/v4l-conf/usr/share/doc/v4l-conf
+ install -g 0 -o 0 -m 644 -p debian/copyright debian/v4l-conf/usr/share/doc/v4l-conf/copyright
+ echo "# Automatically added by dh_installdocs">> debian/v4l-conf.postinst.debhelper
+ sed "s/#PACKAGE#/v4l-conf/g" /usr/share/debhelper/autoscripts/postinst-doc >> debian/v4l-conf.postinst.debhelper
+ echo '# End automatically added section' >> debian/v4l-conf.postinst.debhelper
+ echo "# Automatically added by dh_installdocs">> debian/v4l-conf.prerm.debhelper
+ sed "s/#PACKAGE#/v4l-conf/g" /usr/share/debhelper/autoscripts/prerm-doc >> debian/v4l-conf.prerm.debhelper
+ echo '# End automatically added section' >> debian/v4l-conf.prerm.debhelper
+ install -g 0 -o 0 -d debian/xawtv-tools/usr/share/doc/xawtv-tools
+ install -g 0 -o 0 -m 644 -p debian/copyright debian/xawtv-tools/usr/share/doc/xawtv-tools/copyright
+ echo "# Automatically added by dh_installdocs">> debian/xawtv-tools.postinst.debhelper
+ sed "s/#PACKAGE#/xawtv-tools/g" /usr/share/debhelper/autoscripts/postinst-doc >> debian/xawtv-tools.postinst.debhelper
+ echo '# End automatically added section' >> debian/xawtv-tools.postinst.debhelper
+ echo "# Automatically added by dh_installdocs">> debian/xawtv-tools.prerm.debhelper
+ sed "s/#PACKAGE#/xawtv-tools/g" /usr/share/debhelper/autoscripts/prerm-doc >> debian/xawtv-tools.prerm.debhelper
+ echo '# End automatically added section' >> debian/xawtv-tools.prerm.debhelper
+ install -g 0 -o 0 -d debian/webcam/usr/share/doc/webcam
+ install -g 0 -o 0 -m 644 -p debian/copyright debian/webcam/usr/share/doc/webcam/copyright
+ echo "# Automatically added by dh_installdocs">> debian/webcam.postinst.debhelper
+ sed "s/#PACKAGE#/webcam/g" /usr/share/debhelper/autoscripts/postinst-doc >> debian/webcam.postinst.debhelper
+ echo '# End automatically added section' >> debian/webcam.postinst.debhelper
+ echo "# Automatically added by dh_installdocs">> debian/webcam.prerm.debhelper
+ sed "s/#PACKAGE#/webcam/g" /usr/share/debhelper/autoscripts/prerm-doc >> debian/webcam.prerm.debhelper
+ echo '# End automatically added section' >> debian/webcam.prerm.debhelper
+ install -g 0 -o 0 -d debian/alevtd/usr/share/doc/alevtd
+ install -g 0 -o 0 -m 644 -p debian/copyright debian/alevtd/usr/share/doc/alevtd/copyright
+ echo "# Automatically added by dh_installdocs">> debian/alevtd.postinst.debhelper
+ sed "s/#PACKAGE#/alevtd/g" /usr/share/debhelper/autoscripts/postinst-doc >> debian/alevtd.postinst.debhelper
+ echo '# End automatically added section' >> debian/alevtd.postinst.debhelper
+ echo "# Automatically added by dh_installdocs">> debian/alevtd.prerm.debhelper
+ sed "s/#PACKAGE#/alevtd/g" /usr/share/debhelper/autoscripts/prerm-doc >> debian/alevtd.prerm.debhelper
+ echo '# End automatically added section' >> debian/alevtd.prerm.debhelper
+dh_installdocs -p xawtv-tools tools/README
+ cp -a tools/README debian/xawtv-tools/usr/share/doc/xawtv-tools/
+ chown -R 0.0 debian/xawtv-tools/usr/share/doc
+ chmod -R go=rX debian/xawtv-tools/usr/share/doc
+ chmod -R u\+rw debian/xawtv-tools/usr/share/doc
+ install -g 0 -o 0 -m 644 -p debian/copyright debian/xawtv-tools/usr/share/doc/xawtv-tools/copyright
+ echo "# Automatically added by dh_installdocs">> debian/xawtv-tools.postinst.debhelper
+ sed "s/#PACKAGE#/xawtv-tools/g" /usr/share/debhelper/autoscripts/postinst-doc >> debian/xawtv-tools.postinst.debhelper
+ echo '# End automatically added section' >> debian/xawtv-tools.postinst.debhelper
+ echo "# Automatically added by dh_installdocs">> debian/xawtv-tools.prerm.debhelper
+ sed "s/#PACKAGE#/xawtv-tools/g" /usr/share/debhelper/autoscripts/prerm-doc >> debian/xawtv-tools.prerm.debhelper
+ echo '# End automatically added section' >> debian/xawtv-tools.prerm.debhelper
+dh_installdocs -p webcam webcam/webcam.cgi
+ cp -a webcam/webcam.cgi debian/webcam/usr/share/doc/webcam/
+ chown -R 0.0 debian/webcam/usr/share/doc
+ chmod -R go=rX debian/webcam/usr/share/doc
+ chmod -R u\+rw debian/webcam/usr/share/doc
+ install -g 0 -o 0 -m 644 -p debian/copyright debian/webcam/usr/share/doc/webcam/copyright
+ echo "# Automatically added by dh_installdocs">> debian/webcam.postinst.debhelper
+ sed "s/#PACKAGE#/webcam/g" /usr/share/debhelper/autoscripts/postinst-doc >> debian/webcam.postinst.debhelper
+ echo '# End automatically added section' >> debian/webcam.postinst.debhelper
+ echo "# Automatically added by dh_installdocs">> debian/webcam.prerm.debhelper
+ sed "s/#PACKAGE#/webcam/g" /usr/share/debhelper/autoscripts/prerm-doc >> debian/webcam.prerm.debhelper
+ echo '# End automatically added section' >> debian/webcam.prerm.debhelper
+dh_installmenu
+ install -d debian/tmp/usr/lib/menu
+ install -p -m644 debian/menu debian/tmp/usr/lib/menu/xawtv
+ echo "# Automatically added by dh_installmenu">> debian/postinst.debhelper
+ sed "" /usr/share/debhelper/autoscripts/postinst-menu >> debian/postinst.debhelper
+ echo '# End automatically added section' >> debian/postinst.debhelper
+ echo "# Automatically added by dh_installmenu">> debian/postrm.debhelper
+ sed "" /usr/share/debhelper/autoscripts/postrm-menu >> debian/postrm.debhelper
+ echo '# End automatically added section' >> debian/postrm.debhelper
+ install -d debian/fbtv/usr/lib/menu
+ install -p -m644 debian/fbtv.menu debian/fbtv/usr/lib/menu/fbtv
+ echo "# Automatically added by dh_installmenu">> debian/fbtv.postinst.debhelper
+ sed "" /usr/share/debhelper/autoscripts/postinst-menu >> debian/fbtv.postinst.debhelper
+ echo '# End automatically added section' >> debian/fbtv.postinst.debhelper
+ echo "# Automatically added by dh_installmenu">> debian/fbtv.postrm.debhelper
+ sed "" /usr/share/debhelper/autoscripts/postrm-menu >> debian/fbtv.postrm.debhelper
+ echo '# End automatically added section' >> debian/fbtv.postrm.debhelper
+ install -d debian/radio/usr/lib/menu
+ install -p -m644 debian/radio.menu debian/radio/usr/lib/menu/radio
+ echo "# Automatically added by dh_installmenu">> debian/radio.postinst.debhelper
+ sed "" /usr/share/debhelper/autoscripts/postinst-menu >> debian/radio.postinst.debhelper
+ echo '# End automatically added section' >> debian/radio.postinst.debhelper
+ echo "# Automatically added by dh_installmenu">> debian/radio.postrm.debhelper
+ sed "" /usr/share/debhelper/autoscripts/postrm-menu >> debian/radio.postrm.debhelper
+ echo '# End automatically added section' >> debian/radio.postrm.debhelper
+dh_undocumented -p xawtv scantv.1
+ ln -sf ../man7/undocumented.7.gz debian/tmp/usr/share/man/man1/scantv.1.gz
+dh_undocumented -p xawtv-tools record.1 dump-mixers.1
+ ln -sf ../man7/undocumented.7.gz debian/xawtv-tools/usr/share/man/man1/record.1.gz
+ ln -sf ../man7/undocumented.7.gz debian/xawtv-tools/usr/share/man/man1/dump-mixers.1.gz
+dh_undocumented -p streamer streamer.1
+ install -d debian/streamer/usr/share/man/man1
+ ln -sf ../man7/undocumented.7.gz debian/streamer/usr/share/man/man1/streamer.1.gz
+dh_installchangelogs
+ install -o 0 -g 0 -p -m644 debian/changelog debian/tmp/usr/share/doc/xawtv/changelog
+ install -o 0 -g 0 -p -m644 debian/changelog debian/fbtv/usr/share/doc/fbtv/changelog
+ install -o 0 -g 0 -p -m644 debian/changelog debian/streamer/usr/share/doc/streamer/changelog
+ install -o 0 -g 0 -p -m644 debian/changelog debian/radio/usr/share/doc/radio/changelog
+ install -o 0 -g 0 -p -m644 debian/changelog debian/v4l-conf/usr/share/doc/v4l-conf/changelog
+ install -o 0 -g 0 -p -m644 debian/changelog debian/xawtv-tools/usr/share/doc/xawtv-tools/changelog
+ install -o 0 -g 0 -p -m644 debian/changelog debian/webcam/usr/share/doc/webcam/changelog
+ install -o 0 -g 0 -p -m644 debian/changelog debian/alevtd/usr/share/doc/alevtd/changelog
+dh_compress
+ cd debian/tmp
+ chmod a-x usr/share/man/man1/rootv.1 usr/share/man/man1/v4lctl.1 usr/share/man/man1/xawtv-remote.1 usr/share/man/man1/xawtv.1 usr/share/doc/xawtv/README usr/share/doc/xawtv/README.bttv usr/share/doc/xawtv/Changes usr/share/doc/xawtv/Trouble-Shooting usr/share/doc/xawtv/frequencies-europe usr/share/doc/xawtv/changelog
+ gzip -9f usr/share/man/man1/rootv.1 usr/share/man/man1/v4lctl.1 usr/share/man/man1/xawtv-remote.1 usr/share/man/man1/xawtv.1 usr/share/doc/xawtv/README usr/share/doc/xawtv/README.bttv usr/share/doc/xawtv/Changes usr/share/doc/xawtv/Trouble-Shooting usr/share/doc/xawtv/frequencies-europe usr/share/doc/xawtv/changelog
+ cd /home/kraxel/debian/xawtv-3.20
+ cd debian/fbtv
+ chmod a-x usr/share/man/man1/fbtv.1 usr/share/doc/fbtv/changelog
+ gzip -9f usr/share/man/man1/fbtv.1 usr/share/doc/fbtv/changelog
+ cd /home/kraxel/debian/xawtv-3.20
+ cd debian/streamer
+ chmod a-x usr/share/doc/streamer/changelog
+ gzip -9f usr/share/doc/streamer/changelog
+ cd /home/kraxel/debian/xawtv-3.20
+ cd debian/radio
+ chmod a-x usr/share/man/man1/radio.1 usr/share/doc/radio/changelog
+ gzip -9f usr/share/man/man1/radio.1 usr/share/doc/radio/changelog
+ cd /home/kraxel/debian/xawtv-3.20
+ cd debian/v4l-conf
+ chmod a-x usr/share/man/man1/v4l-conf.1 usr/share/doc/v4l-conf/changelog
+ gzip -9f usr/share/man/man1/v4l-conf.1 usr/share/doc/v4l-conf/changelog
+ cd /home/kraxel/debian/xawtv-3.20
+ cd debian/xawtv-tools
+ chmod a-x usr/share/man/man1/propwatch.1 usr/share/man/man1/showriff.1 usr/share/doc/xawtv-tools/changelog
+ gzip -9f usr/share/man/man1/propwatch.1 usr/share/man/man1/showriff.1 usr/share/doc/xawtv-tools/changelog
+ cd /home/kraxel/debian/xawtv-3.20
+ cd debian/webcam
+ chmod a-x usr/share/man/man1/webcam.1 usr/share/doc/webcam/changelog
+ gzip -9f usr/share/man/man1/webcam.1 usr/share/doc/webcam/changelog
+ cd /home/kraxel/debian/xawtv-3.20
+ cd debian/alevtd
+ chmod a-x usr/share/man/man1/alevtd.1 usr/share/doc/alevtd/changelog
+ gzip -9f usr/share/man/man1/alevtd.1 usr/share/doc/alevtd/changelog
+ cd /home/kraxel/debian/xawtv-3.20
+dh_fixperms
+ find debian/tmp -print0 2>/dev/null | xargs -0r chown --no-dereference 0.0
+ find debian/tmp ! -type l -print0 2>/dev/null | xargs -0r chmod go=rX,u+rw,a-s
+ find debian/tmp/usr/share/doc debian/tmp/usr/doc -type f ! -regex '.*/examples/.*' -print0 2>/dev/null | xargs -0r chmod 644
+ find debian/tmp/usr/share/doc debian/tmp/usr/doc -type d -print0 2>/dev/null | xargs -0r chmod 755
+ find debian/tmp/usr/share/man debian/tmp/usr/man/ debian/tmp/usr/X11*/man/ -type f -print0 2>/dev/null | xargs -0r chmod 644
+ find debian/tmp -perm -5 -type f \( -name '*.so*' -or -name '*.la' -or -name '*.a' \) -print0 2>/dev/null | xargs -0r chmod a-X
+ find debian/fbtv -print0 2>/dev/null | xargs -0r chown --no-dereference 0.0
+ find debian/fbtv ! -type l -print0 2>/dev/null | xargs -0r chmod go=rX,u+rw,a-s
+ find debian/fbtv/usr/share/doc debian/fbtv/usr/doc -type f ! -regex '.*/examples/.*' -print0 2>/dev/null | xargs -0r chmod 644
+ find debian/fbtv/usr/share/doc debian/fbtv/usr/doc -type d -print0 2>/dev/null | xargs -0r chmod 755
+ find debian/fbtv/usr/share/man debian/fbtv/usr/man/ debian/fbtv/usr/X11*/man/ -type f -print0 2>/dev/null | xargs -0r chmod 644
+ find debian/fbtv -perm -5 -type f \( -name '*.so*' -or -name '*.la' -or -name '*.a' \) -print0 2>/dev/null | xargs -0r chmod a-X
+ find debian/streamer -print0 2>/dev/null | xargs -0r chown --no-dereference 0.0
+ find debian/streamer ! -type l -print0 2>/dev/null | xargs -0r chmod go=rX,u+rw,a-s
+ find debian/streamer/usr/share/doc debian/streamer/usr/doc -type f ! -regex '.*/examples/.*' -print0 2>/dev/null | xargs -0r chmod 644
+ find debian/streamer/usr/share/doc debian/streamer/usr/doc -type d -print0 2>/dev/null | xargs -0r chmod 755
+ find debian/streamer/usr/share/man debian/streamer/usr/man/ debian/streamer/usr/X11*/man/ -type f -print0 2>/dev/null | xargs -0r chmod 644
+ find debian/streamer -perm -5 -type f \( -name '*.so*' -or -name '*.la' -or -name '*.a' \) -print0 2>/dev/null | xargs -0r chmod a-X
+ find debian/radio -print0 2>/dev/null | xargs -0r chown --no-dereference 0.0
+ find debian/radio ! -type l -print0 2>/dev/null | xargs -0r chmod go=rX,u+rw,a-s
+ find debian/radio/usr/share/doc debian/radio/usr/doc -type f ! -regex '.*/examples/.*' -print0 2>/dev/null | xargs -0r chmod 644
+ find debian/radio/usr/share/doc debian/radio/usr/doc -type d -print0 2>/dev/null | xargs -0r chmod 755
+ find debian/radio/usr/share/man debian/radio/usr/man/ debian/radio/usr/X11*/man/ -type f -print0 2>/dev/null | xargs -0r chmod 644
+ find debian/radio -perm -5 -type f \( -name '*.so*' -or -name '*.la' -or -name '*.a' \) -print0 2>/dev/null | xargs -0r chmod a-X
+ find debian/v4l-conf -print0 2>/dev/null | xargs -0r chown --no-dereference 0.0
+ find debian/v4l-conf ! -type l -print0 2>/dev/null | xargs -0r chmod go=rX,u+rw,a-s
+ find debian/v4l-conf/usr/share/doc debian/v4l-conf/usr/doc -type f ! -regex '.*/examples/.*' -print0 2>/dev/null | xargs -0r chmod 644
+ find debian/v4l-conf/usr/share/doc debian/v4l-conf/usr/doc -type d -print0 2>/dev/null | xargs -0r chmod 755
+ find debian/v4l-conf/usr/share/man debian/v4l-conf/usr/man/ debian/v4l-conf/usr/X11*/man/ -type f -print0 2>/dev/null | xargs -0r chmod 644
+ find debian/v4l-conf -perm -5 -type f \( -name '*.so*' -or -name '*.la' -or -name '*.a' \) -print0 2>/dev/null | xargs -0r chmod a-X
+ find debian/xawtv-tools -print0 2>/dev/null | xargs -0r chown --no-dereference 0.0
+ find debian/xawtv-tools ! -type l -print0 2>/dev/null | xargs -0r chmod go=rX,u+rw,a-s
+ find debian/xawtv-tools/usr/share/doc debian/xawtv-tools/usr/doc -type f ! -regex '.*/examples/.*' -print0 2>/dev/null | xargs -0r chmod 644
+ find debian/xawtv-tools/usr/share/doc debian/xawtv-tools/usr/doc -type d -print0 2>/dev/null | xargs -0r chmod 755
+ find debian/xawtv-tools/usr/share/man debian/xawtv-tools/usr/man/ debian/xawtv-tools/usr/X11*/man/ -type f -print0 2>/dev/null | xargs -0r chmod 644
+ find debian/xawtv-tools -perm -5 -type f \( -name '*.so*' -or -name '*.la' -or -name '*.a' \) -print0 2>/dev/null | xargs -0r chmod a-X
+ find debian/webcam -print0 2>/dev/null | xargs -0r chown --no-dereference 0.0
+ find debian/webcam ! -type l -print0 2>/dev/null | xargs -0r chmod go=rX,u+rw,a-s
+ find debian/webcam/usr/share/doc debian/webcam/usr/doc -type f ! -regex '.*/examples/.*' -print0 2>/dev/null | xargs -0r chmod 644
+ find debian/webcam/usr/share/doc debian/webcam/usr/doc -type d -print0 2>/dev/null | xargs -0r chmod 755
+ find debian/webcam/usr/share/man debian/webcam/usr/man/ debian/webcam/usr/X11*/man/ -type f -print0 2>/dev/null | xargs -0r chmod 644
+ find debian/webcam -perm -5 -type f \( -name '*.so*' -or -name '*.la' -or -name '*.a' \) -print0 2>/dev/null | xargs -0r chmod a-X
+ find debian/alevtd -print0 2>/dev/null | xargs -0r chown --no-dereference 0.0
+ find debian/alevtd ! -type l -print0 2>/dev/null | xargs -0r chmod go=rX,u+rw,a-s
+ find debian/alevtd/usr/share/doc debian/alevtd/usr/doc -type f ! -regex '.*/examples/.*' -print0 2>/dev/null | xargs -0r chmod 644
+ find debian/alevtd/usr/share/doc debian/alevtd/usr/doc -type d -print0 2>/dev/null | xargs -0r chmod 755
+ find debian/alevtd/usr/share/man debian/alevtd/usr/man/ debian/alevtd/usr/X11*/man/ -type f -print0 2>/dev/null | xargs -0r chmod 644
+ find debian/alevtd -perm -5 -type f \( -name '*.so*' -or -name '*.la' -or -name '*.a' \) -print0 2>/dev/null | xargs -0r chmod a-X
+# You may want to make some executables suid here.
+dh_suidregister
+dh_installdeb
+ install -o 0 -g 0 -d debian/tmp/DEBIAN
+ perl -pe 's~#DEBHELPER#~qx{cat debian/postinst.debhelper}~eg' < debian/postinst > debian/tmp/DEBIAN/postinst
+ chown 0.0 debian/tmp/DEBIAN/postinst
+ chmod 755 debian/tmp/DEBIAN/postinst
+ echo '#!/bin/sh -e' > debian/tmp/DEBIAN/prerm
+ cat debian/prerm.debhelper >> debian/tmp/DEBIAN/prerm
+ chown 0.0 debian/tmp/DEBIAN/prerm
+ chmod 755 debian/tmp/DEBIAN/prerm
+ perl -pe 's~#DEBHELPER#~qx{cat debian/postrm.debhelper}~eg' < debian/postrm > debian/tmp/DEBIAN/postrm
+ chown 0.0 debian/tmp/DEBIAN/postrm
+ chmod 755 debian/tmp/DEBIAN/postrm
+ install -o 0 -g 0 -d debian/fbtv/DEBIAN
+ echo '#!/bin/sh -e' > debian/fbtv/DEBIAN/postinst
+ cat debian/fbtv.postinst.debhelper >> debian/fbtv/DEBIAN/postinst
+ chown 0.0 debian/fbtv/DEBIAN/postinst
+ chmod 755 debian/fbtv/DEBIAN/postinst
+ echo '#!/bin/sh -e' > debian/fbtv/DEBIAN/prerm
+ cat debian/fbtv.prerm.debhelper >> debian/fbtv/DEBIAN/prerm
+ chown 0.0 debian/fbtv/DEBIAN/prerm
+ chmod 755 debian/fbtv/DEBIAN/prerm
+ echo '#!/bin/sh -e' > debian/fbtv/DEBIAN/postrm
+ cat debian/fbtv.postrm.debhelper >> debian/fbtv/DEBIAN/postrm
+ chown 0.0 debian/fbtv/DEBIAN/postrm
+ chmod 755 debian/fbtv/DEBIAN/postrm
+ install -o 0 -g 0 -d debian/streamer/DEBIAN
+ echo '#!/bin/sh -e' > debian/streamer/DEBIAN/postinst
+ cat debian/streamer.postinst.debhelper >> debian/streamer/DEBIAN/postinst
+ chown 0.0 debian/streamer/DEBIAN/postinst
+ chmod 755 debian/streamer/DEBIAN/postinst
+ echo '#!/bin/sh -e' > debian/streamer/DEBIAN/prerm
+ cat debian/streamer.prerm.debhelper >> debian/streamer/DEBIAN/prerm
+ chown 0.0 debian/streamer/DEBIAN/prerm
+ chmod 755 debian/streamer/DEBIAN/prerm
+ install -o 0 -g 0 -d debian/radio/DEBIAN
+ echo '#!/bin/sh -e' > debian/radio/DEBIAN/postinst
+ cat debian/radio.postinst.debhelper >> debian/radio/DEBIAN/postinst
+ chown 0.0 debian/radio/DEBIAN/postinst
+ chmod 755 debian/radio/DEBIAN/postinst
+ echo '#!/bin/sh -e' > debian/radio/DEBIAN/prerm
+ cat debian/radio.prerm.debhelper >> debian/radio/DEBIAN/prerm
+ chown 0.0 debian/radio/DEBIAN/prerm
+ chmod 755 debian/radio/DEBIAN/prerm
+ echo '#!/bin/sh -e' > debian/radio/DEBIAN/postrm
+ cat debian/radio.postrm.debhelper >> debian/radio/DEBIAN/postrm
+ chown 0.0 debian/radio/DEBIAN/postrm
+ chmod 755 debian/radio/DEBIAN/postrm
+ install -o 0 -g 0 -d debian/v4l-conf/DEBIAN
+ echo '#!/bin/sh -e' > debian/v4l-conf/DEBIAN/postinst
+ cat debian/v4l-conf.postinst.debhelper >> debian/v4l-conf/DEBIAN/postinst
+ chown 0.0 debian/v4l-conf/DEBIAN/postinst
+ chmod 755 debian/v4l-conf/DEBIAN/postinst
+ echo '#!/bin/sh -e' > debian/v4l-conf/DEBIAN/prerm
+ cat debian/v4l-conf.prerm.debhelper >> debian/v4l-conf/DEBIAN/prerm
+ chown 0.0 debian/v4l-conf/DEBIAN/prerm
+ chmod 755 debian/v4l-conf/DEBIAN/prerm
+ install -o 0 -g 0 -d debian/xawtv-tools/DEBIAN
+ echo '#!/bin/sh -e' > debian/xawtv-tools/DEBIAN/postinst
+ cat debian/xawtv-tools.postinst.debhelper >> debian/xawtv-tools/DEBIAN/postinst
+ chown 0.0 debian/xawtv-tools/DEBIAN/postinst
+ chmod 755 debian/xawtv-tools/DEBIAN/postinst
+ echo '#!/bin/sh -e' > debian/xawtv-tools/DEBIAN/prerm
+ cat debian/xawtv-tools.prerm.debhelper >> debian/xawtv-tools/DEBIAN/prerm
+ chown 0.0 debian/xawtv-tools/DEBIAN/prerm
+ chmod 755 debian/xawtv-tools/DEBIAN/prerm
+ install -o 0 -g 0 -d debian/webcam/DEBIAN
+ echo '#!/bin/sh -e' > debian/webcam/DEBIAN/postinst
+ cat debian/webcam.postinst.debhelper >> debian/webcam/DEBIAN/postinst
+ chown 0.0 debian/webcam/DEBIAN/postinst
+ chmod 755 debian/webcam/DEBIAN/postinst
+ echo '#!/bin/sh -e' > debian/webcam/DEBIAN/prerm
+ cat debian/webcam.prerm.debhelper >> debian/webcam/DEBIAN/prerm
+ chown 0.0 debian/webcam/DEBIAN/prerm
+ chmod 755 debian/webcam/DEBIAN/prerm
+ install -o 0 -g 0 -d debian/alevtd/DEBIAN
+ echo '#!/bin/sh -e' > debian/alevtd/DEBIAN/postinst
+ cat debian/alevtd.postinst.debhelper >> debian/alevtd/DEBIAN/postinst
+ chown 0.0 debian/alevtd/DEBIAN/postinst
+ chmod 755 debian/alevtd/DEBIAN/postinst
+ echo '#!/bin/sh -e' > debian/alevtd/DEBIAN/prerm
+ cat debian/alevtd.prerm.debhelper >> debian/alevtd/DEBIAN/prerm
+ chown 0.0 debian/alevtd/DEBIAN/prerm
+ chmod 755 debian/alevtd/DEBIAN/prerm
+dh_shlibdeps
+dpkg-shlibdeps: warning: unable to find dependency information for shared library /usr/lib/libfakeroot/libfakeroot (soname 0, path /usr/lib/libfakeroot/libfakeroot.so.0, dependency field Depends)
+dpkg-shlibdeps: warning: unable to find dependency information for shared library /usr/lib/libfakeroot/libfakeroot (soname 0, path /usr/lib/libfakeroot/libfakeroot.so.0, dependency field Depends)
+dpkg-shlibdeps: warning: unable to find dependency information for shared library /usr/lib/libfakeroot/libfakeroot (soname 0, path /usr/lib/libfakeroot/libfakeroot.so.0, dependency field Depends)
+dpkg-shlibdeps: warning: unable to find dependency information for shared library /usr/lib/libfakeroot/libfakeroot (soname 0, path /usr/lib/libfakeroot/libfakeroot.so.0, dependency field Depends)
+dpkg-shlibdeps: warning: unable to find dependency information for shared library /usr/lib/libfakeroot/libfakeroot (soname 0, path /usr/lib/libfakeroot/libfakeroot.so.0, dependency field Depends)
+dpkg-shlibdeps: warning: unable to find dependency information for shared library /usr/lib/libfakeroot/libfakeroot (soname 0, path /usr/lib/libfakeroot/libfakeroot.so.0, dependency field Depends)
+dpkg-shlibdeps: warning: unable to find dependency information for shared library /usr/lib/libfakeroot/libfakeroot (soname 0, path /usr/lib/libfakeroot/libfakeroot.so.0, dependency field Depends)
+dpkg-shlibdeps: warning: unable to find dependency information for shared library /usr/lib/libfakeroot/libfakeroot (soname 0, path /usr/lib/libfakeroot/libfakeroot.so.0, dependency field Depends)
+dpkg-shlibdeps: warning: unable to find dependency information for shared library /usr/lib/libfakeroot/libfakeroot (soname 0, path /usr/lib/libfakeroot/libfakeroot.so.0, dependency field Depends)
+dpkg-shlibdeps: warning: unable to find dependency information for shared library /usr/lib/libfakeroot/libfakeroot (soname 0, path /usr/lib/libfakeroot/libfakeroot.so.0, dependency field Depends)
+dpkg-shlibdeps: warning: unable to find dependency information for shared library /usr/lib/libfakeroot/libfakeroot (soname 0, path /usr/lib/libfakeroot/libfakeroot.so.0, dependency field Depends)
+dpkg-shlibdeps: warning: unable to find dependency information for shared library /usr/lib/libfakeroot/libfakeroot (soname 0, path /usr/lib/libfakeroot/libfakeroot.so.0, dependency field Depends)
+dpkg-shlibdeps: warning: unable to find dependency information for shared library /usr/lib/libfakeroot/libfakeroot (soname 0, path /usr/lib/libfakeroot/libfakeroot.so.0, dependency field Depends)
+dpkg-shlibdeps: warning: unable to find dependency information for shared library /usr/lib/libfakeroot/libfakeroot (soname 0, path /usr/lib/libfakeroot/libfakeroot.so.0, dependency field Depends)
+dpkg-shlibdeps: warning: unable to find dependency information for shared library /usr/lib/libfakeroot/libfakeroot (soname 0, path /usr/lib/libfakeroot/libfakeroot.so.0, dependency field Depends)
+ dpkg-shlibdeps -Tdebian/substvars -dDepends debian/tmp/usr/bin/xawtv debian/tmp/usr/bin/xawtv-remote debian/tmp/usr/bin/v4lctl debian/tmp/usr/bin/rootv debian/tmp/usr/bin/scantv
+ dpkg-shlibdeps -Tdebian/fbtv.substvars -dDepends debian/fbtv/usr/bin/fbtv
+ dpkg-shlibdeps -Tdebian/streamer.substvars -dDepends debian/streamer/usr/bin/streamer
+ dpkg-shlibdeps -Tdebian/radio.substvars -dDepends debian/radio/usr/bin/radio
+ dpkg-shlibdeps -Tdebian/v4l-conf.substvars -dDepends debian/v4l-conf/usr/bin/v4l-conf
+ dpkg-shlibdeps -Tdebian/xawtv-tools.substvars -dDepends debian/xawtv-tools/usr/bin/showriff debian/xawtv-tools/usr/bin/propwatch debian/xawtv-tools/usr/bin/dump-mixers debian/xawtv-tools/usr/bin/record
+ dpkg-shlibdeps -Tdebian/webcam.substvars -dDepends debian/webcam/usr/bin/webcam
+ dpkg-shlibdeps -Tdebian/alevtd.substvars -dDepends debian/alevtd/usr/bin/alevtd
+dh_gencontrol
+ install -o 0 -g 0 -d debian/tmp/DEBIAN
+ dpkg-gencontrol -ldebian/changelog -isp -pxawtv -Tdebian/substvars -Pdebian/tmp
+ chmod 644 debian/tmp/DEBIAN/control
+ chown 0.0 debian/tmp/DEBIAN/control
+ install -o 0 -g 0 -d debian/fbtv/DEBIAN
+ dpkg-gencontrol -ldebian/changelog -isp -pfbtv -Tdebian/fbtv.substvars -Pdebian/fbtv
+ chmod 644 debian/fbtv/DEBIAN/control
+ chown 0.0 debian/fbtv/DEBIAN/control
+ install -o 0 -g 0 -d debian/streamer/DEBIAN
+ dpkg-gencontrol -ldebian/changelog -isp -pstreamer -Tdebian/streamer.substvars -Pdebian/streamer
+ chmod 644 debian/streamer/DEBIAN/control
+ chown 0.0 debian/streamer/DEBIAN/control
+ install -o 0 -g 0 -d debian/radio/DEBIAN
+ dpkg-gencontrol -ldebian/changelog -isp -pradio -Tdebian/radio.substvars -Pdebian/radio
+ chmod 644 debian/radio/DEBIAN/control
+ chown 0.0 debian/radio/DEBIAN/control
+ install -o 0 -g 0 -d debian/v4l-conf/DEBIAN
+ dpkg-gencontrol -ldebian/changelog -isp -pv4l-conf -Tdebian/v4l-conf.substvars -Pdebian/v4l-conf
+ chmod 644 debian/v4l-conf/DEBIAN/control
+ chown 0.0 debian/v4l-conf/DEBIAN/control
+ install -o 0 -g 0 -d debian/xawtv-tools/DEBIAN
+ dpkg-gencontrol -ldebian/changelog -isp -pxawtv-tools -Tdebian/xawtv-tools.substvars -Pdebian/xawtv-tools
+ chmod 644 debian/xawtv-tools/DEBIAN/control
+ chown 0.0 debian/xawtv-tools/DEBIAN/control
+ install -o 0 -g 0 -d debian/webcam/DEBIAN
+ dpkg-gencontrol -ldebian/changelog -isp -pwebcam -Tdebian/webcam.substvars -Pdebian/webcam
+ chmod 644 debian/webcam/DEBIAN/control
+ chown 0.0 debian/webcam/DEBIAN/control
+ install -o 0 -g 0 -d debian/alevtd/DEBIAN
+ dpkg-gencontrol -ldebian/changelog -isp -palevtd -Tdebian/alevtd.substvars -Pdebian/alevtd
+ chmod 644 debian/alevtd/DEBIAN/control
+ chown 0.0 debian/alevtd/DEBIAN/control
+dh_md5sums
+ cd debian/tmp >/dev/null ; find * -type f ! -regex '^DEBIAN/.*' -print0 | xargs -r0 md5sum > DEBIAN/md5sums ; cd /home/kraxel/debian/xawtv-3.20 >/dev/null
+ chmod 644 debian/tmp/DEBIAN/md5sums
+ chown 0.0 debian/tmp/DEBIAN/md5sums
+ cd debian/fbtv >/dev/null ; find * -type f ! -regex '^DEBIAN/.*' -print0 | xargs -r0 md5sum > DEBIAN/md5sums ; cd /home/kraxel/debian/xawtv-3.20 >/dev/null
+ chmod 644 debian/fbtv/DEBIAN/md5sums
+ chown 0.0 debian/fbtv/DEBIAN/md5sums
+ cd debian/streamer >/dev/null ; find * -type f ! -regex '^DEBIAN/.*' -print0 | xargs -r0 md5sum > DEBIAN/md5sums ; cd /home/kraxel/debian/xawtv-3.20 >/dev/null
+ chmod 644 debian/streamer/DEBIAN/md5sums
+ chown 0.0 debian/streamer/DEBIAN/md5sums
+ cd debian/radio >/dev/null ; find * -type f ! -regex '^DEBIAN/.*' -print0 | xargs -r0 md5sum > DEBIAN/md5sums ; cd /home/kraxel/debian/xawtv-3.20 >/dev/null
+ chmod 644 debian/radio/DEBIAN/md5sums
+ chown 0.0 debian/radio/DEBIAN/md5sums
+ cd debian/v4l-conf >/dev/null ; find * -type f ! -regex '^DEBIAN/.*' -print0 | xargs -r0 md5sum > DEBIAN/md5sums ; cd /home/kraxel/debian/xawtv-3.20 >/dev/null
+ chmod 644 debian/v4l-conf/DEBIAN/md5sums
+ chown 0.0 debian/v4l-conf/DEBIAN/md5sums
+ cd debian/xawtv-tools >/dev/null ; find * -type f ! -regex '^DEBIAN/.*' -print0 | xargs -r0 md5sum > DEBIAN/md5sums ; cd /home/kraxel/debian/xawtv-3.20 >/dev/null
+ chmod 644 debian/xawtv-tools/DEBIAN/md5sums
+ chown 0.0 debian/xawtv-tools/DEBIAN/md5sums
+ cd debian/webcam >/dev/null ; find * -type f ! -regex '^DEBIAN/.*' -print0 | xargs -r0 md5sum > DEBIAN/md5sums ; cd /home/kraxel/debian/xawtv-3.20 >/dev/null
+ chmod 644 debian/webcam/DEBIAN/md5sums
+ chown 0.0 debian/webcam/DEBIAN/md5sums
+ cd debian/alevtd >/dev/null ; find * -type f ! -regex '^DEBIAN/.*' -print0 | xargs -r0 md5sum > DEBIAN/md5sums ; cd /home/kraxel/debian/xawtv-3.20 >/dev/null
+ chmod 644 debian/alevtd/DEBIAN/md5sums
+ chown 0.0 debian/alevtd/DEBIAN/md5sums
+dh_builddeb
+dpkg-deb: building package `xawtv' in `../xawtv_3.20_powerpc.deb'.
+dpkg-deb: building package `fbtv' in `../fbtv_3.20_powerpc.deb'.
+dpkg-deb: building package `streamer' in `../streamer_3.20_powerpc.deb'.
+dpkg-deb: building package `radio' in `../radio_3.20_powerpc.deb'.
+dpkg-deb: building package `v4l-conf' in `../v4l-conf_3.20_powerpc.deb'.
+dpkg-deb: building package `xawtv-tools' in `../xawtv-tools_3.20_powerpc.deb'.
+dpkg-deb: building package `webcam' in `../webcam_3.20_powerpc.deb'.
+dpkg-deb: building package `alevtd' in `../alevtd_3.20_powerpc.deb'.
+ dpkg --build debian/tmp ..
+ dpkg --build debian/fbtv ..
+ dpkg --build debian/streamer ..
+ dpkg --build debian/radio ..
+ dpkg --build debian/v4l-conf ..
+ dpkg --build debian/xawtv-tools ..
+ dpkg --build debian/webcam ..
+ dpkg --build debian/alevtd ..
+ dpkg-genchanges
+dpkg-genchanges: including full source code in upload
+dpkg-buildpackage: Debian-specific package; upload is full source
diff --git a/man/Makefile.in b/man/Makefile.in
index 9b8a0b0..b318dc9 100644
--- a/man/Makefile.in
+++ b/man/Makefile.in
@@ -1,14 +1,14 @@
srcdir=@srcdir@
ROOT=
-prefix=$(ROOT)@prefix@
-mandir=$(prefix)/man
+prefix=@prefix@
+mandir=$(ROOT)@mandir@
INSTALL=@INSTALL@
INSTALL_DATA=@INSTALL_DATA@
INSTALL_DIR=mkdir -p
-all:
+all build:
install: all
$(INSTALL_DIR) $(mandir)/man1
@@ -18,10 +18,10 @@ install: all
done
clean:
- -rm -f *.o *.moc *~ core* *.bak TAGS
+ -rm -f *.o core* TAGS
distclean realclean: clean
- -rm -f Makefile
+ -rm -f Makefile *~ *.bak
dep depend:
diff --git a/man/fbtv.man b/man/fbtv.man
index 8cc1d5c..59e59a5 100644
--- a/man/fbtv.man
+++ b/man/fbtv.man
@@ -39,7 +39,8 @@ x
size in the upper right corner.
.TP
.B -f font
-font for text. default is /usr/lib/kbd/consolefonts/lat1-16.psf.
+font for text. Default is to look for lat1-16.psf in
+/usr/lib/kbd/consolefonts and /usr/share/consolefonts.
.TP
.B -m mode
video mode for TV. fbtv will look up the mode in /etc/fb.modes.
@@ -60,8 +61,8 @@ at runtime too ('F').
.B -M
EXPERIMENTAL: Turn on backend scaler mode (write yuv to offscreen
memory and let the gfx board scale up the video). Supported hardware:
-Matrox G200 (with matroxfb) and ATI Mach64 VT/GT (with atyfb, 16bpp
-only). You'll need at least bttv-0.7.11 or kernel 2.3.34.
+Matrox G200/G400 (with matroxfb) and ATI Mach64 VT/GT (with atyfb,
+16bpp only). You'll need at least bttv-0.7.16 or kernel 2.3.50.
.SH USAGE
fbtv is supported to work much like xawtv from user's point of view.
You might have noticed that xawtv has alot of keyboard shortcuts.
diff --git a/man/rootv.man b/man/rootv.man
new file mode 100644
index 0000000..8a84ddd
--- /dev/null
+++ b/man/rootv.man
@@ -0,0 +1,34 @@
+.TH rootv 1 "(c) 2000 Gerd Knorr"
+.SH NAME
+rootv - display TV/video as root window background
+.SH SYNOPSIS
+.B rootv [ -stop | -wm ]
+.SH DESCRIPTION
+.B rootv
+puts a video to the root window of your display. Requires the Xvideo
+extention. If started with -stop the video will be stopped.
+.P
+rootv itself provides no way to control video/audio/tuner. You can
+use v4lctl to do this. You can stick v4lctl calls into your window
+manager menus for example. "rootv -wm" will build a WindowMaker
+menu with all TV stations from the ~/.xawtv config file.
+.SH SEE ALSO
+xawtv(1), fbtv(1), v4lctl(1)
+.SH AUTHOR
+Gerd Knorr <kraxel@goldbach.in-berlin.de>
+.SH COPYRIGHT
+Copyright (C) 2000 Gerd Knorr <kraxel@goldbach.in-berlin.de>
+.P
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+.P
+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.
+.P
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
diff --git a/man/xawtv-remote.man b/man/xawtv-remote.man
index 4d964d0..e2d7f7e 100644
--- a/man/xawtv-remote.man
+++ b/man/xawtv-remote.man
@@ -1,6 +1,6 @@
.TH xawtv-remote 1 "(c) 1997-99 Gerd Knorr"
.SH NAME
-xxx
+xawtv-remote, v4lctl -- control video4linux devices
.SH SYNOPSIS
.B xawtv-remote [ options ] command
.br
@@ -84,11 +84,33 @@ accepted too and increase/decrease the parameter by one percent.
.B snap [ jpeg | ppm ] [ full | win | widthxheight ] <filename>
Capture one image.
.TP
+.B webcam <filename>
+Capture one image. Does basically the same as "snap jpeg win
+<filename>". Works also while avi recording is active. It writes
+to a temporary file and renames it when done, so there is never
+a invalid file.
+.TP
+.B movie file <filename> | start | stop
+control xawtv's avi recorder.
+.TP
.B fullscreen
Toggle fullscreen mode.
.TP
.B msg text
-Display text on the on-screen display.
+Display text on the on-screen display (window title / upper left corner in
+fullscreen mode).
+.TP
+.B vtx line1 line2 [ ... ]
+Display subtitles. It pops up a small window at the bottom of the screen.
+It is supported to be used as interface for displaying subtitles (often on
+videotext page 150 in europe, thats why the name) by external programs.
+.br
+Every command line argument is one line, zero lines removes the window.
+You can colorize the text with the control sequence "ESC foreground
+background". foreground/background has the range 0-7 (ansi term colors).
+Example: "\\03347 hello world " is blue on white. "\\033" must be a real
+escape character, the string does'nt work. With the bash you'll get it
+with ^V ESC.
.TP
.B quit
quit xawtv
diff --git a/man/xawtv.man b/man/xawtv.man
index cefab48..d36c3d4 100644
--- a/man/xawtv.man
+++ b/man/xawtv.man
@@ -11,10 +11,12 @@ Athena widgets.
supports the bttv driver, v4l (video4linux, included in 2.2.x) and the
Xvideo extention.
.P
-.B xawtv
-reads the config file $HOME/.xawtv at startup. This file holds the
-available TV stations and a few settings like TV norm. You have to
-create the config file yourself, see below for details.
+.B xawtv
+reads the config files /usr/X11R6/lib/X11/xawtvrc and $HOME/.xawtv at
+startup. Settings in the personal config file will overwrite the
+options from the global config file. These files holds the available
+TV stations and a few settings like TV norm. You have to create the
+config file yourself, see below for details.
.SH OPTIONS
.TP
\fB-h\fP, \fB-help\fP
@@ -23,9 +25,6 @@ Print a short desctiption of all command line options.
\fB-f\fP, \fB-fullscreen\fP
startup in fullscreen mode.
.TP
-\fB-m\fP, \fB-nomouse\fP
-startup with mouse pointer turned off.
-.TP
\fB-n\fP, \fB-noconf\fP
don't read the config file ($HOME/.xawtv).
.TP
@@ -36,6 +35,9 @@ set basestring for the snapshot output files. The filename will be
\fB-c\fP, \fB-device\fP device
set video4linux device (default is /dev/video).
.TP
+\fB-c\fP, \fB-xvport\fP number
+set Xvideo port (defaults to the first usable).
+.TP
\fB-v\fP, \fB-debug\fP level
Be verbose,
.B level
@@ -60,17 +62,40 @@ This gets passed throuth to v4l-conf(1) too.
.TP
\fB-fb\fP
Use the framebuffer device to determine the video framebuffer address
-(instead of the DGA extention). Yet another pass throuthb argument.
+(instead of the DGA extention). Yet another pass throuth argument.
+.TP
+\fB-xv/-noxv \fP
+enable/disable the usage of the Xvideo extention (for overlay),
+default is on.
+.TP
+\fB-scale/-noscale \fP
+enable/disable the usage of the Xvideo extention (for hardware scaling
+in grabdisplay mode), default is on.
.TP
-\fB-noxv\fP
-disable the usage of the Xvideo extention.
+\fB-vm/-novm\fP
+enable/disable the usage of the VidMode extention, default is off.
+If there is a fullscreen video mode configured in the config file,
+the vidmode extention will be enabled automatically.
.TP
-\fB-novm\fP
-disable the usage of the VidMode extention. If you have trouble with
-fullscreen mode, try this one.
+\fB-dga/-nodga\fP
+enable/disable the usage of the DGA extention, default is on.
+.P
+The usual Toolkit options like \fB-geometry\fP are supported too.
+.SH RESOURCES
+\fBxawtv\fP understands all of the core X Toolkit resource names and
+classes as well as:
+.TP
+\fBdevice\fP
+video4linux device
+.TP
+\fBxvideo\fP (bool)
+enable/disable the usage of the Xvideo extention.
.TP
-\fB-nodga\fP
-disable the usage of the DGA extention.
+\fBvidmode\fP (bool)
+enable/disable the usage of the VidMode extention.
+.TP
+\fBdga\fP (bool)
+enable/disable the usage of the DGA extention.
.SH GETTING STARTED
Just start up xawtv, this will work without a config file too. Then
check out the options (right mouse button) and adjust the settings
@@ -92,7 +117,6 @@ functions.
.nf
V \fBV\fPideo (Capture) on/off
A \fBA\fPudio on/off
-M \fBM\fPouse pointer on/off
F \fBF\fPullscreen on/off
G \fBG\fPrab picture (full size, ppm)
J Grab picture (full size, \fBj\fPpeg)
@@ -116,8 +140,8 @@ Ctrl+up scan for next station
ESC,Q \fBQ\fPuit
-+/- Volume up/down
-Enter mute
++/- Volume up/down (keypad)
+Enter mute (keypad)
.fi
.SS config file
You can stick the channels into a config file ($HOME/.xawtv). Looks like this:
@@ -150,7 +174,7 @@ capture mode: off, overlay (default, TV card => video, 0% cpu) or
grabdisplay (TV card => main memory => X-Server => video, frame rate
depends on load and picture size).
.TP
-.B source = Television | Composite1 | Composite2 | SVHS
+.B input = Television | Composite1 | Composite2 | SVHS
input source. The valid choices depend on the hardware driver, the
values above are just examples.
.TP
@@ -161,14 +185,26 @@ values above are just examples.
.B hue = n
.TP
.B contrast = n
-Valid range is 0-65535, default is 32768
+Valid range is 0-65535, default is 32768. Adding a percent symbol
+changes the range to 0-100, i.e. "50%" has the same effect like
+"32768".
+.TP
+.B audio = mono | stereo | lang1 | lang2
+Set the audio mode for the given channel.
+.TP
+.B freq = n
+Specify the frequency for the given station (kHz, video carrier). You
+shouldn't need this for normal operation, all your channels should be
+listed in the frequency table for your area. Maybe unless you live
+near the border and the foreign country uses another channel scheme.
.P
A few global settings go to the "[global]" section:
.TP
.B fullscreen = width x height
specify which video mode should be used for full-screen. Works with
XFree only, and of cource you need a valid modeline for this mode in
-your XF86Config file.
+your XF86Config file. You also have to enable the VidMode extention
+(option -vm, see above) to make this work.
.TP
.B wm-off-by = [+-]x[+-]y
Some WM's handle static gravity not correct (I know mwm and
@@ -212,6 +248,9 @@ i.e. 1 is the first station from $HOME/.xawtv, ...
.B osd = on | off
Enable/disable the onscreen display in fullscreen mode. Default is
on.
+.TP
+.B ratio = x:y
+Set a fixed aspect ratio for the TV image.
.P
You can start other programs from within xawtv. This is configured
with entries in the "[launch]" section:
diff --git a/vtx/Makefile b/oldstuff/vtx/Makefile
index 783d9b0..783d9b0 100644
--- a/vtx/Makefile
+++ b/oldstuff/vtx/Makefile
diff --git a/vtx/README b/oldstuff/vtx/README
index 9ea12d4..9ea12d4 100644
--- a/vtx/README
+++ b/oldstuff/vtx/README
diff --git a/vtx/cct.h b/oldstuff/vtx/cct.h
index 6846771..6846771 100644
--- a/vtx/cct.h
+++ b/oldstuff/vtx/cct.h
diff --git a/vtx/fileio.c b/oldstuff/vtx/fileio.c
index 5c59237..5c59237 100644
--- a/vtx/fileio.c
+++ b/oldstuff/vtx/fileio.c
diff --git a/vtx/fileio.h b/oldstuff/vtx/fileio.h
index f2d55a0..f2d55a0 100644
--- a/vtx/fileio.h
+++ b/oldstuff/vtx/fileio.h
diff --git a/vtx/main.c b/oldstuff/vtx/main.c
index 7890621..7890621 100644
--- a/vtx/main.c
+++ b/oldstuff/vtx/main.c
diff --git a/vtx/misc.h b/oldstuff/vtx/misc.h
index 8039941..8039941 100644
--- a/vtx/misc.h
+++ b/oldstuff/vtx/misc.h
diff --git a/vtx/sys/vtx.h b/oldstuff/vtx/sys/vtx.h
index c1b4fec..c1b4fec 100644
--- a/vtx/sys/vtx.h
+++ b/oldstuff/vtx/sys/vtx.h
diff --git a/vtx/vtx.cgi b/oldstuff/vtx/vtx.cgi
index c8b94af..c8b94af 100644
--- a/vtx/vtx.cgi
+++ b/oldstuff/vtx/vtx.cgi
diff --git a/vtx/vtx.sh b/oldstuff/vtx/vtx.sh
index 4b65a9e..4b65a9e 100644
--- a/vtx/vtx.sh
+++ b/oldstuff/vtx/vtx.sh
diff --git a/vtx/vtx_assert.h b/oldstuff/vtx/vtx_assert.h
index e4dce2a..e4dce2a 100644
--- a/vtx/vtx_assert.h
+++ b/oldstuff/vtx/vtx_assert.h
diff --git a/vtx/vtxdecode.c b/oldstuff/vtx/vtxdecode.c
index 7fc4552..7fc4552 100644
--- a/vtx/vtxdecode.c
+++ b/oldstuff/vtx/vtxdecode.c
diff --git a/vtx/vtxdecode.h b/oldstuff/vtx/vtxdecode.h
index b56bf75..b56bf75 100644
--- a/vtx/vtxdecode.h
+++ b/oldstuff/vtx/vtxdecode.h
diff --git a/vtx/vtxtools.c b/oldstuff/vtx/vtxtools.c
index 40c9297..40c9297 100644
--- a/vtx/vtxtools.c
+++ b/oldstuff/vtx/vtxtools.c
diff --git a/vtx/vtxtools.h b/oldstuff/vtx/vtxtools.h
index b819d84..b819d84 100644
--- a/vtx/vtxtools.h
+++ b/oldstuff/vtx/vtxtools.h
diff --git a/radio/Makefile.in b/radio/Makefile.in
index 2348945..8ab36c0 100644
--- a/radio/Makefile.in
+++ b/radio/Makefile.in
@@ -2,9 +2,12 @@ srcdir=@srcdir@
VPATH=$(srcdir)
ROOT=
-prefix=$(ROOT)@prefix@
-bindir=$(prefix)/bin
-mandir=$(prefix)/man
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+bindir=$(ROOT)@bindir@
+mandir=$(ROOT)@mandir@
+
+OS:=$(shell uname -s | tr "A-Z" "a-z")
CC=@CC@
INSTALL=@INSTALL@
@@ -14,14 +17,18 @@ INSTALL_DIR=mkdir -p
CFLAGS=-g -Wall @CFLAGS@ -I$(srcdir)/.. -I..
-PROGS=radio
+ifeq ($(OS),linux)
+ PROGS=radio
+else
+ PROGS=
+endif
##########################################################################
-all: $(PROGS)
+all build: $(PROGS)
radio: radio.o
- $(CC) $(CFLAGS) -o $@ $< -lncurses
+ $(CC) $(CFLAGS) -o $@ $< @LIBCURSES@
install: all
$(INSTALL_DIR) $(bindir)
@@ -29,10 +36,10 @@ install: all
$(INSTALL_DATA) $(srcdir)/radio.man $(mandir)/man1/radio.1
clean:
- -rm -f *.o *~ core* *.bak TAGS
+ -rm -f *.o core* TAGS
realclean distclean: clean
- -rm -f $(PROGS) Makefile
+ -rm -f $(PROGS) Makefile *~ *.bak
dep depend:
diff --git a/src/Makefile.in b/src/Makefile.in
index e58869f..c4925ba 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -2,9 +2,14 @@ srcdir=@srcdir@
VPATH=$(srcdir)
ROOT=
-prefix=$(ROOT)@prefix@
-bindir=$(prefix)/bin
-mandir=$(prefix)/man
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+bindir=$(ROOT)@bindir@
+mandir=$(ROOT)@mandir@
+resdir=$(ROOT)@resdir@
+config=@x11conf@/xawtvrc
+
+OS:=$(shell uname -s | tr "A-Z" "a-z")
CC=@CC@
DEPEND=@DEPEND@
@@ -12,73 +17,99 @@ INSTALL=@INSTALL@
INSTALL_PROGRAM=@INSTALL_PROGRAM@
INSTALL_DATA=@INSTALL_DATA@
INSTALL_DIR=mkdir -p
-SUID_ROOT=-m4711 -o root -g root
+SUID_ROOT=-m4755 -o root -g root
VERSION=xawtv-@XAWTV_VERSION@
-CFLAGS=-g -Wall @CFLAGS@ -I$(srcdir)/.. -I.. @X_CFLAGS@ -DVERSION='"$(VERSION)"'
-LDLIBS=@X_LIBS@ @LIBS@ -l@XAWLIB@ -lXmu -lXt @X_PRE_LIBS@ -lXext \
- -lX11 @X_EXTRA_LIBS@
-
-PROGS=xawtv xawtv-remote v4l-conf v4lctl streamer xvideo fbtv
+WARN=-Wall -Wstrict-prototypes
+CFLAGS=-g $(WARN) @CFLAGS@ -I$(srcdir)/.. -I.. @X_CFLAGS@ -D_REENTRANT \
+ -DVERSION='"$(VERSION)"' -DCONFIGFILE='"$(config)"' \
+ -I$(srcdir)/../libvbi -L../libvbi
-COMMON_OBJS= sound.o grab.o grab-v4l.o grab-v4l2.o colorspace.o \
- frequencies.o writefile.o commands.o parseconfig.o mjpeg.o
-CAPTURE_OBJS= capture.o writeavi.o
+GFXLIBS=@GFXLIBS@
+X11LIBS=@X_LIBS@ @LIBS@ -l@XAWLIB@ -lXmu -lXt @X_PRE_LIBS@ -lXext \
+ -lX11 @X_EXTRA_LIBS@
+MOLIBS=@X_LIBS@ @LIBS@ -lXm -lXmu -lXt @X_PRE_LIBS@ -lXext \
+ -lX11 @X_EXTRA_LIBS@
+SCRLIBS=@LIBCURSES@
+IRLIBS=@LIRC@
+LDLIBS=@LIBPTHREAD@ @LIBSOUND@
+
+ifeq ($(OS),linux)
+ PROGS=xawtv xawtv-remote v4l-conf v4lctl streamer fbtv xvideo rootv scantv @MOTIF@
+else
+ PROGS=xawtv xawtv-remote v4lctl streamer xvideo rootv scantv
+endif
+
+COMMON_OBJS= sound.o grab.o grab-ng.o grab-v4l.o grab-v4l2.o grab-bsd.o \
+ colorspace.o webcam.o frequencies.o commands.o parseconfig.o mjpeg.o
+CAPTURE_OBJS=capture.o writefile.o writeavi.o writeqt.o
LIRC_OBJS=lirc.o
-XAWTV_OBJS= main.o toolbox.o conf.o x11.o xv.o complete.o wmhooks.o \
+XAWTV_OBJS= main.o xt.o toolbox.o conf.o x11.o xv.o complete.o wmhooks.o \
channel.o $(COMMON_OBJS) $(CAPTURE_OBJS) $(LIRC_OBJS)
FBTV_OBJS= fbtv.o fbtools.o channel-no-x11.o matrox.o \
$(COMMON_OBJS) $(CAPTURE_OBJS) $(LIRC_OBJS)
##########################################################################
-all: $(PROGS)
+all build: $(PROGS)
xawtv: $(XAWTV_OBJS)
- $(CC) $(CFLAGS) -o $@ $^ @JPEG@ @LIRC@ $(LDLIBS)
+ $(CC) $(CFLAGS) -o $@ $^ $(GFXLIBS) $(IRLIBS) $(X11LIBS) $(LDLIBS)
-test -f Xawtv.ad || cp -v $(srcdir)/Xawtv.ad .
+motv: motif.o xt.o x11.o xv.o channel-no-x11.o $(COMMON_OBJS) $(CAPTURE_OBJS)
+ $(CC) $(CFLAGS) -o $@ $^ $(GFXLIBS) $(IRLIBS) $(MOLIBS) $(LDLIBS)
+
fbtv: $(FBTV_OBJS)
- $(CC) $(CFLAGS) -o $@ $^ @JPEG@ @LIRC@ -lncurses -lm
+ $(CC) $(CFLAGS) -o $@ $^ $(GFXLIBS) $(IRLIBS) $(SCRLIBS) $(LDLIBS) -lm
-v4lctl: v4lctl.o channel-no-x11.o $(COMMON_OBJS)
- $(CC) $(CFLAGS) -o $@ $^ @JPEG@
+v4lctl: v4lctl.o channel-no-x11.o xv.o $(COMMON_OBJS) $(CAPTURE_OBJS)
+ $(CC) $(CFLAGS) -o $@ $^ $(GFXLIBS) $(X11LIBS) $(LDLIBS)
streamer: streamer.o channel-no-x11.o $(COMMON_OBJS) $(CAPTURE_OBJS)
- $(CC) $(CFLAGS) -o $@ $^ @JPEG@
+ $(CC) $(CFLAGS) -o $@ $^ $(GFXLIBS) $(IRLIBS) $(LDLIBS)
+
+xvideo: xvideo.o
+ $(CC) $(CFLAGS) -o $@ $^ $(X11LIBS) #$(LDLIBS)
+
+rootv: rootv.o parseconfig.o
+ $(CC) $(CFLAGS) -o $@ $^ $(X11LIBS)
v4l-conf: v4l-conf.o
- $(CC) $(CFLAGS) -o $@ $< @X_LIBS@ @LIBS@ -lXext -lX11 @X_EXTRA_LIBS@
+ $(CC) $(CFLAGS) -o $@ $< $(X11LIBS)
+
+scantv: scantv.o channel-no-x11.o xv.o $(COMMON_OBJS) $(CAPTURE_OBJS)
+ $(CC) $(CFLAGS) -o $@ $^ -lvbi $(GFXLIBS) $(X11LIBS) $(LDLIBS)
xawtv-remote: xawtv-remote.o
- $(CC) $(CFLAGS) -o $@ $< @X_LIBS@ @LIBS@ -lXmu -lXt @X_PRE_LIBS@ -lXext -lX11 @X_EXTRA_LIBS@
+ $(CC) $(CFLAGS) -o $@ $< $(X11LIBS)
channel-no-x11.o: channel.c
$(CC) $(CFLAGS) -DNO_X11=1 -c -o $@ $<
install: all
$(INSTALL_DIR) $(bindir)
- $(INSTALL_DIR) $(mandir)/man1
- $(INSTALL_DIR) $(ROOT)@x_libraries@/X11/app-defaults
+ $(INSTALL_DIR) $(resdir)
$(INSTALL_PROGRAM) -s xawtv $(bindir)
$(INSTALL_PROGRAM) -s xawtv-remote $(bindir)
$(INSTALL_PROGRAM) -s fbtv $(bindir);
$(INSTALL_PROGRAM) -s streamer $(bindir)
$(INSTALL_PROGRAM) -s v4lctl $(bindir)
+ $(INSTALL_PROGRAM) -s rootv $(bindir)
+ $(INSTALL_PROGRAM) -s scantv $(bindir)
$(INSTALL_PROGRAM) -s $(SUID_ROOT) v4l-conf $(bindir)
- $(INSTALL_DATA) $(srcdir)/Xawtv.ad $(ROOT)@x_libraries@/X11/app-defaults/Xawtv
+ $(INSTALL_DATA) $(srcdir)/Xawtv.ad $(resdir)/Xawtv
clean:
- -rm -f *.o *.moc *~ core* *.bak TAGS
+ -rm -f *.o *.moc *core TAGS
realclean distclean: clean
- -rm -f $(PROGS) Makefile
+ -rm -f $(PROGS) Makefile *~ *.bak
depend dep:
$(DEPEND) -- $(CFLAGS) -- *.c
#-------------------------------------------------------------------------
# DO NOT DELETE THIS LINE -- make depend depends on it.
-
diff --git a/src/MoTV.ad b/src/MoTV.ad
new file mode 100644
index 0000000..c99e761
--- /dev/null
+++ b/src/MoTV.ad
@@ -0,0 +1,55 @@
+MoTV*fontList: -*-helvetica-medium-r-normal-*-120-*
+!MoTV*fontList: -*-lucida-medium-r-normal-*-120-*
+
+MoTV.geometry: 320x240
+MoTV.tv.background: black
+MoTV.tv.translations: #override \n\
+ <Btn2Up>: Command(setstation,next) \n\
+ <Btn3Up>: Popup(control) \n\
+ <Key>osfPageUp: Command(setstation,next) \n\
+ <Key>osfPageDown: Command(setstation,prev) \n\
+ <Key>space: Command(setstation,next)
+
+*menu.leftAttachment: ATTACH_FORM
+*menu.rightAttachment: ATTACH_FORM
+*volume.topAttachment: ATTACH_WIDGET
+*color.topAttachment: ATTACH_WIDGET
+
+*XmMenuShell.XmRowColumn.tearOffModel: TEAR_OFF_ENABLED
+*menu*fileM.tearOffTitle: File
+*menu*stationsM.tearOffTitle: TV Stations
+*menu*optionsM.tearOffTitle: Options
+*menu*inputM.tearOffTitle: Inputs
+*menu*normM.tearOffTitle: TV Norm
+
+*menu.file.labelString: File
+*menu.file.mnemonic: F
+*menu.stations.labelString: Stations
+*menu.stations.mnemonic: S
+*menu.options.labelString: Options
+*menu.options.mnemonic: O
+
+*menu*quit.labelString: Quit
+*menu*quit.mnemonic: Q
+*menu*quit.acceleratorText: Q
+*menu*quit.accelerator: <Key>Q
+
+*menu*pointer.labelString: Mouse Pointer
+*menu*pointer.mnemonic: M
+*menu*pointer.acceleratorText: M
+*menu*pointer.accelerator: <Key>M
+*menu*ontop.labelString: Stay on Top
+*menu*ontop.mnemonic: T
+*menu*ontop.acceleratorText: T
+*menu*ontop.accelerator: <Key>T
+*menu*input.labelString: Input
+*menu*input.mnemonic: I
+*menu*norm.labelString: TV Norm
+*menu*norm.mnemonic: N
+
+*XmScale.orientation: HORIZONTAL
+*XmScale.showValue: true
+*XmScale.highlightOnEnter: true
+*XmScale.highlightThickness: 1
+*volume.titleString: Volume
+*color.titleString: Color
diff --git a/src/Xawtv.ad b/src/Xawtv.ad
index 90b157f..df039f6 100644
--- a/src/Xawtv.ad
+++ b/src/Xawtv.ad
@@ -33,7 +33,6 @@ Hit Return to start watching TV...\n\
\n
Options*mute.label: Audio (un)mute A
-Options*ptr.label: Mouse Pointer on/off M
Options*fs.label: Full Screen on/off F
Options*grabppm.label: Grab Image (ppm) G
Options*grabjpeg.label: Grab Image (jpeg) J
@@ -106,6 +105,7 @@ TopLevelShell*menu.translations: #override \n\
xawtv.tv.width: 384
xawtv.tv.height: 288
+xawtv.tv.background: green
xawtv.winGravity: Static
xawtv.translations: #override \n\
<PropertyNotify>: Remote() \n\
@@ -131,7 +131,6 @@ xawtv.tv.translations: #override \n\
<Key>KP_Subtract: Command(volume,dec) \n\
<Key>KP_Enter: Command(volume,mute) \n\
<Key>A: Command(volume,mute) \n\
- <Key>M: Pointer() \n\
<Key>F: Command(fullscreen) \n\
Ctrl<Key>Z: Zap(fast) \n\
<Key>Z: Zap() \n\
@@ -189,7 +188,6 @@ Options.paned.translations: #override\n\
<Key>KP_Subtract: Command(volume,dec) \n\
<Key>KP_Enter: Command(volume,mute) \n\
<Key>A: Command(volume,mute) \n\
- <Key>M: Pointer() \n\
<Key>F: Command(fullscreen) \n\
Ctrl<Key>Z: Zap(fast) \n\
<Key>Z: Zap() \n\
@@ -219,16 +217,16 @@ Options*Command.translations: #override \n\
! Streamer frontend window
Streamer.title: record movies (*.avi)
-Streamer*flabel.label: output filename
-Streamer*olabel.label: command output
+Streamer*vlabel.label: movie/images filename
+Streamer*alabel.label: *.wav filename
Streamer*streamer.label: start/stop recording
Streamer*xanim.label: playback (start xanim)
-Streamer*Label.width: 320
+Streamer*Label.width: 360
Streamer*Label.resize: false
Streamer*Label.borderWidth: 0
Streamer*Label.shadowWidth: 0
-Streamer*Text.width: 320
+Streamer*Text.width: 360
Streamer*Text*background: white
Streamer*Text*Scrollbar.background: lightgray
Streamer*Text*autoFill: false
@@ -237,24 +235,30 @@ Streamer*Text*type: string
Streamer*Text*useStringInPlace: false
Streamer*status.foreground: darkred
-Streamer*format.vertDistance: 0
+Streamer*vlabel.vertDistance: 5
+Streamer*vname.vertDistance: 0
+Streamer*alabel.vertDistance: 15
+Streamer*aname.vertDistance: 0
+Streamer*driver.vertDistance: 15
+Streamer*audio.vertDistance: 5
+Streamer*rate.vertDistance: 0
+Streamer*video.vertDistance: 5
Streamer*fps.vertDistance: 0
Streamer*size.vertDistance: 0
-Streamer*status.vertDistance: 0
-Streamer*audio.vertDistance: 15
-Streamer*streamer.vertDistance: 15
-Streamer*olabel.vertDistance: 15
+Streamer*status.vertDistance: 5
+Streamer*streamer.vertDistance: 5
+Streamer*xanim.vertDistance: 5
-Streamer*output.height: 80
-Streamer*output.scrollVertical: always
-!Streamer*output.sensitive: false
-
-Streamer*fname.translations: #override \n\
+Streamer*vname.translations: #override \n\
+ <Key>Tab: Complete() \n\
+ <EnterWindow>: SetBg(lightyellow) \n\
+ <LeaveWindow>: SetBg(white)
+Streamer*aname.translations: #override \n\
<Key>Tab: Complete() \n\
<EnterWindow>: SetBg(lightyellow) \n\
<LeaveWindow>: SetBg(white)
-Streamer*Command.width: 320
+Streamer*Command.width: 360
Streamer*Command.resize: false
Streamer*Command.justify: left
Streamer*Command.shadowWidth: 0
@@ -296,7 +300,6 @@ Channels.viewport.translations: #override\n\
<Key>KP_Subtract: Command(volume,dec) \n\
<Key>KP_Enter: Command(volume,mute) \n\
<Key>A: Command(volume,mute) \n\
- <Key>M: Pointer() \n\
<Key>F: Command(fullscreen) \n\
Ctrl<Key>Z: Zap(fast) \n\
<Key>Z: Zap() \n\
@@ -330,6 +333,17 @@ xawtv.onscreen.label.justify: left
xawtv.onscreen.label.font: -*-ledfixed-medium-r-semicondensed--39-*
+xawtv.vtx.allowShellResize: true
+xawtv.vtx.label.resize: true
+
+xawtv.vtx*background: black
+xawtv.vtx*borderColor: black
+xawtv.vtx*foreground: lightgreen
+xawtv.vtx*shadowWidth: 0
+xawtv.vtx.label.justify: center
+xawtv.vtx.label.font: 7x13bold
+
+
! ----------------------------------------------------------------------------
! Config window
diff --git a/src/capture.c b/src/capture.c
index 4167222..02710f1 100644
--- a/src/capture.c
+++ b/src/capture.c
@@ -4,315 +4,338 @@
#include <fcntl.h>
#include <errno.h>
#include <signal.h>
+#include <pthread.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/ipc.h>
#include <sys/shm.h>
-#include "grab.h"
+#include "grab-ng.h"
#include "colorspace.h"
#include "sound.h"
-#include "writeavi.h"
#include "capture.h"
/*-------------------------------------------------------------------------*/
-/* for streaming capture */
-
-/* buffer fifo */
-static int grab_bfirst;
-static int grab_blast;
-static int grab_bufcount;
-static int grab_bufsize;
-static char* grab_buffers;
-
-/* timing */
-static struct timeval grab_start;
-static int grab_fps;
-static int grab_lastsec,grab_lastsync;
-static int grab_absqueued;
-static int grab_secframes,grab_secqueued;
-static int grab_missed;
-
-/* forks of a new process, returns a file handle for a pipe
- * The new process will sync if it reads some char from the pipe
- * and exit on EOF
- */
-int
-grab_syncer(int *talk, int quiet)
+
+void
+fifo_init(struct FIFO *fifo, char *name, int slots)
{
- char dummy[16];
- int pid,rsync,p1[2];
+ pthread_mutex_init(&fifo->lock, NULL);
+ pthread_cond_init(&fifo->hasdata, NULL);
+ fifo->name = name;
+ fifo->slots = slots;
+ fifo->read = 0;
+ fifo->write = 0;
+ fifo->eof = 0;
+}
- if (-1 == pipe(p1)) {
- perror("pipe");
- exit(1);
+int
+fifo_put(struct FIFO *fifo, unsigned char *data, int size)
+{
+ pthread_mutex_lock(&fifo->lock);
+ if (debug > 1)
+ fprintf(stderr,"put %s %p %d\n",fifo->name,data,size);
+ if (NULL == data) {
+ fifo->eof = 1;
+ pthread_cond_signal(&fifo->hasdata);
+ pthread_mutex_unlock(&fifo->lock);
+ return 0;
}
- switch(pid = fork()) {
- case -1:
- perror("fork");
- exit(1);
- case 0:
- close(p1[1]);
- rsync = p1[0];
- fcntl(rsync,F_SETFL,0);
- signal(SIGINT,SIG_IGN);
- nice(10);
- for (;;) {
- switch (read(rsync,dummy,16)) {
- case -1:
- perror("syncer: read socket");
- exit(1);
- case 0:
- if (!quiet)
- fprintf(stderr,"syncer: done\n");
- exit(0);
- default:
- if (!quiet)
- fprintf(stderr,"s");
- sync();
- }
- }
- break;
- default:
- close(p1[0]);
- *talk = p1[1];
- break;
+ if ((fifo->write + 1) % fifo->slots == fifo->read) {
+ pthread_mutex_unlock(&fifo->lock);
+ fprintf(stderr,"fifo %s is full\n",fifo->name);
+ return 0;
}
- return pid;
+ fifo->data[fifo->write] = data;
+ fifo->size[fifo->write] = size;
+ fifo->write++;
+ if (fifo->write >= fifo->slots)
+ fifo->write = 0;
+ pthread_cond_signal(&fifo->hasdata);
+ pthread_mutex_unlock(&fifo->lock);
+ return size;
}
-
-/* allocate shared memory for buffers, init variables for fifo/timing */
-char*
-grab_initbuffers(int size, int count)
+int
+fifo_get(struct FIFO *fifo, unsigned char **data)
{
- char *buffers;
- int shmid;
+ int size;
- while (count > 0)
- if (-1 != (shmid = shmget(IPC_PRIVATE, size*count, IPC_CREAT | 0700)))
- break;
- if (0 == count) {
- perror("shmget");
- return NULL;
+ pthread_mutex_lock(&fifo->lock);
+ if (debug > 1)
+ fprintf(stderr,"get %s\n",fifo->name);
+ while (fifo->write == fifo->read && 0 == fifo->eof) {
+ pthread_cond_wait(&fifo->hasdata, &fifo->lock);
}
- buffers = shmat(shmid, 0, 0);
- if ((void *) -1 == buffers) {
- perror("shmat");
- return NULL;
+ if (fifo->write == fifo->read) {
+ *data = NULL;
+ pthread_cond_signal(&fifo->hasdata);
+ pthread_mutex_unlock(&fifo->lock);
+ return 0;
}
- if (-1 == shmctl(shmid, IPC_RMID, 0))
- perror("shmctl");
-
- gettimeofday(&grab_start,NULL);
- grab_lastsec = 0;
- grab_lastsync = 0;
- grab_absqueued = 0;
- grab_secframes = 0;
- grab_secqueued = 0;
-
- grab_bfirst = 0;
- grab_blast = 0;
- grab_bufcount = count;
- grab_bufsize = size;
- grab_buffers = buffers;
- return buffers;
+ *data = fifo->data[fifo->read];
+ size = fifo->size[fifo->read];
+ fifo->read++;
+ if (fifo->read >= fifo->slots)
+ fifo->read = 0;
+ pthread_cond_signal(&fifo->hasdata);
+ pthread_mutex_unlock(&fifo->lock);
+ return size;
}
-/* free buffers */
-void
-grab_freebuffers(char *buffers)
+static void*
+flushit(void *arg)
{
- if (-1 == shmdt(buffers))
- perror("shmdt");
+ int old;
+
+ pthread_setcancelstate(PTHREAD_CANCEL_ENABLE,&old);
+ pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS,&old);
+ for (;;) {
+ sleep(1);
+ sync();
+ }
+ return NULL;
}
/*-------------------------------------------------------------------------*/
-int
-grab_writer_fork(int *talk)
+struct movie_handle {
+ const struct ng_writer *writer;
+ void *handle;
+ pthread_mutex_t lock;
+ struct ng_video_fmt vfmt;
+ struct ng_audio_fmt afmt;
+ int fps;
+
+ struct FIFO *vfifo;
+ struct FIFO *afifo;
+};
+
+static struct movie_handle movie_state;
+
+static struct FIFO faudio;
+static struct FIFO fvideo;
+static pthread_t taudio;
+static pthread_t tvideo;
+static pthread_t tflush;
+static char *baudio,*bvideo;
+static int saudio,svideo;
+static int iaudio,ivideo;
+static int naudio,nvideo;
+static int caudio,cvideo;
+
+static void*
+writer_audio_thread(void *arg)
{
- int ret, s[2];
-
- /* start up new proccess */
- if (-1 == socketpair(AF_UNIX,SOCK_STREAM,PF_UNIX,s)) {
- perror("socketpair");
- return -1;
- }
- switch(ret = fork()) {
- case -1:
- perror("fork");
- close(s[0]);
- close(s[1]);
- break;
- case 0:
- close(s[0]);
- *talk = s[1];
- fcntl(*talk,F_SETFL,O_RDWR);
- signal(SIGINT,SIG_IGN);
- signal(SIGPIPE,SIG_IGN);
- nice(5);
- break;
- default:
- close(s[1]);
- *talk = s[0];
- fcntl(*talk,F_SETFL,O_RDWR|O_NONBLOCK);
- break;
+ struct movie_handle *h = arg;
+ struct ng_audio_buf buf;
+ unsigned char *data;
+ int size;
+
+ if (debug)
+ fprintf(stderr,"writer_audio_thread start\n");
+ for (;;) {
+ size = fifo_get(h->afifo,&data);
+ if (NULL == data)
+ break;
+ pthread_mutex_lock(&h->lock);
+ buf.fmt = h->afmt;
+ buf.data = data;
+ buf.size = size;
+ h->writer->wr_audio(h->handle,&buf);
+ pthread_mutex_unlock(&h->lock);
}
- return ret;
+ if (debug)
+ fprintf(stderr,"writer_audio_thread done\n");
+ return NULL;
}
-/* start up avi writer */
-int
-grab_writer_avi(char *filename, struct MOVIE_PARAMS *params,
- unsigned char *buffers, int bufsize, int quiet, int *talk)
+static void *
+writer_video_thread(void *arg)
{
- char *sound_data;
- int args[2], sound = -1, sound_size=0, n=0, ret;
- fd_set set;
-
- grab_fps = params->fps;
- grab_missed = 0;
-
- /* start up new proccess */
- if (0 != (ret = grab_writer_fork(talk)))
- return ret;
-
- /* work */
- if (params->channels > 0) {
- if (-1 != (sound = sound_open(params))) {
- sound_size = sound_bufsize();
- n = (*talk>sound) ? *talk+1 : sound+1;
- }
- }
- avi_open(filename,params);
+ struct movie_handle *h = arg;
+ struct ng_video_buf buf;
+ unsigned char *data;
+ int size;
+
+ if (debug)
+ fprintf(stderr,"writer_video_thread start\n");
for (;;) {
- if (sound != -1) {
- FD_ZERO(&set);
- FD_SET(*talk,&set);
- FD_SET(sound,&set);
- select(n,&set,NULL,NULL,NULL);
- if (FD_ISSET(sound,&set)) {
- /* handle audio */
- sound_data = sound_read();
- avi_writesound(sound_data, sound_size);
- }
- if (!FD_ISSET(*talk,&set))
- continue;
+ size = fifo_get(h->vfifo,&data);
+ if (NULL == data)
+ break;
+ pthread_mutex_lock(&h->lock);
+ buf.fmt = h->vfmt;
+ buf.data = data;
+ if (0 != size) {
+ buf.size = size;
+ } else {
+ buf.size = buf.fmt.width * buf.fmt.height *
+ ng_vfmt_to_depth[buf.fmt.fmtid] / 8;
}
+ h->writer->wr_video(h->handle,&buf);
+ pthread_mutex_unlock(&h->lock);
+ }
+ if (debug)
+ fprintf(stderr,"writer_video_thread done\n");
+ return NULL;
+}
- /* wait for frame */
- switch (read(*talk,args,2*sizeof(int))) {
- case -1:
- perror("writer: read socket");
- exit(1);
- case 0:
- avi_close();
- if (!quiet)
- fprintf(stderr,"writer: done\n");
- exit(0);
- }
+int
+movie_writer_init(char *moviename, char *audioname,
+ const struct ng_writer *writer,
+ struct ng_video_fmt *video, const void *priv_video, int fps,
+ struct ng_audio_fmt *audio, const void *priv_audio,
+ int slots, int *sound)
+{
+ struct movie_handle *h = &movie_state;
+ int linelength;
- /* write video */
- avi_writeframe(buffers + args[0]*bufsize,args[1]);
+ if (debug)
+ fprintf(stderr,"movie_init_writer start\n");
+ memset(h,0,sizeof(*h));
+ pthread_mutex_init(&h->lock, NULL);
+ h->afifo = &faudio;
+ h->vfifo = &fvideo;
+ h->writer = writer;
- /* free buffer */
- if (sizeof(int) != write(*talk,args,sizeof(int))) {
- perror("writer: write socket");
- exit(1);
- }
- if (!quiet)
- fprintf(stderr,"-");
+ /* audio */
+ *sound = -1;
+ if (audio->fmtid != AUDIO_NONE)
+ *sound = sound_open(audio);
+ if (audio->fmtid != AUDIO_NONE) {
+ fifo_init(&faudio,"audio",slots);
+ pthread_create(&taudio,NULL,writer_audio_thread,h);
+ iaudio = 0;
+ naudio = slots+2;
+ saudio = sound_bufsize();
+ baudio = malloc(saudio*naudio);
+ caudio = 0;
}
+ h->afmt = *audio;
+
+ /* video */
+ grabber_setparams(video->fmtid, &video->width, &video->height,
+ &linelength,0,0);
+ fifo_init(&fvideo,"video",slots);
+ pthread_create(&tvideo,NULL,writer_video_thread,h);
+ ivideo = 0;
+ nvideo = slots+2;
+ svideo = video->width * video->height *
+ ng_vfmt_to_depth[video->fmtid]/8;
+ if (0 == svideo)
+ svideo = video->width * video->height * 3;
+ bvideo = malloc(svideo*nvideo);
+ cvideo = 0;
+ h->vfmt = *video;
+ h->fps = fps;
- /* done */
- exit(0);
+ /* open file */
+ h->handle = writer->wr_open(moviename,audioname,
+ video,priv_video,fps,
+ audio,priv_audio);
+ if (debug)
+ fprintf(stderr,"movie_init_writer end (h=%p)\n",h->handle);
+ return 0;
}
-void
-grab_set_fps(int fps)
+int
+movie_writer_start()
{
- grab_fps = fps;
- grab_missed = 0;
+ struct movie_handle *h = &movie_state;
+
+ if (debug)
+ fprintf(stderr,"movie_writer_start\n");
+ if (grabber->grab_start)
+ grabber->grab_start(h->fps,0);
+ if (h->afmt.fmtid != AUDIO_NONE)
+ sound_startrec();
+ pthread_create(&tflush,NULL,flushit,NULL);
+ return 0;
}
int
-grab_putbuffer(int quiet, int writer, int wsync)
+movie_writer_stop()
{
- static int synctime = 500;
- int timediff,args[2],size;
- struct timeval tv;
+ struct movie_handle *h = &movie_state;
+ void *dummy;
+ long long ausec,vusec;
+ int soundbytes;
- /* get next frame */
- grabber_capture(grab_buffers + grab_bufsize*grab_bfirst,0,0,&size);
-
- /* check time */
- gettimeofday(&tv,NULL);
- timediff = (tv.tv_sec - grab_start.tv_sec) * 1000;
- timediff += (tv.tv_usec - grab_start.tv_usec) / 1000;
- if (grab_absqueued * 1000 / grab_fps > timediff)
- return grab_absqueued;
-
- if (timediff > grab_lastsync+synctime) {
- /* sync */
- grab_lastsync = timediff - timediff % synctime;
- if (sizeof(grab_bfirst) != write(wsync,&grab_bfirst,sizeof(grab_bfirst))) {
- perror("grabber: write socket");
- exit(1);
- }
- }
-
- if (timediff > grab_lastsec+1000) {
- /* print statistics */
- grab_missed += (grab_fps - grab_secqueued);
- if (!quiet && grab_secframes)
- fprintf(stderr," %2d/%2d (%d)\n",
- grab_secqueued,grab_secframes,-grab_missed);
- grab_lastsec = timediff - timediff % 1000;
- grab_secqueued = 0;
- grab_secframes = 0;
- }
+ if (debug)
+ fprintf(stderr,"movie_writer_stop\n");
- /* check for free buffers */
- switch(read(writer,args,sizeof(int))) {
- case -1:
- if (errno != EAGAIN) {
- perror("grabber: read socket");
- exit(1);
+ if (h->afmt.fmtid != AUDIO_NONE) {
+ vusec = cvideo * 1000 / h->fps;
+ ausec = ((long long)caudio*saudio*8*1000) /
+ (h->afmt.rate * ng_afmt_to_bits[h->afmt.fmtid] *
+ ng_afmt_to_channels[h->afmt.fmtid]);
+ while (vusec < ausec) {
+ grab_put_video();
+ vusec = cvideo * 1000 / h->fps;
+ }
+ soundbytes = (int)(vusec-ausec) * h->afmt.rate *
+ ng_afmt_to_bits[h->afmt.fmtid] *
+ ng_afmt_to_channels[h->afmt.fmtid]/8/1000;
+ soundbytes = (soundbytes+4) & ~0x03;
+ fprintf(stderr,"vs=%Ld as=%Ld %d/%d\n",vusec,ausec,
+ soundbytes,saudio);
+ while (soundbytes > saudio) {
+ grab_put_audio();
+ soundbytes -= saudio;
}
- break;
- case 0:
- /* nothing */
- break;
- default:
- grab_blast++;
- if (grab_blast == grab_bufcount)
- grab_blast = 0;
- break;
+ sound_read(baudio + iaudio*saudio);
+ fifo_put(&faudio,baudio + iaudio*saudio,soundbytes);
}
- grab_secframes++;
- if ((grab_bfirst+2) % grab_bufcount == grab_blast) {
- /* no buffer free */
- if (!quiet)
- fprintf(stderr,"o");
- return grab_absqueued;
+ /* send EOF + join threads */
+ if (h->afmt.fmtid != AUDIO_NONE) {
+ fifo_put(&faudio,NULL,0);
+ pthread_join(taudio,&dummy);
}
+ fifo_put(&fvideo,NULL,0);
+ pthread_join(tvideo,&dummy);
+ pthread_cancel(tflush);
+ pthread_join(tflush,&dummy);
- /* queue buffer */
- args[0] = grab_bfirst;
- args[1] = size;
- if (2*sizeof(int) != write(writer,args,2*sizeof(int))) {
- perror("grabber: write socket");
- exit(1);
- }
- grab_secqueued++;
- grab_absqueued++;
- grab_bfirst++;
- if (grab_bfirst == grab_bufcount)
- grab_bfirst = 0;
- if (!quiet)
- fprintf(stderr,"+");
- return grab_absqueued;
+ /* close file */
+ h->writer->wr_close(h->handle);
+ if (grabber->grab_stop)
+ grabber->grab_stop();
+ if (h->afmt.fmtid != AUDIO_NONE)
+ sound_close();
+ return 0;
+}
+
+/*-------------------------------------------------------------------------*/
+
+int
+grab_put_video()
+{
+ int size;
+
+ if (debug > 1)
+ fprintf(stderr,"grab_put_video\n");
+
+ /* get next frame */
+ grabber_capture(bvideo + ivideo*svideo,0,&size);
+
+ fifo_put(&fvideo,bvideo + ivideo*svideo,size);
+ ivideo = (ivideo+1) % nvideo;
+ cvideo++;
+ return 0;
+}
+
+int
+grab_put_audio()
+{
+ if (debug > 1)
+ fprintf(stderr,"grab_put_audio\n");
+
+ sound_read(baudio + iaudio*saudio);
+ fifo_put(&faudio,baudio + iaudio*saudio,saudio);
+ iaudio = (iaudio+1) % naudio;
+ caudio++;
+ return 0;
}
diff --git a/src/capture.h b/src/capture.h
index d49bc1d..636288a 100644
--- a/src/capture.h
+++ b/src/capture.h
@@ -1,14 +1,30 @@
#ifndef CAPTURE_H
#define CAPTURE_H
-int grab_syncer(int *talk, int quiet);
-char* grab_initbuffers(int size, int count);
-void grab_freebuffers(char *buffers);
-
-int grab_writer_fork(int *talk);
-int grab_writer_avi(char *filename, struct MOVIE_PARAMS *params,
- unsigned char *buffers, int bufsize, int quiet, int *talk);
-void grab_set_fps(int fps);
-int grab_putbuffer(int quiet, int writer, int wsync);
+#define FIFO_MAX 64
+
+struct FIFO {
+ char *name;
+ unsigned char *data[FIFO_MAX];
+ unsigned int size[FIFO_MAX];
+ int slots,read,write,eof;
+ pthread_mutex_t lock;
+ pthread_cond_t hasdata;
+};
+
+void fifo_init(struct FIFO *fifo, char *name, int slots);
+int fifo_put(struct FIFO *fifo, unsigned char *data, int size);
+int fifo_get(struct FIFO *fifo, unsigned char **data);
+
+int movie_writer_init(char *moviename, char *audioname,
+ const struct ng_writer *writer,
+ struct ng_video_fmt *video, const void *priv_video, int fps,
+ struct ng_audio_fmt *audio, const void *priv_audio,
+ int slots, int *sound);
+int movie_writer_start(void);
+int movie_writer_stop(void);
+
+int grab_put_video(void);
+int grab_put_audio(void);
#endif /* CAPTURE_H */
diff --git a/src/channel.c b/src/channel.c
index d002f28..98bf046 100644
--- a/src/channel.c
+++ b/src/channel.c
@@ -36,7 +36,7 @@
# include <X11/Xaw/Paned.h>
#endif
-#include "grab.h"
+#include "grab-ng.h"
#include "channel.h"
#include "frequencies.h"
#include "sound.h"
@@ -45,10 +45,18 @@
/* ----------------------------------------------------------------------- */
/* misc common stuff, not only channel related */
-struct CHANNEL defaults = { "defaults", NULL,
- "5", 0, 0, 0,
- CAPTURE_OVERLAY, 0, 0,
- 32768, 32768, 32768, 32768 };
+struct CHANNEL defaults = {
+ name: "defaults",
+ cname: "none",
+ capture: CAPTURE_OVERLAY,
+ audio: -1,
+ sat: -1,
+ color: 32768,
+ bright: 32768,
+ hue: 32768,
+ contrast: 32768,
+};
+
struct CHANNEL **channels = NULL;
int count = 0;
int alloc_count = 0;
@@ -58,7 +66,7 @@ int last_sender = -1, cur_sender = -1, cur_channel = -1, cur_fine = 0;
int cur_norm = -1, cur_input = -1, cur_freq;
int cur_color,cur_bright,cur_hue,cur_contrast,cur_capture;
-int cur_mute = 0, cur_volume = 65535;
+int cur_movie, cur_mute = 0, cur_volume = 65535;
int have_config;
int jpeg_quality = 75;
int mjpeg_quality = 75;
@@ -112,7 +120,7 @@ int lookup_channel(char *channel)
return i;
}
-int get_freq(int i)
+int get_freq(int i)
{
if (i < 0 || i >= chancount)
return -1;
@@ -258,12 +266,14 @@ calc_frequencies()
int i;
for (i = 0; i < count; i++) {
- channels[i]->channel = lookup_channel(channels[i]->cname);
- if (-1 == channels[i]->channel)
- channels[i]->freq = -1;
- else
- channels[i]->freq = get_freq(channels[i]->channel)
- + channels[i]->fine;
+ if (0 != strcmp(channels[i]->cname,"none")) {
+ channels[i]->channel = lookup_channel(channels[i]->cname);
+ if (-1 == channels[i]->channel)
+ channels[i]->freq = -1;
+ else
+ channels[i]->freq = get_freq(channels[i]->channel)
+ + channels[i]->fine;
+ }
}
}
@@ -280,24 +290,37 @@ init_channel(char *name, struct CHANNEL *c)
else
fprintf(stderr,"config: invalid value for capture: %s\n",val);
}
- if (NULL != (val = cfg_get_str(name,"input")) ||
- NULL != (val = cfg_get_str(name,"source"))) { /* obsolete */
+ if (NULL != grabber->inputs &&
+ (NULL != (val = cfg_get_str(name,"input")) ||
+ NULL != (val = cfg_get_str(name,"source")))) { /* obsolete */
if (-1 != (i = str_to_int(val,grabber->inputs)))
c->input = i;
else
fprintf(stderr,"config: invalid value for input: %s\n",val);
}
- if (NULL != (val = cfg_get_str(name,"norm"))) {
+ if (NULL != grabber->norms &&
+ NULL != (val = cfg_get_str(name,"norm"))) {
if (-1 != (i = str_to_int(val,grabber->norms)))
c->norm = i;
else
fprintf(stderr,"config: invalid value for norm: %s\n",val);
}
+ if (NULL != grabber->audio_modes &&
+ NULL != (val = cfg_get_str(name,"audio"))) {
+ if (-1 != (i = str_to_int(val,grabber->audio_modes)))
+ c->audio = i;
+ else
+ fprintf(stderr,"config: invalid value for audio: %s\n",val);
+ }
if (NULL != (val = cfg_get_str(name,"channel")))
c->cname = strdup(val);
+ if (NULL != (val = cfg_get_str(name,"freq")))
+ c->freq = (int)(atof(val)*16);
if (-1 != (n = cfg_get_int(name,"fine")))
c->fine = n;
+ if (-1 != (n = cfg_get_int(name,"sat")))
+ c->sat = n;
if (NULL != (val = cfg_get_str(name,"key")))
c->key = strdup(val);
@@ -320,7 +343,7 @@ read_config()
char **list,*val;
int i;
- cfg_parse_file("/usr/X11R6/lib/X11/xawtvrc");
+ cfg_parse_file(CONFIGFILE);
sprintf(filename,"%s/%s",getenv("HOME"),".xawtv");
if (0 == cfg_parse_file(filename))
have_config = 1;
@@ -374,6 +397,12 @@ read_config()
fs_xoff = fs_yoff = 0;
}
}
+ if (NULL != (val = cfg_get_str("global","ratio"))) {
+ if (2 != sscanf(val,"%d:%d",&grab_ratio_x,&grab_ratio_y)) {
+ fprintf(stderr,"invalid value for ratio: %s\n",val);
+ grab_ratio_x = grab_ratio_y = 0;
+ }
+ }
if (-1 != (i = cfg_get_int("global","jpeg-quality")))
jpeg_quality = i;
@@ -458,6 +487,8 @@ save_config()
fprintf(fp,"fullscreen = %d x %d\n",fs_width,fs_height);
if (fs_xoff || fs_yoff)
fprintf(fp,"wm-off-by = %+d%+d\n",fs_xoff,fs_yoff);
+ if (grab_ratio_x || grab_ratio_y)
+ fprintf(fp,"ratio = %d:%d\n",grab_ratio_x,grab_ratio_y);
fprintf(fp,"freqtab = %s\n",chanlists[chantab].name);
fprintf(fp,"pixsize = %d x %d\n",pix_width,pix_height);
fprintf(fp,"pixcols = %d\n",pix_cols);
@@ -497,7 +528,7 @@ save_config()
fprintf(fp,"[defaults]\n");
fprintf(fp,"norm = %s\n",int_to_str(cur_norm,grabber->norms));
fprintf(fp,"capture = %s\n",int_to_str(cur_capture,captab));
- fprintf(fp,"source = %s\n",
+ fprintf(fp,"input = %s\n",
int_to_str(cur_input,grabber->inputs));
if (cur_color != 32768)
fprintf(fp,"color = %d\n",cur_color);
@@ -513,9 +544,15 @@ save_config()
for (i = 0; i < count; i++) {
fprintf(fp,"[%s]\n",channels[i]->name);
- fprintf(fp,"channel = %s\n",chanlist[channels[i]->channel].name);
- if (0 != channels[i]->fine)
- fprintf(fp,"fine = %+d\n", channels[i]->fine);
+ if (0 != strcmp(channels[i]->cname,"none")) {
+ fprintf(fp,"channel = %s\n",chanlist[channels[i]->channel].name);
+ if (0 != channels[i]->fine)
+ fprintf(fp,"fine = %+d\n", channels[i]->fine);
+ } else {
+ fprintf(fp,"freq = %.2f\n",(float)(channels[i]->freq)/16);
+ }
+ if (-1 != channels[i]->sat)
+ fprintf(fp,"sat = %+d\n", channels[i]->sat);
if (cur_norm != channels[i]->norm)
fprintf(fp,"norm = %s\n",
int_to_str(cur_norm,grabber->norms));
@@ -569,7 +606,7 @@ str_to_int(char *str, struct STRTAB *tab)
return -1;
}
-char*
+const char*
int_to_str(int n, struct STRTAB *tab)
{
int i;
diff --git a/src/channel.c.orig b/src/channel.c.orig
deleted file mode 100644
index 034cdfe..0000000
--- a/src/channel.c.orig
+++ /dev/null
@@ -1,567 +0,0 @@
-/*
- channel for Bt848 frame grabber driver
-
- Copyright (C) 1996,97 Marcus Metzler (mocm@thp.uni-koeln.de)
-
- many changes by Gerd Knorr <kraxel@goldbach.in-berlin.de>
- [ hmm, think by now nearly nothing left from the original code ... ]
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <ctype.h>
-#include <math.h>
-
-#include <X11/Intrinsic.h>
-#ifndef NO_X11
-# include <X11/StringDefs.h>
-# include <X11/Xaw/XawInit.h>
-# include <X11/Xaw/Command.h>
-# include <X11/Xaw/Paned.h>
-#endif
-
-#include "grab.h"
-#include "channel.h"
-#include "frequencies.h"
-#include "sound.h"
-#include "parseconfig.h"
-
-/* ----------------------------------------------------------------------- */
-/* misc common stuff, not only channel related */
-
-struct CHANNEL defaults = { "defaults", NULL,
- "5", 0, 0, 0,
- CAPTURE_OVERLAY, 0, 0,
- 32768, 32768, 32768, 32768 };
-struct CHANNEL **channels = NULL;
-int count = 0;
-int alloc_count = 0;
-int have_mixer = 0;
-
-int last_sender = -1, cur_sender = -1, cur_channel = -1, cur_fine = 0;
-int cur_norm = -1, cur_input = -1, cur_freq;
-
-int cur_color,cur_bright,cur_hue,cur_contrast,cur_capture;
-int cur_mute = 0, cur_volume = 65535;
-int have_config;
-int jpeg_quality = 75;
-int mjpeg_quality = 50;
-int keypad_ntsc = 0;
-int use_osd = 1;
-int fs_width,fs_height,fs_xoff,fs_yoff;
-int pix_width=128, pix_height=96, pix_cols=1;
-
-#ifndef NO_X11
-void button_cb(Widget widget, XtPointer clientdata, XtPointer call_data);
-
-extern Widget chan_box, chan_viewport, tv, opt_paned, launch_paned;
-#endif
-
-char *mixer = NULL;
-
-struct LAUNCH *launch = NULL;
-int nlaunch = 0;
-
-/* ----------------------------------------------------------------------- */
-
-int lookup_channel(char *channel)
-{
- int i,nr1,nr2;
- char tag1[5],tag2[5];
-
- if (isdigit(channel[0])) {
- tag1[0] = 0;
- nr1 = atoi(channel);
- } else {
- sscanf(channel,"%4[A-Za-z]%d",tag1,&nr1);
- }
-
- for (i = 0; i < chancount; i++) {
- if (isdigit(chanlist[i].name[0])) {
- tag2[0] = 0;
- nr2 = atoi(chanlist[i].name);
- } else {
- sscanf(chanlist[i].name,"%4[A-Za-z]%d",tag2,&nr2);
- }
- if (tag1[0] && tag2[0])
- if (nr1 == nr2 && 0 == strcmp(tag1,tag2))
- break;
- if (!tag1[0] && !tag2[0])
- if (nr1 == nr2)
- break;
- }
- if (i == chancount)
- return -1;
-
- return i;
-}
-
-int get_freq(int i)
-{
- if (i < 0 || i >= chancount)
- return -1;
- return chanlist[i].freq*16/1000;
-}
-
-int cf2freq(char *name, int fine)
-{
- int i;
-
- if (-1 == (i = lookup_channel(name)))
- return -1;
- return get_freq(i)+fine;
-}
-
-/* ----------------------------------------------------------------------- */
-
-struct STRTAB captab[] = {
- { CAPTURE_ON, "on" },
- { CAPTURE_ON, "yes" },
- { CAPTURE_ON, "true" },
- { CAPTURE_OFF, "off" },
- { CAPTURE_OFF, "no" },
- { CAPTURE_OFF, "false" },
- { CAPTURE_OVERLAY, "over" },
- { CAPTURE_OVERLAY, "overlay" },
- { CAPTURE_GRABDISPLAY, "grab" },
- { CAPTURE_GRABDISPLAY, "grabdisplay" },
- { -1, NULL, },
-};
-
-/* just malloc memory for a new channel ... */
-struct CHANNEL*
-add_channel(char *name)
-{
- struct CHANNEL *channel;
-
- if (alloc_count == count) {
- alloc_count += 16;
- if (alloc_count == 16)
- channels = malloc(sizeof(struct CHANNEL*)*alloc_count);
- else
- channels = realloc(channels,sizeof(struct CHANNEL*)*alloc_count);
- }
- channel = channels[count++] = malloc(sizeof(struct CHANNEL));
- memcpy(channel,&defaults,sizeof(struct CHANNEL));
- channel->name = strdup(name);
- return channel;
-}
-
-#ifndef NO_X11
-
-#define PANED_FIX \
- XtNallowResize, False, \
- XtNshowGrip, False, \
- XtNskipAdjust, True
-
-void hotkey_channel(struct CHANNEL *channel)
-{
- char str[100],key[32],ctrl[16];
-
- if (NULL == channel->key)
- return;
- if (2 == sscanf(channel->key,"%15[A-Za-z0-9_]+%31[A-Za-z0-9_]",
- ctrl,key))
- sprintf(str,"%s<Key>%s: Command(setstation,\"%s\")",
- ctrl,key,channel->name);
- else
- sprintf(str,"<Key>%s: Command(setstation,\"%s\")",
- channel->key,channel->name);
- XtOverrideTranslations(tv,XtParseTranslationTable(str));
- XtOverrideTranslations(opt_paned,XtParseTranslationTable(str));
- XtOverrideTranslations(chan_viewport,XtParseTranslationTable(str));
-}
-
-void launch_cb(Widget widget, XtPointer clientdata, XtPointer call_data)
-{
- char *argv[2];
-
- argv[0] = (char*)clientdata;
- argv[1] = NULL;
- XtCallActionProc(widget,"Launch",NULL,argv,1);
-}
-
-void hotkey_launch(struct LAUNCH *launch)
-{
- Widget c;
- char str[100],key[32],ctrl[16],label[64];
-
- if (NULL == launch->key)
- return;
- if (2 == sscanf(launch->key,"%15[A-Za-z0-9_]+%31[A-Za-z0-9_]",
- ctrl,key))
- sprintf(str,"%s<Key>%s: Launch(\"%s\")",ctrl,key,launch->name);
- else
- sprintf(str,"<Key>%s: Launch(\"%s\")",launch->key,launch->name);
- XtOverrideTranslations(tv,XtParseTranslationTable(str));
- XtOverrideTranslations(opt_paned,XtParseTranslationTable(str));
- XtOverrideTranslations(chan_viewport,XtParseTranslationTable(str));
-
- sprintf(label,"%-20s %s",launch->name,launch->key);
- c = XtVaCreateManagedWidget(launch->name, commandWidgetClass,
- launch_paned,
- PANED_FIX,
- XtNlabel,label,
- NULL);
- XtAddCallback(c,XtNcallback,launch_cb,(XtPointer)(launch->name));
-}
-
-/* ... and initalize later */
-void configure_channel(struct CHANNEL *channel)
-{
- channel->button =
- XtVaCreateManagedWidget(channel->name,
- commandWidgetClass, chan_box,
- XtNwidth,pix_width,
- XtNheight,pix_height,
- NULL);
- XtAddCallback(channel->button,XtNcallback,button_cb,(XtPointer*)channel);
- hotkey_channel(channel);
-}
-#endif
-
-/* delete channel */
-void
-del_channel(int i)
-{
-#ifndef NO_X11
- XtDestroyWidget(channels[i]->button);
-#endif
- free(channels[i]->name);
- if (channels[i]->key)
- free(channels[i]->key);
- free(channels[i]);
- count--;
- if (i < count)
- memmove(channels+i,channels+i+1,(count-i)*sizeof(struct CHANNEL*));
-}
-
-void
-calc_frequencies()
-{
- int i;
-
- for (i = 0; i < count; i++) {
- channels[i]->channel = lookup_channel(channels[i]->cname);
- if (-1 == channels[i]->channel)
- channels[i]->freq = -1;
- else
- channels[i]->freq = get_freq(channels[i]->channel)
- + channels[i]->fine;
- }
-}
-
-/* ----------------------------------------------------------------------- */
-
-static void
-init_channel(char *name, struct CHANNEL *c)
-{
- char *val; int n,i;
-
- if (NULL != (val = cfg_get_str(name,"capture"))) {
- if (-1 != (i = str_to_int(val,captab)))
- c->capture = i;
- else
- fprintf(stderr,"config: invalid value for capture: %s\n",val);
- }
- if (NULL != (val = cfg_get_str(name,"input")) ||
- NULL != (val = cfg_get_str(name,"source"))) { /* obsolete */
- if (-1 != (i = str_to_int(val,grabber->inputs)))
- c->input = i;
- else
- fprintf(stderr,"config: invalid value for input: %s\n",val);
- }
- if (NULL != (val = cfg_get_str(name,"norm"))) {
- if (-1 != (i = str_to_int(val,grabber->norms)))
- c->norm = i;
- else
- fprintf(stderr,"config: invalid value for norm: %s\n",val);
- }
-
- if (NULL != (val = cfg_get_str(name,"channel")))
- c->cname = strdup(val);
- if (-1 != (n = cfg_get_int(name,"fine")))
- c->fine = n;
-
- if (NULL != (val = cfg_get_str(name,"key")))
- c->key = strdup(val);
-
- if (-1 != (n = cfg_get_int(name,"color")))
- c->color = n;
- if (-1 != (n = cfg_get_int(name,"bright")))
- c->bright = n;
- if (-1 != (n = cfg_get_int(name,"hue")))
- c->hue = n;
- if (-1 != (n = cfg_get_int(name,"contrast")))
- c->contrast = n;
-}
-
-void
-read_config()
-{
- char filename[100], key[16], cmdline[128];
- char mixerdev[32],mixerctl[16];
- char **list,*val;
- int i;
-
- cfg_parse_file("/usr/X11R6/lib/X11/xawtvrc");
- sprintf(filename,"%s/%s",getenv("HOME"),".xawtv");
- if (0 == cfg_parse_file(filename))
- have_config = 1;
-
- /* misc global settings */
- if (NULL != (val = cfg_get_str("global","mixer"))) {
- mixer = strdup(val);
- if (2 != sscanf(mixer,"%31[^:]:%15s",mixerdev,mixerctl)) {
- strcpy(mixerdev,"/dev/mixer");
- strncpy(mixerctl,val,15);
- mixerctl[15] = 0;
- }
- if (-1 != mixer_open(mixerdev, mixerctl))
- have_mixer = 1;
- else
- fprintf(stderr,"invalid value for mixer: %s\n",val);
- }
-
- if (NULL != (val = cfg_get_str("global","freqtab"))) {
- for (i = 0; chanlists[i].name != NULL; i++)
- if (0 == strcasecmp(val,chanlists[i].name))
- break;
- if (chanlists[i].name != NULL) {
- chantab = i;
- chanlist = chanlists[chantab].list;
- chancount = chanlists[chantab].count;
- } else
- fprintf(stderr,"invalid value for freqtab: %s\n",val);
- }
-
- if (NULL != (val = cfg_get_str("global","fullscreen"))) {
- if (2 != sscanf(val,"%d x %d",&fs_width,&fs_height)) {
- fprintf(stderr,"invalid value for fullscreen: %s\n",val);
- fs_width = fs_height = 0;
- }
- }
-
- if (NULL != (val = cfg_get_str("global","pixsize"))) {
- if (2 != sscanf(val,"%d x %d",&pix_width,&pix_height)) {
- fprintf(stderr,"invalid value for pixsize: %s\n",val);
- pix_width = 128;
- pix_height = 96;
- }
- }
- if (-1 != (i = cfg_get_int("global","pixcols")))
- pix_cols = i;
-
- if (NULL != (val = cfg_get_str("global","wm-off-by"))) {
- if (2 != sscanf(val,"%d %d",&fs_xoff,&fs_yoff)) {
- fprintf(stderr,"invalid value for wm-off-by: %s\n",val);
- fs_xoff = fs_yoff = 0;
- }
- }
-
- if (-1 != (i = cfg_get_int("global","jpeg-quality")))
- jpeg_quality = i;
- if (-1 != (i = cfg_get_int("global","mjpeg-quality")))
- mjpeg_quality = i;
-
- if (NULL != (val = cfg_get_str("global","keypad-ntsc")))
- if (-1 != (i = str_to_int(val,booltab)))
- keypad_ntsc = i;
- if (NULL != (val = cfg_get_str("global","osd")))
- if (-1 != (i = str_to_int(val,booltab)))
- use_osd = i;
-
- /* launch */
- list = list = cfg_list_entries("launch");
- if (NULL != list) {
- for (; *list != NULL; list++) {
- if (NULL != (val = cfg_get_str("launch",*list)) &&
- 2 == sscanf(val,"%15[^,], %127[^\n]",
- key,cmdline)) {
- launch = realloc(launch,sizeof(struct LAUNCH)*(nlaunch+1));
- launch[nlaunch].name = strdup(*list);
- launch[nlaunch].key = strdup(key);
- launch[nlaunch].cmdline = strdup(cmdline);
-#ifndef NO_X11
- hotkey_launch(launch+nlaunch);
-#endif
- nlaunch++;
- } else {
- fprintf(stderr,"invalid value in section [launch]: %s\n",val);
- }
- }
- }
-
- /* channels */
- init_channel("defaults",&defaults);
- for (list = cfg_list_sections(); *list != NULL; list++) {
- if (0 == strcmp(*list,"defaults")) continue;
- if (0 == strcmp(*list,"global")) continue;
- if (0 == strcmp(*list,"launch")) continue;
- init_channel(*list,add_channel(*list));
- }
-
- /* calculate channel frequencies */
- defaults.channel = lookup_channel(defaults.cname);
- defaults.freq = get_freq(defaults.channel) + defaults.fine;
- calc_frequencies();
-#ifndef NO_X11
- for (i = 0; i < count; i++)
- configure_channel(channels[i]);
-#endif
-}
-
-/* ----------------------------------------------------------------------- */
-
-void
-save_config()
-{
- char filename1[100], filename2[100];
- FILE *fp;
- int i;
-
- sprintf(filename1,"%s/%s",getenv("HOME"),".xawtv");
- sprintf(filename2,"%s/%s",getenv("HOME"),".xawtv~");
-
- /* delete old backup */
- unlink(filename2);
-
- /* current becomes backup */
- if (0 == link(filename1,filename2))
- unlink(filename1);
-
- /* write new one... */
- fp = fopen(filename1,"w");
- if (NULL == fp) {
- fprintf(stderr,"can't open config file %s\n",filename1);
- return;
- }
-
- fprintf(fp,"[global]\n");
- if (fs_width && fs_height)
- fprintf(fp,"fullscreen = %d x %d\n",fs_width,fs_height);
- if (fs_xoff || fs_yoff)
- fprintf(fp,"wm-off-by = %+d%+d\n",fs_xoff,fs_yoff);
- fprintf(fp,"freqtab = %s\n",chanlists[chantab].name);
- fprintf(fp,"pixsize = %d x %d\n",pix_width,pix_height);
- fprintf(fp,"pixcols = %d\n",pix_cols);
- fprintf(fp,"jpeg-quality = %d\n",jpeg_quality);
- fprintf(fp,"mjpeg-quality = %d\n",mjpeg_quality);
- fprintf(fp,"keypad-ntsc = %s\n",int_to_str(keypad_ntsc,booltab));
- fprintf(fp,"osd = %s\n",int_to_str(use_osd,booltab));
- if (mixer)
- fprintf(fp,"mixer = %s\n",mixer);
- fprintf(fp,"\n");
-
- if (nlaunch > 0) {
- fprintf(fp,"[launch]\n");
- for (i = 0; i < nlaunch; i++) {
- fprintf(fp,"%s = %s, %s\n",
- launch[i].name,launch[i].key,launch[i].cmdline);
- }
- fprintf(fp,"\n");
- }
-
- /* write defaults */
- fprintf(fp,"[defaults]\n");
- fprintf(fp,"norm = %s\n",int_to_str(cur_norm,grabber->norms));
- fprintf(fp,"capture = %s\n",int_to_str(cur_capture,captab));
- fprintf(fp,"source = %s\n",
- int_to_str(cur_input,grabber->inputs));
- if (cur_color != 32768)
- fprintf(fp,"color = %d\n",cur_color);
- if (cur_bright != 32768)
- fprintf(fp,"bright = %d\n",cur_bright);
- if (cur_hue != 32768)
- fprintf(fp,"hue = %d\n",cur_hue);
- if (cur_contrast != 32768)
- fprintf(fp,"contrast = %d\n",cur_contrast);
- fprintf(fp,"\n");
-
- /* write channels */
- for (i = 0; i < count; i++) {
-
- fprintf(fp,"[%s]\n",channels[i]->name);
- fprintf(fp,"channel = %s\n",chanlist[channels[i]->channel].name);
- if (0 != channels[i]->fine)
- fprintf(fp,"fine = %+d\n", channels[i]->fine);
- if (cur_norm != channels[i]->norm)
- fprintf(fp,"norm = %s\n",
- int_to_str(cur_norm,grabber->norms));
- if (channels[i]->key != NULL)
- fprintf(fp,"key = %s\n",channels[i]->key);
-#if 0
- if (channels[i]->capture != cur_capture)
- fprintf(fp,"capture = %s\n",
- int_to_str(channels[i]->capture,captab));
-#endif
- if (channels[i]->input != cur_input)
- fprintf(fp,"input = %s\n",
- int_to_str(channels[i]->input,grabber->inputs));
-
- if (cur_color != channels[i]->color)
- fprintf(fp,"color = %d\n",channels[i]->color);
- if (cur_bright != channels[i]->bright)
- fprintf(fp,"bright = %d\n",channels[i]->bright);
- if (cur_hue != channels[i]->hue)
- fprintf(fp,"hue = %d\n",channels[i]->hue);
- if (cur_contrast != channels[i]->contrast)
- fprintf(fp,"contrast = %d\n",channels[i]->contrast);
-
- fprintf(fp,"\n");
- }
- fclose(fp);
-}
-
-/* ----------------------------------------------------------------------- */
-
-struct STRTAB booltab[] = {
- { 0, "no" },
- { 0, "false" },
- { 0, "off" },
- { 1, "yes" },
- { 1, "true" },
- { 1, "on" },
- { -1, NULL }
-};
-
-int
-str_to_int(char *str, struct STRTAB *tab)
-{
- int i;
-
- if (str[0] >= '0' && str[0] <= '9')
- return atoi(str);
- for (i = 0; tab[i].str != NULL; i++)
- if (0 == strcasecmp(str,tab[i].str))
- return(tab[i].nr);
- return -1;
-}
-
-char*
-int_to_str(int n, struct STRTAB *tab)
-{
- int i;
-
- for (i = 0; tab[i].str != NULL; i++)
- if (tab[i].nr == n)
- return tab[i].str;
- return NULL;
-}
-
diff --git a/src/channel.h b/src/channel.h
index 1a1dcff..514f4e6 100644
--- a/src/channel.h
+++ b/src/channel.h
@@ -11,10 +11,12 @@ struct CHANNEL {
int channel; /* index into tvtuner[] */
int fine;
int freq;
+ int audio;
int capture;
int input;
int norm;
+ int sat;
int color;
int bright;
@@ -42,7 +44,7 @@ extern int pix_width,pix_height,pix_cols;
extern int last_sender, cur_sender;
extern int cur_channel, cur_fine, cur_norm, cur_input;
extern int cur_color, cur_bright, cur_hue, cur_contrast, cur_capture;
-extern int cur_mute, cur_volume, cur_freq;
+extern int cur_movie, cur_mute, cur_volume, cur_freq;
int lookup_channel(char *channel);
int get_freq(int i);
@@ -52,10 +54,10 @@ struct CHANNEL* add_channel(char *name);
void hotkey_channel(struct CHANNEL *channel);
void configure_channel(struct CHANNEL *channel);
void del_channel(int nr);
-void calc_frequencies();
+void calc_frequencies(void);
-void read_config();
-void save_config();
+void read_config(void);
+void save_config(void);
/* ----------------------------------------------------------------------- */
@@ -74,5 +76,5 @@ extern struct STRTAB booltab[];
extern struct STRTAB captab[];
int str_to_int(char *str, struct STRTAB *tab);
-char* int_to_str(int n, struct STRTAB *tab);
+const char* int_to_str(int n, struct STRTAB *tab);
int attr_to_int(char *attr);
diff --git a/src/colorspace.c b/src/colorspace.c
index d05ec56..4b6cef5 100644
--- a/src/colorspace.c
+++ b/src/colorspace.c
@@ -234,7 +234,7 @@ rgb24_to_bgr24(unsigned char *dest, unsigned char *src, int p)
register unsigned char *s = src;
register unsigned char *d = dest;
- while (--p) {
+ while (p--) {
*(d++) = s[2];
*(d++) = s[1];
*(d++) = s[0];
diff --git a/src/colorspace.c.rej b/src/colorspace.c.rej
deleted file mode 100644
index 88dfa0d..0000000
--- a/src/colorspace.c.rej
+++ /dev/null
@@ -1,29 +0,0 @@
-***************
-*** 370,372 ****
- }
- }
- }
---- 370,392 ----
- }
- }
- }
-+
-+ void
-+ packed422_to_planar420(unsigned char *d, unsigned char *s, int p)
-+ {
-+ int i;
-+ unsigned char *y,*u;
-+
-+ i = (p)/2;
-+ y = d;
-+ u = y + p;
-+
-+ while (--i) {
-+ *(y++) = *(s++);
-+ *(u++) = *(s++);
-+ *(y++) = *(s++);
-+ s++;
-+ }
-+ }
-+
-+
diff --git a/src/commands.c b/src/commands.c
index 9ba734e..e5cc164 100644
--- a/src/commands.c
+++ b/src/commands.c
@@ -6,6 +6,7 @@
#include <errno.h>
#include <math.h>
#include <stdarg.h>
+#include <time.h>
#include <X11/Intrinsic.h>
@@ -13,8 +14,9 @@
#include "commands.h"
#include "writefile.h"
-#include "grab.h"
+#include "grab-ng.h"
#include "channel.h"
+#include "webcam.h"
#include "frequencies.h"
#include "sound.h"
@@ -23,6 +25,7 @@
/* feedback for the user */
void (*update_title)(char *message);
void (*display_message)(char *message);
+void (*vtx_message)(int argc, char **argv);
/* for updating GUI elements / whatever */
void (*norm_notify)(void);
@@ -33,15 +36,17 @@ void (*setfreqtab_notify)(void);
void (*setstation_notify)(void);
/* gets called _before_ channel switches */
-void (*channel_switch_hook)();
+void (*channel_switch_hook)(void);
/* capture overlay/grab/off */
void (*set_capture_hook)(int old, int new);
/* toggle fullscreen */
-void (*fullscreen_hook)();
-void (*exit_hook)();
-void (*reconfigure_hook)();
+void (*fullscreen_hook)(void);
+void (*exit_hook)(void);
+void (*capture_get_hook)(void);
+void (*capture_rel_hook)(void);
+void (*movie_hook)(int argc, char **argv);
int do_overlay;
char *snapbase = "snap";
@@ -60,10 +65,15 @@ static int capture_handler(char *name, int argc, char **argv);
static int volume_handler(char *name, int argc, char **argv);
static int attr_handler(char *name, int argc, char **argv);
+static int dattr_handler(char *name, int argc, char **argv);
static int snap_handler(char *name, int argc, char **argv);
+static int webcam_handler(char *name, int argc, char **argv);
+static int movie_handler(char *name, int argc, char **argv);
static int fullscreen_handler(char *name, int argc, char **argv);
static int msg_handler(char *name, int argc, char **argv);
+static int showtime_handler(char *name, int argc, char **argv);
+static int vtx_handler(char *name, int argc, char **argv);
static int exit_handler(char *name, int argc, char **argv);
static int keypad_handler(char *name, int argc, char **argv);
@@ -86,16 +96,21 @@ static struct COMMANDS {
{ "hue", 0, attr_handler },
{ "bright", 0, attr_handler },
{ "contrast", 0, attr_handler },
+ { "attr", 0, dattr_handler },
{ "snap", 0, snap_handler },
+ { "webcam", 1, webcam_handler },
+ { "movie", 1, movie_handler },
{ "fullscreen", 0, fullscreen_handler },
{ "msg", 1, msg_handler },
+ { "vtx", 0, vtx_handler },
{ "message", 0, msg_handler },
{ "exit", 0, exit_handler },
{ "quit", 0, exit_handler },
{ "bye", 0, exit_handler },
{ "keypad", 1, keypad_handler },
+ { "showtime", 0, showtime_handler },
{ NULL, 0, NULL }
};
@@ -113,6 +128,10 @@ static struct PICT_ATTR {
#define NUM_ATTR (sizeof(pict_attr)/sizeof(struct PICT_ATTR))
+static int cur_dattr = 0;
+static char *dattr[] = { "volume", "bright", "contrast", "color", "hue" };
+#define NUM_DATTR (sizeof(dattr)/sizeof(char*))
+
static int keypad_state = -1;
/*------------------------------------------------------------------------*/
@@ -133,11 +152,6 @@ missing_feature(int id)
sprintf(message,"Grabbing is not supported by \"%s\".",
grabber->name);
break;
-#ifndef HAVE_LIBJPEG
- case MISSING_JPEG:
- sprintf(message,"This binary has no JPEG support.");
- break;
-#endif
default:
strcpy(message,"Oops, you should'nt see this message.");
break;
@@ -192,7 +206,7 @@ do_command(int argc, char **argv)
return -1;
}
if (argc-1 < commands[i].min_args) {
- fprintf(stderr,"no enouth args for %s\n",argv[0]);
+ fprintf(stderr,"no enough args for %s\n",argv[0]);
return -1;
} else {
return commands[i].handler(argv[0],argc-1,argv+1);
@@ -291,6 +305,9 @@ set_attr(int id, int val)
{
int i;
+ if (!grabber->grab_hasattr(id))
+ return;
+
for (i = 0; i < NUM_ATTR; i++)
if (id == pict_attr[i].id)
break;
@@ -320,7 +337,7 @@ set_freqtab(int j)
}
static void
-set_volume()
+set_volume(void)
{
int vol;
@@ -340,23 +357,20 @@ set_volume()
}
static void
-set_title()
+set_title(void)
{
static char title[256];
keypad_state = -1;
if (update_title) {
if (-1 != cur_sender) {
-#if 0
- sprintf(title,"%d - %s",cur_sender+1,channels[cur_sender]->name);
-#endif
sprintf(title,"%s",channels[cur_sender]->name);
} else if (-1 != cur_channel) {
sprintf(title,"channel %s",chanlist[cur_channel].name);
if (cur_fine != 0)
sprintf(title+strlen(title)," (%d)",cur_fine);
sprintf(title+strlen(title)," (%s/%s)",
- grabber->norms[cur_norm].str,
+ (-1 != cur_norm) ? grabber->norms[cur_norm].str : "???",
chanlists[chantab].name);
} else {
sprintf(title,"???");
@@ -492,7 +506,7 @@ set_defaults()
cur_fine = defaults.fine;
cur_freq = defaults.freq;
if (grabber->grab_tune)
- grabber->grab_tune(defaults.freq);
+ grabber->grab_tune(defaults.freq,defaults.sat);
}
/* ----------------------------------------------------------------------- */
@@ -560,14 +574,14 @@ static int setstation_handler(char *name, int argc, char **argv)
cur_fine = channels[i]->fine;
cur_freq = channels[i]->freq;
if (grabber->grab_tune)
- grabber->grab_tune(channels[i]->freq);
+ grabber->grab_tune(channels[i]->freq,channels[i]->sat);
set_title();
if (setstation_notify)
setstation_notify();
if (!cur_mute) {
- usleep(2000);
+ usleep(20000);
if (have_mixer)
mixer_unmute();
else
@@ -630,14 +644,14 @@ static int setchannel_handler(char *name, int argc, char **argv)
set_capture(defaults.capture);
if (grabber->grab_tune)
- grabber->grab_tune(cur_freq);
+ grabber->grab_tune(cur_freq,-1);
set_title();
if (setstation_notify)
setstation_notify();
if (!cur_mute) {
- usleep(2000);
+ usleep(20000);
if (have_mixer)
mixer_unmute();
else
@@ -762,6 +776,30 @@ static int attr_handler(char *name, int argc, char **argv)
return 0;
}
+static int dattr_handler(char *name, int argc, char **argv)
+{
+ int i;
+
+ if (argc > 0 && 0 == strcasecmp(argv[0],"next")) {
+ cur_dattr++;
+ cur_dattr %= NUM_DATTR;
+ argc = 0;
+ }
+ if (argc > 0) {
+ for (i = 0; i < NUM_DATTR; i++)
+ if (0 == strcasecmp(argv[0],dattr[i]))
+ break;
+ if (i < NUM_DATTR) {
+ cur_dattr = i;
+ argc = 0;
+ }
+ }
+ if (0 == cur_dattr)
+ return volume_handler("volume",argc,argv);
+ else
+ return attr_handler(dattr[cur_dattr],argc,argv);
+}
+
/* ----------------------------------------------------------------------- */
static int snap_handler(char *hname, int argc, char **argv)
@@ -783,6 +821,15 @@ static int snap_handler(char *hname, int argc, char **argv)
return -1;
}
+ if (0 != cur_movie) {
+ if (display_message)
+ display_message("grabber busy");
+ return -1;
+ }
+
+ if (capture_get_hook)
+ capture_get_hook();
+
/* format */
if (argc > 0) {
if (0 == strcasecmp(argv[0],"jpeg"))
@@ -812,8 +859,8 @@ static int snap_handler(char *hname, int argc, char **argv)
filename = argv[2];
if (0 != grabber_setparams(VIDEO_RGB24,&width,&height,
- &linelength,0) ||
- NULL == (buffer = grabber_capture(NULL,0,1,NULL))) {
+ &linelength,0,1) ||
+ NULL == (buffer = grabber_capture(NULL,0,NULL))) {
if (display_message)
display_message("grabbing failed");
ret = -1;
@@ -832,15 +879,11 @@ static int snap_handler(char *hname, int argc, char **argv)
}
if (jpeg) {
-#ifdef HAVE_LIBJPEG
if (-1 == write_jpeg(filename,buffer,width,height, jpeg_quality, 0)) {
sprintf(message,"open %s: %s\n",filename,strerror(errno));
} else {
sprintf(message,"saved jpeg: %s",filename);
}
-#else
- missing_feature(MISSING_JPEG);
-#endif
} else {
if (-1 == write_ppm(filename,buffer,width,height)) {
sprintf(message,"open %s: %s\n",filename,strerror(errno));
@@ -848,18 +891,51 @@ static int snap_handler(char *hname, int argc, char **argv)
sprintf(message,"saved ppm: %s",filename);
}
}
- if (grabber->grab_cleanup)
- grabber->grab_cleanup();
if (display_message)
display_message(message);
- /* set parameters to main window size (for grabdisplay) */
done:
- if (reconfigure_hook)
- reconfigure_hook();
+ if (capture_rel_hook)
+ capture_rel_hook();
return ret;
}
+static int webcam_handler(char *hname, int argc, char **argv)
+{
+ int width = grab_width, height = grab_height, linelength = 0;
+
+ if (webcam)
+ free(webcam);
+ webcam = strdup(argv[0]);
+
+ /* if either avi recording or grabdisplay is active, we do
+ /not/ stop capture and switch the video format. The next
+ capture will send a copy of the frame to the webcam thread
+ and it has to deal with it as-is */
+ if (cur_movie)
+ return 0;
+ if (cur_capture == CAPTURE_GRABDISPLAY)
+ return 0;
+
+ /* if no capture is running we can switch to RGB first to make
+ the webcam happy */
+ if (capture_get_hook)
+ capture_get_hook();
+ grabber_setparams(VIDEO_RGB24,&width,&height,&linelength,0,0);
+ grabber_capture(NULL,0,NULL);
+ if (capture_rel_hook)
+ capture_rel_hook();
+ return 0;
+}
+
+static int movie_handler(char *name, int argc, char **argv)
+{
+ if (!movie_hook)
+ return 0;
+ movie_hook(argc,argv);
+ return 0;
+}
+
static int
fullscreen_handler(char *name, int argc, char **argv)
{
@@ -877,6 +953,29 @@ msg_handler(char *name, int argc, char **argv)
}
static int
+showtime_handler(char *name, int argc, char **argv)
+{
+ char timestr[6];
+ struct tm *times;
+ time_t timet;
+
+ timet = time(NULL);
+ times = localtime(&timet);
+ strftime(timestr, 6, "%k:%M", times);
+ if (display_message)
+ display_message(timestr);
+ return 0;
+}
+
+static int
+vtx_handler(char *name, int argc, char **argv)
+{
+ if (vtx_message)
+ vtx_message(argc,argv);
+ return 0;
+}
+
+static int
exit_handler(char *name, int argc, char **argv)
{
if (exit_hook)
diff --git a/src/commands.h b/src/commands.h
index 64e13ff..98bfe2b 100644
--- a/src/commands.h
+++ b/src/commands.h
@@ -1,6 +1,7 @@
/* feedback for the user */
extern void (*update_title)(char *message);
extern void (*display_message)(char *message);
+extern void (*vtx_message)(int argc, char **argv);
/* for updating GUI elements / whatever */
extern void (*norm_notify)(void);
@@ -11,15 +12,17 @@ extern void (*setfreqtab_notify)(void);
extern void (*setstation_notify)(void);
/* gets called _before_ channel switches */
-extern void (*channel_switch_hook)();
+extern void (*channel_switch_hook)(void);
/* capture overlay/grab/off */
extern void (*set_capture_hook)(int old, int new);
/* toggle fullscreen */
-extern void (*fullscreen_hook)();
-extern void (*exit_hook)();
-extern void (*reconfigure_hook)();
+extern void (*fullscreen_hook)(void);
+extern void (*exit_hook)(void);
+extern void (*capture_get_hook)(void);
+extern void (*capture_rel_hook)(void);
+extern void (*movie_hook)(int argc, char **argv);
extern int do_overlay;
extern char *snapbase;
@@ -33,11 +36,11 @@ extern int grab_width, grab_height;
void missing_feature(int id);
-void attr_init();
-void audio_init();
-void audio_on();
-void audio_off();
-void set_defaults();
+void attr_init(void);
+void audio_init(void);
+void audio_on(void);
+void audio_off(void);
+void set_defaults(void);
int do_va_cmd(int argc, ...);
int do_command(int argc, char **argv);
diff --git a/src/conf.c b/src/conf.c
index 6248a9a..523425b 100644
--- a/src/conf.c
+++ b/src/conf.c
@@ -31,9 +31,9 @@
/*-------------------------------------------------------------------------*/
-void pixit();
+void pixit(void);
void set_channel(struct CHANNEL *channel);
-void channel_menu();
+void channel_menu(void);
extern Widget app_shell,conf_shell;
extern Display *dpy;
@@ -50,7 +50,7 @@ static String *channel_list;
/*-------------------------------------------------------------------------*/
-void conf_station_switched();
+void conf_station_switched(void);
static void list_cb(Widget widget, XtPointer clientdata, XtPointer call_data)
{
@@ -76,6 +76,7 @@ static void add_cb(Widget widget, XtPointer clientdata, XtPointer call_data)
channel->key = strdup(key);
channel->cname = (cur_channel != -1) ? chanlist[cur_channel].name : "???";
channel->channel = cur_channel;
+ channel->input = cur_input;
channel->fine = cur_fine;
configure_channel(channel);
channel_menu();
@@ -161,7 +162,7 @@ static void key_eh(Widget widget, XtPointer client_data,
XtNtop,XawChainTop, \
XtNbottom,XawChainTop
-void create_confwin()
+void create_confwin(void)
{
Widget form, label, command;
@@ -271,7 +272,7 @@ void create_confwin()
/*-------------------------------------------------------------------------*/
-void conf_station_switched()
+void conf_station_switched(void)
{
char line[128] = "???";
@@ -297,7 +298,7 @@ void conf_station_switched()
}
}
-void conf_list_update()
+void conf_list_update(void)
{
int i;
diff --git a/src/fbtools.c b/src/fbtools.c
index 5f746f4..7650735 100644
--- a/src/fbtools.c
+++ b/src/fbtools.c
@@ -396,15 +396,15 @@ fb_init(char *device, char *font, char *mode, int vt)
if (NULL == device) {
#ifdef FBIOGET_CON2FBMAP
struct fb_con2fbmap c2m;
- if (-1 == (fb = open("/dev/fb0",O_RDWR,0))) {
+ if (-1 == (fb = open("/dev/fb0",O_WRONLY,0))) {
fprintf(stderr,"open /dev/fb0: %s\n",strerror(errno));
- goto err;
+ exit(1);
}
fstat(tty,&st);
c2m.console = st.st_rdev & 0xff /* FIXME: where is MAJOR() ??? */;
if (-1 == ioctl(fb, FBIOGET_CON2FBMAP, &c2m)) {
perror("ioctl FBIOGET_CON2FBMAP");
- goto err;
+ exit(1);
}
close(fb);
fprintf(stderr,"map: vt%02d => fb%d\n",c2m.console,c2m.framebuffer);
@@ -415,13 +415,13 @@ fb_init(char *device, char *font, char *mode, int vt)
#endif
}
}
-
+
fb_readfont(font ? fonts : default_font);
/* get current settings (which we have to restore) */
if (-1 == (fb = open(device,O_RDWR /* O_WRONLY */))) {
fprintf(stderr,"open %s: %s\n",device,strerror(errno));
- goto err;
+ exit(1);
}
if (-1 == ioctl(fb,FBIOGET_VSCREENINFO,&fb_ovar)) {
perror("ioctl FBIOGET_VSCREENINFO");
diff --git a/src/fbtools.h b/src/fbtools.h
index eed6b9a..9c829bc 100644
--- a/src/fbtools.h
+++ b/src/fbtools.h
@@ -20,6 +20,6 @@ int fb_puts(int x, int y, char *text);
void fb_memset(void *addr, int c, size_t len);
/* console switching */
-int fb_switch_init();
-void fb_switch_release();
-void fb_switch_acquire();
+int fb_switch_init(void);
+void fb_switch_release(void);
+void fb_switch_acquire(void);
diff --git a/src/fbtv.c b/src/fbtv.c
index e14cf7c..859762b 100644
--- a/src/fbtv.c
+++ b/src/fbtv.c
@@ -1,8 +1,7 @@
-
/*
* console TV application. Uses a framebuffer device.
*
- * (c) 1998 Gerd Knorr <kraxel@goldbach.in-berlin.de>
+ * (c) 1998-2000 Gerd Knorr <kraxel@goldbach.in-berlin.de>
*
*/
@@ -30,6 +29,7 @@
#include "config.h"
+#include "grab-ng.h"
#include "fbtools.h"
#include "matrox.h"
#include "writefile.h"
@@ -37,7 +37,6 @@
#include "channel.h"
#include "frequencies.h"
#include "commands.h"
-#include "grab.h"
#include "lirc.h"
#define MAX(x,y) ((x)>(y)?(x):(y))
@@ -108,6 +107,9 @@ static struct KEYTAB keytab[] = {
{ 'V', 2, { "capture", "toggle" }},
{ 'v', 2, { "capture", "toggle" }},
+ { 'F', 2, { "fullscreen", "toggle" }},
+ { 'f', 2, { "fullscreen", "toggle" }},
+
{ '0', 2, { "keypad", "0" }},
{ '1', 2, { "keypad", "1" }},
{ '2', 2, { "keypad", "2" }},
@@ -219,7 +221,7 @@ fb_initcolors(int fd, int gray)
}
void
-tty_init()
+tty_init(void)
{
/* we use curses just for kbd input */
initscr();
@@ -229,7 +231,7 @@ tty_init()
}
void
-tty_cleanup()
+tty_cleanup(void)
{
clear();
refresh();
@@ -259,8 +261,8 @@ void do_capture(int from, int to)
/* off */
switch (from) {
case CAPTURE_GRABDISPLAY:
- if (grabber->grab_cleanup)
- grabber->grab_cleanup();
+ if (grabber->grab_stop)
+ grabber->grab_stop();
break;
case CAPTURE_OVERLAY:
grabber->grab_overlay(0,0,0,0,0,NULL,0);
@@ -275,7 +277,7 @@ void do_capture(int from, int to)
if (ww && hh) {
dw = ww;
dh = hh;
- grabber_setparams(x11_native_format, &dw, &dh, &ll, 0);
+ grabber_setparams(x11_native_format, &dw, &dh, &ll, 0, 1);
dx = fb_var.xres-dw;
dy = 0;
} else {
@@ -288,10 +290,12 @@ void do_capture(int from, int to)
}
dw = fb_var.xres-dx;
dh = fb_var.yres-dy;
- grabber_setparams(x11_native_format, &dw, &dh, &ll, 0);
+ grabber_setparams(x11_native_format, &dw, &dh, &ll, 0, 1);
dx += (fb_var.xres-24-dw)/2;
dy += (fb_var.yres-16-dh)/2;
}
+ if (grabber->grab_start)
+ grabber->grab_start(-1,2);
off = dy * fb_fix.line_length + dx * ((fb_var.bits_per_pixel+7)/8);
break;
case CAPTURE_OVERLAY:
@@ -325,6 +329,8 @@ void do_capture(int from, int to)
height = 240;
starty = fb_var.yres-height;
#endif
+ if (width*2 > fb_fix.line_length)
+ width = fb_fix.line_length/2;
pitch = fb_fix.line_length;
grabber->grab_offscreen(starty,width,height,VIDEO_YUV422);
gfx_scaler_on(starty*pitch,pitch,width,height,dx,dx+dw,dy,dy+dh);
@@ -336,7 +342,7 @@ void do_capture(int from, int to)
}
static void
-do_exit()
+do_exit(void)
{
sig = 1;
}
@@ -354,7 +360,7 @@ new_message(char *txt)
}
void
-channel_menu()
+channel_menu(void)
{
int i,f;
char key[32],ctrl[16];
@@ -375,10 +381,19 @@ channel_menu()
}
}
+static void
+do_fullscreen(void)
+{
+ do_va_cmd(2,"capture","off");
+ quiet = !quiet;
+ fb_memset(fb_mem+fb_mem_offset,0,fb_fix.smem_len);
+ do_va_cmd(2,"capture","on");
+}
+
/*--- main ---------------------------------------------------------------*/
static void
-grabber_init()
+grabber_init(void)
{
grabber_open(device,
fb_var.xres_virtual,
@@ -389,7 +404,7 @@ grabber_init()
}
void
-console_switch()
+console_switch(void)
{
switch (fb_switch_state) {
case FB_REL_REQ:
@@ -434,6 +449,7 @@ int
main(int argc, char *argv[])
{
int key,i,c,gray=0,rc,vt=0,fps=0,t1,t2,lirc;
+ unsigned long freq;
struct timeval tv;
time_t t;
char text[80];
@@ -526,6 +542,7 @@ main(int argc, char *argv[])
display_message = new_message;
set_capture_hook = do_capture;
exit_hook = do_exit;
+ fullscreen_hook = do_fullscreen;
tty_init();
atexit(tty_cleanup);
@@ -534,8 +551,8 @@ main(int argc, char *argv[])
/* init hardware */
attr_init();
- audio_init();
audio_on();
+ audio_init();
do_va_cmd(2,"setfreqtab",chanlist_names[chantab].str);
cur_capture = 0;
@@ -543,7 +560,14 @@ main(int argc, char *argv[])
if (optind+1 == argc) {
do_va_cmd(2,"setstation",argv[optind]);
} else {
- if (!grabber->grab_tuned || !grabber->grab_tuned()) {
+ if (grabber->grab_tune && 0 != (freq = grabber->grab_tune(-1,-1))) {
+ for (i = 0; i < chancount; i++)
+ if (chanlist[i].freq == freq*1000/16) {
+ do_va_cmd(2,"setchannel",chanlist[i].name);
+ break;
+ }
+ }
+ if (-1 == cur_channel) {
if (count > 0)
do_va_cmd(2,"setstation","0");
else
@@ -600,7 +624,7 @@ main(int argc, char *argv[])
if (cur_capture == CAPTURE_GRABDISPLAY) {
fps++;
grabber_capture(fb_mem+fb_mem_offset+off,
- fb_fix.line_length,0,NULL);
+ fb_fix.line_length,NULL);
tv.tv_sec = 0;
tv.tv_usec = 0;
rc = select(MAX(0,lirc)+1,&set,NULL,NULL,&tv);
@@ -633,19 +657,11 @@ main(int argc, char *argv[])
case -1:
break;
- case 'f':
- case 'F':
- do_va_cmd(2,"capture","off");
- quiet = !quiet;
- fb_memset(fb_mem+fb_mem_offset,0,fb_fix.smem_len);
- do_va_cmd(2,"capture","on");
- break;
-
-#if 0
+#if 1
case 'y':
- scaler_test(1);
+ /* scaler_test(1); */
do_va_cmd(2,"capture","off");
- do_va_cmd(2,"capture","on");
+ do_va_cmd(2,"capture","grab");
break;
#endif
diff --git a/src/fix b/src/fix
deleted file mode 100644
index 7e0fdab..0000000
--- a/src/fix
+++ /dev/null
@@ -1,19 +0,0 @@
---- main.c~ Sun Jan 9 10:27:43 2000
-+++ main.c Wed Jan 12 19:22:15 2000
-@@ -2551,6 +2551,7 @@
-
- cur_capture = 0;
- do_va_cmd(2,"capture","overlay");
-+ set_property(0,NULL,NULL);
- if (optind+1 == argc) {
- do_va_cmd(2,"setstation",argv[optind]);
- } else {
-@@ -2559,8 +2560,6 @@
- do_va_cmd(2,"setstation","0");
- else
- set_defaults();
-- } else {
-- set_property(0,NULL,NULL);
- }
- }
-
diff --git a/src/frequencies.c b/src/frequencies.c
index 3b36d84..2c59e33 100644
--- a/src/frequencies.c
+++ b/src/frequencies.c
@@ -1,4 +1,5 @@
#include <stdlib.h>
+#include <sys/time.h>
#include "frequencies.h"
#include "grab.h"
@@ -510,6 +511,7 @@ static struct CHANLIST pal_australia[] = {
{ "3", 86250 },
{ "4", 95250 },
{ "5", 102250 },
+ { "5A", 138250 },
{ "6", 175250 },
{ "7", 182250 },
{ "8", 189250 },
@@ -634,7 +636,7 @@ static struct CHANLIST pal_australia[] = {
{ "R2", 59250 }, \
\
{ "R3", 77250 }, \
- { "R4", 84250 }, \
+ { "R4", 85250 }, \
{ "R5", 93250 }, \
\
{ "R6", 175250 }, \
@@ -716,21 +718,19 @@ static struct CHANLIST pal_australia[] = {
{ "68", 847250 }, \
{ "69", 855250 }
-static struct CHANLIST europe_cable[] = {
+static struct CHANLIST europe_west[] = {
FREQ_CCIR_I_III,
FREQ_CCIR_SL_SH,
FREQ_CCIR_H,
FREQ_UHF
};
-static struct CHANLIST europe_bcast_west[] = {
- FREQ_CCIR_I_III,
- FREQ_UHF
-};
-
-static struct CHANLIST europe_bcast_east[] = {
+static struct CHANLIST europe_east[] = {
FREQ_OIRT_I_III,
FREQ_OIRT_SL_SH,
+ FREQ_CCIR_I_III,
+ FREQ_CCIR_SL_SH,
+ FREQ_CCIR_H,
FREQ_UHF
};
@@ -746,6 +746,7 @@ static struct CHANLIST pal_italy[] = {
{ "10", 210250 },
{ "11", 217250 },
{ "12", 224250 },
+ FREQ_UHF
};
static struct CHANLIST pal_ireland[] = {
@@ -818,30 +819,132 @@ static struct CHANLIST pal_newzealand[] = {
{ "3", 62250 },
{ "4", 175250 },
{ "5", 182250 },
- { "5A", 138250 },
{ "6", 189250 },
{ "7", 196250 },
{ "8", 203250 },
{ "9", 210250 },
{ "10", 217250 },
+ { "11", 224250 },
+ FREQ_UHF,
};
/* --------------------------------------------------------------------- */
+/* China broadcast */
+static struct CHANLIST pal_bcast_cn[] = {
+ { "1", 49750 },
+ { "2", 57750 },
+ { "3", 65750 },
+ { "4", 77250 },
+ { "5", 85250 },
+ { "6", 112250 },
+ { "7", 120250 },
+ { "8", 128250 },
+ { "9", 136250 },
+ { "10", 144250 },
+ { "11", 152250 },
+ { "12", 160250 },
+ { "13", 168250 },
+ { "14", 176250 },
+ { "15", 184250 },
+ { "16", 192250 },
+ { "17", 200250 },
+ { "18", 208250 },
+ { "19", 216250 },
+ { "20", 224250 },
+ { "21", 232250 },
+ { "22", 240250 },
+ { "23", 248250 },
+ { "24", 256250 },
+ { "25", 264250 },
+ { "26", 272250 },
+ { "27", 280250 },
+ { "28", 288250 },
+ { "29", 296250 },
+ { "30", 304250 },
+ { "31", 312250 },
+ { "32", 320250 },
+ { "33", 328250 },
+ { "34", 336250 },
+ { "35", 344250 },
+ { "36", 352250 },
+ { "37", 360250 },
+ { "38", 368250 },
+ { "39", 376250 },
+ { "40", 384250 },
+ { "41", 392250 },
+ { "42", 400250 },
+ { "43", 408250 },
+ { "44", 416250 },
+ { "45", 424250 },
+ { "46", 432250 },
+ { "47", 440250 },
+ { "48", 448250 },
+ { "49", 456250 },
+ { "50", 463250 },
+ { "51", 471250 },
+ { "52", 479250 },
+ { "53", 487250 },
+ { "54", 495250 },
+ { "55", 503250 },
+ { "56", 511250 },
+ { "57", 519250 },
+ { "58", 527250 },
+ { "59", 535250 },
+ { "60", 543250 },
+ { "61", 551250 },
+ { "62", 559250 },
+ { "63", 607250 },
+ { "64", 615250 },
+ { "65", 623250 },
+ { "66", 631250 },
+ { "67", 639250 },
+ { "68", 647250 },
+ { "69", 655250 },
+ { "70", 663250 },
+ { "71", 671250 },
+ { "72", 679250 },
+ { "73", 687250 },
+ { "74", 695250 },
+ { "75", 703250 },
+ { "76", 711250 },
+ { "77", 719250 },
+ { "78", 727250 },
+ { "79", 735250 },
+ { "80", 743250 },
+ { "81", 751250 },
+ { "82", 759250 },
+ { "83", 767250 },
+ { "84", 775250 },
+ { "85", 783250 },
+ { "86", 791250 },
+ { "87", 799250 },
+ { "88", 807250 },
+ { "89", 815250 },
+ { "90", 823250 },
+ { "91", 831250 },
+ { "92", 839250 },
+ { "93", 847250 },
+ { "94", 855250 },
+};
+
+/* --------------------------------------------------------------------- */
+
+
struct CHANLISTS chanlists[] = {
{ "us-bcast", ntsc_bcast, CHAN_COUNT(ntsc_bcast) },
{ "us-cable", ntsc_cable, CHAN_COUNT(ntsc_cable) },
{ "us-cable-hrc", ntsc_hrc, CHAN_COUNT(ntsc_hrc) },
{ "japan-bcast", ntsc_bcast_jp, CHAN_COUNT(ntsc_bcast_jp) },
{ "japan-cable", ntsc_cable_jp, CHAN_COUNT(ntsc_cable_jp) },
- { "europe-bcast-west",europe_bcast_west, CHAN_COUNT(europe_bcast_west) },
- { "europe-bcast-east",europe_bcast_east, CHAN_COUNT(europe_bcast_east) },
- { "europe-cable", europe_cable, CHAN_COUNT(europe_cable) },
+ { "europe-west", europe_west, CHAN_COUNT(europe_west) },
+ { "europe-east", europe_east, CHAN_COUNT(europe_east) },
{ "italy", pal_italy, CHAN_COUNT(pal_italy) },
{ "newzealand", pal_newzealand, CHAN_COUNT(pal_newzealand) },
{ "australia", pal_australia, CHAN_COUNT(pal_australia) },
{ "ireland", pal_ireland, CHAN_COUNT(pal_ireland) },
{ "france", secam_france, CHAN_COUNT(secam_france) },
+ { "china-bcast", pal_bcast_cn, CHAN_COUNT(pal_bcast_cn) },
{ NULL, NULL, 0 } /* EOF */
};
@@ -851,17 +954,17 @@ struct STRTAB chanlist_names[] = {
{ 2, "us-cable-hrc" },
{ 3, "japan-bcast" },
{ 4, "japan-cable" },
- { 5, "europe-bcast-west" },
- { 6, "europe-bcast-east" },
- { 7, "europe-cable" },
- { 8, "italy" },
- { 9, "newzealand" },
- { 10, "australia" },
- { 11, "ireland" },
- { 12, "france" },
+ { 5, "europe-west" },
+ { 6, "europe-east" },
+ { 7, "italy" },
+ { 8, "newzealand" },
+ { 9, "australia" },
+ { 10, "ireland" },
+ { 11, "france" },
+ { 12, "china-bcast" },
{ -1, NULL }
};
-int chantab = 7;
-struct CHANLIST *chanlist = europe_cable;
-int chancount = CHAN_COUNT(europe_cable);
+int chantab = 5;
+struct CHANLIST *chanlist = europe_west;
+int chancount = CHAN_COUNT(europe_west);
diff --git a/src/grab-bsd.c b/src/grab-bsd.c
new file mode 100644
index 0000000..2a48b0e
--- /dev/null
+++ b/src/grab-bsd.c
@@ -0,0 +1,581 @@
+/*
+ * interface to the bsd bktr driver
+ *
+ * (c) 2000 Gerd Knorr <kraxel@goldbach.in-berlin.de>
+ *
+ */
+#include "config.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <math.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <string.h>
+#include <signal.h>
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/ioctl.h>
+#include <sys/stat.h>
+#include <sys/mman.h>
+#ifdef HAVE_ENDIAN_H
+# include <endian.h>
+#endif
+
+#include <X11/Intrinsic.h>
+
+#include "grab.h"
+#include "colorspace.h"
+
+#if !defined(__OpenBSD__)
+struct GRABBER grab_bsd = {};
+#else /* BSD */
+
+#include <machine/ioctl_bt848.h>
+#include <machine/ioctl_meteor.h>
+
+/* ---------------------------------------------------------------------- */
+/* global variables */
+
+static int fd = -1;
+static int tfd = -1;
+
+static int pf_count;
+static struct meteor_pixfmt pf[64];
+static int xawtv2pf[VIDEO_FMT_MAX];
+static unsigned char *mmap_buf;
+
+static int muted;
+
+#if 0
+static struct V4L2_ATTR {
+ int id;
+ int v4l2;
+} v4l2_attr[] = {
+ { GRAB_ATTR_VOLUME, V4L2_CID_AUDIO_VOLUME },
+ { GRAB_ATTR_MUTE, V4L2_CID_AUDIO_MUTE },
+ { GRAB_ATTR_COLOR, V4L2_CID_SATURATION },
+ { GRAB_ATTR_BRIGHT, V4L2_CID_BRIGHTNESS },
+ { GRAB_ATTR_HUE, V4L2_CID_HUE },
+ { GRAB_ATTR_CONTRAST, V4L2_CID_CONTRAST },
+};
+#define NUM_ATTR (sizeof(v4l2_attr)/sizeof(struct V4L2_ATTR))
+#endif
+
+/* ---------------------------------------------------------------------- */
+/* prototypes */
+
+/* open/close */
+static int bsd_open(char *filename);
+static int bsd_close(void);
+
+/* control */
+static int bsd_input(int input, int norm);
+static int bsd_hasattr(int id);
+static int bsd_getattr(int id);
+static int bsd_setattr(int id, int vol);
+
+static unsigned long bsd_tune(unsigned long freq, int sat);
+#if 0
+static int bsd_tuned(void);
+#endif
+
+/* capture */
+static int bsd_setparm(int format, int *width, int *height, int *linelength);
+static void bsd_start(int fps, int buffers);
+static void* bsd_capture(void);
+static void bsd_stop(void);
+
+/* overlay */
+static int bsd_setupfb(int sw, int sh, int format, void *base, int bpl);
+static int bsd_overlay(int x, int y, int width, int height, int format,
+ struct OVERLAY_CLIP *oc, int count);
+
+/* ---------------------------------------------------------------------- */
+
+static struct STRTAB inputs[] = {
+ { 0, "Television" },
+ { 1, "Composite1" },
+ { 2, "S-Video" },
+ { 3, "CSVIDEO" },
+ { -1, NULL }
+};
+static int inputs_map[] = {
+ METEOR_INPUT_DEV1,
+ METEOR_INPUT_DEV0,
+ METEOR_INPUT_DEV_SVIDEO,
+ METEOR_INPUT_DEV2,
+};
+
+static struct STRTAB norms[] = {
+ { 0, "NTSC" },
+ { 1, "NTSC-JP" },
+ { 2, "PAL" },
+ { 3, "PAL-M" },
+ { 4, "PAL-N" },
+ { 5, "SECAM" },
+ { 6, "RSVD" },
+ { -1, NULL }
+};
+static int norms_map[] = {
+ BT848_IFORM_F_NTSCM,
+ BT848_IFORM_F_NTSCJ,
+ BT848_IFORM_F_PALBDGHI,
+ BT848_IFORM_F_PALM,
+ BT848_IFORM_F_PALN,
+ BT848_IFORM_F_SECAM,
+ BT848_IFORM_F_RSVD,
+};
+
+struct GRABBER grab_bsd = {
+ name: "bktr",
+ norms: norms,
+ inputs: inputs,
+
+ grab_open: bsd_open,
+ grab_close: bsd_close,
+
+ grab_setupfb: bsd_setupfb,
+
+ grab_input: bsd_input,
+ grab_hasattr: bsd_hasattr,
+ grab_getattr: bsd_getattr,
+ grab_setattr: bsd_setattr,
+};
+
+
+/* ---------------------------------------------------------------------- */
+/* debug output */
+
+void
+bsd_print_format(struct meteor_pixfmt *pf, int format)
+{
+ switch (pf->type) {
+ case METEOR_PIXTYPE_RGB:
+ fprintf(stderr,
+ "bktr: pf: rgb bpp=%d mask=%ld,%ld,%ld sbytes=%d sshorts=%d",
+ pf->Bpp,pf->masks[0],pf->masks[1],pf->masks[2],
+ pf->swap_bytes,pf->swap_shorts);
+ break;
+ case METEOR_PIXTYPE_YUV:
+ fprintf(stderr,"bktr: pf: yuv h422 v111 (planar)");
+ break;
+ case METEOR_PIXTYPE_YUV_PACKED:
+ fprintf(stderr,"bktr: pf: yuyv h422 v111 (packed)");
+ break;
+ case METEOR_PIXTYPE_YUV_12:
+ fprintf(stderr,"bktr: pf: yuv h422 v422 (planar)");
+ break;
+ default:
+ fprintf(stderr,"bktr: pf: unknown");
+ }
+ fprintf(stderr," (fmt=%d)\n",format);
+}
+
+
+/* ---------------------------------------------------------------------- */
+
+static int
+bsd_open(char *filename)
+{
+ int format;
+
+ if (-1 != fd)
+ goto err;
+
+#if 0
+ if (NULL == filename)
+#endif
+ filename = "/dev/bktr0";
+ if (-1 == (fd = open(filename,O_RDONLY))) {
+ fprintf(stderr,"open %s: %s\n", filename,strerror(errno));
+ goto err;
+ }
+
+ /* video formats */
+ for (format = 0; format < VIDEO_FMT_MAX; format++)
+ xawtv2pf[format] = -1;
+
+ for (pf_count = 0; pf_count < 64; pf_count++) {
+ pf[pf_count].index = pf_count;
+ if (-1 == ioctl(fd, METEORGSUPPIXFMT,pf+pf_count)) {
+ perror("ioctl METEORGSUPPIXFMT");
+ if (0 == pf_count)
+ goto err;
+ break;
+ }
+ format = -1;
+ switch (pf[pf_count].type) {
+ case METEOR_PIXTYPE_RGB:
+ switch(pf[pf_count].masks[0]) {
+ case 31744: /* 15 bpp */
+ format = pf[pf_count].swap_bytes
+ ? VIDEO_RGB15_LE : VIDEO_RGB15_BE;
+ break;
+ case 63488: /* 16 bpp */
+ format = pf[pf_count].swap_bytes
+ ? VIDEO_RGB16_LE : VIDEO_RGB16_BE;
+ break;
+ case 16711680: /* 24/32 bpp */
+ if (pf[pf_count].Bpp == 3 &&
+ pf[pf_count].swap_bytes == 1) {
+ format = VIDEO_BGR24;
+ } else if (pf[pf_count].Bpp == 4 &&
+ pf[pf_count].swap_bytes == 1 &&
+ pf[pf_count].swap_shorts == 1) {
+ format = VIDEO_BGR32;
+ } else if (pf[pf_count].Bpp == 4 &&
+ pf[pf_count].swap_bytes == 0 &&
+ pf[pf_count].swap_shorts == 0) {
+ format = VIDEO_RGB32;
+ }
+ }
+ break;
+ case METEOR_PIXTYPE_YUV:
+ /* fixme */
+ break;
+ case METEOR_PIXTYPE_YUV_PACKED:
+ /* fixme */
+ break;
+ case METEOR_PIXTYPE_YUV_12:
+ /* fixme */
+ break;
+ }
+ if (-1 != format)
+ xawtv2pf[format] = pf_count;
+
+ bsd_print_format(pf+pf_count,format);
+ }
+
+ mmap_buf = mmap(0,768*576*4, PROT_READ, MAP_SHARED, fd, 0);
+ if ((unsigned char*)-1 == mmap_buf) {
+ perror("bktr: mmap");
+ } else {
+ grab_bsd.grab_setparams = bsd_setparm;
+ grab_bsd.grab_start = bsd_start;
+ grab_bsd.grab_capture = bsd_capture;
+ grab_bsd.grab_stop = bsd_stop;
+ }
+
+ if (-1 == (tfd = open("/dev/tuner0",O_RDONLY))) {
+ fprintf(stderr,"open %s: %s\n", "/dev/tuner",strerror(errno));
+ } else {
+ grab_bsd.grab_tune = bsd_tune;
+ }
+
+ return fd;
+
+ err:
+ if (fd != -1) {
+ close(fd);
+ fd = -1;
+ }
+ return -1;
+}
+
+static int
+bsd_close()
+{
+ if (-1 == fd)
+ return 0;
+
+ if (debug)
+ fprintf(stderr, "bktr: close\n");
+
+ close(fd);
+ fd = -1;
+ if (-1 != tfd) {
+ close(tfd);
+ tfd = -1;
+ }
+ return 0;
+}
+
+/* ---------------------------------------------------------------------- */
+
+static int bsd_input(int input, int norm)
+{
+ if (-1 != norm)
+ if (-1 == ioctl(fd,BT848SFMT,&norms_map[norm]))
+ perror("BT848SFMT");
+ if (-1 != input)
+ if (-1 == ioctl(fd,METEORSINPUT,&inputs_map[input]))
+ perror("METEORSINPUT");
+ return 0;
+}
+
+static unsigned long bsd_tune(unsigned long freq, int sat)
+{
+ if (-1 == freq) {
+ if (-1 == ioctl(tfd, TVTUNER_GETFREQ, &freq))
+ perror("ioctl TVTUNER_GETFREQ");
+ if (debug)
+ fprintf(stderr,"bktr: get freq: %.3f\n",(float)freq/16);
+ return 0;
+ }
+ if (debug)
+ fprintf(stderr,"bktr: set freq: %.3f\n",(float)freq/16);
+ if (-1 == ioctl(tfd, TVTUNER_SETFREQ, &freq))
+ perror("ioctl TVTUNER_SETFREQ");
+ return 0;
+}
+
+static int
+bsd_hasattr(int id)
+{
+ switch (id) {
+ case GRAB_ATTR_MUTE:
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+static
+int bsd_getattr(int id)
+{
+ switch (id) {
+ case GRAB_ATTR_MUTE:
+ return muted;
+ default:
+ return -1;
+ }
+}
+
+static
+int bsd_setattr(int id, int val)
+{
+ int arg;
+
+ switch (id) {
+ case GRAB_ATTR_MUTE:
+ muted = val;
+ arg = val ? AUDIO_MUTE : AUDIO_UNMUTE;
+ if (-1 == ioctl(tfd, BT848_SAUDIO, &arg)) {
+ perror("ioctl BT848_SAUDIO");
+ return -1;
+ }
+ return 0;
+ default:
+ return -1;
+ }
+}
+
+/* ---------------------------------------------------------------------- */
+/* overlay */
+
+static const int start = METEOR_CAP_CONTINOUS;
+static const int single = METEOR_CAP_SINGLE;
+static const int stop = METEOR_CAP_STOP_CONT;
+
+static struct meteor_video fb,pos;
+static struct meteor_geomet ovgeo;
+static struct meteor_pixfmt *ovfmt;
+static struct bktr_clip clip[BT848_MAX_CLIP_NODE];
+static int overlay;
+
+static int
+bsd_setupfb(int sw, int sh, int format, void *base, int bpl)
+{
+ /* if error
+ return -1;
+ */
+
+ fb.addr = (long)base;
+ fb.width = bpl;
+ fb.banksize = bpl * sh;
+ fb.ramsize = bpl * sh / 1024;
+
+ grab_bsd.grab_overlay = bsd_overlay;
+ return 0;
+}
+
+static int bsd_overlay(int x, int y, int width, int height, int format,
+ struct OVERLAY_CLIP *oc, int count)
+{
+ int i,xadjust=0,yadjust=0,win_width,win_height,win_x,win_y;
+
+ if (-1 == ioctl(fd, METEORCAPTUR, &stop))
+ perror("ioctl METEORCAPTUR(stop)");
+ overlay = 0;
+ if (width == 0 || height == 0)
+ return 0;
+
+ if (-1 == xawtv2pf[format])
+ return -1;
+
+ /* fixups - fixme: no fixed max size */
+ win_x = x;
+ win_y = y;
+ win_width = width;
+ win_height = height;
+ if (win_width > 768) {
+ win_width = 768;
+ win_x += (width - win_width)/2;
+ }
+ if (win_height > 576) {
+ win_height = 576;
+ win_y += (height - win_height)/2;
+ }
+ grabber_fix_ratio(&win_width,&win_height,&win_x,&win_y);
+ xadjust = win_x - x;
+ yadjust = win_y - y;
+
+ /* fill data */
+ pos = fb;
+ pos.addr += win_y*pos.width;
+ pos.addr += win_x*format2depth[format]>>3;
+ ovgeo.rows = win_height;
+ ovgeo.columns = win_width;
+ ovgeo.frames = 1;
+ ovgeo.oformat = 0x10000;
+
+ if (debug)
+ fprintf(stderr,"bktr: overlay win=%dx%d+%d+%d, %d clips\n",
+ win_width,win_height,win_x,win_y,count);
+
+ /* clipping */
+ memset(clip,0,sizeof(clip));
+ for (i = 0; i < count; i++) {
+#if 0
+ /* This way it *should* work IMHO ... */
+ clip[i].x_min = oc[i].x1 - xadjust;
+ clip[i].x_max = oc[i].x2 - xadjust;
+ clip[i].y_min = oc[i].y1 - yadjust;
+ clip[i].y_max = oc[i].y2 - yadjust;
+#else
+ /* This way it does work. Sort of ... */
+ clip[i].x_min = (oc[i].y1 - yadjust) >> 1;
+ clip[i].x_max = (oc[i].y2 - yadjust) >> 1;
+ clip[i].y_min = oc[i].x1 - xadjust;
+ clip[i].y_max = oc[i].x2 - xadjust;
+#endif
+ if (debug)
+ fprintf(stderr,"bktr: clip x=%d-%d y=%d-%d\n",
+ clip[i].x_min,clip[i].x_max,
+ clip[i].y_min,clip[i].y_max);
+ }
+ ovfmt = pf+xawtv2pf[format];
+
+ if (-1 == ioctl(fd, METEORSVIDEO, &pos))
+ perror("ioctl METEORSVIDEO");
+ if (-1 == ioctl(fd, METEORSETGEO, &ovgeo))
+ perror("ioctl METEORSETGEO");
+ if (-1 == ioctl(fd, METEORSACTPIXFMT, ovfmt))
+ perror("ioctl METEORSACTPIXFMT");
+ if (-1 == ioctl(fd, BT848SCLIP, &clip))
+ perror("ioctl BT848SCLIP");
+ if (-1 == ioctl(fd, METEORCAPTUR, &start))
+ perror("ioctl METEORCAPTUR(start)");
+ overlay = 1;
+
+ return 0;
+}
+
+/* ---------------------------------------------------------------------- */
+/* capture */
+
+static struct meteor_video nofb;
+static struct meteor_geomet capgeo;
+static struct meteor_pixfmt *capfmt;
+static int reenable_overlay,capfps;
+
+static int
+bsd_setparm(int format, int *width, int *height, int *linelength)
+{
+ if (-1 == xawtv2pf[format])
+ return -1;
+
+ if (*width > 768)
+ *width = 768;
+ if (*height > 576)
+ *height = 576;
+ capgeo.rows = *height;
+ capgeo.columns = *width;
+ capgeo.frames = 1;
+ capgeo.oformat = 0x10000;
+ capfmt = pf+xawtv2pf[format];
+ return 0;
+}
+
+static void
+bsd_setcapture(int on)
+{
+ if (on) {
+ /* switch to capture */
+ if (overlay) {
+ reenable_overlay = 1;
+ if (-1 == ioctl(fd, METEORCAPTUR, &stop))
+ perror("ioctl METEORCAPTUR(stop)");
+ overlay = 0;
+ }
+
+ if (-1 == ioctl(fd, METEORSVIDEO, &nofb))
+ perror("ioctl METEORSVIDEO");
+ if (-1 == ioctl(fd, METEORSETGEO, &capgeo))
+ perror("ioctl METEORSETGEO");
+ if (-1 == ioctl(fd, METEORSACTPIXFMT, capfmt))
+ perror("ioctl METEORSACTPIXFMT");
+
+ } else {
+ /* switch to overlay */
+ if (reenable_overlay) {
+ reenable_overlay = 0;
+ if (-1 == ioctl(fd, METEORSVIDEO, &pos))
+ perror("ioctl METEORSVIDEO");
+ if (-1 == ioctl(fd, METEORSETGEO, &ovgeo))
+ perror("ioctl METEORSETGEO");
+ if (-1 == ioctl(fd, METEORSACTPIXFMT, ovfmt))
+ perror("ioctl METEORSACTPIXFMT");
+ if (-1 == ioctl(fd, BT848SCLIP, &clip))
+ perror("ioctl BT848SCLIP");
+ if (-1 == ioctl(fd, METEORCAPTUR, &start))
+ perror("ioctl METEORCAPTUR(start)");
+ overlay = 1;
+ }
+ }
+}
+
+static void
+bsd_start(int fps, int buffers)
+{
+ bsd_setcapture(1);
+ capfps = fps;
+#if 0
+ gettimeofday(&grab_start,NULL);
+#endif
+}
+
+static void*
+bsd_capture(void)
+{
+ if (0 == capfps) {
+ /* grab one buffer */
+ bsd_setcapture(1);
+ if (-1 == ioctl(fd, METEORCAPTUR, &single))
+ perror("ioctl METEORCAPTUR(single)");
+ usleep(100*1000); /* FIXME: use SIGUSR1 instead */
+ bsd_setcapture(0);
+ return mmap_buf;
+ }
+
+#if 0
+ /* rate control */
+ rc = grabber_sw_rate(&grab_start,grab_fps,grab_frames);
+ if (rc <= 0)
+ goto next_frame;
+ grab_frames++;
+#endif
+ return NULL;
+}
+
+static void
+bsd_stop(void)
+{
+ bsd_setcapture(0);
+ capfps = 0;
+}
+
+
+#endif /* BSD */
diff --git a/src/grab-ng.c b/src/grab-ng.c
new file mode 100644
index 0000000..eab9319
--- /dev/null
+++ b/src/grab-ng.c
@@ -0,0 +1,89 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <sys/time.h>
+#ifdef HAVE_ENDIAN_H
+# include <endian.h>
+#endif
+
+#include "config.h"
+
+#include "grab-ng.h"
+
+/* --------------------------------------------------------------------- */
+
+const unsigned int ng_vfmt_to_depth[] = {
+ 0, /* unused */
+ 8, /* RGB8 */
+ 8, /* GRAY8 */
+ 16, /* RGB15 LE */
+ 16, /* RGB16 LE */
+ 16, /* RGB15 BE */
+ 16, /* RGB16 BE */
+ 24, /* BGR24 */
+ 32, /* BGR32 */
+ 24, /* RGB24 */
+ 32, /* RGB32 */
+ 16, /* LUT2 */
+ 32, /* LUT4 */
+ 16, /* YUV422 */
+ 16, /* YUV422P */
+ 12, /* YUV420P */
+ 0, /* MJPEG */
+};
+
+const char* ng_vfmt_to_desc[] = {
+ "none",
+ "8 bit PseudoColor (dithering)",
+ "8 bit StaticGray",
+ "15 bit TrueColor (LE)",
+ "16 bit TrueColor (LE)",
+ "15 bit TrueColor (BE)",
+ "16 bit TrueColor (BE)",
+ "24 bit TrueColor (LE: bgr)",
+ "32 bit TrueColor (LE: bgr-)",
+ "24 bit TrueColor (BE: rgb)",
+ "32 bit TrueColor (BE: -rgb)",
+ "16 bit TrueColor (lut)",
+ "32 bit TrueColor (lut)",
+ "16 bit YUV 4:2:2",
+ "16 bit YUV 4:2:2 (planar)",
+ "12 bit YUV 4:2:0 (planar)",
+ "JPEG"
+};
+
+/* --------------------------------------------------------------------- */
+
+const unsigned int ng_afmt_to_channels[] = {
+ 0, 1, 2, 1, 2, 1, 2
+};
+const unsigned int ng_afmt_to_bits[] = {
+ 0, 8, 8, 16, 16, 16, 16
+};
+const char* ng_afmt_to_desc[] = {
+ "none",
+ "8bit mono",
+ "8bit stereo",
+ "16bit mono (LE)",
+ "16bit stereo (LE)",
+ "16bit mono (BE)",
+ "16bit stereo (BE)"
+};
+
+/* --------------------------------------------------------------------- */
+
+extern const struct ng_writer files_writer;
+extern const struct ng_writer avi_writer;
+#ifdef HAVE_LIBQUICKTIME
+extern const struct ng_writer qt_writer;
+#endif
+
+const struct ng_writer *ng_writers[] = {
+ &files_writer,
+ &avi_writer,
+#ifdef HAVE_LIBQUICKTIME
+ &qt_writer,
+#endif
+ NULL
+};
diff --git a/src/grab-ng.h b/src/grab-ng.h
new file mode 100644
index 0000000..1af7526
--- /dev/null
+++ b/src/grab-ng.h
@@ -0,0 +1,132 @@
+/*
+ * next generation[tm] xawtv capture interfaces
+ *
+ * (c) 2000 Gerd Knorr <kraxel@bytesex.org>
+ *
+ */
+
+/* old stuff -- to be removed once the new stuff is complete */
+#include "grab.h"
+
+/* --------------------------------------------------------------------- */
+/* defines */
+
+#define VIDEO_NONE 0
+#define VIDEO_RGB08 1 /* bt848 dithered */
+#define VIDEO_GRAY 2
+#define VIDEO_RGB15_LE 3 /* 15 bpp little endian */
+#define VIDEO_RGB16_LE 4 /* 16 bpp little endian */
+#define VIDEO_RGB15_BE 5 /* 15 bpp big endian */
+#define VIDEO_RGB16_BE 6 /* 16 bpp big endian */
+#define VIDEO_BGR24 7 /* bgrbgrbgrbgr (LE) */
+#define VIDEO_BGR32 8 /* bgr-bgr-bgr- (LE) */
+#define VIDEO_RGB24 9 /* rgbrgbrgbrgb (BE) */
+#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_YUV422P 14 /* YUV 4:2:2 (planar) */
+#define VIDEO_YUV420P 15 /* YUV 4:2:0 (planar) */
+#define VIDEO_MJPEG 16 /* MJPEG */
+#define VIDEO_FMT_MAX 16
+
+#define AUDIO_NONE 0
+#define AUDIO_U8_MONO 1
+#define AUDIO_U8_STEREO 2
+#define AUDIO_S16_LE_MONO 3
+#define AUDIO_S16_LE_STEREO 4
+#define AUDIO_S16_BE_MONO 5
+#define AUDIO_S16_BE_STEREO 6
+#define AUDIO_FMT_MAX 6
+
+/* --------------------------------------------------------------------- */
+
+extern const unsigned int ng_vfmt_to_depth[];
+extern const char* ng_vfmt_to_desc[];
+
+extern const unsigned int ng_afmt_to_channels[];
+extern const unsigned int ng_afmt_to_bits[];
+extern const char* ng_afmt_to_desc[];
+
+/* --------------------------------------------------------------------- */
+/* video data structures */
+
+struct ng_video_fmt {
+ int fmtid; /* VIDEO_* */
+ int width;
+ int height;
+ int bytesperline; /* nonzero if bytesperline != width * depth */
+};
+
+struct ng_video_buf {
+ struct ng_video_fmt fmt;
+ int size;
+ char *data;
+
+ /* for planar formats */
+ char *data2;
+ char *data3;
+
+ /* FIXME: time (struct timeval?) */
+
+#if 0
+ int refcount;
+ void *priv;
+ /* add (*release)(struct buffer*) ??? */
+#endif
+};
+
+
+/* --------------------------------------------------------------------- */
+/* audio data structures */
+
+struct ng_audio_fmt {
+ int fmtid; /* AUDIO_* */
+ int rate;
+};
+
+struct ng_audio_buf {
+ struct ng_audio_fmt fmt;
+ int size;
+ char *data;
+
+ /* FIXME: time */
+};
+
+
+/* --------------------------------------------------------------------- */
+/* someone who receives video and/or audio data (writeavi, ...) */
+
+struct ng_format_list {
+ const char *name;
+ const char *desc; /* if standard fmtid description doesn't work
+ because it's converted somehow */
+ const char *ext;
+ const int fmtid;
+ const void *priv;
+};
+
+struct ng_writer {
+ const char *name;
+ const char *desc;
+ const struct ng_format_list *video;
+ const struct ng_format_list *audio;
+ const int combined; /* both audio + video in one file */
+
+ void* (*wr_open)(char *moviename, char *audioname,
+ struct ng_video_fmt *video, const void *priv_video, int fps,
+ struct ng_audio_fmt *audio, const void *priv_audio);
+ int (*wr_video)(void *handle, struct ng_video_buf *buf);
+ int (*wr_audio)(void *handle, struct ng_audio_buf *buf);
+ int (*wr_close)(void *handle);
+};
+
+
+/* --------------------------------------------------------------------- */
+/* TODO: color space conversion / compression, grabber */
+/* maybe add filters for on-the-fly image processing later */
+
+
+/* --------------------------------------------------------------------- */
+
+extern const struct ng_writer *ng_writers[];
diff --git a/src/grab-v4l.c b/src/grab-v4l.c
index 18d3c7b..e358a77 100644
--- a/src/grab-v4l.c
+++ b/src/grab-v4l.c
@@ -14,18 +14,22 @@
#include <fcntl.h>
#include <string.h>
#include <signal.h>
-#include <endian.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <sys/mman.h>
+#ifdef HAVE_ENDIAN_H
+# include <endian.h>
+#endif
#include <X11/Intrinsic.h>
-#include "grab.h"
-#include "colorspace.h"
-#include "commands.h"
+#include "grab-ng.h"
+
+#ifndef __linux__
+struct GRABBER grab_v4l = {};
+#else /* __linux__ */
#include <asm/types.h> /* XXX glibc */
#include "videodev.h"
@@ -36,7 +40,7 @@
/* open+close */
static int grab_open(char *filename);
-static int grab_close();
+static int grab_close(void);
/* overlay */
static int grab_setupfb(int sw, int sh, int format, void *base, int width);
@@ -47,23 +51,25 @@ static int grab_offscreen(int y, int width, int height, int format);
/* capture */
static int grab_mm_setparams(int format, int *width, int *height,
int *linelength);
-static void* grab_mm_capture(int single);
-static void grab_mm_cleanup();
+static void grab_mm_start(int fps, int buffers);
+static void* grab_mm_capture(void);
+static void grab_mm_stop(void);
static int grab_read_setparams(int format, int *width, int *height,
int *linelength);
-static void* grab_read_capture(int single);
-static void grab_read_cleanup();
+static void grab_read_start(int fps, int buffers);
+static void* grab_read_capture(void);
+static void grab_read_stop(void);
/* control */
-static int grab_tune(unsigned long freq);
-static int grab_tuned();
+static unsigned long grab_tune(unsigned long freq, int sat);
+static int grab_tuned(void);
static int grab_input(int input, int norm);
static int grab_hasattr(int id);
static int grab_getattr(int id);
static int grab_setattr(int id, int val);
/* internal helpers */
-static int grab_wait(struct video_mmap *gb);
+static int grab_wait(void);
/* ---------------------------------------------------------------------- */
@@ -80,28 +86,28 @@ static char *device_pal[] = {
#define PALETTE(x) ((x < sizeof(device_pal)/sizeof(char*)) ? device_pal[x] : "UNKNOWN")
static struct STRTAB stereo[] = {
- { 0, "auto" },
- { 1, "mono" },
- { 2, "stereo" },
- { 4, "lang1" },
- { 8, "lang2" },
- { -1, NULL, },
+ { 0, "auto" },
+ { VIDEO_SOUND_MONO, "mono" },
+ { VIDEO_SOUND_STEREO, "stereo" },
+ { VIDEO_SOUND_LANG1, "lang1" },
+ { VIDEO_SOUND_LANG2, "lang2" },
+ { -1, NULL },
};
static struct STRTAB norms[] = {
- { 0, "PAL" },
- { 1, "NTSC" },
- { 2, "SECAM" },
- { 3, "AUTO" },
+ { VIDEO_MODE_PAL, "PAL" },
+ { VIDEO_MODE_NTSC, "NTSC" },
+ { VIDEO_MODE_SECAM, "SECAM" },
+ { VIDEO_MODE_AUTO, "AUTO" },
{ -1, NULL }
};
static struct STRTAB norms_bttv[] = {
- { 0, "PAL" },
- { 1, "NTSC" },
- { 2, "SECAM" },
- { 3, "PAL-NC" },
- { 4, "PAL-M" },
- { 5, "PAL-N" },
- { 6, "NTSC-JP" },
+ { VIDEO_MODE_PAL, "PAL" },
+ { VIDEO_MODE_NTSC, "NTSC" },
+ { VIDEO_MODE_SECAM, "SECAM" },
+ { 3, "PAL-NC" },
+ { 4, "PAL-M" },
+ { 5, "PAL-N" },
+ { 6, "NTSC-JP" },
{ -1, NULL }
};
static struct STRTAB *inputs;
@@ -119,24 +125,27 @@ static int cur_norm;
/* overlay */
static struct video_window ov_win;
+static struct video_picture ov_pict;
static struct video_clip ov_clips[32];
static struct video_buffer ov_fbuf;
/* screen grab */
-static struct video_mmap gb_even;
-static struct video_mmap gb_odd;
-static int even,pixmap_bytes;
-static int gb_grab,gb_sync;
+#define MAX_BUFFERS 16
+static struct video_mmap gb_buf[MAX_BUFFERS];
+static int pixmap_bytes;
+static int gb_grab,gb_sync,gb_bufcount = 1;
static struct video_mbuf gb_buffers = { 2*0x151000, 0, {0,0x151000 }};
-static int gb_pal[] = {
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0
-};
+static int gb_pal[64];
-static int grab_read_size;
-static char *grab_read_buf;
+static struct video_window rd_win;
+static struct video_picture rd_pict;
+static int rd_size;
+static char *rd_buf;
+
+/* rate control */
+static struct timeval grab_start;
+static int grab_fps;
+static int grab_frames;
static unsigned short format2palette[] = {
0, /* unused */
@@ -165,7 +174,7 @@ static unsigned short format2palette[] = {
0, /* LUT 4 */
VIDEO_PALETTE_YUV422, /* YUV422 */
VIDEO_PALETTE_YUV422P, /* YUV422P */
-#if 0 /* broken in bttv */
+#if 0 /* broken in bttv (fixed in 0.8.x) */
VIDEO_PALETTE_YUV420P, /* YUV420P */
#else
0, /* YUV420P */
@@ -175,33 +184,29 @@ static unsigned short format2palette[] = {
static char *map = NULL;
/* state */
-static int overlay, swidth, sheight;
+static int swidth, sheight;
+static int ov_enabled; /* turned on? */
+static int ov_on; /* real state (for tmp off) */
/* pass 0/1 by reference */
static int one = 1, zero = 0;
struct GRABBER grab_v4l = {
- "v4l",
- 0,
- norms,NULL,stereo,
+ name: "v4l",
+ norms: norms,
+ audio_modes: stereo,
- grab_open,
- grab_close,
+ grab_open: grab_open,
+ grab_close: grab_close,
- grab_setupfb,
- NULL /* grab_overlay */,
- NULL /* grab_offscreen */,
+ grab_setupfb: grab_setupfb,
- NULL /* grab_setparams */,
- NULL /* grab_capture */,
- NULL /* grab_cleanup */,
-
- grab_tune,
- grab_tuned,
- grab_input,
- grab_hasattr,
- grab_getattr,
- grab_setattr
+ grab_tune: grab_tune,
+ grab_tuned: grab_tuned,
+ grab_input: grab_input,
+ grab_hasattr: grab_hasattr,
+ grab_getattr: grab_getattr,
+ grab_setattr: grab_setattr,
};
/* ---------------------------------------------------------------------- */
@@ -213,23 +218,26 @@ static struct GRAB_ATTR {
int set;
void *arg;
} grab_attr [] = {
- { GRAB_ATTR_VOLUME, 1, VIDIOCGAUDIO, VIDIOCSAUDIO, &audio },
- { GRAB_ATTR_MUTE, 1, VIDIOCGAUDIO, VIDIOCSAUDIO, &audio },
- { GRAB_ATTR_MODE, 1, VIDIOCGAUDIO, VIDIOCSAUDIO, &audio },
+ { GRAB_ATTR_VOLUME, 1, VIDIOCGAUDIO, VIDIOCSAUDIO, &audio },
+ { GRAB_ATTR_MUTE, 1, VIDIOCGAUDIO, VIDIOCSAUDIO, &audio },
+ { GRAB_ATTR_MODE, 1, VIDIOCGAUDIO, VIDIOCSAUDIO, &audio },
- { GRAB_ATTR_COLOR, 1, VIDIOCGPICT, VIDIOCSPICT, &pict },
- { GRAB_ATTR_BRIGHT, 1, VIDIOCGPICT, VIDIOCSPICT, &pict },
- { GRAB_ATTR_HUE, 1, VIDIOCGPICT, VIDIOCSPICT, &pict },
- { GRAB_ATTR_CONTRAST, 1, VIDIOCGPICT, VIDIOCSPICT, &pict },
+ { GRAB_ATTR_COLOR, 1, VIDIOCGPICT, VIDIOCSPICT, &pict },
+ { GRAB_ATTR_BRIGHT, 1, VIDIOCGPICT, VIDIOCSPICT, &pict },
+ { GRAB_ATTR_HUE, 1, VIDIOCGPICT, VIDIOCSPICT, &pict },
+ { GRAB_ATTR_CONTRAST, 1, VIDIOCGPICT, VIDIOCSPICT, &pict },
};
#define NUM_ATTR (sizeof(grab_attr)/sizeof(struct GRAB_ATTR))
/* ---------------------------------------------------------------------- */
+static int alarms;
+
static void
sigalarm(int signal)
{
+ alarms++;
fprintf(stderr,"v4l: oops: got sigalarm\n");
}
@@ -247,9 +255,55 @@ siginit(void)
/* ---------------------------------------------------------------------- */
static int
+xioctl(int fd, int cmd, void *arg)
+{
+ int rc;
+
+ rc = ioctl(fd,cmd,arg);
+ if (0 == rc && 0 == debug)
+ return 0;
+ switch (cmd) {
+ case VIDIOCGPICT:
+ case VIDIOCSPICT:
+ {
+ struct video_picture *a = arg;
+ fprintf(stderr,"v4l: %s(params=%d/%d/%d/%d/%d,depth=%d,pal=%d)",
+ (cmd == VIDIOCGPICT) ? "VIDIOCGPICT" : "VIDIOCSPICT",
+ a->brightness,a->hue,a->colour,a->contrast,a->whiteness,
+ a->depth,a->palette);
+ break;
+ }
+ case VIDIOCGWIN:
+ case VIDIOCSWIN:
+ {
+ struct video_window *a = arg;
+ fprintf(stderr,"v4l: %s(win=%dx%d+%d+%d,key=%d,flags=0x%x,clips=%d)",
+ (cmd == VIDIOCGWIN) ? "VIDIOCGWIN" : "VIDIOCSWIN",
+ a->width,a->height,a->x,a->y,
+ a->chromakey,a->flags,a->clipcount);
+ break;
+ }
+ case VIDIOCCAPTURE:
+ {
+ int *a = arg;
+ fprintf(stderr,"v4l: VIDIOCCAPTURE(%s)",
+ *a ? "on" : "off");
+ break;
+ }
+ default:
+ fprintf(stderr,"v4l: UNKNOWN(cmd=0x%x)",cmd);
+ break;
+ }
+ fprintf(stderr,": %s\n",(rc == 0) ? "ok" : strerror(errno));
+ return rc;
+}
+
+/* ---------------------------------------------------------------------- */
+
+static int
grab_open(char *filename)
{
- int i;
+ int i,rc;
if (-1 != fd)
goto err;
@@ -291,7 +345,7 @@ grab_open(char *filename)
for (i = 0; i < capability.channels; i++) {
channels[i].channel = i;
if (-1 == ioctl(fd,VIDIOCGCHAN,&channels[i]))
- perror("ioctl VIDIOCGCHAN"), exit(0);
+ perror("ioctl VIDIOCGCHAN");
inputs[i].nr = i;
inputs[i].str = channels[i].name;
if (debug)
@@ -307,19 +361,13 @@ grab_open(char *filename)
inputs[i].str = NULL;
grab_v4l.inputs =inputs;
- /* ioctl probe, switch to input 0 */
- if (-1 == ioctl(fd,VIDIOCSCHAN,&channels[0])) {
- fprintf(stderr,"v4l: you need a newer bttv version (>= 0.5.14)\n");
- goto err;
- }
-
/* audios */
if (debug)
fprintf(stderr," audios : %d\n",capability.audios);
if (capability.audios) {
audio.audio = 0;
if (-1 == ioctl(fd,VIDIOCGAUDIO,&audio))
- perror("ioctl VIDIOCGCAUDIO") /* , exit(0) */ ;
+ perror("ioctl VIDIOCGAUDIO");
if (debug) {
fprintf(stderr," %d (%s): ",i,audio.name);
if (audio.flags & VIDEO_AUDIO_MUTABLE)
@@ -389,8 +437,16 @@ grab_open(char *filename)
#define BTTV_VERSION _IOR('v' , BASE_VIDIOCPRIVATE+6, int)
/* dirty hack time / v4l design flaw -- works with bttv only
* this adds support for a few less common PAL versions */
- if (-1 != ioctl(fd,BTTV_VERSION,0)) {
+ if (-1 != (rc = ioctl(fd,BTTV_VERSION,0))) {
grab_v4l.norms = norms_bttv;
+ fprintf(stderr,"v4l: bttv version %d.%d.%d\n",
+ (rc >> 16) & 0xff,
+ (rc >> 8) & 0xff,
+ rc & 0xff);
+ if (rc < 0x000700)
+ fprintf(stderr,
+ "v4l: prehistoric bttv version found, please try to\n"
+ " upgrade the driver before mailing bug reports\n");
}
#endif
@@ -402,35 +458,51 @@ grab_open(char *filename)
ov_fbuf.base, ov_fbuf.width, ov_fbuf.height,
ov_fbuf.depth, ov_fbuf.bytesperline);
+ /* chroma keying */
+ if (capability.type & VID_TYPE_CHROMAKEY)
+ grab_v4l.colorkey = 0x00cc00ff;
+
/* picture parameters */
- if (-1 == ioctl(fd,VIDIOCGPICT,&pict))
+ if (-1 == ioctl(fd,VIDIOCGPICT,&ov_pict))
perror("ioctl VIDIOCGPICT");
+ rd_pict = ov_pict;
if (debug) {
fprintf(stderr,
" picture : brightness=%d hue=%d colour=%d contrast=%d\n",
- pict.brightness, pict.hue, pict.colour, pict.contrast);
+ ov_pict.brightness, ov_pict.hue,
+ ov_pict.colour, ov_pict.contrast);
fprintf(stderr,
" picture : whiteness=%d depth=%d palette=%s\n",
- pict.whiteness, pict.depth, PALETTE(pict.palette));
+ ov_pict.whiteness, ov_pict.depth, PALETTE(ov_pict.palette));
}
- /* map grab buffer */
- if (-1 == ioctl(fd,VIDIOCGMBUF,&gb_buffers)) {
- if (debug)
+ if (capability.type & VID_TYPE_CAPTURE) {
+ /* map grab buffer */
+ if (-1 == ioctl(fd,VIDIOCGMBUF,&gb_buffers)) {
perror("ioctl VIDIOCGMBUF");
- }
- map = mmap(0,gb_buffers.size,PROT_READ|PROT_WRITE,MAP_SHARED,fd,0);
- if ((char*)-1 != map) {
- grab_v4l.grab_setparams = grab_mm_setparams;
- grab_v4l.grab_capture = grab_mm_capture;
- grab_v4l.grab_cleanup = grab_mm_cleanup;
- } else {
- if (debug)
- perror("mmap");
- grab_v4l.grab_setparams = grab_read_setparams;
- grab_v4l.grab_capture = grab_read_capture;
- grab_v4l.grab_cleanup = grab_read_cleanup;
+ } else {
+ if (debug)
+ fprintf(stderr," mbuf: size=%d frames=%d\n",
+ gb_buffers.size,gb_buffers.frames);
+ }
+ map = mmap(0,gb_buffers.size,PROT_READ|PROT_WRITE,MAP_SHARED,fd,0);
+ if ((char*)-1 != map) {
+ if (debug)
+ fprintf(stderr," mmap: worked, using mapped buffers\n");
+ grab_v4l.grab_setparams = grab_mm_setparams;
+ grab_v4l.grab_start = grab_mm_start;
+ grab_v4l.grab_capture = grab_mm_capture;
+ grab_v4l.grab_stop = grab_mm_stop;
+ } else {
+ if (debug)
+ fprintf(stderr," mmap: failed (%s), using read()\n",
+ strerror(errno));
+ grab_v4l.grab_setparams = grab_read_setparams;
+ grab_v4l.grab_start = grab_read_start;
+ grab_v4l.grab_capture = grab_read_capture;
+ grab_v4l.grab_stop = grab_read_stop;
+ }
}
return fd;
@@ -444,13 +516,13 @@ err:
}
static int
-grab_close()
+grab_close(void)
{
if (-1 == fd)
return 0;
- if (gb_grab > gb_sync)
- grab_wait(even ? &gb_even : &gb_odd);
+ while (gb_grab > gb_sync)
+ grab_wait();
if ((char*)-1 != map)
munmap(map,gb_buffers.size);
@@ -473,6 +545,13 @@ grab_setupfb(int sw, int sh, int format, void *base, int bpl)
swidth = sw;
sheight = sh;
+ /* overlay supported ?? */
+ if (!(capability.type & VID_TYPE_OVERLAY)) {
+ if (debug)
+ fprintf(stderr,"v4l: device has no overlay support\n");
+ return -1;
+ }
+
/* double-check settings */
fprintf(stderr,"v4l: %dx%d, %d bit/pixel, %d byte/scanline\n",
ov_fbuf.width,ov_fbuf.height,
@@ -484,10 +563,10 @@ grab_setupfb(int sw, int sh, int format, void *base, int bpl)
fprintf(stderr,"WARNING: Is v4l-conf installed correctly?\n");
settings_ok = 0;
}
- if (format2depth[format] != ((ov_fbuf.depth+7)&0xf8)) {
+ if (ng_vfmt_to_depth[format] != ((ov_fbuf.depth+7)&0xf8)) {
fprintf(stderr,"WARNING: v4l and dga disagree about the color depth\n");
fprintf(stderr,"WARNING: Is v4l-conf installed correctly?\n");
- fprintf(stderr,"%d %d\n",format2depth[format],ov_fbuf.depth);
+ fprintf(stderr,"%d %d\n",ng_vfmt_to_depth[format],ov_fbuf.depth);
settings_ok = 0;
}
if (have_dga) {
@@ -510,6 +589,26 @@ grab_setupfb(int sw, int sh, int format, void *base, int bpl)
}
}
+static void
+grab_overlay_set(int state)
+{
+ if (0 == state) {
+ /* off */
+ if (0 == ov_on)
+ return;
+ xioctl(fd, VIDIOCCAPTURE, &zero);
+ ov_on = 0;
+ } else {
+ /* on */
+ xioctl(fd,VIDIOCSPICT,&ov_pict);
+ xioctl(fd, VIDIOCSWIN, &ov_win);
+ if (0 != ov_on)
+ return;
+ xioctl(fd, VIDIOCCAPTURE, &one);
+ ov_on = 1;
+ }
+}
+
static int
grab_overlay(int x, int y, int width, int height, int format,
struct OVERLAY_CLIP *oc, int count)
@@ -519,8 +618,8 @@ grab_overlay(int x, int y, int width, int height, int format,
if (width == 0 || height == 0) {
if (debug)
fprintf(stderr,"v4l: overlay off\n");
- ioctl(fd, VIDIOCCAPTURE, &zero);
- overlay = 0;
+ ov_enabled = 0;
+ grab_overlay_set(ov_enabled);
return 0;
}
@@ -529,6 +628,7 @@ grab_overlay(int x, int y, int width, int height, int format,
ov_win.width = width;
ov_win.height = height;
ov_win.flags = 0;
+ ov_win.chromakey = grab_v4l.colorkey;
#if 1
/* check against max. size */
@@ -541,6 +641,7 @@ grab_overlay(int x, int y, int width, int height, int format,
ov_win.height = capability.maxheight;
ov_win.y += (height - ov_win.height)/2;
}
+ grabber_fix_ratio(&ov_win.width,&ov_win.height,&ov_win.x,&ov_win.y);
/* pass aligned values -- the driver does'nt get it right yet */
ov_win.width &= ~3;
@@ -578,23 +679,13 @@ grab_overlay(int x, int y, int width, int height, int format,
#endif
}
}
- if (capability.type & VID_TYPE_CHROMAKEY) {
- ov_win.chromakey = 0; /* XXX */
- }
- pict.palette =
+ ov_pict.depth = ng_vfmt_to_depth[format];
+ ov_pict.palette =
(format < sizeof(format2palette)/sizeof(unsigned short))?
format2palette[format] : 0;
- if (-1 == ioctl(fd,VIDIOCSPICT,&pict))
- perror("ioctl VIDIOCSPICT");
- if (-1 == ioctl(fd, VIDIOCSWIN, &ov_win))
- perror("ioctl VIDIOCSWIN");
-
- if (!overlay) {
- if (-1 == ioctl(fd, VIDIOCCAPTURE, &one))
- perror("ioctl VIDIOCCAPTURE");
- overlay = 1;
- }
+ ov_enabled = 1;
+ grab_overlay_set(ov_enabled);
if (debug)
fprintf(stderr,"v4l: overlay win=%dx%d+%d+%d, %d clips\n",
@@ -609,8 +700,8 @@ grab_offscreen(int y, int width, int height, int format)
if (width == 0 || height == 0) {
if (debug)
fprintf(stderr,"v4l: offscreen off\n");
- ioctl(fd, VIDIOCCAPTURE, &zero);
- overlay = 0;
+ ov_enabled = 0;
+ grab_overlay_set(ov_enabled);
return 0;
}
@@ -619,16 +710,14 @@ grab_offscreen(int y, int width, int height, int format)
ov_win.width = width;
ov_win.height = height;
ov_win.flags = 0;
- pict.palette =
+ ov_pict.depth = ng_vfmt_to_depth[format];
+ ov_pict.palette =
(format < sizeof(format2palette)/sizeof(unsigned short))?
format2palette[format] : 0;
- if (-1 == ioctl(fd,VIDIOCSPICT,&pict))
- perror("ioctl VIDIOCSPICT");
- if (-1 == ioctl(fd, VIDIOCSWIN, &ov_win))
- perror("ioctl VIDIOCSWIN");
- if (-1 == ioctl(fd_grab,VIDIOCCAPTURE,&one))
- perror("ioctl VIDIOCCAPTURE");
+ ov_enabled = 1;
+ grab_overlay_set(ov_enabled);
+
if (debug)
fprintf(stderr,"v4l: offscreen size=%dx%d\n",
width,height);
@@ -639,49 +728,55 @@ grab_offscreen(int y, int width, int height, int format)
/* capture using mmaped buffers (with double-buffering, ...) */
static int
-grab_queue(struct video_mmap *gb, int probe)
+grab_queue(void)
{
+ int frame = gb_grab++ % gb_bufcount;
+
if (debug > 1)
- fprintf(stderr,"g%d",gb->frame);
+ fprintf(stderr,"q%d",frame);
+
#if 0
/* might be useful for debugging driver problems */
- memset(map + gb_buffers.offsets[gb->frame],0,
+ memset(map + gb_buffers.offsets[frame],0,
gb_buffers.size/gb_buffers.frames);
#endif
- if (-1 == ioctl(fd,VIDIOCMCAPTURE,gb)) {
+ if (-1 == ioctl(fd,VIDIOCMCAPTURE,gb_buf+frame)) {
if (errno == EAGAIN)
fprintf(stderr,"grabber chip can't sync (no station tuned in?)\n");
else
- if (!probe || debug)
- fprintf(stderr,"ioctl VIDIOCMCAPTURE(%d,%s,%dx%d): %s\n",
- gb->frame,PALETTE(gb->format),gb->width,gb->height,
- strerror(errno));
+ fprintf(stderr,"ioctl VIDIOCMCAPTURE(%d,%s,%dx%d): %s\n",
+ frame,PALETTE(gb_buf[frame].format),
+ gb_buf[frame].width,gb_buf[frame].height,
+ strerror(errno));
return -1;
}
if (debug > 1)
fprintf(stderr,"* ");
- gb_grab++;
return 0;
}
static int
-grab_wait(struct video_mmap *gb)
+grab_wait(void)
{
+ int frame = gb_sync++ % gb_bufcount;
int ret = 0;
-
+
+ alarms=0;
alarm(SYNC_TIMEOUT);
if (debug > 1)
- fprintf(stderr,"s%d",gb->frame);
+ fprintf(stderr,"s%d",frame);
- if (-1 == ioctl(fd,VIDIOCSYNC,&(gb->frame))) {
+ retry:
+ if (-1 == ioctl(fd,VIDIOCSYNC,gb_buf+frame)) {
+ if (errno == EINTR && !alarms)
+ goto retry;
perror("ioctl VIDIOCSYNC");
ret = -1;
}
- gb_sync++;
if (debug > 1)
fprintf(stderr,"* ");
alarm(0);
- return ret;
+ return (ret == 0) ? frame : ret;
}
static int
@@ -699,11 +794,15 @@ grab_probe(int format)
if (debug)
fprintf(stderr, "v4l: capture probe %s...\t", device_pal[format]);
gb.format = format;
- if (-1 == grab_queue(&gb,1)) {
+ if (-1 == ioctl(fd,VIDIOCMCAPTURE,&gb)) {
+ if (debug)
+ perror("VIDIOCMCAPTURE");
gb_pal[format] = 2;
goto done;
}
- if (-1 == grab_wait(&gb)) {
+ if (-1 == ioctl(fd,VIDIOCSYNC,&gb)) {
+ if (debug)
+ perror("VIDIOCSYNC");
gb_pal[format] = 2;
goto done;
}
@@ -718,9 +817,11 @@ grab_probe(int format)
static int
grab_mm_setparams(int format, int *width, int *height, int *linelength)
{
+ int v4l_format,i;
+
/* finish old stuff */
- if (gb_grab > gb_sync)
- grab_wait(even ? &gb_even : &gb_odd);
+ while (gb_grab > gb_sync)
+ grab_wait();
/* verify parameters */
ioctl(fd,VIDIOCGCAP,&capability);
@@ -728,9 +829,9 @@ grab_mm_setparams(int format, int *width, int *height, int *linelength)
*width = capability.maxwidth;
if (*height > capability.maxheight)
*height = capability.maxheight;
- *linelength = *width * format2depth[format] / 8;
+ *linelength = *width * ng_vfmt_to_depth[format] / 8;
-#if 1
+#if 0
/* XXX bttv bug workaround - it returns a larger size than it can handle */
if (*width > 768+76) {
*width = 768+76;
@@ -738,61 +839,95 @@ grab_mm_setparams(int format, int *width, int *height, int *linelength)
}
#endif
- /* initialize everything */
- gb_even.format = gb_odd.format =
- (format < sizeof(format2palette)/sizeof(unsigned short)) ?
+ /* check if we can handle the format */
+ v4l_format = (format < sizeof(format2palette)/sizeof(unsigned short)) ?
format2palette[format] : 0;
- if (gb_even.format == 0 || !grab_probe(gb_even.format)) {
+ if (v4l_format == 0 || !grab_probe(v4l_format))
return -1;
+
+ /* initialize everything */
+ gb_grab = 0;
+ gb_sync = 0;
+ pixmap_bytes = ng_vfmt_to_depth[format] / 8;
+ for (i = 0; i < MAX_BUFFERS; i++) {
+ gb_buf[i].format = v4l_format;
+ gb_buf[i].frame = i;
+ gb_buf[i].width = *width;
+ gb_buf[i].height = *height;
}
- pixmap_bytes = format2depth[format] / 8;
- gb_even.frame = 0;
- gb_odd.frame = 1;
- gb_even.width = *width;
- gb_even.height = *height;
- gb_odd.width = *width;
- gb_odd.height = *height;
- even = 0;
return 0;
}
+static void
+grab_mm_start(int fps, int buffers)
+{
+ if (grab_fps) {
+ fprintf(stderr,"grab_mm_start: aiee: grab_fps!=0\n");
+ exit(1);
+ }
+
+ gb_bufcount = MAX_BUFFERS;
+ if (gb_buffers.frames < gb_bufcount)
+ gb_bufcount = gb_buffers.frames;
+ if (buffers > 0 && buffers < gb_bufcount)
+ gb_bufcount = buffers;
+
+ while ((gb_grab - gb_sync) < gb_bufcount)
+ grab_queue();
+ gettimeofday(&grab_start,NULL);
+ grab_fps = fps;
+ grab_frames = 0;
+}
+
static void*
-grab_mm_capture(int single)
+grab_mm_capture(void)
{
- void *buf;
+ int frame,rc;
- if (!single && gb_grab == gb_sync)
- /* streaming capture started */
- if (-1 == grab_queue(even ? &gb_even : &gb_odd,0))
+ if (0 == grab_fps) {
+ /* grab one buffer */
+ if (debug)
+ fprintf(stderr,"grab_mm_capture: one\n");
+ if (-1 == grab_queue())
return NULL;
+ frame = grab_wait();
+ if (-1 == frame)
+ return NULL;
+ return map + gb_buffers.offsets[frame];
+ }
- if (single && gb_grab > gb_sync)
- /* clear streaming capture */
- grab_wait(even ? &gb_even : &gb_odd);
-
- /* queue */
- if (-1 == grab_queue(even ? &gb_odd : &gb_even,0))
+ /* next buffer (streaming) */
+ if (debug > 1)
+ fprintf(stderr,"grab_mm_capture: next\n");
+ next_frame:
+ while ((gb_grab - gb_sync) < gb_bufcount)
+ if (-1 == grab_queue())
+ return NULL;
+ frame = grab_wait();
+ if (-1 == frame)
return NULL;
- if (gb_grab > gb_sync+1) {
- /* wait -- streaming */
- grab_wait(even ? &gb_even : &gb_odd);
- buf = map + gb_buffers.offsets[even ? 0 : 1];
- } else {
- /* wait -- single */
- grab_wait(even ? &gb_odd : &gb_even);
- buf = map + gb_buffers.offsets[even ? 1 : 0];
- }
- even = !even;
- return buf;
+ /* rate control */
+ rc = grabber_sw_rate(&grab_start,grab_fps,grab_frames);
+ if (rc <= 0)
+ goto next_frame;
+ grab_frames++;
+
+ return map + gb_buffers.offsets[frame];
}
static void
-grab_mm_cleanup()
+grab_mm_stop(void)
{
- if (gb_grab > gb_sync)
- grab_wait(even ? &gb_even : &gb_odd);
+ if (!grab_fps) {
+ fprintf(stderr,"grab_mm_stop: aiee: grab_fps==0\n");
+ exit(1);
+ }
+ /* stop streaming */
+ while (gb_grab > gb_sync)
+ grab_wait();
+ grab_fps = 0;
}
/* ---------------------------------------------------------------------- */
@@ -801,85 +936,130 @@ grab_mm_cleanup()
static int
grab_read_setparams(int format, int *width, int *height, int *linelength)
{
- struct video_window win;
-
- pict.depth = format2depth[format];
- pict.palette = format2palette[format];
+ rd_pict.depth = ng_vfmt_to_depth[format];
+ rd_pict.palette = (format < sizeof(format2palette)/sizeof(unsigned short)) ?
+ format2palette[format] : 0;
+ if (rd_pict.palette == 0)
+ return -1;
+
+ grab_overlay_set(0);
/* set format */
- if (-1 == ioctl(fd,VIDIOCSPICT,&pict)) {
- if (debug)
- perror("ioctl VIDIOCSPICT");
- return -1;
- }
- if (-1 == ioctl(fd,VIDIOCGPICT,&pict)) {
- if (debug)
- perror("ioctl VIDIOCGPICT");
- return -1;
- }
+ if (-1 == xioctl(fd,VIDIOCSPICT,&rd_pict))
+ goto fail;
+ if (-1 == xioctl(fd,VIDIOCGPICT,&rd_pict))
+ goto fail;
/* set size */
- ioctl(fd,VIDIOCGCAP,&capability);
+ xioctl(fd,VIDIOCGCAP,&capability);
if (*width > capability.maxwidth)
*width = capability.maxwidth;
if (*height > capability.maxheight)
*height = capability.maxheight;
- memset(&win,0,sizeof(struct video_window));
- win.width = *width;
- win.height = *height;
- if (-1 == ioctl(fd,VIDIOCSWIN,&win)) {
- if (debug)
- perror("ioctl VIDIOCSWIN");
- return -1;
- }
- if (-1 == ioctl(fd,VIDIOCGWIN,&win)) {
- if (debug)
- perror("ioctl VIDIOCGWIN");
- return -1;
- }
-
- *width = win.width;
- *height = win.height;
- *linelength = *width * format2depth[format] / 8;
+ memset(&rd_win,0,sizeof(struct video_window));
+ rd_win.width = *width;
+ rd_win.height = *height;
+ if (-1 == xioctl(fd,VIDIOCSWIN,&rd_win))
+ goto fail;
+ if (-1 == xioctl(fd,VIDIOCGWIN,&rd_win))
+ goto fail;
+
+ *width = rd_win.width;
+ *height = rd_win.height;
+ *linelength = *width * ng_vfmt_to_depth[format] / 8;
/* alloc buffer */
- grab_read_size = *linelength * *height;
- if (grab_read_buf)
- free(grab_read_buf);
- grab_read_buf = malloc(grab_read_size);
- if (NULL == grab_read_buf)
- return -1;
-
+ rd_size = *linelength * *height;
+ fprintf(stderr,"format: %d %dx%d size=%d depth=%d\n",
+ format,*width,*height,rd_size,ng_vfmt_to_depth[format]);
+ if (rd_buf)
+ free(rd_buf);
+ rd_buf = NULL;
+ grab_overlay_set(ov_enabled);
return 0;
+
+ fail:
+ grab_overlay_set(ov_enabled);
+ return -1;
+}
+
+static void
+grab_read_start(int fps, int buffers)
+{
+ if (grab_fps) {
+ fprintf(stderr,"grab_read_stop: aiee: grab_fps!=0\n");
+ exit(1);
+ }
+ gettimeofday(&grab_start,NULL);
+ grab_fps = fps;
+ grab_frames = 0;
}
static void*
-grab_read_capture(int single)
+grab_read_capture()
{
int rc;
- rc = read(fd,grab_read_buf,grab_read_size);
- if (grab_read_size != rc) {
- fprintf(stderr,"grabber read error (rc=%d)\n",rc);
+ if (NULL == rd_buf)
+ rd_buf = malloc(rd_size);
+ if (NULL == rd_buf)
return NULL;
+
+ grab_overlay_set(0);
+ if (-1 == ioctl(fd,VIDIOCGPICT,&rd_pict) ||
+ -1 == ioctl(fd,VIDIOCSWIN,&rd_win)) {
+ perror("set grab args");
+ goto fail;
+ }
+
+ next_frame:
+ rc = read(fd,rd_buf,rd_size);
+ if (rd_size != rc) {
+ fprintf(stderr,"grabber read error (rc=%d, expect=%d, errno=%s)\n",
+ rc,rd_size,strerror(errno));
+ goto fail;
+ }
+
+ if (grab_fps > 0) {
+ /* rate control */
+ rc = grabber_sw_rate(&grab_start,grab_fps,grab_frames);
+ if (rc <= 0)
+ goto next_frame;
+ grab_frames++;
}
- return grab_read_buf;
+ grab_overlay_set(ov_enabled);
+ return rd_buf;
+
+ fail:
+ grab_overlay_set(ov_enabled);
+ return NULL;
}
static void
-grab_read_cleanup()
+grab_read_stop(void)
{
- if (grab_read_buf) {
- free(grab_read_buf);
- grab_read_buf = NULL;
+ if (!grab_fps) {
+ fprintf(stderr,"grab_read_stop: aiee: grab_fps==0\n");
+ exit(1);
}
+ if (rd_buf) {
+ free(rd_buf);
+ rd_buf = NULL;
+ }
+ grab_overlay_set(ov_enabled);
+ grab_fps = 0;
}
/* ---------------------------------------------------------------------- */
-static int
-grab_tune(unsigned long freq)
+static unsigned long
+grab_tune(unsigned long freq, int sat)
{
+ if (-1 == freq) {
+ if (-1 == ioctl(fd, VIDIOCGFREQ, &freq))
+ perror("ioctl VIDIOCGFREQ");
+ return freq;
+ }
if (debug)
fprintf(stderr,"v4l: freq: %.3f\n",(float)freq/16);
if (-1 == ioctl(fd, VIDIOCSFREQ, &freq))
@@ -888,7 +1068,7 @@ grab_tune(unsigned long freq)
}
static int
-grab_tuned()
+grab_tuned(void)
{
usleep(10000);
if (-1 == ioctl(fd,VIDIOCGTUNER,tuner)) {
@@ -966,7 +1146,7 @@ int grab_setattr(int id, int val)
break;
if (i == NUM_ATTR)
return -1;
- if (-1 == ioctl(fd,grab_attr[i].set,grab_attr[i].arg))
+ if (-1 == ioctl(fd,grab_attr[i].get,grab_attr[i].arg))
perror("ioctl get");
/* ... modify ... */
@@ -978,11 +1158,21 @@ int grab_setattr(int id, int val)
else
audio.flags &= ~VIDEO_AUDIO_MUTE;
break;
- case GRAB_ATTR_MODE: audio.mode = val; break;
- case GRAB_ATTR_COLOR: pict.colour = val; break;
- case GRAB_ATTR_BRIGHT: pict.brightness = val; break;
- case GRAB_ATTR_HUE: pict.hue = val; break;
- case GRAB_ATTR_CONTRAST: pict.contrast = val; break;
+ case GRAB_ATTR_MODE:
+ audio.mode = val;
+ break;
+ case GRAB_ATTR_COLOR:
+ pict.colour = val;
+ break;
+ case GRAB_ATTR_BRIGHT:
+ pict.brightness = val;
+ break;
+ case GRAB_ATTR_HUE:
+ pict.hue = val;
+ break;
+ case GRAB_ATTR_CONTRAST:
+ pict.contrast = val;
+ break;
default: return -1;
}
@@ -990,9 +1180,22 @@ int grab_setattr(int id, int val)
/* bttv: avoid input switch */
audio.audio = cur_input;
#endif
-
+
/* ... write */
if (-1 == ioctl(fd,grab_attr[i].set,grab_attr[i].arg))
perror("ioctl set");
+
+ /* keep the others up-to-date */
+ ov_pict.colour = pict.colour;
+ rd_pict.colour = pict.colour;
+ ov_pict.brightness = pict.brightness;
+ rd_pict.brightness = pict.brightness;
+ ov_pict.hue = pict.hue;
+ rd_pict.hue = pict.hue;
+ ov_pict.contrast = pict.contrast;
+ rd_pict.contrast = pict.contrast;
+
return 0;
}
+
+#endif /* __linux__ */
diff --git a/src/grab-v4l2.c b/src/grab-v4l2.c
index 1761d37..84905ce 100644
--- a/src/grab-v4l2.c
+++ b/src/grab-v4l2.c
@@ -14,17 +14,22 @@
#include <fcntl.h>
#include <string.h>
#include <signal.h>
-#include <endian.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <sys/mman.h>
+#ifdef HAVE_ENDIAN_H
+# include <endian.h>
+#endif
#include <X11/Intrinsic.h>
-#include "grab.h"
-#include "colorspace.h"
+#include "grab-ng.h"
+
+#ifndef __linux__
+struct GRABBER grab_v4l2 = {};
+#else /* __linux__ */
#include <asm/types.h> /* XXX glibc */
#include "videodev2.h"
@@ -44,7 +49,7 @@ static struct v4l2_enumstd std[16];
static struct v4l2_fmtdesc fmt[64];
static struct v4l2_queryctrl ctl[32];
-static int str_on = 0;
+static int str_fps = 0;
static struct v4l2_format str_format;
static struct v4l2_requestbuffers str_bufdesc;
static struct v4l2_buffer str_buffers[WANTED_BUFFERS];
@@ -52,6 +57,10 @@ static unsigned char *str_bufdata[WANTED_BUFFERS];
static unsigned char *read_buf;
static int str_lastdequeued;
+static int preview_state;
+static int preview_reenable;
+static int preview_and_streaming_works = 1;
+
static struct V4L2_ATTR {
int id;
int v4l2;
@@ -71,7 +80,7 @@ static struct V4L2_ATTR {
/* open/close */
static int v4l2_open(char *filename);
-static int v4l2_close();
+static int v4l2_close(void);
/* control */
static int v4l2_input(int input, int norm);
@@ -79,16 +88,17 @@ static int v4l2_hasattr(int id);
static int v4l2_getattr(int id);
static int v4l2_setattr(int id, int vol);
-static int v4l2_tune(unsigned long freq);
-static int v4l2_tuned();
+static unsigned long v4l2_tune(unsigned long freq, int sat);
+static int v4l2_tuned(void);
/* capture */
static int v4l2_setparm(int format, int *width, int *height, int *linelength);
-static void* v4l2_capture(int single);
-static void* v4l2_streaming(int single);
-static void v4l2_cleanup();
-static void v4l2_stop_streaming();
+static void v4l2_start(int fps, int buffers);
+static void* v4l2_capture(void);
+static void* v4l2_streaming(void);
+static void v4l2_stop(void);
+static void v4l2_stop_streaming(void);
/* overlay */
static int v4l2_setupfb(int sw, int sh, int format, void *base, int bpl);
@@ -98,29 +108,18 @@ static int v4l2_overlay(int x, int y, int width, int height, int format,
/* ---------------------------------------------------------------------- */
struct GRABBER grab_v4l2 = {
- "v4l2",
- 0, /* flags */
- NULL, /* norms */
- NULL, /* inputs */
- NULL, /* audio_modes */
-
- v4l2_open,
- v4l2_close,
-
- v4l2_setupfb, /* setupfb */
- NULL, /* overlay */
- NULL, /* offscreen */
-
- v4l2_setparm, /* set params */
- NULL, /* capture */
- NULL, /* cleanup */
-
- NULL, /* tune */
- NULL, /* tuned ? */
- v4l2_input,
- v4l2_hasattr,
- v4l2_getattr,
- v4l2_setattr,
+ name: "v4l2",
+
+ grab_open: v4l2_open,
+ grab_close: v4l2_close,
+
+ grab_setupfb: v4l2_setupfb,
+ grab_setparams: v4l2_setparm,
+
+ grab_input: v4l2_input,
+ grab_hasattr: v4l2_hasattr,
+ grab_getattr: v4l2_getattr,
+ grab_setattr: v4l2_setattr,
};
/* xawtv => v4l */
@@ -162,7 +161,7 @@ print_bits(char *title, char **names, int count, int value)
static void
-print_device_capabilities()
+print_device_capabilities(void)
{
static char *cap_type[] = {
"capture",
@@ -318,11 +317,11 @@ print_fbinfo(struct v4l2_framebuffer *fb)
/* helpers */
static void
-get_device_capabilities()
+get_device_capabilities(void)
{
int i;
- for (ninputs = 0; ninputs < 16; ninputs++) {
+ for (ninputs = 0; ninputs < cap.inputs; ninputs++) {
inp[ninputs].index = ninputs;
if (-1 == ioctl(fd, VIDIOC_ENUMINPUT, &inp[ninputs]))
break;
@@ -357,7 +356,7 @@ get_device_capabilities()
}
static struct STRTAB *
-build_norms()
+build_norms(void)
{
struct STRTAB *norms;
int i;
@@ -373,7 +372,7 @@ build_norms()
}
static struct STRTAB *
-build_inputs()
+build_inputs(void)
{
struct STRTAB *inputs;
int i;
@@ -419,11 +418,13 @@ v4l2_open(char *filename)
/* setup capture */
if (cap.flags & V4L2_FLAG_STREAMING) {
+ grab_v4l2.grab_start = v4l2_start;
grab_v4l2.grab_capture = v4l2_streaming;
- grab_v4l2.grab_cleanup = v4l2_cleanup;
+ grab_v4l2.grab_stop = v4l2_stop;
} else if (cap.flags & V4L2_FLAG_READ) {
+ grab_v4l2.grab_start = v4l2_start;
grab_v4l2.grab_capture = v4l2_capture;
- grab_v4l2.grab_cleanup = v4l2_cleanup;
+ grab_v4l2.grab_stop = v4l2_stop;
}
/* setup tuner */
@@ -448,10 +449,11 @@ v4l2_close()
if (-1 == fd)
return 0;
- if (str_on) {
+ if (str_fps) {
if (debug)
fprintf(stderr,"v4l2: stopping streaming capture\n");
v4l2_stop_streaming();
+ str_fps = 0;
}
if (debug)
@@ -513,7 +515,8 @@ v4l2_setcontrol(int i, int value)
c.id = ctl[i].id;
if (ctl[i].type == V4L2_CTRL_TYPE_INTEGER) {
- c.value = value*(ctl[i].maximum-ctl[i].minimum)/65536+ctl[i].minimum;
+ c.value = (int)((float)value*(ctl[i].maximum-ctl[i].minimum)
+ / 65536 + ctl[i].minimum);
if (c.value < ctl[i].minimum) c.value = ctl[i].minimum;
if (c.value > ctl[i].maximum) c.value = ctl[i].maximum;
} else {
@@ -568,9 +571,14 @@ v4l2_setattr(int id, int val)
return 0;
}
-static int
-v4l2_tune(unsigned long freq)
+static unsigned long
+v4l2_tune(unsigned long freq, int sat)
{
+ if (-1 == freq) {
+ if (-1 == ioctl(fd, VIDIOC_G_FREQ, &freq))
+ perror("ioctl VIDIOC_G_FREQ");
+ return freq;
+ }
if (debug)
fprintf(stderr,"v4l2: freq: %.3f\n",(float)freq/16);
if (-1 == ioctl(fd, VIDIOC_S_FREQ, &freq))
@@ -582,7 +590,8 @@ static int
v4l2_tuned()
{
struct v4l2_tuner tuner;
-
+
+ memset(&tuner,0,sizeof(tuner));
if (-1 == ioctl(fd,VIDIOC_G_TUNER,&tuner)) {
perror("ioctl VIDIOC_G_TUNER");
return 0;
@@ -641,13 +650,26 @@ v4l2_start_streaming(int buffers)
}
str_lastdequeued = str_bufdesc.count-1; /* the buffer that isn't queued */
+ try_again:
+ /* turn off preview (if needed) */
+ if (preview_state && !preview_and_streaming_works) {
+ preview_reenable = 1;
+ preview_state = 0;
+ if (-1 == ioctl(fd, VIDIOC_PREVIEW, &preview_state))
+ perror("ioctl VIDIOC_PREVIEW");
+ if (debug)
+ fprintf(stderr,"v4l2: overlay off (start_streaming)\n");
+ }
+
/* start capture */
if (-1 == ioctl(fd,VIDIOC_STREAMON,&str_format.type)) {
+ if (preview_and_streaming_works && preview_state && errno == EBUSY) {
+ preview_and_streaming_works = 0;
+ goto try_again;
+ }
perror("ioctl VIDIOC_STREAMON");
return -1;
}
- str_on = 1;
-
return 0;
}
@@ -656,8 +678,6 @@ v4l2_stop_streaming()
{
int i;
- str_on = 0;
-
/* stop capture */
if (-1 == ioctl(fd,VIDIOC_STREAMOFF,&str_format.type))
perror("ioctl VIDIOC_STREAMOFF");
@@ -667,6 +687,16 @@ v4l2_stop_streaming()
if (-1 == munmap(str_bufdata[i],str_buffers[i].length))
perror("munmap");
}
+
+ /* turn on preview (if needed) */
+ if (preview_reenable) {
+ preview_reenable = 0;
+ preview_state = 1;
+ if (-1 == ioctl(fd, VIDIOC_PREVIEW, &preview_state))
+ perror("ioctl VIDIOC_PREVIEW");
+ if (debug)
+ fprintf(stderr,"v4l2: overlay on (stop_streaming)\n");
+ }
}
static unsigned char *
@@ -711,10 +741,11 @@ v4l2_get_streaming(int *size)
static int
v4l2_setparm(int format, int *width, int *height, int *linelength)
{
- if (str_on) {
+ if (str_fps) {
if (debug)
fprintf(stderr,"v4l2: stopping streaming capture\n");
v4l2_stop_streaming();
+ str_fps = 0;
}
if (read_buf)
free(read_buf);
@@ -723,7 +754,7 @@ v4l2_setparm(int format, int *width, int *height, int *linelength)
str_format.type = V4L2_BUF_TYPE_CAPTURE;
str_format.fmt.pix.pixelformat = xawtv_pixelformat[format];
str_format.fmt.pix.flags = V4L2_FMT_FLAG_INTERLACED;
- str_format.fmt.pix.depth = format2depth[format];
+ str_format.fmt.pix.depth = ng_vfmt_to_depth[format];
str_format.fmt.pix.width = *width;
str_format.fmt.pix.height = *height;
str_format.fmt.pix.bytesperline = *linelength;
@@ -748,9 +779,22 @@ v4l2_setparm(int format, int *width, int *height, int *linelength)
return 0;
}
+static void
+v4l2_start(int fps, int buffers)
+{
+ if (cap.flags & V4L2_FLAG_STREAMING) {
+ if (str_fps) {
+ fprintf(stderr,"v4l2_start: aiee: str_fps!=0\n");
+ exit(1);
+ }
+ str_fps = fps;
+ v4l2_start_streaming(buffers);
+ }
+}
+
/* do simple capture with read() */
static void*
-v4l2_capture(int single)
+v4l2_capture()
{
int rc;
@@ -772,33 +816,35 @@ v4l2_capture(int single)
/* do streaming capture */
static void*
-v4l2_streaming(int single)
+v4l2_streaming()
{
- int size;
-
- if (single && str_on) {
- if (debug)
- fprintf(stderr,"v4l2: stopping streaming capture\n");
- v4l2_stop_streaming();
- }
- if (str_on == 0) {
- if (debug)
- fprintf(stderr,"v4l2: starting streaming capture\n");
- if (-1 == v4l2_start_streaming(single ? 1 : WANTED_BUFFERS)) {
- fprintf(stderr,"v4l2: ... oops, it did'nt work :-(\n");
- return NULL;
- }
+ int size;
+ char *frame;
+
+ if (0 == str_fps) {
+ /* single frame */
+ if (NULL == read_buf)
+ read_buf = malloc(str_format.fmt.pix.sizeimage);
+ v4l2_start_streaming(1);
+ frame = v4l2_get_streaming(&size);
+ memcpy(read_buf,frame,str_format.fmt.pix.sizeimage);
+ v4l2_stop_streaming(); /* this unmaps the memory frame points to */
+ return read_buf;
+ } else {
+ return v4l2_get_streaming(&size);
}
- return v4l2_get_streaming(&size);
}
static void
-v4l2_cleanup()
+v4l2_stop()
{
- if (str_on) {
- if (debug)
- fprintf(stderr,"v4l2: stopping streaming capture\n");
+ if (cap.flags & V4L2_FLAG_STREAMING) {
+ if (!str_fps) {
+ fprintf(stderr,"v4l2_stop: aiee: grab_fps==0\n");
+ exit(1);
+ }
v4l2_stop_streaming();
+ str_fps = 0;
}
if (read_buf) {
free(read_buf);
@@ -875,13 +921,13 @@ v4l2_setupfb(int sw, int sh, int format, void *base, int bpl)
static int v4l2_overlay(int x, int y, int width, int height, int format,
struct OVERLAY_CLIP *oc, int count)
{
- const int one=1,zero=0;
- int i;
+ int i,xadjust=0,yadjust=0;
if (width == 0 || height == 0) {
if (debug)
fprintf(stderr,"v4l2: overlay off\n");
- if (-1 == ioctl(fd, VIDIOC_PREVIEW, &zero))
+ preview_state = 0;
+ if (-1 == ioctl(fd, VIDIOC_PREVIEW, &preview_state))
perror("ioctl VIDIOC_PREVIEW");
return 0;
}
@@ -894,14 +940,30 @@ static int v4l2_overlay(int x, int y, int width, int height, int format,
ov_win.width = width;
ov_win.height = height;
+ /* check against max. size */
+ ioctl(fd,VIDIOC_QUERYCAP,&cap);
+ if (ov_win.width > cap.maxwidth) {
+ ov_win.width = cap.maxwidth;
+ ov_win.x += (width - ov_win.width)/2;
+ }
+ if (ov_win.height > cap.maxheight) {
+ ov_win.height = cap.maxheight;
+ ov_win.y += (height - ov_win.height)/2;
+ }
+ grabber_fix_ratio(&ov_win.width,&ov_win.height,&ov_win.x,&ov_win.y);
+
+ /* fixups */
+ xadjust = ov_win.x - x;
+ yadjust = ov_win.y - y;
+
if (ov_fb.capability & V4L2_FBUF_CAP_CLIPPING) {
ov_win.clips = ov_clips;
ov_win.clipcount = count;
for (i = 0; i < count; i++) {
ov_clips[i].next = (i+1 == count) ? NULL : &ov_clips[i+1];
- ov_clips[i].x = oc[i].x1;
- ov_clips[i].y = oc[i].y1;
+ ov_clips[i].x = oc[i].x1 - xadjust;
+ ov_clips[i].y = oc[i].y1 - yadjust;
ov_clips[i].width = oc[i].x2-oc[i].x1;
ov_clips[i].height = oc[i].y2-oc[i].y1;
if (debug)
@@ -916,8 +978,11 @@ static int v4l2_overlay(int x, int y, int width, int height, int format,
if (-1 == ioctl(fd, VIDIOC_S_WIN, &ov_win))
perror("ioctl VIDIOC_S_WIN");
- if (-1 == ioctl(fd, VIDIOC_PREVIEW, &one))
+ preview_state = 1;
+ if (-1 == ioctl(fd, VIDIOC_PREVIEW, &preview_state))
perror("ioctl VIDIOC_PREVIEW");
return 0;
}
+
+#endif /* __linux__ */
diff --git a/src/grab.c b/src/grab.c
index f0ae11e..b5ecc6b 100644
--- a/src/grab.c
+++ b/src/grab.c
@@ -1,90 +1,59 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
-#include <endian.h>
#include <string.h>
+#include <sys/time.h>
+#ifdef HAVE_ENDIAN_H
+# include <endian.h>
+#endif
#include "config.h"
-#include "grab.h"
+#include "grab-ng.h"
#include "colorspace.h"
#include "mjpeg.h"
#include "commands.h"
+#include "webcam.h"
extern struct GRABBER grab_v4l;
extern struct GRABBER grab_v4l2;
+extern struct GRABBER grab_bsd;
/*-------------------------------------------------------------------------*/
int fd_grab;
+int grab_ratio_x;
+int grab_ratio_y;
struct GRABBER *grabber;
static struct GRABBER *grabbers[] = {
&grab_v4l2,
&grab_v4l,
+ &grab_bsd,
};
#define GRABBER_COUNT (sizeof(grabbers)/sizeof(struct GRABBERS*))
-unsigned int format2depth[] = {
- 0, /* unused */
- 8, /* RGB8 */
- 8, /* GRAY8 */
- 16, /* RGB15 LE */
- 16, /* RGB16 LE */
- 16, /* RGB15 BE */
- 16, /* RGB16 BE */
- 24, /* BGR24 */
- 32, /* BGR32 */
- 24, /* RGB24 */
- 32, /* RGB32 */
- 16, /* LUT2 */
- 32, /* LUT4 */
- 16, /* YUV422 */
- 16, /* YUV422P */
- 12, /* YUV420P */
- 0, /* MJPEG */
-};
-
-unsigned char* format_desc[] = {
- "",
- "8 bit PseudoColor (dithering)",
- "8 bit StaticGray",
- "15 bit TrueColor (LE)",
- "16 bit TrueColor (LE)",
- "15 bit TrueColor (BE)",
- "16 bit TrueColor (BE)",
- "24 bit TrueColor (LE: bgr)",
- "32 bit TrueColor (LE: bgr-)",
- "24 bit TrueColor (BE: rgb)",
- "32 bit TrueColor (BE: -rgb)",
- "16 bit TrueColor (lut)",
- "32 bit TrueColor (lut)",
- "16 bit YUV 4:2:2",
- "16 bit YUV 4:2:2 (planar)",
- "12 bit YUV 4:2:0 (planar)",
- "MJPEG"
-};
-
/*-------------------------------------------------------------------------*/
extern char v4l_conf[];
void
grabber_run_v4l_conf(void)
-{
- if (do_overlay) {
- switch (system(v4l_conf)) {
- case -1: /* can't run */
- fprintf(stderr,"could'nt start v4l-conf\n");
- break;
- case 0: /* ok */
- break;
- default: /* non-zero return */
- fprintf(stderr,"v4l-conf had some trouble, "
- "trying to continue anyway\n");
- break;
- }
+{
+ if (!do_overlay)
+ return;
+
+ switch (system(v4l_conf)) {
+ case -1: /* can't run */
+ fprintf(stderr,"could'nt start v4l-conf\n");
+ break;
+ case 0: /* ok */
+ break;
+ default: /* non-zero return */
+ fprintf(stderr,"v4l-conf had some trouble, "
+ "trying to continue anyway\n");
+ break;
}
}
@@ -95,6 +64,8 @@ grabber_open(char *device, int sw, int sh, void *base, int format, int width)
/* check all grabber drivers */
for (i = 0; i < GRABBER_COUNT; i++) {
+ if (NULL == grabbers[i]->name)
+ continue;
if (debug)
fprintf(stderr,"init: trying: %s... \n",grabbers[i]->name);
if (-1 != (fd_grab = grabbers[i]->grab_open(device))) {
@@ -123,6 +94,7 @@ static int grabber_height;
static float grabber_depth;
static int grabber_linelength;
static int grabber_format;
+static int output_format;
static color_conv grabber_conv;
static void* grabber_data;
@@ -131,7 +103,7 @@ struct CONV_LIST {
int lut;
color_conv converter;
void (*init)(int width, int height);
- void (*cleanup)();
+ void (*cleanup)(void);
};
static struct CONV_LIST gray_list[] = {
@@ -238,7 +210,6 @@ static struct CONV_LIST yuv420p_list[] = {
{ -1,0, NULL }
};
-#ifdef HAVE_LIBJPEG
static struct CONV_LIST mjpg_list[] = {
{ VIDEO_YUV420P, 0, mjpg_yuv420_compress, mjpg_yuv_init, mjpg_cleanup },
{ VIDEO_YUV422P, 0, mjpg_yuv422_compress, mjpg_yuv_init, mjpg_cleanup },
@@ -246,7 +217,6 @@ static struct CONV_LIST mjpg_list[] = {
{ VIDEO_BGR24, 0, mjpg_bgr_compress, mjpg_rgb_init, mjpg_cleanup },
{ -1,0, NULL }
};
-#endif
static struct CONV_LIST *conv_lists[] = {
@@ -266,16 +236,12 @@ static struct CONV_LIST *conv_lists[] = {
NULL,
yuv422p_list,
yuv420p_list,
-#ifdef HAVE_LIBJPEG
mjpg_list,
-#else
- NULL,
-#endif
};
int
grabber_setparams(int format, int *width, int *height,
- int *linelength, int lut_valid)
+ int *linelength, int lut_valid, int fix_ratio)
{
int w,h,i;
struct CONV_LIST *list;
@@ -291,7 +257,7 @@ grabber_setparams(int format, int *width, int *height,
free(grabber_data);
grabber_data = NULL;
grabber_conv = NULL;
- grabber_depth = format2depth[format]/8;
+ grabber_depth = ng_vfmt_to_depth[format]/8;
w = *width;
h = *height;
@@ -300,6 +266,7 @@ grabber_setparams(int format, int *width, int *height,
grabber_height = h;
grabber_linelength = 0;
grabber_format = format;
+ output_format = -1;
if (0 == grabber->grab_setparams
(grabber_format,&grabber_width,&grabber_height,&grabber_linelength)) {
goto found;
@@ -323,14 +290,23 @@ grabber_setparams(int format, int *width, int *height,
}
}
fprintf(stderr,"grab: no match for: %dx%d %s\n",
- *width,*height,format_desc[format]);
+ *width,*height,ng_vfmt_to_desc[format]);
grabber_format = -1;
return -1;
found:
if (debug)
fprintf(stderr,"grab: req: %dx%d %s\n",
- *width,*height,format_desc[format]);
+ *width,*height,ng_vfmt_to_desc[format]);
+ if (fix_ratio) {
+ grabber_fix_ratio(&grabber_width,&grabber_height,NULL,NULL);
+ grabber_linelength = 0;
+ if (0 != grabber->grab_setparams
+ (grabber_format,&grabber_width,&grabber_height,&grabber_linelength)) {
+ fprintf(stderr,"Oops: ratio size renegotiation failed\n");
+ exit(1);
+ }
+ }
*width = grabber_width;
*height = grabber_height;
if (grabber_linelength == 0)
@@ -338,7 +314,8 @@ grabber_setparams(int format, int *width, int *height,
*linelength = grabber_linelength;
if (debug)
fprintf(stderr,"grab: use: %dx%d %s\n",
- *width,*height,format_desc[grabber_format]);
+ *width,*height,ng_vfmt_to_desc[grabber_format]);
+ output_format = format;
return 0;
}
@@ -375,15 +352,15 @@ grabber_copy(unsigned char *dest, int dll,
}
void*
-grabber_capture(void *dest, int dest_linelength, int single, int *size)
+grabber_capture(void *dest, int dest_linelength, int *size)
{
- int rc;
+ int rc = 0;
void *data;
if (size) *size = 0;
if (-1 == grabber_format)
return NULL;
- if (NULL == (data = grabber->grab_capture(single)))
+ if (NULL == (data = grabber->grab_capture()))
return NULL;
if (0 == dest_linelength)
@@ -391,19 +368,70 @@ grabber_capture(void *dest, int dest_linelength, int single, int *size)
if (dest == NULL) {
if (grabber_conv == NULL && dest_linelength == grabber_linelength)
- return data;
+ goto done;
if (grabber_data == NULL)
grabber_data = malloc(grabber_height * dest_linelength);
rc = grabber_copy(grabber_data, dest_linelength,
data, grabber_linelength,
grabber_width, grabber_height, grabber_depth);
if (size) *size = rc;
- return grabber_data;
+ data = grabber_data;
+ goto done;
}
rc = grabber_copy(dest, dest_linelength,
data, grabber_linelength,
grabber_width, grabber_height, grabber_depth);
+ data = dest;
+
+ done:
+ if (NULL != webcam &&
+ 0 == webcam_put(webcam,output_format,grabber_width,grabber_height,
+ data,rc ? rc : (dest_linelength * grabber_height))) {
+ free(webcam);
+ webcam = NULL;
+ }
if (size) *size = rc;
- return dest;
+ return data;
+}
+
+int
+grabber_sw_rate(struct timeval *start, int fps, int count)
+{
+ struct timeval now;
+ int msecs,frames;
+
+ if (-1 == fps)
+ return 1;
+
+ gettimeofday(&now,NULL);
+ msecs = now.tv_usec/1000 - start->tv_usec/1000;
+ msecs += now.tv_sec*1000 - start->tv_sec*1000;
+ frames = msecs * fps / 1000;
+ if (debug > 1)
+ fprintf(stderr,"rate: msecs=%d fps=%d -> frames=%d |"
+ " count=%d ret=%d\n",
+ msecs,fps,frames,count,frames-count+1);
+ if (frames-count > 3)
+ fprintf(stderr,"rate: video is %d frames behind\n",frames-count);
+ return frames-count+1;
+}
+
+void
+grabber_fix_ratio(int *width, int *height, int *xoff, int *yoff)
+{
+ int h = *height;
+ int w = *width;
+
+ if (0 == grab_ratio_x || 0 == grab_ratio_y)
+ return;
+ if (w * grab_ratio_y < h * grab_ratio_x) {
+ *height = *width * grab_ratio_y / grab_ratio_x;
+ if (yoff)
+ *yoff += (h-*height)/2;
+ } else if (w * grab_ratio_y > h * grab_ratio_x) {
+ *width = *height * grab_ratio_x / grab_ratio_y;
+ if (yoff)
+ *xoff += (w-*width)/2;
+ }
}
diff --git a/src/grab.h b/src/grab.h
index 7b6a67b..671acce 100644
--- a/src/grab.h
+++ b/src/grab.h
@@ -1,20 +1,3 @@
-#define VIDEO_RGB08 1 /* bt848 dithered */
-#define VIDEO_GRAY 2
-#define VIDEO_RGB15_LE 3 /* 15 bpp little endian */
-#define VIDEO_RGB16_LE 4 /* 16 bpp little endian */
-#define VIDEO_RGB15_BE 5 /* 15 bpp big endian */
-#define VIDEO_RGB16_BE 6 /* 16 bpp big endian */
-#define VIDEO_BGR24 7 /* bgrbgrbgrbgr (LE) */
-#define VIDEO_BGR32 8 /* bgr-bgr-bgr- (LE) */
-#define VIDEO_RGB24 9 /* rgbrgbrgbrgb (BE)*/
-#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_YUV422P 14 /* YUV 4:2:2 (planar) */
-#define VIDEO_YUV420P 15 /* YUV 4:2:0 (planar) */
-#define VIDEO_MJPEG 16 /* MJPEG */
-
#define CAN_AUDIO_VOLUME 1
#define GRAB_ATTR_VOLUME 1
@@ -32,7 +15,7 @@
struct STRTAB {
long nr;
- char *str;
+ const char *str;
};
struct OVERLAY_CLIP {
@@ -42,34 +25,34 @@ struct OVERLAY_CLIP {
struct GRABBER {
char *name;
int flags;
+ unsigned int colorkey;
struct STRTAB *norms;
struct STRTAB *inputs;
struct STRTAB *audio_modes;
int (*grab_open)(char *opt);
- int (*grab_close)();
+ int (*grab_close)(void);
+ /* overlay */
int (*grab_setupfb)(int sw, int sh, int format, void *base, int bpl);
int (*grab_overlay)(int x, int y, int width, int height, int format,
struct OVERLAY_CLIP *oc, int count);
int (*grab_offscreen)(int y, int width, int height, int format);
+ /* capture */
int (*grab_setparams)(int format, int *width, int *height, int *linelength);
- void* (*grab_capture)(int single);
- void (*grab_cleanup)();
+ void (*grab_start)(int fps, int buffers);
+ void* (*grab_capture)(void);
+ void (*grab_stop)(void);
- int (*grab_tune)(unsigned long freq);
+ /* configure device */
+ unsigned long (*grab_tune)(unsigned long freq, int sat);
int (*grab_tuned)(void);
int (*grab_input)(int input, int norm);
-#if 0
- int (*grab_picture)(int color, int bright, int hue, int contrast);
- int (*grab_audio)(int mute, int volume, int *mode);
-#else
int (*grab_hasattr)(int id);
int (*grab_getattr)(int id);
int (*grab_setattr)(int id, int val);
-#endif
};
/* ------------------------------------------------------------------------- */
@@ -78,15 +61,16 @@ extern int debug;
extern int have_dga;
extern int fd_grab;
+extern int grab_ratio_x;
+extern int grab_ratio_y;
extern struct GRABBER *grabber;
-extern unsigned int format2depth[];
-extern unsigned char* format_desc[];
-
/* ------------------------------------------------------------------------- */
void grabber_run_v4l_conf(void);
int grabber_open(char *device, int sw, int sh, void *base, int format, int width);
int grabber_setparams(int format, int *width, int *height,
- int *linelength, int lut_valid);
-void* grabber_capture(void *dest, int dest_linelength, int single, int *size);
+ int *linelength, int lut_valid, int fix_ratio);
+void* grabber_capture(void *dest, int dest_linelength, int *size);
+int grabber_sw_rate(struct timeval *start, int fps, int count);
+void grabber_fix_ratio(int *width, int *height, int *xoff, int *yoff);
diff --git a/src/lirc.c b/src/lirc.c
index 4dae5ad..c1919c5 100644
--- a/src/lirc.c
+++ b/src/lirc.c
@@ -46,22 +46,21 @@ int lirc_tv_init()
int lirc_tv_havedata()
{
#ifdef HAVE_LIBLIRC_CLIENT
- char *ir,*cmd,**argv;
+ char *code,*cmd,**argv;
int argc;
+ int ret=-1;
- if (NULL == (ir = lirc_nextir()))
- return -1;
- while (NULL != ir) {
- while (NULL != (cmd = lirc_ir2char(config,ir))) {
+ while (lirc_nextcode(&code)==0 && code!=NULL) {
+ ret = 0;
+ while (lirc_code2char(config,code,&cmd)==0 && cmd!=NULL) {
if (debug)
fprintf(stderr,"lirc: \"%s\"\n", cmd);
argv = split_cmdline(cmd,&argc);
do_command(argc,argv);
}
- free(ir);
- ir = lirc_nextir();
+ free(code);
}
- return 0;
+ return ret;
#else
return 0;
#endif
diff --git a/src/lirc.h b/src/lirc.h
index 29290ca..9906c81 100644
--- a/src/lirc.h
+++ b/src/lirc.h
@@ -1,2 +1,2 @@
-int lirc_tv_init();
-int lirc_tv_havedata();
+int lirc_tv_init(void);
+int lirc_tv_havedata(void);
diff --git a/src/log b/src/log
deleted file mode 100644
index d5d5f48..0000000
--- a/src/log
+++ /dev/null
@@ -1,11 +0,0 @@
-map: vt02 => fb0
-map: vt02 => fb0
-v4l-conf: using framebuffer device /dev/fb0
-mode: 1024x3070, depth=15, bpp=16, bpl=2048, base=0x81800000
-done
-map: vt02 => fb0
-v4l-conf: using framebuffer device /dev/fb0
-mode: 1024x3070, depth=15, bpp=16, bpl=2048, base=0x81800000
-done
-v4l: 1024x3070, 15 bit/pixel, 2048 byte/scanline
-no infrared remote support available
diff --git a/src/main.c b/src/main.c
index 10c13da..278cc4a 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1,7 +1,7 @@
/*
* main.c for xawtv -- a TV application
*
- * (c) 1997-99 Gerd Knorr <kraxel@goldbach.in-berlin.de>
+ * (c) 1997-2000 Gerd Knorr <kraxel@goldbach.in-berlin.de>
*
*/
@@ -11,12 +11,12 @@
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
-#include <getopt.h>
#include <ctype.h>
#include <errno.h>
#include <math.h>
#include <signal.h>
#include <fcntl.h>
+#include <pthread.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <sys/wait.h>
@@ -68,14 +68,15 @@ Status DPMSDisable(Display*);
# include <X11/extensions/Xvlib.h>
#endif
+#include "grab-ng.h"
#include "writefile.h"
#include "sound.h"
#include "channel.h"
#include "commands.h"
#include "frequencies.h"
-#include "grab.h"
#include "xv.h"
#include "capture.h"
+#include "xt.h"
#include "x11.h"
#include "toolbox.h"
#include "complete.h"
@@ -99,53 +100,86 @@ typedef float fp_res;
/*--- public variables ----------------------------------------------------*/
-XtAppContext app_context;
-Widget app_shell, tv;
Widget opt_shell, opt_paned, chan_shell, conf_shell, str_shell;
Widget on_shell, on_label;
+Widget vtx_shell, vtx_label;
Widget launch_shell, launch_paned;
Widget c_norm,c_input,c_freq,c_audio,c_cap;
Widget s_bright,s_color,s_hue,s_contrast,s_volume;
Widget chan_viewport, chan_box;
-Display *dpy;
-XVisualInfo vinfo;
-Colormap colormap;
XtWorkProcId idle_id;
Pixmap tv_pix;
int stay_on_top = 0;
int str_pid = -1;
-Widget str_fbutton,str_text;
-char *str_filename;
int have_config = 0;
-Atom wm_protocols[2],xawtv_remote,xawtv_station;
XtIntervalId title_timer, audio_timer, zap_timer, scan_timer, on_timer;
-int pointer_on = 1, on_skip = 0;
int debug = 0;
int fs = 0;
int zap_start,zap_fast;
char modename[64];
char *progname;
-int have_dga = 0;
-int have_vm = 0;
-int have_shmem = 0;
-#ifdef HAVE_LIBXXF86VM
-int vm_count;
-XF86VidModeModeInfo **vm_modelines;
-#endif
int lirc;
int rec_writer;
int rec_wsync;
-XtWorkProcId rec_id;
-int cur_avi_audio = 0;
-int cur_avi_format = VIDEO_RGB15_LE;
-int cur_avi_fps = 15;
-Widget avi_size,avi_status;
+XtWorkProcId rec_work_id;
+XtInputId rec_audio_id;
+
+/* movie params / setup */
+Widget w_movie_status;
+Widget w_movie_driver;
+
+Widget w_movie_fvideo;
+Widget w_movie_video;
+Widget w_movie_fps;
+Widget w_movie_size;
+
+Widget w_movie_flabel;
+Widget w_movie_faudio;
+Widget w_movie_audio;
+Widget w_movie_rate;
+
+struct STRTAB *m_movie_driver;
+struct STRTAB *m_movie_audio;
+struct STRTAB *m_movie_video;
+
+int movie_driver = 0;
+int movie_audio = 0;
+int movie_video = 0;
+int movie_fps = 12;
+int movie_rate = 44100;
+
+static struct STRTAB m_movie_fps[] = {
+ { 5, " 5 fps" },
+ { 8, " 8 fps" },
+ { 10, "10 fps" },
+ { 12, "12 fps" },
+ { 15, "15 fps" },
+ { 18, "18 fps" },
+ { 20, "20 fps" },
+ { 24, "24 fps" },
+ { 25, "25 fps" },
+ { 30, "30 fps" },
+ { -1, NULL },
+};
+static struct STRTAB m_movie_rate[] = {
+ { 8000, " 8000" },
+ { 11025, "11025" },
+ { 22050, "22050" },
+ { 44100, "44100" },
+ { 48000, "48000" },
+ { -1, NULL },
+};
-char v4l_conf[128] = "v4l-conf";
+#define MOVIE_DRIVER "movie driver"
+#define MOVIE_AUDIO "audio format"
+#define MOVIE_VIDEO "video format"
+#define MOVIE_FPS "frames/sec"
+#define MOVIE_RATE "sample rate"
+#define MOVIE_SIZE "video size"
/* fwd decl */
void change_audio(int mode);
@@ -171,175 +205,29 @@ static struct MY_TOPLEVELS {
struct STRTAB *cmenu = NULL;
static char default_title[256] = "???";
-struct DO_CMD {
- int argc;
- char *argv[8];
-};
-
struct DO_AC {
int argc;
char *name;
char *argv[8];
};
-/*--- args ----------------------------------------------------------------*/
-
-static struct ARGS {
- /* char */
- char *device;
- char *basename;
- /* int */
- int debug;
- int bpp;
- int shift;
- /* boolean */
- int remote;
- int readconfig;
- int showpointer;
- int fullscreen;
- int fbdev;
- int xv_video;
- int xv_scale;
- int vidmode;
- int dga;
- int help;
-} args;
-
-static XtResource args_desc[] = {
- /* name, class, type, size, offset, default_type, default_addr */
- {
- /* Strings */
- "device",
- XtCString, XtRString, sizeof(char*),
- XtOffset(struct ARGS*,device),
- XtRString, "/dev/video"
- },{
- "basename",
- XtCString, XtRString, sizeof(char*),
- XtOffset(struct ARGS*,basename),
- XtRString, "snap"
- },{
- /* Integer */
- "debug",
- XtCValue, XtRInt, sizeof(int),
- XtOffset(struct ARGS*,debug),
- XtRString, "0"
- },{
- "bpp",
- XtCValue, XtRInt, sizeof(int),
- XtOffset(struct ARGS*,bpp),
- XtRString, "0"
- },{
- "shift",
- XtCValue, XtRInt, sizeof(int),
- XtOffset(struct ARGS*,shift),
- XtRString, "0"
- },{
- /* Boolean */
- "remote",
- XtCValue, XtRInt, sizeof(int),
- XtOffset(struct ARGS*,remote),
- XtRString, "0"
- },{
- "readconfig",
- XtCValue, XtRInt, sizeof(int),
- XtOffset(struct ARGS*,readconfig),
- XtRString, "1"
- },{
- "showpointer",
- XtCValue, XtRInt, sizeof(int),
- XtOffset(struct ARGS*,showpointer),
- XtRString, "1"
- },{
- "fullscreen",
- XtCValue, XtRInt, sizeof(int),
- XtOffset(struct ARGS*,fullscreen),
- XtRString, "0"
- },{
- "fbdev",
- XtCValue, XtRInt, sizeof(int),
- XtOffset(struct ARGS*,fbdev),
- XtRString, "0"
- },{
- "xvideo",
- XtCValue, XtRInt, sizeof(int),
- XtOffset(struct ARGS*,xv_video),
- XtRString, "1"
- },{
- "hwscale",
- XtCValue, XtRInt, sizeof(int),
- XtOffset(struct ARGS*,xv_scale),
- XtRString, "1"
- },{
- "vidmode",
- XtCValue, XtRInt, sizeof(int),
- XtOffset(struct ARGS*,vidmode),
- XtRString, "1"
- },{
- "dga",
- XtCValue, XtRInt, sizeof(int),
- XtOffset(struct ARGS*,dga),
- XtRString, "1"
- },{
- "help",
- XtCValue, XtRInt, sizeof(int),
- XtOffset(struct ARGS*,help),
- XtRString, "0"
- }
-};
-
-static XrmOptionDescRec opt_desc[] = {
- { "-c", "device", XrmoptionSepArg, NULL },
- { "-device", "device", XrmoptionSepArg, NULL },
- { "-o", "basename", XrmoptionSepArg, NULL },
- { "-outfile", "basename", XrmoptionSepArg, NULL },
-
- { "-v", "debug", XrmoptionSepArg, NULL },
- { "-debug", "debug", XrmoptionSepArg, NULL },
- { "-b", "bpp", XrmoptionSepArg, NULL },
- { "-bpp", "bpp", XrmoptionSepArg, NULL },
- { "-shift", "shift", XrmoptionSepArg, NULL },
-
- { "-remote", "remote", XrmoptionNoArg, "1" },
- { "-n", "readconfig", XrmoptionNoArg, "0" },
- { "-noconf", "readconfig", XrmoptionNoArg, "0" },
- { "-m", "showpointer", XrmoptionNoArg, "0" },
- { "-nomouse", "showpointer", XrmoptionNoArg, "0" },
- { "-f", "fullscreen", XrmoptionNoArg, "1" },
- { "-fullscreen", "fullscreen", XrmoptionNoArg, "1" },
-
- { "-fb", "fbdev", XrmoptionNoArg, "1" },
- { "-noxv", "xvideo", XrmoptionNoArg, "0" },
- { "-noscale", "hwscale", XrmoptionNoArg, "0" },
- { "-novm", "vidmode", XrmoptionNoArg, "0" },
- { "-nodga", "dga", XrmoptionNoArg, "0" },
-
- { "-h", "help", XrmoptionNoArg, "1" },
- { "-help", "help", XrmoptionNoArg, "1" },
- { "--help", "help", XrmoptionNoArg, "1" },
-};
-
-#define OPT_COUNT (sizeof(opt_desc)/sizeof(XrmOptionDescRec))
-
/*--- actions -------------------------------------------------------------*/
/* conf.c */
-extern void create_confwin();
-extern void conf_station_switched();
-extern void conf_list_update();
+extern void create_confwin(void);
+extern void conf_station_switched(void);
+extern void conf_list_update(void);
void CloseMainAction(Widget, XEvent*, String*, Cardinal*);
void SetBgAction(Widget, XEvent*, String*, Cardinal*);
void SetShadowAction(Widget, XEvent*, String*, Cardinal*);
void ScanAction(Widget, XEvent*, String*, Cardinal*);
void ChannelAction(Widget, XEvent*, String*, Cardinal*);
-void PointerAction(Widget, XEvent*, String*, Cardinal*);
void RemoteAction(Widget, XEvent*, String*, Cardinal*);
void ZapAction(Widget, XEvent*, String*, Cardinal*);
void StayOnTop(Widget, XEvent*, String*, Cardinal*);
void LaunchAction(Widget, XEvent*, String*, Cardinal*);
void PopupAction(Widget, XEvent*, String*, Cardinal*);
-void CommandAction(Widget, XEvent*, String*, Cardinal*);
static XtActionsRec actionTable[] = {
{ "CloseMain", CloseMainAction },
@@ -347,7 +235,6 @@ static XtActionsRec actionTable[] = {
{ "SetShadow", SetShadowAction },
{ "Scan", ScanAction },
{ "Channel", ChannelAction },
- { "Pointer", PointerAction },
{ "Remote", RemoteAction },
{ "Zap", ZapAction },
{ "Complete", CompleteAction },
@@ -366,34 +253,6 @@ static struct STRTAB cap_list[] = {
{ -1, NULL, },
};
-static struct STRTAB avi_audio[] = {
- { 0, "no sound" },
- { 1, "mono" },
- { 2, "stereo" },
- { -1, NULL },
-};
-
-static struct STRTAB avi_format[] = {
- { VIDEO_RGB15_LE, "15 bpp (rgb)" },
- { VIDEO_BGR24, "24 bpp (rgb)" },
- { VIDEO_MJPEG, "mjpeg" },
- { -1, NULL },
-};
-
-static struct STRTAB avi_fps[] = {
- { 5, " 5 fps" },
- { 8, " 8 fps" },
- { 10, "10 fps" },
- { 12, "12 fps" },
- { 15, "15 fps" },
- { 18, "18 fps" },
- { 20, "20 fps" },
- { 24, "24 fps" },
- { 25, "25 fps" },
- { 30, "30 fps" },
- { -1, NULL },
-};
-
/*--- exit ----------------------------------------------------------------*/
Boolean
@@ -423,7 +282,7 @@ ExitCB(Widget widget, XtPointer client_data, XtPointer calldata)
}
static void
-do_exit()
+do_exit(void)
{
ExitCB(NULL,NULL,NULL);
}
@@ -432,64 +291,14 @@ void
CloseMainAction(Widget widget, XEvent *event,
String *params, Cardinal *num_params)
{
-#if 0
- static Dimension x,y,w,h;
-#endif
- char *argv[32];
- int argc = 0;
-
- if (event->type == ClientMessage) {
- if (event->xclient.data.l[0] == wm_protocols[1]) {
- if (debug)
- fprintf(stderr,"Main: wm_save_yourself\n");
-
- argv[argc++] = progname;
-#if 0
-
- /* position */
- if (fs) {
- argv[argc++] = strdup("-f");
- } else {
- XtVaGetValues(app_shell,
- XtNx,&x,XtNy,&y,XtNwidth,&w,XtNheight,&h,
- NULL);
- argv[argc++] = strdup("-geometry");
- sprintf(argv[argc++] = malloc(32),"%dx%d+%d+%d",w,h,x,y);
- }
- argv[argc++] = strdup("-c");
- argv[argc++] = strdup(device);
-
- /* grab filename */
- if (snapbase) {
- argv[argc++] = strdup("-o");
- argv[argc++] = malloc(256);
- argv[argc-1][0] = '\0';
- if (snapbase[0] != '/') {
- getcwd(argv[argc-1],128);
- strcat(argv[argc-1],"/");
- }
- strcat(argv[argc-1],snapbase);
- }
-
- /* options */
- if (!dga_ext)
- argv[argc++] = strdup("--nodga");
- if (!vm_ext)
- argv[argc++] = strdup("--novm");
- if (!xvideo_ext)
- argv[argc++] = strdup("--noxv");
- if (!pointer_on)
- argv[argc++] = strdup("-m");
- if (bpp) {
- argv[argc++] = strdup("-b");
- sprintf(argv[argc++] =