From 9954b939efd6d04c5e810f39066f0eb86f653a55 Mon Sep 17 00:00:00 2001 From: Johns Date: Wed, 27 Feb 2013 16:48:42 +0100 Subject: [PATCH] Try to connect to X11 server, when start fails. --- ChangeLog | 2 ++ softhddev.c | 31 +++++++++++++++++++++++++++++-- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 10aac97..a1c41cb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ User johns Date: + Release Version 0.6.0 + Try to start or connect to X11 server with -xx. Try to use HBR (High Bit-Rate) for EAC3. Improved pass-through (PCM+EAC3) support. Support VDR 1.7.36 new build system. diff --git a/softhddev.c b/softhddev.c index c638ebb..bc05e33 100644 --- a/softhddev.c +++ b/softhddev.c @@ -2792,7 +2792,8 @@ const char *CommandLineHelp(void) " -f\t\tstart with fullscreen window (only with window manager)\n" " -g geometry\tx11 window geometry wxh+x+y\n" " -v device\tvideo driver device (va-api, vdpau, noop)\n" - " -s\t\tstart in suspended mode\n" " -x\t\tstart x11 server\n" + " -s\t\tstart in suspended mode\n" + " -x\t\tstart x11 server, with -xx try to connect, if this fails\n" " -X args\tX11 server arguments (f.e. -nocursor)\n" " -w workaround\tenable/disable workarounds\n" "\tno-hw-decoder\t\tdisable hw decoder, use software decoder only\n" @@ -2850,7 +2851,7 @@ int ProcessArgs(int argc, char *const argv[]) VideoSetDevice(optarg); continue; case 'x': // x11 server - ConfigStartX11Server = 1; + ConfigStartX11Server++; continue; case 'X': // x11 server arguments X11ServerArguments = optarg; @@ -3001,6 +3002,7 @@ static void StartXServer(void) // child signal(SIGUSR1, SIG_IGN); // ignore to force answer //setpgid(0,getpid()); + setpgid(pid, 0); // close all open file-handles maxfd = sysconf(_SC_OPEN_MAX); @@ -3141,6 +3143,31 @@ void Stop(void) */ void Housekeeping(void) { + // + // when starting an own X11 server fails, try to connect to a already + // running X11 server. This can take some time. + // + if (X11ServerPid) { // check if X11 server still running + pid_t wpid; + int status; + + wpid = waitpid(X11ServerPid, &status, WNOHANG); + if (wpid) { + if (WIFEXITED(status)) { + Debug(3, "x-setup: x11 server exited (%d)\n", + WEXITSTATUS(status)); + } + if (WIFSIGNALED(status)) { + Debug(3, "x-setup: x11 server killed (%d)\n", + WTERMSIG(status)); + } + X11ServerPid = 0; + // video not running + if (ConfigStartX11Server > 1 && !MyVideoStream->HwDecoder) { + StartVideo(); + } + } + } } /**