diff -Nur tvtime-1.0.2/configure.ac tvtime-1.0.2-custom/configure.ac
--- tvtime-1.0.2/configure.ac 2005-09-14 23:40:44.000000000 +0200
+++ tvtime-1.0.2-custom/configure.ac 2011-05-29 18:44:24.911109352 +0200
@@ -10,12 +10,7 @@
# Check for compilers.
AC_PROG_CC
-AC_CHECK_PROG(found_cc, "$CC", yes, no)
-test "x$found_cc" = "xyes" || exit 1
-
AC_PROG_CXX
-AC_CHECK_PROG(found_cxx, "$CXX", yes, no)
-test "x$found_cxx" = "xyes" || exit 1
# Check for libtool.
AC_PROG_LIBTOOL
@@ -74,18 +69,26 @@
dnl libxml2
dnl ---------------------------------------------
dnl Test for libxml2
-
AC_PATH_PROG(LIBXML2_CONFIG,xml2-config,no)
if test "$LIBXML2_CONFIG" = "no" ; then
AC_MSG_ERROR(libxml2 needed and xml2-config not found)
else
XML2_LIBS="`$LIBXML2_CONFIG --libs`"
XML2_FLAG="`$LIBXML2_CONFIG --cflags`"
- AC_DEFINE(HAVE_LIBXML2,,[LIBXML2 support])
+ AC_DEFINE(HAVE_LIBXML2,,[LIBXML2 support])
fi
AC_SUBST(XML2_LIBS)
AC_SUBST(XML2_FLAG)
+dnl ---------------------------------------------
+dnl libasound2
+dnl ---------------------------------------------
+dnl Test for ALSA
+AM_PATH_ALSA(1.0.9,
+ [ AC_DEFINE(HAVE_ALSA,1,[Define this if you have Alsa (libasound) installed]) ],
+ AC_MSG_RESULT(libasound needed and not found))
+AM_CONDITIONAL(HAVE_ALSA, test x"$no_alsa" != "yes")
+
dnl ---------------------------------------------
dnl check for gtk+-2.0
@@ -99,6 +102,8 @@
dnl check for X11, Xv and XF86VidModeExtension
dnl ---------------------------------------------
AC_PATH_XTRA
+AC_ARG_WITH([xinerama],
+ [AS_HELP_STRING([--without-xinerama], [Disable Xinerama extension support (default: check)])])
if test x"$no_x" != x"yes"; then
dnl check for Xshm
AC_CHECK_LIB([Xext],[XShmCreateImage],
@@ -112,16 +117,18 @@
X11_LIBS="$X11_LIBS -lXv"],,
[$X_PRE_LIBS $X_LIBS -lX11 $X_EXTRA_LIBS -lXext])
- dnl check for Xinerama
- AC_CHECK_LIB([Xinerama],[XineramaQueryScreens],
- [AC_DEFINE([HAVE_XINERAMA],,[Xinerama support])
- X11_LIBS="$X11_LIBS -lXinerama"],,
- [$X_PRE_LIBS $X_LIBS -lX11 $X_EXTRA_LIBS -lXext])
-
- dnl check for XTest
- AC_CHECK_LIB([Xtst],[XTestFakeKeyEvent],
- [AC_DEFINE([HAVE_XTESTEXTENSION],,[XTest support])
- X11_LIBS="$X11_LIBS -lXtst"],,
+ if test "x$with_xinerama" != "xno"; then
+ dnl check for Xinerama
+ AC_CHECK_LIB([Xinerama],[XineramaQueryScreens],
+ [AC_DEFINE([HAVE_XINERAMA],,[Xinerama support])
+ X11_LIBS="$X11_LIBS -lXinerama"],,
+ [$X_PRE_LIBS $X_LIBS -lX11 $X_EXTRA_LIBS -lXext])
+ fi
+
+ dnl check for XSs
+ AC_CHECK_LIB([Xss],[XScreenSaverSuspend],
+ [AC_DEFINE([HAVE_XSSEXTENSION],,[XSs support])
+ X11_LIBS="$X11_LIBS -lXss"],,
[$X_PRE_LIBS $X_LIBS -lX11 $X_EXTRA_LIBS -lXext])
dnl check for Xvidmode
diff -Nur tvtime-1.0.2/docs/html/default.tvtime.xml tvtime-1.0.2-custom/docs/html/default.tvtime.xml
--- tvtime-1.0.2/docs/html/default.tvtime.xml 2005-09-08 06:06:57.000000000 +0200
+++ tvtime-1.0.2-custom/docs/html/default.tvtime.xml 2011-05-29 18:44:24.914442692 +0200
@@ -116,13 +116,15 @@
<option name="VBIDevice" value="/dev/vbi0"/>
<!--
- This sets the mixer device and channel to use. The format is device
- name:channel name. Valid channels are:
+ This sets the mixer device and channel to use. The format for OSS
+ is device name:channel name. Valid OSS channels are:
vol, bass, treble, synth, pcm, speaker, line, mic, cd, mix, pcm2,
rec, igain, ogain, line1, line2, line3, dig1, dig2, dig3, phin,
phout, video, radio, monitor
+ The format for ALSA mixer is device/channel (e.g., "default/Line"
+ or "hw:0/CD")
-->
- <option name="MixerDevice" value="/dev/mixer:line"/>
+ <option name="MixerDevice" value="default/Line"/>
<!--
This option enables 16:9 aspect ratio mode by default on startup.
diff -Nur tvtime-1.0.2/docs/man/en/tvtime.xml.5 tvtime-1.0.2-custom/docs/man/en/tvtime.xml.5
--- tvtime-1.0.2/docs/man/en/tvtime.xml.5 2005-09-08 06:05:35.000000000 +0200
+++ tvtime-1.0.2-custom/docs/man/en/tvtime.xml.5 2011-05-29 18:44:24.914442692 +0200
@@ -234,7 +234,10 @@
.TP
<option name="MixerDevice" value="/dev/mixer:line"/>
This sets the mixer device and channel to use. The format is device
-name:channel name. Valid channels are:
+name:channel name for OSS mixer (e.g., "/dev/mixer:Line") or device/channel
+for ALSA (e.g., "hw:0/CD").
+
+Valid OSS channels are:
.nh
.IR vol ", " bass ", " treble ", " synth ", " pcm ", " speaker ", "
diff -Nur tvtime-1.0.2/plugins/greedyh.asm tvtime-1.0.2-custom/plugins/greedyh.asm
--- tvtime-1.0.2/plugins/greedyh.asm 2005-08-14 18:16:43.000000000 +0200
+++ tvtime-1.0.2-custom/plugins/greedyh.asm 2011-05-29 18:44:24.914442692 +0200
@@ -18,7 +18,7 @@
#include "x86-64_macros.inc"
-void DScalerFilterGreedyH::FUNCT_NAME(TDeinterlaceInfo* pInfo)
+void FUNCT_NAME(TDeinterlaceInfo* pInfo)
{
int64_t i;
bool InfoIsOdd = (pInfo->PictureHistory[0]->Flags & PICTURE_INTERLACED_ODD) ? 1 : 0;
diff -Nur tvtime-1.0.2/plugins/tomsmocomp/TomsMoCompAll2.inc tvtime-1.0.2-custom/plugins/tomsmocomp/TomsMoCompAll2.inc
--- tvtime-1.0.2/plugins/tomsmocomp/TomsMoCompAll2.inc 2004-10-20 17:31:05.000000000 +0200
+++ tvtime-1.0.2-custom/plugins/tomsmocomp/TomsMoCompAll2.inc 2011-05-29 18:44:24.917776032 +0200
@@ -5,9 +5,9 @@
#endif
#ifdef USE_STRANGE_BOB
-#define SEARCH_EFFORT_FUNC(n) DScalerFilterTomsMoComp::SEFUNC(n##_SB)
+#define SEARCH_EFFORT_FUNC(n) SEFUNC(n##_SB)
#else
-#define SEARCH_EFFORT_FUNC(n) DScalerFilterTomsMoComp::SEFUNC(n)
+#define SEARCH_EFFORT_FUNC(n) SEFUNC(n)
#endif
int SEARCH_EFFORT_FUNC(0) // we don't try at all ;-)
diff -Nur tvtime-1.0.2/plugins/tomsmocomp.cpp tvtime-1.0.2-custom/plugins/tomsmocomp.cpp
--- tvtime-1.0.2/plugins/tomsmocomp.cpp 2004-10-20 19:38:04.000000000 +0200
+++ tvtime-1.0.2-custom/plugins/tomsmocomp.cpp 2011-05-29 18:44:24.917776032 +0200
@@ -31,7 +31,7 @@
#define IS_MMX
#define SSE_TYPE MMX
-#define FUNCT_NAME DScalerFilterTomsMoComp::filterDScaler_MMX
+#define FUNCT_NAME filterDScaler_MMX
#include "tomsmocomp/TomsMoCompAll.inc"
#undef IS_MMX
#undef SSE_TYPE
@@ -39,7 +39,7 @@
#define IS_3DNOW
#define SSE_TYPE 3DNOW
-#define FUNCT_NAME DScalerFilterTomsMoComp::filterDScaler_3DNOW
+#define FUNCT_NAME filterDScaler_3DNOW
#include "tomsmocomp/TomsMoCompAll.inc"
#undef IS_3DNOW
#undef SSE_TYPE
@@ -47,7 +47,7 @@
#define IS_SSE
#define SSE_TYPE SSE
-#define FUNCT_NAME DScalerFilterTomsMoComp::filterDScaler_SSE
+#define FUNCT_NAME filterDScaler_SSE
#include "tomsmocomp/TomsMoCompAll.inc"
#undef IS_SSE
#undef SSE_TYPE
diff -Nur tvtime-1.0.2/src/commands.c tvtime-1.0.2-custom/src/commands.c
--- tvtime-1.0.2/src/commands.c 2005-11-10 03:39:05.000000000 +0100
+++ tvtime-1.0.2-custom/src/commands.c 2011-05-29 18:44:24.921109372 +0200
@@ -128,6 +128,7 @@
int togglepulldowndetection;
int togglematte;
int togglequiet;
+ int changedoverscan;
int framerate;
int scan_channels;
int pause;
@@ -2900,7 +2901,7 @@
case TVTIME_OVERSCAN_DOWN:
cmd->overscan = cmd->overscan + ( (tvtime_cmd == TVTIME_OVERSCAN_UP) ? 0.0025 : -0.0025 );
if( cmd->overscan > 0.4 ) cmd->overscan = 0.4; if( cmd->overscan < 0.0 ) cmd->overscan = 0.0;
-
+ cmd->changedoverscan = 1;
if( cmd->osd ) {
char message[ 200 ];
snprintf( message, sizeof( message ), _("Overscan: %.1f%%"),
@@ -3056,10 +3057,10 @@
break;
case TVTIME_MIXER_TOGGLE_MUTE:
- mixer_mute( !mixer_ismute() );
+ mixer->mute( !mixer->ismute() );
if( cmd->osd ) {
- tvtime_osd_show_data_bar( cmd->osd, _("Volume"), (mixer_get_volume()) & 0xff );
+ tvtime_osd_show_data_bar( cmd->osd, _("Volume"), (mixer->get_volume()) & 0xff );
}
break;
@@ -3073,9 +3074,9 @@
/* Check to see if an argument was passed, if so, use it. */
if (atoi(arg) > 0) {
int perc = atoi(arg);
- volume = mixer_set_volume( ( (tvtime_cmd == TVTIME_MIXER_UP) ? perc : -perc ) );
+ volume = mixer->set_volume( ( (tvtime_cmd == TVTIME_MIXER_UP) ? perc : -perc ) );
} else {
- volume = mixer_set_volume( ( (tvtime_cmd == TVTIME_MIXER_UP) ? 1 : -1 ) );
+ volume = mixer->set_volume( ( (tvtime_cmd == TVTIME_MIXER_UP) ? 1 : -1 ) );
}
if( cmd->osd ) {
@@ -3492,6 +3493,7 @@
cmd->togglepulldowndetection = 0;
cmd->togglematte = 0;
cmd->togglequiet = 0;
+ cmd->changedoverscan = 0;
cmd->resizewindow = 0;
cmd->setdeinterlacer = 0;
cmd->setfreqtable = 0;
@@ -3539,6 +3541,11 @@
return cmd->toggleaspect;
}
+int commands_get_changed_overscan( commands_t *cmd )
+{
+ return cmd->changedoverscan;
+}
+
int commands_toggle_alwaysontop( commands_t *cmd )
{
return cmd->togglealwaysontop;
diff -Nur tvtime-1.0.2/src/commands.h tvtime-1.0.2-custom/src/commands.h
--- tvtime-1.0.2/src/commands.h 2004-10-28 02:50:24.000000000 +0200
+++ tvtime-1.0.2-custom/src/commands.h 2011-05-29 18:44:24.934442732 +0200
@@ -64,6 +64,7 @@
int commands_quit( commands_t *cmd );
int commands_toggle_fullscreen( commands_t *cmd );
int commands_toggle_aspect( commands_t *cmd );
+int commands_get_changed_overscan( commands_t *cmd );
int commands_toggle_deinterlacer( commands_t *cmd );
int commands_toggle_pulldown_detection( commands_t *cmd );
int commands_toggle_matte( commands_t *cmd );
diff -Nur tvtime-1.0.2/src/cpu_accel.c tvtime-1.0.2-custom/src/cpu_accel.c
--- tvtime-1.0.2/src/cpu_accel.c 2004-04-04 18:48:37.000000000 +0200
+++ tvtime-1.0.2-custom/src/cpu_accel.c 2011-05-29 18:44:24.944442752 +0200
@@ -35,7 +35,7 @@
int AMD;
uint32_t caps;
-#ifndef PIC
+#if !defined(__PIC__) || defined(__x86_64__)
#define cpuid(op,eax,ebx,ecx,edx) \
__asm__ ("cpuid" \
: "=a" (eax), \
diff -Nur tvtime-1.0.2/src/Makefile.am tvtime-1.0.2-custom/src/Makefile.am
--- tvtime-1.0.2/src/Makefile.am 2005-02-08 06:00:16.000000000 +0100
+++ tvtime-1.0.2-custom/src/Makefile.am 2011-05-29 18:44:24.944442752 +0200
@@ -29,6 +29,11 @@
-DCONFDIR="\"$(pkgsysconfdir)\"" -DFIFODIR="\"$(tmpdir)\"" \
-D_LARGEFILE64_SOURCE -DLOCALEDIR="\"$(localedir)\""
+if HAVE_ALSA
+ALSA_SRCS = mixer-alsa.c
+else
+ALSA_SRCS =
+endif
COMMON_SRCS = mixer.c videoinput.c rtctimer.c leetft.c osdtools.c tvtimeconf.c \
pngoutput.c tvtimeosd.c input.c cpu_accel.c speedy.c pnginput.c \
deinterlace.c videotools.c attributes.h deinterlace.h leetft.h \
@@ -40,7 +45,7 @@
utils.h utils.c pulldown.h pulldown.c hashtable.h hashtable.c \
cpuinfo.h cpuinfo.c videodev.h videodev2.h menu.c menu.h \
outputfilter.h outputfilter.c xmltv.h xmltv.c gettext.h tvtimeglyphs.h \
- copyfunctions.h copyfunctions.c
+ copyfunctions.h copyfunctions.c mixer-oss.c $(ALSA_SRCS)
if ARCH_X86
DSCALER_SRCS = $(top_srcdir)/plugins/dscalerapi.h \
@@ -74,10 +79,10 @@
tvtime_SOURCES = $(COMMON_SRCS) $(OUTPUT_SRCS) $(PLUGIN_SRCS) tvtime.c
tvtime_CFLAGS = $(TTF_CFLAGS) $(PNG_CFLAGS) $(OPT_CFLAGS) \
- $(PLUGIN_CFLAGS) $(X11_CFLAGS) $(XML2_FLAG) \
+ $(PLUGIN_CFLAGS) $(X11_CFLAGS) $(XML2_FLAG) $(ALSA_CFLAGS) \
$(FONT_CFLAGS) $(AM_CFLAGS)
tvtime_LDFLAGS = $(TTF_LIBS) $(ZLIB_LIBS) $(PNG_LIBS) \
- $(X11_LIBS) $(XML2_LIBS) -lm -lstdc++
+ $(X11_LIBS) $(XML2_LIBS) $(ALSA_LIBS) -lm -lsupc++
tvtime_command_SOURCES = utils.h utils.c tvtimeconf.h tvtimeconf.c \
tvtime-command.c
@@ -90,6 +95,6 @@
tvtime_scanner_SOURCES = utils.h utils.c videoinput.h videoinput.c \
tvtimeconf.h tvtimeconf.c station.h station.c tvtime-scanner.c \
mixer.h mixer.c
-tvtime_scanner_CFLAGS = $(OPT_CFLAGS) $(XML2_FLAG) $(AM_CFLAGS)
-tvtime_scanner_LDFLAGS = $(ZLIB_LIBS) $(XML2_LIBS)
+tvtime_scanner_CFLAGS = $(OPT_CFLAGS) $(XML2_FLAG) $(ALSA_CFLAGS) $(AM_CFLAGS)
+tvtime_scanner_LDFLAGS = $(ZLIB_LIBS) $(XML2_LIBS) $(ALSA_LIBS)
diff -Nur tvtime-1.0.2/src/mixer-alsa.c tvtime-1.0.2-custom/src/mixer-alsa.c
--- tvtime-1.0.2/src/mixer-alsa.c 1970-01-01 01:00:00.000000000 +0100
+++ tvtime-1.0.2-custom/src/mixer-alsa.c 2011-05-29 18:44:24.944442752 +0200
@@ -0,0 +1,240 @@
+/**
+ * Copyright (C) 2006 Philipp Hahn <pmhahn@users.sourceforge.net>
+ *
+ * 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, 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <string.h>
+#include <math.h>
+#include <alsa/asoundlib.h>
+#include "utils.h"
+#include "mixer.h"
+
+static const char alsa_core_devnames[] = "default";
+static char *card, *channel;
+static int muted = 0;
+static int mutecount = 0;
+static snd_mixer_t *handle = NULL;
+static snd_mixer_elem_t *elem = NULL;
+
+static long alsa_min, alsa_max, alsa_vol;
+
+static void alsa_open_mixer( void )
+{
+ int err;
+ static snd_mixer_selem_id_t *sid = NULL;
+ if ((err = snd_mixer_open (&handle, 0)) < 0) {
+ fprintf(stderr, "mixer: open error: %s\n", snd_strerror(err));
+ return;
+ }
+ if ((err = snd_mixer_attach (handle, card)) < 0) {
+ fprintf(stderr, "mixer: attach error: %s\n", snd_strerror(err));
+ goto error;
+ }
+ if ((err = snd_mixer_selem_register (handle, NULL, NULL)) < 0) {
+ fprintf(stderr, "mixer: register error: %s\n", snd_strerror(err));
+ goto error;
+ }
+ if ((err = snd_mixer_load (handle)) < 0) {
+ fprintf(stderr, "mixer: load error: %s\n", snd_strerror(err));
+ goto error;
+ }
+ snd_mixer_selem_id_malloc(&sid);
+ if (sid == NULL)
+ goto error;
+ snd_mixer_selem_id_set_name(sid, channel);
+ if (!(elem = snd_mixer_find_selem(handle, sid))) {
+ fprintf(stderr, "mixer: find error: %s\n", snd_strerror(err));
+ goto error;
+ }
+ if (!snd_mixer_selem_has_playback_volume(elem)) {
+ fprintf(stderr, "mixer: no playback\n");
+ goto error;
+ }
+ snd_mixer_selem_get_playback_volume_range(elem, &alsa_min, &alsa_max);
+ if ((alsa_max - alsa_min) <= 0) {
+ fprintf(stderr, "mixer: no valid playback range\n");
+ goto error;
+ }
+ snd_mixer_selem_id_free(sid);
+ return;
+
+error:
+ if (sid)
+ snd_mixer_selem_id_free(sid);
+ if (handle) {
+ snd_mixer_close(handle);
+ handle = NULL;
+ }
+ return;
+}
+
+/* Volume saved to file */
+static int alsa_get_unmute_volume( void )
+{
+ long val;
+ assert (elem);
+
+ if (snd_mixer_selem_is_playback_mono(elem)) {
+ snd_mixer_selem_get_playback_volume(elem, SND_MIXER_SCHN_MONO, &val);
+ return val;
+ } else {
+ int c, n = 0;
+ long sum = 0;
+ for (c = 0; c <= SND_MIXER_SCHN_LAST; c++) {
+ if (snd_mixer_selem_has_playback_channel(elem, c)) {
+ snd_mixer_selem_get_playback_volume(elem, SND_MIXER_SCHN_FRONT_LEFT, &val);
+ sum += val;
+ n++;
+ }
+ }
+ if (! n) {
+ return 0;
+ }
+
+ val = sum / n;
+ sum = (long)((double)(alsa_vol * (alsa_max - alsa_min)) / 100. + 0.5);
+
+ if (sum != val) {
+ alsa_vol = (long)(((val * 100.) / (alsa_max - alsa_min)) + 0.5);
+ }
+ return alsa_vol;
+ }
+}
+
+static int alsa_get_volume( void )
+{
+ if (muted)
+ return 0;
+ else
+ return alsa_get_unmute_volume();
+}
+
+static int alsa_set_volume( int percentdiff )
+{
+ long volume;
+
+ alsa_get_volume();
+
+ alsa_vol += percentdiff;
+ if( alsa_vol > 100 ) alsa_vol = 100;
+ if( alsa_vol < 0 ) alsa_vol = 0;
+
+ volume = (long)((alsa_vol * (alsa_max - alsa_min) / 100.) + 0.5);
+
+ snd_mixer_selem_set_playback_volume_all(elem, volume + alsa_min);
+ snd_mixer_selem_set_playback_switch_all(elem, 1);
+ muted = 0;
+ mutecount = 0;
+
+ return alsa_vol;
+}
+
+static void alsa_mute( int mute )
+{
+ /**
+ * Make sure that if multiple users mute the card,
+ * we only honour the last one.
+ */
+ if( !mute && mutecount ) mutecount--;
+ if( mutecount ) return;
+
+ if( mute ) {
+ mutecount++;
+ muted = 1;
+ if (snd_mixer_selem_has_playback_switch(elem))
+ snd_mixer_selem_set_playback_switch_all(elem, 0);
+ else
+ fprintf(stderr, "mixer: mute not implemented\n");
+ } else {
+ muted = 0;
+ if (snd_mixer_selem_has_playback_switch(elem))
+ snd_mixer_selem_set_playback_switch_all(elem, 1);
+ else
+ fprintf(stderr, "mixer: mute not implemented\n");
+ }
+}
+
+static int alsa_ismute( void )
+{
+ return muted;
+}
+
+static int alsa_set_device( const char *devname )
+{
+ int i;
+
+ if (card) free(card);
+ card = strdup( devname );
+ if( !card ) return -1;
+
+ i = strcspn( card, "/" );
+ if( i == strlen( card ) ) {
+ channel = "Line";
+ } else {
+ card[i] = 0;
+ channel = card + i + 1;
+ }
+ alsa_open_mixer();
+ if (!handle) {
+ fprintf( stderr, "mixer: Can't open mixer %s, "
+ "mixer volume and mute unavailable.\n", card );
+ return -1;
+ }
+ return 0;
+}
+
+static void alsa_set_state( int ismuted, int unmute_volume )
+{
+ /**
+ * 1. we come back unmuted: Don't touch anything
+ * 2. we don't have a saved volume: Don't touch anything
+ * 3. we come back muted and we have a saved volume:
+ * - if tvtime muted it, unmute to old volume
+ * - if user did it, remember that we're muted and old volume
+ */
+ if( alsa_get_volume() == 0 && unmute_volume > 0 ) {
+ snd_mixer_selem_set_playback_volume_all(elem, unmute_volume);
+ muted = 1;
+
+ if( !ismuted ) {
+ alsa_mute( 0 );
+ }
+ }
+}
+
+static void alsa_close_device( void )
+{
+ elem = NULL;
+ if (handle)
+ snd_mixer_close(handle);
+ handle = NULL;
+ muted = 0;
+ mutecount = 0;
+}
+
+struct mixer alsa_mixer = {
+ .set_device = alsa_set_device,
+ .set_state = alsa_set_state,
+ .get_volume = alsa_get_volume,
+ .get_unmute_volume = alsa_get_unmute_volume,
+ .set_volume = alsa_set_volume,
+ .mute = alsa_mute,
+ .ismute = alsa_ismute,
+ .close_device = alsa_close_device,
+};
+// vim: ts=4 sw=4 et foldmethod=marker
diff -Nur tvtime-1.0.2/src/mixer.c tvtime-1.0.2-custom/src/mixer.c
--- tvtime-1.0.2/src/mixer.c 2004-10-29 04:15:23.000000000 +0200
+++ tvtime-1.0.2-custom/src/mixer.c 2011-05-29 18:44:24.944442752 +0200
@@ -19,230 +19,104 @@
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#include <stdio.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <sys/soundcard.h>
-#include <sys/mman.h>
-#include <string.h>
-#include "utils.h"
#include "mixer.h"
-static char *mixer_device = "/dev/mixer";
-static int saved_volume = (50 << 8 & 0xFF00) | (50 & 0x00FF);
-static int mixer_channel = SOUND_MIXER_LINE;
-static int mixer_dev_mask = 1 << SOUND_MIXER_LINE;
-static int muted = 0;
-static int mutecount = 0;
-static int fd = -1;
-
-int mixer_get_volume( void )
-{
- int v, cmd, devs;
- int curvol = 0;
-
- if( fd < 0 ) fd = open( mixer_device, O_RDONLY );
- if( fd != -1 ) {
-
- ioctl( fd, SOUND_MIXER_READ_DEVMASK, &devs );
- if( devs & mixer_dev_mask ) {
- cmd = MIXER_READ( mixer_channel );
- } else {
- return curvol;
- }
-
- ioctl( fd, cmd, &v );
- curvol = ( v & 0xFF00 ) >> 8;
- }
-
- return curvol;
+/**
+ * Sets the mixer device and channel.
+ */
+static int null_set_device( const char *devname )
+{
+ return 0;
}
-int mixer_get_unmute_volume( void )
+/**
+ * Sets the initial state of the mixer device.
+ */
+static void null_set_state( int ismuted, int unmute_volume )
{
- if( muted ) {
- return saved_volume;
- } else {
- int v, cmd, devs;
-
- if( fd < 0 ) fd = open( mixer_device, O_RDONLY );
- if( fd != -1 ) {
-
- ioctl( fd, SOUND_MIXER_READ_DEVMASK, &devs );
- if( devs & mixer_dev_mask ) {
- cmd = MIXER_READ( mixer_channel );
- } else {
- return -1;
- }
-
- ioctl( fd, cmd, &v );
- return v;
- }
- }
-
- return -1;
}
-int mixer_set_volume( int percentdiff )
+/**
+ * Returns the current volume setting.
+ */
+static int null_get_volume( void )
{
- int v, cmd, devs, levelpercentage;
-
- levelpercentage = mixer_get_volume();
-
- levelpercentage += percentdiff;
- if( levelpercentage > 100 ) levelpercentage = 100;
- if( levelpercentage < 0 ) levelpercentage = 0;
-
- if( fd < 0 ) fd = open( mixer_device, O_RDONLY );
- if( fd != -1 ) {
- ioctl( fd, SOUND_MIXER_READ_DEVMASK, &devs );
- if( devs & mixer_dev_mask ) {
- cmd = MIXER_WRITE( mixer_channel );
- } else {
- return 0;
- }
-
- v = ( levelpercentage << 8 ) | levelpercentage;
- ioctl( fd, cmd, &v );
- muted = 0;
- mutecount = 0;
- return v;
- }
-
return 0;
}
-void mixer_mute( int mute )
+/**
+ * Returns the volume that would be used to restore the unmute state.
+ */
+static int null_get_unmute_volume( void )
{
- int v, cmd, devs;
-
- /**
- * Make sure that if multiple users mute the card,
- * we only honour the last one.
- */
- if( !mute && mutecount ) mutecount--;
- if( mutecount ) return;
-
- if( fd < 0 ) fd = open( mixer_device, O_RDONLY );
-
- if( mute ) {
- mutecount++;
- if( fd != -1 ) {
-
- /* Save volume */
- ioctl( fd, SOUND_MIXER_READ_DEVMASK, &devs );
- if( devs & mixer_dev_mask ) {
- cmd = MIXER_READ( mixer_channel );
- } else {
- return;
- }
-
- ioctl( fd,cmd,&v );
- saved_volume = v;
-
- /* Now set volume to 0 */
- ioctl( fd, SOUND_MIXER_READ_DEVMASK, &devs );
- if( devs & mixer_dev_mask ) {
- cmd = MIXER_WRITE( mixer_channel );
- } else {
- return;
- }
-
- v = 0;
- ioctl( fd, cmd, &v );
-
- muted = 1;
- return;
- }
- } else {
- if( fd != -1 ) {
- ioctl( fd, SOUND_MIXER_READ_DEVMASK, &devs );
- if( devs & mixer_dev_mask ) {
- cmd = MIXER_WRITE( mixer_channel );
- } else {
- return;
- }
-
- v = saved_volume;
- ioctl( fd, cmd, &v );
- muted = 0;
- return;
- }
- }
+ return 0;
}
-int mixer_ismute( void )
+/**
+ * Tunes the relative volume.
+ */
+static int null_set_volume( int percentdiff )
{
- return muted;
+ return 0;
}
-static char *oss_core_devnames[] = SOUND_DEVICE_NAMES;
-
-void mixer_set_device( const char *devname )
+/**
+ * Sets the mute state.
+ */
+static void null_mute( int mute )
{
- const char *channame;
- int found = 0;
- int i;
-
- mixer_device = strdup( devname );
- if( !mixer_device ) return;
-
- i = strcspn( mixer_device, ":" );
- if( i == strlen( mixer_device ) ) {
- channame = "line";
- } else {
- mixer_device[ i ] = 0;
- channame = mixer_device + i + 1;
- }
- if( !file_is_openable_for_read( mixer_device ) ) {
- fprintf( stderr, "mixer: Can't open device %s, "
- "mixer volume and mute unavailable.\n", mixer_device );
- }
-
- mixer_channel = SOUND_MIXER_LINE;
- for( i = 0; i < SOUND_MIXER_NRDEVICES; i++ ) {
- if( !strcasecmp( channame, oss_core_devnames[ i ] ) ) {
- mixer_channel = i;
- found = 1;
- break;
- }
- }
- if( !found ) {
- fprintf( stderr, "mixer: No such mixer channel '%s', using channel 'line'.\n", channame );
- }
- mixer_dev_mask = 1 << mixer_channel;
}
-void mixer_set_state( int ismuted, int unmute_volume )
+/**
+ * Returns true if the mixer is muted.
+ */
+static int null_ismute( void )
{
- /**
- * 1. we come back unmuted: Don't touch anything
- * 2. we don't have a saved volume: Don't touch anything
- * 3. we come back muted and we have a saved volume:
- * - if tvtime muted it, unmute to old volume
- * - if user did it, remember that we're muted and old volume
- */
- if( mixer_get_volume() == 0 && unmute_volume > 0 ) {
- saved_volume = unmute_volume;
- muted = 1;
-
- if( !ismuted ) {
- mixer_mute( 0 );
- }
- }
+ return 0;
}
-void mixer_close_device( void )
+/**
+ * Closes the mixer device if it is open.
+ */
+static void null_close_device( void )
{
- if( fd >= 0 ) close( fd );
- saved_volume = (50 << 8 & 0xFF00) | (50 & 0x00FF);
- mixer_channel = SOUND_MIXER_LINE;
- mixer_dev_mask = 1 << SOUND_MIXER_LINE;
- muted = 0;
- mutecount = 0;
- fd = -1;
}
+/* The null device, which always works. */
+static struct mixer null_mixer = {
+ .set_device = null_set_device,
+ .set_state = null_set_state,
+ .get_volume = null_get_volume,
+ .get_unmute_volume = null_get_unmute_volume,
+ .set_volume = null_set_volume,
+ .mute = null_mute,
+ .ismute = null_ismute,
+ .close_device = null_close_device,
+};
+
+/* List of all available access methods.
+ * Uses weak symbols: NULL is not linked in. */
+static struct mixer *mixers[] = {
+ &alsa_mixer,
+ &oss_mixer,
+ &null_mixer /* LAST */
+};
+/* The actual access method. */
+struct mixer *mixer = &null_mixer;
+
+/**
+ * Sets the mixer device and channel.
+ * Try each access method until one succeeds.
+ */
+void mixer_set_device( const char *devname )
+{
+ int i;
+ mixer->close_device();
+ for (i = 0; i < sizeof(mixers)/sizeof(mixers[0]); i++) {
+ mixer = mixers[i];
+ if (!mixer)
+ continue;
+ if (mixer->set_device(devname) == 0)
+ break;
+ }
+}
diff -Nur tvtime-1.0.2/src/mixer.h tvtime-1.0.2-custom/src/mixer.h
--- tvtime-1.0.2/src/mixer.h 2004-08-27 03:18:49.000000000 +0200
+++ tvtime-1.0.2-custom/src/mixer.h 2011-05-29 18:44:24.947776092 +0200
@@ -27,45 +27,58 @@
#endif
/**
- * Sets the mixer device and channel. The device name is of the form
- * devicename:channelname. The default is /dev/mixer:line.
+ * Sets the mixer device and channel.
+ * All interfaces are scanned until one succeeds.
*/
void mixer_set_device( const char *devname );
+struct mixer {
+/**
+ * Sets the mixer device and channel.
+ */
+int (* set_device)( const char *devname );
+
/**
* Sets the initial state of the mixer device.
*/
-void mixer_set_state( int ismuted, int unmute_volume );
+void (* set_state)( int ismuted, int unmute_volume );
/**
* Returns the current volume setting.
*/
-int mixer_get_volume( void );
+int (* get_volume)( void );
/**
* Returns the volume that would be used to restore the unmute state.
*/
-int mixer_get_unmute_volume( void );
+int (* get_unmute_volume)( void );
/**
* Tunes the relative volume.
*/
-int mixer_set_volume( int percentdiff );
+int (* set_volume)( int percentdiff );
/**
* Sets the mute state.
*/
-void mixer_mute( int mute );
+void (* mute)( int mute );
/**
* Returns true if the mixer is muted.
*/
-int mixer_ismute( void );
+int (* ismute)( void );
/**
* Closes the mixer device if it is open.
*/
-void mixer_close_device( void );
+void (* close_device)( void );
+};
+
+#pragma weak alsa_mixer
+extern struct mixer alsa_mixer;
+#pragma weak oss_mixer
+extern struct mixer oss_mixer;
+extern struct mixer *mixer;
#ifdef __cplusplus
};
diff -Nur tvtime-1.0.2/src/mixer-oss.c tvtime-1.0.2-custom/src/mixer-oss.c
--- tvtime-1.0.2/src/mixer-oss.c 1970-01-01 01:00:00.000000000 +0100
+++ tvtime-1.0.2-custom/src/mixer-oss.c 2011-05-29 18:44:24.954442772 +0200
@@ -0,0 +1,261 @@
+/**
+ * Copyright (C) 2002, 2003 Doug Bell <drbell@users.sourceforge.net>
+ *
+ * Some mixer routines from mplayer, http://mplayer.sourceforge.net.
+ * Copyright (C) 2000-2002. by A'rpi/ESP-team & others
+ *
+ * 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, 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include <stdio.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/ioctl.h>
+#include <sys/soundcard.h>
+#include <sys/mman.h>
+#include <string.h>
+#include "utils.h"
+#include "mixer.h"
+
+static char *mixer_device = "/dev/mixer";
+static int saved_volume = (50 << 8 & 0xFF00) | (50 & 0x00FF);
+static int mixer_channel = SOUND_MIXER_LINE;
+static int mixer_dev_mask = 1 << SOUND_MIXER_LINE;
+static int muted = 0;
+static int mutecount = 0;
+static int fd = -1;
+
+static int oss_get_volume( void )
+{
+ int v, cmd, devs;
+ int curvol = 0;
+
+ if( fd < 0 ) fd = open( mixer_device, O_RDONLY );
+ if( fd != -1 ) {
+
+ ioctl( fd, SOUND_MIXER_READ_DEVMASK, &devs );
+ if( devs & mixer_dev_mask ) {
+ cmd = MIXER_READ( mixer_channel );
+ } else {
+ return curvol;
+ }
+
+ ioctl( fd, cmd, &v );
+ curvol = ( v & 0xFF00 ) >> 8;
+ }
+
+ return curvol;
+}
+
+static int oss_get_unmute_volume( void )
+{
+ if( muted ) {
+ return saved_volume;
+ } else {
+ int v, cmd, devs;
+
+ if( fd < 0 ) fd = open( mixer_device, O_RDONLY );
+ if( fd != -1 ) {
+
+ ioctl( fd, SOUND_MIXER_READ_DEVMASK, &devs );
+ if( devs & mixer_dev_mask ) {
+ cmd = MIXER_READ( mixer_channel );
+ } else {
+ return -1;
+ }
+
+ ioctl( fd, cmd, &v );
+ return v;
+ }
+ }
+
+ return -1;
+}
+
+static int oss_set_volume( int percentdiff )
+{
+ int v, cmd, devs, levelpercentage;
+
+ levelpercentage = oss_get_volume();
+
+ levelpercentage += percentdiff;
+ if( levelpercentage > 100 ) levelpercentage = 100;
+ if( levelpercentage < 0 ) levelpercentage = 0;
+
+ if( fd < 0 ) fd = open( mixer_device, O_RDONLY );
+ if( fd != -1 ) {
+ ioctl( fd, SOUND_MIXER_READ_DEVMASK, &devs );
+ if( devs & mixer_dev_mask ) {
+ cmd = MIXER_WRITE( mixer_channel );
+ } else {
+ return 0;
+ }
+
+ v = ( levelpercentage << 8 ) | levelpercentage;
+ ioctl( fd, cmd, &v );
+ muted = 0;
+ mutecount = 0;
+ return v;
+ }
+
+ return 0;
+}
+
+static void oss_mute( int mute )
+{
+ int v, cmd, devs;
+
+ /**
+ * Make sure that if multiple users mute the card,
+ * we only honour the last one.
+ */
+ if( !mute && mutecount ) mutecount--;
+ if( mutecount ) return;
+
+ if( fd < 0 ) fd = open( mixer_device, O_RDONLY );
+
+ if( mute ) {
+ mutecount++;
+ if( fd != -1 ) {
+
+ /* Save volume */
+ ioctl( fd, SOUND_MIXER_READ_DEVMASK, &devs );
+ if( devs & mixer_dev_mask ) {
+ cmd = MIXER_READ( mixer_channel );
+ } else {
+ return;
+ }
+
+ ioctl( fd,cmd,&v );
+ saved_volume = v;
+
+ /* Now set volume to 0 */
+ ioctl( fd, SOUND_MIXER_READ_DEVMASK, &devs );
+ if( devs & mixer_dev_mask ) {
+ cmd = MIXER_WRITE( mixer_channel );
+ } else {
+ return;
+ }
+
+ v = 0;
+ ioctl( fd, cmd, &v );
+
+ muted = 1;
+ return;
+ }
+ } else {
+ if( fd != -1 ) {
+ ioctl( fd, SOUND_MIXER_READ_DEVMASK, &devs );
+ if( devs & mixer_dev_mask ) {
+ cmd = MIXER_WRITE( mixer_channel );
+ } else {
+ return;
+ }
+
+ v = saved_volume;
+ ioctl( fd, cmd, &v );
+ muted = 0;
+ return;
+ }
+ }
+}
+
+static int oss_ismute( void )
+{
+ return muted;
+}
+
+static char *oss_core_devnames[] = SOUND_DEVICE_NAMES;
+
+static int oss_set_device( const char *devname )
+{
+ const char *channame;
+ int found = 0;
+ int i;
+
+ mixer_device = strdup( devname );
+ if( !mixer_device ) return -1;
+
+ i = strcspn( mixer_device, ":" );
+ if( i == strlen( mixer_device ) ) {
+ channame = "line";
+ } else {
+ mixer_device[ i ] = 0;
+ channame = mixer_device + i + 1;
+ }
+ if( !file_is_openable_for_read( mixer_device ) ) {
+ fprintf( stderr, "mixer: Can't open device %s, "
+ "mixer volume and mute unavailable.\n", mixer_device );
+ return -1;
+ }
+
+ mixer_channel = SOUND_MIXER_LINE;
+ for( i = 0; i < SOUND_MIXER_NRDEVICES; i++ ) {
+ if( !strcasecmp( channame, oss_core_devnames[ i ] ) ) {
+ mixer_channel = i;
+ found = 1;
+ break;
+ }
+ }
+ if( !found ) {
+ fprintf( stderr, "mixer: No such mixer channel '%s', using channel 'line'.\n", channame );
+ return -1;
+ }
+ mixer_dev_mask = 1 << mixer_channel;
+ return 0;
+}
+
+static void oss_set_state( int ismuted, int unmute_volume )
+{
+ /**
+ * 1. we come back unmuted: Don't touch anything
+ * 2. we don't have a saved volume: Don't touch anything
+ * 3. we come back muted and we have a saved volume:
+ * - if tvtime muted it, unmute to old volume
+ * - if user did it, remember that we're muted and old volume
+ */
+ if( oss_get_volume() == 0 && unmute_volume > 0 ) {
+ saved_volume = unmute_volume;
+ muted = 1;
+
+ if( !ismuted ) {
+ oss_mute( 0 );
+ }
+ }
+}
+
+static void oss_close_device( void )
+{
+ if( fd >= 0 ) close( fd );
+ saved_volume = (50 << 8 & 0xFF00) | (50 & 0x00FF);
+ mixer_channel = SOUND_MIXER_LINE;
+ mixer_dev_mask = 1 << SOUND_MIXER_LINE;
+ muted = 0;
+ mutecount = 0;
+ fd = -1;
+}
+
+struct mixer oss_mixer = {
+ .set_device = oss_set_device,
+ .set_state = oss_set_state,
+ .get_volume = oss_get_volume,
+ .get_unmute_volume = oss_get_unmute_volume,
+ .set_volume = oss_set_volume,
+ .mute = oss_mute,
+ .ismute = oss_ismute,
+ .close_device = oss_close_device,
+};
diff -Nur tvtime-1.0.2/src/tvtime.c tvtime-1.0.2-custom/src/tvtime.c
--- tvtime-1.0.2/src/tvtime.c 2005-09-08 04:55:54.000000000 +0200
+++ tvtime-1.0.2-custom/src/tvtime.c 2011-05-29 18:44:24.957776112 +0200
@@ -1062,84 +1062,55 @@
char string[ 128 ];
menu_set_back_command( menu, TVTIME_SHOW_MENU, "output" );
- if( sixteennine ) {
- snprintf( string, sizeof( string ), (mode == 0) ?
- TVTIME_ICON_RADIOON " %s" : TVTIME_ICON_RADIOOFF " %s",
- _("16:9 + Overscan") );
- menu_set_text( menu, 1, string );
- menu_set_enter_command( menu, 1, TVTIME_SET_MATTE, "16:9" );
- snprintf( string, sizeof( string ), (mode == 1) ?
- TVTIME_ICON_RADIOON " %s" : TVTIME_ICON_RADIOOFF " %s",
- _("1.85:1") );
- menu_set_text( menu, 2, string );
- menu_set_enter_command( menu, 2, TVTIME_SET_MATTE, "1.85:1" );
- snprintf( string, sizeof( string ), (mode == 2) ?
- TVTIME_ICON_RADIOON " %s" : TVTIME_ICON_RADIOOFF " %s",
- _("2.35:1") );
- menu_set_text( menu, 3, string );
- menu_set_enter_command( menu, 3, TVTIME_SET_MATTE, "2.35:1" );
- snprintf( string, sizeof( string ), (mode == 3) ?
- TVTIME_ICON_RADIOON " %s" : TVTIME_ICON_RADIOOFF " %s",
- _("4:3 centre") );
- menu_set_text( menu, 4, string );
- menu_set_enter_command( menu, 4, TVTIME_SET_MATTE, "4:3" );
- snprintf( string, sizeof( string ), (mode == 4) ?
- TVTIME_ICON_RADIOON " %s" : TVTIME_ICON_RADIOOFF " %s",
- _("16:10") );
- menu_set_text( menu, 5, string );
- menu_set_enter_command( menu, 5, TVTIME_SET_MATTE, "16:10" );
- } else {
- snprintf( string, sizeof( string ), (mode == 0) ?
- TVTIME_ICON_RADIOON " %s" : TVTIME_ICON_RADIOOFF " %s",
- _("4:3 + Overscan") );
- menu_set_text( menu, 1, string );
- menu_set_enter_command( menu, 1, TVTIME_SET_MATTE, "4:3" );
- snprintf( string, sizeof( string ), (mode == 1) ?
- TVTIME_ICON_RADIOON " %s" : TVTIME_ICON_RADIOOFF " %s",
- _("16:9") );
- menu_set_text( menu, 2, string );
- menu_set_enter_command( menu, 2, TVTIME_SET_MATTE, "16:9" );
- snprintf( string, sizeof( string ), (mode == 2) ?
- TVTIME_ICON_RADIOON " %s" : TVTIME_ICON_RADIOOFF " %s",
- _("16:10") );
- menu_set_text( menu, 3, string );
- menu_set_enter_command( menu, 3, TVTIME_SET_MATTE, "16:10" );
- snprintf( string, sizeof( string ), (mode == 3) ?
- TVTIME_ICON_RADIOON " %s" : TVTIME_ICON_RADIOOFF " %s",
- _("1.85:1") );
- menu_set_text( menu, 4, string );
- menu_set_enter_command( menu, 4, TVTIME_SET_MATTE, "1.85:1" );
- snprintf( string, sizeof( string ), (mode == 4) ?
- TVTIME_ICON_RADIOON " %s" : TVTIME_ICON_RADIOOFF " %s",
- _("2.35:1") );
- menu_set_text( menu, 5, string );
- menu_set_enter_command( menu, 5, TVTIME_SET_MATTE, "2.35:1" );
- }
+
+ snprintf( string, sizeof( string ), (mode == 0) ?
+ TVTIME_ICON_RADIOON " %s" : TVTIME_ICON_RADIOOFF " %s",
+ _("4:3") );
+ menu_set_text( menu, 1, string );
+ menu_set_enter_command( menu, 1, TVTIME_SET_MATTE, "4:3" );
+ snprintf( string, sizeof( string ), (mode == 1) ?
+ TVTIME_ICON_RADIOON " %s" : TVTIME_ICON_RADIOOFF " %s",
+ _("16:10") );
+ menu_set_text( menu, 2, string );
+ menu_set_enter_command( menu, 2, TVTIME_SET_MATTE, "16:10" );
+ snprintf( string, sizeof( string ), (mode == 2) ?
+ TVTIME_ICON_RADIOON " %s" : TVTIME_ICON_RADIOOFF " %s",
+ _("16:9") );
+ menu_set_text( menu, 3, string );
+ menu_set_enter_command( menu, 3, TVTIME_SET_MATTE, "16:9" );
+ snprintf( string, sizeof( string ), (mode == 3) ?
+ TVTIME_ICON_RADIOON " %s" : TVTIME_ICON_RADIOOFF " %s",
+ _("1.85:1") );
+ menu_set_text( menu, 4, string );
+ menu_set_enter_command( menu, 4, TVTIME_SET_MATTE, "1.85:1" );
+ snprintf( string, sizeof( string ), (mode == 4) ?
+ TVTIME_ICON_RADIOON " %s" : TVTIME_ICON_RADIOOFF " %s",
+ _("2.35:1") );
+ menu_set_text( menu, 5, string );
+ menu_set_enter_command( menu, 5, TVTIME_SET_MATTE, "2.35:1" );
+
snprintf( string, sizeof( string ), TVTIME_ICON_PLAINLEFTARROW " %s",
_("Back") );
menu_set_text( menu, 6, string );
menu_set_enter_command( menu, 6, TVTIME_SHOW_MENU, "output" );
}
-
+
static void osd_list_matte( tvtime_osd_t *osd, int mode, int sixteennine )
{
tvtime_osd_list_set_lines( osd, 6 );
if( sixteennine ) {
tvtime_osd_list_set_text( osd, 0, _("Matte setting (Anamorphic input)") );
- tvtime_osd_list_set_text( osd, 1, _("16:9 + Overscan") );
- tvtime_osd_list_set_text( osd, 2, "1.85:1" );
- tvtime_osd_list_set_text( osd, 3, "2.35:1" );
- tvtime_osd_list_set_text( osd, 4, _("4:3 centre") );
- tvtime_osd_list_set_text( osd, 5, "16:10" );
+
} else {
tvtime_osd_list_set_text( osd, 0, _("Matte setting (4:3 input)") );
- tvtime_osd_list_set_text( osd, 1, _("4:3 + Overscan") );
- tvtime_osd_list_set_text( osd, 2, "16:9" );
- tvtime_osd_list_set_text( osd, 3, "16:10" );
- tvtime_osd_list_set_text( osd, 4, "1.85:1" );
- tvtime_osd_list_set_text( osd, 5, "2.35:1" );
}
+ tvtime_osd_list_set_text( osd, 1, "4:3" );
+ tvtime_osd_list_set_text( osd, 2, "16:10" );
+ tvtime_osd_list_set_text( osd, 3, "16:9" );
+ tvtime_osd_list_set_text( osd, 4, "1.85:1" );
+ tvtime_osd_list_set_text( osd, 5, "2.35:1" );
+
tvtime_osd_list_set_hilight( osd, mode + 1 );
tvtime_osd_show_list( osd, 1, 0 );
}
@@ -1204,6 +1175,7 @@
int matte_y = 0;
int matte_h = 0;
int matte_mode = 0;
+ int matte_changed = 0;
int restarttvtime = 0;
int return_value = 0;
int last_current_id = -1;
@@ -1241,6 +1213,7 @@
output = get_xv_output();
sixteennine = config_get_aspect( ct );
+ matte_mode = config_get_matte( ct );
if( !output || !output->init( config_get_geometry( ct ),
sixteennine, config_get_square_pixels( ct ),
@@ -1441,7 +1414,7 @@
/* Set the mixer device. */
mixer_set_device( config_get_mixer_device( ct ) );
- mixer_set_state( config_get_muted( ct ), config_get_unmute_volume( ct ) );
+ mixer->set_state( config_get_muted( ct ), config_get_unmute_volume( ct ) );
/* Setup OSD stuff. */
pixel_aspect = ( (double) width ) /
@@ -1594,6 +1567,15 @@
build_fspos_menu( commands_get_menu( commands, "fspos" ),
config_get_fullscreen_position( ct ) );
+ matte_changed = 1;
+ double matte = 4.0/3.0;
+
+ /* initialize with safe values until matte is calculated later in the loop. */
+ matte_x = 0;
+ matte_y = 0;
+ matte_w = width;
+ matte_h = height;
+
/* Initialize our timestamps. */
for(;;) {
const char *fifo_args = 0;
@@ -1607,31 +1589,19 @@
int exposed = output->is_exposed();
int current_id;
+
if( vidin && videoinput_has_tuner( vidin ) ) {
current_id = station_get_current_id( stationmgr );
} else {
current_id = 0;
}
-
- if( matte_mode ) {
+ /* Since the matte/overscan calculations changed these could probably
+ be the same variables, but we'll leave it like this for now. */
output_x = matte_x;
output_w = matte_w;
output_y = matte_y;
output_h = matte_h;
- } else {
- output_x = (int) ((((double) width) *
- commands_get_overscan( commands )) + 0.5);
- output_w = (int) ((((double) width) -
- (((double) width) *
- commands_get_overscan( commands ) * 2.0)) +
- 0.5);
- output_y = (int) ((((double) height) *
- commands_get_overscan( commands )) + 0.5);
- output_h = (int) ((((double) height) -
- (((double) height) *
- commands_get_overscan( commands ) * 2.0)) +
- 0.5);
- }
+
if( fifo ) {
int cmd;
@@ -1766,11 +1736,14 @@
quiet_screenshots );
commands_refresh_menu( commands );
}
+
+
if( commands_toggle_aspect( commands ) ) {
- matte_mode = 0;
- output->set_matte( 0, 0 );
if( output->toggle_aspect() ) {
sixteennine = 1;
+ /* Matte is now always applied so we change it to 16:9 mode too so that
+ nothing other than overscan is cropped. */
+ matte_mode = 2;
if( osd ) {
tvtime_osd_show_message( osd,
_("16:9 display mode active.") );
@@ -1780,6 +1753,7 @@
( ( (double) height ) * (16.0 / 9.0) );
} else {
sixteennine = 0;
+ matte_mode = 0;
if( osd ) {
tvtime_osd_show_message( osd,
_("4:3 display mode active.") );
@@ -1800,9 +1774,7 @@
output->is_alwaysontop_supported(),
output->is_overscan_supported(),
quiet_screenshots );
- build_matte_menu( commands_get_menu( commands, "matte" ),
- matte_mode, sixteennine );
- commands_refresh_menu( commands );
+ matte_changed = 1;
}
if( commands_get_fs_pos( commands ) ) {
const char *fspos = commands_get_fs_pos( commands );
@@ -1839,84 +1811,92 @@
}
commands_refresh_menu( commands );
}
+
+ /* Overscan has been changed so it is calculated and applied with the matte.
+ So changing it now generated this event so that we can tell it to redo the matte. */
+ if( commands_get_changed_overscan( commands ) ) {
+ matte_changed = 1;
+ }
if( commands_toggle_matte( commands ) ||
commands_get_matte_mode( commands ) ) {
- double matte = 4.0 / 3.0;
- int sqwidth = sixteennine ?
- ((height * 16) / 9) : ((height * 4) / 3);
- int sqheight = sixteennine ?
- ((width * 9) / 16) : ((width * 3) / 4);
- matte_x = 0;
- matte_w = width;
if( commands_toggle_matte( commands ) ) {
matte_mode = (matte_mode + 1) % 5;
} else {
- if( !strcmp( commands_get_matte_mode( commands ), "16:9" ) ) {
- matte_mode = sixteennine ? 0 : 1;
- } else if( !strcmp( commands_get_matte_mode( commands ),
- "16:10" ) ) {
- matte_mode = sixteennine ? 4 : 2;
+ if( !strcmp( commands_get_matte_mode( commands ), "16:10" ) ) {
+ matte_mode = 1;
+ } else if( !strcmp( commands_get_matte_mode( commands ),
+ "16:9" ) ) {
+ matte_mode = 2;
} else if( !strcmp( commands_get_matte_mode( commands ),
"1.85:1" ) ) {
- matte_mode = sixteennine ? 1 : 3;
+ matte_mode = 3;
} else if( !strcmp( commands_get_matte_mode( commands ),
"2.35:1" ) ) {
- matte_mode = sixteennine ? 2 : 4;
+ matte_mode = 4;
} else {
- matte_mode = sixteennine ? 3 : 0;
+ matte_mode = 0;
}
}
-
- if( sixteennine ) {
- if( matte_mode == 0 ) {
- matte = 16.0 / 9.0;
- } else if( matte_mode == 1 ) {
- matte = 1.85;
- } else if( matte_mode == 2 ) {
- matte = 2.35;
- } else if( matte_mode == 3 ) {
- matte = 4.0 / 3.0;
- matte_w = (int) (((double) sqheight * matte) + 0.5);
- matte_x = (width - matte_w) / 2;
- /* We're cropping the sides off so we add overscan to avoid mess
- * at the top of the screen. */
- matte_y = commands_get_overscan( commands ) * height / 2;
- matte_h = height - matte_y;
- output->set_matte( (matte_h * 4) / 3, matte_h );
- } else if( matte_mode == 4 ) {
- matte = 1.6;
- matte_w = (int) (((double) sqheight * matte) + 0.5);
- matte_x = (width - matte_w) / 2;
- /* We're cropping the sides off so we add overscan to avoid mess
- * at the top of the screen. */
- matte_y = commands_get_overscan( commands ) * height / 2;
- matte_h = height - matte_y;
- output->set_matte( (matte_h * 16) / 10, matte_h );
- }
- } else {
- if( matte_mode == 1 ) {
- matte = 16.0 / 9.0;
- } else if( matte_mode == 2 ) {
- matte = 1.6;
- } else if( matte_mode == 3 ) {
- matte = 1.85;
- } else if( matte_mode == 4 ) {
- matte = 2.35;
- }
- }
- if( !matte_x ) {
- matte_h = (int) ((((double) sqwidth)/matte) + 0.5);
- matte_y = (height - matte_h) / 2;
- output->set_matte( sqwidth, matte_h );
- }
if( osd && !commands_menu_active( commands ) ) {
osd_list_matte( osd, matte_mode, sixteennine );
}
build_matte_menu( commands_get_menu( commands, "matte" ),
matte_mode, sixteennine );
commands_refresh_menu( commands );
+ matte_changed = 1;
}
+ if (matte_changed) {
+ matte_changed = 0;
+
+ /* start with overscan then apply matte */
+ matte_x = (int) ((((double) width) *
+ commands_get_overscan( commands )) + 0.5);
+ matte_w = (int) ((((double) width) -
+ (((double) width) *
+ commands_get_overscan( commands ) * 2.0)) +
+ 0.5);
+ matte_y = (int) ((((double) height) *
+ commands_get_overscan( commands )) + 0.5);
+ matte_h = (int) ((((double) height) -
+ (((double) height) *
+ commands_get_overscan( commands ) * 2.0)) +
+ 0.5);
+
+ int sqwidth = sixteennine ?
+ ((matte_h * 16) / 9) : ((matte_h * 4) / 3);
+ int sqheight = sixteennine ?
+ ((matte_w * 9) / 16) : ((matte_w * 3) / 4);
+
+ if( matte_mode == 0 ) {
+ matte = 4.0 / 3.0;
+ config_save( ct, "Matte", "4:3" );
+ } else if( matte_mode == 1 ) {
+ matte = 1.6;
+ config_save( ct, "Matte", "16:10" );
+ } else if( matte_mode == 2 ) {
+ matte = 16.0/9.0;
+ config_save( ct, "Matte", "16:9" );
+ } else if( matte_mode == 3 ) {
+ matte = 1.85;
+ config_save( ct, "Matte", "1.85:1" );
+ } else if( matte_mode == 4 ) {
+ matte = 2.35;
+ config_save( ct, "Matte", "2.35:1" );
+ }
+
+ if( sixteennine && matte < (16.0/9.0) )
+ {
+ matte_w = (int) (((double) sqheight * matte) + 0.5);
+ matte_x = (width - matte_w) / 2;
+ output->set_matte( matte_w, sqheight );
+ } else {
+ matte_h = (int) ((((double) sqwidth)/matte) + 0.5);
+ matte_y = (height - matte_h) / 2;
+ output->set_matte( sqwidth, matte_h );
+ }
+ }
+
if( commands_toggle_pulldown_detection( commands ) ) {
if( height == 480 ) {
tvtime->pulldown_alg =
@@ -2565,14 +2545,14 @@
snprintf( number, 4, "%d", quiet_screenshots );
config_save( ct, "QuietScreenshots", number );
- snprintf( number, 6, "%d", mixer_get_unmute_volume() );
+ snprintf( number, 6, "%d", mixer->get_unmute_volume() );
config_save( ct, "UnmuteVolume", number );
- snprintf( number, 4, "%d", mixer_ismute() );
+ snprintf( number, 4, "%d", mixer->ismute() );
config_save( ct, "Muted", number );
if( config_get_mute_on_exit( ct ) ) {
- mixer_mute( 1 );
+ mixer->mute( 1 );
}
if( vidin ) {
@@ -2619,7 +2599,7 @@
if( osd ) {
tvtime_osd_delete( osd );
}
- mixer_close_device();
+ mixer->close_device();
/* Free temporary memory. */
free( colourbars );
diff -Nur tvtime-1.0.2/src/tvtimeconf.c tvtime-1.0.2-custom/src/tvtimeconf.c
--- tvtime-1.0.2/src/tvtimeconf.c 2005-09-08 06:07:56.000000000 +0200
+++ tvtime-1.0.2-custom/src/tvtimeconf.c 2011-05-29 18:44:24.957776112 +0200
@@ -56,6 +56,7 @@
char *geometry;
int verbose;
int aspect;
+ int matte;
int squarepixels;
int debug;
int fullscreen;
@@ -290,6 +291,22 @@
ct->aspect = atoi( curval );
}
+ if( !xmlStrcasecmp( name, BAD_CAST "Matte" ) ) {
+ if(!strcmp( curval, "4:3")) {
+ ct->matte = 0;
+ } else if(!strcmp( curval, "16:10")) {
+ ct->matte = 1;
+ } else if(!strcmp( curval, "16:9")) {
+ ct->matte = 2;
+ } else if(!strcmp( curval, "1.85:1")) {
+ ct->matte = 3;
+ } else if(!strcmp( curval, "2.35:1")) {
+ ct->matte = 4;
+ }
+ /* No valid matte if found ct->matte will be -1 and config_get_matte will choose
+ a default based on the aspect ratio. */
+ }
+
if( !xmlStrcasecmp( name, BAD_CAST "DebugMode" ) ) {
ct->debug = atoi( curval );
}
@@ -629,9 +646,11 @@
lfputs( _(" -l, --xmltvlanguage=LANG Use XMLTV data in given language, if available.\n"), stderr );
lfputs( _(" -v, --verbose Print debugging messages to stderr.\n"), stderr );
lfputs( _(" -X, --display=DISPLAY Use the given X display to connect to.\n"), stderr );
- lfputs( _(" -x, --mixer=DEVICE[:CH] The mixer device and channel to control.\n"
- " (defaults to /dev/mixer:line)\n\n"
- " Valid channels are:\n"
+ lfputs( _(" -x, --mixer=<DEVICE[:CH]>|<DEVICE/CH>\n"
+ " The mixer device and channel to control. The first\n"
+ " variant sets the OSS mixer the second one ALSA.\n"
+ " (defaults to default/Line)\n\n"
+ " Valid channels for OSS are:\n"
" vol, bass, treble, synth, pcm, speaker, line,\n"
" mic, cd, mix, pcm2, rec, igain, ogain, line1,\n"
" line2, line3, dig1, dig2, dig3, phin, phout,\n"
@@ -677,9 +696,11 @@
lfputs( _(" -R, --priority=PRI Sets the process priority to run tvtime at.\n"), stderr );
lfputs( _(" -t, --xmltv=FILE Read XMLTV listings from the given file.\n"), stderr );
lfputs( _(" -l, --xmltvlanguage=LANG Use XMLTV data in given language, if available.\n"), stderr );
- lfputs( _(" -x, --mixer=DEVICE[:CH] The mixer device and channel to control.\n"
- " (defaults to /dev/mixer:line)\n\n"
- " Valid channels are:\n"
+ lfputs( _(" -x, --mixer=<DEVICE[:CH]>|<DEVICE/CH>\n"
+ " The mixer device and channel to control. The first\n"
+ " variant sets the OSS mixer the second one ALSA.\n"
+ " (defaults to default/Line)\n\n"
+ " Valid channels for OSS are:\n"
" vol, bass, treble, synth, pcm, speaker, line,\n"
" mic, cd, mix, pcm2, rec, igain, ogain, line1,\n"
" line2, line3, dig1, dig2, dig3, phin, phout,\n"
@@ -712,6 +733,7 @@
ct->geometry = strdup( "0x576" );
ct->verbose = 0;
ct->aspect = 0;
+ ct->matte = -1;
ct->squarepixels = 1;
ct->debug = 0;
ct->fullscreen = 0;
@@ -764,7 +786,7 @@
ct->uid = getuid();
- ct->mixerdev = strdup( "/dev/mixer:line" );
+ ct->mixerdev = strdup( "default/Line" );
ct->deinterlace_method = strdup( "GreedyH" );
ct->check_freq_present = 1;
@@ -807,6 +829,10 @@
ct->keymap[ 'a' ] = TVTIME_TOGGLE_ASPECT;
ct->keymap[ 'f' ] = TVTIME_TOGGLE_FULLSCREEN;
ct->keymap[ 'i' ] = TVTIME_TOGGLE_INPUT;
+ ct->keymap[ 'a' ] = TVTIME_TOGGLE_ASPECT;
+ ct->keymap[ I_INSERT ] = TVTIME_TOGGLE_MATTE;
+ ct->keymap[ ',' ] = TVTIME_OVERSCAN_DOWN;
+ ct->keymap[ '.' ] = TVTIME_OVERSCAN_DOWN;
ct->keymap[ 's' ] = TVTIME_SCREENSHOT;
ct->keymap[ ',' ] = TVTIME_MIXER_TOGGLE_MUTE;
ct->keymap[ 'e' ] = TVTIME_TOGGLE_AUDIO_MODE;
@@ -1451,6 +1477,13 @@
return ct->aspect;
}
+int config_get_matte( config_t *ct )
+{
+ /* If matte is not set then default to 0 for normal or 2 for widescreen. */
+ if (ct->matte == -1) return ct->aspect * 2;
+ return ct->matte;
+}
+
int config_get_start_channel( config_t *ct )
{
return ct->start_channel;
diff -Nur tvtime-1.0.2/src/tvtimeconf.h tvtime-1.0.2-custom/src/tvtimeconf.h
--- tvtime-1.0.2/src/tvtimeconf.h 2005-08-14 19:00:11.000000000 +0200
+++ tvtime-1.0.2-custom/src/tvtimeconf.h 2011-05-29 18:44:24.967776132 +0200
@@ -151,6 +151,7 @@
const char *config_get_geometry( config_t *ct );
int config_get_inputwidth( config_t *ct );
int config_get_aspect( config_t *ct );
+int config_get_matte( config_t *ct );
int config_get_inputnum( config_t *ct );
const char *config_get_v4l_device( config_t *ct );
const char *config_get_v4l_norm( config_t *ct );
diff -Nur tvtime-1.0.2/src/videodev2.h tvtime-1.0.2-custom/src/videodev2.h
--- tvtime-1.0.2/src/videodev2.h 2005-01-17 03:36:40.000000000 +0100
+++ tvtime-1.0.2-custom/src/videodev2.h 2011-05-29 18:44:24.971109472 +0200
@@ -16,7 +16,6 @@
#ifdef __KERNEL__
#include <linux/time.h> /* need struct timeval */
#endif
-#include <linux/compiler.h> /* need __user */
/* for kernel versions 2.4.26 and below: */
#ifndef __user
diff -Nur tvtime-1.0.2/src/videoinput.c tvtime-1.0.2-custom/src/videoinput.c
--- tvtime-1.0.2/src/videoinput.c 2005-09-08 05:13:37.000000000 +0200
+++ tvtime-1.0.2-custom/src/videoinput.c 2011-05-29 18:44:24.974442812 +0200
@@ -376,7 +376,9 @@
wait_for_frame_v4l2( vidin );
+ videoinput_get_aspect( vidin );
cur_buf.type = vidin->capbuffers[ 0 ].vidbuf.type;
+ cur_buf.memory = vidin->capbuffers[ 0 ].vidbuf.memory;
if( ioctl( vidin->grab_fd, VIDIOC_DQBUF, &cur_buf ) < 0 ) {
/* some drivers return EIO when there is no signal */
if( errno != EIO ) {
@@ -1148,6 +1150,22 @@
}
}
+float videoinput_get_aspect( videoinput_t *vidin )
+{
+ float aspect = 1.0;
+
+ if( vidin->isv4l2 ) {
+ struct v4l2_cropcap cropcap;
+ /* on success 0 is returned */
+ if( !ioctl( vidin->grab_fd, VIDIOC_CROPCAP, &cropcap ) ) {
+ aspect = (float)cropcap.pixelaspect.numerator / (float)cropcap.pixelaspect.denominator;
+ fprintf( stderr, "videoinput: Aspect ratio: %f\n", aspect);
+ }
+ }
+
+ return aspect;
+}
+
static void videoinput_do_mute( videoinput_t *vidin, int mute )
{
if( vidin->hasaudio && mute != vidin->hw_muted ) {
@@ -1269,7 +1287,7 @@
}
vidin->change_muted = 1;
- mixer_mute( 1 );
+ mixer->mute( 1 );
videoinput_do_mute( vidin, vidin->user_muted || vidin->change_muted );
vidin->cur_tuner_state = TUNER_STATE_SIGNAL_DETECTED;
vidin->signal_acquire_wait = SIGNAL_ACQUIRE_DELAY;
@@ -1620,7 +1638,7 @@
if( vidin->change_muted ) {
vidin->change_muted = 0;
videoinput_do_mute( vidin, vidin->user_muted || vidin->change_muted );
- mixer_mute( 0 );
+ mixer->mute( 0 );
}
break;
}
@@ -1631,7 +1649,7 @@
vidin->cur_tuner_state = TUNER_STATE_SIGNAL_LOST;
vidin->signal_recover_wait = SIGNAL_RECOVER_DELAY;
vidin->change_muted = 1;
- mixer_mute( 1 );
+ mixer->mute( 1 );
videoinput_do_mute( vidin, vidin->user_muted || vidin->change_muted );
case TUNER_STATE_SIGNAL_LOST:
if( vidin->signal_recover_wait ) {
diff -Nur tvtime-1.0.2/src/videoinput.h tvtime-1.0.2-custom/src/videoinput.h
--- tvtime-1.0.2/src/videoinput.h 2005-09-08 04:55:10.000000000 +0200
+++ tvtime-1.0.2-custom/src/videoinput.h 2011-05-29 18:44:24.981109492 +0200
@@ -71,6 +71,8 @@
#define VIDEOINPUT_LANG1 4
#define VIDEOINPUT_LANG2 8
+float videoinput_get_aspect( videoinput_t *vidin );
+
/**
* Possible PAL audio modes, for the cx88 driver that cannot autodetect.
*/
diff -Nur tvtime-1.0.2/src/xcommon.c tvtime-1.0.2-custom/src/xcommon.c
--- tvtime-1.0.2/src/xcommon.c 2005-08-14 19:36:52.000000000 +0200
+++ tvtime-1.0.2-custom/src/xcommon.c 2011-05-29 18:44:24.987776172 +0200
@@ -25,6 +25,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
#if defined(__FreeBSD__)
#include <machine/param.h>
@@ -45,8 +46,8 @@
#include <X11/keysym.h>
#include <X11/cursorfont.h>
#include <X11/extensions/XShm.h>
-#ifdef HAVE_XTESTEXTENSION
-#include <X11/extensions/XTest.h>
+#ifdef HAVE_XSSEXTENSION
+#include <X11/extensions/scrnsaver.h>
#endif
#include "xfullscreen.h"
@@ -67,7 +68,7 @@
static Window fs_window;
static Window output_window;
static GC gc;
-static int have_xtest;
+static int have_xss;
static int output_width, output_height;
static int output_aspect;
static int output_on_root;
@@ -106,10 +107,7 @@
static Atom wm_delete_window;
static Atom xawtv_station;
static Atom xawtv_remote;
-
-#ifdef HAVE_XTESTEXTENSION
-static KeyCode kc_shift_l; /* Fake key to send. */
-#endif
+static Atom net_wm_pid;
static area_t video_area;
static area_t window_area;
@@ -150,11 +148,12 @@
"WM_PROTOCOLS",
"WM_DELETE_WINDOW",
"_XAWTV_STATION",
- "_XAWTV_REMOTE"
+ "_XAWTV_REMOTE",
+ "_NET_WM_PID"
};
- Atom atoms_return[ 17 ];
+ Atom atoms_return[ 18 ];
- XInternAtoms( display, atom_names, 17, False, atoms_return );
+ XInternAtoms( display, atom_names, 18, False, atoms_return );
net_supporting_wm_check = atoms_return[ 0 ];
net_supported = atoms_return[ 1 ];
net_wm_name = atoms_return[ 2 ];
@@ -172,6 +171,7 @@
wm_delete_window = atoms_return[ 14 ];
xawtv_station = atoms_return[ 15 ];
xawtv_remote = atoms_return[ 16 ];
+ net_wm_pid = atoms_return[ 17 ];
}
static uint32_t icon_colours[256];
@@ -248,12 +248,12 @@
} while ( (event.type != MapNotify) || (event.xmap.event != win) );
}
-static int have_xtestextention( void )
+static int have_xssextention( void )
{
-#ifdef HAVE_XTESTEXTENSION
- int dummy1, dummy2, dummy3, dummy4;
+#ifdef HAVE_XSSEXTENSION
+ int dummy1, dummy2;
- return (XTestQueryExtension( display, &dummy1, &dummy2, &dummy3, &dummy4 ) == True);
+ return (XScreenSaverQueryExtension( display, &dummy1, &dummy2 ) == True);
#endif
return 0;
}
@@ -843,7 +843,7 @@
output_aspect = aspect;
output_height = 576;
- have_xtest = 0;
+ have_xss = 0;
output_on_root = 0;
has_ewmh_state_fullscreen = 0;
has_ewmh_state_above = 0;
@@ -927,13 +927,16 @@
xfullscreen_print_summary( xf );
}
-#ifdef HAVE_XTESTEXTENSION
- kc_shift_l = XKeysymToKeycode( display, XK_Shift_L );
-#endif
- have_xtest = have_xtestextention();
- if( have_xtest && xcommon_verbose ) {
- fprintf( stderr, "xcommon: Have XTest, will use it to ping the screensaver.\n" );
+ have_xss = have_xssextention();
+ if( have_xss && xcommon_verbose ) {
+ fprintf( stderr, "xcommon: Have XSS, will use it to disable the screensaver.\n" );
+ }
+
+#ifdef HAVE_XSSEXTENSION
+ if ( have_xss ) {
+ XScreenSaverSuspend( display, True );
}
+#endif
/* Initially, get the best width for our height. */
output_width = xv_get_width_for_height( output_height );
@@ -1017,6 +1020,16 @@
free( data );
}
}
+
+ /* Set _NET_WM_PID */
+ {
+ if( xcommon_verbose ) {
+ fprintf( stderr, "xcommon: try to set _NET_WM_PID" );
+ }
+ pid_t mypid = getpid();
+ XChangeProperty(display, wm_window, net_wm_pid, cardinal, 32,
+ PropModeReplace, (const unsigned char*) &mypid, 1);
+ }
if( check_for_EWMH_wm( display, &wmname ) ) {
if( xcommon_verbose ) {
@@ -1112,15 +1125,7 @@
gettimeofday( &curtime, 0 );
if( timediff( &curtime, &last_ping_time ) > SCREENSAVER_PING_TIME ) {
last_ping_time = curtime;
-#ifdef HAVE_XTESTEXTENSION
- if( have_xtest ) {
- XTestFakeKeyEvent( display, kc_shift_l, True, CurrentTime );
- XTestFakeKeyEvent( display, kc_shift_l, False, CurrentTime );
- } else
-#endif
- {
- XResetScreenSaver( display );
- }
+ XResetScreenSaver( display );
}
}
@@ -1715,6 +1720,11 @@
void xcommon_close_display( void )
{
+#ifdef HAVE_XSSEXTENSION
+ if ( have_xss ) {
+ XScreenSaverSuspend( display, False );
+ }
+#endif
XDestroyWindow( display, output_window );
XDestroyWindow( display, wm_window );
XDestroyWindow( display, fs_window );
diff -Nur tvtime-1.0.2/src/xfullscreen.c tvtime-1.0.2-custom/src/xfullscreen.c
--- tvtime-1.0.2/src/xfullscreen.c 2004-10-14 02:12:02.000000000 +0200
+++ tvtime-1.0.2-custom/src/xfullscreen.c 2011-05-29 18:44:25.011109552 +0200
@@ -263,6 +263,10 @@
int max_area = -1;
int i;
+ *x = xf->heads[ 0 ].x;
+ *y = xf->heads[ 0 ].y;
+ *w = xf->heads[ 0 ].w;
+ *h = xf->heads[ 0 ].h;
for( i = 0; i < xf->nheads; i++ ) {
int head_x1 = xf->heads[ i ].x;
int head_x2 = xf->heads[ i ].x + xf->heads[ i ].w - 1;
diff -Nur tvtime-1.0.2/src/xmltv.c tvtime-1.0.2-custom/src/xmltv.c
--- tvtime-1.0.2/src/xmltv.c 2004-09-26 18:40:01.000000000 +0200
+++ tvtime-1.0.2-custom/src/xmltv.c 2011-05-29 18:44:25.014442892 +0200
@@ -118,9 +118,9 @@
typedef struct {
const char *code;
const char *name;
-} locale_t;
+} tv_locale_t;
-static locale_t locale_table[] = {
+static tv_locale_t locale_table[] = {
{"AA", "Afar"}, {"AB", "Abkhazian"}, {"AF", "Afrikaans"},
{"AM", "Amharic"}, {"AR", "Arabic"}, {"AS", "Assamese"},
{"AY", "Aymara"}, {"AZ", "Azerbaijani"}, {"BA", "Bashkir"},
@@ -168,7 +168,7 @@
{"XH", "Xhosa"}, {"YO", "Yoruba"}, {"ZH", "Chinese"},
{"ZU", "Zulu"} };
-const int num_locales = sizeof( locale_table ) / sizeof( locale_t );
+const int num_locales = sizeof( locale_table ) / sizeof( tv_locale_t );
/**
* Timezone parsing code based loosely on the algorithm in
diff -Nur tvtime-1.0.2/src/xvoutput.c tvtime-1.0.2-custom/src/xvoutput.c
--- tvtime-1.0.2/src/xvoutput.c 2005-08-14 19:35:50.000000000 +0200
+++ tvtime-1.0.2-custom/src/xvoutput.c 2011-05-29 18:44:25.014442892 +0200
@@ -233,7 +233,7 @@
{
int size;
uint8_t *alloc;
-
+
size = input_width * input_height * 2;
if( use_shm ) {
alloc = create_shm( size );