summaryrefslogtreecommitdiff
path: root/vdr.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <kls (at) cadsoft (dot) de>2004-10-24 18:00:00 +0200
committerKlaus Schmidinger <kls (at) cadsoft (dot) de>2004-10-24 18:00:00 +0200
commit6f93a5f7819b3c7030a5b199e502bedd4eb7844c (patch)
tree3be72385cb6433514bf6232f83a6aaacea8a3e76 /vdr.c
parentaf483c11aebd8146a978dba3d604bda0951e24ac (diff)
downloadvdr-patch-lnbsharing-6f93a5f7819b3c7030a5b199e502bedd4eb7844c.tar.gz
vdr-patch-lnbsharing-6f93a5f7819b3c7030a5b199e502bedd4eb7844c.tar.bz2
Version 1.3.14vdr-1.3.14
- Fixed detecting transponder lock in cDvbTuner (based on a patch from Stefan Meyknecht). - What was previously marked with WAIT_FOR_LOCK_AFTER_TUNING is now permanently active and uses a cCondVar to signal when a transponder is locked. - Added some missing 'const' to cChannel. - Added a sample setup for 'DisiCon-4 Single Cable Network' to 'diseqc.conf' (thanks to Oliver Endriss). - Fixed attaching a cPlayer to a cDevice, so that 'Operation not permitted' errors don't occur any more (thanks to Marco Schlüßler). - Fixed a case where the resultBuffer in cRemux ran full before getting a sync. - Removed the usleep() call from cDvbPlayer::Action() to make VDR run on NPTL systems (thanks to Alfred Zastrow). The NPTL check at startup has also been removed. - Taking the complete size of available data into account when deciding whether to clear the transfer buffer to avoid overflows (thanks to Reinhard Nissl). - Updated Romanian language texts and the iso8859-2 fonts (thanks to Lucian Muresan). - Now actually using the iso8859-15 fonts (thanks to Lucian Muresan). - Some minor code cleanups (thanks to Prakash K. Cheemplavam). - Fixed missing cleanup at program exit in case there is a problem with a plugin (thanks to Mattias Grönlund for pointing this out). - Increased the required free buffer space in the resultBuffer of cRemux to 2 * IPACKS to avoid a buffer overflow in case a cTS2PES writes one complete packet and then (within processing the same TS packet) wants to write another small packet. - Removed the signal handler and WakeUp() call from cThread (it is no longer needed). - Added some checks when canceling a thread and removed the usleep() in cThread::Start() (suggested by Ludwig Nussel). Also removed 'running' from cThread and using only childTid to indicate whether a thread is actually running. - Added cCondWait::Sleep() and using it to replace all usleep() calls (based on a suggestion by Werner Fink). - Only assigning events to timers if the related schedule has actually been modified. - When searching for the present event, the running status is now only taken into account if the event has been "seen" within the past 30 seconds. This avoids shortly seeing the wrong events in the channel display when switching to a channel that hasn't been tuned to in a while.
Diffstat (limited to 'vdr.c')
-rw-r--r--vdr.c68
1 files changed, 29 insertions, 39 deletions
diff --git a/vdr.c b/vdr.c
index 6d76f17..033f186 100644
--- a/vdr.c
+++ b/vdr.c
@@ -22,7 +22,7 @@
*
* The project's page is at http://www.cadsoft.de/vdr
*
- * $Id: vdr.c 1.187 2004/10/17 11:50:21 kls Exp $
+ * $Id: vdr.c 1.190 2004/10/24 14:01:11 kls Exp $
*/
#include <getopt.h>
@@ -64,6 +64,8 @@
#define MANUALSTART 600 // seconds the next timer must be in the future to assume manual start
#define CHANNELSAVEDELTA 600 // seconds before saving channels.conf after automatic modifications
+#define EXIT(v) { ExitCode = (v); goto Exit; }
+
static int Interrupted = 0;
static void SignalHandler(int signum)
@@ -85,17 +87,6 @@ static void Watchdog(int signum)
int main(int argc, char *argv[])
{
-#ifdef _CS_GNU_LIBPTHREAD_VERSION
- // Check for NPTL and exit if present - VDR apparently doesn't run well with NPTL:
- char LibPthreadVersion[128];
- if (confstr(_CS_GNU_LIBPTHREAD_VERSION, LibPthreadVersion, sizeof(LibPthreadVersion)) > 0) {
- if (strstr(LibPthreadVersion, "NPTL")) {
- fprintf(stderr, "vdr: please turn off NPTL by setting 'export LD_ASSUME_KERNEL=2.4.1' before starting VDR\n");
- return 2;
- }
- }
-#endif
-
// Check for UTF-8 and exit if present - asprintf() will fail if it encounters 8 bit ASCII codes
char *LangEnv;
if ((LangEnv = getenv("LANG")) != NULL && strcasestr(LangEnv, "utf") ||
@@ -133,6 +124,7 @@ int main(int argc, char *argv[])
const char *Terminal = NULL;
const char *Shutdown = NULL;
cPluginManager PluginManager(DEFAULTPLUGINDIR);
+ int ExitCode = 0;
static struct option long_options[] = {
{ "audio", required_argument, NULL, 'a' },
@@ -358,7 +350,7 @@ int main(int argc, char *argv[])
// Load plugins:
if (!PluginManager.LoadPlugins(true))
- return 2;
+ EXIT(2);
// Configuration data:
@@ -380,7 +372,7 @@ int main(int argc, char *argv[])
Keys.Load(AddDirectory(ConfigDirectory, "remote.conf")) &&
KeyMacros.Load(AddDirectory(ConfigDirectory, "keymacros.conf"), true)
))
- return 2;
+ EXIT(2);
cFont::SetCode(I18nCharSets()[Setup.OSDLanguage]);
@@ -402,7 +394,7 @@ int main(int argc, char *argv[])
// Initialize plugins:
if (!PluginManager.InitializePlugins())
- return 2;
+ EXIT(2);
// Primary device:
@@ -425,12 +417,12 @@ int main(int argc, char *argv[])
fprintf(stderr, "vdr: %s\n", msg);
esyslog("ERROR: %s", msg);
if (!cDevice::SetPrimaryDevice(1))
- return 2;
+ EXIT(2);
if (!cDevice::PrimaryDevice()) {
const char *msg = "no primary device found - giving up!";
fprintf(stderr, "vdr: %s\n", msg);
esyslog("ERROR: %s", msg);
- return 2;
+ EXIT(2);
}
}
}
@@ -442,7 +434,7 @@ int main(int argc, char *argv[])
// Start plugins:
if (!PluginManager.StartPlugins())
- return 2;
+ EXIT(2);
// Skins:
@@ -498,18 +490,18 @@ int main(int argc, char *argv[])
// Main program loop:
- cOsdObject *Menu = NULL;
- cOsdObject *Temp = NULL;
- int LastChannel = -1;
- int LastTimerChannel = -1;
- int PreviousChannel[2] = { 1, 1 };
- int PreviousChannelIndex = 0;
- time_t LastChannelChanged = time(NULL);
- time_t LastActivity = 0;
- int MaxLatencyTime = 0;
- bool ForceShutdown = false;
- bool UserShutdown = false;
- bool TimerInVpsMargin = false;
+ static cOsdObject *Menu = NULL;
+ static cOsdObject *Temp = NULL;
+ static int LastChannel = -1;
+ static int LastTimerChannel = -1;
+ static int PreviousChannel[2] = { 1, 1 };
+ static int PreviousChannelIndex = 0;
+ static time_t LastChannelChanged = time(NULL);
+ static time_t LastActivity = 0;
+ static int MaxLatencyTime = 0;
+ static bool ForceShutdown = false;
+ static bool UserShutdown = false;
+ static bool TimerInVpsMargin = false;
while (!Interrupted) {
// Handle emergency exits:
@@ -589,14 +581,9 @@ int main(int argc, char *argv[])
// Timers and Recordings:
if (!Timers.BeingEdited()) {
// Assign events to timers:
- if (time(NULL) - LastActivity > 10) {
- static time_t LastSetEvents = 0;//XXX trigger by actual EPG data modification???
- if (time(NULL) - LastSetEvents > 5) {
- Timers.SetEvents();
- LastSetEvents = time(NULL);
- }
- }
- time_t Now = time(NULL); // must do all following calls with the exact same time!
+ Timers.SetEvents();
+ // Must do all following calls with the exact same time!
+ time_t Now = time(NULL);
// Process ongoing recordings:
cRecordControls::Process(Now);
// Start new recordings:
@@ -898,6 +885,9 @@ int main(int argc, char *argv[])
}
if (Interrupted)
isyslog("caught signal %d", Interrupted);
+
+Exit:
+
cRecordControls::Shutdown();
cCutter::Stop();
delete Menu;
@@ -924,5 +914,5 @@ int main(int argc, char *argv[])
esyslog("emergency exit!");
return 1;
}
- return 0;
+ return ExitCode;
}