35 #include <sys/capability.h> 36 #include <sys/prctl.h> 38 #include <systemd/sd-daemon.h> 74 #define MINCHANNELWAIT 10 // seconds to wait between failed channel switchings 75 #define ACTIVITYTIMEOUT 60 // seconds before starting housekeeping 76 #define SHUTDOWNWAIT 300 // seconds to wait in user prompt before automatic shutdown 77 #define SHUTDOWNRETRY 360 // seconds before trying again to shut down 78 #define SHUTDOWNFORCEPROMPT 5 // seconds to wait in user prompt to allow forcing shutdown 79 #define SHUTDOWNCANCELPROMPT 5 // seconds to wait in user prompt to allow canceling shutdown 80 #define RESTARTCANCELPROMPT 5 // seconds to wait in user prompt before restarting on SIGHUP 81 #define MANUALSTART 600 // seconds the next timer must be in the future to assume manual start 82 #define CHANNELSAVEDELTA 600 // seconds before saving channels.conf after automatic modifications 83 #define DEVICEREADYTIMEOUT 30 // seconds to wait until all devices are ready 84 #define MENUTIMEOUT 120 // seconds of user inactivity after which an OSD display is closed 85 #define TIMERCHECKDELTA 10 // seconds between checks for timers that need to see their channel 86 #define TIMERDEVICETIMEOUT 8 // seconds before a device used for timer check may be reused 87 #define TIMERLOOKAHEADTIME 60 // seconds before a non-VPS timer starts and the channel is switched if possible 88 #define VPSLOOKAHEADTIME 24 // hours within which VPS timers will make sure their events are up to date 89 #define VPSUPTODATETIME 3600 // seconds before the event or schedule of a VPS timer needs to be refreshed 91 #define EXIT(v) { ShutdownHandler.Exit(v); goto Exit; } 95 static bool SetUser(
const char *UserName,
bool UserDump)
98 struct passwd *user = getpwnam(UserName);
100 fprintf(stderr,
"vdr: unknown user: '%s'\n", UserName);
103 if (setgid(user->pw_gid) < 0) {
104 fprintf(stderr,
"vdr: cannot set group id %u: %s\n", (
unsigned int)user->pw_gid, strerror(errno));
107 if (initgroups(user->pw_name, user->pw_gid) < 0) {
108 fprintf(stderr,
"vdr: cannot set supplemental group ids for user %s: %s\n", user->pw_name, strerror(errno));
111 if (setuid(user->pw_uid) < 0) {
112 fprintf(stderr,
"vdr: cannot set user id %u: %s\n", (
unsigned int)user->pw_uid, strerror(errno));
115 if (UserDump && prctl(PR_SET_DUMPABLE, 1, 0, 0, 0) < 0)
116 fprintf(stderr,
"vdr: warning - cannot set dumpable: %s\n", strerror(errno));
117 setenv(
"HOME", user->pw_dir, 1);
118 setenv(
"USER", user->pw_name, 1);
119 setenv(
"LOGNAME", user->pw_name, 1);
120 setenv(
"SHELL", user->pw_shell, 1);
128 cap_t caps = cap_from_text(
"= cap_sys_nice,cap_sys_time,cap_net_raw=ep");
130 fprintf(stderr,
"vdr: cap_from_text failed: %s\n", strerror(errno));
133 if (cap_set_proc(caps) == -1) {
134 fprintf(stderr,
"vdr: cap_set_proc failed: %s\n", strerror(errno));
145 if (prctl(PR_SET_KEEPCAPS, On ? 1 : 0, 0, 0, 0) != 0) {
146 fprintf(stderr,
"vdr: prctl failed\n");
172 esyslog(
"PANIC: watchdog timer expired - exiting!");
176 int main(
int argc,
char *argv[])
180 struct termios savedTm;
181 bool HasStdin = (tcgetpgrp(STDIN_FILENO) == getpid() || getppid() != (pid_t)1) && tcgetattr(STDIN_FILENO, &savedTm) == 0;
185 setlocale(LC_ALL,
"");
189 #define dd(a, b) (*a ? a : b) 190 #define DEFAULTSVDRPPORT 6419 191 #define DEFAULTWATCHDOG 0 // seconds 192 #define DEFAULTVIDEODIR VIDEODIR 193 #define DEFAULTCONFDIR dd(CONFDIR, VideoDirectory) 194 #define DEFAULTARGSDIR dd(ARGSDIR, "/etc/vdr/conf.d") 195 #define DEFAULTCACHEDIR dd(CACHEDIR, VideoDirectory) 196 #define DEFAULTRESDIR dd(RESDIR, ConfigDirectory) 197 #define DEFAULTPLUGINDIR PLUGINDIR 198 #define DEFAULTLOCDIR LOCDIR 199 #define DEFAULTEPGDATAFILENAME "epg.data" 201 bool StartedAsRoot =
false;
202 const char *VdrUser = NULL;
203 bool UserDump =
false;
205 const char *AudioCommand = NULL;
207 const char *ConfigDirectory = NULL;
208 const char *CacheDirectory = NULL;
209 const char *ResourceDirectory = NULL;
212 bool DisplayHelp =
false;
213 bool DisplayVersion =
false;
214 bool DaemonMode =
false;
215 int SysLogTarget = LOG_USER;
216 bool MuteAudio =
false;
218 const char *Terminal = NULL;
220 #define DEPRECATED_VDR_CHARSET_OVERRIDE 221 #ifdef DEPRECATED_VDR_CHARSET_OVERRIDE 222 OverrideCharacterTable = getenv(
"VDR_CHARSET_OVERRIDE");
227 const char *LircDevice = NULL;
228 #if !defined(REMOTE_KBD) 231 #if defined(REMOTE_LIRC) 232 LircDevice = LIRC_DEVICE;
234 #if defined(VDR_USER) 240 Args =
new cArgs(argv[0]);
250 static struct option long_options[] = {
251 {
"audio", required_argument, NULL,
'a' },
252 {
"cachedir", required_argument, NULL,
'c' | 0x100 },
253 {
"chartab", required_argument, NULL,
'c' | 0x200 },
254 {
"config", required_argument, NULL,
'c' },
255 {
"daemon", no_argument, NULL,
'd' },
256 {
"device", required_argument, NULL,
'D' },
257 {
"dirnames", required_argument, NULL,
'd' | 0x100 },
258 {
"edit", required_argument, NULL,
'e' | 0x100 },
259 {
"epgfile", required_argument, NULL,
'E' },
260 {
"filesize", required_argument, NULL,
'f' | 0x100 },
261 {
"genindex", required_argument, NULL,
'g' | 0x100 },
262 {
"grab", required_argument, NULL,
'g' },
263 {
"help", no_argument, NULL,
'h' },
264 {
"instance", required_argument, NULL,
'i' },
265 {
"lib", required_argument, NULL,
'L' },
266 {
"lirc", optional_argument, NULL,
'l' | 0x100 },
267 {
"localedir",required_argument, NULL,
'l' | 0x200 },
268 {
"log", required_argument, NULL,
'l' },
269 {
"mute", no_argument, NULL,
'm' },
270 {
"no-kbd", no_argument, NULL,
'n' | 0x100 },
271 {
"plugin", required_argument, NULL,
'P' },
272 {
"port", required_argument, NULL,
'p' },
273 {
"record", required_argument, NULL,
'r' },
274 {
"resdir", required_argument, NULL,
'r' | 0x100 },
275 {
"showargs", optional_argument, NULL,
's' | 0x200 },
276 {
"shutdown", required_argument, NULL,
's' },
277 {
"split", no_argument, NULL,
's' | 0x100 },
278 {
"terminal", required_argument, NULL,
't' },
279 {
"updindex", required_argument, NULL,
'u' | 0x200 },
280 {
"user", required_argument, NULL,
'u' },
281 {
"userdump", no_argument, NULL,
'u' | 0x100 },
282 {
"version", no_argument, NULL,
'V' },
283 {
"vfat", no_argument, NULL,
'v' | 0x100 },
284 {
"video", required_argument, NULL,
'v' },
285 {
"watchdog", required_argument, NULL,
'w' },
286 { NULL, no_argument, NULL, 0 }
290 while ((c = getopt_long(argc, argv,
"a:c:dD:e:E:g:hi:l:L:mp:P:r:s:t:u:v:Vw:", long_options, NULL)) != -1) {
292 case 'a': AudioCommand = optarg;
295 CacheDirectory = optarg;
298 OverrideCharacterTable = optarg;
300 case 'c': ConfigDirectory = optarg;
302 case 'd': DaemonMode =
true;
305 int n = atoi(optarg);
311 fprintf(stderr,
"vdr: invalid DVB device number: %s\n", optarg);
316 int n = strtol(s, &s, 10);
317 if (n <= 0 || n >= PATH_MAX) {
318 fprintf(stderr,
"vdr: invalid directory path length: %s\n", optarg);
325 fprintf(stderr,
"vdr: invalid delimiter: %s\n", optarg);
333 int n = strtol(s, &s, 10);
334 if (n <= 0 || n > NAME_MAX) {
335 fprintf(stderr,
"vdr: invalid directory name length: %s\n", optarg);
342 fprintf(stderr,
"vdr: invalid delimiter: %s\n", optarg);
349 int n = strtol(s, &s, 10);
350 if (n != 0 && n != 1) {
351 fprintf(stderr,
"vdr: invalid directory encoding: %s\n", optarg);
356 fprintf(stderr,
"vdr: unexpected data: %s\n", optarg);
363 case 'E': EpgDataFileName = (*optarg !=
'-' ? optarg : NULL);
376 case 'h': DisplayHelp =
true;
383 fprintf(stderr,
"vdr: invalid instance id: %s\n", optarg);
386 char *p = strchr(optarg,
'.');
390 int l = atoi(optarg);
391 if (0 <= l && l <= 3) {
397 if (0 <= l && l <= 7) {
398 int targets[] = { LOG_LOCAL0, LOG_LOCAL1, LOG_LOCAL2, LOG_LOCAL3, LOG_LOCAL4, LOG_LOCAL5, LOG_LOCAL6, LOG_LOCAL7 };
399 SysLogTarget = targets[l];
407 fprintf(stderr,
"vdr: invalid log level: %s\n", optarg);
410 case 'L':
if (access(optarg, R_OK | X_OK) == 0)
413 fprintf(stderr,
"vdr: can't access plugin directory: %s\n", optarg);
418 LircDevice = optarg ? optarg : LIRC_DEVICE;
421 if (access(optarg, R_OK | X_OK) == 0)
422 LocaleDirectory = optarg;
424 fprintf(stderr,
"vdr: can't access locale directory: %s\n", optarg);
428 case 'm': MuteAudio =
true;
434 SVDRPport = atoi(optarg);
436 fprintf(stderr,
"vdr: invalid port number: %s\n", optarg);
440 case 'P': PluginManager.
AddPlugin(optarg);
445 ResourceDirectory = optarg;
456 fprintf(stderr,
"vdr: can't read arguments from directory: %s\n", ArgsDir);
461 for (
int i = 1; i < c; i++)
462 printf(
"%s\n", v[i]);
465 case 't': Terminal = optarg;
466 if (access(Terminal, R_OK | W_OK) < 0) {
467 fprintf(stderr,
"vdr: can't access terminal: %s\n", Terminal);
471 case 'u':
if (*optarg)
479 case 'V': DisplayVersion =
true;
486 case 'v': VideoDirectory = optarg;
487 while (optarg && *optarg && optarg[strlen(optarg) - 1] ==
'/')
488 optarg[strlen(optarg) - 1] = 0;
492 int t = atoi(optarg);
498 fprintf(stderr,
"vdr: invalid watchdog timeout: %s\n", optarg);
506 if (VdrUser && geteuid() == 0) {
507 StartedAsRoot =
true;
508 if (strcmp(VdrUser,
"root")) {
511 if (!
SetUser(VdrUser, UserDump))
522 if (DisplayHelp || DisplayVersion) {
527 printf(
"Usage: vdr [OPTIONS]\n\n" 528 " -a CMD, --audio=CMD send Dolby Digital audio to stdin of command CMD\n" 529 " --cachedir=DIR save cache files in DIR (default: %s)\n" 530 " --chartab=CHARACTER_TABLE\n" 531 " set the character table to use for strings in the\n" 532 " DVB data stream that don't begin with a character\n" 533 " table indicator, but don't use the standard default\n" 534 " character table (for instance ISO-8859-9)\n" 535 " -c DIR, --config=DIR read config files from DIR (default: %s)\n" 536 " -d, --daemon run in daemon mode\n" 537 " -D NUM, --device=NUM use only the given DVB device (NUM = 0, 1, 2...)\n" 538 " there may be several -D options (default: all DVB\n" 539 " devices will be used)\n" 540 " --dirnames=PATH[,NAME[,ENC]]\n" 541 " set the maximum directory path length to PATH\n" 542 " (default: %d); if NAME is also given, it defines\n" 543 " the maximum directory name length (default: %d);\n" 544 " the optional ENC can be 0 or 1, and controls whether\n" 545 " special characters in directory names are encoded as\n" 546 " hex values (default: 0); if PATH or NAME are left\n" 547 " empty (as in \",,1\" to only set ENC), the defaults\n" 549 " --edit=REC cut recording REC and exit\n" 550 " -E FILE, --epgfile=FILE write the EPG data into the given FILE (default is\n" 551 " '%s' in the cache directory)\n" 552 " '-E-' disables this\n" 553 " if FILE is a directory, the default EPG file will be\n" 554 " created in that directory\n" 555 " --filesize=SIZE limit video files to SIZE bytes (default is %dM)\n" 556 " only useful in conjunction with --edit\n" 557 " --genindex=REC generate index for recording REC and exit\n" 558 " -g DIR, --grab=DIR write images from the SVDRP command GRAB into the\n" 559 " given DIR; DIR must be the full path name of an\n" 560 " existing directory, without any \"..\", double '/'\n" 561 " or symlinks (default: none, same as -g-)\n" 562 " -h, --help print this help and exit\n" 563 " -i ID, --instance=ID use ID as the id of this VDR instance (default: 0)\n" 564 " -l LEVEL, --log=LEVEL set log level (default: 3)\n" 565 " 0 = no logging, 1 = errors only,\n" 566 " 2 = errors and info, 3 = errors, info and debug\n" 567 " if logging should be done to LOG_LOCALn instead of\n" 568 " LOG_USER, add '.n' to LEVEL, as in 3.7 (n=0..7)\n" 569 " -L DIR, --lib=DIR search for plugins in DIR (default is %s)\n" 570 " --lirc[=PATH] use a LIRC remote control device, attached to PATH\n" 572 " --localedir=DIR search for locale files in DIR (default is\n" 574 " -m, --mute mute audio of the primary DVB device at startup\n" 575 " --no-kbd don't use the keyboard as an input device\n" 576 " -p PORT, --port=PORT use PORT for SVDRP (default: %d)\n" 577 " 0 turns off SVDRP\n" 578 " -P OPT, --plugin=OPT load a plugin defined by the given options\n" 579 " -r CMD, --record=CMD call CMD before and after a recording, and after\n" 580 " a recording has been edited or deleted\n" 581 " --resdir=DIR read resource files from DIR (default: %s)\n" 582 " -s CMD, --shutdown=CMD call CMD to shutdown the computer\n" 583 " --split split edited files at the editing marks (only\n" 584 " useful in conjunction with --edit)\n" 585 " --showargs[=DIR] print the arguments read from DIR and exit\n" 587 " -t TTY, --terminal=TTY controlling tty\n" 588 " -u USER, --user=USER run as user USER; only applicable if started as\n" 590 " --updindex=REC update index for recording REC and exit\n" 591 " --userdump allow coredumps if -u is given (debugging)\n" 592 " -v DIR, --video=DIR use DIR as video directory (default: %s)\n" 593 " -V, --version print version information and exit\n" 594 " --vfat for backwards compatibility (same as\n" 595 " --dirnames=250,40,1)\n" 596 " -w SEC, --watchdog=SEC activate the watchdog timer with a timeout of SEC\n" 597 " seconds (default: %d); '0' disables the watchdog\n" 619 printf(
"Plugins: vdr -P\"name [OPTIONS]\"\n\n");
620 for (
int i = 0; ; i++) {
625 if (DisplayHelp && help) {
640 openlog(
"vdr", LOG_CONS, SysLogTarget);
645 fprintf(stderr,
"vdr: can't access video directory %s\n", VideoDirectory);
652 if (daemon(1, 0) == -1) {
653 fprintf(stderr,
"vdr: %m\n");
660 stdin = freopen(Terminal,
"r", stdin);
661 stdout = freopen(Terminal,
"w", stdout);
662 stderr = freopen(Terminal,
"w", stderr);
664 tcgetattr(STDIN_FILENO, &savedTm);
668 if (StartedAsRoot && VdrUser)
669 isyslog(
"switched to user '%s'", VdrUser);
676 char *CodeSet = NULL;
677 if (setlocale(LC_CTYPE,
""))
678 CodeSet = nl_langinfo(CODESET);
680 char *LangEnv = getenv(
"LANG");
682 CodeSet = strchr(LangEnv,
'.');
689 isyslog(
"codeset is '%s' - %s", CodeSet, known ?
"known" :
"unknown");
692 #ifdef DEPRECATED_VDR_CHARSET_OVERRIDE 693 if (DeprecatedVdrCharsetOverride)
694 isyslog(
"use of environment variable VDR_CHARSET_OVERRIDE (%s) is deprecated!", DeprecatedVdrCharsetOverride);
696 if (OverrideCharacterTable) {
697 isyslog(
"override character table is '%s'", OverrideCharacterTable);
710 int LastTimerChannel = -1;
711 int PreviousChannel[2] = { 1, 1 };
712 int PreviousChannelIndex = 0;
713 time_t LastChannelChanged = time(NULL);
714 time_t LastInteract = 0;
715 int MaxLatencyTime = 0;
716 bool InhibitEpgScan =
false;
717 bool IsInfoMenu =
false;
718 cSkin *CurrentSkin = NULL;
727 if (!ConfigDirectory)
733 if (!ResourceDirectory)
755 const char *msg =
"no fonts available - OSD will not show any text!";
756 fprintf(stderr,
"vdr: %s\n", msg);
767 if (EpgDataFileName) {
768 const char *EpgDirectory = NULL;
770 EpgDirectory = EpgDataFileName;
773 else if (*EpgDataFileName !=
'/' && *EpgDataFileName !=
'.')
774 EpgDirectory = CacheDirectory;
779 EpgDataReader.
Start();
801 isyslog(
"trying device number %d instead", i + 1);
809 const char *msg =
"no primary device found - using first device!";
810 fprintf(stderr,
"vdr: %s\n", msg);
815 const char *msg =
"no primary device found - giving up!";
816 fprintf(stderr,
"vdr: %s\n", msg);
855 if (!DaemonMode && HasStdin && UseKbd)
893 if (signal(SIGHUP,
SignalHandler) == SIG_IGN) signal(SIGHUP, SIG_IGN);
894 if (signal(SIGINT,
SignalHandler) == SIG_IGN) signal(SIGINT, SIG_IGN);
895 if (signal(SIGTERM,
SignalHandler) == SIG_IGN) signal(SIGTERM, SIG_IGN);
896 if (signal(SIGPIPE,
SignalHandler) == SIG_IGN) signal(SIGPIPE, SIG_IGN);
897 if (WatchdogTimeout > 0)
898 if (signal(SIGALRM,
Watchdog) == SIG_IGN) signal(SIGALRM, SIG_IGN);
902 if (WatchdogTimeout > 0) {
903 dsyslog(
"setting watchdog timer to %d seconds", WatchdogTimeout);
904 alarm(WatchdogTimeout);
908 sd_notify(0,
"READY=1\nSTATUS=Ready");
913 #define DELETE_MENU ((IsInfoMenu &= (Menu == NULL)), delete Menu, Menu = NULL) 916 #ifdef DEBUGRINGBUFFERS 917 cRingBufferLinear::PrintDebugRBL();
922 time_t Now = time(NULL);
926 static time_t lastTime = 0;
930 if (Channel && (Channel->
Vpid() || Channel->
Apid(0) || Channel->
Dpid(0))) {
933 else if (LastTimerChannel > 0) {
940 LastTimerChannel = -1;
948 static time_t lastOsdSizeUpdate = 0;
949 if (Now != lastOsdSizeUpdate) {
951 lastOsdSizeUpdate = Now;
955 if (WatchdogTimeout > 0) {
956 int LatencyTime = WatchdogTimeout - alarm(WatchdogTimeout);
957 if (LatencyTime > MaxLatencyTime) {
958 MaxLatencyTime = LatencyTime;
959 dsyslog(
"max. latency time %d seconds", MaxLatencyTime);
965 static time_t ChannelSaveTimeout = 0;
966 static int TimerState = 0;
970 ChannelSaveTimeout = 1;
971 else if (modified && !ChannelSaveTimeout)
973 bool timeout = ChannelSaveTimeout == 1 || ChannelSaveTimeout && Now > ChannelSaveTimeout && !
cRecordControls::Active();
974 if ((modified || timeout) &&
Channels.
Lock(
false, 100)) {
978 ChannelSaveTimeout = 0;
980 bool renumber =
false;
990 isyslog(
"retuning due to modification of channel %d (%s)", Channel->Number(), Channel->Name());
1008 LastChannelChanged = Now;
1010 if (Now - LastChannelChanged >=
Setup.
ZapTimeout && LastChannel != PreviousChannel[PreviousChannelIndex])
1011 PreviousChannel[PreviousChannelIndex ^= 1] = LastChannel;
1028 static time_t LastTimerCheck = 0;
1030 InhibitEpgScan =
false;
1032 bool InVpsMargin =
false;
1033 bool NeedsTransponder =
false;
1040 else if (Timer->
Event()) {
1049 InVpsMargin = !Schedule;
1053 InhibitEpgScan |= InVpsMargin | NeedsTransponder;
1058 if (NeedsTransponder || InVpsMargin) {
1061 if (!Device && InVpsMargin)
1078 LastTimerCheck = Now;
1109 bool WasOpen = Interact != NULL;
1110 bool WasMenu = Interact && Interact->
IsMenu();
1148 #define DirectMainFunction(function)\ 1150 if (cControl::Control())\ 1151 cControl::Control()->Hide();\ 1152 Menu = new cMenuMain(function);\ 1153 key = kNone; } // nobody else needs to see this key 1174 esyslog(
"ERROR: unknown plugin '%s'", PluginName);
1261 isyslog(
"Power button pressed");
1295 if (state ==
osEnd) {
1338 case osEnd:
if (Interact == Menu)
1356 if (PreviousChannel[PreviousChannelIndex ^ 1] == LastChannel || LastChannel != PreviousChannel[0] && LastChannel != PreviousChannel[1])
1357 PreviousChannelIndex ^= 1;
1381 case kOk: LastChannel = -1;
break;
1395 if (!InhibitEpgScan)
1459 esyslog(
"emergency exit requested - shutting down");
1464 signal(SIGHUP, SIG_DFL);
1465 signal(SIGINT, SIG_DFL);
1466 signal(SIGTERM, SIG_DFL);
1467 signal(SIGPIPE, SIG_DFL);
1468 signal(SIGALRM, SIG_DFL);
1493 if (WatchdogTimeout > 0)
1494 dsyslog(
"max. latency time %d seconds", MaxLatencyTime);
1503 tcsetattr(STDIN_FILENO, TCSANOW, &savedTm);
static void Watchdog(int signum)
void ClearVanishedRecordings(void)
bool Replaying(void) const
Returns true if we are currently replaying.
int DeviceNumber(void) const
Returns the number of this device (0 ... numDevices - 1).
int Modified(void)
Returns 0 if no channels have been modified, 1 if an automatic modification has been made...
bool Update(bool Wait=false)
Triggers an update of the list of recordings, which will run as a separate thread if Wait is false...
void SetOccupied(int Seconds)
Sets the occupied timeout for this device to the given number of Seconds, This can be used to tune a ...
static void SetThemesDirectory(const char *ThemesDirectory)
static tChannelID FromString(const char *s)
bool ToggleMute(void)
Turns the volume off or on and returns the new mute state.
void CheckManualStart(int ManualStart)
Check whether the next timer is in ManualStart time window.
#define TIMERDEVICETIMEOUT
#define SHUTDOWNFORCEPROMPT
time_t EndTime(void) const
bool Confirm(const char *s, int Seconds=10, bool WaitForTimeout=false)
bool IsUserInactive(time_t AtTime=0)
Check whether VDR is in interactive mode or non-interactive mode (waiting for shutdown).
static bool Initialize(void)
Initializes the DVB devices.
bool LoadPlugins(bool Log=false)
bool Load(const char *SkinName)
virtual cOsdObject * GetInfo(void)
Returns an OSD object that displays information about the currently played programme.
void Shutdown(bool Log=false)
static void Shutdown(void)
virtual const char * Version(void)=0
cNestedItemList TimerCommands
static bool DropCaps(void)
#define RESTARTCANCELPROMPT
#define CHANNELMOD_TRANSP
int QueueMessage(eMessageType Type, const char *s, int Seconds=0, int Timeout=0)
Like Message(), but this function may be called from a background thread.
void ReportEpgBugFixStats(bool Force)
virtual cOsdObject * MainMenuAction(void)
static cDisplayVolume * Create(void)
void ProcessQueuedMessages(void)
Processes the first queued message, if any.
cTimer * GetMatch(time_t t)
const cEvent * Event(void) const
static void ChannelDataModified(cChannel *Channel)
bool Matches(time_t t=0, bool Directly=false, int Margin=0) const
void SetUserInactive(void)
Set VDR manually into non-interactive mode from now on.
static cDevice * GetDevice(int Index)
Gets the device with the given Index.
void SetInVpsMargin(bool InVpsMargin)
static cControl * Control(bool Hidden=false)
Returns the current replay control (if any) in case it is currently visible.
static void Process(time_t t)
bool Load(const char *FileName=NULL, bool AllowComments=false, bool MustExist=false)
static void Process(eKeys Key)
bool Update(void)
Update status display of the countdown.
bool EmergencyExitRequested(void)
Returns true if an emergency exit was requested.
static int NumDevices(void)
Returns the total number of devices.
void SetPending(bool Pending)
bool DoShutdown(bool Force)
Call the shutdown script with data of the next pending timer.
void Exit(int ExitCode)
Set VDR exit code and initiate end of VDR main loop.
bool InitializePlugins(void)
time_t StartTime(void) const
void MainThreadHook(void)
static bool SetKeepCaps(bool On)
static void SetEpgDataFileName(const char *FileName)
bool PresentSeenWithin(int Seconds) const
static void SetCommand(const char *Command)
static const cSchedules * Schedules(cSchedulesLock &SchedulesLock)
Caller must provide a cSchedulesLock which has to survive the entire time the returned cSchedules is ...
cNestedItemList RecordingCommands
#define MAXVIDEOFILESIZEDEFAULT
const cChannel * Channel(void) const
bool Load(const char *FileName, bool AllowComments=false, bool MustExist=false)
static cPositioner * GetPositioner(void)
Returns a previously created positioner.
static int CurrentVolume(void)
bool IsPrimaryDevice(void) const
#define TIMERLOOKAHEADTIME
virtual const char * Description(void)=0
virtual const char * CommandLineHelp(void)
bool Transferring(void) const
Returns true if we are currently in Transfer Mode.
static void Destroy(void)
void Start(const char *Message, int Seconds)
Start the 5 minute shutdown warning countdown.
bool Recording(void) const
static int CurrentChannel(void)
Returns the number of the current channel on the primary device.
const char * Name(void) const
static bool PutMacro(eKeys Key)
T * Next(const T *object) const
static bool BondDevices(const char *Bondings)
Bonds the devices as defined in the given Bondings string.
bool Modified(int &State)
Returns true if any of the timers have been modified, which is detected by State being different than...
void SetVolume(int Volume, bool Absolute=false)
Sets the volume to the given value, either absolutely or relative to the current volume.
int GetExitCode(void)
Get the currently set exit code of VDR.
static char * OverrideCharacterTable
virtual void Clear(void)
Free up all registered skins.
bool SwitchChannel(const cChannel *Channel, bool LiveView)
Switches the device to the given Channel, initiating transfer mode if necessary.
static bool SetUser(const char *UserName, bool UserDump)
char FontOsd[MAXFONTNAME]
void RemoveDeletedRecordings(void)
bool HasFlags(uint Flags) const
bool DoExit(void)
Check if an exit code was set, and VDR should exit.
int main(int argc, char *argv[])
static void SetName(const char *Name)
const cKeyMacro * Get(eKeys Key)
void bool Start(void)
Sets the description of this thread, which will be used when logging starting or stopping of the thre...
static void UpdateOsdSize(bool Force=false)
Inquires the actual size of the video display and adjusts the OSD and font sizes accordingly.
char ** GetArgv(void) const
cSourceParams SourceParams
bool Finished(bool &Error)
Returns true if all operations in the list have been finished.
virtual bool HasProgramme(void) const
Returns true if the device is currently showing any programme to the user, either through replaying o...
bool GenerateIndex(const char *FileName, bool Update)
Generates the index of the existing recording with the given FileName.
bool ConfirmShutdown(bool Ask)
Check for background activity that blocks shutdown.
bool Load(const char *FileName, bool AllowComments=false, bool MustExist=false)
bool Put(uint64_t Code, bool Repeat=false, bool Release=false)
bool ReadDirectory(const char *Directory)
static void Cleanup(bool Force=false)
cShutdownHandler ShutdownHandler
bool Lock(bool Write, int TimeoutMs=0)
static int IsOpen(void)
Returns true if there is currently a level 0 OSD open.
static const char * GetPlugin(void)
Returns the name of the plugin that was set with a previous call to PutMacro() or CallPlugin()...
static void SetSystemCharacterTable(const char *CharacterTable)
static bool WaitForAllDevicesReady(int Timeout=0)
Waits until all devices have become ready, or the given Timeout (seconds) has expired.
static tThreadId ThreadId(void)
static cDisplaySubtitleTracks * Create(void)
cRecordingsHandler RecordingsHandler
#define DEVICEREADYTIMEOUT
bool IsOpen(void)
Returns true if there is currently a skin display object active.
cChannel * GetByChannelID(tChannelID ChannelID, bool TryWithoutRid=false, bool TryWithoutPolarization=false)
static void Launch(cControl *Control)
virtual bool ProvidesTransponder(const cChannel *Channel) const
Returns true if this device can provide the transponder of the given Channel (which implies that it c...
static const char * LastReplayed(void)
eKeys Message(eMessageType Type, const char *s, int Seconds=0)
Displays the given message, either through a currently visible display object that is capable of doin...
bool SetSystemCharacterTable(const char *CharacterTable)
cRecordings DeletedRecordings
static bool HasPlugins(void)
static cDevice * GetDeviceForTransponder(const cChannel *Channel, int Priority)
Returns a device that is not currently "occupied" and can be tuned to the transponder of the given Ch...
virtual eOSState ProcessKey(eKeys Key)
bool HasSVDRPConnection(void)
const cSchedule * GetSchedule(tChannelID ChannelID) const
static void SetMainThreadId(void)
#define DEFAULTEPGDATAFILENAME
bool WaitForAllCamSlotsReady(int Timeout=0)
Waits until all CAM slots have become ready, or the given Timeout (seconds) has expired.
#define CHANNELMOD_RETUNE
static time_t LastActivity(void)
Absolute time when last key was delivered by Get().
static void Process(eKeys Key)
void DelAll(void)
Deletes/terminates all operations.
static void SetCacheDirectory(const char *Dir)
static void Process(eKeys Key)
static cString GetFontFileName(const char *FontName)
Returns the actual font file name for the given FontName.
cChannel * GetByNumber(int Number, int SkipGap=0)
bool CutRecording(const char *FileName)
eKeys GetKey(bool Wait=true)
static cDevice * PrimaryDevice(void)
Returns the primary device.
bool Load(const char *FileName)
void SetUserInactiveTimeout(int Seconds=-1, bool Force=false)
Set the time in the future when VDR will switch into non-interactive mode or power down...
void AddPlugin(const char *Args)
static bool SetPrimaryDevice(int n)
Sets the primary device to 'n'.
static cDisplayTracks * Create(void)
void StopReplay(void)
Stops the current replay session (if any).
virtual bool NeedsFastResponse(void)
bool Retry(time_t AtTime=0)
Check whether its time to re-try the shutdown.
cRecordings Recordings
Any access to Recordings that loops through the list of recordings needs to hold a thread lock on thi...
bool ConfirmRestart(bool Ask)
Check for background activity that blocks restart.
static void SetGrabImageDir(const char *GrabImageDir)
void SetDirectory(const char *Directory)
virtual bool IsTunedToTransponder(const cChannel *Channel) const
Returns true if this device is currently tuned to the given Channel's transponder.
static void SignalHandler(int signum)
static cPlugin * GetPlugin(int Index)
static void Shutdown(void)
Closes down all devices.
static cDevice * ActualDevice(void)
Returns the actual receiving device in case of Transfer Mode, or the primary device otherwise...
bool SwitchTo(int Number)
static cOsdObject * PluginOsdObject(void)
#define SHUTDOWNCANCELPROMPT
virtual bool HasDecoder(void) const
Tells whether this device has an MPEG decoder.
bool Load(const char *FileName)
bool Active(void)
Checks whether there is currently any operation running and starts the next one form the list if the ...
bool SeenWithin(int Seconds) const
static void MsgChannelChange(const cChannel *Channel)
bool Load(const char *FileName, bool AllowComments=false, bool MustExist=false)
void SetRetry(int Seconds)
Set shutdown retry so that VDR will not try to automatically shut down within Seconds.
char OSDTheme[MaxThemeName]
void SetShutdownCommand(const char *ShutdownCommand)
Set the command string for shutdown command.
#define MAXVIDEOFILESIZETS
char OSDSkin[MaxSkinName]
static bool PauseLiveVideo(void)
cSkin * Current(void)
Returns a pointer to the current skin.
static void SetResourceDirectory(const char *Dir)
bool SetCurrent(const char *Name=NULL)
Sets the current skin to the one indicated by name.
static void Shutdown(void)
#define DirectMainFunction(function)
void SetOverrideCharacterTable(const char *CharacterTable)
static void SetUseDevice(int n)
Sets the 'useDevice' flag of the given device.
void I18nInitialize(const char *LocaleDir)
Detects all available locales and loads the language names and codes.
The cDevice class is the base from which actual devices can be derived.
static void Shutdown(void)
Shuts down the OSD provider facility by deleting the current OSD provider.
static void DestroyPositioner(void)
Destroys a previously created positioner.
void Cancel(void)
Cancel the 5 minute shutdown warning countdown.
static void SetConfigDirectory(const char *Dir)
virtual void Hide(void)=0
bool Done(void)
Check if countdown timer has run out without canceling.
static bool Start(cTimer *Timer=NULL, bool Pause=false)