From 7e4b4d290570aee1d24241b0e0ac10e7c8148a36 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Wed, 20 Sep 2000 18:00:00 +0200 Subject: Version 0.64 - NOTE: If you are using DVB driver version 0.7 you need to load the dvb.o module with option outstream=0, so your insmod statement should read 'insmod dvb.o outstream=0'. This is currently necessary because 'vdr' still works with AV_PES data. - Video files now have the 'group read' bit set. - Fixed handling errors in 'readstring()'. - Handling SIGPIPE and re-establishing handler after intercepting a signal. - The configuration files are now by default read from the video directory. This can be changed by using the new '-c' option. Make sure you copy your current '*.conf' files to your video directory ('/video' by default), or use "-c ." to get the old behaviour of loading the configuration files from the current directory. - Waiting for input is now handled by a common function, which improves response time on user actions. As a consequence the EIT data may sometimes not be displayed, but this will change later when cEIT runs as a separate thread. - The new SVDRP command 'HITK' (thanks to Guido Fiala!) can be used to 'hit' a remote control key. Establish an SVDRP connection and enter HITK without a parameter for a list of all valid key names. - The new SVDRP command 'GRAB' (thanks to Guido Fiala!) can be used to grab the current frame and save it to a file. - The new SVDRP commands 'OVL*' can be used to control video overlays (thanks to Guido Fiala!). This is mainly for use in the 'kvdr' tool (see the 'kvdr' page at http://www.s.netic.de/gfiala). - If the name of the video directory used with the '-v' option had trailing slashes, the recording file names have been damaged. Trailing slashes are now silently removed. - Fixed a buffer overflow in EIT parsing. - Added a security warning regarding SVDRP to the INSTALL file. - Fixed 'confirm' dialog. - The daemon mode (option '-d') now no longer works with REMOTE=KBD (there is no stdin in daemon mode, so KBD makes no sense - plus it sometimes crashed). --- vdr.c | 44 +++++++++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 17 deletions(-) (limited to 'vdr.c') diff --git a/vdr.c b/vdr.c index 4932bf2..91643c2 100644 --- a/vdr.c +++ b/vdr.c @@ -22,7 +22,7 @@ * * The project's page is at http://www.cadsoft.de/people/kls/vdr * - * $Id: vdr.c 1.30 2000/09/10 14:33:09 kls Exp $ + * $Id: vdr.c 1.35 2000/09/20 16:45:01 kls Exp $ */ #include @@ -34,7 +34,6 @@ #include "interface.h" #include "menu.h" #include "recording.h" -#include "svdrp.h" #include "tools.h" #include "videodir.h" @@ -46,9 +45,11 @@ static int Interrupted = 0; -void SignalHandler(int signum) +static void SignalHandler(int signum) { - Interrupted = signum; + if (signum != SIGPIPE) + Interrupted = signum; + signal(signum, SignalHandler); } int main(int argc, char *argv[]) @@ -58,9 +59,11 @@ int main(int argc, char *argv[]) #define DEFAULTSVDRPPORT 2001 int SVDRPport = DEFAULTSVDRPPORT; + const char *ConfigDirectory = NULL; bool DaemonMode = false; static struct option long_options[] = { + { "config", required_argument, NULL, 'c' }, { "daemon", no_argument, NULL, 'd' }, { "help", no_argument, NULL, 'h' }, { "log", required_argument, NULL, 'l' }, @@ -71,10 +74,14 @@ int main(int argc, char *argv[]) int c; int option_index = 0; - while ((c = getopt_long(argc, argv, "dhl:p:v:", long_options, &option_index)) != -1) { + while ((c = getopt_long(argc, argv, "c:dhl:p:v:", long_options, &option_index)) != -1) { switch (c) { + case 'c': ConfigDirectory = optarg; + break; case 'd': DaemonMode = true; break; - case 'h': printf("Usage: vdr [OPTION]\n\n" + case 'h': printf("Usage: vdr [OPTION]\n\n" // for easier orientation, this is column 80| + " -c DIR, --config=DIR read config files from DIR (default is to read them\n" + " from the video directory)\n" " -h, --help display this help and exit\n" " -d, --daemon run in daemon mode\n" " -l LEVEL, --log=LEVEL set log level (default: 3)\n" @@ -108,6 +115,8 @@ int main(int argc, char *argv[]) } break; case 'v': VideoDirectory = optarg; + while (optarg && *optarg && optarg[strlen(optarg) - 1] == '/') + optarg[strlen(optarg) - 1] = 0; break; default: abort(); } @@ -128,7 +137,7 @@ int main(int argc, char *argv[]) // Daemon mode: if (DaemonMode) { -#ifndef DEBUG_OSD +#if !defined(DEBUG_OSD) && !defined(REMOTE_KBD) pid_t pid = fork(); if (pid < 0) { fprintf(stderr, "%s\n", strerror(errno)); @@ -141,7 +150,7 @@ int main(int argc, char *argv[]) fclose(stdout); fclose(stderr); #else - fprintf(stderr, "vdr: can't run in daemon mode with DEBUG_OSD on!\n"); + fprintf(stderr, "vdr: can't run in daemon mode with DEBUG_OSD or REMOTE_KBD on!\n"); abort(); #endif } @@ -154,16 +163,19 @@ int main(int argc, char *argv[]) // Configuration data: - Setup.Load("setup.conf"); - Channels.Load("channels.conf"); - Timers.Load("timers.conf"); + if (!ConfigDirectory) + ConfigDirectory = VideoDirectory; + + Setup.Load(AddDirectory(ConfigDirectory, "setup.conf")); + Channels.Load(AddDirectory(ConfigDirectory, "channels.conf")); + Timers.Load(AddDirectory(ConfigDirectory, "timers.conf")); #ifdef REMOTE_LIRC Keys.SetDummyValues(); #else - if (!Keys.Load(KEYS_CONF)) + if (!Keys.Load(AddDirectory(ConfigDirectory, KEYS_CONF))) Interface.LearnKeys(); #endif - Interface.Init(); + Interface.Init(SVDRPport); cDvbApi::SetPrimaryDvbApi(Setup.PrimaryDVB); @@ -174,10 +186,10 @@ int main(int argc, char *argv[]) if (signal(SIGHUP, SignalHandler) == SIG_IGN) signal(SIGHUP, SIG_IGN); if (signal(SIGINT, SignalHandler) == SIG_IGN) signal(SIGINT, SIG_IGN); if (signal(SIGTERM, SignalHandler) == SIG_IGN) signal(SIGTERM, SIG_IGN); + if (signal(SIGPIPE, SignalHandler) == SIG_IGN) signal(SIGPIPE, SIG_IGN); // Main program loop: - cSVDRP *SVDRP = SVDRPport ? new cSVDRP(SVDRPport) : NULL; cOsdBase *Menu = NULL; cReplayControl *ReplayControl = NULL; int LastChannel = -1; @@ -267,13 +279,11 @@ int main(int argc, char *argv[]) default: break; } } - if (SVDRP) - SVDRP->Process();//TODO lock menu vs. SVDRP? } isyslog(LOG_INFO, "caught signal %d", Interrupted); delete Menu; delete ReplayControl; - delete SVDRP; + Interface.Cleanup(); cDvbApi::Cleanup(); isyslog(LOG_INFO, "exiting"); if (SysLogLevel > 0) -- cgit v1.2.3