Version 1.1.2

- Changed the cPlugin::Start() function to return a boolean value that indicates
  if the plugin will not be able to perform its task (suggested by Stefan Huelswitt).
- Added the cPlugin::Housekeeping() function (suggested by Stefan Huelswitt).
- Updated channels.conf.cable (thanks to Uwe Scheffler).
- Added 'insert' capabilities to cList (suggested by Stefan Huelswitt).
- Changed the 'package' target in the plugin's Makefile to produce a package that
  expands to a directory with just the plugin name and version number (suggested
  by Stefan Huelswitt).
- Made the config directory available to plugins (suggested by Stefan Huelswitt).
  See PLUGINS.html, section "Configuration files" for details.
- Improved the [eid]syslog() macros, so that the LOG_... macros don't need to be
  given any more.
This commit is contained in:
Klaus Schmidinger 2002-05-13 18:00:00 +02:00
parent 803c6c6bf6
commit d07e3829f7
31 changed files with 556 additions and 301 deletions

View File

@ -130,6 +130,13 @@ Stefan Huelswitt <huels@iname.com>
doing shutdown or housekeeping
for making the cList template class avoid ambiguities in case one defines a "list of
lists"
for suggesting to make the cPlugin::Start() function return a boolean value that
indicates if the plugin will not be able to perform its task
for suggesting to add the cPlugin::Housekeeping() function
for suggesting to add 'insert' capabilities to cList
for suggesting to make 'package' target in the plugin's Makefile produce a package that
expands to a directory with just the plugin name and version number
for suggesting to make the config directory available to plugins
Ulrich Röder <roeder@efr-net.de>
for pointing out that there are channels that have a symbol rate higher than

15
HISTORY
View File

@ -1269,3 +1269,18 @@ Video Disk Recorder Revision History
- Fixed logging error message for unknown config parameters in plugins.
- Rearranged cleanup sequence at the end of the main program.
- Adapted PLUGINS.html to use the actual code examples from the 'hello' plugin.
2002-05-13: Version 1.1.2
- Changed the cPlugin::Start() function to return a boolean value that indicates
if the plugin will not be able to perform its task (suggested by Stefan Huelswitt).
- Added the cPlugin::Housekeeping() function (suggested by Stefan Huelswitt).
- Updated channels.conf.cable (thanks to Uwe Scheffler).
- Added 'insert' capabilities to cList (suggested by Stefan Huelswitt).
- Changed the 'package' target in the plugin's Makefile to produce a package that
expands to a directory with just the plugin name and version number (suggested
by Stefan Huelswitt).
- Made the config directory available to plugins (suggested by Stefan Huelswitt).
See PLUGINS.html, section "Configuration files" for details.
- Improved the [eid]syslog() macros, so that the LOG_... macros don't need to be
given any more.

View File

@ -16,9 +16,12 @@ This document describes the "outside" interface of the plugin system.
It handles everything necessary for a plugin to get hooked into the core
VDR program and present itself to the user.
<p>
<!--X1.1.1--><table width=100%><tr><td bgcolor=red>&nbsp;</td><td width=100%>
<!--X1.1.1--><table width=100%><tr><td bgcolor=cyan>&nbsp;</td><td width=100%>
Important modifications introduced in version 1.1.1 are marked like this.
<!--X1.1.1--></td></tr></table>
<!--X1.1.2--><table width=100%><tr><td bgcolor=red>&nbsp;</td><td width=100%>
Important modifications introduced in version 1.1.2 are marked like this.
<!--X1.1.2--></td></tr></table>
<!--<p>TODO: Link to the document about VDR base classes to use when implementing actual functionality (yet to be written).-->
<hr><h2>Quick start</h2>
@ -114,21 +117,25 @@ from the web, it will typically have a name like
<p>
and will unpack into a directory named
<p>
<tt>vdr-hello-0.0.1</tt>
<!--X1.1.2--><table width=100%><tr><td bgcolor=red>&nbsp;</td><td width=100%>
<tt>hello-0.0.1</tt>
<!--X1.1.2--></td></tr></table>
<p>
To use the <tt>plugins</tt> and <tt>plugins-clean</tt> targets from the VDR <tt>Makefile</tt>
you need to unpack such an archive into the <tt>VDR/PLUGINS/SRC</tt> directory and
create a symbolic link with the basic plugin name, as in
<!--X1.1.2--><table width=100%><tr><td bgcolor=red>&nbsp;</td><td width=100%>
<p><table><tr><td bgcolor=#F0F0F0><pre><br>
ln -s vdr-hello-0.0.1 hello
ln -s hello-0.0.1 hello
</pre></td></tr></table><p>
Since the VDR <tt>Makefile</tt> only searches for directories with names consisting
of only lowercase characters and digits, it will only follow the symbolic links, which
should lead to the current version of the plugin you want to use. This way you can
have several different versions of a plugin source (like <tt>vdr-hello-0.0.1</tt> and
<tt>vdr-hello-0.0.2</tt>) and define which one to actually use through the symbolic link.
have several different versions of a plugin source (like <tt>hello-0.0.1</tt> and
<tt>hello-0.0.2</tt>) and define which one to actually use through the symbolic link.
<!--X1.1.2--></td></tr></table>
<a name="Initializing a new plugin directory"><hr><h2>Initializing a new plugin directory</h2>
@ -184,7 +191,7 @@ its memory. You don't need to worry about the details behind all this.
If your plugin requires additional source files, simply add them to your plugin's
source directory and adjust the <tt>Makefile</tt> accordingly.
<p>
<!--X1.1.1--><table width=100%><tr><td bgcolor=red>&nbsp;</td><td width=100%>
<!--X1.1.1--><table width=100%><tr><td bgcolor=cyan>&nbsp;</td><td width=100%>
Header files usually contain preprocessor statements that prevent the same
file (or rather its contents, to be precise) from being included more than once, like
@ -403,9 +410,11 @@ If a plugin implements a function that runs in the background (presumably in a
thread of its own), or wants to make use of <a href="#Internationalization">internationalization</a>,
it needs to implement the function
<!--X1.1.2--><table width=100%><tr><td bgcolor=red>&nbsp;</td><td width=100%>
<p><table><tr><td bgcolor=#F0F0F0><pre><br>
virtual void Start(void);
virtual bool Start(void);
</pre></td></tr></table><p>
<!--X1.1.2--></td></tr></table>
which is called once for each plugin at program startup.
Inside this function the plugin must set up everything necessary to perform
@ -413,6 +422,13 @@ its task. This may, for instance, be a thread that collects data from the DVB
stream, which is later presented to the user via a function that is available
from the main menu.
<p>
<!--X1.1.2--><table width=100%><tr><td bgcolor=red>&nbsp;</td><td width=100%>
A return value of <i>false</i> indicates that something has gone wrong and the
plugin will not be able to perform its task. In that case, the plugin should
write a proper error message to the log file. The first plugin that returns
<i>false</i> from its <tt>Start()</tt> function will cause VDR to exit.
<!--X1.1.2--></td></tr></table>
<p>
If the plugin doesn't implement any background functionality or internationalized
texts, it doesn't need to implement this function.
@ -470,7 +486,34 @@ interaction is possible. If a specific action takes longer than a few seconds,
the plugin should launch a separate thread to do this.
</b>
<hr><h2>Setup parameters</h2>
<!--X1.1.2--><table width=100%><tr><td bgcolor=red>&nbsp;</td><td width=100%>
<hr><h2>Housekeeping</h2>
<center><i><b>Chores, chores...</b></i></center><p>
From time to time a plugin may want to do some regular tasks, like cleaning
up some files or other things. In order to do this it can implement the function
<p><table><tr><td bgcolor=#F0F0F0><pre><br>
virtual void Housekeeping(void);
</pre></td></tr></table><p>
which gets called when VDR is otherwise idle. The intervals between subsequent
calls to this function are not defined. There may be several hours between two
calls (if, for instance, there are recordings or replays going on) or they may
be as close as ten seconds. The only thing that is guaranteed is that there are
at least ten seconds between two subsequent calls to the <tt>Housekeeping()</tt>
function of the same plugin.
<p>
<b>
It is very important that a call to <tt>Housekeeping()</tt> returns as soon
as possible! As long as the program stays inside this function, no other user
interaction is possible. If a specific action takes longer than a few seconds,
the plugin should launch a separate thread to do this.
</b>
<!--X1.1.2--></td></tr></table>
<a name="Setup parameters"><hr><h2>Setup parameters</h2>
<center><i><b>Remember me...</b></i></center><p>
@ -490,7 +533,7 @@ previously stored in the global setup data (see below). It shall return
<i>true</i> if the parameter was parsed correctly, <i>false</i> in case of
an error. If <i>false</i> is returned, an error message will be written to
the log file (and program execution will continue).
<!--X1.1.1--><table width=100%><tr><td bgcolor=red>&nbsp;</td><td width=100%>
<!--X1.1.1--><table width=100%><tr><td bgcolor=cyan>&nbsp;</td><td width=100%>
A possible implementation of <tt>SetupParse()</tt> could look like this:
<p><table><tr><td bgcolor=#F0F0F0><pre><br>
@ -545,7 +588,7 @@ needs setup parameters that are not directly user adjustable. It can use
<tt>SetupStore()</tt> and <tt>SetupParse()</tt> without presenting these
parameters to the user.
<!--X1.1.1--><table width=100%><tr><td bgcolor=red>&nbsp;</td><td width=100%>
<!--X1.1.1--><table width=100%><tr><td bgcolor=cyan>&nbsp;</td><td width=100%>
<a name="The Setup menu"><hr><h2>The Setup menu</h2>
<center><i><b>Have it your way!</b></i></center><p>
@ -605,6 +648,63 @@ your setup parameters and use that one to copy all parameters with one single st
(like VDR does with its cSetup class).
<!--X1.1.1--></td></tr></table>
<!--X1.1.2--><table width=100%><tr><td bgcolor=red>&nbsp;</td><td width=100%>
<hr><h2>Configuration files</h2>
<center><i><b>I want my own stuff!</b></i></center><p>
There may be situations where a plugin requires configuration files of its own, maybe
for data that can't be stored in the simple <a href="#Setup parameters">setup parameters</a>
of VDR, or maybe because it needs to launch other programs that simply need a separate
configuration file. While the plugin is free to store such files anywhere it
sees fit, it might be a good idea to put them in a common place, preferably
where other configuration data already exists. VDR provides the function
<p><table><tr><td bgcolor=#F0F0F0><pre><br>
const char *ConfigDirectory(const char *PluginName = NULL);
</pre></td></tr></table><p>
which returns a string containing the directory that VDR uses for its own configuration
files (defined through the <tt><b>-c</b></tt> option in the call to VDR), extended by
<tt>"/plugins"</tt>. So assuming the VDR configuration directory is <tt>/video</tt>
(the default if no <tt><b>-c</b></tt> or <tt><b>-v</b></tt> option is given),
a call to <tt>ConfigDirectory()</tt> will return <tt>/video/plugins</tt>. The first
call to <tt>ConfigDirectory()</tt> will automatically make sure that the <tt>plugins</tt>
subdirectory will exist. If, for some reason, this cannot be achieved, <tt>NULL</tt>
will be returned.
<p>
The additional <tt>plugins</tt> directory is used to keep files from plugins apart
from those of VDR itself, making sure there will be no name clashes. If a plugin
needs only one extra configuration file, it is suggested that this file be named
<tt>name.conf</tt>, where <i>name</i> shall be the name of the plugin.
<p>
If a plugin needs more than one such file, it is suggested that the plugin stores
these in a subdirectory of its own, named after the plugin. To easily get such a name
the <tt>ConfigDirectory()</tt> function can be given an additional string that will
be appended to the returned directory name, as in
<p><table><tr><td bgcolor=#F0F0F0><pre><br>
const char *MyConfigDir = ConfigDirectory(Name());
</pre></td></tr></table><p>
where <tt>Name()</tt> is the member function of the plugin class that returns the
plugin's name. Again, VDR will make sure that the requested directory will exist
(or return <tt>NULL</tt> in case of an error).
<p>
<b>
The returned string is statically allocated and will be overwritten by subsequent
calls to ConfigDirectory()!
</b>
<p>
The <tt>ConfigDirectory()</tt> function is a static member function of the <tt>cPlugin</tt>
class. This allows it to be called even from outside any member function of the derived
plugin class, by writing
<p><table><tr><td bgcolor=#F0F0F0><pre><br>
const char *MyConfigDir = cPlugin::ConfigDirectory();
</pre></td></tr></table><p>
<!--X1.1.2--></td></tr></table>
<a name="Internationalization"><hr><h2>Internationalization</h2>
<center><i><b>Welcome to Babylon!</b></i></center><p>

View File

@ -8,3 +8,9 @@ VDR Plugin 'hello' Revision History
2002-05-11: Version 0.0.2
- Added setup parameters and a Setup menu to adjust them.
2002-05-12: Version 0.0.3
- Changed return type of cPluginHello::Start().
- Added cPluginHello::Housekeeping().
- Modified package generation.

View File

@ -1,7 +1,7 @@
#
# Makefile for a Video Disk Recorder plugin
#
# $Id: Makefile 1.1 2002/05/09 15:17:44 kls Exp $
# $Id: Makefile 1.2 2002/05/12 15:09:07 kls Exp $
# The official name of this plugin.
# This name will be used in the '-P...' option of VDR to load the plugin.
@ -27,7 +27,8 @@ VDRVERSION = `grep 'define VDRVERSION ' $(VDRDIR)/config.h | awk '{ print $$3 }'
### The name of the distribution archive:
ARCHIVE = vdr-$(PLUGIN)-$(VERSION)
ARCHIVE = $(PLUGIN)-$(VERSION)
PACKAGE = vdr-$(ARCHIVE)
### Includes and Defines (add further entries here):
@ -70,9 +71,9 @@ package: clean
@-rm -rf $(TMPDIR)/$(ARCHIVE)
@mkdir $(TMPDIR)/$(ARCHIVE)
@cp -a * $(TMPDIR)/$(ARCHIVE)
@tar czf $(ARCHIVE).tgz -C $(TMPDIR) $(ARCHIVE)
@tar czf $(PACKAGE).tgz -C $(TMPDIR) $(ARCHIVE)
@-rm -rf $(TMPDIR)/$(ARCHIVE)
@echo Distribution archive created as $(ARCHIVE).tgz
@echo Distribution package created as $(PACKAGE).tgz
clean:
@-rm -f $(OBJS) $(DEPFILE) *.so *.tgz core* *~

View File

@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
* $Id: hello.c 1.2 2002/05/11 14:17:20 kls Exp $
* $Id: hello.c 1.4 2002/05/12 10:18:59 kls Exp $
*/
#include <getopt.h>
@ -11,7 +11,7 @@
#include <vdr/plugin.h>
#include "i18n.h"
static const char *VERSION = "0.0.2";
static const char *VERSION = "0.0.3";
static const char *DESCRIPTION = "A friendly greeting";
static const char *MAINMENUENTRY = "Hello";
@ -27,7 +27,8 @@ public:
virtual const char *Description(void) { return tr(DESCRIPTION); }
virtual const char *CommandLineHelp(void);
virtual bool ProcessArgs(int argc, char *argv[]);
virtual void Start(void);
virtual bool Start(void);
virtual void Housekeeping(void);
virtual const char *MainMenuEntry(void) { return tr(MAINMENUENTRY); }
virtual cOsdMenu *MainMenuAction(void);
virtual cMenuSetupPage *SetupMenu(void);
@ -110,10 +111,16 @@ bool cPluginHello::ProcessArgs(int argc, char *argv[])
return true;
}
void cPluginHello::Start(void)
bool cPluginHello::Start(void)
{
// Start any background activities the plugin shall perform.
RegisterI18n(Phrases);
return true;
}
void cPluginHello::Housekeeping(void)
{
// Perform any cleanup or other regular tasks.
}
cOsdMenu *cPluginHello::MainMenuAction(void)

View File

@ -45,7 +45,7 @@ Disney Channel:402:C:0:6900:1030:1034:0:101:34
Discovery Channel:378:C:0:6900:1791:1792:0:101:14
Fox Kids:354:C:0:6900:1279:1280:0:101:28
Junior:354:C:0:6900:255:256:0:101:19
K-TOON:354:C:0:6900:0:0:0:101:12
K-TOON:354:C:0:6900:511:512:0:101:12
GOLDSTAR TV:354:C:0:6900:3839:3840:0:101:518
CLASSICA:354:C:0:6900:767:768:0:101:15
:Mediavision
@ -54,7 +54,7 @@ Fashion TV:346:h:0:6900:821:822:0:101:50702
Einstein:346:h:0:6900:623:624:0:101:50719
Extreme Sport:346:h:0:6900:801:802:0:101:50700
LANDSCAPE:346:h:0:6900:831:832:0:101:50703
Single TV:346:h:0:6900:621:622:0:101:50706
Single TV:346:h:0:6900:525:526:0:101:50706
Leitseite:346:h:0:6900:2254:0:0:0:5004
BET ON JAZZ:346:h:0:6900:841:842:0:101:50704
:Digit. Bouquet"Kabel Berlin"
@ -84,9 +84,28 @@ ZEE TV:442:h:0:6900:517:773:0:101:53301
NTV i:442:h:0:6900:514:515:0:101:53302
ATV:434:h:0:6900:631:632:0:0:53203
TW1:610:h:0:6900:6106:6107:0:0:6106
Channel71:386:C:0:6900:1791:1792:0:101:33
:Premiere Sport
PREMIERE SPORT 1:362:C:0:6900:255:256,257:0:101:17
PREMIERE SPORT 2:378:C:0:6900:3839:3840,3841:0:101:27
:Premiere Bundesliga
Bundesliga Konferenz:378:C:0:6900:2303:2304,2305:0:101:210
Bundesliga Spiel 1:362:C:0:6900:255:256,257:0:101:17
Bundesliga Spiel 2:362:C:0:6900:2047:2048,2049:0:101:240
Bundesliga Spiel 3:362:C:0:6900:2303:2304,2305:0:101:241
Bundesliga Spiel 4:362:C:0:6900:2559:2560,2561:0:101:242
Bundesliga Spiel 5:362:C:0:6900:2815:2816,2817:0:101:243
Bundesliga Spiel 6:362:C:0:6900:3071:3072,3073:0:101:244
Bundesliga Spiel 7:362:C:0:6900:3327:3328,3329:0:101:245
Bundesliga Spiel 8:378:C:0:6900:3071:3072,3073:0:101:208
Bundesliga Spiel 9:378:C:0:6900:3327:3328,3329:0:101:209
:Premiere Formel 1
F1 Multi:362:h:0:6900:255:256,257:0:101:17
F1 Supersignal:386:h:0:6900:255:256,257:0:101:211
F1 Cockpit:386:h:0:6900:511:512,513:0:101:212
F1 Boxen:386:h:0:6900:767:768,769:0:101:213
F1 Verfolger:386:h:0:6900:1023:1024,1025:0:101:214
F1 Info:386:h:0:6900:1279:1280,1281:0:101:215
:Premiere Direkt 1
PREMIERE DIREKT 1A:362:C:0:6900:1023:1024,1025:0:101:182
PREMIERE DIREKT 1B:378:C:0:6900:511:512,513:0:101:177

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: config.c 1.100 2002/05/11 12:05:22 kls Exp $
* $Id: config.c 1.101 2002/05/13 16:28:12 kls Exp $
*/
#include "config.h"
@ -72,7 +72,7 @@ void cKeys::SetDummyValues(void)
bool cKeys::Load(const char *FileName)
{
isyslog(LOG_INFO, "loading %s", FileName);
isyslog("loading %s", FileName);
bool result = false;
if (FileName)
fileName = strdup(FileName);
@ -105,7 +105,7 @@ bool cKeys::Load(const char *FileName)
}
}
if (Name) {
esyslog(LOG_ERR, "unknown key in %s, line %d\n", fileName, line);
esyslog("unknown key in %s, line %d\n", fileName, line);
result = false;
break;
}
@ -113,7 +113,7 @@ bool cKeys::Load(const char *FileName)
}
continue;
}
esyslog(LOG_ERR, "error in %s, line %d\n", fileName, line);
esyslog("error in %s, line %d\n", fileName, line);
result = false;
break;
}
@ -121,10 +121,10 @@ bool cKeys::Load(const char *FileName)
fclose(f);
}
else
esyslog(LOG_ERR, "can't open '%s'\n", fileName);
esyslog("can't open '%s'\n", fileName);
}
else
esyslog(LOG_ERR, "no key configuration file name supplied!\n");
esyslog("no key configuration file name supplied!\n");
return result;
}
@ -299,7 +299,7 @@ bool cChannel::Switch(cDvbApi *DvbApi, bool Log)
DvbApi = cDvbApi::PrimaryDvbApi;
if (!DvbApi->Recording() && !groupSep) {
if (Log)
isyslog(LOG_INFO, "switching to channel %d", number);
isyslog("switching to channel %d", number);
for (int i = 3; i--;) {
switch (DvbApi->SetChannel(number, frequency, polarization, diseqc, srate, vpid, apid1, apid2, dpid1, dpid2, tpid, ca, pnr)) {
case scrOk: return true;
@ -308,7 +308,7 @@ bool cChannel::Switch(cDvbApi *DvbApi, bool Log)
return false;
case scrFailed: break; // loop will retry
}
esyslog(LOG_ERR, "retrying");
esyslog("retrying");
}
return false;
}
@ -637,7 +637,7 @@ time_t cTimer::StopTime(void)
void cTimer::SetRecording(bool Recording)
{
recording = Recording;
isyslog(LOG_INFO, "timer %d %s", Index() + 1, recording ? "start" : "stop");
isyslog("timer %d %s", Index() + 1, recording ? "start" : "stop");
}
void cTimer::SetPending(bool Pending)
@ -684,7 +684,7 @@ bool cCommand::Parse(const char *s)
const char *cCommand::Execute(void)
{
dsyslog(LOG_INFO, "executing command '%s'", command);
dsyslog("executing command '%s'", command);
delete result;
result = NULL;
FILE *p = popen(command, "r");
@ -701,7 +701,7 @@ const char *cCommand::Execute(void)
pclose(p);
}
else
esyslog(LOG_ERR, "ERROR: can't open pipe for command '%s'", command);
esyslog("ERROR: can't open pipe for command '%s'", command);
return result;
}
@ -1084,7 +1084,7 @@ bool cSetup::Load(const char *FileName)
error = true;
}
if (error) {
esyslog(LOG_ERR, "ERROR: unknown config parameter: %s%s%s = %s", l->Plugin() ? l->Plugin() : "", l->Plugin() ? "." : "", l->Name(), l->Value());
esyslog("ERROR: unknown config parameter: %s%s%s = %s", l->Plugin() ? l->Plugin() : "", l->Plugin() ? "." : "", l->Name(), l->Value());
result = false;
}
}
@ -1225,7 +1225,7 @@ bool cSetup::Save(void)
Sort();
if (cConfig<cSetupLine>::Save()) {
isyslog(LOG_INFO, "saved setup to %s", FileName());
isyslog("saved setup to %s", FileName());
return true;
}
return false;

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: config.h 1.114 2002/05/10 13:48:00 kls Exp $
* $Id: config.h 1.116 2002/05/13 16:28:16 kls Exp $
*/
#ifndef __CONFIG_H
@ -19,7 +19,7 @@
#include "eit.h"
#include "tools.h"
#define VDRVERSION "1.1.1"
#define VDRVERSION "1.1.2"
#define MAXPRIORITY 99
#define MAXLIFETIME 99
@ -227,7 +227,7 @@ public:
fileName = strdup(FileName);
bool result = false;
if (access(FileName, F_OK) == 0) {
isyslog(LOG_INFO, "loading %s", FileName);
isyslog("loading %s", FileName);
FILE *f = fopen(fileName, "r");
if (f) {
int line = 0;
@ -245,7 +245,7 @@ public:
if (l->Parse(buffer))
Add(l);
else {
esyslog(LOG_ERR, "error in %s, line %d\n", fileName, line);
esyslog("error in %s, line %d\n", fileName, line);
delete l;
result = false;
break;

126
dvbapi.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: dvbapi.c 1.174 2002/05/03 15:59:32 kls Exp $
* $Id: dvbapi.c 1.175 2002/05/13 16:29:17 kls Exp $
*/
#include "dvbapi.h"
@ -137,7 +137,7 @@ cIndexFile::cIndexFile(const char *FileName, bool Record)
delta = buf.st_size % sizeof(tIndex);
if (delta) {
delta = sizeof(tIndex) - delta;
esyslog(LOG_ERR, "ERROR: invalid file size (%ld) in '%s'", buf.st_size, fileName);
esyslog("ERROR: invalid file size (%ld) in '%s'", buf.st_size, fileName);
}
last = (buf.st_size + delta) / sizeof(tIndex) - 1;
if (!Record && last >= 0) {
@ -147,7 +147,7 @@ cIndexFile::cIndexFile(const char *FileName, bool Record)
f = open(fileName, O_RDONLY);
if (f >= 0) {
if ((int)safe_read(f, index, buf.st_size) != buf.st_size) {
esyslog(LOG_ERR, "ERROR: can't read from file '%s'", fileName);
esyslog("ERROR: can't read from file '%s'", fileName);
delete index;
index = NULL;
close(f);
@ -159,18 +159,18 @@ cIndexFile::cIndexFile(const char *FileName, bool Record)
LOG_ERROR_STR(fileName);
}
else
esyslog(LOG_ERR, "ERROR: can't allocate %d bytes for index '%s'", size * sizeof(tIndex), fileName);
esyslog("ERROR: can't allocate %d bytes for index '%s'", size * sizeof(tIndex), fileName);
}
}
else
LOG_ERROR;
}
else if (!Record)
isyslog(LOG_INFO, "missing index file %s", fileName);
isyslog("missing index file %s", fileName);
if (Record) {
if ((f = open(fileName, O_WRONLY | O_CREAT | O_APPEND, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)) >= 0) {
if (delta) {
esyslog(LOG_ERR, "ERROR: padding index file with %d '0' bytes", delta);
esyslog("ERROR: padding index file with %d '0' bytes", delta);
while (delta--)
writechar(f, 0);
}
@ -180,7 +180,7 @@ cIndexFile::cIndexFile(const char *FileName, bool Record)
}
}
else
esyslog(LOG_ERR, "ERROR: can't copy file name '%s'", FileName);
esyslog("ERROR: can't copy file name '%s'", FileName);
}
}
@ -211,7 +211,7 @@ bool cIndexFile::CatchUp(int Index)
int delta = (newLast - last) * sizeof(tIndex);
if (lseek(f, offset, SEEK_SET) == offset) {
if (safe_read(f, &index[last + 1], delta) != delta) {
esyslog(LOG_ERR, "ERROR: can't read from index");
esyslog("ERROR: can't read from index");
delete index;
index = NULL;
close(f);
@ -224,7 +224,7 @@ bool cIndexFile::CatchUp(int Index)
LOG_ERROR_STR(fileName);
}
else
esyslog(LOG_ERR, "ERROR: can't realloc() index");
esyslog("ERROR: can't realloc() index");
}
}
else
@ -300,7 +300,7 @@ int cIndexFile::GetNextIFrame(int Index, bool Forward, uchar *FileNumber, int *F
if (fn == *FileNumber)
*Length = fo - *FileOffset;
else {
esyslog(LOG_ERR, "ERROR: 'I' frame at end of file #%d", *FileNumber);
esyslog("ERROR: 'I' frame at end of file #%d", *FileNumber);
*Length = -1;
}
}
@ -358,7 +358,7 @@ cFileName::cFileName(const char *FileName, bool Record, bool Blocking)
// Prepare the file name:
fileName = new char[strlen(FileName) + RECORDFILESUFFIXLEN];
if (!fileName) {
esyslog(LOG_ERR, "ERROR: can't copy file name '%s'", fileName);
esyslog("ERROR: can't copy file name '%s'", fileName);
return;
}
strcpy(fileName, FileName);
@ -377,14 +377,14 @@ int cFileName::Open(void)
if (file < 0) {
int BlockingFlag = blocking ? 0 : O_NONBLOCK;
if (record) {
dsyslog(LOG_INFO, "recording to '%s'", fileName);
dsyslog("recording to '%s'", fileName);
file = OpenVideoFile(fileName, O_RDWR | O_CREAT | BlockingFlag);
if (file < 0)
LOG_ERROR_STR(fileName);
}
else {
if (access(fileName, R_OK) == 0) {
dsyslog(LOG_INFO, "playing '%s'", fileName);
dsyslog("playing '%s'", fileName);
file = open(fileName, O_RDONLY | BlockingFlag);
if (file < 0)
LOG_ERROR_STR(fileName);
@ -429,7 +429,7 @@ int cFileName::SetOffset(int Number, int Offset)
}
return file;
}
esyslog(LOG_ERR, "ERROR: max number of files (%d) exceeded", MAXFILESPERRECORDING);
esyslog("ERROR: max number of files (%d) exceeded", MAXFILESPERRECORDING);
return -1;
}
@ -479,7 +479,7 @@ cRecordBuffer::cRecordBuffer(cDvbApi *DvbApi, const char *FileName, int VPid, in
// Create the index file:
index = new cIndexFile(FileName, true);
if (!index)
esyslog(LOG_ERR, "ERROR: can't allocate index");
esyslog("ERROR: can't allocate index");
// let's continue without index, so we'll at least have the recording
videoDev = dvbApi->SetModeRecord();
Start();
@ -498,7 +498,7 @@ bool cRecordBuffer::RunningLowOnDiskSpace(void)
int Free = FreeDiskSpaceMB(fileName.Name());
lastDiskSpaceCheck = time(NULL);
if (Free < MINFREEDISKSPACE) {
dsyslog(LOG_INFO, "low disk space (%d MB, limit is %d MB)", Free, MINFREEDISKSPACE);
dsyslog("low disk space (%d MB, limit is %d MB)", Free, MINFREEDISKSPACE);
return true;
}
}
@ -518,7 +518,7 @@ bool cRecordBuffer::NextFile(void)
void cRecordBuffer::Input(void)
{
dsyslog(LOG_INFO, "input thread started (pid=%d)", getpid());
dsyslog("input thread started (pid=%d)", getpid());
uchar b[MINVIDEODATA];
time_t t = time(NULL);
@ -540,7 +540,7 @@ void cRecordBuffer::Input(void)
else if (r < 0) {
if (FATALERRNO) {
if (errno == EBUFFEROVERFLOW) // this error code is not defined in the library
esyslog(LOG_ERR, "ERROR (%s,%d): DVB driver buffer overflow", __FILE__, __LINE__);
esyslog("ERROR (%s,%d): DVB driver buffer overflow", __FILE__, __LINE__);
else {
LOG_ERROR;
break;
@ -549,7 +549,7 @@ void cRecordBuffer::Input(void)
}
}
if (time(NULL) - t > MAXBROKENTIMEOUT) {
esyslog(LOG_ERR, "ERROR: video data stream broken");
esyslog("ERROR: video data stream broken");
cThread::EmergencyExit(true);
t = time(NULL);
}
@ -557,12 +557,12 @@ void cRecordBuffer::Input(void)
break;
}
dsyslog(LOG_INFO, "input thread ended (pid=%d)", getpid());
dsyslog("input thread ended (pid=%d)", getpid());
}
void cRecordBuffer::Output(void)
{
dsyslog(LOG_INFO, "output thread started (pid=%d)", getpid());
dsyslog("output thread started (pid=%d)", getpid());
uchar b[MINVIDEODATA];
int r = 0;
@ -601,7 +601,7 @@ void cRecordBuffer::Output(void)
}
recording = false;
dsyslog(LOG_INFO, "output thread ended (pid=%d)", getpid());
dsyslog("output thread ended (pid=%d)", getpid());
}
// --- ReadFrame -------------------------------------------------------------
@ -611,7 +611,7 @@ int ReadFrame(int f, uchar *b, int Length, int Max)
if (Length == -1)
Length = Max; // this means we read up to EOF (see cIndex)
else if (Length > Max) {
esyslog(LOG_ERR, "ERROR: frame larger than buffer (%d > %d)", Length, Max);
esyslog("ERROR: frame larger than buffer (%d > %d)", Length, Max);
Length = Max;
}
int r = safe_read(f, b, Length);
@ -751,7 +751,7 @@ void cPlayBuffer::PlayExternalDolby(const uchar *b, int MaxLength)
{
if (cDvbApi::AudioCommand()) {
if (!dolbyDev && !dolbyDev.Open(cDvbApi::AudioCommand(), "w")) {
esyslog(LOG_ERR, "ERROR: can't open pipe to audio command '%s'", cDvbApi::AudioCommand());
esyslog("ERROR: can't open pipe to audio command '%s'", cDvbApi::AudioCommand());
return;
}
if (b[0] == 0x00 && b[1] == 0x00 && b[2] == 0x01) {
@ -775,7 +775,7 @@ void cPlayBuffer::PlayExternalDolby(const uchar *b, int MaxLength)
void cPlayBuffer::Output(void)
{
dsyslog(LOG_INFO, "output thread started (pid=%d)", getpid());
dsyslog("output thread started (pid=%d)", getpid());
while (Busy()) {
if (blockOutput) {
@ -812,7 +812,7 @@ void cPlayBuffer::Output(void)
}
}
dsyslog(LOG_INFO, "output thread ended (pid=%d)", getpid());
dsyslog("output thread ended (pid=%d)", getpid());
}
void cPlayBuffer::putFrame(cFrame *Frame)
@ -1051,7 +1051,7 @@ cReplayBuffer::cReplayBuffer(cDvbApi *DvbApi, int VideoDev, int AudioDev, const
// Create the index file:
index = new cIndexFile(FileName, false);
if (!index)
esyslog(LOG_ERR, "ERROR: can't allocate index");
esyslog("ERROR: can't allocate index");
else if (!index->Ok()) {
delete index;
index = NULL;
@ -1072,11 +1072,11 @@ cReplayBuffer::~cReplayBuffer()
void cReplayBuffer::Input(void)
{
dsyslog(LOG_INFO, "input thread started (pid=%d)", getpid());
dsyslog("input thread started (pid=%d)", getpid());
readIndex = Resume();
if (readIndex >= 0)
isyslog(LOG_INFO, "resuming replay at index %d (%s)", readIndex, IndexToHMSF(readIndex, true));
isyslog("resuming replay at index %d (%s)", readIndex, IndexToHMSF(readIndex, true));
uchar b[MAXFRAMESIZE];
while (Busy() && (blockInput || NextFile())) {
@ -1134,7 +1134,7 @@ void cReplayBuffer::Input(void)
usleep(1); // this keeps the CPU load low
}
dsyslog(LOG_INFO, "input thread ended (pid=%d)", getpid());
dsyslog("input thread ended (pid=%d)", getpid());
}
void cReplayBuffer::StripAudioPackets(uchar *b, int Length, uchar Except)
@ -1161,7 +1161,7 @@ void cReplayBuffer::StripAudioPackets(uchar *b, int Length, uchar Except)
case 0xE0 ... 0xEF: // video
break;
default:
//esyslog(LOG_ERR, "ERROR: unexpected packet id %02X", c);
//esyslog("ERROR: unexpected packet id %02X", c);
l = 0;
}
if (l)
@ -1169,7 +1169,7 @@ void cReplayBuffer::StripAudioPackets(uchar *b, int Length, uchar Except)
}
/*XXX
else
esyslog(LOG_ERR, "ERROR: broken packet header");
esyslog("ERROR: broken packet header");
XXX*/
}
}
@ -1370,7 +1370,7 @@ void cTransferBuffer::SetAudioPid(int APid)
void cTransferBuffer::Input(void)
{
dsyslog(LOG_INFO, "input thread started (pid=%d)", getpid());
dsyslog("input thread started (pid=%d)", getpid());
uchar b[MINVIDEODATA];
int n = 0;
@ -1396,7 +1396,7 @@ void cTransferBuffer::Input(void)
else if (r < 0) {
if (FATALERRNO) {
if (errno == EBUFFEROVERFLOW) // this error code is not defined in the library
esyslog(LOG_ERR, "ERROR (%s,%d): DVB driver buffer overflow", __FILE__, __LINE__);
esyslog("ERROR (%s,%d): DVB driver buffer overflow", __FILE__, __LINE__);
else {
LOG_ERROR;
break;
@ -1406,12 +1406,12 @@ void cTransferBuffer::Input(void)
}
}
dsyslog(LOG_INFO, "input thread ended (pid=%d)", getpid());
dsyslog("input thread ended (pid=%d)", getpid());
}
void cTransferBuffer::Output(void)
{
dsyslog(LOG_INFO, "output thread started (pid=%d)", getpid());
dsyslog("output thread started (pid=%d)", getpid());
uchar b[MINVIDEODATA];
while (Busy()) {
@ -1443,7 +1443,7 @@ void cTransferBuffer::Output(void)
usleep(1); // this keeps the CPU load low
}
dsyslog(LOG_INFO, "output thread ended (pid=%d)", getpid());
dsyslog("output thread ended (pid=%d)", getpid());
}
// --- cCuttingBuffer --------------------------------------------------------
@ -1480,7 +1480,7 @@ cCuttingBuffer::cCuttingBuffer(const char *FromFileName, const char *ToFileName)
Start();
}
else
esyslog(LOG_ERR, "no editing marks found for %s", FromFileName);
esyslog("no editing marks found for %s", FromFileName);
}
cCuttingBuffer::~cCuttingBuffer()
@ -1495,7 +1495,7 @@ cCuttingBuffer::~cCuttingBuffer()
void cCuttingBuffer::Action(void)
{
dsyslog(LOG_INFO, "video cutting thread started (pid=%d)", getpid());
dsyslog("video cutting thread started (pid=%d)", getpid());
cMark *Mark = fromMarks.First();
if (Mark) {
@ -1596,8 +1596,8 @@ void cCuttingBuffer::Action(void)
}
}
else
esyslog(LOG_ERR, "no editing marks found!");
dsyslog(LOG_INFO, "end video cutting thread");
esyslog("no editing marks found!");
dsyslog("end video cutting thread");
}
// --- cVideoCutter ----------------------------------------------------------
@ -1644,9 +1644,9 @@ void cVideoCutter::Stop(void)
cuttingBuffer = NULL;
if ((Interrupted || Error) && editedVersionName) {
if (Interrupted)
isyslog(LOG_INFO, "editing process has been interrupted");
isyslog("editing process has been interrupted");
if (Error)
esyslog(LOG_ERR, "ERROR: '%s' during editing process", Error);
esyslog("ERROR: '%s' during editing process", Error);
RemoveVideoFile(editedVersionName); //XXX what if this file is currently being replayed?
}
}
@ -1755,7 +1755,7 @@ cDvbApi::cDvbApi(int n)
frontendType = feinfo.type;
}
else
esyslog(LOG_ERR, "ERROR: can't open video device %d", n);
esyslog("ERROR: can't open video device %d", n);
cols = rows = 0;
#if defined(DEBUG_OSD) || defined(REMOTE_KBD)
@ -1803,11 +1803,11 @@ bool cDvbApi::SetPrimaryDvbApi(int n)
{
n--;
if (0 <= n && n < NumDvbApis && dvbApi[n]) {
isyslog(LOG_INFO, "setting primary DVB to %d", n + 1);
isyslog("setting primary DVB to %d", n + 1);
PrimaryDvbApi = dvbApi[n];
return true;
}
esyslog(LOG_ERR, "invalid DVB interface: %d", n + 1);
esyslog("invalid DVB interface: %d", n + 1);
return false;
}
@ -1906,7 +1906,7 @@ int cDvbApi::ProvidesCa(int Ca)
bool cDvbApi::Probe(const char *FileName)
{
if (access(FileName, F_OK) == 0) {
dsyslog(LOG_INFO, "probing %s", FileName);
dsyslog("probing %s", FileName);
int f = open(FileName, O_RDONLY);
if (f >= 0) {
close(f);
@ -1933,9 +1933,9 @@ bool cDvbApi::Init(void)
}
PrimaryDvbApi = dvbApi[0];
if (NumDvbApis > 0)
isyslog(LOG_INFO, "found %d video device%s", NumDvbApis, NumDvbApis > 1 ? "s" : "");
isyslog("found %d video device%s", NumDvbApis, NumDvbApis > 1 ? "s" : "");
else
esyslog(LOG_ERR, "ERROR: no video device found, giving up!");
esyslog("ERROR: no video device found, giving up!");
SetCaCaps();
return NumDvbApis > 0;
}
@ -1990,7 +1990,7 @@ bool cDvbApi::GrabImage(const char *FileName, bool Jpeg, int Quality, int SizeX,
if (Quality < 0)
Quality = 255; //XXX is this 'best'???
isyslog(LOG_INFO, "grabbing to %s (%s %d %d %d)", FileName, Jpeg ? "JPEG" : "PNM", Quality, vm.width, vm.height);
isyslog("grabbing to %s (%s %d %d %d)", FileName, Jpeg ? "JPEG" : "PNM", Quality, vm.width, vm.height);
FILE *f = fopen(FileName, "wb");
if (f) {
if (Jpeg) {
@ -2446,7 +2446,7 @@ eSetChannelResult cDvbApi::SetChannel(int ChannelNumber, int Frequency, char Pol
}
break;
default:
esyslog(LOG_ERR, "ERROR: attempt to set channel with unknown DVB frontend type");
esyslog("ERROR: attempt to set channel with unknown DVB frontend type");
return scrFailed;
}
@ -2461,22 +2461,22 @@ eSetChannelResult cDvbApi::SetChannel(int ChannelNumber, int Frequency, char Pol
int res = ioctl(fd_frontend, FE_GET_EVENT, &event);
if (res >= 0) {
if (event.type != FE_COMPLETION_EV) {
esyslog(LOG_ERR, "ERROR: channel %d not sync'ed on DVB card %d!", ChannelNumber, CardIndex() + 1);
esyslog("ERROR: channel %d not sync'ed on DVB card %d!", ChannelNumber, CardIndex() + 1);
if (this == PrimaryDvbApi)
cThread::RaisePanic();
return scrFailed;
}
}
else
esyslog(LOG_ERR, "ERROR %d in frontend get event (channel %d, card %d)", res, ChannelNumber, CardIndex() + 1);
esyslog("ERROR %d in frontend get event (channel %d, card %d)", res, ChannelNumber, CardIndex() + 1);
}
else
esyslog(LOG_ERR, "ERROR: timeout while tuning");
esyslog("ERROR: timeout while tuning");
// PID settings:
if (!SetPids(false)) {
esyslog(LOG_ERR, "ERROR: failed to set PIDs for channel %d", ChannelNumber);
esyslog("ERROR: failed to set PIDs for channel %d", ChannelNumber);
return scrFailed;
}
SetTpid(Tpid, DMX_OUT_DECODER);
@ -2563,7 +2563,7 @@ bool cDvbApi::Replaying(void)
bool cDvbApi::StartRecord(const char *FileName, int Ca, int Priority)
{
if (Recording()) {
esyslog(LOG_ERR, "ERROR: StartRecord() called while recording - ignored!");
esyslog("ERROR: StartRecord() called while recording - ignored!");
return false;
}
@ -2574,10 +2574,10 @@ bool cDvbApi::StartRecord(const char *FileName, int Ca, int Priority)
// Check FileName:
if (!FileName) {
esyslog(LOG_ERR, "ERROR: StartRecord: file name is (null)");
esyslog("ERROR: StartRecord: file name is (null)");
return false;
}
isyslog(LOG_INFO, "record %s", FileName);
isyslog("record %s", FileName);
// Create directories if necessary:
@ -2598,7 +2598,7 @@ bool cDvbApi::StartRecord(const char *FileName, int Ca, int Priority)
return true;
}
else
esyslog(LOG_ERR, "ERROR: can't allocate recording buffer");
esyslog("ERROR: can't allocate recording buffer");
return false;
}
@ -2616,7 +2616,7 @@ void cDvbApi::StopRecord(void)
bool cDvbApi::StartReplay(const char *FileName)
{
if (Recording()) {
esyslog(LOG_ERR, "ERROR: StartReplay() called while recording - ignored!");
esyslog("ERROR: StartReplay() called while recording - ignored!");
return false;
}
StopTransfer();
@ -2626,10 +2626,10 @@ bool cDvbApi::StartReplay(const char *FileName)
// Check FileName:
if (!FileName) {
esyslog(LOG_ERR, "ERROR: StartReplay: file name is (null)");
esyslog("ERROR: StartReplay: file name is (null)");
return false;
}
isyslog(LOG_INFO, "replay %s", FileName);
isyslog("replay %s", FileName);
// Create replay buffer:
@ -2637,7 +2637,7 @@ bool cDvbApi::StartReplay(const char *FileName)
if (replayBuffer)
return true;
else
esyslog(LOG_ERR, "ERROR: can't allocate replaying buffer");
esyslog("ERROR: can't allocate replaying buffer");
}
return false;
}

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: dvbosd.c 1.14 2002/05/10 14:22:04 kls Exp $
* $Id: dvbosd.c 1.15 2002/05/13 16:29:20 kls Exp $
*/
#include "dvbosd.h"
@ -18,7 +18,7 @@ cDvbOsd::cDvbOsd(int VideoDev, int x, int y)
{
videoDev = VideoDev;
if (videoDev < 0)
esyslog(LOG_ERR, "ERROR: illegal video device handle (%d)!", videoDev);
esyslog("ERROR: illegal video device handle (%d)!", videoDev);
}
cDvbOsd::~cDvbOsd()
@ -37,7 +37,7 @@ bool cDvbOsd::SetWindow(cWindow *Window)
Cmd(OSD_SetWindow, 0, Handle + 1);
return true;
}
esyslog(LOG_ERR, "ERROR: illegal window handle: %d", Handle);
esyslog("ERROR: illegal window handle: %d", Handle);
}
return false;
}

62
eit.c
View File

@ -16,7 +16,7 @@
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* $Id: eit.c 1.44 2002/04/06 13:58:59 kls Exp $
* $Id: eit.c 1.45 2002/05/13 16:35:49 kls Exp $
***************************************************************************/
#include "eit.h"
@ -117,7 +117,7 @@ void cMJD::ConvertToTime()
mjdtime = timegm(&t);
//isyslog(LOG_INFO, "Time parsed = %s\n", ctime(&mjdtime));
//isyslog("Time parsed = %s\n", ctime(&mjdtime));
}
/** */
@ -132,10 +132,10 @@ bool cMJD::SetSystemTime()
if (abs(mjdtime - loctim) > 2)
{
isyslog(LOG_INFO, "System Time = %s (%ld)\n", ctime(&loctim), loctim);
isyslog(LOG_INFO, "Local Time = %s (%ld)\n", ctime(&mjdtime), mjdtime);
isyslog("System Time = %s (%ld)\n", ctime(&loctim), loctim);
isyslog("Local Time = %s (%ld)\n", ctime(&mjdtime), mjdtime);
if (stime(&mjdtime) < 0)
esyslog(LOG_ERR, "ERROR while setting system time: %m");
esyslog("ERROR while setting system time: %m");
return true;
}
@ -391,11 +391,11 @@ bool cEventInfo::Read(FILE *f, cSchedule *Schedule)
break;
case 'c': // to keep things simple we react on 'c' here
return true;
default: esyslog(LOG_ERR, "ERROR: unexpected tag while reading EPG data: %s", s);
default: esyslog("ERROR: unexpected tag while reading EPG data: %s", s);
return false;
}
}
esyslog(LOG_ERR, "ERROR: unexpected end of file while reading EPG data");
esyslog("ERROR: unexpected end of file while reading EPG data");
}
return false;
}
@ -436,14 +436,14 @@ static void ReportEpgBugFixStats(bool Reset = false)
tEpgBugFixStats *p = &EpgBugFixStats[i];
if (p->hits) {
if (!GotHits) {
dsyslog(LOG_INFO, "=====================");
dsyslog(LOG_INFO, "EPG bugfix statistics");
dsyslog(LOG_INFO, "=====================");
dsyslog(LOG_INFO, "IF SOMEBODY WHO IS IN CHARGE OF THE EPG DATA FOR ONE OF THE LISTED");
dsyslog(LOG_INFO, "CHANNELS READS THIS: PLEASE TAKE A LOOK AT THE FUNCTION cEventInfo::FixEpgBugs()");
dsyslog(LOG_INFO, "IN VDR/eit.c TO LEARN WHAT'S WRONG WITH YOUR DATA, AND FIX IT!");
dsyslog(LOG_INFO, "=====================");
dsyslog(LOG_INFO, "Fix\tHits\tChannels");
dsyslog("=====================");
dsyslog("EPG bugfix statistics");
dsyslog("=====================");
dsyslog("IF SOMEBODY WHO IS IN CHARGE OF THE EPG DATA FOR ONE OF THE LISTED");
dsyslog("CHANNELS READS THIS: PLEASE TAKE A LOOK AT THE FUNCTION cEventInfo::FixEpgBugs()");
dsyslog("IN VDR/eit.c TO LEARN WHAT'S WRONG WITH YOUR DATA, AND FIX IT!");
dsyslog("=====================");
dsyslog("Fix\tHits\tChannels");
GotHits = true;
}
char *q = buffer;
@ -455,13 +455,13 @@ static void ReportEpgBugFixStats(bool Reset = false)
delim = ", ";
}
}
dsyslog(LOG_INFO, "%s", buffer);
dsyslog("%s", buffer);
}
if (Reset)
p->hits = p->n = 0;
}
if (GotHits)
dsyslog(LOG_INFO, "=====================");
dsyslog("=====================");
}
}
@ -760,7 +760,7 @@ bool cSchedule::Read(FILE *f, cSchedules *Schedules)
}
}
else {
esyslog(LOG_ERR, "ERROR: unexpected tag while reading EPG data: %s", s);
esyslog("ERROR: unexpected tag while reading EPG data: %s", s);
return false;
}
}
@ -1015,7 +1015,7 @@ bool cSIProcessor::Read(FILE *f)
if (OwnFile) {
const char *FileName = GetEpgDataFileName();
if (access(FileName, R_OK) == 0) {
dsyslog(LOG_INFO, "reading EPG data from %s", FileName);
dsyslog("reading EPG data from %s", FileName);
if ((f = fopen(FileName, "r")) == NULL) {
LOG_ERROR;
return false;
@ -1065,7 +1065,7 @@ information and let the classes corresponding
to the tables write their information to the disk */
void cSIProcessor::Action()
{
dsyslog(LOG_INFO, "EIT processing thread started (pid=%d)%s", getpid(), masterSIProcessor ? " - master" : "");
dsyslog("EIT processing thread started (pid=%d)%s", getpid(), masterSIProcessor ? " - master" : "");
time_t lastCleanup = time(NULL);
time_t lastDump = time(NULL);
@ -1082,7 +1082,7 @@ void cSIProcessor::Action()
if (now - lastCleanup > 3600 && ptm->tm_hour == 5)
{
cMutexLock MutexLock(&schedulesMutex);
isyslog(LOG_INFO, "cleaning up schedules data");
isyslog("cleaning up schedules data");
schedules->Cleanup();
lastCleanup = now;
ReportEpgBugFixStats(true);
@ -1131,7 +1131,7 @@ void cSIProcessor::Action()
if (n == seclen)
{
seclen += 3;
//dsyslog(LOG_INFO, "Received pid 0x%02x with table ID 0x%02x and length of %04d\n", pid, buf[0], seclen);
//dsyslog("Received pid 0x%02x with table ID 0x%02x and length of %04d\n", pid, buf[0], seclen);
switch (pid)
{
case 0x14:
@ -1145,7 +1145,7 @@ void cSIProcessor::Action()
}
/*XXX this comes pretty often:
else
dsyslog(LOG_INFO, "Time packet was not 0x70 but 0x%02x\n", (int)buf[0]);
dsyslog("Time packet was not 0x70 but 0x%02x\n", (int)buf[0]);
XXX*/
break;
@ -1157,7 +1157,7 @@ void cSIProcessor::Action()
ceit.ProcessEIT(buf);
}
else
dsyslog(LOG_INFO, "Received stuffing section in EIT\n");
dsyslog("Received stuffing section in EIT\n");
break;
default:
@ -1166,7 +1166,7 @@ void cSIProcessor::Action()
}
/*XXX this just fills up the log file - shouldn't we rather try to re-sync?
else
dsyslog(LOG_INFO, "read incomplete section - seclen = %d, n = %d", seclen, n);
dsyslog("read incomplete section - seclen = %d, n = %d", seclen, n);
XXX*/
}
}
@ -1174,7 +1174,7 @@ void cSIProcessor::Action()
}
}
dsyslog(LOG_INFO, "EIT processing thread ended (pid=%d)%s", getpid(), masterSIProcessor ? " - master" : "");
dsyslog("EIT processing thread ended (pid=%d)%s", getpid(), masterSIProcessor ? " - master" : "");
}
/** Add a filter with packet identifier pid and
@ -1202,21 +1202,21 @@ bool cSIProcessor::AddFilter(u_char pid, u_char tid)
filters[a].inuse = true;
else
{
esyslog(LOG_ERR, "ERROR: can't set filter");
esyslog("ERROR: can't set filter");
close(filters[a].handle);
return false;
}
// dsyslog(LOG_INFO, " Registered filter handle %04x, pid = %02d, tid = %02d", filters[a].handle, filters[a].pid, filters[a].tid);
// dsyslog("Registered filter handle %04x, pid = %02d, tid = %02d", filters[a].handle, filters[a].pid, filters[a].tid);
}
else
{
esyslog(LOG_ERR, "ERROR: can't open filter handle");
esyslog("ERROR: can't open filter handle");
return false;
}
return true;
}
}
esyslog(LOG_ERR, "ERROR: too many filters");
esyslog("ERROR: too many filters");
return false;
}
@ -1229,7 +1229,7 @@ bool cSIProcessor::ShutDownFilters(void)
if (filters[a].inuse)
{
close(filters[a].handle);
// dsyslog(LOG_INFO, "Deregistered filter handle %04x, pid = %02d, tid = %02d", filters[a].handle, filters[a].pid, filters[a].tid);
// dsyslog("Deregistered filter handle %04x, pid = %02d, tid = %02d", filters[a].handle, filters[a].pid, filters[a].tid);
filters[a].inuse = false;
}
}

4
i18n.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: i18n.c 1.88 2002/05/11 11:43:38 kls Exp $
* $Id: i18n.c 1.89 2002/05/13 16:30:00 kls Exp $
*
* Translations provided by:
*
@ -2495,7 +2495,7 @@ const char *I18nTranslate(const char *s, const char *Plugin)
}
p = Phrases;
}
esyslog(LOG_ERR, "%s%sno translation found for '%s' in language %d (%s)\n", Plugin ? Plugin : "", Plugin ? ": " : "", s, Setup.OSDLanguage, Phrases[0][Setup.OSDLanguage]);
esyslog("%s%sno translation found for '%s' in language %d (%s)\n", Plugin ? Plugin : "", Plugin ? ": " : "", s, Setup.OSDLanguage, Phrases[0][Setup.OSDLanguage]);
}
const char *p = strchr(s, '$');
return p ? p + 1 : s;

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: interface.c 1.47 2002/01/27 15:48:46 kls Exp $
* $Id: interface.c 1.48 2002/05/13 16:30:22 kls Exp $
*/
#include "interface.h"
@ -303,7 +303,7 @@ void cInterface::Status(const char *s, eDvbColor FgColor, eDvbColor BgColor)
void cInterface::Info(const char *s)
{
Open(Setup.OSDwidth, -1);
isyslog(LOG_INFO, "info: %s", s);
isyslog("info: %s", s);
Status(s, clrBlack, clrGreen);
Wait();
Status(NULL);
@ -313,7 +313,7 @@ void cInterface::Info(const char *s)
void cInterface::Error(const char *s)
{
Open(Setup.OSDwidth, -1);
esyslog(LOG_ERR, "ERROR: %s", s);
esyslog("ERROR: %s", s);
Status(s, clrWhite, clrRed);
Wait();
Status(NULL);
@ -323,13 +323,13 @@ void cInterface::Error(const char *s)
bool cInterface::Confirm(const char *s, int Seconds, bool WaitForTimeout)
{
Open(Setup.OSDwidth, -1);
isyslog(LOG_INFO, "confirm: %s", s);
isyslog("confirm: %s", s);
Status(s, clrBlack, clrYellow);
eKeys k = Wait(Seconds);
bool result = WaitForTimeout ? k == kNone : k == kOk;
Status(NULL);
Close();
isyslog(LOG_INFO, "%sconfirmed", result ? "" : "not ");
isyslog("%sconfirmed", result ? "" : "not ");
return result;
}
@ -441,7 +441,7 @@ void cInterface::QueryKeys(void)
void cInterface::LearnKeys(void)
{
isyslog(LOG_INFO, "learning keys");
isyslog("learning keys");
Open();
for (;;) {
Clear();

48
menu.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: menu.c 1.191 2002/05/11 11:16:32 kls Exp $
* $Id: menu.c 1.192 2002/05/13 16:30:50 kls Exp $
*/
#include "menu.h"
@ -514,7 +514,7 @@ eOSState cMenuChannels::Edit(void)
{
if (HasSubMenu() || Count() == 0)
return osContinue;
isyslog(LOG_INFO, "editing channel %d", Current() + 1);
isyslog("editing channel %d", Current() + 1);
return AddSubMenu(new cMenuEditChannel(Current()));
}
@ -527,7 +527,7 @@ eOSState cMenuChannels::New(void)
Channels.ReNumber();
Add(new cMenuChannelItem(channel->Index()/*XXX*/, channel), true);
Channels.Save();
isyslog(LOG_INFO, "channel %d added", channel->number);
isyslog("channel %d added", channel->number);
return AddSubMenu(new cMenuEditChannel(Current()));
}
@ -553,7 +553,7 @@ eOSState cMenuChannels::Del(void)
for (cMenuChannelItem *ci = (cMenuChannelItem *)First(); ci; ci = (cMenuChannelItem *)ci->Next())
ci->SetIndex(i++);
Channels.Save();
isyslog(LOG_INFO, "channel %d deleted", DeletedChannel);
isyslog("channel %d deleted", DeletedChannel);
// Fix the timers:
bool TimersModified = false;
for (cTimer *ti = Timers.First(); ti; ti = (cTimer *)ti->Next()) {
@ -562,7 +562,7 @@ eOSState cMenuChannels::Del(void)
ti->channel--;
if (ti->channel != OldChannel) {
TimersModified = true;
isyslog(LOG_INFO, "timer %d: channel changed from %d to %d", ti->Index() + 1, OldChannel, ti->channel);
isyslog("timer %d: channel changed from %d to %d", ti->Index() + 1, OldChannel, ti->channel);
}
}
if (TimersModified)
@ -585,7 +585,7 @@ void cMenuChannels::Move(int From, int To)
for (cMenuChannelItem *ci = (cMenuChannelItem *)First(); ci; ci = (cMenuChannelItem *)ci->Next())
ci->SetIndex(i++);
Channels.Save();
isyslog(LOG_INFO, "channel %d moved to %d", FromNumber, ToNumber);
isyslog("channel %d moved to %d", FromNumber, ToNumber);
// Fix the timers:
bool TimersModified = false;
From++; // user visible channel numbers start with '1'
@ -600,7 +600,7 @@ void cMenuChannels::Move(int From, int To)
ti->channel++;
if (ti->channel != OldChannel) {
TimersModified = true;
isyslog(LOG_INFO, "timer %d: channel changed from %d to %d", ti->Index() + 1, OldChannel, ti->channel);
isyslog("timer %d: channel changed from %d to %d", ti->Index() + 1, OldChannel, ti->channel);
}
}
if (TimersModified)
@ -714,7 +714,7 @@ eOSState cMenuEditTimer::ProcessKey(eKeys Key)
if (timer->active)
timer->active = 1; // allows external programs to mark active timers with values > 1 and recognize if the user has modified them
Timers.Save();
isyslog(LOG_INFO, "timer %d modified (%s)", timer->Index() + 1, timer->active ? "active" : "inactive");
isyslog("timer %d modified (%s)", timer->Index() + 1, timer->active ? "active" : "inactive");
}
return osBack;
case kRed:
@ -822,9 +822,9 @@ eOSState cMenuTimers::OnOff(void)
RefreshCurrent();
DisplayCurrent(true);
if (timer->firstday)
isyslog(LOG_INFO, "timer %d first day set to %s", timer->Index() + 1, timer->PrintFirstDay());
isyslog("timer %d first day set to %s", timer->Index() + 1, timer->PrintFirstDay());
else
isyslog(LOG_INFO, "timer %d %sactivated", timer->Index() + 1, timer->active ? "" : "de");
isyslog("timer %d %sactivated", timer->Index() + 1, timer->active ? "" : "de");
Timers.Save();
}
return osContinue;
@ -834,7 +834,7 @@ eOSState cMenuTimers::Edit(void)
{
if (HasSubMenu() || Count() == 0)
return osContinue;
isyslog(LOG_INFO, "editing timer %d", CurrentTimer()->Index() + 1);
isyslog("editing timer %d", CurrentTimer()->Index() + 1);
return AddSubMenu(new cMenuEditTimer(CurrentTimer()->Index()));
}
@ -846,7 +846,7 @@ eOSState cMenuTimers::New(void)
Timers.Add(timer);
Add(new cMenuTimerItem(timer), true);
Timers.Save();
isyslog(LOG_INFO, "timer %d added", timer->Index() + 1);
isyslog("timer %d added", timer->Index() + 1);
return AddSubMenu(new cMenuEditTimer(timer->Index(), true));
}
@ -862,7 +862,7 @@ eOSState cMenuTimers::Del(void)
cOsdMenu::Del(Current());
Timers.Save();
Display();
isyslog(LOG_INFO, "timer %d deleted", Index + 1);
isyslog("timer %d deleted", Index + 1);
}
}
else
@ -877,7 +877,7 @@ void cMenuTimers::Move(int From, int To)
cOsdMenu::Move(From, To);
Timers.Save();
Display();
isyslog(LOG_INFO, "timer %d moved to %d", From + 1, To + 1);
isyslog("timer %d moved to %d", From + 1, To + 1);
}
eOSState cMenuTimers::Summary(void)
@ -1068,7 +1068,7 @@ eOSState cMenuWhatsOn::Record(void)
if (!t) {
Timers.Add(timer);
Timers.Save();
isyslog(LOG_INFO, "timer %d added", timer->Index() + 1);
isyslog("timer %d added", timer->Index() + 1);
}
else {
delete timer;
@ -1201,7 +1201,7 @@ eOSState cMenuSchedule::Record(void)
if (!t) {
Timers.Add(timer);
Timers.Save();
isyslog(LOG_INFO, "timer %d added", timer->Index() + 1);
isyslog("timer %d added", timer->Index() + 1);
}
else {
delete timer;
@ -2426,7 +2426,7 @@ cRecordControl::cRecordControl(cDvbApi *DvbApi, cTimer *Timer)
Title = eventInfo->GetTitle();
Subtitle = eventInfo->GetSubtitle();
Summary = eventInfo->GetExtendedDescription();
dsyslog(LOG_INFO, "Title: '%s' Subtitle: '%s'", Title, Subtitle);
dsyslog("Title: '%s' Subtitle: '%s'", Title, Subtitle);
}
cRecording Recording(timer, Title, Subtitle, Summary);
fileName = strdup(Recording.FileName());
@ -2462,17 +2462,17 @@ bool cRecordControl::GetEventInfo(void)
eventInfo = Schedule->GetEventAround(Time);
if (eventInfo) {
if (seconds > 0)
dsyslog(LOG_INFO, "got EPG info after %d seconds", seconds);
dsyslog("got EPG info after %d seconds", seconds);
return true;
}
}
}
}
if (seconds == 0)
dsyslog(LOG_INFO, "waiting for EPG info...");
dsyslog("waiting for EPG info...");
sleep(1);
}
dsyslog(LOG_INFO, "no EPG info available");
dsyslog("no EPG info available");
return false;
}
@ -2484,7 +2484,7 @@ void cRecordControl::Stop(bool KeepInstant)
if ((IsInstant() && !KeepInstant) || (timer->IsSingleEvent() && !timer->Matches())) {
// checking timer->Matches() to make sure we don't delete the timer
// if the program was cancelled before the timer's stop time!
isyslog(LOG_INFO, "deleting timer %d", timer->Index() + 1);
isyslog("deleting timer %d", timer->Index() + 1);
Timers.Del(timer);
Timers.Save();
}
@ -2523,10 +2523,10 @@ bool cRecordControls::Start(cTimer *Timer)
}
}
else if (!Timer || (Timer->priority >= Setup.PrimaryLimit && !Timer->pending))
isyslog(LOG_ERR, "no free DVB device to record channel %d!", ch);
isyslog("no free DVB device to record channel %d!", ch);
}
else
esyslog(LOG_ERR, "ERROR: channel %d not defined!", ch);
esyslog("ERROR: channel %d not defined!", ch);
return false;
}
@ -2546,7 +2546,7 @@ void cRecordControls::Stop(cDvbApi *DvbApi)
for (int i = 0; i < MAXDVBAPI; i++) {
if (RecordControls[i]) {
if (RecordControls[i]->Uses(DvbApi)) {
isyslog(LOG_INFO, "stopping recording on DVB device %d due to higher priority", DvbApi->CardIndex() + 1);
isyslog("stopping recording on DVB device %d due to higher priority", DvbApi->CardIndex() + 1);
RecordControls[i]->Stop(true);
}
}

View File

@ -12,7 +12,7 @@
# See the main source file 'vdr.c' for copyright information and
# how to reach the author.
#
# $Id: newplugin 1.1 2002/05/09 15:12:26 kls Exp $
# $Id: newplugin 1.4 2002/05/12 15:02:13 kls Exp $
$PLUGIN_NAME = $ARGV[0] || die "Usage: newplugin <name>\n";
@ -82,7 +82,8 @@ VDRVERSION = `grep 'define VDRVERSION ' \$(VDRDIR)/config.h | awk '{ print \$\$3
### The name of the distribution archive:
ARCHIVE = vdr-\$(PLUGIN)-\$(VERSION)
ARCHIVE = \$(PLUGIN)-\$(VERSION)
PACKAGE = vdr-\$(ARCHIVE)
### Includes and Defines (add further entries here):
@ -125,9 +126,9 @@ package: clean
\@-rm -rf \$(TMPDIR)/\$(ARCHIVE)
\@mkdir \$(TMPDIR)/\$(ARCHIVE)
\@cp -a * \$(TMPDIR)/\$(ARCHIVE)
\@tar czf \$(ARCHIVE).tgz -C \$(TMPDIR) \$(ARCHIVE)
\@tar czf \$(PACKAGE).tgz -C \$(TMPDIR) \$(ARCHIVE)
\@-rm -rf \$(TMPDIR)/\$(ARCHIVE)
\@echo Distribution archive created as \$(ARCHIVE).tgz
\@echo Distribution package created as \$(PACKAGE).tgz
clean:
\@-rm -f \$(OBJS) \$(DEPFILE) *.so *.tgz core* *~
@ -158,7 +159,8 @@ public:
virtual const char *Description(void) { return DESCRIPTION; }
virtual const char *CommandLineHelp(void);
virtual bool ProcessArgs(int argc, char *argv[]);
virtual void Start(void);
virtual bool Start(void);
virtual void Housekeeping(void);
virtual const char *MainMenuEntry(void) { return MAINMENUENTRY; }
virtual cOsdMenu *MainMenuAction(void);
virtual cMenuSetupPage *SetupMenu(void);
@ -189,9 +191,15 @@ bool cPlugin${PLUGIN_CLASS}::ProcessArgs(int argc, char *argv[])
return true;
}
void cPlugin${PLUGIN_CLASS}::Start(void)
bool cPlugin${PLUGIN_CLASS}::Start(void)
{
// Start any background activities the plugin shall perform.
return true;
}
void cPlugin${PLUGIN_CLASS}::Housekeeping(void)
{
// Perform any cleanup or other regular tasks.
}
cOsdMenu *cPlugin${PLUGIN_CLASS}::MainMenuAction(void)

13
osd.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: osd.c 1.24 2002/05/01 11:53:24 kls Exp $
* $Id: osd.c 1.25 2002/05/12 11:38:39 kls Exp $
*/
#include "osd.h"
@ -161,9 +161,16 @@ void cOsdMenu::Del(int Index)
first--;
}
void cOsdMenu::Add(cOsdItem *Item, bool Current)
void cOsdMenu::Add(cOsdItem *Item, bool Current, cOsdItem *After)
{
cList<cOsdItem>::Add(Item);
cList<cOsdItem>::Add(Item, After);
if (Current)
current = Item->Index();
}
void cOsdMenu::Ins(cOsdItem *Item, bool Current, cOsdItem *Before)
{
cList<cOsdItem>::Ins(Item, Before);
if (Current)
current = Item->Index();
}

5
osd.h
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: osd.h 1.28 2002/05/01 11:17:42 kls Exp $
* $Id: osd.h 1.29 2002/05/12 11:19:22 kls Exp $
*/
#ifndef __OSD_H
@ -116,7 +116,8 @@ public:
cOsdMenu(const char *Title, int c0 = 0, int c1 = 0, int c2 = 0, int c3 = 0, int c4 = 0);
virtual ~cOsdMenu();
int Current(void) { return current; }
void Add(cOsdItem *Item, bool Current = false);
void Add(cOsdItem *Item, bool Current = false, cOsdItem *After = NULL);
void Ins(cOsdItem *Item, bool Current = false, cOsdItem *Before = NULL);
void Display(void);
virtual eOSState ProcessKey(eKeys Key);
};

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: osdbase.c 1.1 2002/05/10 14:55:53 kls Exp $
* $Id: osdbase.c 1.2 2002/05/13 16:30:59 kls Exp $
*/
#include "osdbase.h"
@ -49,7 +49,7 @@ int cPalette::Index(eDvbColor Color)
return i;
}
}
esyslog(LOG_ERR, "ERROR: too many different colors used in palette");
esyslog("ERROR: too many different colors used in palette");
full = true;
}
return 0;
@ -105,10 +105,10 @@ cBitmap::cBitmap(int Width, int Height, int Bpp, bool ClearWithBackground)
SetFont(fontOsd);
}
else
esyslog(LOG_ERR, "ERROR: can't allocate bitmap!");
esyslog("ERROR: can't allocate bitmap!");
}
else
esyslog(LOG_ERR, "ERROR: illegal bitmap parameters (%d, %d)!", width, height);
esyslog("ERROR: illegal bitmap parameters (%d, %d)!", width, height);
}
cBitmap::~cBitmap()
@ -337,7 +337,7 @@ tWindowHandle cOsd::Create(int x, int y, int w, int h, int Bpp, bool ClearWithBa
if (x >= 0 && y >= 0 && w > 0 && h > 0 && (Bpp == 1 || Bpp == 2 || Bpp == 4 || Bpp == 8)) {
if ((w & 0x03) != 0) {
w += 4 - (w & 0x03);
esyslog(LOG_ERR, "ERROR: OSD window width must be a multiple of 4 - increasing to %d", w);
esyslog("ERROR: OSD window width must be a multiple of 4 - increasing to %d", w);
}
cWindow *win = new cWindow(numWindows, x, y, w, h, Bpp, ClearWithBackground, Tiled);
if (OpenWindow(win)) {
@ -349,10 +349,10 @@ tWindowHandle cOsd::Create(int x, int y, int w, int h, int Bpp, bool ClearWithBa
delete win;
}
else
esyslog(LOG_ERR, "ERROR: illegal OSD parameters");
esyslog("ERROR: illegal OSD parameters");
}
else
esyslog(LOG_ERR, "ERROR: too many OSD windows");
esyslog("ERROR: too many OSD windows");
return -1;
}
@ -456,7 +456,7 @@ void cOsd::Relocate(tWindowHandle Window, int x, int y, int NewWidth, int NewHei
if (NewWidth > 0 && NewHeight > 0) {
if ((NewWidth & 0x03) != 0) {
NewWidth += 4 - (NewWidth & 0x03);
esyslog(LOG_ERR, "ERROR: OSD window width must be a multiple of 4 - increasing to %d", NewWidth);
esyslog("ERROR: OSD window width must be a multiple of 4 - increasing to %d", NewWidth);
}
CloseWindow(w);
cWindow *NewWindow = new cWindow(w->Handle(), x, y, NewWidth, NewHeight, w->Bpp(), w->ClearWithBackground(), w->Tiled());

View File

@ -4,22 +4,26 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: plugin.c 1.1 2002/05/09 16:26:56 kls Exp $
* $Id: plugin.c 1.5 2002/05/13 16:31:09 kls Exp $
*/
#include "plugin.h"
#include <ctype.h>
#include <dirent.h>
#include <dlfcn.h>
#include <time.h>
#include "config.h"
#define LIBVDR_PREFIX "libvdr-"
#define SO_INDICATOR ".so."
#define MAXPLUGINARGS 1024
#define HOUSEKEEPINGDELTA 10 // seconds
// --- cPlugin ---------------------------------------------------------------
char *cPlugin::configDirectory = NULL;
cPlugin::cPlugin(void)
{
name = NULL;
@ -45,7 +49,12 @@ bool cPlugin::ProcessArgs(int argc, char *argv[])
return true;
}
void cPlugin::Start(void)
bool cPlugin::Start(void)
{
return true;
}
void cPlugin::Housekeeping(void)
{
}
@ -84,6 +93,19 @@ void cPlugin::RegisterI18n(const tI18nPhrase * const Phrases)
I18nRegister(Phrases, Name());
}
void cPlugin::SetConfigDirectory(const char *Dir)
{
configDirectory = strdup(Dir);
}
const char *cPlugin::ConfigDirectory(const char *PluginName)
{
static char *buffer = NULL;
delete buffer;
asprintf(&buffer, "%s/plugins%s%s", configDirectory, PluginName ? "/" : "", PluginName ? PluginName : "");
return MakeDirs(buffer, true) ? buffer : NULL;
}
// --- cDll ------------------------------------------------------------------
cDll::cDll(const char *FileName, const char *Args)
@ -117,7 +139,7 @@ static char *SkipQuote(char *s)
strcpy(s, s + 1);
return s;
}
esyslog(LOG_ERR, "ERROR: missing closing %c", c);
esyslog("ERROR: missing closing %c", c);
fprintf(stderr, "vdr: missing closing %c\n", c);
return NULL;
}
@ -125,9 +147,9 @@ static char *SkipQuote(char *s)
bool cDll::Load(bool Log)
{
if (Log)
isyslog(LOG_INFO, "loading plugin: %s", fileName);
isyslog("loading plugin: %s", fileName);
if (handle) {
esyslog(LOG_ERR, "attempt to load plugin '%s' twice!", fileName);
esyslog("attempt to load plugin '%s' twice!", fileName);
return false;
}
handle = dlopen(fileName, RTLD_NOW);
@ -153,7 +175,7 @@ bool cDll::Load(bool Log)
if (*p)
p++;
else {
esyslog(LOG_ERR, "ERROR: missing character after \\");
esyslog("ERROR: missing character after \\");
fprintf(stderr, "vdr: missing character after \\\n");
return false;
}
@ -169,7 +191,7 @@ bool cDll::Load(bool Log)
if (argc < MAXPLUGINARGS - 1)
argv[argc++] = q;
else {
esyslog(LOG_ERR, "ERROR: plugin argument list too long");
esyslog("ERROR: plugin argument list too long");
fprintf(stderr, "vdr: plugin argument list too long\n");
return false;
}
@ -188,7 +210,7 @@ bool cDll::Load(bool Log)
}
}
else {
esyslog(LOG_ERR, "ERROR: %s", error);
esyslog("ERROR: %s", error);
fprintf(stderr, "vdr: %s\n", error);
}
return !error && plugin;
@ -201,6 +223,8 @@ cPluginManager *cPluginManager::pluginManager = NULL;
cPluginManager::cPluginManager(const char *Directory)
{
directory = NULL;
lastHousekeeping = time(NULL);
nextHousekeeping = -1;
if (pluginManager) {
fprintf(stderr, "vdr: attempt to create more than one plugin manager - exiting!\n");
exit(2);
@ -268,18 +292,36 @@ bool cPluginManager::LoadPlugins(bool Log)
return true;
}
void cPluginManager::StartPlugins(void)
bool cPluginManager::StartPlugins(void)
{
for (cDll *dll = dlls.First(); dll; dll = dlls.Next(dll)) {
cPlugin *p = dll->Plugin();
if (p) {
int Language = Setup.OSDLanguage;
Setup.OSDLanguage = 0; // the i18n texts are only available _after_ Start()
isyslog(LOG_INFO, "starting plugin: %s (%s): %s", p->Name(), p->Version(), p->Description());
isyslog("starting plugin: %s (%s): %s", p->Name(), p->Version(), p->Description());
Setup.OSDLanguage = Language;
dll->Plugin()->Start();
if (!p->Start())
return false;
}
}
return true;
}
void cPluginManager::Housekeeping(void)
{
if (time(NULL) - lastHousekeeping > HOUSEKEEPINGDELTA) {
if (++nextHousekeeping >= dlls.Count())
nextHousekeeping = 0;
cDll *dll = dlls.Get(nextHousekeeping);
if (dll) {
cPlugin *p = dll->Plugin();
if (p) {
p->Housekeeping();
}
}
lastHousekeeping = time(NULL);
}
}
bool cPluginManager::HasPlugins(void)
@ -312,7 +354,7 @@ void cPluginManager::Shutdown(bool Log)
if (Log) {
cPlugin *p = dll->Plugin();
if (p)
isyslog(LOG_INFO, "stopping plugin: %s", p->Name());
isyslog("stopping plugin: %s", p->Name());
}
dlls.Del(dll);
}

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: plugin.h 1.1 2002/05/09 10:16:09 kls Exp $
* $Id: plugin.h 1.4 2002/05/13 15:32:14 kls Exp $
*/
#ifndef __PLUGIN_H
@ -20,6 +20,7 @@
class cPlugin {
friend class cDll;
private:
static char *configDirectory;
const char *name;
void SetName(const char *s);
public:
@ -32,7 +33,8 @@ public:
virtual const char *CommandLineHelp(void);
virtual bool ProcessArgs(int argc, char *argv[]);
virtual void Start(void);
virtual bool Start(void);
virtual void Housekeeping(void);
virtual const char *MainMenuEntry(void);
virtual cOsdMenu *MainMenuAction(void);
@ -43,6 +45,9 @@ public:
void SetupStore(const char *Name, int Value);
void RegisterI18n(const tI18nPhrase * const Phrases);
static void SetConfigDirectory(const char *Dir);
static const char *ConfigDirectory(const char *PluginName = NULL);
};
class cDll : public cListObject {
@ -64,6 +69,8 @@ class cPluginManager {
private:
static cPluginManager *pluginManager;
char *directory;
time_t lastHousekeeping;
int nextHousekeeping;
cDlls dlls;
public:
cPluginManager(const char *Directory);
@ -71,7 +78,8 @@ public:
void SetDirectory(const char *Directory);
void AddPlugin(const char *Args);
bool LoadPlugins(bool Log = false);
void StartPlugins(void);
bool StartPlugins(void);
void Housekeeping(void);
static bool HasPlugins(void);
static cPlugin *GetPlugin(int Index);
static cPlugin *GetPlugin(const char *Name);

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: recording.c 1.61 2002/04/21 14:02:55 kls Exp $
* $Id: recording.c 1.62 2002/05/13 16:31:21 kls Exp $
*/
#include "recording.h"
@ -86,7 +86,7 @@ void AssertFreeDiskSpace(int Priority)
if (!LockFile.Lock())
return;
// Remove the oldest file that has been "deleted":
isyslog(LOG_INFO, "low disk space while recording, trying to remove a deleted recording...");
isyslog("low disk space while recording, trying to remove a deleted recording...");
cRecordings Recordings;
if (Recordings.Load(true)) {
cRecording *r = Recordings.First();
@ -102,7 +102,7 @@ void AssertFreeDiskSpace(int Priority)
}
}
// No "deleted" files to remove, so let's see if we can delete a recording:
isyslog(LOG_INFO, "...no deleted recording found, trying to delete an old recording...");
isyslog("...no deleted recording found, trying to delete an old recording...");
if (Recordings.Load(false)) {
cRecording *r = Recordings.First();
cRecording *r0 = NULL;
@ -124,7 +124,7 @@ void AssertFreeDiskSpace(int Priority)
return;
}
// Unable to free disk space, but there's nothing we can do about that...
isyslog(LOG_INFO, "...no old recording found, giving up");
isyslog("...no old recording found, giving up");
Interface->Confirm(tr("Low disk space!"), 30);
}
LastFreeDiskCheck = time(NULL);
@ -141,7 +141,7 @@ cResumeFile::cResumeFile(const char *FileName)
strcat(fileName, RESUMEFILESUFFIX);
}
else
esyslog(LOG_ERR, "ERROR: can't allocate memory for resume file name");
esyslog("ERROR: can't allocate memory for resume file name");
}
cResumeFile::~cResumeFile()
@ -368,7 +368,7 @@ cRecording::cRecording(const char *FileName)
if (rbytes >= 0) {
summary[rbytes] = 0;
if (rbytes != size)
esyslog(LOG_ERR, "%s: expected %d bytes but read %d", SummaryFileName, size, rbytes);
esyslog("%s: expected %d bytes but read %d", SummaryFileName, size, rbytes);
}
else {
LOG_ERROR_STR(SummaryFileName);
@ -378,7 +378,7 @@ cRecording::cRecording(const char *FileName)
}
else
esyslog(LOG_ERR, "can't allocate %d byte of memory for summary file '%s'", size + 1, SummaryFileName);
esyslog("can't allocate %d byte of memory for summary file '%s'", size + 1, SummaryFileName);
close(f);
}
else
@ -556,10 +556,10 @@ bool cRecording::Delete(void)
strncpy(ext, DELEXT, strlen(ext));
if (access(NewName, F_OK) == 0) {
// the new name already exists, so let's remove that one first:
isyslog(LOG_INFO, "removing recording %s", NewName);
isyslog("removing recording %s", NewName);
RemoveVideoFile(NewName);
}
isyslog(LOG_INFO, "deleting recording %s", FileName());
isyslog("deleting recording %s", FileName());
result = RenameVideoFile(FileName(), NewName);
}
delete NewName;
@ -570,10 +570,10 @@ bool cRecording::Remove(void)
{
// let's do a final safety check here:
if (!endswith(FileName(), DELEXT)) {
esyslog(LOG_ERR, "attempt to remove recording %s", FileName());
esyslog("attempt to remove recording %s", FileName());
return false;
}
isyslog(LOG_INFO, "removing recording %s", FileName());
isyslog("removing recording %s", FileName());
return RemoveVideoFile(FileName());
}
@ -727,7 +727,7 @@ void cRecordingUserCommand::InvokeCommand(const char *State, const char *Recordi
if (command) {
char *cmd;
asprintf(&cmd, "%s %s \"%s\"", command, State, strescape(RecordingFileName, "\"$"));
isyslog(LOG_INFO, "executing '%s'", cmd);
isyslog("executing '%s'", cmd);
SystemExec(cmd);
delete cmd;
}

View File

@ -6,7 +6,7 @@
*
* Ported to LIRC by Carsten Koch <Carsten.Koch@icem.de> 2000-06-16.
*
* $Id: remote.c 1.25 2001/09/30 11:39:49 kls Exp $
* $Id: remote.c 1.26 2002/05/13 16:31:27 kls Exp $
*/
#include "remote.h"
@ -130,7 +130,7 @@ void cRcIoRCU::Action(void)
} buffer;
#pragma pack()
dsyslog(LOG_INFO, "RCU remote control thread started (pid=%d)", getpid());
dsyslog("RCU remote control thread started (pid=%d)", getpid());
int FirstTime = 0;
unsigned int LastCommand = 0;
@ -425,7 +425,7 @@ cRcIoLIRC::~cRcIoLIRC()
void cRcIoLIRC::Action(void)
{
dsyslog(LOG_INFO, "LIRC remote control thread started (pid=%d)", getpid());
dsyslog("LIRC remote control thread started (pid=%d)", getpid());
int FirstTime = 0;
int LastTime = 0;

14
remux.c
View File

@ -8,7 +8,7 @@
* the Linux DVB driver's 'tuxplayer' example and were rewritten to suit
* VDR's needs.
*
* $Id: remux.c 1.8 2002/02/03 16:20:37 kls Exp $
* $Id: remux.c 1.9 2002/05/13 16:31:38 kls Exp $
*/
/* The calling interface of the 'cRemux::Process()' function is defined
@ -154,7 +154,7 @@ cTS2PES::cTS2PES(uint8_t *ResultBuffer, int *ResultCount, int Size, uint8_t Audi
audioCid = AudioCid;
if (!(buf = new uint8_t[size]))
esyslog(LOG_ERR, "Not enough memory for ts_transform");
esyslog("Not enough memory for ts_transform");
reset_ipack();
}
@ -172,7 +172,7 @@ void cTS2PES::Clear(void)
void cTS2PES::store(uint8_t *Data, int Count)
{
if (*resultCount + Count > RESULTBUFFERSIZE) {
esyslog(LOG_ERR, "ERROR: result buffer overflow (%d + %d > %d)", *resultCount, Count, RESULTBUFFERSIZE);
esyslog("ERROR: result buffer overflow (%d + %d > %d)", *resultCount, Count, RESULTBUFFERSIZE);
Count = RESULTBUFFERSIZE - *resultCount;
}
memcpy(resultBuffer + *resultCount, Data, Count);
@ -309,7 +309,7 @@ void cTS2PES::instant_repack(const uint8_t *Buf, int Count)
if ((flag1 & 0xC0) == 0x80 )
mpeg = 2;
else {
esyslog(LOG_INFO, "ERROR: can't record MPEG1!");
esyslog("ERROR: can't record MPEG1!");
hlength = 0;
which = 0;
mpeg = 1;
@ -525,7 +525,7 @@ XXX*/
used++;
}
if (used)
esyslog(LOG_ERR, "ERROR: skipped %d byte to sync on TS packet", used);
esyslog("ERROR: skipped %d byte to sync on TS packet", used);
// Convert incoming TS data into multiplexed PES:
@ -570,7 +570,7 @@ XXX*/
if (!synced && skipped >= 0) {
if (skipped > MAXNONUSEFULDATA) {
esyslog(LOG_ERR, "ERROR: no useful data seen within %d byte of video stream", skipped);
esyslog("ERROR: no useful data seen within %d byte of video stream", skipped);
skipped = -1;
if (exitOnFailure)
cThread::EmergencyExit(true);
@ -595,7 +595,7 @@ XXX*/
return NULL; // no useful data found, wait for more
if (pt != NO_PICTURE) {
if (pt < I_FRAME || B_FRAME < pt)
esyslog(LOG_ERR, "ERROR: unknown picture type '%d'", pt);
esyslog("ERROR: unknown picture type '%d'", pt);
else if (!synced) {
if (pt == I_FRAME) {
resultDelivered = i; // will drop everything before this position

View File

@ -7,7 +7,7 @@
* Parts of this file were inspired by the 'ringbuffy.c' from the
* LinuxDVB driver (see linuxtv.org).
*
* $Id: ringbuffer.c 1.6 2002/04/18 15:46:36 kls Exp $
* $Id: ringbuffer.c 1.7 2002/05/13 16:31:46 kls Exp $
*/
#include "ringbuffer.h"
@ -52,7 +52,7 @@ cRingBuffer::~cRingBuffer()
delete inputThread;
delete outputThread;
if (statistics)
dsyslog(LOG_INFO, "buffer stats: %d (%d%%) used", maxFill, maxFill * 100 / (size - 1));
dsyslog("buffer stats: %d (%d%%) used", maxFill, maxFill * 100 / (size - 1));
}
void cRingBuffer::WaitForPut(void)
@ -121,11 +121,11 @@ cRingBufferLinear::cRingBufferLinear(int Size, bool Statistics)
if (Size > 1) { // 'Size - 1' must not be 0!
buffer = new uchar[Size];
if (!buffer)
esyslog(LOG_ERR, "ERROR: can't allocate ring buffer (size=%d)", Size);
esyslog("ERROR: can't allocate ring buffer (size=%d)", Size);
Clear();
}
else
esyslog(LOG_ERR, "ERROR: illegal size for ring buffer (%d)", Size);
esyslog("ERROR: illegal size for ring buffer (%d)", Size);
}
cRingBufferLinear::~cRingBufferLinear()
@ -163,7 +163,7 @@ int cRingBufferLinear::Put(const uchar *Data, int Count)
maxFill = fill;
int percent = maxFill * 100 / (Size() - 1);
if (percent > 75)
dsyslog(LOG_INFO, "buffer usage: %d%%", percent);
dsyslog("buffer usage: %d%%", percent);
}
}
if (free > 0) {
@ -228,7 +228,7 @@ cFrame::cFrame(const uchar *Data, int Count, eFrameType Type, int Index)
if (data)
memcpy(data, Data, count);
else
esyslog(LOG_ERR, "ERROR: can't allocate frame buffer (count=%d)", count);
esyslog("ERROR: can't allocate frame buffer (count=%d)", count);
next = NULL;
}
@ -314,7 +314,7 @@ void cRingBufferFrame::Drop(const cFrame *Frame)
}
}
else
esyslog(LOG_ERR, "ERROR: attempt to drop wrong frame from ring buffer!");
esyslog("ERROR: attempt to drop wrong frame from ring buffer!");
}
Unlock();
EnablePut();

32
svdrp.c
View File

@ -10,7 +10,7 @@
* and interact with the Video Disk Recorder - or write a full featured
* graphical interface that sits on top of an SVDRP connection.
*
* $Id: svdrp.c 1.36 2002/05/10 15:05:57 kls Exp $
* $Id: svdrp.c 1.37 2002/05/13 16:32:05 kls Exp $
*/
#include "svdrp.h"
@ -109,7 +109,7 @@ int cSocket::Accept(void)
close(newsock);
newsock = -1;
}
isyslog(LOG_INFO, "connect from %s, port %hd - %s", inet_ntoa(clientname.sin_addr), ntohs(clientname.sin_port), accepted ? "accepted" : "DENIED");
isyslog("connect from %s, port %hd - %s", inet_ntoa(clientname.sin_addr), ntohs(clientname.sin_port), accepted ? "accepted" : "DENIED");
}
else if (errno != EINTR && errno != EAGAIN)
LOG_ERROR;
@ -314,7 +314,7 @@ cSVDRP::cSVDRP(int Port)
numChars = 0;
message = NULL;
lastActivity = 0;
isyslog(LOG_INFO, "SVDRP listening on port %d", Port);
isyslog("SVDRP listening on port %d", Port);
}
cSVDRP::~cSVDRP()
@ -330,7 +330,7 @@ void cSVDRP::Close(bool Timeout)
char buffer[BUFSIZ];
gethostname(buffer, sizeof(buffer));
Reply(221, "%s closing connection%s", buffer, Timeout ? " (timeout)" : "");
isyslog(LOG_INFO, "closing SVDRP connection"); //TODO store IP#???
isyslog("closing SVDRP connection"); //TODO store IP#???
file.Close();
DELETENULL(PUTEhandler);
}
@ -375,7 +375,7 @@ void cSVDRP::Reply(int Code, const char *fmt, ...)
}
else {
Reply(451, "Zero return code - looks like a programming error!");
esyslog(LOG_ERR, "SVDRP: zero return code!");
esyslog("SVDRP: zero return code!");
}
}
}
@ -473,7 +473,7 @@ void cSVDRP::CmdDELT(const char *Option)
if (!timer->recording) {
Timers.Del(timer);
Timers.Save();
isyslog(LOG_INFO, "timer %s deleted", Option);
isyslog("timer %s deleted", Option);
Reply(250, "Timer \"%s\" deleted", Option);
}
else
@ -738,7 +738,7 @@ void cSVDRP::CmdMESG(const char *Option)
if (*Option) {
delete message;
message = strdup(Option);
isyslog(LOG_INFO, "SVDRP message: '%s'", message);
isyslog("SVDRP message: '%s'", message);
Reply(250, "Message stored");
}
else if (message)
@ -763,7 +763,7 @@ void cSVDRP::CmdMODC(const char *Option)
}
*channel = c;
Channels.Save();
isyslog(LOG_INFO, "channel %d modified", channel->number);
isyslog("channel %d modified", channel->number);
Reply(250, "%d %s", channel->number, channel->ToText());
}
else
@ -796,7 +796,7 @@ void cSVDRP::CmdMODT(const char *Option)
}
*timer = t;
Timers.Save();
isyslog(LOG_INFO, "timer %d modified (%s)", timer->Index() + 1, timer->active ? "active" : "inactive");
isyslog("timer %d modified (%s)", timer->Index() + 1, timer->active ? "active" : "inactive");
Reply(250, "%d %s", timer->Index() + 1, timer->ToText());
}
else
@ -829,7 +829,7 @@ void cSVDRP::CmdNEWC(const char *Option)
Channels.Add(channel);
Channels.ReNumber();
Channels.Save();
isyslog(LOG_INFO, "channel %d added", channel->number);
isyslog("channel %d added", channel->number);
Reply(250, "%d %s", channel->number, channel->ToText());
}
else
@ -848,7 +848,7 @@ void cSVDRP::CmdNEWT(const char *Option)
if (!t) {
Timers.Add(timer);
Timers.Save();
isyslog(LOG_INFO, "timer %d added", timer->Index() + 1);
isyslog("timer %d added", timer->Index() + 1);
Reply(250, "%d %s", timer->Index() + 1, timer->ToText());
return;
}
@ -904,11 +904,11 @@ void cSVDRP::CmdUPDT(const char *Option)
t->Parse(Option);
delete timer;
timer = t;
isyslog(LOG_INFO, "timer %d updated", timer->Index() + 1);
isyslog("timer %d updated", timer->Index() + 1);
}
else {
Timers.Add(timer);
isyslog(LOG_INFO, "timer %d added", timer->Index() + 1);
isyslog("timer %d added", timer->Index() + 1);
}
Timers.Save();
Reply(250, "%d %s", timer->Index() + 1, timer->ToText());
@ -1038,18 +1038,18 @@ void cSVDRP::Process(void)
}
else {
Reply(501, "Command line too long");
esyslog(LOG_ERR, "SVDRP: command line too long: '%s'", cmdLine);
esyslog("SVDRP: command line too long: '%s'", cmdLine);
numChars = 0;
}
lastActivity = time(NULL);
}
else if (r <= 0) {
isyslog(LOG_INFO, "lost connection to SVDRP client");
isyslog("lost connection to SVDRP client");
Close();
}
}
if (Setup.SVDRPTimeout && time(NULL) - lastActivity > Setup.SVDRPTimeout) {
isyslog(LOG_INFO, "timeout on SVDRP connection");
isyslog("timeout on SVDRP connection");
Close(true);
}
}

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: thread.c 1.19 2002/03/09 12:05:44 kls Exp $
* $Id: thread.c 1.20 2002/05/13 16:32:09 kls Exp $
*/
#include "thread.h"
@ -153,7 +153,7 @@ void cThread::Cancel(int WaitSeconds)
return;
usleep(10000);
}
esyslog(LOG_ERR, "ERROR: thread %d won't end (waited %d seconds) - cancelling it...", threadPid, WaitSeconds);
esyslog("ERROR: thread %d won't end (waited %d seconds) - cancelling it...", threadPid, WaitSeconds);
}
pthread_cancel(thread);
}
@ -175,18 +175,18 @@ void cThread::RaisePanic(void)
}
lastPanic = time(NULL);
if (panicLevel > MAXPANICLEVEL) {
esyslog(LOG_ERR, "ERROR: max. panic level exceeded");
esyslog("ERROR: max. panic level exceeded");
EmergencyExit(true);
}
else
dsyslog(LOG_INFO, "panic level: %d", panicLevel);
dsyslog("panic level: %d", panicLevel);
}
bool cThread::EmergencyExit(bool Request)
{
if (!Request)
return emergencyExitRequested;
esyslog(LOG_ERR, "initiating emergency exit");
esyslog("initiating emergency exit");
return emergencyExitRequested = true; // yes, it's an assignment, not a comparison!
}

79
tools.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: tools.c 1.63 2002/05/01 16:20:30 kls Exp $
* $Id: tools.c 1.66 2002/05/13 17:56:17 kls Exp $
*/
#include "tools.h"
@ -25,7 +25,7 @@ ssize_t safe_read(int filedes, void *buffer, size_t size)
for (;;) {
ssize_t p = read(filedes, buffer, size);
if (p < 0 && errno == EINTR) {
dsyslog(LOG_INFO, "EINTR while reading from file handle %d - retrying", filedes);
dsyslog("EINTR while reading from file handle %d - retrying", filedes);
continue;
}
return p;
@ -41,7 +41,7 @@ ssize_t safe_write(int filedes, const void *buffer, size_t size)
p = write(filedes, ptr, size);
if (p < 0) {
if (errno == EINTR) {
dsyslog(LOG_INFO, "EINTR while writing to file handle %d - retrying", filedes);
dsyslog("EINTR while writing to file handle %d - retrying", filedes);
continue;
}
break;
@ -77,7 +77,7 @@ char *strcpyrealloc(char *dest, const char *src)
if (dest)
strcpy(dest, src);
else
esyslog(LOG_ERR, "ERROR: out of memory");
esyslog("ERROR: out of memory");
}
else {
delete dest;
@ -269,10 +269,10 @@ bool DirectoryOk(const char *DirName, bool LogErrors)
if (access(DirName, R_OK | W_OK | X_OK) == 0)
return true;
else if (LogErrors)
esyslog(LOG_ERR, "ERROR: can't access %s", DirName);
esyslog("ERROR: can't access %s", DirName);
}
else if (LogErrors)
esyslog(LOG_ERR, "ERROR: %s is not a directory", DirName);
esyslog("ERROR: %s is not a directory", DirName);
}
else if (LogErrors)
LOG_ERROR_STR(DirName);
@ -291,7 +291,7 @@ bool MakeDirs(const char *FileName, bool IsDirectory)
*p = 0;
struct stat fs;
if (stat(s, &fs) != 0 || !S_ISDIR(fs.st_mode)) {
dsyslog(LOG_INFO, "creating directory %s", s);
dsyslog("creating directory %s", s);
if (mkdir(s, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) == -1) {
LOG_ERROR_STR(s);
result = false;
@ -329,15 +329,15 @@ bool RemoveFileOrDir(const char *FileName, bool FollowSymlinks)
}
else if (n < size) {
l[n] = 0;
dsyslog(LOG_INFO, "removing %s", l);
dsyslog("removing %s", l);
if (remove(l) < 0)
LOG_ERROR_STR(l);
}
else
esyslog(LOG_ERR, "ERROR: symlink name length (%d) exceeded anticipated buffer size (%d)", n, size);
esyslog("ERROR: symlink name length (%d) exceeded anticipated buffer size (%d)", n, size);
delete l;
}
dsyslog(LOG_INFO, "removing %s", buffer);
dsyslog("removing %s", buffer);
if (remove(buffer) < 0)
LOG_ERROR_STR(buffer);
delete buffer;
@ -350,7 +350,7 @@ bool RemoveFileOrDir(const char *FileName, bool FollowSymlinks)
return false;
}
}
dsyslog(LOG_INFO, "removing %s", FileName);
dsyslog("removing %s", FileName);
if (remove(FileName) < 0) {
LOG_ERROR_STR(FileName);
return false;
@ -392,7 +392,7 @@ bool RemoveEmptyDirectories(const char *DirName, bool RemoveThis)
}
closedir(d);
if (RemoveThis && empty) {
dsyslog(LOG_INFO, "removing %s", DirName);
dsyslog("removing %s", DirName);
if (remove(DirName) < 0) {
LOG_ERROR_STR(DirName);
return false;
@ -421,7 +421,7 @@ char *ReadLink(const char *FileName)
TargetName = RealName;
}
else
esyslog(LOG_ERR, "ERROR: symlink's target name too long: %s", FileName);
esyslog("ERROR: symlink's target name too long: %s", FileName);
return TargetName ? strdup(TargetName) : NULL;
}
@ -446,14 +446,14 @@ bool SpinUpDisk(const char *FileName)
gettimeofday(&tp2, NULL);
double seconds = (((long long)tp2.tv_sec * 1000000 + tp2.tv_usec) - ((long long)tp1.tv_sec * 1000000 + tp1.tv_usec)) / 1000000.0;
if (seconds > 0.5)
dsyslog(LOG_INFO, "SpinUpDisk took %.2f seconds\n", seconds);
dsyslog("SpinUpDisk took %.2f seconds\n", seconds);
return true;
}
else
LOG_ERROR_STR(buf);
}
}
esyslog(LOG_ERR, "ERROR: SpinUpDisk failed");
esyslog("ERROR: SpinUpDisk failed");
return false;
}
@ -501,7 +501,7 @@ bool cFile::Open(const char *FileName, int Flags, mode_t Mode)
{
if (!IsOpen())
return Open(open(FileName, Flags, Mode));
esyslog(LOG_ERR, "ERROR: attempt to re-open %s", FileName);
esyslog("ERROR: attempt to re-open %s", FileName);
return false;
}
@ -517,15 +517,15 @@ bool cFile::Open(int FileDes)
if (!files[f])
files[f] = true;
else
esyslog(LOG_ERR, "ERROR: file descriptor %d already in files[]", f);
esyslog("ERROR: file descriptor %d already in files[]", f);
return true;
}
else
esyslog(LOG_ERR, "ERROR: file descriptor %d is larger than FD_SETSIZE (%d)", f, FD_SETSIZE);
esyslog("ERROR: file descriptor %d is larger than FD_SETSIZE (%d)", f, FD_SETSIZE);
}
}
else
esyslog(LOG_ERR, "ERROR: attempt to re-open file descriptor %d", FileDes);
esyslog("ERROR: attempt to re-open file descriptor %d", FileDes);
}
return false;
}
@ -671,7 +671,7 @@ bool cLockFile::Lock(int WaitSeconds)
struct stat fs;
if (stat(fileName, &fs) == 0) {
if (time(NULL) - fs.st_mtime > LOCKFILESTALETIME) {
esyslog(LOG_ERR, "ERROR: removing stale lock file '%s'", fileName);
esyslog("ERROR: removing stale lock file '%s'", fileName);
if (remove(fileName) < 0) {
LOG_ERROR_STR(fileName);
break;
@ -704,7 +704,7 @@ void cLockFile::Unlock(void)
f = -1;
}
else
esyslog(LOG_ERR, "ERROR: attempt to unlock %s without holding a lock!", fileName);
esyslog("ERROR: attempt to unlock %s without holding a lock!", fileName);
}
// --- cListObject -----------------------------------------------------------
@ -724,6 +724,12 @@ void cListObject::Append(cListObject *Object)
Object->prev = this;
}
void cListObject::Insert(cListObject *Object)
{
prev = Object;
Object->next = this;
}
void cListObject::Unlink(void)
{
if (next)
@ -757,13 +763,34 @@ cListBase::~cListBase()
Clear();
}
void cListBase::Add(cListObject *Object)
void cListBase::Add(cListObject *Object, cListObject *After)
{
if (lastObject)
lastObject->Append(Object);
else
if (After && After != lastObject) {
After->Next()->Insert(Object);
After->Append(Object);
}
else {
if (lastObject)
lastObject->Append(Object);
else
objects = Object;
lastObject = Object;
}
}
void cListBase::Ins(cListObject *Object, cListObject *Before)
{
if (Before && Before != objects) {
Before->Prev()->Append(Object);
Before->Insert(Object);
}
else {
if (objects)
objects->Insert(Object);
else
lastObject = Object;
objects = Object;
lastObject = Object;
}
}
void cListBase::Del(cListObject *Object)

16
tools.h
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: tools.h 1.43 2002/05/11 08:35:47 kls Exp $
* $Id: tools.h 1.45 2002/05/13 16:21:55 kls Exp $
*/
#ifndef __TOOLS_H
@ -20,12 +20,12 @@
extern int SysLogLevel;
#define esyslog(a...) void( (SysLogLevel > 0) ? syslog(a) : void() )
#define isyslog(a...) void( (SysLogLevel > 1) ? syslog(a) : void() )
#define dsyslog(a...) void( (SysLogLevel > 2) ? syslog(a) : void() )
#define esyslog(a...) void( (SysLogLevel > 0) ? syslog(LOG_ERR, a) : void() )
#define isyslog(a...) void( (SysLogLevel > 1) ? syslog(LOG_INFO, a) : void() )
#define dsyslog(a...) void( (SysLogLevel > 2) ? syslog(LOG_DEBUG, a) : void() )
#define LOG_ERROR esyslog(LOG_ERR, "ERROR (%s,%d): %m", __FILE__, __LINE__)
#define LOG_ERROR_STR(s) esyslog(LOG_ERR, "ERROR: %s: %m", s)
#define LOG_ERROR esyslog("ERROR (%s,%d): %m", __FILE__, __LINE__)
#define LOG_ERROR_STR(s) esyslog("ERROR: %s: %m", s)
#define SECSINDAY 86400
@ -120,6 +120,7 @@ public:
virtual ~cListObject();
virtual bool operator< (const cListObject &ListObject) { return false; }
void Append(cListObject *Object);
void Insert(cListObject *Object);
void Unlink(void);
int Index(void);
cListObject *Prev(void) const { return prev; }
@ -132,7 +133,8 @@ protected:
cListBase(void);
public:
virtual ~cListBase();
void Add(cListObject *Object);
void Add(cListObject *Object, cListObject *After = NULL);
void Ins(cListObject *Object, cListObject *Before = NULL);
void Del(cListObject *Object);
virtual void Move(int From, int To);
void Move(cListObject *From, cListObject *To);

37
vdr.c
View File

@ -22,7 +22,7 @@
*
* The project's page is at http://www.cadsoft.de/people/kls/vdr
*
* $Id: vdr.c 1.105 2002/05/11 11:46:40 kls Exp $
* $Id: vdr.c 1.109 2002/05/13 16:32:49 kls Exp $
*/
#include <getopt.h>
@ -66,7 +66,7 @@ static void Watchdog(int signum)
{
// Something terrible must have happened that prevented the 'alarm()' from
// being called in time, so let's get out of here:
esyslog(LOG_ERR, "PANIC: watchdog timer expired - exiting!");
esyslog("PANIC: watchdog timer expired - exiting!");
exit(1);
}
@ -269,7 +269,7 @@ int main(int argc, char *argv[])
pid_t pid = fork();
if (pid < 0) {
fprintf(stderr, "%m\n");
esyslog(LOG_ERR, "ERROR: %m");
esyslog("ERROR: %m");
return 2;
}
if (pid != 0)
@ -289,7 +289,7 @@ int main(int argc, char *argv[])
stderr = freopen(Terminal, "w", stderr);
}
isyslog(LOG_INFO, "VDR version %s started", VDRVERSION);
isyslog("VDR version %s started", VDRVERSION);
// Load plugins:
@ -301,6 +301,8 @@ int main(int argc, char *argv[])
if (!ConfigDirectory)
ConfigDirectory = VideoDirectory;
cPlugin::SetConfigDirectory(ConfigDirectory);
Setup.Load(AddDirectory(ConfigDirectory, "setup.conf"));
Channels.Load(AddDirectory(ConfigDirectory, "channels.conf"));
Timers.Load(AddDirectory(ConfigDirectory, "timers.conf"));
@ -324,7 +326,8 @@ int main(int argc, char *argv[])
// Start plugins:
PluginManager.StartPlugins();
if (!PluginManager.StartPlugins())
return 2;
// Channel:
@ -364,14 +367,14 @@ int main(int argc, char *argv[])
bool ForceShutdown = false;
if (WatchdogTimeout > 0) {
dsyslog(LOG_INFO, "setting watchdog timer to %d seconds", WatchdogTimeout);
dsyslog("setting watchdog timer to %d seconds", WatchdogTimeout);
alarm(WatchdogTimeout); // Initial watchdog timer start
}
while (!Interrupted) {
// Handle emergency exits:
if (cThread::EmergencyExit()) {
esyslog(LOG_ERR, "emergency exit requested - shutting down");
esyslog("emergency exit requested - shutting down");
break;
}
// Restart the Watchdog timer:
@ -379,7 +382,7 @@ int main(int argc, char *argv[])
int LatencyTime = WatchdogTimeout - alarm(WatchdogTimeout);
if (LatencyTime > MaxLatencyTime) {
MaxLatencyTime = LatencyTime;
dsyslog(LOG_INFO, "max. latency time %d seconds", MaxLatencyTime);
dsyslog("max. latency time %d seconds", MaxLatencyTime);
}
}
// Channel display:
@ -426,7 +429,7 @@ int main(int argc, char *argv[])
cDisplayVolume::Process(key);
break;
// Power off:
case kPower: isyslog(LOG_INFO, "Power button pressed");
case kPower: isyslog("Power button pressed");
DELETENULL(*Interact);
if (!Shutdown) {
Interface->Error(tr("Can't shutdown - option '-s' not given!"));
@ -532,7 +535,7 @@ int main(int argc, char *argv[])
if (!LastActivity) {
if (!timer || Delta > MANUALSTART) {
// Apparently the user started VDR manually
dsyslog(LOG_INFO, "assuming manual start of VDR");
dsyslog("assuming manual start of VDR");
LastActivity = Now;
continue; // don't run into the actual shutdown procedure below
}
@ -550,7 +553,7 @@ int main(int argc, char *argv[])
if (!Next || Delta > Setup.MinEventTimeout * 60 || ForceShutdown) {
ForceShutdown = false;
if (timer)
dsyslog(LOG_INFO, "next timer event at %s", ctime(&Next));
dsyslog("next timer event at %s", ctime(&Next));
if (WatchdogTimeout > 0)
signal(SIGALRM, SIG_IGN);
if (Interface->Confirm(tr("Press any key to cancel shutdown"), UserShutdown ? 5 : SHUTDOWNWAIT, true)) {
@ -558,7 +561,7 @@ int main(int argc, char *argv[])
const char *File = timer ? timer->file : "";
char *cmd;
asprintf(&cmd, "%s %ld %ld %d \"%s\" %d", Shutdown, Next, Delta, Channel, strescape(File, "\"$"), UserShutdown);
isyslog(LOG_INFO, "executing '%s'", cmd);
isyslog("executing '%s'", cmd);
SystemExec(cmd);
delete cmd;
}
@ -573,11 +576,13 @@ int main(int argc, char *argv[])
}
// Disk housekeeping:
RemoveDeletedRecordings();
// Plugins housekeeping:
PluginManager.Housekeeping();
}
}
}
if (Interrupted)
isyslog(LOG_INFO, "caught signal %d", Interrupted);
isyslog("caught signal %d", Interrupted);
cVideoCutter::Stop();
delete Menu;
delete ReplayControl;
@ -588,12 +593,12 @@ int main(int argc, char *argv[])
Setup.Save();
cDvbApi::Cleanup();
if (WatchdogTimeout > 0)
dsyslog(LOG_INFO, "max. latency time %d seconds", MaxLatencyTime);
isyslog(LOG_INFO, "exiting");
dsyslog("max. latency time %d seconds", MaxLatencyTime);
isyslog("exiting");
if (SysLogLevel > 0)
closelog();
if (cThread::EmergencyExit()) {
esyslog(LOG_ERR, "emergency exit!");
esyslog("emergency exit!");
return 1;
}
return 0;

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: videodir.c 1.7 2002/01/27 12:37:26 kls Exp $
* $Id: videodir.c 1.8 2002/05/13 16:32:52 kls Exp $
*/
#include "videodir.h"
@ -108,7 +108,7 @@ int OpenVideoFile(const char *FileName, int Flags)
// Incoming name must be in base video directory:
if (strstr(FileName, VideoDirectory) != FileName) {
esyslog(LOG_ERR, "ERROR: %s not in %s", FileName, VideoDirectory);
esyslog("ERROR: %s not in %s", FileName, VideoDirectory);
errno = ENOENT; // must set 'errno' - any ideas for a better value?
return -1;
}