aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2010-04-01 09:24:40 (GMT)
committerGerd Hoffmann <kraxel@redhat.com>2010-04-01 09:24:40 (GMT)
commit9a66215a0f025697feff7b23b38bd81099ab2264 (patch)
tree6dfc04ba6962b77c5a94eab041117308b14dba2c
parent0232cfd283801fe5bc7af5e4d29a70a429dc3421 (diff)
v3.87
-rw-r--r--Changes9
-rw-r--r--Makefile2
-rw-r--r--Makefile.clean2
-rw-r--r--Makefile.in34
-rw-r--r--common/capture.c27
-rw-r--r--common/channel.c6
-rw-r--r--common/commands.c32
-rw-r--r--common/commands.h1
-rw-r--r--common/frequencies.c2
-rw-r--r--common/parseconfig.c4
-rw-r--r--config.h.in9
-rwxr-xr-xconfigure160
-rw-r--r--configure.ac21
-rw-r--r--console/fbtv.c5
-rw-r--r--console/record.c24
-rw-r--r--console/showqt.c32
-rw-r--r--console/showriff.c15
-rw-r--r--console/v4l-info.c17
-rw-r--r--debian/changelog8
-rw-r--r--debian/control6
-rw-r--r--debian/rules2
-rw-r--r--debian/xawtv.files2
-rw-r--r--debian/xawtv.postinst6
-rw-r--r--libng/grab-ng.c4
-rw-r--r--libng/plugins/drv0-v4l2.c35
-rw-r--r--man/es/xawtvrc.56
-rw-r--r--man/v4l-info.115
-rw-r--r--man/xawtvrc.58
-rw-r--r--scripts/build-test22
-rw-r--r--x11/MoTV-de2
-rw-r--r--x11/MoTV-default2
-rw-r--r--x11/MoTV-fr2
-rw-r--r--x11/MoTV-it2
-rw-r--r--x11/Subdir.mk6
-rw-r--r--x11/blit.c14
-rw-r--r--x11/motv.c106
-rw-r--r--x11/mtt.ad15
-rw-r--r--x11/mtt.c20
-rw-r--r--x11/vbi-gui.c216
-rw-r--r--x11/vbi-x11.c172
-rw-r--r--x11/vbi-x11.h24
-rw-r--r--x11/x11.c13
-rw-r--r--x11/x11.h2
-rw-r--r--x11/xawtv.c62
-rw-r--r--x11/xt.c296
-rw-r--r--x11/xt.h47
-rw-r--r--xawtv.spec2
47 files changed, 1133 insertions, 386 deletions
diff --git a/Changes b/Changes
index 3fe9994..72311dc 100644
--- a/Changes
+++ b/Changes
@@ -1,4 +1,13 @@
+3.86 => 3.87
+============
+
+ * fixed "default = grabdisplay" not working.
+ * added Xrandr support.
+ * lots of mtt (motif teletext viewer) tweaks.
+ * 64bit fixes for record + showriff
+
+
3.85 => 3.86
============
diff --git a/Makefile b/Makefile
index abc1322..6738ba5 100644
--- a/Makefile
+++ b/Makefile
@@ -12,7 +12,7 @@ build all install: $(arch)/Makefile
clean distclean:
-test -d "$(arch)" && rm -rf "$(arch)"
-tarball rpm checkit release port snapshot snap:
+tarball rpm dsc debs pbuild release snapshot snap:
./configure
$(MAKE) $@
diff --git a/Makefile.clean b/Makefile.clean
index abc1322..6738ba5 100644
--- a/Makefile.clean
+++ b/Makefile.clean
@@ -12,7 +12,7 @@ build all install: $(arch)/Makefile
clean distclean:
-test -d "$(arch)" && rm -rf "$(arch)"
-tarball rpm checkit release port snapshot snap:
+tarball rpm dsc debs pbuild release snapshot snap:
./configure
$(MAKE) $@
diff --git a/Makefile.in b/Makefile.in
index 3bcc65a..e5ed376 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -29,15 +29,15 @@ VERSION := @VERSION@
# for CFLAGS
WARN_FLAGS := -Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith
LFS_FLAGS := -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
-X11_FLAGS := @X_CFLAGS@ -I/usr/X11R6/include/X11/fonts
+X11_FLAGS := @X_CFLAGS@ @XFT_FLAGS@ -I/usr/X11R6/include/X11/fonts
LIB_FLAGS := -I. -I./vbistuff -I./x11 \
-I$(srcdir)/jwz -I$(srcdir)/common -I$(srcdir)/console \
-I$(srcdir)/x11 -I$(srcdir)/structs \
-I$(srcdir)/libng -Llibng
# various libraries
-ATHENA_LIBS := @X_LIBS@ @LIBS@ @ATHENA@
-MOTIF_LIBS := @X_LIBS@ @LIBS@ -lXm -lXmu -lXt @X_PRE_LIBS@ \
+ATHENA_LIBS := @X_LIBS@ @XFT_LIBS@ @LIBS@ @ATHENA@
+MOTIF_LIBS := @X_LIBS@ @XFT_LIBS@ @LIBS@ -lXm -lXmu -lXt @X_PRE_LIBS@ \
-lXp -lXpm -lXext -lX11 @X_EXTRA_LIBS@
THREAD_LIBS := @LIBPTHREAD@
CURSES_LIBS := @LIBCURSES@
@@ -157,15 +157,28 @@ include $(srcdir)/x11/Subdir.mk
#########################################################
# just for me, some maintaining jobs. Don't use them
-checkit: distclean
- dpkg-buildpackage -tc -us -uc -rfakeroot
- lintian ../xawtv_*.changes
+PRESULT := /work/pbuilder/result
-release: distclean
- dpkg-buildpackage -tc -rfakeroot
+PACKAGE := xawtv
+DEBARCH := $(shell uname -m | sed \
+ -e 's/i.86/i386/' \
+ -e 's/ppc/powerpc/')
+DEBVER = $(shell dpkg-parsechangelog | sed -n 's/^Version: \(.*:\|\)//p')
+DSC := $(PACKAGE)_$(VERSION).dsc
+CHANGES := $(PACKAGE)_$(VERSION)_$(DEBARCH).changes
+
+
+dsc source ../$(DSC): clean
+ test "$(VERSION)" = "$(DEBVER)"
+ dpkg-buildpackage -S -us -uc -rfakeroot
+
+debs pbuild $(PRESULT)/$(CHANGES): ../$(DSC)
+ sudo /usr/sbin/pbuilder build ../$(DSC)
+ lintian -i $(PRESULT)/$(CHANGES)
+
+release: $(PRESULT)/$(CHANGES)
+ debsign $(PRESULT)/$(CHANGES)
-port:
- dpkg-buildpackage -b -tc -rfakeroot
tarball: distclean
(cd ..; tar cvzf xawtv_$(VERSION).tar.gz \
@@ -177,4 +190,5 @@ rpm: tarball
snapshot snap: distclean
(cd ..; tar cvzf $(HOME)/snapshot/xawtv-`date +%Y%m%d`.tar.gz \
xawtv-$(VERSION))
+ $(MAKE) -C $(HOME)/snapshot
diff --git a/common/capture.c b/common/capture.c
index 97e272f..4396a24 100644
--- a/common/capture.c
+++ b/common/capture.c
@@ -8,6 +8,7 @@
#include <signal.h>
#include <string.h>
#include <pthread.h>
+#include <inttypes.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/socket.h>
@@ -255,9 +256,9 @@ struct movie_handle {
const struct ng_writer *writer;
void *handle;
pthread_t tflush;
- long long start;
- long long rts;
- long long stopby;
+ uint64_t start;
+ uint64_t rts;
+ uint64_t stopby;
int slots;
/* video */
@@ -267,7 +268,7 @@ struct movie_handle {
int seq;
struct FIFO vfifo;
pthread_t tvideo;
- long long vts;
+ uint64_t vts;
/* video converter thread */
struct FIFO cfifo;
@@ -284,10 +285,10 @@ struct movie_handle {
struct FIFO afifo;
pthread_t taudio;
pthread_t raudio;
- long long ats;
+ uint64_t ats;
- long long rdrift;
- long long vdrift;
+ uint64_t rdrift;
+ uint64_t vdrift;
};
static void*
@@ -517,7 +518,7 @@ int
movie_writer_stop(struct movie_handle *h)
{
char line[128];
- long long stopby;
+ uint64_t stopby;
int frames,i;
void *dummy;
@@ -526,12 +527,12 @@ movie_writer_stop(struct movie_handle *h)
if (h->vfmt.fmtid != VIDEO_NONE && h->afmt.fmtid != AUDIO_NONE) {
for (frames = 0; frames < 16; frames++) {
- stopby = (long long)(h->frames + frames) * 1000000000000 / h->fps;
+ stopby = (uint64_t)(h->frames + frames) * (uint64_t)1000000000000 / h->fps;
if (stopby > h->ats)
break;
}
frames++;
- h->stopby = (long long)(h->frames + frames) * 1000000000000 / h->fps;
+ h->stopby = (uint64_t)(h->frames + frames) * (uint64_t)1000000000000 / h->fps;
while (frames) {
movie_grab_put_video(h,NULL);
frames--;
@@ -593,11 +594,11 @@ movie_print_timestamps(struct movie_handle *h)
(h->rdrift > 0) ? '+' : '-',
(int)((abs(h->rdrift) / 1000000000)),
(int)((abs(h->rdrift) % 1000000000) / 10000000),
- (int)(h->rdrift * h->fps / 1000000000000),
+ (int)(h->rdrift * h->fps / (uint64_t)1000000000000),
(h->vdrift > 0) ? '+' : '-',
(int)((abs(h->vdrift) / 1000000000)),
(int)((abs(h->vdrift) % 1000000000) / 10000000),
- (int)(h->vdrift * h->fps / 1000000000000));
+ (int)(h->vdrift * h->fps / (uint64_t)1000000000000));
rec_status(line);
}
@@ -622,7 +623,7 @@ movie_grab_put_video(struct movie_handle *h, struct ng_video_buf **ret)
#endif
/* rate control */
- expected = (buf->info.ts - h->vdrift) * h->fps / 1000000000000;
+ expected = (buf->info.ts - h->vdrift) * h->fps / (uint64_t)1000000000000;
if (expected < h->frames-1) {
if (debug > 1)
fprintf(stderr,"rate: ignoring frame [%d %d]\n",
diff --git a/common/channel.c b/common/channel.c
index b10802f..1b8596e 100644
--- a/common/channel.c
+++ b/common/channel.c
@@ -2,9 +2,7 @@
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 ... ]
+ (c) 1998-2003 Gerd Knorr <kraxel@bytesex.org>
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
@@ -693,7 +691,7 @@ save_config()
if (channels[i]->key != NULL)
fprintf(fp,"key = %s\n",channels[i]->key);
if (0 != strcmp(channels[i]->group,defaults.group))
- fprintf(fp,"group = %s\n",defaults.group);
+ fprintf(fp,"group = %s\n",channels[i]->group);
if (channels[i]->midi != 0)
fprintf(fp,"midi = %d\n",channels[i]->midi);
if (channels[i]->capture != cur_capture)
diff --git a/common/commands.c b/common/commands.c
index 9b33bc9..bf633a9 100644
--- a/common/commands.c
+++ b/common/commands.c
@@ -198,6 +198,26 @@ void add_attrs(struct ng_attribute *new)
#endif
}
+void init_overlay(void)
+{
+ do_va_cmd(2,"setfreqtab",(-1 != chantab)
+ ? chanlist_names[chantab].str : "europe-west");
+
+ cur_capture = -1;
+ switch (defaults.capture) {
+ case CAPTURE_ON:
+ case CAPTURE_OVERLAY:
+ do_va_cmd(2,"capture","overlay");
+ break;
+ case CAPTURE_GRABDISPLAY:
+ do_va_cmd(2,"capture","grabdisplay");
+ break;
+ default:
+ do_va_cmd(2,"capture","off");
+ break;
+ }
+}
+
/* ----------------------------------------------------------------------- */
int
@@ -282,7 +302,7 @@ split_cmdline(char *line, int *count)
static void
set_capture(int capture, int tmp_switch)
{
- static int last_on = 0;
+ static int last_on = CAPTURE_OVERLAY;
if (set_capture_hook) {
if (capture == CAPTURE_ON)
@@ -439,7 +459,7 @@ static int update_int(struct ng_attribute *attr, int old, char *new)
/* ----------------------------------------------------------------------- */
void
-attr_init()
+attr_init(void)
{
struct ng_attribute *attr;
int val;
@@ -468,7 +488,7 @@ attr_init()
}
void
-audio_init()
+audio_init(void)
{
struct ng_attribute *attr;
@@ -481,7 +501,7 @@ audio_init()
}
void
-audio_on()
+audio_on(void)
{
struct ng_attribute *attr,*list;
@@ -492,7 +512,7 @@ audio_on()
}
void
-audio_off()
+audio_off(void)
{
struct ng_attribute *attr,*list;
@@ -503,7 +523,7 @@ audio_off()
}
void
-set_defaults()
+set_defaults(void)
{
struct ng_attribute *attr;
diff --git a/common/commands.h b/common/commands.h
index 8e51e9d..7c655d8 100644
--- a/common/commands.h
+++ b/common/commands.h
@@ -71,6 +71,7 @@ void audio_off(void);
void set_defaults(void);
void add_attrs(struct ng_attribute *new);
+void init_overlay(void);
int do_va_cmd(int argc, ...);
int do_command(int argc, char **argv);
diff --git a/common/frequencies.c b/common/frequencies.c
index 1c95832..cc03cf3 100644
--- a/common/frequencies.c
+++ b/common/frequencies.c
@@ -62,6 +62,7 @@ void freq_init(void)
fprintf(stderr,"%s:%d: syntax error\n",
DATADIR "/Index.map",nr);
}
+ fclose(fp);
chanlist_names = malloc((i+1) * sizeof(struct STRTAB));
for (j = 0; j < i; j++) {
@@ -125,6 +126,7 @@ static int freq_readlist(struct CHANLIST **list, int n, char *name)
/* Huh ? */
fprintf(stderr,"%s:%d: syntax error\n", filename, nr);
}
+ fclose(fp);
return n;
}
diff --git a/common/parseconfig.c b/common/parseconfig.c
index d4588d7..5e2b798 100644
--- a/common/parseconfig.c
+++ b/common/parseconfig.c
@@ -133,6 +133,9 @@ cfg_parse_file(char *filename)
if (NULL == e) {
fprintf(stderr,"%s:%d: error: no section\n",filename,nr);
} else {
+ char *c = value + strlen(value)-1;
+ while (c > value && (*c == ' ' || *c == '\t'))
+ *(c--) = 0;
cfg_set_entry(e,tag,value);
}
} else {
@@ -140,6 +143,7 @@ cfg_parse_file(char *filename)
fprintf(stderr,"%s:%d: syntax error\n",filename,nr);
}
}
+ fclose(fp);
return 0;
}
diff --git a/config.h.in b/config.h.in
index f5b6ffb..11301ea 100644
--- a/config.h.in
+++ b/config.h.in
@@ -51,6 +51,12 @@
/* Define to 1 if you have the `Xinerama' library (-lXinerama). */
#undef HAVE_LIBXINERAMA
+/* Define to 1 if you have the `Xrandr' library (-lXrandr). */
+#undef HAVE_LIBXRANDR
+
+/* Define to 1 if you have the `Xrender' library (-lXrender). */
+#undef HAVE_LIBXRENDER
+
/* Define to 1 if you have the `Xv' library (-lXv). */
#undef HAVE_LIBXV
@@ -105,6 +111,9 @@
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
+/* "have xft" */
+#undef HAVE_XFT
+
/* "have xmu" */
#undef HAVE_XMU
diff --git a/configure b/configure
index 7d38310..6e51be6 100755
--- a/configure
+++ b/configure
@@ -308,7 +308,7 @@ ac_includes_default="\
# include <unistd.h>
#endif"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CXX CXXFLAGS ac_ct_CXX CPP INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA DEPEND FOUND_AALIB FOUND_ALSA FOUND_DV FOUND_LQT FOUND_MOTIF FOUND_OS FOUND_X11 FOUND_GL FOUND_ZVBI EGREP DLFLAGS LIBPTHREAD LIBOSS LIBCURSES X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS x_includes x_libraries ATHENA FSLIB SUBS TOOLS LDLIBS LIBALSA LIRC LIBZVBI AALIBS LIBDV QTLIBS LIBGL VERSION x11conf resdir USE_MMX LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CXX CXXFLAGS ac_ct_CXX CPP INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA DEPEND FOUND_AALIB FOUND_ALSA FOUND_DV FOUND_LQT FOUND_MOTIF FOUND_OS FOUND_X11 FOUND_GL FOUND_ZVBI EGREP DLFLAGS LIBPTHREAD LIBOSS LIBCURSES X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS x_includes x_libraries ATHENA FSLIB SUBS TOOLS LDLIBS XFT_FLAGS XFT_LIBS LIBALSA LIRC LIBZVBI AALIBS LIBDV QTLIBS LIBGL VERSION x11conf resdir USE_MMX LIBOBJS LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
@@ -862,6 +862,7 @@ Optional Features:
--enable-gl enable opengl support
--enable-dv enable dvlib support
--enable-mmx enable mmx support
+ --enable-xft enable xft support
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@@ -1345,6 +1346,11 @@ if test "${enable_mmx+set}" = set; then
enableval="$enable_mmx"
fi;
+# Check whether --enable-xft or --disable-xft was given.
+if test "${enable_xft+set}" = set; then
+ enableval="$enable_xft"
+
+fi;
@@ -5031,6 +5037,26 @@ if test "$no_x" != "yes"; then
FOUND_X11="yes"
ATHENA="-lXaw -lXmu -lXt $X_PRE_LIBS -lXpm -lXext -lX11 $X_EXTRA_LIBS"
FSLIB="-lFS"
+ XFT_FLAGS=""
+ XFT_LIBS=""
+ if test "$enable_xft" != "no"; then
+ echo "$as_me:$LINENO: checking for Xft" >&5
+echo $ECHO_N "checking for Xft... $ECHO_C" >&6
+ if test -x "`which pkg-config 2>/dev/null`" && pkg-config xft; then
+ XFT_FLAGS="`pkg-config --cflags xft`"
+ XFT_LIBS="`pkg-config --libs xft`"
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_XFT 1
+_ACEOF
+
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+ else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+ fi
+ fi
else
ATHENA=""
FSLIB=""
@@ -5047,6 +5073,8 @@ fi
+
+
echo "$as_me:$LINENO: checking for jpeg_start_compress in -ljpeg" >&5
echo $ECHO_N "checking for jpeg_start_compress in -ljpeg... $ECHO_C" >&6
if test "${ac_cv_lib_jpeg_jpeg_start_compress+set}" = set; then
@@ -5851,6 +5879,134 @@ _ACEOF
fi
+
+echo "$as_me:$LINENO: checking for XRenderQueryExtension in -lXrender" >&5
+echo $ECHO_N "checking for XRenderQueryExtension in -lXrender... $ECHO_C" >&6
+if test "${ac_cv_lib_Xrender_XRenderQueryExtension+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lXrender $X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char XRenderQueryExtension ();
+int
+main ()
+{
+XRenderQueryExtension ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_Xrender_XRenderQueryExtension=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_Xrender_XRenderQueryExtension=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_Xrender_XRenderQueryExtension" >&5
+echo "${ECHO_T}$ac_cv_lib_Xrender_XRenderQueryExtension" >&6
+if test $ac_cv_lib_Xrender_XRenderQueryExtension = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBXRENDER 1
+_ACEOF
+
+ LIBS="-lXrender $LIBS"
+
+fi
+
+
+echo "$as_me:$LINENO: checking for XRRConfigCurrentConfiguration in -lXrandr" >&5
+echo $ECHO_N "checking for XRRConfigCurrentConfiguration in -lXrandr... $ECHO_C" >&6
+if test "${ac_cv_lib_Xrandr_XRRConfigCurrentConfiguration+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lXrandr $X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char XRRConfigCurrentConfiguration ();
+int
+main ()
+{
+XRRConfigCurrentConfiguration ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_Xrandr_XRRConfigCurrentConfiguration=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_Xrandr_XRRConfigCurrentConfiguration=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_Xrandr_XRRConfigCurrentConfiguration" >&5
+echo "${ECHO_T}$ac_cv_lib_Xrandr_XRRConfigCurrentConfiguration" >&6
+if test $ac_cv_lib_Xrandr_XRRConfigCurrentConfiguration = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBXRANDR 1
+_ACEOF
+
+ LIBS="-lXrandr $LIBS"
+
+fi
+
else
echo "*** XFree extentions disabled"
fi
@@ -6755,6 +6911,8 @@ s,@FSLIB@,$FSLIB,;t t
s,@SUBS@,$SUBS,;t t
s,@TOOLS@,$TOOLS,;t t
s,@LDLIBS@,$LDLIBS,;t t
+s,@XFT_FLAGS@,$XFT_FLAGS,;t t
+s,@XFT_LIBS@,$XFT_LIBS,;t t
s,@LIBALSA@,$LIBALSA,;t t
s,@LIRC@,$LIRC,;t t
s,@LIBZVBI@,$LIBZVBI,;t t
diff --git a/configure.ac b/configure.ac
index 49d490c..9985740 100644
--- a/configure.ac
+++ b/configure.ac
@@ -30,6 +30,8 @@ AC_ARG_ENABLE(dv,
[ --enable-dv enable dvlib support])
AC_ARG_ENABLE(mmx,
[ --enable-mmx enable mmx support])
+AC_ARG_ENABLE(xft,
+ [ --enable-xft enable xft support])
dnl ---------------------------------------------------------------------
@@ -131,6 +133,19 @@ if test "$no_x" != "yes"; then
FOUND_X11="yes"
ATHENA="-lXaw -lXmu -lXt $X_PRE_LIBS -lXpm -lXext -lX11 $X_EXTRA_LIBS"
FSLIB="-lFS"
+ XFT_FLAGS=""
+ XFT_LIBS=""
+ if test "$enable_xft" != "no"; then
+ AC_MSG_CHECKING(for Xft)
+ if test -x "`which pkg-config 2>/dev/null`" && pkg-config xft; then
+ XFT_FLAGS="`pkg-config --cflags xft`"
+ XFT_LIBS="`pkg-config --libs xft`"
+ AC_DEFINE(HAVE_XFT,1,"have xft")
+ AC_MSG_RESULT(yes)
+ else
+ AC_MSG_RESULT(no)
+ fi
+ fi
else
ATHENA=""
FSLIB=""
@@ -146,6 +161,8 @@ AC_SUBST(FSLIB)
AC_SUBST(SUBS)
AC_SUBST(TOOLS)
AC_SUBST(LDLIBS)
+AC_SUBST(XFT_FLAGS)
+AC_SUBST(XFT_LIBS)
AC_CHECK_LIB(jpeg, jpeg_start_compress, JPEG="found",,)
if test "$JPEG" != "found"; then
@@ -231,6 +248,10 @@ if test "$enable_xfree_ext" != "no"; then
fi
AC_CHECK_LIB(Xinerama, XineramaQueryExtension,,,
$X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS)
+ AC_CHECK_LIB(Xrender, XRenderQueryExtension,,,
+ $X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS)
+ AC_CHECK_LIB(Xrandr, XRRConfigCurrentConfiguration,,,
+ $X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS)
else
echo "*** XFree extentions disabled"
fi
diff --git a/console/fbtv.c b/console/fbtv.c
index 9697219..58a89ae 100644
--- a/console/fbtv.c
+++ b/console/fbtv.c
@@ -705,10 +705,7 @@ main(int argc, char *argv[])
parse_config();
channel_menu();
- do_va_cmd(2,"setfreqtab",(-1 != chantab)
- ? chanlist_names[chantab].str : "europe-west");
- cur_capture = 0;
- do_va_cmd(2,"capture","overlay");
+ init_overlay();
if (optind+1 == argc) {
do_va_cmd(2,"setstation",argv[optind]);
} else {
diff --git a/console/record.c b/console/record.c
index 4bc43dd..c42c49b 100644
--- a/console/record.c
+++ b/console/record.c
@@ -8,6 +8,7 @@
#include <errno.h>
#include <curses.h>
#include <signal.h>
+#include <inttypes.h>
#include <sys/time.h>
#include <sys/signal.h>
#include <sys/ioctl.h>
@@ -40,8 +41,9 @@ tty_restore(void)
/* -------------------------------------------------------------------- */
static int sound_fd;
+static int sound_rcount;
static unsigned int sound_blksize;
-static short *sound_buffer;
+static int16_t *sound_buffer;
static int maxl,maxr;
static int secl,secr;
static int *histl,*histr,histn,histi;
@@ -128,7 +130,7 @@ sound_read(void)
{
unsigned int have;
int i,rc;
- short *v;
+ int16_t *v;
/* read */
for (have = 0;have < sound_blksize;) {
@@ -174,6 +176,7 @@ sound_read(void)
if (secr < histr[i])
secr = histr[i];
}
+ sound_rcount++;
return 0;
}
@@ -253,10 +256,10 @@ mixer_set_volume(int val)
/* Copyright (C) by Heiko Eissfeldt */
-typedef unsigned char BYTE;
-typedef unsigned short WORD;
-typedef unsigned long DWORD;
-typedef unsigned long FOURCC; /* a four character code */
+typedef uint8_t BYTE;
+typedef uint16_t WORD;
+typedef uint32_t DWORD;
+typedef uint32_t FOURCC; /* a four character code */
/* flags for 'wFormatTag' field of WAVEFORMAT */
#define WAVE_FORMAT_PCM 1
@@ -390,6 +393,10 @@ static char blank[] =
" "
" ";
+static char alive[] = "-\\|/";
+//static char alive[] = ".oOo";
+#define ALIVE(count) alive[count % (sizeof(alive)/sizeof(alive[0])-1)]
+
static void
print_bar(int line, char *name, int val1, int val2, int max)
{
@@ -697,7 +704,7 @@ main(int argc, char *argv[])
mvprintw(3,0,"%s: %3d:%02d (%s) ",outfile,
sec/60,sec%60,str_mb(wav_size));
} else {
- mvprintw(3,0,"");
+ mvprintw(3,0,"%c",ALIVE(sound_rcount));
}
}
@@ -778,7 +785,8 @@ main(int argc, char *argv[])
}
}
if (!record) {
- printf("waiting for signal [%d/%d]... \r",maxl,maxr);
+ printf("waiting for signal %c [%d/%d]... \r",
+ ALIVE(sound_rcount), maxl,maxr);
fflush(stdout);
continue;
}
diff --git a/console/showqt.c b/console/showqt.c
index 51dfc94..4221e81 100644
--- a/console/showqt.c
+++ b/console/showqt.c
@@ -17,22 +17,22 @@
#endif
#if BYTE_ORDER == LITTLE_ENDIAN
-# define SWAP2(x) (((x>>8) & 0x00ff) |\
- ((x<<8) & 0xff00))
-
-# define SWAP4(x) (((x>>24) & 0x000000ff) |\
- ((x>>8) & 0x0000ff00) |\
- ((x<<8) & 0x00ff0000) |\
- ((x<<24) & 0xff000000))
-
-# define SWAP8(x) (((x>>56) & 0x00000000000000ff) |\
- ((x>>40) & 0x000000000000ff00) |\
- ((x>>24) & 0x0000000000ff0000) |\
- ((x>> 8) & 0x00000000ff000000) |\
- ((x<< 8) & 0x000000ff00000000) |\
- ((x<<24) & 0x0000ff0000000000) |\
- ((x<<40) & 0x00ff000000000000) |\
- ((x<<56) & 0xff00000000000000))
+# define SWAP2(x) ((((uint16_t)x>>8) & (uint16_t)0x00ff) |\
+ (((uint16_t)x<<8) & (uint16_t)0xff00))
+
+# define SWAP4(x) ((((uint32_t)x>>24) & (uint32_t)0x000000ff) |\
+ (((uint32_t)x>>8) & (uint32_t)0x0000ff00) |\
+ (((uint32_t)x<<8) & (uint32_t)0x00ff0000) |\
+ (((uint32_t)x<<24) & (uint32_t)0xff000000))
+
+# define SWAP8(x) ((((uint64_t)x>>56) & (uint64_t)0x00000000000000ff) |\
+ (((uint64_t)x>>40) & (uint64_t)0x000000000000ff00) |\
+ (((uint64_t)x>>24) & (uint64_t)0x0000000000ff0000) |\
+ (((uint64_t)x>> 8) & (uint64_t)0x00000000ff000000) |\
+ (((uint64_t)x<< 8) & (uint64_t)0x000000ff00000000) |\
+ (((uint64_t)x<<24) & (uint64_t)0x0000ff0000000000) |\
+ (((uint64_t)x<<40) & (uint64_t)0x00ff000000000000) |\
+ (((uint64_t)x<<56) & (uint64_t)0xff00000000000000))
#else
# define SWAP2(a) (a)
# define SWAP4(a) (a)
diff --git a/console/showriff.c b/console/showriff.c
index c884e4d..aa9d093 100644
--- a/console/showriff.c
+++ b/console/showriff.c
@@ -20,6 +20,7 @@
#include <unistd.h>
#include <ctype.h>
#include <errno.h>
+#include <inttypes.h>
#include <sys/types.h>
#if BYTE_ORDER == BIG_ENDIAN
@@ -42,10 +43,10 @@
# define fseeko fseek
#endif
-typedef unsigned long DWORD;
-typedef unsigned short WORD;
+typedef uint32_t DWORD;
+typedef uint16_t WORD;
typedef DWORD FOURCC; /* Type of FOUR Character Codes */
-typedef unsigned char boolean;
+typedef uint8_t boolean;
#define TRUE 1
#define FALSE 0
#define BUFSIZE 4096
@@ -203,13 +204,13 @@ static void dump_vals(FILE *f, int count, struct VAL *names)
case INT32:
fread(&val32,4,1,f);
val32 = SWAP4(val32);
- printf("\t%-12s = %ld\n",names[i].name,val32);
+ printf("\t%-12s = %d\n",names[i].name,val32);
break;
case CCODE:
fread(&val32,4,1,f);
val32 = SWAP4(val32);
if (val32) {
- printf("\t%-12s = %c%c%c%c (0x%lx)\n",names[i].name,
+ printf("\t%-12s = %c%c%c%c (0x%x)\n",names[i].name,
(int)( val32 & 0xff),
(int)((val32 >> 8) & 0xff),
(int)((val32 >> 16) & 0xff),
@@ -222,7 +223,7 @@ static void dump_vals(FILE *f, int count, struct VAL *names)
case FLAGS:
fread(&val32,4,1,f);
val32 = SWAP4(val32);
- printf("\t%-12s = 0x%lx\n",names[i].name,val32);
+ printf("\t%-12s = 0x%x\n",names[i].name,val32);
if (names[i].flags) {
for (j = 0; names[i].flags[j].bit != 0; j++)
if (names[i].flags[j].bit & val32)
@@ -406,7 +407,7 @@ static boolean ProcessChunk(FILE* f, size_t filepos, size_t filesize,
datapos=filepos+sizeof(FOURCC)+sizeof(DWORD); /* here is the data */
/* print out header: */
- printf("(0x%s) %*c ID:<%s> Size: 0x%08lx\n",
+ printf("(0x%s) %*c ID:<%s> Size: 0x%08x\n",
off_t_to_char(filepos,16,8),(RekDepth+1)*4,' ',tagstr,*chunksize);
if (datapos + ((*chunksize+1)&~1) > filesize) { /* too long? */
diff --git a/console/v4l-info.c b/console/v4l-info.c
index 38659cf..8e5155d 100644
--- a/console/v4l-info.c
+++ b/console/v4l-info.c
@@ -267,7 +267,7 @@ int main(int argc, char *argv[])
{
char dummy[256];
char *device = "/dev/video0";
- int tab = 1;
+ int tab = 1, ok = 0;
int fd;
if (argc > 1)
@@ -280,13 +280,20 @@ int main(int argc, char *argv[])
};
if (-1 != ioctl(fd,VIDIOC_QUERYCAP,dummy)) {
- printf("### v4l2 device info [%s] ###\n",device);
+ printf("\n### v4l2 device info [%s] ###\n",device);
dump_v4l2(fd,tab);
- } else if (-1 != ioctl(fd,VIDIOCGCAP,dummy)) {
- printf("### video4linux device info [%s] ###\n",device);
+ ok = 1;
+ }
+
+ if (-1 != ioctl(fd,VIDIOCGCAP,dummy)) {
+ printf("\n### video4linux device info [%s] ###\n",device);
dump_v4l(fd,tab);
- } else {
+ ok = 1;
+ }
+
+ if (!ok) {
fprintf(stderr,"%s: not an video4linux device\n",device);
+ exit(1);
}
return 0;
}
diff --git a/debian/changelog b/debian/changelog
index 3471d7d..29d4713 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+xawtv (3.87) unstable; urgency=low
+
+ * new release.
+ * postinst fixes (closes: #179319,#188652).
+ * rebuild with new, fixed libquicktime-dev (closes: #186332).
+
+ -- Gerd Knorr <kraxel@debian.org> Tue, 15 Apr 2003 12:39:21 +0200
+
xawtv (3.86) unstable; urgency=low
* new release (closes: #175886, #171884, #178691, #171354)
diff --git a/debian/control b/debian/control
index c574a19..8a81e12 100644
--- a/debian/control
+++ b/debian/control
@@ -1,9 +1,9 @@
Source: xawtv
Section: graphics
Priority: extra
-Build-Depends: libjpeg-dev, libncurses5-dev, xlibs-dev (>= 4.0.1), liblircclient-dev, debhelper (>= 2.0), xutils, xbase-clients, aalib1-dev, libasound2-dev, libzvbi-dev (>= 0.2.1), libquicktime-dev, libxaw7-dev
+Build-Depends: libjpeg-dev, libncurses5-dev, xlibs-dev (>= 4.0.1), liblircclient-dev, debhelper (>= 4.0), xutils, xbase-clients, aalib1-dev, libasound2-dev, libzvbi-dev (>= 0.2.1), libquicktime-dev, libxaw7-dev, xlibmesa-gl-dev, libxft2-dev
Maintainer: Gerd Knorr <kraxel@debian.org>
-Standards-Version: 3.5.7.1
+Standards-Version: 3.5.9
Package: xawtv
Section: x11
@@ -109,7 +109,7 @@ Package: webcam
Section: net
Architecture: any
Depends: ${shlibs:Depends}, xawtv-plugins (=${Source-Version})
-Reommends: ftp, ssh
+Recommends: ftp, ssh
Description: capture and upload images
webcam captures images from a video4linux device like
bttv, annotates them and and uploads them to a webserver
diff --git a/debian/rules b/debian/rules
index bb658ea..1478e5a 100644
--- a/debian/rules
+++ b/debian/rules
@@ -3,7 +3,7 @@
# GNU copyright 1997 to 1999 by Joey Hess.
#export DH_VERBOSE=1
-export DH_COMPAT=2
+export DH_COMPAT=4
ROOT=$(shell echo `pwd`/debian/tmp)
build:
diff --git a/debian/xawtv.files b/debian/xawtv.files
index feb41bf..078ecab 100644
--- a/debian/xawtv.files
+++ b/debian/xawtv.files
@@ -4,6 +4,7 @@
/usr/bin/rootv
/usr/bin/ntsc-cc
/usr/bin/subtitles
+/usr/bin/v4l-info
/usr/share/man/man1/v4lctl.1
/usr/share/man/*/man1/v4lctl.1
/usr/share/man/man1/xawtv.1
@@ -15,6 +16,7 @@
/usr/share/man/man1/ntsc-cc.1
/usr/share/man/man1/subtitles.1
/usr/share/man/*/man1/subtitles.1
+/usr/share/man/man1/v4l-info.1
/usr/share/man/man5/xawtvrc.5
/usr/share/man/*/man5/xawtvrc.5
/etc/X11/app-defaults/Xawtv
diff --git a/debian/xawtv.postinst b/debian/xawtv.postinst
index c84f6e9..5b583b1 100644
--- a/debian/xawtv.postinst
+++ b/debian/xawtv.postinst
@@ -12,7 +12,7 @@ freqtab=""
doscan=""
# create v4l devices ?
-test -c /dev/.devfsd -o -c /dev/video0 && mkdev="false"
+test -c /dev/.devfsd -o -c /dev/video0 -o -c /dev/v4l/video0 && mkdev="false"
if test "$mkdev" = "true"; then
db_get xawtv/makedev
mkdev="$RET"
@@ -55,9 +55,5 @@ if test "$mkcfg" = "true"; then
$cmd
fi
-# install new X11 fonts
-(cd /usr/X11R6/lib/X11/fonts/misc; /usr/X11R6/bin/mkfontdir)
-
#########################################################
#DEBHELPER#
-
diff --git a/libng/grab-ng.c b/libng/grab-ng.c
index 1f02a2e..e29942e 100644
--- a/libng/grab-ng.c
+++ b/libng/grab-ng.c
@@ -197,6 +197,8 @@ ng_malloc_audio_buf(struct ng_audio_fmt *fmt, int size)
struct ng_attribute*
ng_attr_byid(struct ng_attribute *attrs, int id)
{
+ if (NULL == attrs)
+ return NULL;
for (;;) {
if (NULL == attrs->name)
return NULL;
@@ -209,6 +211,8 @@ ng_attr_byid(struct ng_attribute *attrs, int id)
struct ng_attribute*
ng_attr_byname(struct ng_attribute *attrs, char *name)
{
+ if (NULL == attrs)
+ return NULL;
for (;;) {
if (NULL == attrs->name)
return NULL;
diff --git a/libng/plugins/drv0-v4l2.c b/libng/plugins/drv0-v4l2.c
index 032d2a8..3954123 100644
--- a/libng/plugins/drv0-v4l2.c
+++ b/libng/plugins/drv0-v4l2.c
@@ -98,6 +98,9 @@ struct v4l2_handle {
struct v4l2_framebuffer ov_fb;
struct v4l2_format ov_win;
struct v4l2_clip ov_clips[256];
+#if 0
+ enum v4l2_field ov_fields;
+#endif
int ov_error;
int ov_enabled;
int ov_on;
@@ -344,6 +347,8 @@ v4l2_add_attr(struct v4l2_handle *h, struct v4l2_queryctrl *ctl,
} else {
/* for norms + inputs */
h->attr[h->nattr].id = id;
+ if (-1 == h->attr[h->nattr].id)
+ h->attr[h->nattr].id = private_ids++;
h->attr[h->nattr].defval = 0;
h->attr[h->nattr].type = ATTR_TYPE_CHOICE;
h->attr[h->nattr].choices = choices;
@@ -363,7 +368,9 @@ static int v4l2_read_attr(struct ng_attribute *attr)
const struct v4l2_queryctrl *ctl = attr->priv;
struct v4l2_control c;
struct v4l2_tuner tuner;
+ v4l2_std_id std;
int value = 0;
+ int i;
if (NULL != ctl) {
c.id = ctl->id;
@@ -371,7 +378,11 @@ static int v4l2_read_attr(struct ng_attribute *attr)
value = c.value;
} else if (attr->id == ATTR_ID_NORM) {
- value = -1; /* FIXME */
+ value = -1;
+ xioctl(h->fd,VIDIOC_G_STD,&std,0);
+ for (i = 0; i < h->nstds; i++)
+ if (std & h->std[i].id)
+ value = i;
} else if (attr->id == ATTR_ID_INPUT) {
xioctl(h->fd,VIDIOC_G_INPUT,&value,0);
@@ -760,6 +771,25 @@ v4l2_waiton(struct v4l2_handle *h)
return -1;
h->waiton++;
h->buf_v4l2[buf.index] = buf;
+
+#if 0
+ if (1) {
+ /* for driver debugging */
+ static const char *fn[] = {
+ "any", "none", "top", "bottom",
+ "interlaced", "tb", "bt", "alternate",
+ };
+ static struct timeval last;
+ signed long diff;
+
+ diff = (buf.timestamp.tv_sec - last.tv_sec) * 1000000;
+ diff += buf.timestamp.tv_usec - last.tv_usec;
+ fprintf(stderr,"\tdiff %6.1f ms buf %d field %d [%s]\n",
+ diff/1000.0, buf.index, buf.field, fn[buf.field%8]);
+ last = buf.timestamp;
+ }
+#endif
+
return buf.index;
}
@@ -832,6 +862,8 @@ v4l2_stop_streaming(struct v4l2_handle *h)
for (i = 0; i < h->reqbufs.count; i++) {
if (0 != h->buf_me[i].refcount)
ng_waiton_video_buf(&h->buf_me[i]);
+ if (ng_debug)
+ print_bufinfo(&h->buf_v4l2[i]);
if (-1 == munmap(h->buf_me[i].data,h->buf_me[i].size))
perror("munmap");
}
@@ -861,6 +893,7 @@ v4l2_setformat(void *handle, struct ng_video_fmt *fmt)
h->fmt_v4l2.fmt.pix.width = fmt->width;
h->fmt_v4l2.fmt.pix.height = fmt->height;
h->fmt_v4l2.fmt.pix.field = V4L2_FIELD_ANY;
+ //h->fmt_v4l2.fmt.pix.field = V4L2_FIELD_ALTERNATE;
if (fmt->bytesperline != fmt->width * ng_vfmt_to_depth[fmt->fmtid]/8)
h->fmt_v4l2.fmt.pix.bytesperline = fmt->bytesperline;
else
diff --git a/man/es/xawtvrc.5 b/man/es/xawtvrc.5
index 67fc758..a223b45 100644
--- a/man/es/xawtvrc.5
+++ b/man/es/xawtvrc.5
@@ -54,13 +54,13 @@ usa una sintaxis similar a la de smb.conf: las secciones empiezan con
[nombre], seguida de líneas con parejas opción = valor.
.P
Hay cuatro secciones especiales: [global], [launch], [eventmap] y
-[default]. Todas las demás secciones describen una cadena de TV cada una.
+[defaults]. Todas las demás secciones describen una cadena de TV cada una.
.SS Opciones de cadenas de TV.
Las siguientes opciones son válidas para cadenas de TV y la sección
-[default]. Las opciones de la sección [default] se usan -- como su
+[defaults]. Las opciones de la sección [defaults] se usan -- como su
nombre sugiere -- como valores por defecto para todoslos demás canales.
Puede poner todo lo que es común para todos los canales (como la
-norma de TV que se usa en su país) en la sección [default], de modo que
+norma de TV que se usa en su país) en la sección [defaults], de modo que
ya no deberá especificarla para cada canal.
.P
Con una sección [defaults] razonable, sólo necesitará especificar
diff --git a/man/v4l-info.1 b/man/v4l-info.1
new file mode 100644
index 0000000..90ce560
--- /dev/null
+++ b/man/v4l-info.1
@@ -0,0 +1,15 @@
+.TH v4l-info 1 "(c) Gerd Knorr"
+.SH NAME
+v4l-info - dump video4linux(2) device info to stdout
+.SH SYNOPSIS
+.B v4l-info [ device ]
+.SH DESCRIPTION
+.B v4l-info
+just prints the v4l(2) device info, i.e. calls lots of ioctls and dumps
+the results to stdout. It optionally accepts the device you want to
+query. Default is /dev/video0.
+.P
+Was written to help debug drivers, probably not that useful for end
+users ...
+.SH AUTHOR
+Gerd Knorr <kraxel@bytesex.org>
diff --git a/man/xawtvrc.5 b/man/xawtvrc.5
index 10b1068..136ceba 100644
--- a/man/xawtvrc.5
+++ b/man/xawtvrc.5
@@ -53,13 +53,13 @@ uses the same syntax like smb.conf: sections starting with [name],
followed by lines with option = value pairs.
.P
There are four special sections: [global], [launch], [eventmap] and
-[default]. All other sections describe a TV station each.
+[defaults]. All other sections describe a TV station each.
.SS TV station options.
-The following options are allowed for TV stations and the [default]
-section. The options from the [default] sections are used -- as the
+The following options are allowed for TV stations and the [defaults]
+section. The options from the [defaults] sections are used -- as the
name suggests -- as defaults for all other channels. You can put
everything which is common for all TV stations (like the TV norm which
-is used in your country) into the [default] section, so you don't have
+is used in your country) into the [defaults] section, so you don't have
to specify it for every single channel.
.P
With a reasonable [defaults] section you usually only need to specify
diff --git a/scripts/build-test b/scripts/build-test
index 7f1509f..eec0848 100644
--- a/scripts/build-test
+++ b/scripts/build-test
@@ -14,6 +14,7 @@ make distclean
# make sure autoconf stuff is up-to-date
autoconf || exit 1
autoheader || exit 1
+rm -rf autom4te.cache
set -x
@@ -22,7 +23,7 @@ set -x
make distclean
# parallel builds
-./configure && make -j || exit 1
+./configure && nice make -j || exit 1
make distclean
# no lirc
@@ -57,6 +58,10 @@ make distclean
./configure --disable-gl && make || exit 1
make distclean
+# no xft
+./configure --disable-xft && make || exit 1
+make distclean
+
# no X11
./configure --without-x && make || exit 1
make distclean
@@ -65,21 +70,6 @@ make distclean
#CFLAGS="-static" ./configure && make || exit 1
#make distclean
-# 2.2.x kernel headers
-kernel=`ls -d /work/kernel/2.2.* | head -1`
-./configure && make CC="gcc -I$kernel/include" || exit 1
-make distclean
-
-# 2.4.x kernel headers
-kernel=`ls -d /work/kernel/2.4.* | head -1`
-./configure && make CC="gcc -I$kernel/include" || exit 1
-make distclean
-
-# 2.5.x kernel headers
-kernel=`ls -d /work/kernel/2.5.* | head -1`
-./configure && make CC="gcc -I$kernel/include" || exit 1
-make distclean
-
set +x
diff --git a/x11/MoTV-de b/x11/MoTV-de
index cc7441d..b4cdf18 100644
--- a/x11/MoTV-de
+++ b/x11/MoTV-de
@@ -127,6 +127,8 @@ control*menubar*s_333.labelString: Seite 333
control*menubar*s_333.mnemonic: 3
control*menubar*s_777.labelString: Seite 777
control*menubar*s_777.mnemonic: 7
+control*menubar*s_801.labelString: Seite 801
+control*menubar*s_801.mnemonic: 0
control*menubar*s_888.labelString: Seite 888
control*menubar*s_888.mnemonic: 8
diff --git a/x11/MoTV-default b/x11/MoTV-default
index 0d06b36..16b09b5 100644
--- a/x11/MoTV-default
+++ b/x11/MoTV-default
@@ -129,6 +129,8 @@ control*menubar*s_333.labelString: page 333
control*menubar*s_333.mnemonic: 3
control*menubar*s_777.labelString: page 777
control*menubar*s_777.mnemonic: 7
+control*menubar*s_801.labelString: page 801
+control*menubar*s_801.mnemonic: 0
control*menubar*s_888.labelString: page 888
control*menubar*s_888.mnemonic: 8
diff --git a/x11/MoTV-fr b/x11/MoTV-fr
index f2c9748..91f61ee 100644
--- a/x11/MoTV-fr
+++ b/x11/MoTV-fr
@@ -129,6 +129,8 @@ control*menubar*s_333.labelString: page 333
control*menubar*s_333.mnemonic: 3
control*menubar*s_777.labelString: page 777
control*menubar*s_777.mnemonic: 7
+control*menubar*s_801.labelString: page 801
+control*menubar*s_801.mnemonic: 0
control*menubar*s_888.labelString: page 888
control*menubar*s_888.mnemonic: 8
diff --git a/x11/MoTV-it b/x11/MoTV-it
index ab95517..467a912 100644
--- a/x11/MoTV-it
+++ b/x11/MoTV-it
@@ -130,6 +130,8 @@ control*menubar*s_333.labelString: pagina 333
control*menubar*s_333.mnemonic: 3
control*menubar*s_777.labelString: pagina 777
control*menubar*s_777.mnemonic: 7
+control*menubar*s_801.labelString: pagina 801
+control*menubar*s_801.mnemonic: 0
control*menubar*s_888.labelString: pagina 888
control*menubar*s_888.mnemonic: 8
diff --git a/x11/Subdir.mk b/x11/Subdir.mk
index ea2e8b5..909ddf0 100644
--- a/x11/Subdir.mk
+++ b/x11/Subdir.mk
@@ -67,7 +67,9 @@ x11/mtt: \
console/vbi-tty.o \
console/fbtools.o \
common/vbi-data.o \
- common/RegEdit.o
+ common/channel-no-x11.o \
+ common/RegEdit.o \
+ $(OBJS-common-capture)
x11/v4lctl: \
x11/v4lctl.o \
@@ -96,7 +98,7 @@ x11/xawtv : LDLIBS += \
x11/motv : LDLIBS += \
$(THREAD_LIBS) $(CURSES_LIBS) $(LIRC_LIBS) $(ALSA_LIBS) \
$(MOTIF_LIBS) $(VBI_LIBS) $(GL_LIBS) -ljpeg -lm
-x11/mtt : LDLIBS += $(THREAD_LIBS) $(MOTIF_LIBS) $(VBI_LIBS)
+x11/mtt : LDLIBS += $(THREAD_LIBS) $(MOTIF_LIBS) $(VBI_LIBS) -ljpeg
x11/v4lctl : LDLIBS += $(THREAD_LIBS) $(ATHENA_LIBS) -ljpeg -lm
x11/pia : LDLIBS += $(ATHENA_LIBS) $(GL_LIBS) -ljpeg -lm
x11/rootv : LDLIBS += $(ATHENA_LIBS)
diff --git a/x11/blit.c b/x11/blit.c
index 7b0ac76..397ecd9 100644
--- a/x11/blit.c
+++ b/x11/blit.c
@@ -522,8 +522,10 @@ static int gl_init(Widget widget)
XVisualInfo *visinfo;
GLXContext ctx;
+ if (debug)
+ fprintf(stderr,"blit: gl: init\n");
visinfo = glXChooseVisual(XtDisplay(widget),
- DefaultScreen(XtDisplay(widget)),
+ XScreenNumberOfScreen(XtScreen(widget)),
gl_attrib);
if (!visinfo) {
if (debug)
@@ -658,6 +660,7 @@ struct blit_state {
enum blit_status status;
Widget widget;
Dimension win_width, win_height;
+ int wx,wy,ww,wh;
GC gc;
XVisualInfo *vinfo;
struct ng_video_fmt fmt;
@@ -750,6 +753,13 @@ void blit_resize(struct blit_state *st, Dimension width, Dimension height)
fprintf(stderr,"blit: resize %dx%d\n",width,height);
st->win_width = width;
st->win_height = height;
+
+ st->wx = 0;
+ st->wy = 0;
+ st->ww = st->win_width;
+ st->wh = st->win_height;
+ ng_ratio_fixup(&st->ww, &st->wh, &st->wx, &st->wy);
+
blit_fini_frame(st);
}
@@ -913,7 +923,7 @@ void blit_putframe(struct blit_state *st, struct ng_video_buf *buf)
xv_blit(XtDisplay(st->widget), XtWindow(st->widget),
st->gc, st->xvimage,
0, 0, st->buf.fmt.width, st->buf.fmt.height,
- 0, 0, st->win_width, st->win_height);
+ st->wx, st->wy, st->ww, st->wh);
break;
#endif
diff --git a/x11/motv.c b/x11/motv.c
index 003303b..be0b126 100644
--- a/x11/motv.c
+++ b/x11/motv.c
@@ -42,19 +42,7 @@
#include <Xm/SelectioB.h>
#include <Xm/TransferP.h>
#include <Xm/DragIcon.h>
-
#include <X11/extensions/XShm.h>
-#ifdef HAVE_LIBXXF86VM
-# include <X11/extensions/xf86vmode.h>
-# include <X11/extensions/xf86vmstr.h>
-#endif
-#ifdef HAVE_LIBXINERAMA
-# include <X11/extensions/Xinerama.h>
-#endif
-#ifdef HAVE_LIBXV
-# include <X11/extensions/Xv.h>
-# include <X11/extensions/Xvlib.h>
-#endif
#include "grab-ng.h"
#include "channel.h"
@@ -63,8 +51,8 @@
#include "capture.h"
#include "wmhooks.h"
#include "atoms.h"
-#include "xt.h"
#include "x11.h"
+#include "xt.h"
#include "xv.h"
#include "man.h"
#include "RegEdit.h"
@@ -1406,6 +1394,8 @@ create_control(void)
XtAddCallback(push,XmNactivateCallback,action_cb,"Vtx(start,333)");
push = XtVaCreateManagedWidget("s_777",xmPushButtonWidgetClass,smenu,NULL);
XtAddCallback(push,XmNactivateCallback,action_cb,"Vtx(start,777)");
+ push = XtVaCreateManagedWidget("s_801",xmPushButtonWidgetClass,smenu,NULL);
+ XtAddCallback(push,XmNactivateCallback,action_cb,"Vtx(start,801)");
push = XtVaCreateManagedWidget("s_888",xmPushButtonWidgetClass,smenu,NULL);
XtAddCallback(push,XmNactivateCallback,action_cb,"Vtx(start,888)");
#endif
@@ -2342,7 +2332,7 @@ pref_menu(Widget option, Widget menu, int enable)
XtVaCreateManagedWidget("none",xmPushButtonWidgetClass,menu,NULL);
}
-#ifdef HAVE_LIBXXF86VM
+#if defined(HAVE_LIBXXF86VM) || defined(HAVE_LIBXRANDR)
static void
pref_fs(void)
@@ -2353,11 +2343,13 @@ pref_fs(void)
on = XmToggleButtonGetState(pref_fs_toggle);
if (on) {
- if (0 == args.vidmode) {
+#if defined(HAVE_LIBXXF86VM)
+ if (0 == have_randr && 0 == args.vidmode) {
args.vidmode = 1;
- xfree_vm_init();
+ xfree_vm_init(dpy);
}
- if (0 == have_vm) {
+#endif
+ if (0 == have_randr && 0 == have_vm) {
on = 0;
XtVaSetValues(pref_fs_toggle,XtNsensitive,0,NULL);
}
@@ -2366,17 +2358,34 @@ pref_fs(void)
XmToggleButtonSetState(pref_fs_toggle,on,False);
if (on) {
pref_menu(pref_fs_option,pref_fs_menu,1);
- for (i = 0; i < vm_count; i++) {
- sprintf(s,"%d x %d",
- vm_modelines[i]->hdisplay,
- vm_modelines[i]->vdisplay);
- push = XtVaCreateManagedWidget(s,xmPushButtonWidgetClass,
- pref_fs_menu,NULL);
- if (vm_modelines[i]->hdisplay == fs_width &&
- vm_modelines[i]->vdisplay == fs_height) {
- XtVaSetValues(pref_fs_menu,XmNmenuHistory,push,NULL);
+#if defined(HAVE_LIBXRANDR)
+ if (have_randr) {
+ for (i = 0; i < nrandr; i++) {
+ sprintf(s,"%d x %d",randr[i].width,randr[i].height);
+ push = XtVaCreateManagedWidget(s,xmPushButtonWidgetClass,
+ pref_fs_menu,NULL);
+ if (randr[i].width == fs_width &&
+ randr[i].height == fs_height) {
+ XtVaSetValues(pref_fs_menu,XmNmenuHistory,push,NULL);
+ }
+ }
+ }
+#endif
+#if defined(HAVE_LIBXXF86VM)
+ if (!have_randr) {
+ for (i = 0; i < vm_count; i++) {
+ sprintf(s,"%d x %d",
+ vm_modelines[i]->hdisplay,
+ vm_modelines[i]->vdisplay);
+ push = XtVaCreateManagedWidget(s,xmPushButtonWidgetClass,
+ pref_fs_menu,NULL);
+ if (vm_modelines[i]->hdisplay == fs_width &&
+ vm_modelines[i]->vdisplay == fs_height) {
+ XtVaSetValues(pref_fs_menu,XmNmenuHistory,push,NULL);
+ }
}
}
+#endif
} else {
pref_menu(pref_fs_option,pref_fs_menu,0);
}
@@ -2403,7 +2412,7 @@ pref_mix2(void)
if (w) {
name = XtName(w);
if (!list_empty(&ng_mix_drivers) && 0 != strcmp(name,"none")) {
- mix = list_entry(&ng_mix_drivers.next,struct ng_mix_driver,list);
+ mix = list_entry(ng_mix_drivers.next,struct ng_mix_driver,list);
info = mix->channels(name);
}
}
@@ -3279,14 +3288,14 @@ main(int argc, char *argv[])
/* x11 stuff */
XtAppAddActions(app_context,actionTable,
sizeof(actionTable)/sizeof(XtActionsRec));
- x11_misc_init();
+ x11_misc_init(dpy);
XmAddWMProtocolCallback(app_shell,WM_DELETE_WINDOW,ExitCB,NULL);
if (debug)
fprintf(stderr,"main: dga extention...\n");
- xfree_dga_init();
+ xfree_dga_init(dpy);
if (debug)
fprintf(stderr,"main: xinerama extention...\n");
- xfree_xinerama_init();
+ xfree_xinerama_init(dpy);
#ifdef HAVE_LIBXV
if (debug)
fprintf(stderr,"main: xvideo extention [video]...\n");
@@ -3374,31 +3383,9 @@ main(int argc, char *argv[])
create_scale();
create_attr_widgets();
INIT_LIST_HEAD(&ipc_selections);
-
- if (fs_width && fs_height && !args.vidmode) {
- if (debug)
- fprintf(stderr,"fullscreen mode configured (%dx%d), "
- "VidMode extention enabled\n",fs_width,fs_height);
- args.vidmode = 1;
- }
- if (debug)
- fprintf(stderr,"main: checking for vidmode extention ...\n");
- xfree_vm_init();
-
- /* lirc / midi / joystick remote control */
- if (debug)
- fprintf(stderr,"main: checking for lirc ...\n");
- xt_lirc_init();
- if (debug)
- fprintf(stderr,"main: checking for joystick ...\n");
- xt_joystick_init();
- if (debug)
- fprintf(stderr,"main: checking for midi ...\n");
- xt_midi_init(midi);
- if (debug)
- fprintf(stderr,"main: adding kbd hooks ...\n");
- xt_kbd_init(tv);
+ xt_vm_randr_input_init(dpy);
+
if (debug)
fprintf(stderr,"main: mapping main window ...\n");
XtRealizeWidget(app_shell);
@@ -3435,10 +3422,8 @@ main(int argc, char *argv[])
channel_menu();
xt_handle_pending(dpy);
- do_va_cmd(2,"setfreqtab",(-1 != chantab)
- ? chanlist_names[chantab].str : "europe-west");
- cur_capture = 0;
- do_va_cmd(2,"capture","overlay");
+ init_overlay();
+
set_property(0,NULL,NULL);
if (optind+1 == argc) {
do_va_cmd(2,"setstation",argv[optind]);
@@ -3473,9 +3458,6 @@ main(int argc, char *argv[])
XtAppAddWorkProc(app_context,MyResize,NULL);
}
- if (debug)
- fprintf(stderr,"main: enter main event loop... \n");
- signal(SIGHUP,SIG_IGN); /* don't really need a tty ... */
- XtAppMainLoop(app_context);
+ xt_main_loop();
return 0;
}
diff --git a/x11/mtt.ad b/x11/mtt.ad
index 2bb0620..f528950 100644
--- a/x11/mtt.ad
+++ b/x11/mtt.ad
@@ -6,8 +6,15 @@ mtt.deleteResponse: DO_NOTHING
*renderTable:
*renderTable.fontType: FONT_IS_FONTSET
*renderTable.fontName: \
- -*-helvetica-medium-r-normal--*-120-*-*-*-*, \
- -*-*-*-r-normal--*-120-*-*-*-*
+ -adobe-helvetica-medium-r-normal-*-14-*-*-*-p-*-iso8859-*, \
+ -cronyx-helvetica-medium-r-normal-*-14-*-*-*-p-*-koi8-r, \
+ -*-lucida-medium-r-normal-*-14-*-*-*-p-*-iso8859-*, \
+ -gnu-unifont-medium-r-normal--16-*-*-*-p-*-*-*, \
+ -efont-biwidth-medium-r-normal--16-*-*-*-*-*-*-*, \
+ -*-*-medium-r-normal-*-14-*-*-*-p-*-*-*, \
+ -*-*-medium-r-normal-*-16-*-*-*-p-*-*-*, \
+ -*-*-*-*-*-*-14-*-*-*-*-*-*-*, \
+ -*-*-*-*-*-*-16-*-*-*-*-*-*-*,*
! arrange widgets
mtt.form.*.leftAttachment: ATTACH_FORM
@@ -29,6 +36,10 @@ mtt*bar.go.labelString: Go to
mtt*bar.go.mnemonic: G
mtt*bar.subpage.labelString: Subpage
mtt*bar.subpage.mnemonic: S
+mtt*bar.station.labelString: Stations
+mtt*bar.station.mnemonic: t
+mtt*bar.font.labelString: Fonts
+mtt*bar.font.mnemonic: o
! toolbar
mtt*tool.orientation: HORIZONTAL
diff --git a/x11/mtt.c b/x11/mtt.c
index a066e85..eb4a622 100644
--- a/x11/mtt.c
+++ b/x11/mtt.c
@@ -41,6 +41,11 @@
#include "vbi-gui.h"
#include "vbi-tty.h"
+#include "grab-ng.h"
+#include "channel.h"
+#include "frequencies.h"
+#include "commands.h"
+
/* --------------------------------------------------------------------- */
XtAppContext app_context;
@@ -200,14 +205,6 @@ main(int argc, char **argv)
memcpy(av,argv,sizeof(char*)*(argc+1));
XtSetLanguageProc(NULL,NULL,NULL);
-#if 0
- app_shell = XtVaAppInitialize(&app_context, "mtt",
- opt_desc, opt_count,
- &argc, argv,
- fallback_ressources,
- NULL);
- dpy = XtDisplay(app_shell);
-#else
XtToolkitInitialize();
app_context = XtCreateApplicationContext();
XtAppSetFallbackResources(app_context,fallback_ressources);
@@ -219,7 +216,6 @@ main(int argc, char **argv)
main_tty(ac,av);
app_shell = XtVaAppCreateShell(NULL,"mtt",
applicationShellWidgetClass,dpy,NULL);
-#endif
XtAppAddActions(app_context,actionTable,
sizeof(actionTable)/sizeof(XtActionsRec));
x11_icons_init(dpy,0);
@@ -234,6 +230,12 @@ main(int argc, char **argv)
if (args.tty)
main_tty(ac,av);
+ freq_init();
+ read_config(NULL, &argc, argv);
+ parse_config();
+ do_va_cmd(2,"setfreqtab",(-1 != chantab)
+ ? chanlist_names[chantab].str : "europe-west");
+
vbi = vbi_open(args.device,args.debug,args.sim);
if (NULL == vbi)
exit(1);
diff --git a/x11/vbi-gui.c b/x11/vbi-gui.c
index 1aed9d6..e0752b2 100644
--- a/x11/vbi-gui.c
+++ b/x11/vbi-gui.c
@@ -17,6 +17,7 @@
#include <langinfo.h>
#include <sys/types.h>
#include <sys/time.h>
+#include <sys/ioctl.h>
#include <X11/Xlib.h>
#include <X11/Xatom.h>
@@ -43,7 +44,9 @@
#include "vbi-x11.h"
#include "vbi-gui.h"
-static int tt_debug = 0;
+#include "channel.h"
+
+static int tt_debug = 1;
static int tt_windows = 0;
struct vbi_selection {
@@ -273,10 +276,8 @@ vbi_destroy_cb(Widget widget, XtPointer clientdata, XtPointer call_data)
{
struct vbi_window *vw = clientdata;
- vbi_event_handler_remove(vw->vbi->dec,vbi_newdata);
- XFreeFont(XtDisplay(widget),vw->font1);
- if (vw->font2)
- XFreeFont(XtDisplay(widget),vw->font2);
+ vbi_event_handler_unregister(vw->vbi->dec,vbi_newdata,vw);
+ vbi_render_free_font(widget,vw);
XFreeGC(XtDisplay(widget),vw->gc);
free(vw);
tt_windows--;
@@ -304,6 +305,16 @@ vbi_new_cb(Widget widget, XtPointer clientdata, XtPointer call_data)
}
static void
+vbi_font_cb(Widget widget, XtPointer clientdata, XtPointer call_data)
+{
+ struct vbi_window *vw = clientdata;
+ char *name = XtName(widget);
+ vbi_render_set_font(widget, vw, name);
+ XtVaSetValues(vw->tt, XmNwidth,vw->w*41, XmNheight,vw->h*25, NULL);
+ XClearWindow(XtDisplay(vw->tt),XtWindow(vw->tt));
+}
+
+static void
vbi_goto_cb(Widget widget, XtPointer clientdata, XtPointer call_data)
{
struct vbi_window *vw = clientdata;
@@ -343,19 +354,30 @@ vbi_findpage(struct vbi_page *pg, int px, int py)
i = 0;
newpage = pg->nav_link[i].pgno;
} else if (px <= 40 && py <= 23) {
- /* look for a 3-digit string ... */
- x = px; newpage = 0;
- while (pg->text[py*41+x].unicode >= '0' &&
- pg->text[py*41+x].unicode <= '9' &&
- x > 0) {
- x--;
- }
- x++;
- while (pg->text[py*41+x].unicode >= '0' &&
- pg->text[py*41+x].unicode <= '9' &&
- x < 40) {
- newpage = newpage*16 + pg->text[py*41+x].unicode - '0';
+ if (pg->text[py*41+px].unicode >= '0' &&
+ pg->text[py*41+px].unicode <= '9') {
+ /* look for a 3-digit string ... */
+ x = px; newpage = 0;
+ while (pg->text[py*41+x].unicode >= '0' &&
+ pg->text[py*41+x].unicode <= '9' &&
+ x > 0) {
+ x--;
+ }
x++;
+ while (pg->text[py*41+x].unicode >= '0' &&
+ pg->text[py*41+x].unicode <= '9' &&
+ x < 40) {
+ newpage = newpage*16 + pg->text[py*41+x].unicode - '0';
+ x++;
+ }
+
+ } else if (pg->text[py*41+px].unicode == '>') {
+ /* next page */
+ newpage = vbi_calc_page(pg->pgno,+1);
+
+ } else if (pg->text[py*41+px].unicode == '<') {
+ /* prev page */
+ newpage = vbi_calc_page(pg->pgno,-1);
}
}
@@ -869,12 +891,156 @@ selection_dnd_start(struct vbi_window *vw, XEvent *event)
/* --------------------------------------------------------------------- */
+static void vbi_station_cb(Widget widget, XtPointer client, XtPointer call)
+{
+ struct vbi_state *vbi = client;
+ char *name = XtName(widget);
+ int i;
+
+ for (i = 0; i < count; i++)
+ if (0 == strcmp(channels[i]->name,name))
+ break;
+ if (i == count)
+ return;
+#if 0
+ fprintf(stderr,"tune: %.3f MHz [channel %s, station %s]\n",
+ channels[i]->freq / 16.0,
+ channels[i]->cname,
+ channels[i]->name);
+#endif
+
+#ifdef linux
+#include "videodev.h"
+ if (-1 == ioctl(vbi->fd,VIDIOCSFREQ,&channels[i]->freq))
+ perror("ioctl VIDIOCSFREQ");
+#endif
+ /* FIXME: should add some BSD code once libzvbi is ported ... */
+}
+
+static void vbi_station_menu(Widget menubar, struct vbi_state *vbi)
+{
+ struct {
+ char *name;
+ Widget menu;
+ } *sub = NULL;
+ int subs = 0;
+
+ Widget m,menu,push;
+ XmString label;
+ int i,j;
+
+ if (0 == count)
+ return;
+
+ menu = XmCreatePulldownMenu(menubar,"stationM",NULL,0);
+ XtVaCreateManagedWidget("station",xmCascadeButtonWidgetClass,menubar,
+ XmNsubMenuId,menu,NULL);
+
+ for (i = 0; i < count; i++) {
+#if 0
+ if (channels[i]->key) {
+ if (2 == sscanf(channels[i]->key,
+ "%15[A-Za-z0-9_]+%31[A-Za-z0-9_]",
+ ctrl,key)) {
+ sprintf(accel,"%s<Key>%s",ctrl,key);
+ } else {
+ sprintf(accel,"<Key>%s",channels[i]->key);
+ }
+ } else {
+ accel[0] = 0;
+ }
+#endif
+
+ m = menu;
+ if (0 != strcmp(channels[i]->group,"main")) {
+ for (j = 0; j < subs; j++)
+ if (0 == strcmp(channels[i]->group,sub[j].name))
+ break;
+ if (j == subs) {
+ subs++;
+ sub = realloc(sub, subs * sizeof(*sub));
+ sub[j].name = channels[i]->group;
+ sub[j].menu = XmCreatePulldownMenu(menu,
+ channels[i]->group,
+ NULL,0);
+ XtVaCreateManagedWidget(channels[i]->group,
+ xmCascadeButtonWidgetClass, menu,
+ XmNsubMenuId, sub[j].menu,
+ NULL);
+ }
+ m = sub[j].menu;
+ }
+
+ label = XmStringGenerate(channels[i]->name, NULL, XmMULTIBYTE_TEXT, NULL);
+ push = XtVaCreateManagedWidget(channels[i]->name,
+ xmPushButtonWidgetClass,m,
+ XmNlabelString,label,
+ NULL);
+ XtAddCallback(push,XmNactivateCallback,vbi_station_cb,vbi);
+ XmStringFree(label);
+ }
+}
+
+static int fntcmp(const void *a, const void *b)
+{
+ char const * const *aa = a;
+ char const * const *bb = b;
+
+ return strcmp(*aa,*bb);
+}
+
+static void vbi_xft_font_menu(Widget menu, struct vbi_window *vw)
+{
+#ifdef HAVE_XFT
+ FcPattern *pattern;
+ FcObjectSet *oset;
+ FcFontSet *fset;
+ Widget push;
+ XmString label;
+ char **fonts, *h;
+ int i;
+
+ pattern = FcNameParse(":style=Regular:spacing=100:slant=0:weight=100");
+ oset = FcObjectSetBuild(FC_FAMILY, FC_STYLE, FC_SPACING, FC_SLANT,
+ FC_WEIGHT, NULL);
+ fset = FcFontList(NULL, pattern, oset);
+ FcPatternDestroy(pattern);
+ if (fset) {
+ XtVaCreateManagedWidget("sep",xmSeparatorWidgetClass,menu,NULL);
+ fonts = malloc(sizeof(char*) * fset->nfont);
+ for (i = 0; i < fset->nfont; i++)
+ fonts[i] = FcNameUnparse (fset->fonts[i]);
+ qsort(fonts,fset->nfont,sizeof(char*),fntcmp);
+
+ for (i = 0; i < fset->nfont; i++) {
+ push = XtVaCreateManagedWidget(fonts[i],xmPushButtonWidgetClass,menu,NULL);
+ h = strchr(fonts[i],':');
+ if (h)
+ *h = 0;
+ label = XmStringGenerate(fonts[i], NULL, XmMULTIBYTE_TEXT, NULL);
+ XtVaSetValues(push, XmNlabelString, label, NULL);
+ XmStringFree(label);
+
+ XtAddCallback(push, XmNactivateCallback, vbi_font_cb, vw);
+ }
+
+ for (i = 0; i < fset->nfont; i++)
+ free(fonts[i]);
+ free(fonts);
+ }
+#endif
+}
+
+/* --------------------------------------------------------------------- */
+
void vbi_create_widgets(Widget shell, struct vbi_state *vbi)
{
Widget form,menubar,tool,menu,push,tt;
struct vbi_window *vw;
+ int i;
/* form container */
+ XtVaSetValues(shell, XmNallowShellResize, True, NULL);
form = XtVaCreateManagedWidget("form", xmFormWidgetClass, shell,
NULL);
@@ -894,7 +1060,7 @@ void vbi_create_widgets(Widget shell, struct vbi_state *vbi)
XtAddCallback(tt,XmNexposeCallback,vbi_expose_cb,vw);
XtAddCallback(tt,XmNdestroyCallback,vbi_destroy_cb,vw);
XtAddCallback(tt,XmNconvertCallback,selection_convert_cb,vw);
- vbi_event_handler_add(vw->vbi->dec,~0,vbi_newdata,vw);
+ vbi_event_handler_register(vw->vbi->dec,~0,vbi_newdata,vw);
/* menu -- file */
menu = XmCreatePulldownMenu(menubar,"fileM",NULL,0);
@@ -932,6 +1098,20 @@ void vbi_create_widgets(Widget shell, struct vbi_state *vbi)
menubar,
XmNsubMenuId,vw->submenu,NULL);
+ /* menu -- stations */
+ vbi_station_menu(menubar,vbi);
+
+ /* menu -- fonts */
+ menu = XmCreatePulldownMenu(menubar,"fontM",NULL,0);
+ XtVaCreateManagedWidget("font",xmCascadeButtonWidgetClass,menubar,
+ XmNsubMenuId,menu,NULL);
+ for (i = 0; vbi_fonts[i].label != NULL; i++) {
+ push = XtVaCreateManagedWidget(vbi_fonts[i].label,
+ xmPushButtonWidgetClass,menu,NULL);
+ XtAddCallback(push,XmNactivateCallback,vbi_font_cb,vw);
+ }
+ vbi_xft_font_menu(menu,vw);
+
/* toolbar */
push = XtVaCreateManagedWidget("100",xmPushButtonWidgetClass,tool,NULL);
XtAddCallback(push,XmNactivateCallback,vbi_goto_cb,vw);
diff --git a/x11/vbi-x11.c b/x11/vbi-x11.c
index 819cc92..eaa5fa0 100644
--- a/x11/vbi-x11.c
+++ b/x11/vbi-x11.c
@@ -33,16 +33,21 @@
/* --------------------------------------------------------------------- */
-static struct {
- char *f1,*f2;
-} vbi_try_fonts[] = {
+struct vbi_font vbi_fonts[] = {
{
- f1: "-*-teletext-medium-r-normal--20-*-*-*-*-*-iso10646-1",
- f2: "-*-teletext-medium-r-normal--40-*-*-*-*-*-iso10646-1",
+ .label = "Teletext 20",
+ .xlfd1 = "-*-teletext-medium-r-normal--20-*-*-*-*-*-iso10646-1",
+ .xlfd2 = "-*-teletext-medium-r-normal--40-*-*-*-*-*-iso10646-1",
},{
- f1: "-*-fixed-medium-r-normal--18-*-*-*-*-*-iso10646-1",
+ .label = "Teletext 10",
+ .xlfd1 = "-*-teletext-medium-r-normal--10-*-*-*-*-*-iso10646-1",
+ .xlfd2 = "-*-teletext-medium-r-normal--20-*-*-*-*-*-iso10646-1",
},{
- f1: "fixed",
+ .label = "Fixed 18",
+ .xlfd1 = "-*-fixed-medium-r-normal--18-*-*-*-*-*-iso10646-1",
+ },{
+ .label = "Fixed 13",
+ .xlfd1 = "-misc-fixed-medium-r-semicondensed--13-*-*-*-*-*-iso10646-1",
},{
/* end of list */
}
@@ -51,11 +56,92 @@ static struct {
/* --------------------------------------------------------------------- */
/* render teletext pages */
+static int vbi_render_try_font(Widget shell, struct vbi_window *vw,
+ struct vbi_font *fnt)
+{
+ if (NULL == vw->xft_font && NULL != fnt->xlfd1) {
+ vw->font1 = XLoadQueryFont(XtDisplay(shell), fnt->xlfd1);
+ if (NULL != fnt->xlfd2)
+ vw->font2 = XLoadQueryFont(XtDisplay(shell), fnt->xlfd2);
+ if (NULL != vw->font1) {
+ vw->a = vw->font1->max_bounds.ascent;
+ vw->d = vw->font1->max_bounds.descent;
+ vw->w = vw->font1->max_bounds.width;
+ vw->h = vw->a + vw->d;
+ return 0;
+ }
+ }
+ return 1;
+}
+
+void vbi_render_free_font(Widget shell, struct vbi_window *vw)
+{
+#ifdef HAVE_XFT
+ if (NULL != vw->xft_font) {
+ XftFontClose(XtDisplay(shell),vw->xft_font);
+ vw->xft_font = NULL;
+ }
+#endif
+ if (NULL != vw->font1) {
+ XFreeFont(XtDisplay(shell),vw->font1);
+ vw->font1 = NULL;
+ }
+ if (NULL != vw->font2) {
+ XFreeFont(XtDisplay(shell),vw->font2);
+ vw->font2 = NULL;
+ }
+}
+
+void vbi_render_set_font(Widget shell, struct vbi_window *vw, char *label)
+{
+#ifdef HAVE_XFT
+ FcPattern *pattern;
+ FcResult rc;
+#endif
+ int i;
+
+ /* free old stuff */
+ vbi_render_free_font(shell,vw);
+
+ if (NULL != label) {
+ /* try core font */
+ for (i = 0; vbi_fonts[i].label != NULL; i++) {
+ if (0 != strcasecmp(label,vbi_fonts[i].label))
+ continue;
+ if (0 == vbi_render_try_font(shell, vw, &vbi_fonts[i]))
+ return;
+ }
+
+#ifdef HAVE_XFT
+ /* try xft */
+ pattern = FcNameParse(label);
+ pattern = XftFontMatch(XtDisplay(shell),
+ XScreenNumberOfScreen(XtScreen(shell)),
+ pattern,&rc);
+ vw->xft_font = XftFontOpenPattern(XtDisplay(shell), pattern);
+ if (vw->xft_font) {
+ vw->a = vw->xft_font->ascent;
+ vw->d = vw->xft_font->descent;
+ vw->w = vw->xft_font->max_advance_width;
+ vw->h = vw->xft_font->height;
+ return;
+ }
+#endif
+ }
+
+ /* walk through the whole list as fallback */
+ for (i = 0; vbi_fonts[i].label != NULL; i++) {
+ if (0 == vbi_render_try_font(shell, vw, &vbi_fonts[i]))
+ return;
+ }
+ fprintf(stderr,"Oops: can't load any font\n");
+ exit(1);
+}
+
struct vbi_window*
vbi_render_init(Widget shell, Widget tt, struct vbi_state *vbi)
{
struct vbi_window *vw;
- Colormap cmap;
XColor color,dummy;
int i;
@@ -68,28 +154,19 @@ vbi_render_init(Widget shell, Widget tt, struct vbi_state *vbi)
vw->gc = XCreateGC(XtDisplay(shell),
RootWindowOfScreen(XtScreen(shell)),
0, NULL);
-
- for (i = 0; NULL == vw->font1 && NULL != vbi_try_fonts[i].f1; i++) {
- vw->font1 = XLoadQueryFont(XtDisplay(shell),vbi_try_fonts[i].f1);
- if (NULL == vbi_try_fonts[i].f2)
- continue;
- vw->font2 = XLoadQueryFont(XtDisplay(shell),vbi_try_fonts[i].f2);
- }
- if (NULL == vw->font1) {
- fprintf(stderr,"can't load font\n");
- exit(1);
- }
- vw->a = vw->font1->max_bounds.ascent;
- vw->d = vw->font1->max_bounds.descent;
- vw->w = vw->font1->max_bounds.width;
- vw->h = vw->a + vw->d;
- XtVaGetValues(tt, XtNcolormap, &cmap, NULL);
+ XtVaGetValues(tt, XtNcolormap, &vw->cmap, NULL);
for (i = 0; i < 8; i++) {
- XAllocNamedColor(XtDisplay(shell), cmap, vbi_colors[i],
+#ifdef HAVE_XFT
+ XftColorAllocName(XtDisplay(shell),
+ DefaultVisualOfScreen(XtScreen(shell)),
+ vw->cmap, vbi_colors[i], &vw->xft_color[i]);
+#endif
+ XAllocNamedColor(XtDisplay(shell), vw->cmap, vbi_colors[i],
&color, &dummy);
vw->colors[i] = color.pixel;
}
+ vbi_render_set_font(shell,vw,NULL);
INIT_LIST_HEAD(&vw->selections);
return vw;
@@ -100,9 +177,12 @@ vbi_render_line(struct vbi_window *vw, Drawable d, struct vbi_char *ch,
int y, int top, int left, int right)
{
XGCValues values;
- XChar2b line[40];
- XTextItem16 ti;
+ XChar2b line[42];
int x1,x2,i,code,sy;
+#ifdef HAVE_XFT
+ FcChar32 wline[42];
+ XftDraw *xft_draw = NULL;
+#endif
for (x1 = left; x1 < right; x1 = x2) {
for (x2 = x1; x2 < right; x2++) {
@@ -134,24 +214,42 @@ vbi_render_line(struct vbi_window *vw, Drawable d, struct vbi_char *ch,
code = ' ';
line[i-x1].byte1 = (code >> 8) & 0xff;
line[i-x1].byte2 = code & 0xff;
+#ifdef HAVE_XFT
+ wline[i-x1] = code;
+#endif
}
- ti.chars = line;
- ti.nchars = x2-x1;
- ti.delta = 0;
- ti.font = (1 == sy) ? vw->font1->fid : vw->font2->fid;
-
+
values.function = GXcopy;
values.foreground = vw->colors[ch[x1].background & 7];
XChangeGC(XtDisplay(vw->tt), vw->gc, GCForeground|GCFunction, &values);
XFillRectangle(XtDisplay(vw->tt), d,
vw->gc, (x1-left)*vw->w, (y-top)*vw->h,
vw->w * (x2-x1), vw->h * sy);
-
- values.foreground = vw->colors[ch[x1].foreground & 7];
- XChangeGC(XtDisplay(vw->tt), vw->gc, GCForeground, &values);
- XDrawText16(XtDisplay(vw->tt), d, vw->gc,
- (x1-left)*vw->w, vw->a + (y-top+sy-1)*vw->h, &ti,1);
+
+ if (vw->xft_font) {
+#ifdef HAVE_XFT
+ if (NULL == xft_draw)
+ xft_draw = XftDrawCreate(XtDisplay(vw->tt), d,
+ DefaultVisualOfScreen(XtScreen(vw->tt)),
+ vw->cmap);
+ XftDrawString32(xft_draw, &vw->xft_color[ch[x1].foreground & 7],
+ vw->xft_font,
+ (x1-left)*vw->w, vw->a + (y-top+sy-1)*vw->h,
+ wline, x2-x1);
+#endif
+ } else {
+ values.foreground = vw->colors[ch[x1].foreground & 7];
+ values.font = (1 == sy) ? vw->font1->fid : vw->font2->fid;
+ XChangeGC(XtDisplay(vw->tt), vw->gc, GCForeground|GCFont, &values);
+ XDrawString16(XtDisplay(vw->tt), d, vw->gc,
+ (x1-left)*vw->w, vw->a + (y-top+sy-1)*vw->h,
+ line, x2-x1);
+ }
}
+#ifdef HAVE_XFT
+ if (NULL != xft_draw)
+ XftDrawDestroy(xft_draw);
+#endif
}
Pixmap
diff --git a/x11/vbi-x11.h b/x11/vbi-x11.h
index 6748542..b231dfa 100644
--- a/x11/vbi-x11.h
+++ b/x11/vbi-x11.h
@@ -2,16 +2,36 @@
#define _VBI_X11_H 1
#ifdef HAVE_ZVBI
+
+#ifdef HAVE_XFT
+# define _XFT_NO_COMPAT_ 1
+# include <X11/Xft/Xft.h>
+#endif
+
#include "list.h"
+struct vbi_font {
+ char *label;
+ char *xlfd1;
+ char *xlfd2;
+};
+
struct vbi_window {
Widget shell,tt,subbtn,submenu;
Widget savebox;
+ Colormap cmap;
GC gc;
XFontStruct *font1,*font2;
int w,a,d,h;
unsigned long colors[8];
+#ifdef HAVE_XFT
+ XftFont *xft_font;
+ XftColor xft_color[8];
+#else
+ void *xft_font;
+#endif
+
struct vbi_state *vbi;
struct vbi_page pg;
int pgno,subno;
@@ -24,8 +44,12 @@ struct vbi_window {
struct list_head selections;
};
+extern struct vbi_font vbi_fonts[];
+
struct vbi_window* vbi_render_init(Widget shell, Widget tt,
struct vbi_state *vbi);
+void vbi_render_free_font(Widget shell, struct vbi_window *vw);
+void vbi_render_set_font(Widget shell, struct vbi_window *vw, char *label);
void vbi_render_line(struct vbi_window *vw, Drawable d, struct vbi_char *ch,
int y, int top, int left, int right);
Pixmap vbi_export_pixmap(struct vbi_window *vw,
diff --git a/x11/x11.c b/x11/x11.c
index 39ece9e..cff899e 100644
--- a/x11/x11.c
+++ b/x11/x11.c
@@ -208,8 +208,10 @@ video_gd_start(void)
fprintf(stderr,"gd: start [%d]\n",h->best.fmtid);
if (0 == h->best.fmtid)
return;
- ng_grabber_setformat(&h->best,0);
+ if (0 != ng_grabber_setformat(&h->best,0))
+ return;
drv->startvideo(h_drv,-1,2);
+// drv->startvideo(h_drv,-1,4);
h->work_id = XtAppAddWorkProc(app_context, video_gd_idle, h);
}
@@ -333,7 +335,7 @@ static XtWorkProcId conf_id;
/* ------------------------------------------------------------------------ */
-static char *events[] = {
+char *event_names[] = {
"0", "1",
"KeyPress",
"KeyRelease",
@@ -369,6 +371,7 @@ static char *events[] = {
"ClientMessage",
"MappingNotify"
};
+const int nevent_names = sizeof(event_names)/sizeof(event_names[0]);
/* ------------------------------------------------------------------------ */
@@ -602,7 +605,7 @@ video_event(Widget widget, XtPointer client_data, XEvent *event, Boolean *d)
default:
if (debug > 1)
fprintf(stderr,"video: shell: %s\n",
- events[event->type]);
+ event_names[event->type]);
}
return;
@@ -653,7 +656,7 @@ video_event(Widget widget, XtPointer client_data, XEvent *event, Boolean *d)
if (event->xvisibility.window != XtWindow(video)) {
if (debug > 1)
fprintf(stderr,"video: root: %s%s\n",
- events[event->type],did_refresh?" (ignored)":"");
+ event_names[event->type],did_refresh?" (ignored)":"");
if (!did_refresh)
configure_overlay();
}
@@ -661,7 +664,7 @@ video_event(Widget widget, XtPointer client_data, XEvent *event, Boolean *d)
default:
if (debug > 1)
fprintf(stderr,"video: tv(+root): %s\n",
- events[event->type]);
+ event_names[event->type]);
break;
}
}
diff --git a/x11/x11.h b/x11/x11.h
index 8d3b0c4..eb3394f 100644
--- a/x11/x11.h
+++ b/x11/x11.h
@@ -1,4 +1,6 @@
extern unsigned int swidth,sheight;
+extern char *event_names[];
+extern const int nevent_names;
void x11_label_pixmap(Display *dpy, Colormap colormap, Pixmap pixmap,
int height, char *label);
diff --git a/x11/xawtv.c b/x11/xawtv.c
index 052d3ef..bccf713 100644
--- a/x11/xawtv.c
+++ b/x11/xawtv.c
@@ -43,21 +43,6 @@
#include <X11/Xaw/Dialog.h>
#include <X11/Xaw/AsciiText.h>
#include <X11/extensions/XShm.h>
-#ifdef HAVE_LIBXXF86DGA
-# include <X11/extensions/xf86dga.h>
-# include <X11/extensions/xf86dgastr.h>
-#endif
-#ifdef HAVE_LIBXXF86VM
-# include <X11/extensions/xf86vmode.h>
-# include <X11/extensions/xf86vmstr.h>
-#endif
-#ifdef HAVE_LIBXINERAMA
-# include <X11/extensions/Xinerama.h>
-#endif
-#ifdef HAVE_LIBXV
-# include <X11/extensions/Xv.h>
-# include <X11/extensions/Xvlib.h>
-#endif
#include "grab-ng.h"
#include "writefile.h"
@@ -1272,7 +1257,7 @@ static void
exec_record(Widget widget, XtPointer client_data, XtPointer calldata)
{
if (!(f_drv & CAN_CAPTURE)) {
- fprintf(stderr,"grabbing: not supported\n");
+ fprintf(stderr,"grabbing: not supported [try -noxv switch?]\n");
return;
}
@@ -1634,13 +1619,13 @@ main(int argc, char *argv[])
/* x11 stuff */
XtAppAddActions(app_context,actionTable,
sizeof(actionTable)/sizeof(XtActionsRec));
- x11_misc_init();
+ x11_misc_init(dpy);
if (debug)
fprintf(stderr,"main: dga extention...\n");
- xfree_dga_init();
+ xfree_dga_init(dpy);
if (debug)
fprintf(stderr,"main: xinerama extention...\n");
- xfree_xinerama_init();
+ xfree_xinerama_init(dpy);
#ifdef HAVE_LIBXV
if (debug)
fprintf(stderr,"main: xvideo extention [video]...\n");
@@ -1724,30 +1709,8 @@ main(int argc, char *argv[])
init_movie_menus();
create_attr_widgets();
- if (fs_width && fs_height && !args.vidmode) {
- if (debug)
- fprintf(stderr,"fullscreen mode configured (%dx%d), "
- "VidMode extention enabled\n",fs_width,fs_height);
- args.vidmode = 1;
- }
- if (debug)
- fprintf(stderr,"main: checking for vidmode extention ...\n");
- xfree_vm_init();
-
- /* lirc / midi / joystick remote control */
- if (debug)
- fprintf(stderr,"main: checking for lirc ...\n");
- xt_lirc_init();
- if (debug)
- fprintf(stderr,"main: checking for joystick ...\n");
- xt_joystick_init();
- if (debug)
- fprintf(stderr,"main: checking for midi ...\n");
- xt_midi_init(midi);
- if (debug)
- fprintf(stderr,"main: adding kbd hooks ...\n");
- xt_kbd_init(tv);
-
+ xt_vm_randr_input_init(dpy);
+
if (debug)
fprintf(stderr,"main: mapping main window ...\n");
XtRealizeWidget(app_shell);
@@ -1787,10 +1750,8 @@ main(int argc, char *argv[])
channel_menu();
xt_handle_pending(dpy);
- do_va_cmd(2,"setfreqtab",(-1 != chantab)
- ? chanlist_names[chantab].str : "europe-west");
- cur_capture = 0;
- do_va_cmd(2,"capture","overlay");
+ init_overlay();
+
set_property(0,NULL,NULL);
if (optind+1 == argc) {
do_va_cmd(2,"setstation",argv[optind]);
@@ -1833,11 +1794,6 @@ main(int argc, char *argv[])
if (!have_config)
XtCallActionProc(tv,"Help",NULL,NULL,0);
- if (debug)
- fprintf(stderr,"main: enter main event loop... \n");
- signal(SIGHUP,SIG_IGN); /* don't really need a tty ... */
- XtAppMainLoop(app_context);
-
- /* keep compiler happy */
+ xt_main_loop();
return 0;
}
diff --git a/x11/xt.c b/x11/xt.c
index 5aab373..d2cfcda 100644
--- a/x11/xt.c
+++ b/x11/xt.c
@@ -1,7 +1,7 @@
/*
* common X11 stuff (mostly libXt level) moved here from main.c
*
- * (c) 1997-2002 Gerd Knorr <kraxel@bytesex.org>
+ * (c) 1997-2003 Gerd Knorr <kraxel@bytesex.org>
*
*/
@@ -37,31 +37,7 @@
#include <X11/Shell.h>
#include <X11/StringDefs.h>
#include <X11/cursorfont.h>
-# include <X11/extensions/XShm.h>
-#ifdef HAVE_LIBXXF86DGA
-# include <X11/extensions/xf86dga.h>
-# include <X11/extensions/xf86dgastr.h>
-#endif
-#ifdef HAVE_LIBXXF86VM
-# include <X11/extensions/xf86vmode.h>
-# include <X11/extensions/xf86vmstr.h>
-#endif
-#ifdef HAVE_LIBXINERAMA
-# include <X11/extensions/Xinerama.h>
-#endif
-#ifdef HAVE_LIBXV
-# include <X11/extensions/Xv.h>
-# include <X11/extensions/Xvlib.h>
-#endif
-#ifdef HAVE_LIBXDPMS
-# include <X11/extensions/dpms.h>
-/* XFree 3.3.x has'nt prototypes for this ... */
-Bool DPMSQueryExtension(Display*, int*, int*);
-Bool DPMSCapable(Display*);
-Status DPMSInfo(Display*, CARD16*, BOOL*);
-Status DPMSEnable(Display*);
-Status DPMSDisable(Display*);
-#endif
+#include <X11/extensions/XShm.h>
#include "grab-ng.h"
#include "commands.h"
@@ -96,8 +72,9 @@ int stay_on_top = 0;
XVisualInfo vinfo;
Colormap colormap;
-int have_dga = 0;
-int have_vm = 0;
+int have_dga = 0;
+int have_vm = 0;
+int have_randr = 0;
int fs = 0;
void *movie_state;
@@ -107,17 +84,19 @@ XtIntervalId zap_timer,scan_timer;
#ifdef HAVE_LIBXXF86VM
int vm_count;
-static int vm_switched;
XF86VidModeModeInfo **vm_modelines;
XF86VidModeModeLine vm_line;
int vm_dot;
-XF86VidModeModeInfo *vm_current;
-XF86VidModeModeInfo *vm_fullscreen;
#endif
#ifdef HAVE_LIBXINERAMA
XineramaScreenInfo *xinerama;
int nxinerama;
#endif
+#ifdef HAVE_LIBXRANDR
+XRRScreenSize *randr;
+int nrandr;
+int randr_evbase;
+#endif
static Widget on_label;
static XtIntervalId title_timer, on_timer;
@@ -250,6 +229,11 @@ XtResource args_desc[] = {
XtOffset(struct ARGS*,dga),
XtRString, "1"
},{
+ "randr",
+ XtCBoolean, XtRBoolean, sizeof(int),
+ XtOffset(struct ARGS*,randr),
+ XtRString, "1"
+ },{
"help",
XtCBoolean, XtRBoolean, sizeof(int),
XtOffset(struct ARGS*,help),
@@ -306,6 +290,8 @@ XrmOptionDescRec opt_desc[] = {
{ "-novm", "vidmode", XrmoptionNoArg, "0" },
{ "-dga", "dga", XrmoptionNoArg, "1" },
{ "-nodga", "dga", XrmoptionNoArg, "0" },
+ { "-randr", "randr", XrmoptionNoArg, "1" },
+ { "-norandr", "randr", XrmoptionNoArg, "0" },
{ "-h", "help", XrmoptionNoArg, "1" },
{ "-help", "help", XrmoptionNoArg, "1" },
@@ -808,63 +794,119 @@ set_vidmode(XF86VidModeModeInfo *mode)
mode->vtotal,
mode->flags);
XF86VidModeSwitchToMode(dpy,XDefaultScreen(dpy),mode);
+ XSync(dpy,False);
}
-#endif
static void
-do_modeswitch(int fs_state, int *vp_width, int *vp_height)
+do_vidmode_modeswitch(int fs_state, int *vp_width, int *vp_height)
{
+ static int vm_switched;
+ static XF86VidModeModeInfo *vm_current;
+ static XF86VidModeModeInfo *vm_fullscreen;
+ int i;
+
if (fs_state) {
/* enter fullscreen mode */
- *vp_width = swidth;
- *vp_height = sheight;
-
-#ifdef HAVE_LIBXXF86VM
- if (have_vm) {
- int i;
- XF86VidModeGetModeLine(dpy,XDefaultScreen(dpy),&vm_dot,&vm_line);
- XF86VidModeGetAllModeLines(dpy,XDefaultScreen(dpy),
- &vm_count,&vm_modelines);
- vm_fullscreen = NULL;
- for (i = 0; i < vm_count; i++) {
- if (fs_width == vm_modelines[i]->hdisplay &&
- fs_height == vm_modelines[i]->vdisplay)
- vm_fullscreen = vm_modelines[i];
- if (vm_line.hdisplay == vm_modelines[i]->hdisplay &&
- vm_line.vdisplay == vm_modelines[i]->vdisplay)
- vm_current = vm_modelines[i];
- }
- if (debug) {
- fprintf(stderr,"vm: current=%dx%d",
- vm_current->hdisplay,vm_current->vdisplay);
- if (vm_fullscreen)
- fprintf(stderr,"fullscreen=%dx%d",
- vm_fullscreen->hdisplay,vm_fullscreen->vdisplay);
- fprintf(stderr,"\n");
- }
- if (vm_current && vm_fullscreen &&
- vm_fullscreen->hdisplay != vm_current->hdisplay &&
- vm_fullscreen->vdisplay != vm_current->vdisplay) {
- set_vidmode(vm_fullscreen);
- vm_switched = 1;
- *vp_width = vm_fullscreen->hdisplay;
- *vp_height = vm_fullscreen->vdisplay;
- } else {
- vm_switched = 0;
- *vp_width = vm_current->hdisplay;
- *vp_height = vm_current->vdisplay;
- }
+ XF86VidModeGetModeLine(dpy,XDefaultScreen(dpy),&vm_dot,&vm_line);
+ XF86VidModeGetAllModeLines(dpy,XDefaultScreen(dpy),
+ &vm_count,&vm_modelines);
+ vm_fullscreen = NULL;
+ for (i = 0; i < vm_count; i++) {
+ if (fs_width == vm_modelines[i]->hdisplay &&
+ fs_height == vm_modelines[i]->vdisplay)
+ vm_fullscreen = vm_modelines[i];
+ if (vm_line.hdisplay == vm_modelines[i]->hdisplay &&
+ vm_line.vdisplay == vm_modelines[i]->vdisplay)
+ vm_current = vm_modelines[i];
+ }
+ if (debug) {
+ fprintf(stderr,"vm: current=%dx%d",
+ vm_current->hdisplay,vm_current->vdisplay);
+ if (vm_fullscreen)
+ fprintf(stderr,"fullscreen=%dx%d",
+ vm_fullscreen->hdisplay,vm_fullscreen->vdisplay);
+ fprintf(stderr,"\n");
+ }
+ if (vm_current && vm_fullscreen &&
+ vm_fullscreen->hdisplay != vm_current->hdisplay &&
+ vm_fullscreen->vdisplay != vm_current->vdisplay) {
+ set_vidmode(vm_fullscreen);
+ vm_switched = 1;
+ *vp_width = vm_fullscreen->hdisplay;
+ *vp_height = vm_fullscreen->vdisplay;
+ } else {
+ vm_switched = 0;
+ *vp_width = vm_current->hdisplay;
+ *vp_height = vm_current->vdisplay;
}
-#endif
} else {
/* leave fullscreen mode */
-#ifdef HAVE_LIBXXF86VM
- if (have_vm && vm_switched) {
+ if (vm_switched) {
set_vidmode(vm_current);
vm_switched = 0;
}
+ }
+}
#endif
+
+#ifdef HAVE_LIBXRANDR
+static void
+do_randr_modeswitch(int fs_state, int *vp_width, int *vp_height)
+{
+ static SizeID normal;
+ Window root = RootWindow(dpy, DefaultScreen(dpy));
+ XRRScreenConfiguration *sc;
+ Rotation rotation;
+ SizeID current, new, i;
+
+ sc = XRRGetScreenInfo(dpy, root);
+ current = XRRConfigCurrentConfiguration(sc, &rotation);
+ new = current;
+ if (fs_state) {
+ /* enter fullscreen mode */
+ normal = current;
+ new = current;
+ for (i = 0; i < nrandr; i++) {
+ if (randr[i].width == fs_width &&
+ randr[i].height == fs_height) {
+ new = i;
+ break;
+ }
+ }
+ } else {
+ /* leave fullscreen mode */
+ new = normal;
}
+
+ if (new != current) {
+ /* switch mode */
+ if (debug)
+ fprintf(stderr, "randr: switch to %dx%d\n",
+ randr[new].width, randr[new].height);
+ XRRSetScreenConfig(dpy, sc, root, new, rotation, CurrentTime);
+ }
+ XRRFreeScreenConfigInfo(sc);
+
+ /* FIXME: change swidth / sheight instead */
+ *vp_width = randr[new].width;
+ *vp_height = randr[new].height;
+}
+#endif
+
+static void
+do_modeswitch(int fs_state, int *vp_width, int *vp_height)
+{
+ *vp_width = swidth;
+ *vp_height = sheight;
+
+#ifdef HAVE_LIBXRANDR
+ if (have_randr)
+ do_randr_modeswitch(fs_state,vp_width,vp_height);
+#endif
+#ifdef HAVE_LIBXXF86VM
+ if (!have_randr && have_vm)
+ do_vidmode_modeswitch(fs_state,vp_width,vp_height);
+#endif
}
/*----------------------------------------------------------------------*/
@@ -931,7 +973,7 @@ do_fullscreen(void)
fs = !fs;
if (debug)
fprintf(stderr,"fullscreen %s via netwm\n", fs ? "on" : "off");
-
+
do_modeswitch(fs,&vp_width,&vp_height);
XSync(dpy,False);
wm_fullscreen(dpy,XtWindow(app_shell),fs);
@@ -986,7 +1028,9 @@ do_fullscreen(void)
warp_pointer = 1;
XWarpPointer(dpy, None, RootWindowOfScreen(XtScreen(tv)),
0, 0, 0, 0, vp_width/2, vp_height/2);
+#ifdef HAVE_LIBXXF86VM
XF86VidModeSetViewPort(dpy,XDefaultScreen(dpy),0,0);
+#endif
}
XtVaGetValues(app_shell,
XtNx, &x,
@@ -1149,6 +1193,7 @@ void tv_expose_event(Widget widget, XtPointer client_data,
event->xexpose.count);
if (0 == event->xexpose.count && CAPTURE_OVERLAY == cur_capture) {
if (f_drv & NEEDS_CHROMAKEY) {
+ Dimension win_width, win_height;
if (debug)
fprintf(stderr,"expose: chromakey [%dx%d]\n",
cur_tv_width, cur_tv_height);
@@ -1163,9 +1208,11 @@ void tv_expose_event(Widget widget, XtPointer client_data,
&values);
}
/* draw background for chroma keying */
+ XtVaGetValues(widget, XtNwidth, &win_width,
+ XtNheight, &win_height, NULL);
XFillRectangle(dpy,XtWindow(widget),gc,
- 0 /* (win_width - x11_fmt.width) >> 1 */,
- 0 /* (win_height - x11_fmt.height) >> 1 */,
+ (win_width - cur_tv_width) >> 1,
+ (win_height - cur_tv_height) >> 1,
cur_tv_width, cur_tv_height);
}
if (have_xv) {
@@ -1200,7 +1247,7 @@ FilterAction(Widget widget, XEvent *event,
/*----------------------------------------------------------------------*/
void
-xfree_dga_init()
+xfree_dga_init(Display *dpy)
{
#ifdef HAVE_LIBXXF86DGA
int flags,foo,bar,ma,mi;
@@ -1223,9 +1270,9 @@ xfree_dga_init()
}
void
-xfree_vm_init()
+xfree_vm_init(Display *dpy)
{
-#ifdef HAVE_LIBXXF86DGA
+#ifdef HAVE_LIBXXF86VM
int foo,bar,i,ma,mi;
if (!do_overlay)
@@ -1254,7 +1301,32 @@ xfree_vm_init()
}
void
-xfree_xinerama_init(void)
+xfree_randr_init(Display *dpy)
+{
+#ifdef HAVE_LIBXRANDR
+ int bar,i;
+
+ if (args.randr) {
+ if (XRRQueryExtension(dpy,&randr_evbase,&bar)) {
+ randr = XRRSizes(dpy,DefaultScreen(dpy),&nrandr);
+ if (nrandr > 0) {
+ have_randr = 1;
+ if (debug) {
+ fprintf(stderr,"xrandr:");
+ for (i = 0; i < nrandr; i++) {
+ fprintf(stderr, " %dx%d",
+ randr[i].width, randr[i].height);
+ }
+ fprintf(stderr,"\n");
+ }
+ }
+ }
+ }
+#endif
+}
+
+void
+xfree_xinerama_init(Display *dpy)
{
#ifdef HAVE_LIBXINERAMA
int foo,bar,i;
@@ -1421,7 +1493,7 @@ x11_check_remote()
return;
}
-void x11_misc_init()
+void x11_misc_init(Display *dpy)
{
fcntl(ConnectionNumber(dpy),F_SETFD,FD_CLOEXEC);
}
@@ -1490,8 +1562,15 @@ usage(void)
" -n -noconf don't read the config file\n"
" -m -nomouse startup with mouse pointer disabled\n"
" -f -fullscreen startup in fullscreen mode\n"
+#ifdef HAVE_LIBXXF86DGA
" -(no)dga enable/disable DGA extention\n"
+#endif
+#ifdef HAVE_LIBXXF86VM
" -(no)vm enable/disable VidMode extention\n"
+#endif
+#ifdef HAVE_LIBXRANDR
+ " -(no)randr enable/disable Xrandr extention\n"
+#endif
#ifdef HAVE_LIBXV
" -(no)xv enable/disable Xvideo extention altogether\n"
" -(no)xv-video enable/disable Xvideo extention (for video only,\n"
@@ -2034,3 +2113,56 @@ int xt_handle_pending(Display *dpy)
fprintf(stderr,"xt: handle_pending: ... done\n");
return 0;
}
+
+/* ---------------------------------------------------------------------- */
+
+int xt_vm_randr_input_init(Display *dpy)
+{
+ /* vidmode / randr */
+ if (debug)
+ fprintf(stderr,"xt: checking for randr extention ...\n");
+ xfree_randr_init(dpy);
+ if (fs_width && fs_height && !args.vidmode && !have_randr) {
+ if (debug)
+ fprintf(stderr,"fullscreen mode configured (%dx%d), "
+ "VidMode extention enabled\n",fs_width,fs_height);
+ args.vidmode = 1;
+ }
+ if (debug)
+ fprintf(stderr,"xt: checking for vidmode extention ...\n");
+ xfree_vm_init(dpy);
+
+ /* input */
+ if (debug)
+ fprintf(stderr,"xt: checking for lirc ...\n");
+ xt_lirc_init();
+ if (debug)
+ fprintf(stderr,"xt: checking for joystick ...\n");
+ xt_joystick_init();
+ if (debug)
+ fprintf(stderr,"xt: checking for midi ...\n");
+ xt_midi_init(midi);
+ if (debug)
+ fprintf(stderr,"xt: adding kbd hooks ...\n");
+ xt_kbd_init(tv);
+
+ return 0;
+}
+
+int xt_main_loop()
+{
+ XEvent event;
+
+ if (debug)
+ fprintf(stderr,"xt: enter main event loop... \n");
+ signal(SIGHUP,SIG_IGN); /* don't really need a tty ... */
+
+ for (;;) {
+ if (XtAppGetExitFlag(app_context))
+ break;
+ XtAppNextEvent(app_context, &event);
+ if (True == XtDispatchEvent(&event))
+ continue;
+ }
+ return 0;
+}
diff --git a/x11/xt.h b/x11/xt.h
index 3492860..efc8cd0 100644
--- a/x11/xt.h
+++ b/x11/xt.h
@@ -1,3 +1,32 @@
+#include <X11/Xlib.h>
+#include <X11/Xmd.h>
+#ifdef HAVE_LIBXXF86DGA
+# include <X11/extensions/xf86dga.h>
+# include <X11/extensions/xf86dgastr.h>
+#endif
+#ifdef HAVE_LIBXXF86VM
+# include <X11/extensions/xf86vmode.h>
+# include <X11/extensions/xf86vmstr.h>
+#endif
+#ifdef HAVE_LIBXINERAMA
+# include <X11/extensions/Xinerama.h>
+#endif
+#ifdef HAVE_LIBXV
+# include <X11/extensions/Xv.h>
+# include <X11/extensions/Xvlib.h>
+#endif
+#ifdef HAVE_LIBXRANDR
+# include <X11/extensions/Xrandr.h>
+#endif
+#ifdef HAVE_LIBXDPMS
+# include <X11/extensions/dpms.h>
+/* XFree 3.3.x has'nt prototypes for this ... */
+Bool DPMSQueryExtension(Display*, int*, int*);
+Bool DPMSCapable(Display*);
+Status DPMSInfo(Display*, CARD16*, BOOL*);
+Status DPMSEnable(Display*);
+Status DPMSDisable(Display*);
+#endif
struct ARGS {
/* char */
@@ -28,6 +57,7 @@ struct ARGS {
int gl;
int vidmode;
int dga;
+ int randr;
int help;
int hwscan;
};
@@ -52,6 +82,7 @@ extern Colormap colormap;
extern int have_dga;
extern int have_vm;
+extern int have_randr;
extern int fs;
extern void *movie_state;
@@ -67,6 +98,10 @@ extern XF86VidModeModeInfo **vm_modelines;
extern XineramaScreenInfo *xinerama;
extern int nxinerama;
#endif
+#ifdef HAVE_LIBXRANDR
+extern XRRScreenSize *randr;
+extern int nrandr;
+#endif
extern char v4l_conf[128];
@@ -135,10 +170,12 @@ void set_property(int freq, char *channel, char *name);
/*----------------------------------------------------------------------*/
-void x11_misc_init(void);
-void xfree_dga_init(void);
-void xfree_xinerama_init(void);
-void xfree_vm_init(void);
+void x11_misc_init(Display *dpy);
+void xfree_dga_init(Display *dpy);
+void xfree_xinerama_init(Display *dpy);
+void xfree_vm_init(Display *dpy);
+void xfree_randr_init(Display *dpy);
+
void grabber_init(void);
void grabber_scan(void);
void x11_check_remote(void);
@@ -183,3 +220,5 @@ extern Pixmap bm_no;
/*----------------------------------------------------------------------*/
int xt_handle_pending(Display *dpy);
+int xt_vm_randr_input_init(Display *dpy);
+int xt_main_loop(void);
diff --git a/xawtv.spec b/xawtv.spec
index 7dad5fa..125a092 100644
--- a/xawtv.spec
+++ b/xawtv.spec
@@ -1,7 +1,7 @@
Name: xawtv
Group: Applications/Multimedia
Autoreqprov: on
-Version: 3.86
+Version: 3.87
Release: 0
License: GPL
Summary: v4l applications

Privacy Policy