mirror of
https://github.com/vdr-projects/vdr.git
synced 2025-03-01 10:50:46 +00:00
Version 1.1.7
- Adapted VDR to the NEWSTRUCT driver. To use the new driver, compile VDR with 'make NEWSTRUCT=1' (thanks to Holger Wächtler for some valuable advice). By default it currently still uses the old driver. - Added some missing #includes (thanks to Martin Hammerschmid). - Changed the log error message "can't record MPEG1!" to "error in data stream!", since the mentioning of MPEG1 has irritated many people. - Consistently using malloc/free and new/delete (thanks to Andreas Schultz). - Temporarily made cDevice::ProvidesCa() virtual (Andreas Schultz needs this in his DXR3 plugin). - cDevice no longer exposes a file handle to cPlayer. A derived cPlayer class can now call DevicePoll() to see whether the replay device is ready for further data. A derived cDevice class must implement Poll() and shall check if any of its file handles is ready for data. - Implemented several replay modes to allow players that play only audio (thanks to Stefan Huelswitt). - Improved cCondVar::Wait() and implemented cCondVar::TimedWait() (thanks to Stefan Huelswitt). - VDR no longer gives up if there is no DVB device. It continues to work if there is at least one device, either a DVB device found by the core VDR code itself, or a device implemented by a plugin.
This commit is contained in:
parent
527748826c
commit
ed643353b1
@ -140,6 +140,8 @@ Stefan Huelswitt <huels@iname.com>
|
||||
for suggesting to make the config directory available to plugins
|
||||
for suggesting to add an error message if the directory specified in the '-L'
|
||||
option can't be accessed
|
||||
for implementing several replay modes to allow players that play only audio
|
||||
for improving cCondVar::Wait() and implementing cCondVar::TimedWait()
|
||||
|
||||
Ulrich Röder <roeder@efr-net.de>
|
||||
for pointing out that there are channels that have a symbol rate higher than
|
||||
@ -158,6 +160,7 @@ Andreas Schultz <aschultz@warp10.net>
|
||||
than 3 characters
|
||||
for adding direct access to the index data of cPalette (needed for displaying SPUs)
|
||||
for pointing out a possible race condition in the cDvbPlayer
|
||||
for making the use of malloc/free and new/delete consistent
|
||||
|
||||
Aaron Holtzman
|
||||
for writing 'ac3dec'
|
||||
@ -369,8 +372,11 @@ Paul Lacatus <paul@campina.iiruc.ro>
|
||||
Istvan Koenigsberger <istvnko@hotmail.com> and Guido Josten <guido.josten@t-online.de>
|
||||
for translating OSD texts to the Hungarian language
|
||||
|
||||
Christian Rienecker <C.Rienecker@deutschepost.de>
|
||||
Christian Rienecker <C.Rienecker@gmx.net>
|
||||
for making the VFAT handling more tolerant for users who forget to turn it on
|
||||
|
||||
Joerg Riechardt <J.Riechardt@gmx.de>
|
||||
for filling in some missing teletext PIDs
|
||||
|
||||
Holger Wächtler <holger@convergence.de>
|
||||
for some valuable advice during adapting to the NEWSTRUCT driver
|
||||
|
23
HISTORY
23
HISTORY
@ -1392,3 +1392,26 @@ Video Disk Recorder Revision History
|
||||
- Now using CC, CFLAGS, CXX and CXXFLAGS in Makefile.
|
||||
- Changed the cDevice class to allow plugins to implement their own devices (see
|
||||
PLUGINS.html for details).
|
||||
|
||||
2002-08-16: Version 1.1.7
|
||||
|
||||
- Adapted VDR to the NEWSTRUCT driver. To use the new driver, compile VDR with
|
||||
'make NEWSTRUCT=1' (thanks to Holger Wächtler for some valuable advice).
|
||||
By default it currently still uses the old driver.
|
||||
- Added some missing #includes (thanks to Martin Hammerschmid).
|
||||
- Changed the log error message "can't record MPEG1!" to "error in data stream!",
|
||||
since the mentioning of MPEG1 has irritated many people.
|
||||
- Consistently using malloc/free and new/delete (thanks to Andreas Schultz).
|
||||
- Temporarily made cDevice::ProvidesCa() virtual (Andreas Schultz needs this
|
||||
in his DXR3 plugin).
|
||||
- cDevice no longer exposes a file handle to cPlayer. A derived cPlayer class
|
||||
can now call DevicePoll() to see whether the replay device is ready for
|
||||
further data. A derived cDevice class must implement Poll() and shall
|
||||
check if any of its file handles is ready for data.
|
||||
- Implemented several replay modes to allow players that play only audio (thanks
|
||||
to Stefan Huelswitt).
|
||||
- Improved cCondVar::Wait() and implemented cCondVar::TimedWait() (thanks to
|
||||
Stefan Huelswitt).
|
||||
- VDR no longer gives up if there is no DVB device. It continues to work if
|
||||
there is at least one device, either a DVB device found by the core VDR code
|
||||
itself, or a device implemented by a plugin.
|
||||
|
7
Makefile
7
Makefile
@ -4,7 +4,7 @@
|
||||
# See the main source file 'vdr.c' for copyright information and
|
||||
# how to reach the author.
|
||||
#
|
||||
# $Id: Makefile 1.44 2002/07/28 15:20:47 kls Exp $
|
||||
# $Id: Makefile 1.45 2002/08/09 16:02:02 kls Exp $
|
||||
|
||||
.DELETE_ON_ERROR:
|
||||
|
||||
@ -23,7 +23,12 @@ PLUGINDIR= ./PLUGINS
|
||||
|
||||
VIDEODIR = /video
|
||||
|
||||
ifdef NEWSTRUCT
|
||||
INCLUDES = -I$(DVBDIR)/include
|
||||
DEFINES += -DNEWSTRUCT
|
||||
else
|
||||
INCLUDES = -I$(DVBDIR)/ost/include
|
||||
endif
|
||||
|
||||
DTVLIB = $(DTVDIR)/libdtv.a
|
||||
|
||||
|
42
PLUGINS.html
42
PLUGINS.html
@ -12,7 +12,6 @@ This interface allows programmers to develop additional functionality for VDR co
|
||||
separate from the core VDR source, without the need of patching the original
|
||||
VDR code (and all the problems of correlating various patches).
|
||||
<p>
|
||||
<!--X1.1.3--><table width=100%><tr><td bgcolor=#0000AA> </td><td width=100%>
|
||||
This document is divided into two parts, the first one describing the
|
||||
<a href="#Part I - The Outside Interface"><i>outside</i> interface</a>
|
||||
of the plugin system, and the second one describing the
|
||||
@ -21,20 +20,19 @@ The <i>outside</i> interface handles everything necessary for a plugin to get ho
|
||||
VDR program and present itself to the user.
|
||||
The <i>inside</i> interface provides the plugin code access to VDR's internal data
|
||||
structures and allows it to hook itself into specific areas to perform special actions.
|
||||
<!--X1.1.3--></td></tr></table>
|
||||
<p>
|
||||
<!--X1.1.3--><table width=100%><tr><td bgcolor=#0000AA> </td><td width=100%>
|
||||
Important modifications introduced in version 1.1.3 are marked like this.
|
||||
<!--X1.1.3--></td></tr></table>
|
||||
<!--X1.1.4--><table width=100%><tr><td bgcolor=#00AA00> </td><td width=100%>
|
||||
<!--X1.1.4--><table width=100%><tr><td bgcolor=#0000AA> </td><td width=100%>
|
||||
Important modifications introduced in version 1.1.4 are marked like this.
|
||||
<!--X1.1.4--></td></tr></table>
|
||||
<!--X1.1.5--><table width=100%><tr><td bgcolor=#AA0000> </td><td width=100%>
|
||||
<!--X1.1.5--><table width=100%><tr><td bgcolor=#00AA00> </td><td width=100%>
|
||||
Important modifications introduced in version 1.1.5 are marked like this.
|
||||
<!--X1.1.5--></td></tr></table>
|
||||
<!--X1.1.6--><table width=100%><tr><td bgcolor=#FF0000> </td><td width=100%>
|
||||
<!--X1.1.6--><table width=100%><tr><td bgcolor=#AA0000> </td><td width=100%>
|
||||
Important modifications introduced in version 1.1.6 are marked like this.
|
||||
<!--X1.1.6--></td></tr></table>
|
||||
<!--X1.1.7--><table width=100%><tr><td bgcolor=#FF0000> </td><td width=100%>
|
||||
Important modifications introduced in version 1.1.7 are marked like this.
|
||||
<!--X1.1.7--></td></tr></table>
|
||||
|
||||
<a name="Part I - The Outside Interface"><hr><center><h1>Part I - The Outside Interface</h1></center>
|
||||
|
||||
@ -814,7 +812,6 @@ and display their help and/or version information in addition to its own output.
|
||||
|
||||
If you want to make your plugin available to other VDR users, you'll need to
|
||||
make a package that can be easily distributed.
|
||||
<!--X1.1.3--><table width=100%><tr><td bgcolor=#0000AA> </td><td width=100%>
|
||||
The <tt>Makefile</tt> that has been created by the call to
|
||||
<a href="#Initializing a new plugin directory"><tt>newplugin</tt></a>
|
||||
provides the target <tt>dist</tt>, which does this for you.
|
||||
@ -825,7 +822,6 @@ Simply change into your source directory and execute <tt>make dist</tt>:
|
||||
cd VDR/PLUGINS/SRC/hello
|
||||
make dist
|
||||
</pre></td></tr></table><p>
|
||||
<!--X1.1.3--></td></tr></table>
|
||||
|
||||
After this you should find a file named like
|
||||
|
||||
@ -836,7 +832,6 @@ vdr-hello-0.0.1.tgz
|
||||
in your source directory, where <tt>hello</tt> will be replaced with your actual
|
||||
plugin's name, and <tt>0.0.1</tt> will be your plugin's current version number.
|
||||
|
||||
<!--X1.1.3--><table width=100%><tr><td bgcolor=#0000AA> </td><td width=100%>
|
||||
<a name="Part II - The Inside Interface"><hr><center><h1>Part II - The Inside Interface</h1></center>
|
||||
|
||||
<hr><h2>Status monitor</h2>
|
||||
@ -911,9 +906,8 @@ objects were created.
|
||||
See the file <tt>status.h</tt> for detailed information on which status monitor
|
||||
member functions are available in <tt>cStatus</tt>. You only need to implement
|
||||
the functions you actually want to use.
|
||||
<!--X1.1.3--></td></tr></table>
|
||||
|
||||
<!--X1.1.4--><table width=100%><tr><td bgcolor=#00AA00> </td><td width=100%>
|
||||
<!--X1.1.4--><table width=100%><tr><td bgcolor=#0000AA> </td><td width=100%>
|
||||
<hr><h2>Players</h2>
|
||||
|
||||
<center><i><b>Play it again, Sam!</b></i></center><p>
|
||||
@ -959,11 +953,20 @@ To play the video data, the player needs to call its member function
|
||||
int PlayVideo(const uchar *Data, int Length);
|
||||
</pre></td></tr></table><p>
|
||||
|
||||
where <tt>Data</tt> point to a block of <tt>Length</tt> bytes of a PES data
|
||||
where <tt>Data</tt> points to a block of <tt>Length</tt> bytes of a PES data
|
||||
stream. There are no prerequisites regarding the length or alignment of an
|
||||
individual block of data. The sum of all blocks must simply result in the
|
||||
desired video data stream, and it must be delivered fast enough so that the
|
||||
DVB device doesn't run out of data.
|
||||
<!--X1.1.7--><table width=100%><tr><td bgcolor=#FF0000> </td><td width=100%>
|
||||
To avoid busy loops the player should call its member function
|
||||
|
||||
<p><table><tr><td bgcolor=#F0F0F0><pre><br>
|
||||
bool DevicePoll(cPoller &Poller, int TimeoutMs = 0);
|
||||
</pre></td></tr></table><p>
|
||||
|
||||
to determine whether the device is ready for further data.
|
||||
<!--X1.1.7--></td></tr></table>
|
||||
<p>
|
||||
TODO: PlayAudio()???
|
||||
<p>
|
||||
@ -1064,7 +1067,7 @@ that they already know. If you absolutely want to do things differently, just go
|
||||
ahead - it's your show...
|
||||
<!--X1.1.4--></td></tr></table>
|
||||
|
||||
<!--X1.1.6--><table width=100%><tr><td bgcolor=#FF0000> </td><td width=100%>
|
||||
<!--X1.1.6--><table width=100%><tr><td bgcolor=#AA0000> </td><td width=100%>
|
||||
<hr><h2>Receivers</h2>
|
||||
|
||||
<center><i><b>Tapping into the stream...</b></i></center><p>
|
||||
@ -1120,7 +1123,7 @@ If the <tt>cReceiver</tt> isn't needed any more, it may simply be <i>deleted</i>
|
||||
and will automatically detach itself from the <tt>cDevice</tt>.
|
||||
<!--X1.1.6--></td></tr></table>
|
||||
|
||||
<!--X1.1.5--><table width=100%><tr><td bgcolor=#AA0000> </td><td width=100%>
|
||||
<!--X1.1.5--><table width=100%><tr><td bgcolor=#00AA00> </td><td width=100%>
|
||||
<hr><h2>The On Screen Display</h2>
|
||||
|
||||
<center><i><b>Express yourself</b></i></center><p>
|
||||
@ -1152,7 +1155,7 @@ of these functions, and VDR/osd.c to see how VDR opens the OSD and sets up
|
||||
its windows and color depths).
|
||||
<!--X1.1.5--></td></tr></table>
|
||||
|
||||
<!--X1.1.6--><table width=100%><tr><td bgcolor=#FF0000> </td><td width=100%>
|
||||
<!--X1.1.6--><table width=100%><tr><td bgcolor=#AA0000> </td><td width=100%>
|
||||
<hr><h2>Devices</h2>
|
||||
|
||||
<center><i><b>Expanding the possibilities</b></i></center><p>
|
||||
@ -1225,17 +1228,20 @@ to indicate this to VDR.
|
||||
<p>
|
||||
The functions to implement replaying capabilites are
|
||||
|
||||
<!--X1.1.7--><table width=100%><tr><td bgcolor=#FF0000> </td><td width=100%>
|
||||
<p><table><tr><td bgcolor=#F0F0F0><pre><br>
|
||||
virtual bool HasDecoder(void) const;
|
||||
virtual int SetPlayMode(bool On);
|
||||
virtual bool SetPlayMode(ePlayMode PlayMode);
|
||||
virtual void TrickSpeed(int Speed);
|
||||
virtual void Clear(void);
|
||||
virtual void Play(void);
|
||||
virtual void Freeze(void);
|
||||
virtual void Mute(void);
|
||||
virtual void StillPicture(const uchar *Data, int Length);
|
||||
virtual bool Poll(cPoller &Poller, int TimeoutMs = 0);
|
||||
virtual int PlayVideo(const uchar *Data, int Length);
|
||||
</pre></td></tr></table><p>
|
||||
<!--X1.1.7--></td></tr></table>
|
||||
|
||||
In addition, the following functions may be implemented to provide further
|
||||
functionality:
|
||||
|
42
config.c
42
config.c
@ -4,7 +4,7 @@
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* how to reach the author.
|
||||
*
|
||||
* $Id: config.c 1.103 2002/08/04 12:03:11 kls Exp $
|
||||
* $Id: config.c 1.104 2002/08/11 11:35:18 kls Exp $
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
@ -217,7 +217,7 @@ const char *cChannel::ToText(cChannel *Channel)
|
||||
s = strcpy(buf, s);
|
||||
strreplace(s, ':', '|');
|
||||
}
|
||||
delete buffer;
|
||||
free(buffer);
|
||||
if (Channel->groupSep)
|
||||
asprintf(&buffer, ":%s\n", s);
|
||||
else {
|
||||
@ -267,7 +267,7 @@ bool cChannel::Parse(const char *s)
|
||||
sscanf(apidbuf, "%d ,%d ", &apid1, &apid2);
|
||||
if (p)
|
||||
sscanf(p, "%d ,%d ", &dpid1, &dpid2);
|
||||
delete apidbuf;
|
||||
free(apidbuf);
|
||||
}
|
||||
else
|
||||
return false;
|
||||
@ -279,7 +279,7 @@ bool cChannel::Parse(const char *s)
|
||||
tpid = 0;
|
||||
}
|
||||
strn0cpy(name, buffer, MaxChannelName);
|
||||
delete buffer;
|
||||
free(buffer);
|
||||
}
|
||||
else
|
||||
return false;
|
||||
@ -377,7 +377,7 @@ cTimer::cTimer(const cEventInfo *EventInfo)
|
||||
|
||||
cTimer::~cTimer()
|
||||
{
|
||||
delete summary;
|
||||
free(summary);
|
||||
}
|
||||
|
||||
cTimer& cTimer::operator= (const cTimer &Timer)
|
||||
@ -398,7 +398,7 @@ bool cTimer::operator< (const cListObject &ListObject)
|
||||
|
||||
const char *cTimer::ToText(cTimer *Timer)
|
||||
{
|
||||
delete buffer;
|
||||
free(buffer);
|
||||
strreplace(Timer->file, ':', '|');
|
||||
strreplace(Timer->summary, '\n', '|');
|
||||
asprintf(&buffer, "%d:%d:%s:%04d:%04d:%d:%d:%s:%s\n", Timer->active, Timer->channel, PrintDay(Timer->day, Timer->firstday), Timer->start, Timer->stop, Timer->priority, Timer->lifetime, Timer->file, Timer->summary ? Timer->summary : "");
|
||||
@ -495,7 +495,7 @@ bool cTimer::Parse(const char *s)
|
||||
{
|
||||
char *buffer1 = NULL;
|
||||
char *buffer2 = NULL;
|
||||
delete summary;
|
||||
free(summary);
|
||||
summary = NULL;
|
||||
//XXX Apparently sscanf() doesn't work correctly if the last %a argument
|
||||
//XXX results in an empty string (this first occured when the EIT gathering
|
||||
@ -508,13 +508,13 @@ bool cTimer::Parse(const char *s)
|
||||
while (l2 > 0 && isspace(s[l2 - 1]))
|
||||
l2--;
|
||||
if (s[l2 - 1] == ':') {
|
||||
s2 = (char *)malloc(l2 + 3);
|
||||
s2 = MALLOC(char, l2 + 3);
|
||||
strcat(strn0cpy(s2, s, l2 + 1), " \n");
|
||||
s = s2;
|
||||
}
|
||||
if (8 <= sscanf(s, "%d :%d :%a[^:]:%d :%d :%d :%d :%a[^:\n]:%a[^\n]", &active, &channel, &buffer1, &start, &stop, &priority, &lifetime, &buffer2, &summary)) {
|
||||
if (summary && !*skipspace(summary)) {
|
||||
delete summary;
|
||||
free(summary);
|
||||
summary = NULL;
|
||||
}
|
||||
//TODO add more plausibility checks
|
||||
@ -522,12 +522,12 @@ bool cTimer::Parse(const char *s)
|
||||
strn0cpy(file, buffer2, MaxFileName);
|
||||
strreplace(file, '|', ':');
|
||||
strreplace(summary, '|', '\n');
|
||||
delete buffer1;
|
||||
delete buffer2;
|
||||
delete s2;
|
||||
free(buffer1);
|
||||
free(buffer2);
|
||||
free(s2);
|
||||
return day != 0;
|
||||
}
|
||||
delete s2;
|
||||
free(s2);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -661,8 +661,8 @@ cCommand::cCommand(void)
|
||||
|
||||
cCommand::~cCommand()
|
||||
{
|
||||
delete title;
|
||||
delete command;
|
||||
free(title);
|
||||
free(command);
|
||||
}
|
||||
|
||||
bool cCommand::Parse(const char *s)
|
||||
@ -685,7 +685,7 @@ bool cCommand::Parse(const char *s)
|
||||
const char *cCommand::Execute(void)
|
||||
{
|
||||
dsyslog("executing command '%s'", command);
|
||||
delete result;
|
||||
free(result);
|
||||
result = NULL;
|
||||
FILE *p = popen(command, "r");
|
||||
if (p) {
|
||||
@ -749,7 +749,7 @@ cCaDefinition::cCaDefinition(void)
|
||||
|
||||
cCaDefinition::~cCaDefinition()
|
||||
{
|
||||
delete description;
|
||||
free(description);
|
||||
}
|
||||
|
||||
bool cCaDefinition::Parse(const char *s)
|
||||
@ -935,9 +935,9 @@ cSetupLine::cSetupLine(const char *Name, const char *Value, const char *Plugin)
|
||||
|
||||
cSetupLine::~cSetupLine()
|
||||
{
|
||||
delete plugin;
|
||||
delete name;
|
||||
delete value;
|
||||
free(plugin);
|
||||
free(name);
|
||||
free(value);
|
||||
}
|
||||
|
||||
bool cSetupLine::operator< (const cListObject &ListObject)
|
||||
@ -1068,7 +1068,7 @@ void cSetup::Store(const char *Name, int Value, const char *Plugin)
|
||||
char *buffer = NULL;
|
||||
asprintf(&buffer, "%d", Value);
|
||||
Store(Name, buffer, Plugin);
|
||||
delete buffer;
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
bool cSetup::Load(const char *FileName)
|
||||
|
10
config.h
10
config.h
@ -4,7 +4,7 @@
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* how to reach the author.
|
||||
*
|
||||
* $Id: config.h 1.121 2002/07/27 12:00:30 kls Exp $
|
||||
* $Id: config.h 1.123 2002/08/11 11:36:36 kls Exp $
|
||||
*/
|
||||
|
||||
#ifndef __CONFIG_H
|
||||
@ -12,6 +12,7 @@
|
||||
|
||||
#include <arpa/inet.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
@ -19,7 +20,7 @@
|
||||
#include "eit.h"
|
||||
#include "tools.h"
|
||||
|
||||
#define VDRVERSION "1.1.6"
|
||||
#define VDRVERSION "1.1.7"
|
||||
|
||||
#define MAXPRIORITY 99
|
||||
#define MAXLIFETIME 99
|
||||
@ -214,12 +215,13 @@ private:
|
||||
char *fileName;
|
||||
void Clear(void)
|
||||
{
|
||||
delete fileName;
|
||||
free(fileName);
|
||||
fileName = NULL;
|
||||
cList<T>::Clear();
|
||||
}
|
||||
public:
|
||||
cConfig(void) { fileName = NULL; }
|
||||
virtual ~cConfig() { delete fileName; }
|
||||
virtual ~cConfig() { free(fileName); }
|
||||
const char *FileName(void) { return fileName; }
|
||||
bool Load(const char *FileName, bool AllowComments = false)
|
||||
{
|
||||
|
6
cutter.c
6
cutter.c
@ -4,7 +4,7 @@
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* how to reach the author.
|
||||
*
|
||||
* $Id: cutter.c 1.1 2002/06/22 10:09:34 kls Exp $
|
||||
* $Id: cutter.c 1.2 2002/08/11 11:09:23 kls Exp $
|
||||
*/
|
||||
|
||||
#include "cutter.h"
|
||||
@ -196,7 +196,7 @@ bool cCutter::Start(const char *FileName)
|
||||
RemoveVideoFile(s);
|
||||
}
|
||||
}
|
||||
delete s;
|
||||
free(s);
|
||||
// XXX
|
||||
editedVersionName = strdup(evn);
|
||||
Recording.WriteSummary();
|
||||
@ -231,7 +231,7 @@ bool cCutter::Active(void)
|
||||
Stop();
|
||||
if (!error)
|
||||
cRecordingUserCommand::InvokeCommand(RUC_EDITEDRECORDING, editedVersionName);
|
||||
delete editedVersionName;
|
||||
free(editedVersionName);
|
||||
editedVersionName = NULL;
|
||||
ended = true;
|
||||
}
|
||||
|
19
device.c
19
device.c
@ -4,12 +4,11 @@
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* how to reach the author.
|
||||
*
|
||||
* $Id: device.c 1.8 2002/08/04 15:18:05 kls Exp $
|
||||
* $Id: device.c 1.12 2002/08/16 09:50:43 kls Exp $
|
||||
*/
|
||||
|
||||
#include "device.h"
|
||||
#include <errno.h>
|
||||
#include <poll.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/mman.h>
|
||||
#include "eit.h"
|
||||
@ -98,7 +97,7 @@ bool cDevice::SetPrimaryDevice(int n)
|
||||
primaryDevice->MakePrimaryDevice(true);
|
||||
return true;
|
||||
}
|
||||
esyslog("invalid device number: %d", n + 1);
|
||||
esyslog("invalid primary device number: %d", n + 1);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -317,9 +316,9 @@ void cDevice::SetVolume(int Volume, bool Absolute)
|
||||
mute = false;
|
||||
}
|
||||
|
||||
int cDevice::SetPlayMode(bool On)
|
||||
bool cDevice::SetPlayMode(ePlayMode PlayMode)
|
||||
{
|
||||
return -1;
|
||||
return false;
|
||||
}
|
||||
|
||||
void cDevice::TrickSpeed(int Speed)
|
||||
@ -362,7 +361,7 @@ bool cDevice::AttachPlayer(cPlayer *Player)
|
||||
Detach(player);
|
||||
player = Player;
|
||||
player->device = this;
|
||||
player->deviceFileHandle = SetPlayMode(true);
|
||||
SetPlayMode(player->playMode);
|
||||
player->Activate(true);
|
||||
return true;
|
||||
}
|
||||
@ -373,10 +372,9 @@ void cDevice::Detach(cPlayer *Player)
|
||||
{
|
||||
if (Player && player == Player) {
|
||||
player->Activate(false);
|
||||
player->deviceFileHandle = -1;
|
||||
player->device = NULL;
|
||||
player = NULL;
|
||||
SetPlayMode(false);
|
||||
SetPlayMode(pmNone);
|
||||
}
|
||||
}
|
||||
|
||||
@ -399,6 +397,11 @@ void cDevice::StopReplay(void)
|
||||
}
|
||||
}
|
||||
|
||||
bool cDevice::Poll(cPoller &Poller, int TimeoutMs)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int cDevice::PlayVideo(const uchar *Data, int Length)
|
||||
{
|
||||
return -1;
|
||||
|
37
device.h
37
device.h
@ -4,7 +4,7 @@
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* how to reach the author.
|
||||
*
|
||||
* $Id: device.h 1.5 2002/08/04 14:02:19 kls Exp $
|
||||
* $Id: device.h 1.9 2002/08/16 08:52:27 kls Exp $
|
||||
*/
|
||||
|
||||
#ifndef __DEVICE_H
|
||||
@ -26,6 +26,23 @@
|
||||
|
||||
enum eSetChannelResult { scrOk, scrNoTransfer, scrFailed };
|
||||
|
||||
enum ePlayMode { pmNone, // audio/video from decoder
|
||||
pmAudioVideo, // audio/video from player
|
||||
pmAudioOnly, // audio only from player, video from decoder
|
||||
pmExtern_THIS_SHOULD_BE_AVOIDED
|
||||
// external player (e.g. MPlayer), release the device
|
||||
// WARNING: USE THIS MODE ONLY AS A LAST RESORT, IF YOU
|
||||
// ABSOLUTELY, POSITIVELY CAN'T IMPLEMENT YOUR PLAYER
|
||||
// THE WAY IT IS SUPPOSED TO WORK. FORCING THE DEVICE
|
||||
// TO RELEASE ITS FILES HANDLES (OR WHATEVER RESOURCES
|
||||
// IT MAY USE) TO ALLOW AN EXTERNAL PLAYER TO ACCESS
|
||||
// THEM MEANS THAT SUCH A PLAYER WILL NEED TO HAVE
|
||||
// DETAILED KNOWLEDGE ABOUT THE INTERNALS OF THE DEVICE
|
||||
// IN USE. AS A CONSEQUENCE, YOUR PLAYER MAY NOT WORK
|
||||
// IF A PARTICULAR VDR INSTALLATION USES A DEVICE NOT
|
||||
// KNOWN TO YOUR PLAYER.
|
||||
};
|
||||
|
||||
class cChannel;
|
||||
class cPlayer;
|
||||
class cReceiver;
|
||||
@ -97,7 +114,9 @@ public:
|
||||
bool IsPrimaryDevice(void) const { return this == primaryDevice; }
|
||||
int CardIndex(void) const { return cardIndex; }
|
||||
// Returns the card index of this device (0 ... MAXDEVICES - 1).
|
||||
int ProvidesCa(int Ca);
|
||||
virtual int ProvidesCa(int Ca);
|
||||
//XXX TODO temporarily made this function virtual - until a general
|
||||
//XXX mechanism has been implemented
|
||||
// Checks whether this device provides the given value in its
|
||||
// caCaps. Returns 0 if the value is not provided, 1 if only this
|
||||
// value is provided, and > 1 if this and other values are provided.
|
||||
@ -188,11 +207,9 @@ public:
|
||||
private:
|
||||
cPlayer *player;
|
||||
protected:
|
||||
virtual int SetPlayMode(bool On);
|
||||
// Sets the device into play mode (On = true) or normal
|
||||
// viewing mode (On = false). If On is true, it may return a file
|
||||
// handle that a player can use to poll this device when replaying.
|
||||
//XXX TODO should be implemented differently
|
||||
virtual bool SetPlayMode(ePlayMode PlayMode);
|
||||
// Sets the device into the given play mode.
|
||||
// Returns true if the operation was successful.
|
||||
public:
|
||||
virtual void TrickSpeed(int Speed);
|
||||
// Sets the device into a mode where replay is done slower.
|
||||
@ -209,6 +226,12 @@ public:
|
||||
// Turns off audio while replaying.
|
||||
virtual void StillPicture(const uchar *Data, int Length);
|
||||
// Displays the given I-frame as a still picture.
|
||||
virtual bool Poll(cPoller &Poller, int TimeoutMs = 0);
|
||||
// Returns true if the device itself or any of the file handles in
|
||||
// Poller is ready for further action.
|
||||
// If TimeoutMs is not zero, the device will wait up to the given number
|
||||
// of milleseconds before returning in case there is no immediate
|
||||
// need for data.
|
||||
virtual int PlayVideo(const uchar *Data, int Length);
|
||||
// Actually plays the given data block as video. The data must be
|
||||
// part of a PES (Packetized Elementary Stream) which can contain
|
||||
|
264
dvbdevice.c
264
dvbdevice.c
@ -4,7 +4,7 @@
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* how to reach the author.
|
||||
*
|
||||
* $Id: dvbdevice.c 1.1 2002/08/04 12:24:25 kls Exp $
|
||||
* $Id: dvbdevice.c 1.7 2002/08/16 09:27:53 kls Exp $
|
||||
*/
|
||||
|
||||
#include "dvbdevice.h"
|
||||
@ -18,10 +18,15 @@ extern "C" {
|
||||
}
|
||||
#include <limits.h>
|
||||
#include <linux/videodev.h>
|
||||
#ifdef NEWSTRUCT
|
||||
#include <linux/dvb/audio.h>
|
||||
#include <linux/dvb/frontend.h>
|
||||
#include <linux/dvb/video.h>
|
||||
#else
|
||||
#include <ost/audio.h>
|
||||
#include <ost/sec.h>
|
||||
#include <ost/video.h>
|
||||
#include <poll.h>
|
||||
#endif
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/mman.h>
|
||||
#include "dvbosd.h"
|
||||
@ -33,24 +38,38 @@ extern "C" {
|
||||
#define MAXDVBDEVICES 4
|
||||
|
||||
#define DEV_VIDEO "/dev/video"
|
||||
#define DEV_OST_OSD "/dev/ost/osd"
|
||||
#define DEV_OST_FRONTEND "/dev/ost/frontend"
|
||||
#define DEV_OST_SEC "/dev/ost/sec"
|
||||
#define DEV_OST_DVR "/dev/ost/dvr"
|
||||
#define DEV_OST_DEMUX "/dev/ost/demux"
|
||||
#define DEV_OST_VIDEO "/dev/ost/video"
|
||||
#define DEV_OST_AUDIO "/dev/ost/audio"
|
||||
#ifdef NEWSTRUCT
|
||||
#define DEV_DVB_ADAPTER "/dev/dvb/adapter"
|
||||
#define DEV_DVB_OSD "osd"
|
||||
#define DEV_DVB_FRONTEND "frontend"
|
||||
#define DEV_DVB_DVR "dvr"
|
||||
#define DEV_DVB_DEMUX "demux"
|
||||
#define DEV_DVB_VIDEO "video"
|
||||
#define DEV_DVB_AUDIO "audio"
|
||||
#else
|
||||
#define DEV_DVB_OSD "/dev/ost/osd"
|
||||
#define DEV_DVB_FRONTEND "/dev/ost/frontend"
|
||||
#define DEV_DVB_SEC "/dev/ost/sec"
|
||||
#define DEV_DVB_DVR "/dev/ost/dvr"
|
||||
#define DEV_DVB_DEMUX "/dev/ost/demux"
|
||||
#define DEV_DVB_VIDEO "/dev/ost/video"
|
||||
#define DEV_DVB_AUDIO "/dev/ost/audio"
|
||||
#endif
|
||||
|
||||
static const char *OstName(const char *Name, int n)
|
||||
static const char *DvbName(const char *Name, int n)
|
||||
{
|
||||
static char buffer[PATH_MAX];
|
||||
#ifdef NEWSTRUCT
|
||||
snprintf(buffer, sizeof(buffer), "%s%d/%s%d", DEV_DVB_ADAPTER, n, Name, 0);
|
||||
#else
|
||||
snprintf(buffer, sizeof(buffer), "%s%d", Name, n);
|
||||
#endif
|
||||
return buffer;
|
||||
}
|
||||
|
||||
static int OstOpen(const char *Name, int n, int Mode, bool ReportError = false)
|
||||
static int DvbOpen(const char *Name, int n, int Mode, bool ReportError = false)
|
||||
{
|
||||
const char *FileName = OstName(Name, n);
|
||||
const char *FileName = DvbName(Name, n);
|
||||
int fd = open(FileName, Mode);
|
||||
if (fd < 0 && ReportError)
|
||||
LOG_ERROR_STR(FileName);
|
||||
@ -61,20 +80,23 @@ cDvbDevice::cDvbDevice(int n)
|
||||
{
|
||||
frontendType = FrontendType(-1); // don't know how else to initialize this - there is no FE_UNKNOWN
|
||||
siProcessor = NULL;
|
||||
playMode = pmNone;
|
||||
|
||||
// Devices that are present on all card types:
|
||||
|
||||
fd_frontend = OstOpen(DEV_OST_FRONTEND, n, O_RDWR);
|
||||
|
||||
// Devices that are only present on DVB-S cards:
|
||||
|
||||
fd_sec = OstOpen(DEV_OST_SEC, n, O_RDWR);
|
||||
fd_frontend = DvbOpen(DEV_DVB_FRONTEND, n, O_RDWR | O_NONBLOCK);
|
||||
|
||||
// Devices that are only present on cards with decoders:
|
||||
|
||||
fd_osd = OstOpen(DEV_OST_OSD, n, O_RDWR);
|
||||
fd_video = OstOpen(DEV_OST_VIDEO, n, O_RDWR | O_NONBLOCK);
|
||||
fd_audio = OstOpen(DEV_OST_AUDIO, n, O_RDWR | O_NONBLOCK);
|
||||
fd_osd = DvbOpen(DEV_DVB_OSD, n, O_RDWR);
|
||||
fd_video = DvbOpen(DEV_DVB_VIDEO, n, O_RDWR | O_NONBLOCK);
|
||||
fd_audio = DvbOpen(DEV_DVB_AUDIO, n, O_RDWR | O_NONBLOCK);
|
||||
|
||||
#ifndef NEWSTRUCT
|
||||
// Devices that are only present on DVB-S cards:
|
||||
|
||||
fd_sec = DvbOpen(DEV_DVB_SEC, n, O_RDWR);
|
||||
#endif
|
||||
|
||||
// The DVR device (will be opened and closed as needed):
|
||||
|
||||
@ -87,8 +109,12 @@ cDvbDevice::cDvbDevice(int n)
|
||||
// We only check the devices that must be present - the others will be checked before accessing them://XXX
|
||||
|
||||
if (fd_frontend >= 0) {
|
||||
siProcessor = new cSIProcessor(OstName(DEV_OST_DEMUX, n));
|
||||
#ifdef NEWSTRUCT
|
||||
dvb_frontend_info feinfo;
|
||||
#else
|
||||
FrontendInfo feinfo;
|
||||
#endif
|
||||
siProcessor = new cSIProcessor(DvbName(DEV_DVB_DEMUX, n));
|
||||
if (ioctl(fd_frontend, FE_GET_INFO, &feinfo) >= 0)
|
||||
frontendType = feinfo.type;
|
||||
else
|
||||
@ -130,7 +156,7 @@ bool cDvbDevice::Initialize(void)
|
||||
int i;
|
||||
for (i = 0; i < MAXDVBDEVICES; i++) {
|
||||
if (UseDevice(NextCardIndex())) {
|
||||
if (Probe(OstName(DEV_OST_FRONTEND, i))) {
|
||||
if (Probe(DvbName(DEV_DVB_FRONTEND, i))) {
|
||||
new cDvbDevice(i);
|
||||
found++;
|
||||
}
|
||||
@ -169,7 +195,7 @@ bool cDvbDevice::HasDecoder(void) const
|
||||
|
||||
bool cDvbDevice::GrabImage(const char *FileName, bool Jpeg, int Quality, int SizeX, int SizeY)
|
||||
{
|
||||
int videoDev = OstOpen(DEV_VIDEO, CardIndex(), O_RDWR, true);
|
||||
int videoDev = DvbOpen(DEV_VIDEO, CardIndex(), O_RDWR, true);
|
||||
if (videoDev >= 0) {
|
||||
int result = 0;
|
||||
struct video_mbuf mbuf;
|
||||
@ -274,7 +300,7 @@ bool cDvbDevice::SetPid(cPidHandle *Handle, int Type, bool On)
|
||||
if (Handle->pid) {
|
||||
if (On) {
|
||||
if (Handle->handle < 0) {
|
||||
Handle->handle = OstOpen(DEV_OST_DEMUX, CardIndex(), O_RDWR | O_NONBLOCK, true);
|
||||
Handle->handle = DvbOpen(DEV_DVB_DEMUX, CardIndex(), O_RDWR | O_NONBLOCK, true);
|
||||
if (Handle->handle < 0)
|
||||
return false;
|
||||
}
|
||||
@ -290,6 +316,7 @@ bool cDvbDevice::SetPid(cPidHandle *Handle, int Type, bool On)
|
||||
|
||||
if (Handle->pid != 0x1FFF) {
|
||||
dmxPesFilterParams pesFilterParams;
|
||||
memset(&pesFilterParams, 0, sizeof(pesFilterParams));
|
||||
pesFilterParams.pid = Handle->pid;
|
||||
pesFilterParams.input = DMX_IN_FRONTEND;
|
||||
pesFilterParams.output = (Type <= ptTeletext && Handle->used <= 1) ? DMX_OUT_DECODER : DMX_OUT_TS_TAP;
|
||||
@ -332,7 +359,13 @@ bool cDvbDevice::SetChannelDevice(const cChannel *Channel)
|
||||
DelPid(pidHandles[ptDolby].pid);
|
||||
}
|
||||
|
||||
#ifdef NEWSTRUCT
|
||||
dvb_frontend_parameters Frontend;
|
||||
#else
|
||||
FrontendParameters Frontend;
|
||||
#endif
|
||||
|
||||
memset(&Frontend, 0, sizeof(Frontend));
|
||||
|
||||
switch (frontendType) {
|
||||
case FE_QPSK: { // DVB-S
|
||||
@ -351,15 +384,38 @@ bool cDvbDevice::SetChannelDevice(const cChannel *Channel)
|
||||
tone = SEC_TONE_ON;
|
||||
}
|
||||
|
||||
#ifdef NEWSTRUCT
|
||||
Frontend.frequency = freq * 1000UL;
|
||||
Frontend.inversion = INVERSION_AUTO;
|
||||
Frontend.u.qpsk.symbol_rate = Channel->srate * 1000UL;
|
||||
Frontend.u.qpsk.fec_inner = FEC_AUTO;
|
||||
#else
|
||||
Frontend.Frequency = freq * 1000UL;
|
||||
Frontend.Inversion = INVERSION_AUTO;
|
||||
Frontend.u.qpsk.SymbolRate = Channel->srate * 1000UL;
|
||||
Frontend.u.qpsk.FEC_inner = FEC_AUTO;
|
||||
#endif
|
||||
|
||||
int volt = (Channel->polarization == 'v' || Channel->polarization == 'V') ? SEC_VOLTAGE_13 : SEC_VOLTAGE_18;
|
||||
|
||||
// DiseqC:
|
||||
// DiSEqC:
|
||||
|
||||
#ifdef NEWSTRUCT
|
||||
struct dvb_diseqc_master_cmd cmd = { {0xE0, 0x10, 0x38, 0xF0, 0x00, 0x00}, 4};
|
||||
cmd.msg[3] = 0xF0 | (((Channel->diseqc * 4) & 0x0F) | (tone == SEC_TONE_ON ? 1 : 0) | (volt == SEC_VOLTAGE_18 ? 2 : 0));
|
||||
|
||||
if (Setup.DiSEqC)
|
||||
CHECK(ioctl(fd_frontend, FE_SET_TONE, SEC_TONE_OFF));
|
||||
CHECK(ioctl(fd_frontend, FE_SET_VOLTAGE, volt));
|
||||
if (Setup.DiSEqC) {
|
||||
usleep(15 * 1000);
|
||||
CHECK(ioctl(fd_frontend, FE_DISEQC_SEND_MASTER_CMD, &cmd));
|
||||
usleep(15 * 1000);
|
||||
CHECK(ioctl(fd_frontend, FE_DISEQC_SEND_BURST, (Channel->diseqc / 4) % 2 ? SEC_MINI_B : SEC_MINI_A));
|
||||
usleep(15 * 1000);
|
||||
}
|
||||
CHECK(ioctl(fd_frontend, FE_SET_TONE, tone));
|
||||
#else
|
||||
secCommand scmd;
|
||||
scmd.type = 0;
|
||||
scmd.u.diseqc.addr = 0x10;
|
||||
@ -375,23 +431,43 @@ bool cDvbDevice::SetChannelDevice(const cChannel *Channel)
|
||||
scmds.commands = &scmd;
|
||||
|
||||
CHECK(ioctl(fd_sec, SEC_SEND_SEQUENCE, &scmds));
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case FE_QAM: { // DVB-C
|
||||
|
||||
// Frequency and symbol rate:
|
||||
|
||||
#ifdef NEWSTRUCT
|
||||
Frontend.frequency = Channel->frequency * 1000000UL;
|
||||
Frontend.inversion = INVERSION_AUTO;
|
||||
Frontend.u.qam.symbol_rate = Channel->srate * 1000UL;
|
||||
Frontend.u.qam.fec_inner = FEC_AUTO;
|
||||
Frontend.u.qam.modulation = QAM_64;
|
||||
#else
|
||||
Frontend.Frequency = Channel->frequency * 1000000UL;
|
||||
Frontend.Inversion = INVERSION_AUTO;
|
||||
Frontend.u.qam.SymbolRate = Channel->srate * 1000UL;
|
||||
Frontend.u.qam.FEC_inner = FEC_AUTO;
|
||||
Frontend.u.qam.QAM = QAM_64;
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case FE_OFDM: { // DVB-T
|
||||
|
||||
// Frequency and OFDM paramaters:
|
||||
|
||||
#ifdef NEWSTRUCT
|
||||
Frontend.frequency = Channel->frequency * 1000UL;
|
||||
Frontend.inversion = INVERSION_AUTO;
|
||||
Frontend.u.ofdm.bandwidth=BANDWIDTH_8_MHZ;
|
||||
Frontend.u.ofdm.code_rate_HP = FEC_2_3;
|
||||
Frontend.u.ofdm.code_rate_LP = FEC_1_2;
|
||||
Frontend.u.ofdm.constellation = QAM_64;
|
||||
Frontend.u.ofdm.transmission_mode = TRANSMISSION_MODE_2K;
|
||||
Frontend.u.ofdm.guard_interval = GUARD_INTERVAL_1_32;
|
||||
Frontend.u.ofdm.hierarchy_information = HIERARCHY_NONE;
|
||||
#else
|
||||
Frontend.Frequency = Channel->frequency * 1000UL;
|
||||
Frontend.Inversion = INVERSION_AUTO;
|
||||
Frontend.u.ofdm.bandWidth=BANDWIDTH_8_MHZ;
|
||||
@ -401,6 +477,7 @@ bool cDvbDevice::SetChannelDevice(const cChannel *Channel)
|
||||
Frontend.u.ofdm.TransmissionMode=TRANSMISSION_MODE_2K;
|
||||
Frontend.u.ofdm.guardInterval=GUARD_INTERVAL_1_32;
|
||||
Frontend.u.ofdm.HierarchyInformation=HIERARCHY_NONE;
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@ -408,16 +485,40 @@ bool cDvbDevice::SetChannelDevice(const cChannel *Channel)
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef NEWSTRUCT
|
||||
// Discard stale events:
|
||||
|
||||
for (;;) {
|
||||
dvb_frontend_event event;
|
||||
if (ioctl(fd_frontend, FE_GET_EVENT, &event) < 0)
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Tuning:
|
||||
|
||||
CHECK(ioctl(fd_frontend, FE_SET_FRONTEND, &Frontend));
|
||||
|
||||
// Wait for channel sync:
|
||||
// Wait for channel lock:
|
||||
|
||||
#ifdef NEWSTRUCT
|
||||
FrontendStatus status = FrontendStatus(0);
|
||||
for (int i = 0; i < 100; i++) {
|
||||
CHECK(ioctl(fd_frontend, FE_READ_STATUS, &status));
|
||||
if (status & FE_HAS_LOCK)
|
||||
break;
|
||||
usleep(10 * 1000);
|
||||
}
|
||||
if (!(status & FE_HAS_LOCK)) {
|
||||
esyslog("ERROR: channel %d not locked on DVB card %d!", Channel->number, CardIndex() + 1);
|
||||
if (IsPrimaryDevice())
|
||||
cThread::RaisePanic();
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
if (cFile::FileReady(fd_frontend, 5000)) {
|
||||
FrontendEvent event;
|
||||
int res = ioctl(fd_frontend, FE_GET_EVENT, &event);
|
||||
if (res >= 0) {
|
||||
if (ioctl(fd_frontend, FE_GET_EVENT, &event) >= 0) {
|
||||
if (event.type != FE_COMPLETION_EV) {
|
||||
esyslog("ERROR: channel %d not sync'ed on DVB card %d!", Channel->number, CardIndex() + 1);
|
||||
if (IsPrimaryDevice())
|
||||
@ -426,10 +527,11 @@ bool cDvbDevice::SetChannelDevice(const cChannel *Channel)
|
||||
}
|
||||
}
|
||||
else
|
||||
esyslog("ERROR %d in frontend get event (channel %d, card %d)", res, Channel->number, CardIndex() + 1);
|
||||
esyslog("ERROR in frontend get event (channel %d, card %d): %m", Channel->number, CardIndex() + 1);
|
||||
}
|
||||
else
|
||||
esyslog("ERROR: timeout while tuning");
|
||||
esyslog("ERROR: timeout while tuning on DVB card %d", CardIndex() + 1);
|
||||
#endif
|
||||
|
||||
frequency = Channel->frequency;
|
||||
|
||||
@ -467,32 +569,64 @@ void cDvbDevice::SetVolumeDevice(int Volume)
|
||||
}
|
||||
}
|
||||
|
||||
int cDvbDevice::SetPlayMode(bool On)
|
||||
bool cDvbDevice::SetPlayMode(ePlayMode PlayMode)
|
||||
{
|
||||
if (On) {
|
||||
if (siProcessor)
|
||||
siProcessor->SetStatus(false);
|
||||
CHECK(ioctl(fd_video, VIDEO_SET_BLANK, true));
|
||||
CHECK(ioctl(fd_audio, AUDIO_SELECT_SOURCE, AUDIO_SOURCE_MEMORY));
|
||||
CHECK(ioctl(fd_audio, AUDIO_SET_AV_SYNC, true));
|
||||
CHECK(ioctl(fd_audio, AUDIO_PLAY));
|
||||
CHECK(ioctl(fd_video, VIDEO_SELECT_SOURCE, VIDEO_SOURCE_MEMORY));
|
||||
CHECK(ioctl(fd_video, VIDEO_PLAY));
|
||||
return fd_video;
|
||||
}
|
||||
else {
|
||||
CHECK(ioctl(fd_video, VIDEO_STOP, true));
|
||||
CHECK(ioctl(fd_audio, AUDIO_STOP, true));
|
||||
CHECK(ioctl(fd_video, VIDEO_CLEAR_BUFFER));
|
||||
CHECK(ioctl(fd_audio, AUDIO_CLEAR_BUFFER));
|
||||
CHECK(ioctl(fd_video, VIDEO_SELECT_SOURCE, VIDEO_SOURCE_DEMUX));
|
||||
CHECK(ioctl(fd_audio, AUDIO_SELECT_SOURCE, AUDIO_SOURCE_DEMUX));
|
||||
CHECK(ioctl(fd_audio, AUDIO_SET_AV_SYNC, true));
|
||||
CHECK(ioctl(fd_audio, AUDIO_SET_MUTE, false));
|
||||
if (siProcessor)
|
||||
siProcessor->SetStatus(true);
|
||||
return -1;
|
||||
if (PlayMode != pmExtern_THIS_SHOULD_BE_AVOIDED && fd_video < 0 && fd_audio < 0) {
|
||||
// reopen the devices
|
||||
fd_video = DvbOpen(DEV_DVB_VIDEO, CardIndex(), O_RDWR | O_NONBLOCK);
|
||||
fd_audio = DvbOpen(DEV_DVB_AUDIO, CardIndex(), O_RDWR | O_NONBLOCK);
|
||||
SetVideoFormat(Setup.VideoFormat);
|
||||
}
|
||||
|
||||
switch (PlayMode) {
|
||||
case pmNone:
|
||||
// special handling to return from PCM replay:
|
||||
CHECK(ioctl(fd_video, VIDEO_SET_BLANK, true));
|
||||
CHECK(ioctl(fd_video, VIDEO_SELECT_SOURCE, VIDEO_SOURCE_MEMORY));
|
||||
CHECK(ioctl(fd_video, VIDEO_PLAY));
|
||||
|
||||
CHECK(ioctl(fd_video, VIDEO_STOP, true));
|
||||
CHECK(ioctl(fd_audio, AUDIO_STOP, true));
|
||||
CHECK(ioctl(fd_video, VIDEO_CLEAR_BUFFER));
|
||||
CHECK(ioctl(fd_audio, AUDIO_CLEAR_BUFFER));
|
||||
CHECK(ioctl(fd_video, VIDEO_SELECT_SOURCE, VIDEO_SOURCE_DEMUX));
|
||||
CHECK(ioctl(fd_audio, AUDIO_SELECT_SOURCE, AUDIO_SOURCE_DEMUX));
|
||||
CHECK(ioctl(fd_audio, AUDIO_SET_AV_SYNC, true));
|
||||
CHECK(ioctl(fd_audio, AUDIO_SET_MUTE, false));
|
||||
if (siProcessor)
|
||||
siProcessor->SetStatus(true);
|
||||
break;
|
||||
case pmAudioVideo:
|
||||
if (siProcessor)
|
||||
siProcessor->SetStatus(false);
|
||||
CHECK(ioctl(fd_video, VIDEO_SET_BLANK, true));
|
||||
CHECK(ioctl(fd_audio, AUDIO_SELECT_SOURCE, AUDIO_SOURCE_MEMORY));
|
||||
CHECK(ioctl(fd_audio, AUDIO_SET_AV_SYNC, true));
|
||||
CHECK(ioctl(fd_audio, AUDIO_PLAY));
|
||||
CHECK(ioctl(fd_video, VIDEO_SELECT_SOURCE, VIDEO_SOURCE_MEMORY));
|
||||
CHECK(ioctl(fd_video, VIDEO_PLAY));
|
||||
break;
|
||||
case pmAudioOnly:
|
||||
if (siProcessor)
|
||||
siProcessor->SetStatus(false);
|
||||
CHECK(ioctl(fd_video, VIDEO_SET_BLANK, true));
|
||||
CHECK(ioctl(fd_audio, AUDIO_STOP, true));
|
||||
CHECK(ioctl(fd_audio, AUDIO_CLEAR_BUFFER));
|
||||
CHECK(ioctl(fd_audio, AUDIO_SELECT_SOURCE, AUDIO_SOURCE_MEMORY));
|
||||
CHECK(ioctl(fd_audio, AUDIO_SET_AV_SYNC, false));
|
||||
CHECK(ioctl(fd_audio, AUDIO_PLAY));
|
||||
CHECK(ioctl(fd_video, VIDEO_SET_BLANK, false));
|
||||
break;
|
||||
case pmExtern_THIS_SHOULD_BE_AVOIDED:
|
||||
if (siProcessor)
|
||||
siProcessor->SetStatus(false);
|
||||
close(fd_video);
|
||||
close(fd_audio);
|
||||
fd_video = fd_audio = -1;
|
||||
break;
|
||||
}
|
||||
playMode = PlayMode;
|
||||
return true;
|
||||
}
|
||||
|
||||
void cDvbDevice::TrickSpeed(int Speed)
|
||||
@ -558,10 +692,17 @@ void cDvbDevice::StillPicture(const uchar *Data, int Length)
|
||||
#endif
|
||||
}
|
||||
|
||||
bool cDvbDevice::Poll(cPoller &Poller, int TimeoutMs)
|
||||
{
|
||||
Poller.Add(playMode == pmAudioOnly ? fd_audio : fd_video, true);
|
||||
return Poller.Poll(TimeoutMs);
|
||||
}
|
||||
|
||||
int cDvbDevice::PlayVideo(const uchar *Data, int Length)
|
||||
{
|
||||
if (fd_video >= 0)
|
||||
return write(fd_video, Data, Length);
|
||||
int fd = playMode == pmAudioOnly ? fd_audio : fd_video;
|
||||
if (fd >= 0)
|
||||
return write(fd, Data, Length);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -574,7 +715,7 @@ int cDvbDevice::PlayAudio(const uchar *Data, int Length)
|
||||
bool cDvbDevice::OpenDvr(void)
|
||||
{
|
||||
CloseDvr();
|
||||
fd_dvr = OstOpen(DEV_OST_DVR, CardIndex(), O_RDONLY | O_NONBLOCK, true);
|
||||
fd_dvr = DvbOpen(DEV_DVB_DVR, CardIndex(), O_RDONLY | O_NONBLOCK, true);
|
||||
return fd_dvr >= 0;
|
||||
}
|
||||
|
||||
@ -589,13 +730,8 @@ void cDvbDevice::CloseDvr(void)
|
||||
int cDvbDevice::GetTSPacket(uchar *Data)
|
||||
{
|
||||
if (fd_dvr >= 0) {
|
||||
pollfd pfd;
|
||||
pfd.fd = fd_dvr;
|
||||
pfd.events = POLLIN;
|
||||
|
||||
poll(&pfd, 1, 100);
|
||||
|
||||
if (pfd.revents & POLLIN != 0) {
|
||||
cPoller Poller(fd_dvr, false);
|
||||
if (Poller.Poll(100)) {
|
||||
int r = read(fd_dvr, Data, TS_SIZE);
|
||||
if (r >= 0)
|
||||
return r;
|
||||
|
14
dvbdevice.h
14
dvbdevice.h
@ -4,18 +4,22 @@
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* how to reach the author.
|
||||
*
|
||||
* $Id: dvbdevice.h 1.1 2002/08/04 12:19:10 kls Exp $
|
||||
* $Id: dvbdevice.h 1.5 2002/08/16 08:53:30 kls Exp $
|
||||
*/
|
||||
|
||||
#ifndef __DVBDEVICE_H
|
||||
#define __DVBDEVICE_H
|
||||
|
||||
#ifdef NEWSTRUCT
|
||||
#include <linux/dvb/frontend.h>
|
||||
#else
|
||||
#include <stdlib.h> // FIXME: this is apparently necessary for the ost/... header files
|
||||
// FIXME: shouldn't every header file include ALL the other header
|
||||
// FIXME: files it depends on? The sequence in which header files
|
||||
// FIXME: are included here should not matter - and it should NOT
|
||||
// FIXME: be necessary to include <stdlib.h> here!
|
||||
#include <ost/frontend.h>
|
||||
#endif
|
||||
#include "device.h"
|
||||
#include "eit.h"
|
||||
|
||||
@ -30,7 +34,11 @@ public:
|
||||
// Must be called before accessing any DVB functions.
|
||||
private:
|
||||
FrontendType frontendType;
|
||||
#ifdef NEWSTRUCT
|
||||
int fd_osd, fd_frontend, fd_audio, fd_video, fd_dvr;
|
||||
#else
|
||||
int fd_osd, fd_frontend, fd_sec, fd_audio, fd_video, fd_dvr;
|
||||
#endif
|
||||
int OsdDeviceHandle(void) const { return fd_osd; }
|
||||
protected:
|
||||
virtual void MakePrimaryDevice(bool On);
|
||||
@ -75,7 +83,8 @@ private:
|
||||
// Player facilities
|
||||
|
||||
protected:
|
||||
virtual int SetPlayMode(bool On);
|
||||
ePlayMode playMode;
|
||||
virtual bool SetPlayMode(ePlayMode PlayMode);
|
||||
public:
|
||||
virtual void TrickSpeed(int Speed);
|
||||
virtual void Clear(void);
|
||||
@ -83,6 +92,7 @@ public:
|
||||
virtual void Freeze(void);
|
||||
virtual void Mute(void);
|
||||
virtual void StillPicture(const uchar *Data, int Length);
|
||||
virtual bool Poll(cPoller &Poller, int TimeoutMs = 0);
|
||||
virtual int PlayVideo(const uchar *Data, int Length);
|
||||
virtual int PlayAudio(const uchar *Data, int Length);
|
||||
|
||||
|
6
dvbosd.h
6
dvbosd.h
@ -4,13 +4,17 @@
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* how to reach the author.
|
||||
*
|
||||
* $Id: dvbosd.h 1.14 2002/08/04 10:12:14 kls Exp $
|
||||
* $Id: dvbosd.h 1.15 2002/08/09 16:16:48 kls Exp $
|
||||
*/
|
||||
|
||||
#ifndef __DVBOSD_H
|
||||
#define __DVBOSD_H
|
||||
|
||||
#ifdef NEWSTRUCT
|
||||
#include <linux/dvb/osd.h>
|
||||
#else
|
||||
#include <ost/osd.h>
|
||||
#endif
|
||||
#include "dvbdevice.h"
|
||||
#include "osdbase.h"
|
||||
|
||||
|
197
dvbplayer.c
197
dvbplayer.c
@ -4,14 +4,15 @@
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* how to reach the author.
|
||||
*
|
||||
* $Id: dvbplayer.c 1.8 2002/07/27 11:57:48 kls Exp $
|
||||
* $Id: dvbplayer.c 1.11 2002/08/16 09:16:38 kls Exp $
|
||||
*/
|
||||
|
||||
#include "dvbplayer.h"
|
||||
#include <poll.h>
|
||||
#include <stdlib.h>
|
||||
#include "recording.h"
|
||||
#include "ringbuffer.h"
|
||||
#include "thread.h"
|
||||
#include "tools.h"
|
||||
|
||||
// --- cBackTrace ----------------------------------------------------------
|
||||
|
||||
@ -63,7 +64,7 @@ int cBackTrace::Get(bool Forward)
|
||||
p = BACKTRACE_ENTRIES - 1;
|
||||
i = index[p] - 1;
|
||||
l -= length[p];
|
||||
n--;
|
||||
n--;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
@ -301,121 +302,111 @@ void cDvbPlayer::Action(void)
|
||||
const uchar *p = NULL;
|
||||
int pc = 0;
|
||||
|
||||
pollfd pfd[2];
|
||||
pfd[0].fd = DeviceFileHandle();
|
||||
pfd[0].events = pfd[0].revents = POLLOUT;
|
||||
pfd[1].fd = replayFile;
|
||||
pfd[1].events = pfd[1].revents = POLLIN;
|
||||
|
||||
readIndex = Resume();
|
||||
if (readIndex >= 0)
|
||||
isyslog("resuming replay at index %d (%s)", readIndex, IndexToHMSF(readIndex, true));
|
||||
|
||||
running = true;
|
||||
while (running && NextFile()) {
|
||||
pfd[1].fd = replayFile; // NextFile() may have returned a new file handle!
|
||||
{
|
||||
LOCK_THREAD;
|
||||
cPoller Poller;
|
||||
if (!readFrame)
|
||||
Poller.Add(replayFile, false);
|
||||
if (DevicePoll(Poller, 100)) {
|
||||
|
||||
// Read the next frame from the file:
|
||||
LOCK_THREAD;
|
||||
|
||||
if (!readFrame && (pfd[1].revents & POLLIN)) {
|
||||
if (playMode != pmStill) {
|
||||
int r = 0;
|
||||
if (playMode == pmFast || (playMode == pmSlow && playDir == pdBackward)) {
|
||||
uchar FileNumber;
|
||||
int FileOffset, Length;
|
||||
int Index = index->GetNextIFrame(readIndex, playDir == pdForward, &FileNumber, &FileOffset, &Length, true);
|
||||
if (Index >= 0) {
|
||||
if (!NextFile(FileNumber, FileOffset))
|
||||
break;
|
||||
}
|
||||
else {
|
||||
// can't call Play() here, because those functions may only be
|
||||
// called from the foreground thread - and we also don't need
|
||||
// to empty the buffer here
|
||||
DevicePlay();
|
||||
playMode = pmPlay;
|
||||
playDir = pdForward;
|
||||
continue;
|
||||
}
|
||||
readIndex = Index;
|
||||
r = ReadFrame(replayFile, b, Length, sizeof(b));
|
||||
// must call StripAudioPackets() here because the buffer is not emptied
|
||||
// when falling back from "fast forward" to "play" (see above)
|
||||
StripAudioPackets(b, r);
|
||||
}
|
||||
else if (index) {
|
||||
uchar FileNumber;
|
||||
int FileOffset, Length;
|
||||
readIndex++;
|
||||
if (!(index->Get(readIndex, &FileNumber, &FileOffset, NULL, &Length) && NextFile(FileNumber, FileOffset)))
|
||||
break;
|
||||
r = ReadFrame(replayFile, b, Length, sizeof(b));
|
||||
}
|
||||
else // allows replay even if the index file is missing
|
||||
r = read(replayFile, b, sizeof(b));
|
||||
if (r > 0)
|
||||
readFrame = new cFrame(b, r, ftUnknown, readIndex);
|
||||
else if (r == 0)
|
||||
eof = true;
|
||||
else if (r < 0 && FATALERRNO) {
|
||||
LOG_ERROR;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else//XXX
|
||||
usleep(1); // this keeps the CPU load low
|
||||
}
|
||||
// Read the next frame from the file:
|
||||
|
||||
// Store the frame in the buffer:
|
||||
if (!readFrame) {
|
||||
if (playMode != pmStill) {
|
||||
int r = 0;
|
||||
if (playMode == pmFast || (playMode == pmSlow && playDir == pdBackward)) {
|
||||
uchar FileNumber;
|
||||
int FileOffset, Length;
|
||||
int Index = index->GetNextIFrame(readIndex, playDir == pdForward, &FileNumber, &FileOffset, &Length, true);
|
||||
if (Index >= 0) {
|
||||
if (!NextFile(FileNumber, FileOffset))
|
||||
break;
|
||||
}
|
||||
else {
|
||||
// can't call Play() here, because those functions may only be
|
||||
// called from the foreground thread - and we also don't need
|
||||
// to empty the buffer here
|
||||
DevicePlay();
|
||||
playMode = pmPlay;
|
||||
playDir = pdForward;
|
||||
continue;
|
||||
}
|
||||
readIndex = Index;
|
||||
r = ReadFrame(replayFile, b, Length, sizeof(b));
|
||||
// must call StripAudioPackets() here because the buffer is not emptied
|
||||
// when falling back from "fast forward" to "play" (see above)
|
||||
StripAudioPackets(b, r);
|
||||
}
|
||||
else if (index) {
|
||||
uchar FileNumber;
|
||||
int FileOffset, Length;
|
||||
readIndex++;
|
||||
if (!(index->Get(readIndex, &FileNumber, &FileOffset, NULL, &Length) && NextFile(FileNumber, FileOffset)))
|
||||
break;
|
||||
r = ReadFrame(replayFile, b, Length, sizeof(b));
|
||||
}
|
||||
else // allows replay even if the index file is missing
|
||||
r = read(replayFile, b, sizeof(b));
|
||||
if (r > 0)
|
||||
readFrame = new cFrame(b, r, ftUnknown, readIndex);
|
||||
else if (r == 0)
|
||||
eof = true;
|
||||
else if (r < 0 && FATALERRNO) {
|
||||
LOG_ERROR;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else//XXX
|
||||
usleep(1); // this keeps the CPU load low
|
||||
}
|
||||
|
||||
if (readFrame) {
|
||||
if (ringBuffer->Put(readFrame))
|
||||
readFrame = NULL;
|
||||
}
|
||||
// Store the frame in the buffer:
|
||||
|
||||
// Get the next frame from the buffer:
|
||||
|
||||
if (!playFrame) {
|
||||
playFrame = ringBuffer->Get();
|
||||
p = NULL;
|
||||
pc = 0;
|
||||
}
|
||||
if (readFrame) {
|
||||
if (ringBuffer->Put(readFrame))
|
||||
readFrame = NULL;
|
||||
}
|
||||
|
||||
// Play the frame:
|
||||
// Get the next frame from the buffer:
|
||||
|
||||
if (playFrame && (pfd[0].revents & POLLOUT)) {
|
||||
if (!p) {
|
||||
p = playFrame->Data();
|
||||
pc = playFrame->Count();
|
||||
}
|
||||
if (p) {
|
||||
int w = PlayVideo(p, pc);
|
||||
if (w > 0) {
|
||||
p += w;
|
||||
pc -= w;
|
||||
}
|
||||
else if (w < 0 && FATALERRNO) {
|
||||
LOG_ERROR;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (pc == 0) {
|
||||
writeIndex = playFrame->Index();
|
||||
backTrace->Add(playFrame->Index(), playFrame->Count());
|
||||
ringBuffer->Drop(playFrame);
|
||||
playFrame = NULL;
|
||||
p = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!playFrame) {
|
||||
playFrame = ringBuffer->Get();
|
||||
p = NULL;
|
||||
pc = 0;
|
||||
}
|
||||
|
||||
// Wait for input or output to become ready:
|
||||
// Play the frame:
|
||||
|
||||
if (poll(pfd, readFrame ? 1 : 2, 10) < 0 && FATALERRNO) {
|
||||
LOG_ERROR;
|
||||
break;
|
||||
if (playFrame) {
|
||||
if (!p) {
|
||||
p = playFrame->Data();
|
||||
pc = playFrame->Count();
|
||||
}
|
||||
if (p) {
|
||||
int w = PlayVideo(p, pc);
|
||||
if (w > 0) {
|
||||
p += w;
|
||||
pc -= w;
|
||||
}
|
||||
else if (w < 0 && FATALERRNO) {
|
||||
LOG_ERROR;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (pc == 0) {
|
||||
writeIndex = playFrame->Index();
|
||||
backTrace->Add(playFrame->Index(), playFrame->Count());
|
||||
ringBuffer->Drop(playFrame);
|
||||
playFrame = NULL;
|
||||
p = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
active = running = false;
|
||||
|
22
eit.c
22
eit.c
@ -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.46 2002/05/31 10:26:56 kls Exp $
|
||||
* $Id: eit.c 1.48 2002/08/11 11:11:12 kls Exp $
|
||||
***************************************************************************/
|
||||
|
||||
#include "eit.h"
|
||||
@ -26,7 +26,11 @@
|
||||
#include <iomanip.h>
|
||||
#include <iostream.h>
|
||||
#include <limits.h>
|
||||
#ifdef NEWSTRUCT
|
||||
#include <linux/dvb/dmx.h>
|
||||
#else
|
||||
#include <ost/dmx.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -198,9 +202,9 @@ cEventInfo::cEventInfo(unsigned short serviceid, unsigned short eventid)
|
||||
|
||||
cEventInfo::~cEventInfo()
|
||||
{
|
||||
delete pTitle;
|
||||
delete pSubtitle;
|
||||
delete pExtendedDescription;
|
||||
free(pTitle);
|
||||
free(pSubtitle);
|
||||
free(pExtendedDescription);
|
||||
}
|
||||
|
||||
/** */
|
||||
@ -496,8 +500,8 @@ void cEventInfo::FixEpgBugs(void)
|
||||
*e = 0;
|
||||
char *s = strdup(p + 1);
|
||||
char *d = strdup(e + strlen(delim));
|
||||
delete pSubtitle;
|
||||
delete pExtendedDescription;
|
||||
free(pSubtitle);
|
||||
free(pExtendedDescription);
|
||||
pSubtitle = s;
|
||||
pExtendedDescription = d;
|
||||
EpgBugFixStat(0, GetServiceID());
|
||||
@ -527,7 +531,7 @@ void cEventInfo::FixEpgBugs(void)
|
||||
// Title
|
||||
//
|
||||
if (pSubtitle && strcmp(pTitle, pSubtitle) == 0) {
|
||||
delete pSubtitle;
|
||||
free(pSubtitle);
|
||||
pSubtitle = NULL;
|
||||
EpgBugFixStat(2, GetServiceID());
|
||||
}
|
||||
@ -997,10 +1001,10 @@ cSIProcessor::~cSIProcessor()
|
||||
active = false;
|
||||
Cancel(3);
|
||||
ShutDownFilters();
|
||||
delete filters;
|
||||
free(filters);
|
||||
if (!--numSIProcessors) // the last one deletes it
|
||||
delete schedules;
|
||||
delete fileName;
|
||||
free(fileName);
|
||||
}
|
||||
|
||||
const cSchedules *cSIProcessor::Schedules(cMutexLock &MutexLock)
|
||||
|
@ -4,7 +4,7 @@
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* how to reach the author.
|
||||
*
|
||||
* $Id: eitscan.c 1.4 2002/07/28 15:10:23 kls Exp $
|
||||
* $Id: eitscan.c 1.5 2002/08/11 11:11:39 kls Exp $
|
||||
*/
|
||||
|
||||
#include "eitscan.h"
|
||||
@ -21,7 +21,7 @@ cEITScanner::cEITScanner(void)
|
||||
|
||||
cEITScanner::~cEITScanner()
|
||||
{
|
||||
delete transponders;
|
||||
free(transponders);
|
||||
}
|
||||
|
||||
bool cEITScanner::TransponderScanned(cChannel *Channel)
|
||||
|
11
interface.c
11
interface.c
@ -4,11 +4,12 @@
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* how to reach the author.
|
||||
*
|
||||
* $Id: interface.c 1.52 2002/06/16 13:23:40 kls Exp $
|
||||
* $Id: interface.c 1.54 2002/08/11 11:46:47 kls Exp $
|
||||
*/
|
||||
|
||||
#include "interface.h"
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include "i18n.h"
|
||||
#include "osd.h"
|
||||
@ -84,7 +85,7 @@ eKeys cInterface::GetKey(bool Wait)
|
||||
char *message = SVDRP->GetMessage();
|
||||
if (message) {
|
||||
Info(message);
|
||||
delete message;
|
||||
free(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -213,12 +214,12 @@ char *cInterface::WrapText(const char *Text, int Width, int *Height)
|
||||
// punch in a newline, so we need to make room for it:
|
||||
if (Delim)
|
||||
p = Delim + 1; // let's fall back to the most recent delimiter
|
||||
char *s = new char[strlen(t) + 2]; // The additional '\n' plus the terminating '\0'
|
||||
char *s = MALLOC(char, strlen(t) + 2); // The additional '\n' plus the terminating '\0'
|
||||
int l = p - t;
|
||||
strncpy(s, t, l);
|
||||
s[l] = '\n';
|
||||
strcpy(s + l + 1, p);
|
||||
delete t;
|
||||
free(t);
|
||||
t = s;
|
||||
p = t + l;
|
||||
continue;
|
||||
@ -399,7 +400,7 @@ void cInterface::QueryKeys(void)
|
||||
char *Prompt;
|
||||
asprintf(&Prompt, tr("Press key for '%s'"), tr(k->name));
|
||||
WriteText(1, 5, Prompt);
|
||||
delete Prompt;
|
||||
free(Prompt);
|
||||
for (;;) {
|
||||
unsigned int ch = GetCh();
|
||||
if (ch != 0) {
|
||||
|
44
menu.c
44
menu.c
@ -4,7 +4,7 @@
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* how to reach the author.
|
||||
*
|
||||
* $Id: menu.c 1.203 2002/08/03 09:55:44 kls Exp $
|
||||
* $Id: menu.c 1.205 2002/08/15 11:28:08 kls Exp $
|
||||
*/
|
||||
|
||||
#include "menu.h"
|
||||
@ -32,8 +32,6 @@
|
||||
|
||||
#define CHNUMWIDTH (Channels.Count() > 999 ? 5 : 4) // there are people with more than 999 channels...
|
||||
|
||||
const char *FileNameChars = " abcdefghijklmnopqrstuvwxyz0123456789-.#~";
|
||||
|
||||
// --- cMenuEditChanItem -----------------------------------------------------
|
||||
|
||||
class cMenuEditChanItem : public cMenuEditIntItem {
|
||||
@ -936,7 +934,7 @@ cMenuEvent::cMenuEvent(const cEventInfo *EventInfo, bool CanSwitch)
|
||||
char *buffer;
|
||||
asprintf(&buffer, "%-17.*s\t%.*s %s - %s", 17, channel->name, 5, eventInfo->GetDate(), eventInfo->GetTimeString(), eventInfo->GetEndTimeString());
|
||||
SetTitle(buffer, false);
|
||||
delete buffer;
|
||||
free(buffer);
|
||||
int Line = 2;
|
||||
cMenuTextItem *item;
|
||||
const char *Title = eventInfo->GetTitle();
|
||||
@ -1040,7 +1038,7 @@ cMenuWhatsOn::cMenuWhatsOn(const cSchedules *Schedules, bool Now, int CurrentCha
|
||||
Add(new cMenuWhatsOnItem(pArray[a]), pArray[a]->GetChannelNumber() == CurrentChannelNr);
|
||||
|
||||
currentChannel = CurrentChannelNr;
|
||||
delete pArray;
|
||||
free(pArray);
|
||||
SetHelp(tr("Record"), Now ? tr("Next") : tr("Now"), tr("Button$Schedule"), tr("Switch"));
|
||||
}
|
||||
|
||||
@ -1173,11 +1171,11 @@ void cMenuSchedule::PrepareSchedule(cChannel *Channel)
|
||||
char *buffer = NULL;
|
||||
asprintf(&buffer, tr("Schedule - %s"), Channel->name);
|
||||
SetTitle(buffer);
|
||||
delete buffer;
|
||||
free(buffer);
|
||||
if (schedules) {
|
||||
const cSchedule *Schedule = Channel->pnr ? schedules->GetSchedule(Channel->pnr) : schedules->GetSchedule();
|
||||
int num = Schedule->NumEvents();
|
||||
const cEventInfo **pArray = (const cEventInfo **)malloc(num * sizeof(cEventInfo *));
|
||||
const cEventInfo **pArray = MALLOC(const cEventInfo *, num);
|
||||
if (pArray) {
|
||||
time_t now = time(NULL);
|
||||
int numreal = 0;
|
||||
@ -1191,7 +1189,7 @@ void cMenuSchedule::PrepareSchedule(cChannel *Channel)
|
||||
|
||||
for (int a = 0; a < numreal; a++)
|
||||
Add(new cMenuScheduleItem(pArray[a]));
|
||||
delete pArray;
|
||||
free(pArray);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1306,8 +1304,8 @@ cMenuRecordingItem::cMenuRecordingItem(cRecording *Recording, int Level)
|
||||
|
||||
cMenuRecordingItem::~cMenuRecordingItem()
|
||||
{
|
||||
delete fileName;
|
||||
delete name;
|
||||
free(fileName);
|
||||
free(name);
|
||||
}
|
||||
|
||||
void cMenuRecordingItem::IncrementCounter(bool New)
|
||||
@ -1344,7 +1342,7 @@ cMenuRecordings::cMenuRecordings(const char *Base, int Level, bool OpenSubMenus)
|
||||
if (*Item->Text() && (!LastItem || strcmp(Item->Text(), LastItemText) != 0)) {
|
||||
Add(Item);
|
||||
LastItem = Item;
|
||||
delete LastItemText;
|
||||
free(LastItemText);
|
||||
LastItemText = strdup(LastItem->Text()); // must use a copy because of the counters!
|
||||
}
|
||||
else
|
||||
@ -1357,7 +1355,7 @@ cMenuRecordings::cMenuRecordings(const char *Base, int Level, bool OpenSubMenus)
|
||||
}
|
||||
}
|
||||
}
|
||||
delete LastItemText;
|
||||
free(LastItemText);
|
||||
if (Current() < 0)
|
||||
SetCurrent(First());
|
||||
else if (OpenSubMenus && Open(true))
|
||||
@ -1370,7 +1368,7 @@ cMenuRecordings::cMenuRecordings(const char *Base, int Level, bool OpenSubMenus)
|
||||
cMenuRecordings::~cMenuRecordings()
|
||||
{
|
||||
helpKeys = -1;
|
||||
delete base;
|
||||
free(base);
|
||||
}
|
||||
|
||||
void cMenuRecordings::SetHelpKeys(void)
|
||||
@ -1417,7 +1415,7 @@ bool cMenuRecordings::Open(bool OpenSubMenus)
|
||||
t = buffer;
|
||||
}
|
||||
AddSubMenu(new cMenuRecordings(t, level + 1, OpenSubMenus));
|
||||
delete buffer;
|
||||
free(buffer);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -1766,7 +1764,7 @@ cMenuSetupPlugins::cMenuSetupPlugins(void)
|
||||
char *buffer = NULL;
|
||||
asprintf(&buffer, "%s (%s) - %s", p->Name(), p->Version(), p->Description());
|
||||
Add(new cMenuSetupPluginItem(hk(buffer), i));
|
||||
delete buffer;
|
||||
free(buffer);
|
||||
}
|
||||
else
|
||||
break;
|
||||
@ -1901,7 +1899,7 @@ eOSState cMenuCommands::Execute(void)
|
||||
asprintf(&buffer, "%s...", command->Title());
|
||||
Interface->Status(buffer);
|
||||
Interface->Flush();
|
||||
delete buffer;
|
||||
free(buffer);
|
||||
const char *Result = command->Execute();
|
||||
if (Result)
|
||||
return AddSubMenu(new cMenuText(command->Title(), Result, fontFix));
|
||||
@ -2013,7 +2011,7 @@ void cMenuMain::Set(void)
|
||||
char *buffer = NULL;
|
||||
asprintf(&buffer, "%s%s", STOP_RECORDING, ON_PRIMARY_INTERFACE);
|
||||
Add(new cOsdItem(buffer, osStopRecord));
|
||||
delete buffer;
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
const char *s = NULL;
|
||||
@ -2021,7 +2019,7 @@ void cMenuMain::Set(void)
|
||||
char *buffer = NULL;
|
||||
asprintf(&buffer, "%s%s", STOP_RECORDING, s);
|
||||
Add(new cOsdItem(buffer, osStopRecord));
|
||||
delete buffer;
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
// Editing control:
|
||||
@ -2452,8 +2450,8 @@ cRecordControl::cRecordControl(cDevice *Device, cTimer *Timer)
|
||||
cRecordControl::~cRecordControl()
|
||||
{
|
||||
Stop(true);
|
||||
delete instantId;
|
||||
delete fileName;
|
||||
free(instantId);
|
||||
free(fileName);
|
||||
}
|
||||
|
||||
#define INSTANT_REC_EPG_LOOKAHEAD 300 // seconds to look into the EPG data for an instant recording
|
||||
@ -2701,8 +2699,8 @@ cReplayControl::~cReplayControl()
|
||||
|
||||
void cReplayControl::SetRecording(const char *FileName, const char *Title)
|
||||
{
|
||||
delete fileName;
|
||||
delete title;
|
||||
free(fileName);
|
||||
free(title);
|
||||
fileName = FileName ? strdup(FileName) : NULL;
|
||||
title = Title ? strdup(Title) : NULL;
|
||||
}
|
||||
@ -2715,7 +2713,7 @@ const char *cReplayControl::LastReplayed(void)
|
||||
void cReplayControl::ClearLastReplayed(const char *FileName)
|
||||
{
|
||||
if (fileName && FileName && strcmp(fileName, FileName) == 0) {
|
||||
delete fileName;
|
||||
free(fileName);
|
||||
fileName = NULL;
|
||||
}
|
||||
}
|
||||
|
16
menuitems.c
16
menuitems.c
@ -4,7 +4,7 @@
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* how to reach the author.
|
||||
*
|
||||
* $Id: menuitems.c 1.6 2002/06/16 13:23:56 kls Exp $
|
||||
* $Id: menuitems.c 1.8 2002/08/15 11:27:57 kls Exp $
|
||||
*/
|
||||
|
||||
#include "menuitems.h"
|
||||
@ -13,6 +13,8 @@
|
||||
#include "plugin.h"
|
||||
#include "status.h"
|
||||
|
||||
const char *FileNameChars = " abcdefghijklmnopqrstuvwxyz0123456789-.#~";
|
||||
|
||||
// --- cMenuEditItem ---------------------------------------------------------
|
||||
|
||||
cMenuEditItem::cMenuEditItem(const char *Name)
|
||||
@ -23,13 +25,13 @@ cMenuEditItem::cMenuEditItem(const char *Name)
|
||||
|
||||
cMenuEditItem::~cMenuEditItem()
|
||||
{
|
||||
delete name;
|
||||
delete value;
|
||||
free(name);
|
||||
free(value);
|
||||
}
|
||||
|
||||
void cMenuEditItem::SetValue(const char *Value)
|
||||
{
|
||||
delete value;
|
||||
free(value);
|
||||
value = strdup(Value);
|
||||
char *buffer = NULL;
|
||||
asprintf(&buffer, "%s:\t%s", name, value);
|
||||
@ -119,7 +121,7 @@ cMenuEditChrItem::cMenuEditChrItem(const char *Name, char *Value, const char *Al
|
||||
|
||||
cMenuEditChrItem::~cMenuEditChrItem()
|
||||
{
|
||||
delete allowed;
|
||||
free(allowed);
|
||||
}
|
||||
|
||||
void cMenuEditChrItem::Set(void)
|
||||
@ -167,7 +169,7 @@ cMenuEditStrItem::cMenuEditStrItem(const char *Name, char *Value, int Length, co
|
||||
|
||||
cMenuEditStrItem::~cMenuEditStrItem()
|
||||
{
|
||||
delete allowed;
|
||||
free(allowed);
|
||||
}
|
||||
|
||||
void cMenuEditStrItem::SetHelpKeys(void)
|
||||
@ -364,7 +366,7 @@ cMenuTextItem::cMenuTextItem(const char *Text, int X, int Y, int W, int H, eDvbC
|
||||
|
||||
cMenuTextItem::~cMenuTextItem()
|
||||
{
|
||||
delete text;
|
||||
free(text);
|
||||
}
|
||||
|
||||
void cMenuTextItem::Clear(void)
|
||||
|
12
menuitems.h
12
menuitems.h
@ -4,7 +4,7 @@
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* how to reach the author.
|
||||
*
|
||||
* $Id: menuitems.h 1.2 2002/05/11 10:48:28 kls Exp $
|
||||
* $Id: menuitems.h 1.4 2002/08/15 11:28:26 kls Exp $
|
||||
*/
|
||||
|
||||
#ifndef __MENUITEMS_H
|
||||
@ -12,10 +12,12 @@
|
||||
|
||||
#include "osd.h"
|
||||
|
||||
extern const char *FileNameChars;
|
||||
|
||||
class cMenuEditItem : public cOsdItem {
|
||||
private:
|
||||
const char *name;
|
||||
const char *value;
|
||||
char *name;
|
||||
char *value;
|
||||
public:
|
||||
cMenuEditItem(const char *Name);
|
||||
~cMenuEditItem();
|
||||
@ -43,7 +45,7 @@ public:
|
||||
class cMenuEditChrItem : public cMenuEditItem {
|
||||
private:
|
||||
char *value;
|
||||
const char *allowed;
|
||||
char *allowed;
|
||||
const char *current;
|
||||
virtual void Set(void);
|
||||
public:
|
||||
@ -56,7 +58,7 @@ class cMenuEditStrItem : public cMenuEditItem {
|
||||
private:
|
||||
char *value;
|
||||
int length;
|
||||
const char *allowed;
|
||||
char *allowed;
|
||||
int pos;
|
||||
bool insert, newchar, uppercase;
|
||||
void SetHelpKeys(void);
|
||||
|
18
osd.c
18
osd.c
@ -4,7 +4,7 @@
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* how to reach the author.
|
||||
*
|
||||
* $Id: osd.c 1.32 2002/08/04 10:11:26 kls Exp $
|
||||
* $Id: osd.c 1.34 2002/08/15 11:20:44 kls Exp $
|
||||
*/
|
||||
|
||||
#include "osd.h"
|
||||
@ -128,7 +128,7 @@ void cOsd::Open(int w, int h)
|
||||
osd->Create(0, lineHeight, w, lineHeight, 2, false);
|
||||
osd->Create(0, 2 * lineHeight, w, lineHeight, 1);
|
||||
XXX*///XXX some pixels are not drawn correctly with lower bpp values
|
||||
osd->Create(0, 0, w, 3*lineHeight, 4);
|
||||
osd->Create(0, 0, w, h, 4);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -279,13 +279,13 @@ cOsdItem::cOsdItem(const char *Text, eOSState State)
|
||||
|
||||
cOsdItem::~cOsdItem()
|
||||
{
|
||||
delete text;
|
||||
free(text);
|
||||
}
|
||||
|
||||
void cOsdItem::SetText(const char *Text, bool Copy)
|
||||
{
|
||||
delete text;
|
||||
text = Copy ? strdup(Text) : Text;
|
||||
free(text);
|
||||
text = Copy ? strdup(Text) : (char *)Text; // text assumes ownership!
|
||||
}
|
||||
|
||||
void cOsdItem::SetColor(eDvbColor FgColor, eDvbColor BgColor)
|
||||
@ -337,9 +337,9 @@ cOsdMenu::cOsdMenu(const char *Title, int c0, int c1, int c2, int c3, int c4)
|
||||
|
||||
cOsdMenu::~cOsdMenu()
|
||||
{
|
||||
delete title;
|
||||
free(title);
|
||||
delete subMenu;
|
||||
delete status;
|
||||
free(status);
|
||||
Interface->Clear();
|
||||
Interface->Close();
|
||||
}
|
||||
@ -367,7 +367,7 @@ void cOsdMenu::SetHasHotkeys(void)
|
||||
|
||||
void cOsdMenu::SetStatus(const char *s)
|
||||
{
|
||||
delete status;
|
||||
free(status);
|
||||
status = s ? strdup(s) : NULL;
|
||||
if (visible)
|
||||
Interface->Status(status);
|
||||
@ -375,7 +375,7 @@ void cOsdMenu::SetStatus(const char *s)
|
||||
|
||||
void cOsdMenu::SetTitle(const char *Title, bool ShowDate)
|
||||
{
|
||||
delete title;
|
||||
free(title);
|
||||
if (ShowDate)
|
||||
asprintf(&title, "%s\t%s", Title, DayDateTime(time(NULL)));
|
||||
else
|
||||
|
6
osd.h
6
osd.h
@ -4,7 +4,7 @@
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* how to reach the author.
|
||||
*
|
||||
* $Id: osd.h 1.33 2002/07/13 12:47:06 kls Exp $
|
||||
* $Id: osd.h 1.34 2002/08/11 11:42:15 kls Exp $
|
||||
*/
|
||||
|
||||
#ifndef __OSD_H
|
||||
@ -89,7 +89,7 @@ public:
|
||||
|
||||
class cOsdItem : public cListObject {
|
||||
private:
|
||||
const char *text;
|
||||
char *text;
|
||||
int offset;
|
||||
eOSState state;
|
||||
protected:
|
||||
@ -128,7 +128,7 @@ private:
|
||||
int first, current, marked;
|
||||
cOsdMenu *subMenu;
|
||||
const char *helpRed, *helpGreen, *helpYellow, *helpBlue;
|
||||
const char *status;
|
||||
char *status;
|
||||
int digit;
|
||||
bool hasHotkeys;
|
||||
protected:
|
||||
|
@ -4,11 +4,12 @@
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* how to reach the author.
|
||||
*
|
||||
* $Id: osdbase.c 1.5 2002/07/13 14:42:47 kls Exp $
|
||||
* $Id: osdbase.c 1.6 2002/08/11 11:47:21 kls Exp $
|
||||
*/
|
||||
|
||||
#include "osdbase.h"
|
||||
#include <signal.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/unistd.h>
|
||||
@ -109,7 +110,7 @@ cBitmap::cBitmap(int Width, int Height, int Bpp, bool ClearWithBackground)
|
||||
fontType = fontOsd;
|
||||
font = NULL;
|
||||
if (width > 0 && height > 0) {
|
||||
bitmap = new char[width * height];
|
||||
bitmap = MALLOC(char, width * height);
|
||||
if (bitmap) {
|
||||
Clean();
|
||||
memset(bitmap, 0x00, width * height);
|
||||
@ -125,7 +126,7 @@ cBitmap::cBitmap(int Width, int Height, int Bpp, bool ClearWithBackground)
|
||||
cBitmap::~cBitmap()
|
||||
{
|
||||
delete font;
|
||||
delete bitmap;
|
||||
free(bitmap);
|
||||
}
|
||||
|
||||
eDvbFont cBitmap::SetFont(eDvbFont Font)
|
||||
|
6
player.c
6
player.c
@ -4,7 +4,7 @@
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* how to reach the author.
|
||||
*
|
||||
* $Id: player.c 1.3 2002/06/23 12:56:25 kls Exp $
|
||||
* $Id: player.c 1.5 2002/08/15 10:29:17 kls Exp $
|
||||
*/
|
||||
|
||||
#include "player.h"
|
||||
@ -12,10 +12,10 @@
|
||||
|
||||
// --- cPlayer ---------------------------------------------------------------
|
||||
|
||||
cPlayer::cPlayer(void)
|
||||
cPlayer::cPlayer(ePlayMode PlayMode)
|
||||
{
|
||||
device = NULL;
|
||||
deviceFileHandle = -1;
|
||||
playMode = PlayMode;
|
||||
}
|
||||
|
||||
cPlayer::~cPlayer()
|
||||
|
20
player.h
20
player.h
@ -4,7 +4,7 @@
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* how to reach the author.
|
||||
*
|
||||
* $Id: player.h 1.5 2002/07/13 11:12:26 kls Exp $
|
||||
* $Id: player.h 1.8 2002/08/16 09:14:12 kls Exp $
|
||||
*/
|
||||
|
||||
#ifndef __PLAYER_H
|
||||
@ -17,9 +17,9 @@ class cPlayer {
|
||||
friend class cDevice;
|
||||
private:
|
||||
cDevice *device;
|
||||
int deviceFileHandle;
|
||||
ePlayMode playMode;
|
||||
protected:
|
||||
int DeviceFileHandle(void) { return deviceFileHandle; } //XXX+ needed for polling
|
||||
bool DevicePoll(cPoller &Poller, int TimeoutMs = 0) { return device ? device->Poll(Poller, TimeoutMs) : false; }
|
||||
void DeviceTrickSpeed(int Speed) { if (device) device->TrickSpeed(Speed); }
|
||||
void DeviceClear(void) { if (device) device->Clear(); }
|
||||
void DevicePlay(void) { if (device) device->Play(); }
|
||||
@ -28,17 +28,17 @@ protected:
|
||||
void DeviceStillPicture(const uchar *Data, int Length) { if (device) device->StillPicture(Data, Length); }
|
||||
void Detach(void);
|
||||
virtual void Activate(bool On) {}
|
||||
// This function is called right after the cPlayer has been attached to
|
||||
// (On == true) or before it gets detached from (On == false) a cDevice.
|
||||
// It can be used to do things like starting/stopping a thread.
|
||||
// This function is called right after the cPlayer has been attached to
|
||||
// (On == true) or before it gets detached from (On == false) a cDevice.
|
||||
// It can be used to do things like starting/stopping a thread.
|
||||
int PlayVideo(const uchar *Data, int Length);
|
||||
// Sends the given Data to the video device and returns the number of
|
||||
// bytes that have actually been accepted by the video device (or a
|
||||
// negative value in case of an error).
|
||||
// Sends the given Data to the video device and returns the number of
|
||||
// bytes that have actually been accepted by the video device (or a
|
||||
// negative value in case of an error).
|
||||
int PlayAudio(const uchar *Data, int Length);
|
||||
// XXX+ TODO
|
||||
public:
|
||||
cPlayer(void);
|
||||
cPlayer(ePlayMode PlayMode = pmAudioVideo);
|
||||
virtual ~cPlayer();
|
||||
bool IsAttached(void) { return device != NULL; }
|
||||
virtual bool GetIndex(int &Current, int &Total, bool SnapToIFrame = false) { return false; }
|
||||
|
17
plugin.c
17
plugin.c
@ -4,13 +4,14 @@
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* how to reach the author.
|
||||
*
|
||||
* $Id: plugin.c 1.5 2002/05/13 16:31:09 kls Exp $
|
||||
* $Id: plugin.c 1.7 2002/08/11 11:21:00 kls Exp $
|
||||
*/
|
||||
|
||||
#include "plugin.h"
|
||||
#include <ctype.h>
|
||||
#include <dirent.h>
|
||||
#include <dlfcn.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include "config.h"
|
||||
|
||||
@ -101,7 +102,7 @@ void cPlugin::SetConfigDirectory(const char *Dir)
|
||||
const char *cPlugin::ConfigDirectory(const char *PluginName)
|
||||
{
|
||||
static char *buffer = NULL;
|
||||
delete buffer;
|
||||
free(buffer);
|
||||
asprintf(&buffer, "%s/plugins%s%s", configDirectory, PluginName ? "/" : "", PluginName ? PluginName : "");
|
||||
return MakeDirs(buffer, true) ? buffer : NULL;
|
||||
}
|
||||
@ -121,8 +122,8 @@ cDll::~cDll()
|
||||
delete plugin;
|
||||
if (handle)
|
||||
dlclose(handle);
|
||||
delete args;
|
||||
delete fileName;
|
||||
free(args);
|
||||
free(fileName);
|
||||
}
|
||||
|
||||
static char *SkipQuote(char *s)
|
||||
@ -236,14 +237,14 @@ cPluginManager::cPluginManager(const char *Directory)
|
||||
cPluginManager::~cPluginManager()
|
||||
{
|
||||
Shutdown();
|
||||
delete directory;
|
||||
free(directory);
|
||||
if (pluginManager == this)
|
||||
pluginManager = NULL;
|
||||
}
|
||||
|
||||
void cPluginManager::SetDirectory(const char *Directory)
|
||||
{
|
||||
delete directory;
|
||||
free(directory);
|
||||
directory = Directory ? strdup(Directory) : NULL;
|
||||
}
|
||||
|
||||
@ -279,8 +280,8 @@ void cPluginManager::AddPlugin(const char *Args)
|
||||
char *buffer = NULL;
|
||||
asprintf(&buffer, "%s/%s%s%s%s", directory, LIBVDR_PREFIX, s, SO_INDICATOR, VDRVERSION);
|
||||
dlls.Add(new cDll(buffer, Args));
|
||||
delete buffer;
|
||||
delete s;
|
||||
free(buffer);
|
||||
free(s);
|
||||
}
|
||||
|
||||
bool cPluginManager::LoadPlugins(bool Log)
|
||||
|
56
recording.c
56
recording.c
@ -4,7 +4,7 @@
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* how to reach the author.
|
||||
*
|
||||
* $Id: recording.c 1.65 2002/07/27 12:55:14 kls Exp $
|
||||
* $Id: recording.c 1.66 2002/08/11 11:48:11 kls Exp $
|
||||
*/
|
||||
|
||||
#include "recording.h"
|
||||
@ -148,7 +148,7 @@ void AssertFreeDiskSpace(int Priority)
|
||||
|
||||
cResumeFile::cResumeFile(const char *FileName)
|
||||
{
|
||||
fileName = new char[strlen(FileName) + strlen(RESUMEFILESUFFIX) + 1];
|
||||
fileName = MALLOC(char, strlen(FileName) + strlen(RESUMEFILESUFFIX) + 1);
|
||||
if (fileName) {
|
||||
strcpy(fileName, FileName);
|
||||
strcat(fileName, RESUMEFILESUFFIX);
|
||||
@ -159,7 +159,7 @@ cResumeFile::cResumeFile(const char *FileName)
|
||||
|
||||
cResumeFile::~cResumeFile()
|
||||
{
|
||||
delete fileName;
|
||||
free(fileName);
|
||||
}
|
||||
|
||||
int cResumeFile::Read(void)
|
||||
@ -375,7 +375,7 @@ cRecording::cRecording(const char *FileName)
|
||||
struct stat buf;
|
||||
if (fstat(f, &buf) == 0) {
|
||||
int size = buf.st_size;
|
||||
summary = new char[size + 1]; // +1 for terminating 0
|
||||
summary = MALLOC(char, size + 1); // +1 for terminating 0
|
||||
if (summary) {
|
||||
int rbytes = safe_read(f, summary, size);
|
||||
if (rbytes >= 0) {
|
||||
@ -385,7 +385,7 @@ cRecording::cRecording(const char *FileName)
|
||||
}
|
||||
else {
|
||||
LOG_ERROR_STR(SummaryFileName);
|
||||
delete summary;
|
||||
free(summary);
|
||||
summary = NULL;
|
||||
}
|
||||
|
||||
@ -399,17 +399,17 @@ cRecording::cRecording(const char *FileName)
|
||||
}
|
||||
else if (errno != ENOENT)
|
||||
LOG_ERROR_STR(SummaryFileName);
|
||||
delete SummaryFileName;
|
||||
free(SummaryFileName);
|
||||
}
|
||||
}
|
||||
|
||||
cRecording::~cRecording()
|
||||
{
|
||||
delete titleBuffer;
|
||||
delete sortBuffer;
|
||||
delete fileName;
|
||||
delete name;
|
||||
delete summary;
|
||||
free(titleBuffer);
|
||||
free(sortBuffer);
|
||||
free(fileName);
|
||||
free(name);
|
||||
free(summary);
|
||||
}
|
||||
|
||||
char *cRecording::StripEpisodeName(char *s)
|
||||
@ -437,9 +437,9 @@ char *cRecording::SortName(void)
|
||||
if (!sortBuffer) {
|
||||
char *s = StripEpisodeName(strdup(FileName() + strlen(VideoDirectory) + 1));
|
||||
int l = strxfrm(NULL, s, 0);
|
||||
sortBuffer = new char[l];
|
||||
sortBuffer = MALLOC(char, l);
|
||||
strxfrm(sortBuffer, s, l);
|
||||
delete s;
|
||||
free(s);
|
||||
}
|
||||
return sortBuffer;
|
||||
}
|
||||
@ -474,7 +474,7 @@ const char *cRecording::FileName(void)
|
||||
const char *cRecording::Title(char Delimiter, bool NewIndicator, int Level)
|
||||
{
|
||||
char New = NewIndicator && IsNew() ? '*' : ' ';
|
||||
delete titleBuffer;
|
||||
free(titleBuffer);
|
||||
titleBuffer = NULL;
|
||||
if (Level < 0 || Level == HierarchyLevels()) {
|
||||
struct tm tm_r;
|
||||
@ -524,7 +524,7 @@ const char *cRecording::PrefixFileName(char Prefix)
|
||||
{
|
||||
const char *p = PrefixVideoFileName(FileName(), Prefix);
|
||||
if (p) {
|
||||
delete fileName;
|
||||
free(fileName);
|
||||
fileName = strdup(p);
|
||||
return fileName;
|
||||
}
|
||||
@ -555,7 +555,7 @@ bool cRecording::WriteSummary(void)
|
||||
}
|
||||
else
|
||||
LOG_ERROR_STR(SummaryFileName);
|
||||
delete SummaryFileName;
|
||||
free(SummaryFileName);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -575,7 +575,7 @@ bool cRecording::Delete(void)
|
||||
isyslog("deleting recording %s", FileName());
|
||||
result = RenameVideoFile(FileName(), NewName);
|
||||
}
|
||||
delete NewName;
|
||||
free(NewName);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -614,7 +614,7 @@ bool cRecordings::Load(bool Deleted)
|
||||
}
|
||||
else
|
||||
Interface->Error("Error while opening pipe!");
|
||||
delete cmd;
|
||||
free(cmd);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -639,19 +639,19 @@ cMark::cMark(int Position, const char *Comment)
|
||||
|
||||
cMark::~cMark()
|
||||
{
|
||||
delete comment;
|
||||
free(comment);
|
||||
}
|
||||
|
||||
const char *cMark::ToText(void)
|
||||
{
|
||||
delete buffer;
|
||||
free(buffer);
|
||||
asprintf(&buffer, "%s%s%s\n", IndexToHMSF(position, true), comment ? " " : "", comment ? comment : "");
|
||||
return buffer;
|
||||
}
|
||||
|
||||
bool cMark::Parse(const char *s)
|
||||
{
|
||||
delete comment;
|
||||
free(comment);
|
||||
comment = NULL;
|
||||
position = HMSFToIndex(s);
|
||||
const char *p = strchr(s, ' ');
|
||||
@ -742,7 +742,7 @@ void cRecordingUserCommand::InvokeCommand(const char *State, const char *Recordi
|
||||
asprintf(&cmd, "%s %s \"%s\"", command, State, strescape(RecordingFileName, "\"$"));
|
||||
isyslog("executing '%s'", cmd);
|
||||
SystemExec(cmd);
|
||||
delete cmd;
|
||||
free(cmd);
|
||||
}
|
||||
}
|
||||
|
||||
@ -782,13 +782,13 @@ cIndexFile::cIndexFile(const char *FileName, bool Record)
|
||||
last = (buf.st_size + delta) / sizeof(tIndex) - 1;
|
||||
if (!Record && last >= 0) {
|
||||
size = last + 1;
|
||||
index = new tIndex[size];
|
||||
index = MALLOC(tIndex, size);
|
||||
if (index) {
|
||||
f = open(fileName, O_RDONLY);
|
||||
if (f >= 0) {
|
||||
if ((int)safe_read(f, index, buf.st_size) != buf.st_size) {
|
||||
esyslog("ERROR: can't read from file '%s'", fileName);
|
||||
delete index;
|
||||
free(index);
|
||||
index = NULL;
|
||||
close(f);
|
||||
f = -1;
|
||||
@ -828,8 +828,8 @@ cIndexFile::~cIndexFile()
|
||||
{
|
||||
if (f >= 0)
|
||||
close(f);
|
||||
delete fileName;
|
||||
delete index;
|
||||
free(fileName);
|
||||
free(index);
|
||||
}
|
||||
|
||||
bool cIndexFile::CatchUp(int Index)
|
||||
@ -852,7 +852,7 @@ bool cIndexFile::CatchUp(int Index)
|
||||
if (lseek(f, offset, SEEK_SET) == offset) {
|
||||
if (safe_read(f, &index[last + 1], delta) != delta) {
|
||||
esyslog("ERROR: can't read from index");
|
||||
delete index;
|
||||
free(index);
|
||||
index = NULL;
|
||||
close(f);
|
||||
f = -1;
|
||||
@ -999,7 +999,7 @@ cFileName::cFileName(const char *FileName, bool Record, bool Blocking)
|
||||
cFileName::~cFileName()
|
||||
{
|
||||
Close();
|
||||
delete fileName;
|
||||
free(fileName);
|
||||
}
|
||||
|
||||
int cFileName::Open(void)
|
||||
|
9
remux.c
9
remux.c
@ -8,7 +8,7 @@
|
||||
* the Linux DVB driver's 'tuxplayer' example and were rewritten to suit
|
||||
* VDR's needs.
|
||||
*
|
||||
* $Id: remux.c 1.9 2002/05/13 16:31:38 kls Exp $
|
||||
* $Id: remux.c 1.11 2002/08/11 11:48:34 kls Exp $
|
||||
*/
|
||||
|
||||
/* The calling interface of the 'cRemux::Process()' function is defined
|
||||
@ -66,6 +66,7 @@
|
||||
*/
|
||||
|
||||
#include "remux.h"
|
||||
#include <stdlib.h>
|
||||
#include "thread.h"
|
||||
#include "tools.h"
|
||||
|
||||
@ -153,7 +154,7 @@ cTS2PES::cTS2PES(uint8_t *ResultBuffer, int *ResultCount, int Size, uint8_t Audi
|
||||
size = Size;
|
||||
audioCid = AudioCid;
|
||||
|
||||
if (!(buf = new uint8_t[size]))
|
||||
if (!(buf = MALLOC(uint8_t, size)))
|
||||
esyslog("Not enough memory for ts_transform");
|
||||
|
||||
reset_ipack();
|
||||
@ -161,7 +162,7 @@ cTS2PES::cTS2PES(uint8_t *ResultBuffer, int *ResultCount, int Size, uint8_t Audi
|
||||
|
||||
cTS2PES::~cTS2PES()
|
||||
{
|
||||
delete buf;
|
||||
free(buf);
|
||||
}
|
||||
|
||||
void cTS2PES::Clear(void)
|
||||
@ -309,7 +310,7 @@ void cTS2PES::instant_repack(const uint8_t *Buf, int Count)
|
||||
if ((flag1 & 0xC0) == 0x80 )
|
||||
mpeg = 2;
|
||||
else {
|
||||
esyslog("ERROR: can't record MPEG1!");
|
||||
esyslog("ERROR: error in data stream!");
|
||||
hlength = 0;
|
||||
which = 0;
|
||||
mpeg = 1;
|
||||
|
8
remux.h
8
remux.h
@ -4,14 +4,18 @@
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* how to reach the author.
|
||||
*
|
||||
* $Id: remux.h 1.6 2002/08/04 10:27:07 kls Exp $
|
||||
* $Id: remux.h 1.7 2002/08/09 16:18:02 kls Exp $
|
||||
*/
|
||||
|
||||
#ifndef __REMUX_H
|
||||
#define __REMUX_H
|
||||
|
||||
#include <time.h> //XXX FIXME: DVB/ost/include/ost/dmx.h should include <time.h> itself!!!
|
||||
#include <time.h> //XXX FIXME: DVB/linux/dvb/dmx.h should include <time.h> itself!!!
|
||||
#ifdef NEWSTRUCT
|
||||
#include <linux/dvb/dmx.h>
|
||||
#else
|
||||
#include <ost/dmx.h>
|
||||
#endif
|
||||
#include "tools.h"
|
||||
|
||||
// Picture types:
|
||||
|
11
svdrp.c
11
svdrp.c
@ -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.38 2002/06/09 15:56:54 kls Exp $
|
||||
* $Id: svdrp.c 1.39 2002/08/11 12:01:28 kls Exp $
|
||||
*/
|
||||
|
||||
#include "svdrp.h"
|
||||
@ -37,6 +37,7 @@ cSocket::cSocket(int Port, int Queue)
|
||||
{
|
||||
port = Port;
|
||||
sock = -1;
|
||||
queue = Queue;
|
||||
}
|
||||
|
||||
cSocket::~cSocket()
|
||||
@ -320,7 +321,7 @@ cSVDRP::cSVDRP(int Port)
|
||||
cSVDRP::~cSVDRP()
|
||||
{
|
||||
Close();
|
||||
delete message;
|
||||
free(message);
|
||||
}
|
||||
|
||||
void cSVDRP::Close(bool Timeout)
|
||||
@ -370,7 +371,7 @@ void cSVDRP::Reply(int Code, const char *fmt, ...)
|
||||
}
|
||||
s = n ? n + 1 : NULL;
|
||||
}
|
||||
delete buffer;
|
||||
free(buffer);
|
||||
va_end(ap);
|
||||
}
|
||||
else {
|
||||
@ -685,7 +686,7 @@ void cSVDRP::CmdLSTR(const char *Option)
|
||||
if (recording->Summary()) {
|
||||
char *summary = strdup(recording->Summary());
|
||||
Reply(250, "%s", strreplace(summary,'\n','|'));
|
||||
delete summary;
|
||||
free(summary);
|
||||
}
|
||||
else
|
||||
Reply(550, "No summary availabe");
|
||||
@ -736,7 +737,7 @@ void cSVDRP::CmdLSTT(const char *Option)
|
||||
void cSVDRP::CmdMESG(const char *Option)
|
||||
{
|
||||
if (*Option) {
|
||||
delete message;
|
||||
free(message);
|
||||
message = strdup(Option);
|
||||
isyslog("SVDRP message: '%s'", message);
|
||||
Reply(250, "Message stored");
|
||||
|
42
thread.c
42
thread.c
@ -4,13 +4,14 @@
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* how to reach the author.
|
||||
*
|
||||
* $Id: thread.c 1.21 2002/06/01 15:28:46 kls Exp $
|
||||
* $Id: thread.c 1.22 2002/08/15 11:44:48 kls Exp $
|
||||
*/
|
||||
|
||||
#include "thread.h"
|
||||
#include <errno.h>
|
||||
#include <signal.h>
|
||||
#include <sys/resource.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
#include "tools.h"
|
||||
@ -27,17 +28,43 @@ cCondVar::~cCondVar()
|
||||
pthread_cond_destroy(&cond);
|
||||
}
|
||||
|
||||
bool cCondVar::Wait(cMutex &Mutex)
|
||||
void cCondVar::Wait(cMutex &Mutex)
|
||||
{
|
||||
return pthread_cond_wait(&cond, &Mutex.mutex);
|
||||
if (Mutex.locked && Mutex.lockingPid == getpid()) {
|
||||
int locked = Mutex.locked;
|
||||
Mutex.locked = 0; // have to clear the locked count here, as pthread_cond_wait
|
||||
// does an implizit unlock of the mutex
|
||||
pthread_cond_wait(&cond, &Mutex.mutex);
|
||||
Mutex.locked = locked;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
bool cCondVar::TimedWait(cMutex &Mutex, unsigned long tmout)
|
||||
bool cCondVar::TimedWait(cMutex &Mutex, int TimeoutMs)
|
||||
{
|
||||
return pthread_cond_timedwait(&cond, &Mutex.mutex, tmout);
|
||||
bool r = true; // true = condition signaled false = timeout
|
||||
|
||||
if (Mutex.locked && Mutex.lockingPid == getpid()) {
|
||||
struct timeval now; // unfortunately timedwait needs the absolute time, not the delta :-(
|
||||
if (gettimeofday(&now, NULL) == 0) { // get current time
|
||||
now.tv_usec += TimeoutMs * 1000; // add the timeout
|
||||
while (now.tv_usec >= 1000000) { // take care of an overflow
|
||||
now.tv_sec++;
|
||||
now.tv_usec -= 1000000;
|
||||
}
|
||||
struct timespec abstime; // build timespec for timedwait
|
||||
abstime.tv_sec = now.tv_sec; // seconds
|
||||
abstime.tv_nsec = now.tv_usec * 1000; // nano seconds
|
||||
|
||||
int locked = Mutex.locked;
|
||||
Mutex.locked = 0; // have to clear the locked count here, as pthread_cond_timedwait
|
||||
// does an implizit unlock of the mutex.
|
||||
if (pthread_cond_timedwait(&cond, &Mutex.mutex, &abstime) == ETIMEDOUT)
|
||||
r = false;
|
||||
Mutex.locked = locked;
|
||||
}
|
||||
}
|
||||
return r;
|
||||
}
|
||||
*/
|
||||
|
||||
void cCondVar::Broadcast(void)
|
||||
{
|
||||
@ -344,7 +371,6 @@ int cPipe::Close(void)
|
||||
i--;
|
||||
usleep(100000);
|
||||
}
|
||||
|
||||
if (!i) {
|
||||
kill(pid, SIGKILL);
|
||||
ret = -1;
|
||||
|
6
thread.h
6
thread.h
@ -4,7 +4,7 @@
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* how to reach the author.
|
||||
*
|
||||
* $Id: thread.h 1.13 2002/06/01 14:55:31 kls Exp $
|
||||
* $Id: thread.h 1.14 2002/08/15 11:40:06 kls Exp $
|
||||
*/
|
||||
|
||||
#ifndef __THREAD_H
|
||||
@ -22,8 +22,8 @@ private:
|
||||
public:
|
||||
cCondVar(void);
|
||||
~cCondVar();
|
||||
bool Wait(cMutex &Mutex);
|
||||
//bool TimedWait(cMutex &Mutex, unsigned long tmout);
|
||||
void Wait(cMutex &Mutex);
|
||||
bool TimedWait(cMutex &Mutex, int TimeoutMs);
|
||||
void Broadcast(void);
|
||||
//void Signal(void);
|
||||
};
|
||||
|
64
tools.c
64
tools.c
@ -4,7 +4,7 @@
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* how to reach the author.
|
||||
*
|
||||
* $Id: tools.c 1.68 2002/08/03 15:44:53 kls Exp $
|
||||
* $Id: tools.c 1.70 2002/08/16 13:43:40 kls Exp $
|
||||
*/
|
||||
|
||||
#include "tools.h"
|
||||
@ -80,7 +80,7 @@ char *strcpyrealloc(char *dest, const char *src)
|
||||
esyslog("ERROR: out of memory");
|
||||
}
|
||||
else {
|
||||
delete dest;
|
||||
free(dest);
|
||||
dest = NULL;
|
||||
}
|
||||
return dest;
|
||||
@ -239,7 +239,7 @@ bool isnumber(const char *s)
|
||||
const char *AddDirectory(const char *DirName, const char *FileName)
|
||||
{
|
||||
static char *buf = NULL;
|
||||
delete buf;
|
||||
free(buf);
|
||||
asprintf(&buf, "%s/%s", DirName && *DirName ? DirName : ".", FileName);
|
||||
return buf;
|
||||
}
|
||||
@ -303,7 +303,7 @@ bool MakeDirs(const char *FileName, bool IsDirectory)
|
||||
else
|
||||
break;
|
||||
}
|
||||
delete s;
|
||||
free(s);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -321,7 +321,7 @@ bool RemoveFileOrDir(const char *FileName, bool FollowSymlinks)
|
||||
asprintf(&buffer, "%s/%s", FileName, e->d_name);
|
||||
if (FollowSymlinks) {
|
||||
int size = strlen(buffer) * 2; // should be large enough
|
||||
char *l = new char[size];
|
||||
char *l = MALLOC(char, size);
|
||||
int n = readlink(buffer, l, size);
|
||||
if (n < 0) {
|
||||
if (errno != EINVAL)
|
||||
@ -335,12 +335,12 @@ bool RemoveFileOrDir(const char *FileName, bool FollowSymlinks)
|
||||
}
|
||||
else
|
||||
esyslog("ERROR: symlink name length (%d) exceeded anticipated buffer size (%d)", n, size);
|
||||
delete l;
|
||||
free(l);
|
||||
}
|
||||
dsyslog("removing %s", buffer);
|
||||
if (remove(buffer) < 0)
|
||||
LOG_ERROR_STR(buffer);
|
||||
delete buffer;
|
||||
free(buffer);
|
||||
}
|
||||
}
|
||||
closedir(d);
|
||||
@ -384,10 +384,10 @@ bool RemoveEmptyDirectories(const char *DirName, bool RemoveThis)
|
||||
}
|
||||
else {
|
||||
LOG_ERROR_STR(buffer);
|
||||
delete buffer;
|
||||
free(buffer);
|
||||
return false;
|
||||
}
|
||||
delete buffer;
|
||||
free(buffer);
|
||||
}
|
||||
}
|
||||
closedir(d);
|
||||
@ -429,7 +429,7 @@ bool SpinUpDisk(const char *FileName)
|
||||
{
|
||||
static char *buf = NULL;
|
||||
for (int n = 0; n < 10; n++) {
|
||||
delete buf;
|
||||
free(buf);
|
||||
if (DirectoryOk(FileName))
|
||||
asprintf(&buf, "%s/vdr-%06d", *FileName ? FileName : ".", n);
|
||||
else
|
||||
@ -482,6 +482,42 @@ const char *DayDateTime(time_t t)
|
||||
return buffer;
|
||||
}
|
||||
|
||||
// --- cPoller ---------------------------------------------------------------
|
||||
|
||||
cPoller::cPoller(int FileHandle, bool Out)
|
||||
{
|
||||
numFileHandles = 0;
|
||||
Add(FileHandle, Out);
|
||||
}
|
||||
|
||||
bool cPoller::Add(int FileHandle, bool Out)
|
||||
{
|
||||
if (FileHandle >= 0) {
|
||||
for (int i = 0; i < numFileHandles; i++) {
|
||||
if (pfd[i].fd == FileHandle)
|
||||
return true;
|
||||
}
|
||||
if (numFileHandles < MaxPollFiles) {
|
||||
pfd[numFileHandles].fd = FileHandle;
|
||||
pfd[numFileHandles].events = Out ? POLLOUT : POLLIN;
|
||||
numFileHandles++;
|
||||
return true;
|
||||
}
|
||||
esyslog("ERROR: too many file handles in cPoller");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool cPoller::Poll(int TimeoutMs)
|
||||
{
|
||||
if (numFileHandles) {
|
||||
if (poll(pfd, numFileHandles, TimeoutMs) != 0)
|
||||
return true; // returns true even in case of an error, to let the caller
|
||||
// access the file and thus see the error code
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// --- cFile -----------------------------------------------------------------
|
||||
|
||||
bool cFile::files[FD_SETSIZE] = { false };
|
||||
@ -594,7 +630,7 @@ cSafeFile::cSafeFile(const char *FileName)
|
||||
{
|
||||
f = NULL;
|
||||
fileName = ReadLink(FileName);
|
||||
tempName = fileName ? new char[strlen(fileName) + 5] : NULL;
|
||||
tempName = fileName ? MALLOC(char, strlen(fileName) + 5) : NULL;
|
||||
if (tempName)
|
||||
strcat(strcpy(tempName, fileName), ".$$$");
|
||||
}
|
||||
@ -604,8 +640,8 @@ cSafeFile::~cSafeFile()
|
||||
if (f)
|
||||
fclose(f);
|
||||
unlink(tempName);
|
||||
delete fileName;
|
||||
delete tempName;
|
||||
free(fileName);
|
||||
free(tempName);
|
||||
}
|
||||
|
||||
bool cSafeFile::Open(void)
|
||||
@ -657,7 +693,7 @@ cLockFile::cLockFile(const char *Directory)
|
||||
cLockFile::~cLockFile()
|
||||
{
|
||||
Unlock();
|
||||
delete fileName;
|
||||
free(fileName);
|
||||
}
|
||||
|
||||
bool cLockFile::Lock(int WaitSeconds)
|
||||
|
16
tools.h
16
tools.h
@ -4,7 +4,7 @@
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* how to reach the author.
|
||||
*
|
||||
* $Id: tools.h 1.47 2002/06/09 11:09:10 kls Exp $
|
||||
* $Id: tools.h 1.49 2002/08/16 08:52:01 kls Exp $
|
||||
*/
|
||||
|
||||
#ifndef __TOOLS_H
|
||||
@ -12,6 +12,7 @@
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <poll.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <syslog.h>
|
||||
@ -36,6 +37,8 @@ extern int SysLogLevel;
|
||||
|
||||
#define MAXPARSEBUFFER KILOBYTE(10)
|
||||
|
||||
#define MALLOC(type, size) (type *)malloc(sizeof(type) * (size))
|
||||
|
||||
#define DELETENULL(p) (delete (p), p = NULL)
|
||||
|
||||
#define CHECK(s) { if ((s) < 0) LOG_ERROR; } // used for 'ioctl()' calls
|
||||
@ -74,6 +77,17 @@ bool SpinUpDisk(const char *FileName);
|
||||
const char *WeekDayName(int WeekDay); // returns a statically allocated string!
|
||||
const char *DayDateTime(time_t t = 0); // returns a statically allocated string!
|
||||
|
||||
class cPoller {
|
||||
private:
|
||||
enum { MaxPollFiles = 16 };
|
||||
pollfd pfd[MaxPollFiles];
|
||||
int numFileHandles;
|
||||
public:
|
||||
cPoller(int FileHandle = -1, bool Out = false);
|
||||
bool Add(int FileHandle, bool Out);
|
||||
bool Poll(int TimeoutMs = 0);
|
||||
};
|
||||
|
||||
class cFile {
|
||||
private:
|
||||
static bool files[];
|
||||
|
15
vdr.c
15
vdr.c
@ -22,7 +22,7 @@
|
||||
*
|
||||
* The project's page is at http://www.cadsoft.de/people/kls/vdr
|
||||
*
|
||||
* $Id: vdr.c 1.118 2002/08/04 09:56:30 kls Exp $
|
||||
* $Id: vdr.c 1.120 2002/08/16 09:54:03 kls Exp $
|
||||
*/
|
||||
|
||||
#include <getopt.h>
|
||||
@ -327,8 +327,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
// DVB interfaces:
|
||||
|
||||
if (!cDvbDevice::Initialize())
|
||||
return 2;
|
||||
cDvbDevice::Initialize();
|
||||
|
||||
cSIProcessor::Read();
|
||||
|
||||
@ -340,6 +339,12 @@ int main(int argc, char *argv[])
|
||||
// Primary device:
|
||||
|
||||
cDevice::SetPrimaryDevice(Setup.PrimaryDVB);
|
||||
if (!cDevice::PrimaryDevice()) {
|
||||
const char *msg = "no primary device found - giving up!";
|
||||
fprintf(stderr, "vdr: %s\n", msg);
|
||||
esyslog("ERROR: %s", msg);
|
||||
return 2;
|
||||
}
|
||||
|
||||
// OSD:
|
||||
|
||||
@ -585,7 +590,7 @@ int main(int argc, char *argv[])
|
||||
asprintf(&buf, tr("Recording in %d minutes, shut down anyway?"), Delta / 60);
|
||||
if (Interface->Confirm(buf))
|
||||
ForceShutdown = true;
|
||||
delete buf;
|
||||
free(buf);
|
||||
}
|
||||
if (!Next || Delta > Setup.MinEventTimeout * 60 || ForceShutdown) {
|
||||
ForceShutdown = false;
|
||||
@ -600,7 +605,7 @@ int main(int argc, char *argv[])
|
||||
asprintf(&cmd, "%s %ld %ld %d \"%s\" %d", Shutdown, Next, Delta, Channel, strescape(File, "\"$"), UserShutdown);
|
||||
isyslog("executing '%s'", cmd);
|
||||
SystemExec(cmd);
|
||||
delete cmd;
|
||||
free(cmd);
|
||||
}
|
||||
else if (WatchdogTimeout > 0) {
|
||||
alarm(WatchdogTimeout);
|
||||
|
14
videodir.c
14
videodir.c
@ -4,7 +4,7 @@
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* how to reach the author.
|
||||
*
|
||||
* $Id: videodir.c 1.8 2002/05/13 16:32:52 kls Exp $
|
||||
* $Id: videodir.c 1.9 2002/08/11 13:31:02 kls Exp $
|
||||
*/
|
||||
|
||||
#include "videodir.h"
|
||||
@ -48,9 +48,9 @@ cVideoDirectory::cVideoDirectory(void)
|
||||
|
||||
cVideoDirectory::~cVideoDirectory()
|
||||
{
|
||||
delete name;
|
||||
delete stored;
|
||||
delete adjusted;
|
||||
free(name);
|
||||
free(stored);
|
||||
free(adjusted);
|
||||
}
|
||||
|
||||
int cVideoDirectory::FreeMB(int *UsedMB)
|
||||
@ -87,7 +87,7 @@ bool cVideoDirectory::Next(void)
|
||||
void cVideoDirectory::Store(void)
|
||||
{
|
||||
if (name) {
|
||||
delete stored;
|
||||
free(stored);
|
||||
stored = strdup(name);
|
||||
}
|
||||
}
|
||||
@ -95,7 +95,7 @@ void cVideoDirectory::Store(void)
|
||||
const char *cVideoDirectory::Adjust(const char *FileName)
|
||||
{
|
||||
if (stored) {
|
||||
delete adjusted;
|
||||
free(adjusted);
|
||||
adjusted = strdup(FileName);
|
||||
return strncpy(adjusted, stored, length);
|
||||
}
|
||||
@ -139,7 +139,7 @@ int OpenVideoFile(const char *FileName, int Flags)
|
||||
}
|
||||
int Result = open(ActualFileName, Flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
|
||||
if (ActualFileName != FileName)
|
||||
delete ActualFileName;
|
||||
free((char *)ActualFileName);
|
||||
return Result;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user