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 make the config directory available to plugins
|
||||||
for suggesting to add an error message if the directory specified in the '-L'
|
for suggesting to add an error message if the directory specified in the '-L'
|
||||||
option can't be accessed
|
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>
|
Ulrich Röder <roeder@efr-net.de>
|
||||||
for pointing out that there are channels that have a symbol rate higher than
|
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
|
than 3 characters
|
||||||
for adding direct access to the index data of cPalette (needed for displaying SPUs)
|
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 pointing out a possible race condition in the cDvbPlayer
|
||||||
|
for making the use of malloc/free and new/delete consistent
|
||||||
|
|
||||||
Aaron Holtzman
|
Aaron Holtzman
|
||||||
for writing 'ac3dec'
|
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>
|
Istvan Koenigsberger <istvnko@hotmail.com> and Guido Josten <guido.josten@t-online.de>
|
||||||
for translating OSD texts to the Hungarian language
|
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
|
for making the VFAT handling more tolerant for users who forget to turn it on
|
||||||
|
|
||||||
Joerg Riechardt <J.Riechardt@gmx.de>
|
Joerg Riechardt <J.Riechardt@gmx.de>
|
||||||
for filling in some missing teletext PIDs
|
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.
|
- Now using CC, CFLAGS, CXX and CXXFLAGS in Makefile.
|
||||||
- Changed the cDevice class to allow plugins to implement their own devices (see
|
- Changed the cDevice class to allow plugins to implement their own devices (see
|
||||||
PLUGINS.html for details).
|
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
|
# See the main source file 'vdr.c' for copyright information and
|
||||||
# how to reach the author.
|
# 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:
|
.DELETE_ON_ERROR:
|
||||||
|
|
||||||
@ -23,7 +23,12 @@ PLUGINDIR= ./PLUGINS
|
|||||||
|
|
||||||
VIDEODIR = /video
|
VIDEODIR = /video
|
||||||
|
|
||||||
|
ifdef NEWSTRUCT
|
||||||
|
INCLUDES = -I$(DVBDIR)/include
|
||||||
|
DEFINES += -DNEWSTRUCT
|
||||||
|
else
|
||||||
INCLUDES = -I$(DVBDIR)/ost/include
|
INCLUDES = -I$(DVBDIR)/ost/include
|
||||||
|
endif
|
||||||
|
|
||||||
DTVLIB = $(DTVDIR)/libdtv.a
|
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
|
separate from the core VDR source, without the need of patching the original
|
||||||
VDR code (and all the problems of correlating various patches).
|
VDR code (and all the problems of correlating various patches).
|
||||||
<p>
|
<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
|
This document is divided into two parts, the first one describing the
|
||||||
<a href="#Part I - The Outside Interface"><i>outside</i> interface</a>
|
<a href="#Part I - The Outside Interface"><i>outside</i> interface</a>
|
||||||
of the plugin system, and the second one describing the
|
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.
|
VDR program and present itself to the user.
|
||||||
The <i>inside</i> interface provides the plugin code access to VDR's internal data
|
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.
|
structures and allows it to hook itself into specific areas to perform special actions.
|
||||||
<!--X1.1.3--></td></tr></table>
|
|
||||||
<p>
|
<p>
|
||||||
<!--X1.1.3--><table width=100%><tr><td bgcolor=#0000AA> </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.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%>
|
|
||||||
Important modifications introduced in version 1.1.4 are marked like this.
|
Important modifications introduced in version 1.1.4 are marked like this.
|
||||||
<!--X1.1.4--></td></tr></table>
|
<!--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.
|
Important modifications introduced in version 1.1.5 are marked like this.
|
||||||
<!--X1.1.5--></td></tr></table>
|
<!--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.
|
Important modifications introduced in version 1.1.6 are marked like this.
|
||||||
<!--X1.1.6--></td></tr></table>
|
<!--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>
|
<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
|
If you want to make your plugin available to other VDR users, you'll need to
|
||||||
make a package that can be easily distributed.
|
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
|
The <tt>Makefile</tt> that has been created by the call to
|
||||||
<a href="#Initializing a new plugin directory"><tt>newplugin</tt></a>
|
<a href="#Initializing a new plugin directory"><tt>newplugin</tt></a>
|
||||||
provides the target <tt>dist</tt>, which does this for you.
|
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
|
cd VDR/PLUGINS/SRC/hello
|
||||||
make dist
|
make dist
|
||||||
</pre></td></tr></table><p>
|
</pre></td></tr></table><p>
|
||||||
<!--X1.1.3--></td></tr></table>
|
|
||||||
|
|
||||||
After this you should find a file named like
|
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
|
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.
|
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>
|
<a name="Part II - The Inside Interface"><hr><center><h1>Part II - The Inside Interface</h1></center>
|
||||||
|
|
||||||
<hr><h2>Status monitor</h2>
|
<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
|
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
|
member functions are available in <tt>cStatus</tt>. You only need to implement
|
||||||
the functions you actually want to use.
|
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>
|
<hr><h2>Players</h2>
|
||||||
|
|
||||||
<center><i><b>Play it again, Sam!</b></i></center><p>
|
<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);
|
int PlayVideo(const uchar *Data, int Length);
|
||||||
</pre></td></tr></table><p>
|
</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
|
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
|
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
|
desired video data stream, and it must be delivered fast enough so that the
|
||||||
DVB device doesn't run out of data.
|
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>
|
<p>
|
||||||
TODO: PlayAudio()???
|
TODO: PlayAudio()???
|
||||||
<p>
|
<p>
|
||||||
@ -1064,7 +1067,7 @@ that they already know. If you absolutely want to do things differently, just go
|
|||||||
ahead - it's your show...
|
ahead - it's your show...
|
||||||
<!--X1.1.4--></td></tr></table>
|
<!--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>
|
<hr><h2>Receivers</h2>
|
||||||
|
|
||||||
<center><i><b>Tapping into the stream...</b></i></center><p>
|
<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>.
|
and will automatically detach itself from the <tt>cDevice</tt>.
|
||||||
<!--X1.1.6--></td></tr></table>
|
<!--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>
|
<hr><h2>The On Screen Display</h2>
|
||||||
|
|
||||||
<center><i><b>Express yourself</b></i></center><p>
|
<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).
|
its windows and color depths).
|
||||||
<!--X1.1.5--></td></tr></table>
|
<!--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>
|
<hr><h2>Devices</h2>
|
||||||
|
|
||||||
<center><i><b>Expanding the possibilities</b></i></center><p>
|
<center><i><b>Expanding the possibilities</b></i></center><p>
|
||||||
@ -1225,17 +1228,20 @@ to indicate this to VDR.
|
|||||||
<p>
|
<p>
|
||||||
The functions to implement replaying capabilites are
|
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>
|
<p><table><tr><td bgcolor=#F0F0F0><pre><br>
|
||||||
virtual bool HasDecoder(void) const;
|
virtual bool HasDecoder(void) const;
|
||||||
virtual int SetPlayMode(bool On);
|
virtual bool SetPlayMode(ePlayMode PlayMode);
|
||||||
virtual void TrickSpeed(int Speed);
|
virtual void TrickSpeed(int Speed);
|
||||||
virtual void Clear(void);
|
virtual void Clear(void);
|
||||||
virtual void Play(void);
|
virtual void Play(void);
|
||||||
virtual void Freeze(void);
|
virtual void Freeze(void);
|
||||||
virtual void Mute(void);
|
virtual void Mute(void);
|
||||||
virtual void StillPicture(const uchar *Data, int Length);
|
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 PlayVideo(const uchar *Data, int Length);
|
||||||
</pre></td></tr></table><p>
|
</pre></td></tr></table><p>
|
||||||
|
<!--X1.1.7--></td></tr></table>
|
||||||
|
|
||||||
In addition, the following functions may be implemented to provide further
|
In addition, the following functions may be implemented to provide further
|
||||||
functionality:
|
functionality:
|
||||||
|
42
config.c
42
config.c
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* 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"
|
#include "config.h"
|
||||||
@ -217,7 +217,7 @@ const char *cChannel::ToText(cChannel *Channel)
|
|||||||
s = strcpy(buf, s);
|
s = strcpy(buf, s);
|
||||||
strreplace(s, ':', '|');
|
strreplace(s, ':', '|');
|
||||||
}
|
}
|
||||||
delete buffer;
|
free(buffer);
|
||||||
if (Channel->groupSep)
|
if (Channel->groupSep)
|
||||||
asprintf(&buffer, ":%s\n", s);
|
asprintf(&buffer, ":%s\n", s);
|
||||||
else {
|
else {
|
||||||
@ -267,7 +267,7 @@ bool cChannel::Parse(const char *s)
|
|||||||
sscanf(apidbuf, "%d ,%d ", &apid1, &apid2);
|
sscanf(apidbuf, "%d ,%d ", &apid1, &apid2);
|
||||||
if (p)
|
if (p)
|
||||||
sscanf(p, "%d ,%d ", &dpid1, &dpid2);
|
sscanf(p, "%d ,%d ", &dpid1, &dpid2);
|
||||||
delete apidbuf;
|
free(apidbuf);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
@ -279,7 +279,7 @@ bool cChannel::Parse(const char *s)
|
|||||||
tpid = 0;
|
tpid = 0;
|
||||||
}
|
}
|
||||||
strn0cpy(name, buffer, MaxChannelName);
|
strn0cpy(name, buffer, MaxChannelName);
|
||||||
delete buffer;
|
free(buffer);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
@ -377,7 +377,7 @@ cTimer::cTimer(const cEventInfo *EventInfo)
|
|||||||
|
|
||||||
cTimer::~cTimer()
|
cTimer::~cTimer()
|
||||||
{
|
{
|
||||||
delete summary;
|
free(summary);
|
||||||
}
|
}
|
||||||
|
|
||||||
cTimer& cTimer::operator= (const cTimer &Timer)
|
cTimer& cTimer::operator= (const cTimer &Timer)
|
||||||
@ -398,7 +398,7 @@ bool cTimer::operator< (const cListObject &ListObject)
|
|||||||
|
|
||||||
const char *cTimer::ToText(cTimer *Timer)
|
const char *cTimer::ToText(cTimer *Timer)
|
||||||
{
|
{
|
||||||
delete buffer;
|
free(buffer);
|
||||||
strreplace(Timer->file, ':', '|');
|
strreplace(Timer->file, ':', '|');
|
||||||
strreplace(Timer->summary, '\n', '|');
|
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 : "");
|
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 *buffer1 = NULL;
|
||||||
char *buffer2 = NULL;
|
char *buffer2 = NULL;
|
||||||
delete summary;
|
free(summary);
|
||||||
summary = NULL;
|
summary = NULL;
|
||||||
//XXX Apparently sscanf() doesn't work correctly if the last %a argument
|
//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
|
//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]))
|
while (l2 > 0 && isspace(s[l2 - 1]))
|
||||||
l2--;
|
l2--;
|
||||||
if (s[l2 - 1] == ':') {
|
if (s[l2 - 1] == ':') {
|
||||||
s2 = (char *)malloc(l2 + 3);
|
s2 = MALLOC(char, l2 + 3);
|
||||||
strcat(strn0cpy(s2, s, l2 + 1), " \n");
|
strcat(strn0cpy(s2, s, l2 + 1), " \n");
|
||||||
s = s2;
|
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 (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)) {
|
if (summary && !*skipspace(summary)) {
|
||||||
delete summary;
|
free(summary);
|
||||||
summary = NULL;
|
summary = NULL;
|
||||||
}
|
}
|
||||||
//TODO add more plausibility checks
|
//TODO add more plausibility checks
|
||||||
@ -522,12 +522,12 @@ bool cTimer::Parse(const char *s)
|
|||||||
strn0cpy(file, buffer2, MaxFileName);
|
strn0cpy(file, buffer2, MaxFileName);
|
||||||
strreplace(file, '|', ':');
|
strreplace(file, '|', ':');
|
||||||
strreplace(summary, '|', '\n');
|
strreplace(summary, '|', '\n');
|
||||||
delete buffer1;
|
free(buffer1);
|
||||||
delete buffer2;
|
free(buffer2);
|
||||||
delete s2;
|
free(s2);
|
||||||
return day != 0;
|
return day != 0;
|
||||||
}
|
}
|
||||||
delete s2;
|
free(s2);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -661,8 +661,8 @@ cCommand::cCommand(void)
|
|||||||
|
|
||||||
cCommand::~cCommand()
|
cCommand::~cCommand()
|
||||||
{
|
{
|
||||||
delete title;
|
free(title);
|
||||||
delete command;
|
free(command);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cCommand::Parse(const char *s)
|
bool cCommand::Parse(const char *s)
|
||||||
@ -685,7 +685,7 @@ bool cCommand::Parse(const char *s)
|
|||||||
const char *cCommand::Execute(void)
|
const char *cCommand::Execute(void)
|
||||||
{
|
{
|
||||||
dsyslog("executing command '%s'", command);
|
dsyslog("executing command '%s'", command);
|
||||||
delete result;
|
free(result);
|
||||||
result = NULL;
|
result = NULL;
|
||||||
FILE *p = popen(command, "r");
|
FILE *p = popen(command, "r");
|
||||||
if (p) {
|
if (p) {
|
||||||
@ -749,7 +749,7 @@ cCaDefinition::cCaDefinition(void)
|
|||||||
|
|
||||||
cCaDefinition::~cCaDefinition()
|
cCaDefinition::~cCaDefinition()
|
||||||
{
|
{
|
||||||
delete description;
|
free(description);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cCaDefinition::Parse(const char *s)
|
bool cCaDefinition::Parse(const char *s)
|
||||||
@ -935,9 +935,9 @@ cSetupLine::cSetupLine(const char *Name, const char *Value, const char *Plugin)
|
|||||||
|
|
||||||
cSetupLine::~cSetupLine()
|
cSetupLine::~cSetupLine()
|
||||||
{
|
{
|
||||||
delete plugin;
|
free(plugin);
|
||||||
delete name;
|
free(name);
|
||||||
delete value;
|
free(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cSetupLine::operator< (const cListObject &ListObject)
|
bool cSetupLine::operator< (const cListObject &ListObject)
|
||||||
@ -1068,7 +1068,7 @@ void cSetup::Store(const char *Name, int Value, const char *Plugin)
|
|||||||
char *buffer = NULL;
|
char *buffer = NULL;
|
||||||
asprintf(&buffer, "%d", Value);
|
asprintf(&buffer, "%d", Value);
|
||||||
Store(Name, buffer, Plugin);
|
Store(Name, buffer, Plugin);
|
||||||
delete buffer;
|
free(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cSetup::Load(const char *FileName)
|
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
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* 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
|
#ifndef __CONFIG_H
|
||||||
@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@ -19,7 +20,7 @@
|
|||||||
#include "eit.h"
|
#include "eit.h"
|
||||||
#include "tools.h"
|
#include "tools.h"
|
||||||
|
|
||||||
#define VDRVERSION "1.1.6"
|
#define VDRVERSION "1.1.7"
|
||||||
|
|
||||||
#define MAXPRIORITY 99
|
#define MAXPRIORITY 99
|
||||||
#define MAXLIFETIME 99
|
#define MAXLIFETIME 99
|
||||||
@ -214,12 +215,13 @@ private:
|
|||||||
char *fileName;
|
char *fileName;
|
||||||
void Clear(void)
|
void Clear(void)
|
||||||
{
|
{
|
||||||
delete fileName;
|
free(fileName);
|
||||||
|
fileName = NULL;
|
||||||
cList<T>::Clear();
|
cList<T>::Clear();
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
cConfig(void) { fileName = NULL; }
|
cConfig(void) { fileName = NULL; }
|
||||||
virtual ~cConfig() { delete fileName; }
|
virtual ~cConfig() { free(fileName); }
|
||||||
const char *FileName(void) { return fileName; }
|
const char *FileName(void) { return fileName; }
|
||||||
bool Load(const char *FileName, bool AllowComments = false)
|
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
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* 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"
|
#include "cutter.h"
|
||||||
@ -196,7 +196,7 @@ bool cCutter::Start(const char *FileName)
|
|||||||
RemoveVideoFile(s);
|
RemoveVideoFile(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delete s;
|
free(s);
|
||||||
// XXX
|
// XXX
|
||||||
editedVersionName = strdup(evn);
|
editedVersionName = strdup(evn);
|
||||||
Recording.WriteSummary();
|
Recording.WriteSummary();
|
||||||
@ -231,7 +231,7 @@ bool cCutter::Active(void)
|
|||||||
Stop();
|
Stop();
|
||||||
if (!error)
|
if (!error)
|
||||||
cRecordingUserCommand::InvokeCommand(RUC_EDITEDRECORDING, editedVersionName);
|
cRecordingUserCommand::InvokeCommand(RUC_EDITEDRECORDING, editedVersionName);
|
||||||
delete editedVersionName;
|
free(editedVersionName);
|
||||||
editedVersionName = NULL;
|
editedVersionName = NULL;
|
||||||
ended = true;
|
ended = true;
|
||||||
}
|
}
|
||||||
|
19
device.c
19
device.c
@ -4,12 +4,11 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* 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 "device.h"
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <poll.h>
|
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include "eit.h"
|
#include "eit.h"
|
||||||
@ -98,7 +97,7 @@ bool cDevice::SetPrimaryDevice(int n)
|
|||||||
primaryDevice->MakePrimaryDevice(true);
|
primaryDevice->MakePrimaryDevice(true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
esyslog("invalid device number: %d", n + 1);
|
esyslog("invalid primary device number: %d", n + 1);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -317,9 +316,9 @@ void cDevice::SetVolume(int Volume, bool Absolute)
|
|||||||
mute = false;
|
mute = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int cDevice::SetPlayMode(bool On)
|
bool cDevice::SetPlayMode(ePlayMode PlayMode)
|
||||||
{
|
{
|
||||||
return -1;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cDevice::TrickSpeed(int Speed)
|
void cDevice::TrickSpeed(int Speed)
|
||||||
@ -362,7 +361,7 @@ bool cDevice::AttachPlayer(cPlayer *Player)
|
|||||||
Detach(player);
|
Detach(player);
|
||||||
player = Player;
|
player = Player;
|
||||||
player->device = this;
|
player->device = this;
|
||||||
player->deviceFileHandle = SetPlayMode(true);
|
SetPlayMode(player->playMode);
|
||||||
player->Activate(true);
|
player->Activate(true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -373,10 +372,9 @@ void cDevice::Detach(cPlayer *Player)
|
|||||||
{
|
{
|
||||||
if (Player && player == Player) {
|
if (Player && player == Player) {
|
||||||
player->Activate(false);
|
player->Activate(false);
|
||||||
player->deviceFileHandle = -1;
|
|
||||||
player->device = NULL;
|
player->device = NULL;
|
||||||
player = 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)
|
int cDevice::PlayVideo(const uchar *Data, int Length)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
|
37
device.h
37
device.h
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* 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
|
#ifndef __DEVICE_H
|
||||||
@ -26,6 +26,23 @@
|
|||||||
|
|
||||||
enum eSetChannelResult { scrOk, scrNoTransfer, scrFailed };
|
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 cChannel;
|
||||||
class cPlayer;
|
class cPlayer;
|
||||||
class cReceiver;
|
class cReceiver;
|
||||||
@ -97,7 +114,9 @@ public:
|
|||||||
bool IsPrimaryDevice(void) const { return this == primaryDevice; }
|
bool IsPrimaryDevice(void) const { return this == primaryDevice; }
|
||||||
int CardIndex(void) const { return cardIndex; }
|
int CardIndex(void) const { return cardIndex; }
|
||||||
// Returns the card index of this device (0 ... MAXDEVICES - 1).
|
// 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
|
// Checks whether this device provides the given value in its
|
||||||
// caCaps. Returns 0 if the value is not provided, 1 if only this
|
// 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.
|
// value is provided, and > 1 if this and other values are provided.
|
||||||
@ -188,11 +207,9 @@ public:
|
|||||||
private:
|
private:
|
||||||
cPlayer *player;
|
cPlayer *player;
|
||||||
protected:
|
protected:
|
||||||
virtual int SetPlayMode(bool On);
|
virtual bool SetPlayMode(ePlayMode PlayMode);
|
||||||
// Sets the device into play mode (On = true) or normal
|
// Sets the device into the given play mode.
|
||||||
// viewing mode (On = false). If On is true, it may return a file
|
// Returns true if the operation was successful.
|
||||||
// handle that a player can use to poll this device when replaying.
|
|
||||||
//XXX TODO should be implemented differently
|
|
||||||
public:
|
public:
|
||||||
virtual void TrickSpeed(int Speed);
|
virtual void TrickSpeed(int Speed);
|
||||||
// Sets the device into a mode where replay is done slower.
|
// Sets the device into a mode where replay is done slower.
|
||||||
@ -209,6 +226,12 @@ public:
|
|||||||
// Turns off audio while replaying.
|
// Turns off audio while replaying.
|
||||||
virtual void StillPicture(const uchar *Data, int Length);
|
virtual void StillPicture(const uchar *Data, int Length);
|
||||||
// Displays the given I-frame as a still picture.
|
// 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);
|
virtual int PlayVideo(const uchar *Data, int Length);
|
||||||
// Actually plays the given data block as video. The data must be
|
// Actually plays the given data block as video. The data must be
|
||||||
// part of a PES (Packetized Elementary Stream) which can contain
|
// 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
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* 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"
|
#include "dvbdevice.h"
|
||||||
@ -18,10 +18,15 @@ extern "C" {
|
|||||||
}
|
}
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <linux/videodev.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/audio.h>
|
||||||
#include <ost/sec.h>
|
#include <ost/sec.h>
|
||||||
#include <ost/video.h>
|
#include <ost/video.h>
|
||||||
#include <poll.h>
|
#endif
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include "dvbosd.h"
|
#include "dvbosd.h"
|
||||||
@ -33,24 +38,38 @@ extern "C" {
|
|||||||
#define MAXDVBDEVICES 4
|
#define MAXDVBDEVICES 4
|
||||||
|
|
||||||
#define DEV_VIDEO "/dev/video"
|
#define DEV_VIDEO "/dev/video"
|
||||||
#define DEV_OST_OSD "/dev/ost/osd"
|
#ifdef NEWSTRUCT
|
||||||
#define DEV_OST_FRONTEND "/dev/ost/frontend"
|
#define DEV_DVB_ADAPTER "/dev/dvb/adapter"
|
||||||
#define DEV_OST_SEC "/dev/ost/sec"
|
#define DEV_DVB_OSD "osd"
|
||||||
#define DEV_OST_DVR "/dev/ost/dvr"
|
#define DEV_DVB_FRONTEND "frontend"
|
||||||
#define DEV_OST_DEMUX "/dev/ost/demux"
|
#define DEV_DVB_DVR "dvr"
|
||||||
#define DEV_OST_VIDEO "/dev/ost/video"
|
#define DEV_DVB_DEMUX "demux"
|
||||||
#define DEV_OST_AUDIO "/dev/ost/audio"
|
#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];
|
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);
|
snprintf(buffer, sizeof(buffer), "%s%d", Name, n);
|
||||||
|
#endif
|
||||||
return buffer;
|
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);
|
int fd = open(FileName, Mode);
|
||||||
if (fd < 0 && ReportError)
|
if (fd < 0 && ReportError)
|
||||||
LOG_ERROR_STR(FileName);
|
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
|
frontendType = FrontendType(-1); // don't know how else to initialize this - there is no FE_UNKNOWN
|
||||||
siProcessor = NULL;
|
siProcessor = NULL;
|
||||||
|
playMode = pmNone;
|
||||||
|
|
||||||
// Devices that are present on all card types:
|
// Devices that are present on all card types:
|
||||||
|
|
||||||
fd_frontend = OstOpen(DEV_OST_FRONTEND, n, O_RDWR);
|
fd_frontend = DvbOpen(DEV_DVB_FRONTEND, n, O_RDWR | O_NONBLOCK);
|
||||||
|
|
||||||
// Devices that are only present on DVB-S cards:
|
|
||||||
|
|
||||||
fd_sec = OstOpen(DEV_OST_SEC, n, O_RDWR);
|
|
||||||
|
|
||||||
// Devices that are only present on cards with decoders:
|
// Devices that are only present on cards with decoders:
|
||||||
|
|
||||||
fd_osd = OstOpen(DEV_OST_OSD, n, O_RDWR);
|
fd_osd = DvbOpen(DEV_DVB_OSD, n, O_RDWR);
|
||||||
fd_video = OstOpen(DEV_OST_VIDEO, n, O_RDWR | O_NONBLOCK);
|
fd_video = DvbOpen(DEV_DVB_VIDEO, n, O_RDWR | O_NONBLOCK);
|
||||||
fd_audio = OstOpen(DEV_OST_AUDIO, 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):
|
// 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
|
// We only check the devices that must be present - the others will be checked before accessing them://XXX
|
||||||
|
|
||||||
if (fd_frontend >= 0) {
|
if (fd_frontend >= 0) {
|
||||||
siProcessor = new cSIProcessor(OstName(DEV_OST_DEMUX, n));
|
#ifdef NEWSTRUCT
|
||||||
|
dvb_frontend_info feinfo;
|
||||||
|
#else
|
||||||
FrontendInfo feinfo;
|
FrontendInfo feinfo;
|
||||||
|
#endif
|
||||||
|
siProcessor = new cSIProcessor(DvbName(DEV_DVB_DEMUX, n));
|
||||||
if (ioctl(fd_frontend, FE_GET_INFO, &feinfo) >= 0)
|
if (ioctl(fd_frontend, FE_GET_INFO, &feinfo) >= 0)
|
||||||
frontendType = feinfo.type;
|
frontendType = feinfo.type;
|
||||||
else
|
else
|
||||||
@ -130,7 +156,7 @@ bool cDvbDevice::Initialize(void)
|
|||||||
int i;
|
int i;
|
||||||
for (i = 0; i < MAXDVBDEVICES; i++) {
|
for (i = 0; i < MAXDVBDEVICES; i++) {
|
||||||
if (UseDevice(NextCardIndex())) {
|
if (UseDevice(NextCardIndex())) {
|
||||||
if (Probe(OstName(DEV_OST_FRONTEND, i))) {
|
if (Probe(DvbName(DEV_DVB_FRONTEND, i))) {
|
||||||
new cDvbDevice(i);
|
new cDvbDevice(i);
|
||||||
found++;
|
found++;
|
||||||
}
|
}
|
||||||
@ -169,7 +195,7 @@ bool cDvbDevice::HasDecoder(void) const
|
|||||||
|
|
||||||
bool cDvbDevice::GrabImage(const char *FileName, bool Jpeg, int Quality, int SizeX, int SizeY)
|
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) {
|
if (videoDev >= 0) {
|
||||||
int result = 0;
|
int result = 0;
|
||||||
struct video_mbuf mbuf;
|
struct video_mbuf mbuf;
|
||||||
@ -274,7 +300,7 @@ bool cDvbDevice::SetPid(cPidHandle *Handle, int Type, bool On)
|
|||||||
if (Handle->pid) {
|
if (Handle->pid) {
|
||||||
if (On) {
|
if (On) {
|
||||||
if (Handle->handle < 0) {
|
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)
|
if (Handle->handle < 0)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -290,6 +316,7 @@ bool cDvbDevice::SetPid(cPidHandle *Handle, int Type, bool On)
|
|||||||
|
|
||||||
if (Handle->pid != 0x1FFF) {
|
if (Handle->pid != 0x1FFF) {
|
||||||
dmxPesFilterParams pesFilterParams;
|
dmxPesFilterParams pesFilterParams;
|
||||||
|
memset(&pesFilterParams, 0, sizeof(pesFilterParams));
|
||||||
pesFilterParams.pid = Handle->pid;
|
pesFilterParams.pid = Handle->pid;
|
||||||
pesFilterParams.input = DMX_IN_FRONTEND;
|
pesFilterParams.input = DMX_IN_FRONTEND;
|
||||||
pesFilterParams.output = (Type <= ptTeletext && Handle->used <= 1) ? DMX_OUT_DECODER : DMX_OUT_TS_TAP;
|
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);
|
DelPid(pidHandles[ptDolby].pid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef NEWSTRUCT
|
||||||
|
dvb_frontend_parameters Frontend;
|
||||||
|
#else
|
||||||
FrontendParameters Frontend;
|
FrontendParameters Frontend;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
memset(&Frontend, 0, sizeof(Frontend));
|
||||||
|
|
||||||
switch (frontendType) {
|
switch (frontendType) {
|
||||||
case FE_QPSK: { // DVB-S
|
case FE_QPSK: { // DVB-S
|
||||||
@ -351,15 +384,38 @@ bool cDvbDevice::SetChannelDevice(const cChannel *Channel)
|
|||||||
tone = SEC_TONE_ON;
|
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.Frequency = freq * 1000UL;
|
||||||
Frontend.Inversion = INVERSION_AUTO;
|
Frontend.Inversion = INVERSION_AUTO;
|
||||||
Frontend.u.qpsk.SymbolRate = Channel->srate * 1000UL;
|
Frontend.u.qpsk.SymbolRate = Channel->srate * 1000UL;
|
||||||
Frontend.u.qpsk.FEC_inner = FEC_AUTO;
|
Frontend.u.qpsk.FEC_inner = FEC_AUTO;
|
||||||
|
#endif
|
||||||
|
|
||||||
int volt = (Channel->polarization == 'v' || Channel->polarization == 'V') ? SEC_VOLTAGE_13 : SEC_VOLTAGE_18;
|
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;
|
secCommand scmd;
|
||||||
scmd.type = 0;
|
scmd.type = 0;
|
||||||
scmd.u.diseqc.addr = 0x10;
|
scmd.u.diseqc.addr = 0x10;
|
||||||
@ -375,23 +431,43 @@ bool cDvbDevice::SetChannelDevice(const cChannel *Channel)
|
|||||||
scmds.commands = &scmd;
|
scmds.commands = &scmd;
|
||||||
|
|
||||||
CHECK(ioctl(fd_sec, SEC_SEND_SEQUENCE, &scmds));
|
CHECK(ioctl(fd_sec, SEC_SEND_SEQUENCE, &scmds));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case FE_QAM: { // DVB-C
|
case FE_QAM: { // DVB-C
|
||||||
|
|
||||||
// Frequency and symbol rate:
|
// 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.Frequency = Channel->frequency * 1000000UL;
|
||||||
Frontend.Inversion = INVERSION_AUTO;
|
Frontend.Inversion = INVERSION_AUTO;
|
||||||
Frontend.u.qam.SymbolRate = Channel->srate * 1000UL;
|
Frontend.u.qam.SymbolRate = Channel->srate * 1000UL;
|
||||||
Frontend.u.qam.FEC_inner = FEC_AUTO;
|
Frontend.u.qam.FEC_inner = FEC_AUTO;
|
||||||
Frontend.u.qam.QAM = QAM_64;
|
Frontend.u.qam.QAM = QAM_64;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case FE_OFDM: { // DVB-T
|
case FE_OFDM: { // DVB-T
|
||||||
|
|
||||||
// Frequency and OFDM paramaters:
|
// 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.Frequency = Channel->frequency * 1000UL;
|
||||||
Frontend.Inversion = INVERSION_AUTO;
|
Frontend.Inversion = INVERSION_AUTO;
|
||||||
Frontend.u.ofdm.bandWidth=BANDWIDTH_8_MHZ;
|
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.TransmissionMode=TRANSMISSION_MODE_2K;
|
||||||
Frontend.u.ofdm.guardInterval=GUARD_INTERVAL_1_32;
|
Frontend.u.ofdm.guardInterval=GUARD_INTERVAL_1_32;
|
||||||
Frontend.u.ofdm.HierarchyInformation=HIERARCHY_NONE;
|
Frontend.u.ofdm.HierarchyInformation=HIERARCHY_NONE;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -408,16 +485,40 @@ bool cDvbDevice::SetChannelDevice(const cChannel *Channel)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef NEWSTRUCT
|
||||||
|
// Discard stale events:
|
||||||
|
|
||||||
|
for (;;) {
|
||||||
|
dvb_frontend_event event;
|
||||||
|
if (ioctl(fd_frontend, FE_GET_EVENT, &event) < 0)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Tuning:
|
// Tuning:
|
||||||
|
|
||||||
CHECK(ioctl(fd_frontend, FE_SET_FRONTEND, &Frontend));
|
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)) {
|
if (cFile::FileReady(fd_frontend, 5000)) {
|
||||||
FrontendEvent event;
|
FrontendEvent event;
|
||||||
int res = ioctl(fd_frontend, FE_GET_EVENT, &event);
|
if (ioctl(fd_frontend, FE_GET_EVENT, &event) >= 0) {
|
||||||
if (res >= 0) {
|
|
||||||
if (event.type != FE_COMPLETION_EV) {
|
if (event.type != FE_COMPLETION_EV) {
|
||||||
esyslog("ERROR: channel %d not sync'ed on DVB card %d!", Channel->number, CardIndex() + 1);
|
esyslog("ERROR: channel %d not sync'ed on DVB card %d!", Channel->number, CardIndex() + 1);
|
||||||
if (IsPrimaryDevice())
|
if (IsPrimaryDevice())
|
||||||
@ -426,10 +527,11 @@ bool cDvbDevice::SetChannelDevice(const cChannel *Channel)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
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
|
else
|
||||||
esyslog("ERROR: timeout while tuning");
|
esyslog("ERROR: timeout while tuning on DVB card %d", CardIndex() + 1);
|
||||||
|
#endif
|
||||||
|
|
||||||
frequency = Channel->frequency;
|
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 (PlayMode != pmExtern_THIS_SHOULD_BE_AVOIDED && fd_video < 0 && fd_audio < 0) {
|
||||||
if (siProcessor)
|
// reopen the devices
|
||||||
siProcessor->SetStatus(false);
|
fd_video = DvbOpen(DEV_DVB_VIDEO, CardIndex(), O_RDWR | O_NONBLOCK);
|
||||||
CHECK(ioctl(fd_video, VIDEO_SET_BLANK, true));
|
fd_audio = DvbOpen(DEV_DVB_AUDIO, CardIndex(), O_RDWR | O_NONBLOCK);
|
||||||
CHECK(ioctl(fd_audio, AUDIO_SELECT_SOURCE, AUDIO_SOURCE_MEMORY));
|
SetVideoFormat(Setup.VideoFormat);
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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)
|
void cDvbDevice::TrickSpeed(int Speed)
|
||||||
@ -558,10 +692,17 @@ void cDvbDevice::StillPicture(const uchar *Data, int Length)
|
|||||||
#endif
|
#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)
|
int cDvbDevice::PlayVideo(const uchar *Data, int Length)
|
||||||
{
|
{
|
||||||
if (fd_video >= 0)
|
int fd = playMode == pmAudioOnly ? fd_audio : fd_video;
|
||||||
return write(fd_video, Data, Length);
|
if (fd >= 0)
|
||||||
|
return write(fd, Data, Length);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -574,7 +715,7 @@ int cDvbDevice::PlayAudio(const uchar *Data, int Length)
|
|||||||
bool cDvbDevice::OpenDvr(void)
|
bool cDvbDevice::OpenDvr(void)
|
||||||
{
|
{
|
||||||
CloseDvr();
|
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;
|
return fd_dvr >= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -589,13 +730,8 @@ void cDvbDevice::CloseDvr(void)
|
|||||||
int cDvbDevice::GetTSPacket(uchar *Data)
|
int cDvbDevice::GetTSPacket(uchar *Data)
|
||||||
{
|
{
|
||||||
if (fd_dvr >= 0) {
|
if (fd_dvr >= 0) {
|
||||||
pollfd pfd;
|
cPoller Poller(fd_dvr, false);
|
||||||
pfd.fd = fd_dvr;
|
if (Poller.Poll(100)) {
|
||||||
pfd.events = POLLIN;
|
|
||||||
|
|
||||||
poll(&pfd, 1, 100);
|
|
||||||
|
|
||||||
if (pfd.revents & POLLIN != 0) {
|
|
||||||
int r = read(fd_dvr, Data, TS_SIZE);
|
int r = read(fd_dvr, Data, TS_SIZE);
|
||||||
if (r >= 0)
|
if (r >= 0)
|
||||||
return r;
|
return r;
|
||||||
|
14
dvbdevice.h
14
dvbdevice.h
@ -4,18 +4,22 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* 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
|
#ifndef __DVBDEVICE_H
|
||||||
#define __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
|
#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: shouldn't every header file include ALL the other header
|
||||||
// FIXME: files it depends on? The sequence in which header files
|
// FIXME: files it depends on? The sequence in which header files
|
||||||
// FIXME: are included here should not matter - and it should NOT
|
// FIXME: are included here should not matter - and it should NOT
|
||||||
// FIXME: be necessary to include <stdlib.h> here!
|
// FIXME: be necessary to include <stdlib.h> here!
|
||||||
#include <ost/frontend.h>
|
#include <ost/frontend.h>
|
||||||
|
#endif
|
||||||
#include "device.h"
|
#include "device.h"
|
||||||
#include "eit.h"
|
#include "eit.h"
|
||||||
|
|
||||||
@ -30,7 +34,11 @@ public:
|
|||||||
// Must be called before accessing any DVB functions.
|
// Must be called before accessing any DVB functions.
|
||||||
private:
|
private:
|
||||||
FrontendType frontendType;
|
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;
|
int fd_osd, fd_frontend, fd_sec, fd_audio, fd_video, fd_dvr;
|
||||||
|
#endif
|
||||||
int OsdDeviceHandle(void) const { return fd_osd; }
|
int OsdDeviceHandle(void) const { return fd_osd; }
|
||||||
protected:
|
protected:
|
||||||
virtual void MakePrimaryDevice(bool On);
|
virtual void MakePrimaryDevice(bool On);
|
||||||
@ -75,7 +83,8 @@ private:
|
|||||||
// Player facilities
|
// Player facilities
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual int SetPlayMode(bool On);
|
ePlayMode playMode;
|
||||||
|
virtual bool SetPlayMode(ePlayMode PlayMode);
|
||||||
public:
|
public:
|
||||||
virtual void TrickSpeed(int Speed);
|
virtual void TrickSpeed(int Speed);
|
||||||
virtual void Clear(void);
|
virtual void Clear(void);
|
||||||
@ -83,6 +92,7 @@ public:
|
|||||||
virtual void Freeze(void);
|
virtual void Freeze(void);
|
||||||
virtual void Mute(void);
|
virtual void Mute(void);
|
||||||
virtual void StillPicture(const uchar *Data, int Length);
|
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 PlayVideo(const uchar *Data, int Length);
|
||||||
virtual int PlayAudio(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
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* 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
|
#ifndef __DVBOSD_H
|
||||||
#define __DVBOSD_H
|
#define __DVBOSD_H
|
||||||
|
|
||||||
|
#ifdef NEWSTRUCT
|
||||||
|
#include <linux/dvb/osd.h>
|
||||||
|
#else
|
||||||
#include <ost/osd.h>
|
#include <ost/osd.h>
|
||||||
|
#endif
|
||||||
#include "dvbdevice.h"
|
#include "dvbdevice.h"
|
||||||
#include "osdbase.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
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* 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 "dvbplayer.h"
|
||||||
#include <poll.h>
|
#include <stdlib.h>
|
||||||
#include "recording.h"
|
#include "recording.h"
|
||||||
#include "ringbuffer.h"
|
#include "ringbuffer.h"
|
||||||
#include "thread.h"
|
#include "thread.h"
|
||||||
|
#include "tools.h"
|
||||||
|
|
||||||
// --- cBackTrace ----------------------------------------------------------
|
// --- cBackTrace ----------------------------------------------------------
|
||||||
|
|
||||||
@ -63,7 +64,7 @@ int cBackTrace::Get(bool Forward)
|
|||||||
p = BACKTRACE_ENTRIES - 1;
|
p = BACKTRACE_ENTRIES - 1;
|
||||||
i = index[p] - 1;
|
i = index[p] - 1;
|
||||||
l -= length[p];
|
l -= length[p];
|
||||||
n--;
|
n--;
|
||||||
}
|
}
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
@ -301,121 +302,111 @@ void cDvbPlayer::Action(void)
|
|||||||
const uchar *p = NULL;
|
const uchar *p = NULL;
|
||||||
int pc = 0;
|
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();
|
readIndex = Resume();
|
||||||
if (readIndex >= 0)
|
if (readIndex >= 0)
|
||||||
isyslog("resuming replay at index %d (%s)", readIndex, IndexToHMSF(readIndex, true));
|
isyslog("resuming replay at index %d (%s)", readIndex, IndexToHMSF(readIndex, true));
|
||||||
|
|
||||||
running = true;
|
running = true;
|
||||||
while (running && NextFile()) {
|
while (running && NextFile()) {
|
||||||
pfd[1].fd = replayFile; // NextFile() may have returned a new file handle!
|
cPoller Poller;
|
||||||
{
|
if (!readFrame)
|
||||||
LOCK_THREAD;
|
Poller.Add(replayFile, false);
|
||||||
|
if (DevicePoll(Poller, 100)) {
|
||||||
|
|
||||||
// Read the next frame from the file:
|
LOCK_THREAD;
|
||||||
|
|
||||||
if (!readFrame && (pfd[1].revents & POLLIN)) {
|
// Read the next frame from the file:
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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) {
|
// Store the frame in the buffer:
|
||||||
if (ringBuffer->Put(readFrame))
|
|
||||||
readFrame = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the next frame from the buffer:
|
if (readFrame) {
|
||||||
|
if (ringBuffer->Put(readFrame))
|
||||||
if (!playFrame) {
|
readFrame = NULL;
|
||||||
playFrame = ringBuffer->Get();
|
}
|
||||||
p = NULL;
|
|
||||||
pc = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Play the frame:
|
// Get the next frame from the buffer:
|
||||||
|
|
||||||
if (playFrame && (pfd[0].revents & POLLOUT)) {
|
if (!playFrame) {
|
||||||
if (!p) {
|
playFrame = ringBuffer->Get();
|
||||||
p = playFrame->Data();
|
p = NULL;
|
||||||
pc = playFrame->Count();
|
pc = 0;
|
||||||
}
|
}
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Wait for input or output to become ready:
|
// Play the frame:
|
||||||
|
|
||||||
if (poll(pfd, readFrame ? 1 : 2, 10) < 0 && FATALERRNO) {
|
if (playFrame) {
|
||||||
LOG_ERROR;
|
if (!p) {
|
||||||
break;
|
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;
|
active = running = false;
|
||||||
|
22
eit.c
22
eit.c
@ -16,7 +16,7 @@
|
|||||||
* the Free Software Foundation; either version 2 of the License, or *
|
* the Free Software Foundation; either version 2 of the License, or *
|
||||||
* (at your option) any later version. *
|
* (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"
|
#include "eit.h"
|
||||||
@ -26,7 +26,11 @@
|
|||||||
#include <iomanip.h>
|
#include <iomanip.h>
|
||||||
#include <iostream.h>
|
#include <iostream.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
#ifdef NEWSTRUCT
|
||||||
|
#include <linux/dvb/dmx.h>
|
||||||
|
#else
|
||||||
#include <ost/dmx.h>
|
#include <ost/dmx.h>
|
||||||
|
#endif
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -198,9 +202,9 @@ cEventInfo::cEventInfo(unsigned short serviceid, unsigned short eventid)
|
|||||||
|
|
||||||
cEventInfo::~cEventInfo()
|
cEventInfo::~cEventInfo()
|
||||||
{
|
{
|
||||||
delete pTitle;
|
free(pTitle);
|
||||||
delete pSubtitle;
|
free(pSubtitle);
|
||||||
delete pExtendedDescription;
|
free(pExtendedDescription);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** */
|
/** */
|
||||||
@ -496,8 +500,8 @@ void cEventInfo::FixEpgBugs(void)
|
|||||||
*e = 0;
|
*e = 0;
|
||||||
char *s = strdup(p + 1);
|
char *s = strdup(p + 1);
|
||||||
char *d = strdup(e + strlen(delim));
|
char *d = strdup(e + strlen(delim));
|
||||||
delete pSubtitle;
|
free(pSubtitle);
|
||||||
delete pExtendedDescription;
|
free(pExtendedDescription);
|
||||||
pSubtitle = s;
|
pSubtitle = s;
|
||||||
pExtendedDescription = d;
|
pExtendedDescription = d;
|
||||||
EpgBugFixStat(0, GetServiceID());
|
EpgBugFixStat(0, GetServiceID());
|
||||||
@ -527,7 +531,7 @@ void cEventInfo::FixEpgBugs(void)
|
|||||||
// Title
|
// Title
|
||||||
//
|
//
|
||||||
if (pSubtitle && strcmp(pTitle, pSubtitle) == 0) {
|
if (pSubtitle && strcmp(pTitle, pSubtitle) == 0) {
|
||||||
delete pSubtitle;
|
free(pSubtitle);
|
||||||
pSubtitle = NULL;
|
pSubtitle = NULL;
|
||||||
EpgBugFixStat(2, GetServiceID());
|
EpgBugFixStat(2, GetServiceID());
|
||||||
}
|
}
|
||||||
@ -997,10 +1001,10 @@ cSIProcessor::~cSIProcessor()
|
|||||||
active = false;
|
active = false;
|
||||||
Cancel(3);
|
Cancel(3);
|
||||||
ShutDownFilters();
|
ShutDownFilters();
|
||||||
delete filters;
|
free(filters);
|
||||||
if (!--numSIProcessors) // the last one deletes it
|
if (!--numSIProcessors) // the last one deletes it
|
||||||
delete schedules;
|
delete schedules;
|
||||||
delete fileName;
|
free(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
const cSchedules *cSIProcessor::Schedules(cMutexLock &MutexLock)
|
const cSchedules *cSIProcessor::Schedules(cMutexLock &MutexLock)
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* 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"
|
#include "eitscan.h"
|
||||||
@ -21,7 +21,7 @@ cEITScanner::cEITScanner(void)
|
|||||||
|
|
||||||
cEITScanner::~cEITScanner()
|
cEITScanner::~cEITScanner()
|
||||||
{
|
{
|
||||||
delete transponders;
|
free(transponders);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cEITScanner::TransponderScanned(cChannel *Channel)
|
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
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* 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 "interface.h"
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include "i18n.h"
|
#include "i18n.h"
|
||||||
#include "osd.h"
|
#include "osd.h"
|
||||||
@ -84,7 +85,7 @@ eKeys cInterface::GetKey(bool Wait)
|
|||||||
char *message = SVDRP->GetMessage();
|
char *message = SVDRP->GetMessage();
|
||||||
if (message) {
|
if (message) {
|
||||||
Info(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:
|
// punch in a newline, so we need to make room for it:
|
||||||
if (Delim)
|
if (Delim)
|
||||||
p = Delim + 1; // let's fall back to the most recent delimiter
|
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;
|
int l = p - t;
|
||||||
strncpy(s, t, l);
|
strncpy(s, t, l);
|
||||||
s[l] = '\n';
|
s[l] = '\n';
|
||||||
strcpy(s + l + 1, p);
|
strcpy(s + l + 1, p);
|
||||||
delete t;
|
free(t);
|
||||||
t = s;
|
t = s;
|
||||||
p = t + l;
|
p = t + l;
|
||||||
continue;
|
continue;
|
||||||
@ -399,7 +400,7 @@ void cInterface::QueryKeys(void)
|
|||||||
char *Prompt;
|
char *Prompt;
|
||||||
asprintf(&Prompt, tr("Press key for '%s'"), tr(k->name));
|
asprintf(&Prompt, tr("Press key for '%s'"), tr(k->name));
|
||||||
WriteText(1, 5, Prompt);
|
WriteText(1, 5, Prompt);
|
||||||
delete Prompt;
|
free(Prompt);
|
||||||
for (;;) {
|
for (;;) {
|
||||||
unsigned int ch = GetCh();
|
unsigned int ch = GetCh();
|
||||||
if (ch != 0) {
|
if (ch != 0) {
|
||||||
|
44
menu.c
44
menu.c
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* 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"
|
#include "menu.h"
|
||||||
@ -32,8 +32,6 @@
|
|||||||
|
|
||||||
#define CHNUMWIDTH (Channels.Count() > 999 ? 5 : 4) // there are people with more than 999 channels...
|
#define CHNUMWIDTH (Channels.Count() > 999 ? 5 : 4) // there are people with more than 999 channels...
|
||||||
|
|
||||||
const char *FileNameChars = " abcdefghijklmnopqrstuvwxyz0123456789-.#~";
|
|
||||||
|
|
||||||
// --- cMenuEditChanItem -----------------------------------------------------
|
// --- cMenuEditChanItem -----------------------------------------------------
|
||||||
|
|
||||||
class cMenuEditChanItem : public cMenuEditIntItem {
|
class cMenuEditChanItem : public cMenuEditIntItem {
|
||||||
@ -936,7 +934,7 @@ cMenuEvent::cMenuEvent(const cEventInfo *EventInfo, bool CanSwitch)
|
|||||||
char *buffer;
|
char *buffer;
|
||||||
asprintf(&buffer, "%-17.*s\t%.*s %s - %s", 17, channel->name, 5, eventInfo->GetDate(), eventInfo->GetTimeString(), eventInfo->GetEndTimeString());
|
asprintf(&buffer, "%-17.*s\t%.*s %s - %s", 17, channel->name, 5, eventInfo->GetDate(), eventInfo->GetTimeString(), eventInfo->GetEndTimeString());
|
||||||
SetTitle(buffer, false);
|
SetTitle(buffer, false);
|
||||||
delete buffer;
|
free(buffer);
|
||||||
int Line = 2;
|
int Line = 2;
|
||||||
cMenuTextItem *item;
|
cMenuTextItem *item;
|
||||||
const char *Title = eventInfo->GetTitle();
|
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);
|
Add(new cMenuWhatsOnItem(pArray[a]), pArray[a]->GetChannelNumber() == CurrentChannelNr);
|
||||||
|
|
||||||
currentChannel = CurrentChannelNr;
|
currentChannel = CurrentChannelNr;
|
||||||
delete pArray;
|
free(pArray);
|
||||||
SetHelp(tr("Record"), Now ? tr("Next") : tr("Now"), tr("Button$Schedule"), tr("Switch"));
|
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;
|
char *buffer = NULL;
|
||||||
asprintf(&buffer, tr("Schedule - %s"), Channel->name);
|
asprintf(&buffer, tr("Schedule - %s"), Channel->name);
|
||||||
SetTitle(buffer);
|
SetTitle(buffer);
|
||||||
delete buffer;
|
free(buffer);
|
||||||
if (schedules) {
|
if (schedules) {
|
||||||
const cSchedule *Schedule = Channel->pnr ? schedules->GetSchedule(Channel->pnr) : schedules->GetSchedule();
|
const cSchedule *Schedule = Channel->pnr ? schedules->GetSchedule(Channel->pnr) : schedules->GetSchedule();
|
||||||
int num = Schedule->NumEvents();
|
int num = Schedule->NumEvents();
|
||||||
const cEventInfo **pArray = (const cEventInfo **)malloc(num * sizeof(cEventInfo *));
|
const cEventInfo **pArray = MALLOC(const cEventInfo *, num);
|
||||||
if (pArray) {
|
if (pArray) {
|
||||||
time_t now = time(NULL);
|
time_t now = time(NULL);
|
||||||
int numreal = 0;
|
int numreal = 0;
|
||||||
@ -1191,7 +1189,7 @@ void cMenuSchedule::PrepareSchedule(cChannel *Channel)
|
|||||||
|
|
||||||
for (int a = 0; a < numreal; a++)
|
for (int a = 0; a < numreal; a++)
|
||||||
Add(new cMenuScheduleItem(pArray[a]));
|
Add(new cMenuScheduleItem(pArray[a]));
|
||||||
delete pArray;
|
free(pArray);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1306,8 +1304,8 @@ cMenuRecordingItem::cMenuRecordingItem(cRecording *Recording, int Level)
|
|||||||
|
|
||||||
cMenuRecordingItem::~cMenuRecordingItem()
|
cMenuRecordingItem::~cMenuRecordingItem()
|
||||||
{
|
{
|
||||||
delete fileName;
|
free(fileName);
|
||||||
delete name;
|
free(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cMenuRecordingItem::IncrementCounter(bool New)
|
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)) {
|
if (*Item->Text() && (!LastItem || strcmp(Item->Text(), LastItemText) != 0)) {
|
||||||
Add(Item);
|
Add(Item);
|
||||||
LastItem = Item;
|
LastItem = Item;
|
||||||
delete LastItemText;
|
free(LastItemText);
|
||||||
LastItemText = strdup(LastItem->Text()); // must use a copy because of the counters!
|
LastItemText = strdup(LastItem->Text()); // must use a copy because of the counters!
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1357,7 +1355,7 @@ cMenuRecordings::cMenuRecordings(const char *Base, int Level, bool OpenSubMenus)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delete LastItemText;
|
free(LastItemText);
|
||||||
if (Current() < 0)
|
if (Current() < 0)
|
||||||
SetCurrent(First());
|
SetCurrent(First());
|
||||||
else if (OpenSubMenus && Open(true))
|
else if (OpenSubMenus && Open(true))
|
||||||
@ -1370,7 +1368,7 @@ cMenuRecordings::cMenuRecordings(const char *Base, int Level, bool OpenSubMenus)
|
|||||||
cMenuRecordings::~cMenuRecordings()
|
cMenuRecordings::~cMenuRecordings()
|
||||||
{
|
{
|
||||||
helpKeys = -1;
|
helpKeys = -1;
|
||||||
delete base;
|
free(base);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cMenuRecordings::SetHelpKeys(void)
|
void cMenuRecordings::SetHelpKeys(void)
|
||||||
@ -1417,7 +1415,7 @@ bool cMenuRecordings::Open(bool OpenSubMenus)
|
|||||||
t = buffer;
|
t = buffer;
|
||||||
}
|
}
|
||||||
AddSubMenu(new cMenuRecordings(t, level + 1, OpenSubMenus));
|
AddSubMenu(new cMenuRecordings(t, level + 1, OpenSubMenus));
|
||||||
delete buffer;
|
free(buffer);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -1766,7 +1764,7 @@ cMenuSetupPlugins::cMenuSetupPlugins(void)
|
|||||||
char *buffer = NULL;
|
char *buffer = NULL;
|
||||||
asprintf(&buffer, "%s (%s) - %s", p->Name(), p->Version(), p->Description());
|
asprintf(&buffer, "%s (%s) - %s", p->Name(), p->Version(), p->Description());
|
||||||
Add(new cMenuSetupPluginItem(hk(buffer), i));
|
Add(new cMenuSetupPluginItem(hk(buffer), i));
|
||||||
delete buffer;
|
free(buffer);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
@ -1901,7 +1899,7 @@ eOSState cMenuCommands::Execute(void)
|
|||||||
asprintf(&buffer, "%s...", command->Title());
|
asprintf(&buffer, "%s...", command->Title());
|
||||||
Interface->Status(buffer);
|
Interface->Status(buffer);
|
||||||
Interface->Flush();
|
Interface->Flush();
|
||||||
delete buffer;
|
free(buffer);
|
||||||
const char *Result = command->Execute();
|
const char *Result = command->Execute();
|
||||||
if (Result)
|
if (Result)
|
||||||
return AddSubMenu(new cMenuText(command->Title(), Result, fontFix));
|
return AddSubMenu(new cMenuText(command->Title(), Result, fontFix));
|
||||||
@ -2013,7 +2011,7 @@ void cMenuMain::Set(void)
|
|||||||
char *buffer = NULL;
|
char *buffer = NULL;
|
||||||
asprintf(&buffer, "%s%s", STOP_RECORDING, ON_PRIMARY_INTERFACE);
|
asprintf(&buffer, "%s%s", STOP_RECORDING, ON_PRIMARY_INTERFACE);
|
||||||
Add(new cOsdItem(buffer, osStopRecord));
|
Add(new cOsdItem(buffer, osStopRecord));
|
||||||
delete buffer;
|
free(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *s = NULL;
|
const char *s = NULL;
|
||||||
@ -2021,7 +2019,7 @@ void cMenuMain::Set(void)
|
|||||||
char *buffer = NULL;
|
char *buffer = NULL;
|
||||||
asprintf(&buffer, "%s%s", STOP_RECORDING, s);
|
asprintf(&buffer, "%s%s", STOP_RECORDING, s);
|
||||||
Add(new cOsdItem(buffer, osStopRecord));
|
Add(new cOsdItem(buffer, osStopRecord));
|
||||||
delete buffer;
|
free(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Editing control:
|
// Editing control:
|
||||||
@ -2452,8 +2450,8 @@ cRecordControl::cRecordControl(cDevice *Device, cTimer *Timer)
|
|||||||
cRecordControl::~cRecordControl()
|
cRecordControl::~cRecordControl()
|
||||||
{
|
{
|
||||||
Stop(true);
|
Stop(true);
|
||||||
delete instantId;
|
free(instantId);
|
||||||
delete fileName;
|
free(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define INSTANT_REC_EPG_LOOKAHEAD 300 // seconds to look into the EPG data for an instant recording
|
#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)
|
void cReplayControl::SetRecording(const char *FileName, const char *Title)
|
||||||
{
|
{
|
||||||
delete fileName;
|
free(fileName);
|
||||||
delete title;
|
free(title);
|
||||||
fileName = FileName ? strdup(FileName) : NULL;
|
fileName = FileName ? strdup(FileName) : NULL;
|
||||||
title = Title ? strdup(Title) : NULL;
|
title = Title ? strdup(Title) : NULL;
|
||||||
}
|
}
|
||||||
@ -2715,7 +2713,7 @@ const char *cReplayControl::LastReplayed(void)
|
|||||||
void cReplayControl::ClearLastReplayed(const char *FileName)
|
void cReplayControl::ClearLastReplayed(const char *FileName)
|
||||||
{
|
{
|
||||||
if (fileName && FileName && strcmp(fileName, FileName) == 0) {
|
if (fileName && FileName && strcmp(fileName, FileName) == 0) {
|
||||||
delete fileName;
|
free(fileName);
|
||||||
fileName = NULL;
|
fileName = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
16
menuitems.c
16
menuitems.c
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* 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"
|
#include "menuitems.h"
|
||||||
@ -13,6 +13,8 @@
|
|||||||
#include "plugin.h"
|
#include "plugin.h"
|
||||||
#include "status.h"
|
#include "status.h"
|
||||||
|
|
||||||
|
const char *FileNameChars = " abcdefghijklmnopqrstuvwxyz0123456789-.#~";
|
||||||
|
|
||||||
// --- cMenuEditItem ---------------------------------------------------------
|
// --- cMenuEditItem ---------------------------------------------------------
|
||||||
|
|
||||||
cMenuEditItem::cMenuEditItem(const char *Name)
|
cMenuEditItem::cMenuEditItem(const char *Name)
|
||||||
@ -23,13 +25,13 @@ cMenuEditItem::cMenuEditItem(const char *Name)
|
|||||||
|
|
||||||
cMenuEditItem::~cMenuEditItem()
|
cMenuEditItem::~cMenuEditItem()
|
||||||
{
|
{
|
||||||
delete name;
|
free(name);
|
||||||
delete value;
|
free(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cMenuEditItem::SetValue(const char *Value)
|
void cMenuEditItem::SetValue(const char *Value)
|
||||||
{
|
{
|
||||||
delete value;
|
free(value);
|
||||||
value = strdup(Value);
|
value = strdup(Value);
|
||||||
char *buffer = NULL;
|
char *buffer = NULL;
|
||||||
asprintf(&buffer, "%s:\t%s", name, value);
|
asprintf(&buffer, "%s:\t%s", name, value);
|
||||||
@ -119,7 +121,7 @@ cMenuEditChrItem::cMenuEditChrItem(const char *Name, char *Value, const char *Al
|
|||||||
|
|
||||||
cMenuEditChrItem::~cMenuEditChrItem()
|
cMenuEditChrItem::~cMenuEditChrItem()
|
||||||
{
|
{
|
||||||
delete allowed;
|
free(allowed);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cMenuEditChrItem::Set(void)
|
void cMenuEditChrItem::Set(void)
|
||||||
@ -167,7 +169,7 @@ cMenuEditStrItem::cMenuEditStrItem(const char *Name, char *Value, int Length, co
|
|||||||
|
|
||||||
cMenuEditStrItem::~cMenuEditStrItem()
|
cMenuEditStrItem::~cMenuEditStrItem()
|
||||||
{
|
{
|
||||||
delete allowed;
|
free(allowed);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cMenuEditStrItem::SetHelpKeys(void)
|
void cMenuEditStrItem::SetHelpKeys(void)
|
||||||
@ -364,7 +366,7 @@ cMenuTextItem::cMenuTextItem(const char *Text, int X, int Y, int W, int H, eDvbC
|
|||||||
|
|
||||||
cMenuTextItem::~cMenuTextItem()
|
cMenuTextItem::~cMenuTextItem()
|
||||||
{
|
{
|
||||||
delete text;
|
free(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cMenuTextItem::Clear(void)
|
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
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* 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
|
#ifndef __MENUITEMS_H
|
||||||
@ -12,10 +12,12 @@
|
|||||||
|
|
||||||
#include "osd.h"
|
#include "osd.h"
|
||||||
|
|
||||||
|
extern const char *FileNameChars;
|
||||||
|
|
||||||
class cMenuEditItem : public cOsdItem {
|
class cMenuEditItem : public cOsdItem {
|
||||||
private:
|
private:
|
||||||
const char *name;
|
char *name;
|
||||||
const char *value;
|
char *value;
|
||||||
public:
|
public:
|
||||||
cMenuEditItem(const char *Name);
|
cMenuEditItem(const char *Name);
|
||||||
~cMenuEditItem();
|
~cMenuEditItem();
|
||||||
@ -43,7 +45,7 @@ public:
|
|||||||
class cMenuEditChrItem : public cMenuEditItem {
|
class cMenuEditChrItem : public cMenuEditItem {
|
||||||
private:
|
private:
|
||||||
char *value;
|
char *value;
|
||||||
const char *allowed;
|
char *allowed;
|
||||||
const char *current;
|
const char *current;
|
||||||
virtual void Set(void);
|
virtual void Set(void);
|
||||||
public:
|
public:
|
||||||
@ -56,7 +58,7 @@ class cMenuEditStrItem : public cMenuEditItem {
|
|||||||
private:
|
private:
|
||||||
char *value;
|
char *value;
|
||||||
int length;
|
int length;
|
||||||
const char *allowed;
|
char *allowed;
|
||||||
int pos;
|
int pos;
|
||||||
bool insert, newchar, uppercase;
|
bool insert, newchar, uppercase;
|
||||||
void SetHelpKeys(void);
|
void SetHelpKeys(void);
|
||||||
|
18
osd.c
18
osd.c
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* 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"
|
#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, lineHeight, w, lineHeight, 2, false);
|
||||||
osd->Create(0, 2 * lineHeight, w, lineHeight, 1);
|
osd->Create(0, 2 * lineHeight, w, lineHeight, 1);
|
||||||
XXX*///XXX some pixels are not drawn correctly with lower bpp values
|
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
|
#endif
|
||||||
}
|
}
|
||||||
@ -279,13 +279,13 @@ cOsdItem::cOsdItem(const char *Text, eOSState State)
|
|||||||
|
|
||||||
cOsdItem::~cOsdItem()
|
cOsdItem::~cOsdItem()
|
||||||
{
|
{
|
||||||
delete text;
|
free(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cOsdItem::SetText(const char *Text, bool Copy)
|
void cOsdItem::SetText(const char *Text, bool Copy)
|
||||||
{
|
{
|
||||||
delete text;
|
free(text);
|
||||||
text = Copy ? strdup(Text) : Text;
|
text = Copy ? strdup(Text) : (char *)Text; // text assumes ownership!
|
||||||
}
|
}
|
||||||
|
|
||||||
void cOsdItem::SetColor(eDvbColor FgColor, eDvbColor BgColor)
|
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()
|
cOsdMenu::~cOsdMenu()
|
||||||
{
|
{
|
||||||
delete title;
|
free(title);
|
||||||
delete subMenu;
|
delete subMenu;
|
||||||
delete status;
|
free(status);
|
||||||
Interface->Clear();
|
Interface->Clear();
|
||||||
Interface->Close();
|
Interface->Close();
|
||||||
}
|
}
|
||||||
@ -367,7 +367,7 @@ void cOsdMenu::SetHasHotkeys(void)
|
|||||||
|
|
||||||
void cOsdMenu::SetStatus(const char *s)
|
void cOsdMenu::SetStatus(const char *s)
|
||||||
{
|
{
|
||||||
delete status;
|
free(status);
|
||||||
status = s ? strdup(s) : NULL;
|
status = s ? strdup(s) : NULL;
|
||||||
if (visible)
|
if (visible)
|
||||||
Interface->Status(status);
|
Interface->Status(status);
|
||||||
@ -375,7 +375,7 @@ void cOsdMenu::SetStatus(const char *s)
|
|||||||
|
|
||||||
void cOsdMenu::SetTitle(const char *Title, bool ShowDate)
|
void cOsdMenu::SetTitle(const char *Title, bool ShowDate)
|
||||||
{
|
{
|
||||||
delete title;
|
free(title);
|
||||||
if (ShowDate)
|
if (ShowDate)
|
||||||
asprintf(&title, "%s\t%s", Title, DayDateTime(time(NULL)));
|
asprintf(&title, "%s\t%s", Title, DayDateTime(time(NULL)));
|
||||||
else
|
else
|
||||||
|
6
osd.h
6
osd.h
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* 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
|
#ifndef __OSD_H
|
||||||
@ -89,7 +89,7 @@ public:
|
|||||||
|
|
||||||
class cOsdItem : public cListObject {
|
class cOsdItem : public cListObject {
|
||||||
private:
|
private:
|
||||||
const char *text;
|
char *text;
|
||||||
int offset;
|
int offset;
|
||||||
eOSState state;
|
eOSState state;
|
||||||
protected:
|
protected:
|
||||||
@ -128,7 +128,7 @@ private:
|
|||||||
int first, current, marked;
|
int first, current, marked;
|
||||||
cOsdMenu *subMenu;
|
cOsdMenu *subMenu;
|
||||||
const char *helpRed, *helpGreen, *helpYellow, *helpBlue;
|
const char *helpRed, *helpGreen, *helpYellow, *helpBlue;
|
||||||
const char *status;
|
char *status;
|
||||||
int digit;
|
int digit;
|
||||||
bool hasHotkeys;
|
bool hasHotkeys;
|
||||||
protected:
|
protected:
|
||||||
|
@ -4,11 +4,12 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* 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 "osdbase.h"
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/unistd.h>
|
#include <sys/unistd.h>
|
||||||
@ -109,7 +110,7 @@ cBitmap::cBitmap(int Width, int Height, int Bpp, bool ClearWithBackground)
|
|||||||
fontType = fontOsd;
|
fontType = fontOsd;
|
||||||
font = NULL;
|
font = NULL;
|
||||||
if (width > 0 && height > 0) {
|
if (width > 0 && height > 0) {
|
||||||
bitmap = new char[width * height];
|
bitmap = MALLOC(char, width * height);
|
||||||
if (bitmap) {
|
if (bitmap) {
|
||||||
Clean();
|
Clean();
|
||||||
memset(bitmap, 0x00, width * height);
|
memset(bitmap, 0x00, width * height);
|
||||||
@ -125,7 +126,7 @@ cBitmap::cBitmap(int Width, int Height, int Bpp, bool ClearWithBackground)
|
|||||||
cBitmap::~cBitmap()
|
cBitmap::~cBitmap()
|
||||||
{
|
{
|
||||||
delete font;
|
delete font;
|
||||||
delete bitmap;
|
free(bitmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
eDvbFont cBitmap::SetFont(eDvbFont Font)
|
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
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* 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"
|
#include "player.h"
|
||||||
@ -12,10 +12,10 @@
|
|||||||
|
|
||||||
// --- cPlayer ---------------------------------------------------------------
|
// --- cPlayer ---------------------------------------------------------------
|
||||||
|
|
||||||
cPlayer::cPlayer(void)
|
cPlayer::cPlayer(ePlayMode PlayMode)
|
||||||
{
|
{
|
||||||
device = NULL;
|
device = NULL;
|
||||||
deviceFileHandle = -1;
|
playMode = PlayMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
cPlayer::~cPlayer()
|
cPlayer::~cPlayer()
|
||||||
|
20
player.h
20
player.h
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* 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
|
#ifndef __PLAYER_H
|
||||||
@ -17,9 +17,9 @@ class cPlayer {
|
|||||||
friend class cDevice;
|
friend class cDevice;
|
||||||
private:
|
private:
|
||||||
cDevice *device;
|
cDevice *device;
|
||||||
int deviceFileHandle;
|
ePlayMode playMode;
|
||||||
protected:
|
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 DeviceTrickSpeed(int Speed) { if (device) device->TrickSpeed(Speed); }
|
||||||
void DeviceClear(void) { if (device) device->Clear(); }
|
void DeviceClear(void) { if (device) device->Clear(); }
|
||||||
void DevicePlay(void) { if (device) device->Play(); }
|
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 DeviceStillPicture(const uchar *Data, int Length) { if (device) device->StillPicture(Data, Length); }
|
||||||
void Detach(void);
|
void Detach(void);
|
||||||
virtual void Activate(bool On) {}
|
virtual void Activate(bool On) {}
|
||||||
// This function is called right after the cPlayer has been attached to
|
// This function is called right after the cPlayer has been attached to
|
||||||
// (On == true) or before it gets detached from (On == false) a cDevice.
|
// (On == true) or before it gets detached from (On == false) a cDevice.
|
||||||
// It can be used to do things like starting/stopping a thread.
|
// It can be used to do things like starting/stopping a thread.
|
||||||
int PlayVideo(const uchar *Data, int Length);
|
int PlayVideo(const uchar *Data, int Length);
|
||||||
// Sends the given Data to the video device and returns the number of
|
// 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
|
// bytes that have actually been accepted by the video device (or a
|
||||||
// negative value in case of an error).
|
// negative value in case of an error).
|
||||||
int PlayAudio(const uchar *Data, int Length);
|
int PlayAudio(const uchar *Data, int Length);
|
||||||
// XXX+ TODO
|
// XXX+ TODO
|
||||||
public:
|
public:
|
||||||
cPlayer(void);
|
cPlayer(ePlayMode PlayMode = pmAudioVideo);
|
||||||
virtual ~cPlayer();
|
virtual ~cPlayer();
|
||||||
bool IsAttached(void) { return device != NULL; }
|
bool IsAttached(void) { return device != NULL; }
|
||||||
virtual bool GetIndex(int &Current, int &Total, bool SnapToIFrame = false) { return false; }
|
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
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* 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 "plugin.h"
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
@ -101,7 +102,7 @@ void cPlugin::SetConfigDirectory(const char *Dir)
|
|||||||
const char *cPlugin::ConfigDirectory(const char *PluginName)
|
const char *cPlugin::ConfigDirectory(const char *PluginName)
|
||||||
{
|
{
|
||||||
static char *buffer = NULL;
|
static char *buffer = NULL;
|
||||||
delete buffer;
|
free(buffer);
|
||||||
asprintf(&buffer, "%s/plugins%s%s", configDirectory, PluginName ? "/" : "", PluginName ? PluginName : "");
|
asprintf(&buffer, "%s/plugins%s%s", configDirectory, PluginName ? "/" : "", PluginName ? PluginName : "");
|
||||||
return MakeDirs(buffer, true) ? buffer : NULL;
|
return MakeDirs(buffer, true) ? buffer : NULL;
|
||||||
}
|
}
|
||||||
@ -121,8 +122,8 @@ cDll::~cDll()
|
|||||||
delete plugin;
|
delete plugin;
|
||||||
if (handle)
|
if (handle)
|
||||||
dlclose(handle);
|
dlclose(handle);
|
||||||
delete args;
|
free(args);
|
||||||
delete fileName;
|
free(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *SkipQuote(char *s)
|
static char *SkipQuote(char *s)
|
||||||
@ -236,14 +237,14 @@ cPluginManager::cPluginManager(const char *Directory)
|
|||||||
cPluginManager::~cPluginManager()
|
cPluginManager::~cPluginManager()
|
||||||
{
|
{
|
||||||
Shutdown();
|
Shutdown();
|
||||||
delete directory;
|
free(directory);
|
||||||
if (pluginManager == this)
|
if (pluginManager == this)
|
||||||
pluginManager = NULL;
|
pluginManager = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cPluginManager::SetDirectory(const char *Directory)
|
void cPluginManager::SetDirectory(const char *Directory)
|
||||||
{
|
{
|
||||||
delete directory;
|
free(directory);
|
||||||
directory = Directory ? strdup(Directory) : NULL;
|
directory = Directory ? strdup(Directory) : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -279,8 +280,8 @@ void cPluginManager::AddPlugin(const char *Args)
|
|||||||
char *buffer = NULL;
|
char *buffer = NULL;
|
||||||
asprintf(&buffer, "%s/%s%s%s%s", directory, LIBVDR_PREFIX, s, SO_INDICATOR, VDRVERSION);
|
asprintf(&buffer, "%s/%s%s%s%s", directory, LIBVDR_PREFIX, s, SO_INDICATOR, VDRVERSION);
|
||||||
dlls.Add(new cDll(buffer, Args));
|
dlls.Add(new cDll(buffer, Args));
|
||||||
delete buffer;
|
free(buffer);
|
||||||
delete s;
|
free(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cPluginManager::LoadPlugins(bool Log)
|
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
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* 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"
|
#include "recording.h"
|
||||||
@ -148,7 +148,7 @@ void AssertFreeDiskSpace(int Priority)
|
|||||||
|
|
||||||
cResumeFile::cResumeFile(const char *FileName)
|
cResumeFile::cResumeFile(const char *FileName)
|
||||||
{
|
{
|
||||||
fileName = new char[strlen(FileName) + strlen(RESUMEFILESUFFIX) + 1];
|
fileName = MALLOC(char, strlen(FileName) + strlen(RESUMEFILESUFFIX) + 1);
|
||||||
if (fileName) {
|
if (fileName) {
|
||||||
strcpy(fileName, FileName);
|
strcpy(fileName, FileName);
|
||||||
strcat(fileName, RESUMEFILESUFFIX);
|
strcat(fileName, RESUMEFILESUFFIX);
|
||||||
@ -159,7 +159,7 @@ cResumeFile::cResumeFile(const char *FileName)
|
|||||||
|
|
||||||
cResumeFile::~cResumeFile()
|
cResumeFile::~cResumeFile()
|
||||||
{
|
{
|
||||||
delete fileName;
|
free(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
int cResumeFile::Read(void)
|
int cResumeFile::Read(void)
|
||||||
@ -375,7 +375,7 @@ cRecording::cRecording(const char *FileName)
|
|||||||
struct stat buf;
|
struct stat buf;
|
||||||
if (fstat(f, &buf) == 0) {
|
if (fstat(f, &buf) == 0) {
|
||||||
int size = buf.st_size;
|
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) {
|
if (summary) {
|
||||||
int rbytes = safe_read(f, summary, size);
|
int rbytes = safe_read(f, summary, size);
|
||||||
if (rbytes >= 0) {
|
if (rbytes >= 0) {
|
||||||
@ -385,7 +385,7 @@ cRecording::cRecording(const char *FileName)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
LOG_ERROR_STR(SummaryFileName);
|
LOG_ERROR_STR(SummaryFileName);
|
||||||
delete summary;
|
free(summary);
|
||||||
summary = NULL;
|
summary = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -399,17 +399,17 @@ cRecording::cRecording(const char *FileName)
|
|||||||
}
|
}
|
||||||
else if (errno != ENOENT)
|
else if (errno != ENOENT)
|
||||||
LOG_ERROR_STR(SummaryFileName);
|
LOG_ERROR_STR(SummaryFileName);
|
||||||
delete SummaryFileName;
|
free(SummaryFileName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cRecording::~cRecording()
|
cRecording::~cRecording()
|
||||||
{
|
{
|
||||||
delete titleBuffer;
|
free(titleBuffer);
|
||||||
delete sortBuffer;
|
free(sortBuffer);
|
||||||
delete fileName;
|
free(fileName);
|
||||||
delete name;
|
free(name);
|
||||||
delete summary;
|
free(summary);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *cRecording::StripEpisodeName(char *s)
|
char *cRecording::StripEpisodeName(char *s)
|
||||||
@ -437,9 +437,9 @@ char *cRecording::SortName(void)
|
|||||||
if (!sortBuffer) {
|
if (!sortBuffer) {
|
||||||
char *s = StripEpisodeName(strdup(FileName() + strlen(VideoDirectory) + 1));
|
char *s = StripEpisodeName(strdup(FileName() + strlen(VideoDirectory) + 1));
|
||||||
int l = strxfrm(NULL, s, 0);
|
int l = strxfrm(NULL, s, 0);
|
||||||
sortBuffer = new char[l];
|
sortBuffer = MALLOC(char, l);
|
||||||
strxfrm(sortBuffer, s, l);
|
strxfrm(sortBuffer, s, l);
|
||||||
delete s;
|
free(s);
|
||||||
}
|
}
|
||||||
return sortBuffer;
|
return sortBuffer;
|
||||||
}
|
}
|
||||||
@ -474,7 +474,7 @@ const char *cRecording::FileName(void)
|
|||||||
const char *cRecording::Title(char Delimiter, bool NewIndicator, int Level)
|
const char *cRecording::Title(char Delimiter, bool NewIndicator, int Level)
|
||||||
{
|
{
|
||||||
char New = NewIndicator && IsNew() ? '*' : ' ';
|
char New = NewIndicator && IsNew() ? '*' : ' ';
|
||||||
delete titleBuffer;
|
free(titleBuffer);
|
||||||
titleBuffer = NULL;
|
titleBuffer = NULL;
|
||||||
if (Level < 0 || Level == HierarchyLevels()) {
|
if (Level < 0 || Level == HierarchyLevels()) {
|
||||||
struct tm tm_r;
|
struct tm tm_r;
|
||||||
@ -524,7 +524,7 @@ const char *cRecording::PrefixFileName(char Prefix)
|
|||||||
{
|
{
|
||||||
const char *p = PrefixVideoFileName(FileName(), Prefix);
|
const char *p = PrefixVideoFileName(FileName(), Prefix);
|
||||||
if (p) {
|
if (p) {
|
||||||
delete fileName;
|
free(fileName);
|
||||||
fileName = strdup(p);
|
fileName = strdup(p);
|
||||||
return fileName;
|
return fileName;
|
||||||
}
|
}
|
||||||
@ -555,7 +555,7 @@ bool cRecording::WriteSummary(void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
LOG_ERROR_STR(SummaryFileName);
|
LOG_ERROR_STR(SummaryFileName);
|
||||||
delete SummaryFileName;
|
free(SummaryFileName);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -575,7 +575,7 @@ bool cRecording::Delete(void)
|
|||||||
isyslog("deleting recording %s", FileName());
|
isyslog("deleting recording %s", FileName());
|
||||||
result = RenameVideoFile(FileName(), NewName);
|
result = RenameVideoFile(FileName(), NewName);
|
||||||
}
|
}
|
||||||
delete NewName;
|
free(NewName);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -614,7 +614,7 @@ bool cRecordings::Load(bool Deleted)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
Interface->Error("Error while opening pipe!");
|
Interface->Error("Error while opening pipe!");
|
||||||
delete cmd;
|
free(cmd);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -639,19 +639,19 @@ cMark::cMark(int Position, const char *Comment)
|
|||||||
|
|
||||||
cMark::~cMark()
|
cMark::~cMark()
|
||||||
{
|
{
|
||||||
delete comment;
|
free(comment);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *cMark::ToText(void)
|
const char *cMark::ToText(void)
|
||||||
{
|
{
|
||||||
delete buffer;
|
free(buffer);
|
||||||
asprintf(&buffer, "%s%s%s\n", IndexToHMSF(position, true), comment ? " " : "", comment ? comment : "");
|
asprintf(&buffer, "%s%s%s\n", IndexToHMSF(position, true), comment ? " " : "", comment ? comment : "");
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cMark::Parse(const char *s)
|
bool cMark::Parse(const char *s)
|
||||||
{
|
{
|
||||||
delete comment;
|
free(comment);
|
||||||
comment = NULL;
|
comment = NULL;
|
||||||
position = HMSFToIndex(s);
|
position = HMSFToIndex(s);
|
||||||
const char *p = strchr(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, "\"$"));
|
asprintf(&cmd, "%s %s \"%s\"", command, State, strescape(RecordingFileName, "\"$"));
|
||||||
isyslog("executing '%s'", cmd);
|
isyslog("executing '%s'", cmd);
|
||||||
SystemExec(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;
|
last = (buf.st_size + delta) / sizeof(tIndex) - 1;
|
||||||
if (!Record && last >= 0) {
|
if (!Record && last >= 0) {
|
||||||
size = last + 1;
|
size = last + 1;
|
||||||
index = new tIndex[size];
|
index = MALLOC(tIndex, size);
|
||||||
if (index) {
|
if (index) {
|
||||||
f = open(fileName, O_RDONLY);
|
f = open(fileName, O_RDONLY);
|
||||||
if (f >= 0) {
|
if (f >= 0) {
|
||||||
if ((int)safe_read(f, index, buf.st_size) != buf.st_size) {
|
if ((int)safe_read(f, index, buf.st_size) != buf.st_size) {
|
||||||
esyslog("ERROR: can't read from file '%s'", fileName);
|
esyslog("ERROR: can't read from file '%s'", fileName);
|
||||||
delete index;
|
free(index);
|
||||||
index = NULL;
|
index = NULL;
|
||||||
close(f);
|
close(f);
|
||||||
f = -1;
|
f = -1;
|
||||||
@ -828,8 +828,8 @@ cIndexFile::~cIndexFile()
|
|||||||
{
|
{
|
||||||
if (f >= 0)
|
if (f >= 0)
|
||||||
close(f);
|
close(f);
|
||||||
delete fileName;
|
free(fileName);
|
||||||
delete index;
|
free(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cIndexFile::CatchUp(int Index)
|
bool cIndexFile::CatchUp(int Index)
|
||||||
@ -852,7 +852,7 @@ bool cIndexFile::CatchUp(int Index)
|
|||||||
if (lseek(f, offset, SEEK_SET) == offset) {
|
if (lseek(f, offset, SEEK_SET) == offset) {
|
||||||
if (safe_read(f, &index[last + 1], delta) != delta) {
|
if (safe_read(f, &index[last + 1], delta) != delta) {
|
||||||
esyslog("ERROR: can't read from index");
|
esyslog("ERROR: can't read from index");
|
||||||
delete index;
|
free(index);
|
||||||
index = NULL;
|
index = NULL;
|
||||||
close(f);
|
close(f);
|
||||||
f = -1;
|
f = -1;
|
||||||
@ -999,7 +999,7 @@ cFileName::cFileName(const char *FileName, bool Record, bool Blocking)
|
|||||||
cFileName::~cFileName()
|
cFileName::~cFileName()
|
||||||
{
|
{
|
||||||
Close();
|
Close();
|
||||||
delete fileName;
|
free(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
int cFileName::Open(void)
|
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
|
* the Linux DVB driver's 'tuxplayer' example and were rewritten to suit
|
||||||
* VDR's needs.
|
* 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
|
/* The calling interface of the 'cRemux::Process()' function is defined
|
||||||
@ -66,6 +66,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "remux.h"
|
#include "remux.h"
|
||||||
|
#include <stdlib.h>
|
||||||
#include "thread.h"
|
#include "thread.h"
|
||||||
#include "tools.h"
|
#include "tools.h"
|
||||||
|
|
||||||
@ -153,7 +154,7 @@ cTS2PES::cTS2PES(uint8_t *ResultBuffer, int *ResultCount, int Size, uint8_t Audi
|
|||||||
size = Size;
|
size = Size;
|
||||||
audioCid = AudioCid;
|
audioCid = AudioCid;
|
||||||
|
|
||||||
if (!(buf = new uint8_t[size]))
|
if (!(buf = MALLOC(uint8_t, size)))
|
||||||
esyslog("Not enough memory for ts_transform");
|
esyslog("Not enough memory for ts_transform");
|
||||||
|
|
||||||
reset_ipack();
|
reset_ipack();
|
||||||
@ -161,7 +162,7 @@ cTS2PES::cTS2PES(uint8_t *ResultBuffer, int *ResultCount, int Size, uint8_t Audi
|
|||||||
|
|
||||||
cTS2PES::~cTS2PES()
|
cTS2PES::~cTS2PES()
|
||||||
{
|
{
|
||||||
delete buf;
|
free(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cTS2PES::Clear(void)
|
void cTS2PES::Clear(void)
|
||||||
@ -309,7 +310,7 @@ void cTS2PES::instant_repack(const uint8_t *Buf, int Count)
|
|||||||
if ((flag1 & 0xC0) == 0x80 )
|
if ((flag1 & 0xC0) == 0x80 )
|
||||||
mpeg = 2;
|
mpeg = 2;
|
||||||
else {
|
else {
|
||||||
esyslog("ERROR: can't record MPEG1!");
|
esyslog("ERROR: error in data stream!");
|
||||||
hlength = 0;
|
hlength = 0;
|
||||||
which = 0;
|
which = 0;
|
||||||
mpeg = 1;
|
mpeg = 1;
|
||||||
|
8
remux.h
8
remux.h
@ -4,14 +4,18 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* 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
|
#ifndef __REMUX_H
|
||||||
#define __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>
|
#include <ost/dmx.h>
|
||||||
|
#endif
|
||||||
#include "tools.h"
|
#include "tools.h"
|
||||||
|
|
||||||
// Picture types:
|
// Picture types:
|
||||||
|
11
svdrp.c
11
svdrp.c
@ -10,7 +10,7 @@
|
|||||||
* and interact with the Video Disk Recorder - or write a full featured
|
* and interact with the Video Disk Recorder - or write a full featured
|
||||||
* graphical interface that sits on top of an SVDRP connection.
|
* 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"
|
#include "svdrp.h"
|
||||||
@ -37,6 +37,7 @@ cSocket::cSocket(int Port, int Queue)
|
|||||||
{
|
{
|
||||||
port = Port;
|
port = Port;
|
||||||
sock = -1;
|
sock = -1;
|
||||||
|
queue = Queue;
|
||||||
}
|
}
|
||||||
|
|
||||||
cSocket::~cSocket()
|
cSocket::~cSocket()
|
||||||
@ -320,7 +321,7 @@ cSVDRP::cSVDRP(int Port)
|
|||||||
cSVDRP::~cSVDRP()
|
cSVDRP::~cSVDRP()
|
||||||
{
|
{
|
||||||
Close();
|
Close();
|
||||||
delete message;
|
free(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cSVDRP::Close(bool Timeout)
|
void cSVDRP::Close(bool Timeout)
|
||||||
@ -370,7 +371,7 @@ void cSVDRP::Reply(int Code, const char *fmt, ...)
|
|||||||
}
|
}
|
||||||
s = n ? n + 1 : NULL;
|
s = n ? n + 1 : NULL;
|
||||||
}
|
}
|
||||||
delete buffer;
|
free(buffer);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -685,7 +686,7 @@ void cSVDRP::CmdLSTR(const char *Option)
|
|||||||
if (recording->Summary()) {
|
if (recording->Summary()) {
|
||||||
char *summary = strdup(recording->Summary());
|
char *summary = strdup(recording->Summary());
|
||||||
Reply(250, "%s", strreplace(summary,'\n','|'));
|
Reply(250, "%s", strreplace(summary,'\n','|'));
|
||||||
delete summary;
|
free(summary);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Reply(550, "No summary availabe");
|
Reply(550, "No summary availabe");
|
||||||
@ -736,7 +737,7 @@ void cSVDRP::CmdLSTT(const char *Option)
|
|||||||
void cSVDRP::CmdMESG(const char *Option)
|
void cSVDRP::CmdMESG(const char *Option)
|
||||||
{
|
{
|
||||||
if (*Option) {
|
if (*Option) {
|
||||||
delete message;
|
free(message);
|
||||||
message = strdup(Option);
|
message = strdup(Option);
|
||||||
isyslog("SVDRP message: '%s'", message);
|
isyslog("SVDRP message: '%s'", message);
|
||||||
Reply(250, "Message stored");
|
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
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* 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 "thread.h"
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
|
#include <sys/time.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include "tools.h"
|
#include "tools.h"
|
||||||
@ -27,17 +28,43 @@ cCondVar::~cCondVar()
|
|||||||
pthread_cond_destroy(&cond);
|
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, int TimeoutMs)
|
||||||
bool cCondVar::TimedWait(cMutex &Mutex, unsigned long tmout)
|
|
||||||
{
|
{
|
||||||
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)
|
void cCondVar::Broadcast(void)
|
||||||
{
|
{
|
||||||
@ -344,7 +371,6 @@ int cPipe::Close(void)
|
|||||||
i--;
|
i--;
|
||||||
usleep(100000);
|
usleep(100000);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!i) {
|
if (!i) {
|
||||||
kill(pid, SIGKILL);
|
kill(pid, SIGKILL);
|
||||||
ret = -1;
|
ret = -1;
|
||||||
|
6
thread.h
6
thread.h
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* 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
|
#ifndef __THREAD_H
|
||||||
@ -22,8 +22,8 @@ private:
|
|||||||
public:
|
public:
|
||||||
cCondVar(void);
|
cCondVar(void);
|
||||||
~cCondVar();
|
~cCondVar();
|
||||||
bool Wait(cMutex &Mutex);
|
void Wait(cMutex &Mutex);
|
||||||
//bool TimedWait(cMutex &Mutex, unsigned long tmout);
|
bool TimedWait(cMutex &Mutex, int TimeoutMs);
|
||||||
void Broadcast(void);
|
void Broadcast(void);
|
||||||
//void Signal(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
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* 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"
|
#include "tools.h"
|
||||||
@ -80,7 +80,7 @@ char *strcpyrealloc(char *dest, const char *src)
|
|||||||
esyslog("ERROR: out of memory");
|
esyslog("ERROR: out of memory");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
delete dest;
|
free(dest);
|
||||||
dest = NULL;
|
dest = NULL;
|
||||||
}
|
}
|
||||||
return dest;
|
return dest;
|
||||||
@ -239,7 +239,7 @@ bool isnumber(const char *s)
|
|||||||
const char *AddDirectory(const char *DirName, const char *FileName)
|
const char *AddDirectory(const char *DirName, const char *FileName)
|
||||||
{
|
{
|
||||||
static char *buf = NULL;
|
static char *buf = NULL;
|
||||||
delete buf;
|
free(buf);
|
||||||
asprintf(&buf, "%s/%s", DirName && *DirName ? DirName : ".", FileName);
|
asprintf(&buf, "%s/%s", DirName && *DirName ? DirName : ".", FileName);
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
@ -303,7 +303,7 @@ bool MakeDirs(const char *FileName, bool IsDirectory)
|
|||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
delete s;
|
free(s);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -321,7 +321,7 @@ bool RemoveFileOrDir(const char *FileName, bool FollowSymlinks)
|
|||||||
asprintf(&buffer, "%s/%s", FileName, e->d_name);
|
asprintf(&buffer, "%s/%s", FileName, e->d_name);
|
||||||
if (FollowSymlinks) {
|
if (FollowSymlinks) {
|
||||||
int size = strlen(buffer) * 2; // should be large enough
|
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);
|
int n = readlink(buffer, l, size);
|
||||||
if (n < 0) {
|
if (n < 0) {
|
||||||
if (errno != EINVAL)
|
if (errno != EINVAL)
|
||||||
@ -335,12 +335,12 @@ bool RemoveFileOrDir(const char *FileName, bool FollowSymlinks)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
esyslog("ERROR: symlink name length (%d) exceeded anticipated buffer size (%d)", n, size);
|
esyslog("ERROR: symlink name length (%d) exceeded anticipated buffer size (%d)", n, size);
|
||||||
delete l;
|
free(l);
|
||||||
}
|
}
|
||||||
dsyslog("removing %s", buffer);
|
dsyslog("removing %s", buffer);
|
||||||
if (remove(buffer) < 0)
|
if (remove(buffer) < 0)
|
||||||
LOG_ERROR_STR(buffer);
|
LOG_ERROR_STR(buffer);
|
||||||
delete buffer;
|
free(buffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
closedir(d);
|
closedir(d);
|
||||||
@ -384,10 +384,10 @@ bool RemoveEmptyDirectories(const char *DirName, bool RemoveThis)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
LOG_ERROR_STR(buffer);
|
LOG_ERROR_STR(buffer);
|
||||||
delete buffer;
|
free(buffer);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
delete buffer;
|
free(buffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
closedir(d);
|
closedir(d);
|
||||||
@ -429,7 +429,7 @@ bool SpinUpDisk(const char *FileName)
|
|||||||
{
|
{
|
||||||
static char *buf = NULL;
|
static char *buf = NULL;
|
||||||
for (int n = 0; n < 10; n++) {
|
for (int n = 0; n < 10; n++) {
|
||||||
delete buf;
|
free(buf);
|
||||||
if (DirectoryOk(FileName))
|
if (DirectoryOk(FileName))
|
||||||
asprintf(&buf, "%s/vdr-%06d", *FileName ? FileName : ".", n);
|
asprintf(&buf, "%s/vdr-%06d", *FileName ? FileName : ".", n);
|
||||||
else
|
else
|
||||||
@ -482,6 +482,42 @@ const char *DayDateTime(time_t t)
|
|||||||
return buffer;
|
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 -----------------------------------------------------------------
|
// --- cFile -----------------------------------------------------------------
|
||||||
|
|
||||||
bool cFile::files[FD_SETSIZE] = { false };
|
bool cFile::files[FD_SETSIZE] = { false };
|
||||||
@ -594,7 +630,7 @@ cSafeFile::cSafeFile(const char *FileName)
|
|||||||
{
|
{
|
||||||
f = NULL;
|
f = NULL;
|
||||||
fileName = ReadLink(FileName);
|
fileName = ReadLink(FileName);
|
||||||
tempName = fileName ? new char[strlen(fileName) + 5] : NULL;
|
tempName = fileName ? MALLOC(char, strlen(fileName) + 5) : NULL;
|
||||||
if (tempName)
|
if (tempName)
|
||||||
strcat(strcpy(tempName, fileName), ".$$$");
|
strcat(strcpy(tempName, fileName), ".$$$");
|
||||||
}
|
}
|
||||||
@ -604,8 +640,8 @@ cSafeFile::~cSafeFile()
|
|||||||
if (f)
|
if (f)
|
||||||
fclose(f);
|
fclose(f);
|
||||||
unlink(tempName);
|
unlink(tempName);
|
||||||
delete fileName;
|
free(fileName);
|
||||||
delete tempName;
|
free(tempName);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cSafeFile::Open(void)
|
bool cSafeFile::Open(void)
|
||||||
@ -657,7 +693,7 @@ cLockFile::cLockFile(const char *Directory)
|
|||||||
cLockFile::~cLockFile()
|
cLockFile::~cLockFile()
|
||||||
{
|
{
|
||||||
Unlock();
|
Unlock();
|
||||||
delete fileName;
|
free(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cLockFile::Lock(int WaitSeconds)
|
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
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* 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
|
#ifndef __TOOLS_H
|
||||||
@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#include <poll.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <syslog.h>
|
#include <syslog.h>
|
||||||
@ -36,6 +37,8 @@ extern int SysLogLevel;
|
|||||||
|
|
||||||
#define MAXPARSEBUFFER KILOBYTE(10)
|
#define MAXPARSEBUFFER KILOBYTE(10)
|
||||||
|
|
||||||
|
#define MALLOC(type, size) (type *)malloc(sizeof(type) * (size))
|
||||||
|
|
||||||
#define DELETENULL(p) (delete (p), p = NULL)
|
#define DELETENULL(p) (delete (p), p = NULL)
|
||||||
|
|
||||||
#define CHECK(s) { if ((s) < 0) LOG_ERROR; } // used for 'ioctl()' calls
|
#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 *WeekDayName(int WeekDay); // returns a statically allocated string!
|
||||||
const char *DayDateTime(time_t t = 0); // 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 {
|
class cFile {
|
||||||
private:
|
private:
|
||||||
static bool files[];
|
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
|
* 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>
|
#include <getopt.h>
|
||||||
@ -327,8 +327,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
// DVB interfaces:
|
// DVB interfaces:
|
||||||
|
|
||||||
if (!cDvbDevice::Initialize())
|
cDvbDevice::Initialize();
|
||||||
return 2;
|
|
||||||
|
|
||||||
cSIProcessor::Read();
|
cSIProcessor::Read();
|
||||||
|
|
||||||
@ -340,6 +339,12 @@ int main(int argc, char *argv[])
|
|||||||
// Primary device:
|
// Primary device:
|
||||||
|
|
||||||
cDevice::SetPrimaryDevice(Setup.PrimaryDVB);
|
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:
|
// OSD:
|
||||||
|
|
||||||
@ -585,7 +590,7 @@ int main(int argc, char *argv[])
|
|||||||
asprintf(&buf, tr("Recording in %d minutes, shut down anyway?"), Delta / 60);
|
asprintf(&buf, tr("Recording in %d minutes, shut down anyway?"), Delta / 60);
|
||||||
if (Interface->Confirm(buf))
|
if (Interface->Confirm(buf))
|
||||||
ForceShutdown = true;
|
ForceShutdown = true;
|
||||||
delete buf;
|
free(buf);
|
||||||
}
|
}
|
||||||
if (!Next || Delta > Setup.MinEventTimeout * 60 || ForceShutdown) {
|
if (!Next || Delta > Setup.MinEventTimeout * 60 || ForceShutdown) {
|
||||||
ForceShutdown = false;
|
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);
|
asprintf(&cmd, "%s %ld %ld %d \"%s\" %d", Shutdown, Next, Delta, Channel, strescape(File, "\"$"), UserShutdown);
|
||||||
isyslog("executing '%s'", cmd);
|
isyslog("executing '%s'", cmd);
|
||||||
SystemExec(cmd);
|
SystemExec(cmd);
|
||||||
delete cmd;
|
free(cmd);
|
||||||
}
|
}
|
||||||
else if (WatchdogTimeout > 0) {
|
else if (WatchdogTimeout > 0) {
|
||||||
alarm(WatchdogTimeout);
|
alarm(WatchdogTimeout);
|
||||||
|
14
videodir.c
14
videodir.c
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* 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"
|
#include "videodir.h"
|
||||||
@ -48,9 +48,9 @@ cVideoDirectory::cVideoDirectory(void)
|
|||||||
|
|
||||||
cVideoDirectory::~cVideoDirectory()
|
cVideoDirectory::~cVideoDirectory()
|
||||||
{
|
{
|
||||||
delete name;
|
free(name);
|
||||||
delete stored;
|
free(stored);
|
||||||
delete adjusted;
|
free(adjusted);
|
||||||
}
|
}
|
||||||
|
|
||||||
int cVideoDirectory::FreeMB(int *UsedMB)
|
int cVideoDirectory::FreeMB(int *UsedMB)
|
||||||
@ -87,7 +87,7 @@ bool cVideoDirectory::Next(void)
|
|||||||
void cVideoDirectory::Store(void)
|
void cVideoDirectory::Store(void)
|
||||||
{
|
{
|
||||||
if (name) {
|
if (name) {
|
||||||
delete stored;
|
free(stored);
|
||||||
stored = strdup(name);
|
stored = strdup(name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -95,7 +95,7 @@ void cVideoDirectory::Store(void)
|
|||||||
const char *cVideoDirectory::Adjust(const char *FileName)
|
const char *cVideoDirectory::Adjust(const char *FileName)
|
||||||
{
|
{
|
||||||
if (stored) {
|
if (stored) {
|
||||||
delete adjusted;
|
free(adjusted);
|
||||||
adjusted = strdup(FileName);
|
adjusted = strdup(FileName);
|
||||||
return strncpy(adjusted, stored, length);
|
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);
|
int Result = open(ActualFileName, Flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
|
||||||
if (ActualFileName != FileName)
|
if (ActualFileName != FileName)
|
||||||
delete ActualFileName;
|
free((char *)ActualFileName);
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user