summaryrefslogtreecommitdiff
path: root/dvbplayer.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <kls (at) cadsoft (dot) de>2009-06-14 13:49:00 +0200
committerKlaus Schmidinger <kls (at) cadsoft (dot) de>2009-06-14 13:49:00 +0200
commitab6f2ccf424896a80b6e2fdf9ab9313ea4b7f316 (patch)
treecd6cf2c6307c8a58f137e12286674cc8f1366dc5 /dvbplayer.c
parent991eda006700f1703bcec528c1ff178a4cab9048 (diff)
downloadvdr-patch-lnbsharing-ab6f2ccf424896a80b6e2fdf9ab9313ea4b7f316.tar.gz
vdr-patch-lnbsharing-ab6f2ccf424896a80b6e2fdf9ab9313ea4b7f316.tar.bz2
Version 1.7.8vdr-1.7.8
- The name of the function cDevice::GetVideoSize() wasn't very well chosen for its purpose of defining the optimum size of the OSD for the current output device. Therefore a new function named cDevice::GetOsdSize() has been introduced (suggested by Rolf Ahrenberg). Plugin authors should implement this function in classes derived from cDevice, if they are able to replay video. cDevice::GetVideoSize() still exists and should return the actual size of the video material that is currently replayed. Note that because of the many possible aspect ratios for video material, the type of the Aspect parameter of GetVideoSize() has been changed to 'double', and the Aspect parameter in both functions is named differently, because it returns different values (suggested by Reinhard Nissl). Thanks to Oliver Endriss for his input on calculating the Aspect factor in GetOsdSize(). - Fixed the way the OSD size is determined on full featured DVB cards (thanks to Oliver Endriss). - Increased MAXOSDHEIGHT to 1200 (suggested by Nicolas Huillard). - Removed limitation to PAL resolution from SPU handling. - Checking fd_video in cDvbDevice::GetVideoSize() to avoid error messages on systems with no real primary replay device (reported by Martin Neuditschko). - Added a note to cTsToPes::GetPes() about having to call it repeatedly, once it has returned a non-NULL value. - Added MPEG 1 handling to remux.c (thanks to Ales Jurik). - Fixed use of time_t in cEIT::cEIT() (thanks to Tobias Bratfisch). - Added missing update of lastOsdSizeUpdate. - EIT events are now only processed if a plausible system time is available, to avoid wrong handling of PDC descriptors (thanks to Tobias Bratfisch). - Removed unused 'synced' member from cTsToPes (reported by Christoph Haubrich). - Added a note to cTsToPes about all TS packets having to belong to the same PID, and that for video data GetPes() may only be called if the next TS packet that will be given to PutTs() has the "payload start" flag set (suggested by Christoph Haubrich). - Added a note about the meaning of PERCENTAGEDELTA in cRingBuffer::UpdatePercentage() (thanks to Rolf Ahrenberg). - The new setup option "Recording/Pause key handling" can be used to define what happens if the Pause key on the remote control is pressed during live tv (thanks to Timo Eskola). - Added a note about cFont::GetFont() not being thread-safe. - Fixed generating PAT/PMT version numbers in case the PIDs change during recording (reported by Reinhard Nissl). - Updated the Ukrainian OSD texts (thanks to Yarema Aka Knedlyk). - Fixed a memory leak when reaching the end of a recording during replay (reported by Reinhard Nissl). - Fixed calling close(-1) in cUnbufferedFile::Close() (reported by Reinhard Nissl). - Added a workaround for the broken linux-dvb driver header files (based on a patch from Tobias Grimm). - Fixed handling the length of DiSEqC command sequences (reported by Reinhard Nissl). - Fixed cOsdMenu::Display() in case the menu size has changed (thanks to Reinhard Nissl). - Added some missing 'const' keywords to avoid compilation errors with gcc 4.4 (thanks to Ville Skyttä and Ludwig Nussel). - Modified cSVDRP::CmdGRAB() to avoid writing into const data (reported by Ludwig Nussel). - Fixed calculating menu colum widths in case the font has a size other than the default size (reported by Reinhard Nissl). - Added a plausibility check for the OSD percentage parameters to avoid problems in case the values are stored in the setup.conf file in a wrong way. - Fixed variable types in cIndexFile (reported by Udo Richter).
Diffstat (limited to 'dvbplayer.c')
-rw-r--r--dvbplayer.c84
1 files changed, 43 insertions, 41 deletions
diff --git a/dvbplayer.c b/dvbplayer.c
index 219de49..9f96462 100644
--- a/dvbplayer.c
+++ b/dvbplayer.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: dvbplayer.c 2.15 2009/04/19 15:19:10 kls Exp $
+ * $Id: dvbplayer.c 2.17 2009/05/31 14:12:42 kls Exp $
*/
#include "dvbplayer.h"
@@ -89,7 +89,6 @@ private:
uchar *buffer;
int wanted;
int length;
- bool hasData;
cCondWait newSet;
cCondVar newDataCond;
cMutex newDataMutex;
@@ -99,7 +98,8 @@ public:
cNonBlockingFileReader(void);
~cNonBlockingFileReader();
void Clear(void);
- int Read(cUnbufferedFile *File, uchar *Buffer, int Length);
+ void Request(cUnbufferedFile *File, int Length);
+ int Result(uchar **Buffer);
bool Reading(void) { return buffer; }
bool WaitForDataMs(int msToWait);
};
@@ -110,7 +110,6 @@ cNonBlockingFileReader::cNonBlockingFileReader(void)
f = NULL;
buffer = NULL;
wanted = length = 0;
- hasData = false;
Start();
}
@@ -128,29 +127,27 @@ void cNonBlockingFileReader::Clear(void)
free(buffer);
buffer = NULL;
wanted = length = 0;
- hasData = false;
+ Unlock();
+}
+
+void cNonBlockingFileReader::Request(cUnbufferedFile *File, int Length)
+{
+ Lock();
+ Clear();
+ wanted = Length;
+ buffer = MALLOC(uchar, wanted);
+ f = File;
Unlock();
newSet.Signal();
}
-int cNonBlockingFileReader::Read(cUnbufferedFile *File, uchar *Buffer, int Length)
+int cNonBlockingFileReader::Result(uchar **Buffer)
{
- if (hasData && buffer) {
- if (buffer != Buffer) {
- esyslog("ERROR: cNonBlockingFileReader::Read() called with different buffer!");
- errno = EINVAL;
- return -1;
- }
+ LOCK_THREAD;
+ if (buffer && length == wanted) {
+ *Buffer = buffer;
buffer = NULL;
- return length;
- }
- if (!buffer) {
- f = File;
- buffer = Buffer;
- wanted = Length;
- length = 0;
- hasData = false;
- newSet.Signal();
+ return wanted;
}
errno = EAGAIN;
return -1;
@@ -160,20 +157,23 @@ void cNonBlockingFileReader::Action(void)
{
while (Running()) {
Lock();
- if (!hasData && f && buffer) {
+ if (f && buffer && length < wanted) {
int r = f->Read(buffer + length, wanted - length);
- if (r >= 0) {
+ if (r > 0)
length += r;
- if (!r || length == wanted) { // r == 0 means EOF
- cMutexLock NewDataLock(&newDataMutex);
- hasData = true;
- newDataCond.Broadcast();
- }
+ else if (r == 0) { // r == 0 means EOF
+ if (length > 0)
+ wanted = length; // already read something, so return the rest
+ else
+ length = wanted = 0; // report EOF
}
- else if (r < 0 && FATALERRNO) {
+ else if (FATALERRNO) {
LOG_ERROR;
- length = r; // this will forward the error status to the caller
- hasData = true;
+ length = wanted = r; // this will forward the error status to the caller
+ }
+ if (length == wanted) {
+ cMutexLock NewDataLock(&newDataMutex);
+ newDataCond.Broadcast();
}
}
Unlock();
@@ -184,7 +184,7 @@ void cNonBlockingFileReader::Action(void)
bool cNonBlockingFileReader::WaitForDataMs(int msToWait)
{
cMutexLock NewDataLock(&newDataMutex);
- if (hasData)
+ if (buffer && length == wanted)
return true;
return newDataCond.TimedWait(newDataMutex, msToWait);
}
@@ -381,7 +381,6 @@ void cDvbPlayer::Activate(bool On)
void cDvbPlayer::Action(void)
{
- uchar *b = NULL;
uchar *p = NULL;
int pc = 0;
@@ -461,10 +460,12 @@ void cDvbPlayer::Action(void)
esyslog("ERROR: frame larger than buffer (%d > %d)", Length, MAXFRAMESIZE);
Length = MAXFRAMESIZE;
}
- b = MALLOC(uchar, Length);
+ if (!eof)
+ nonBlockingFileReader->Request(replayFile, Length);
}
if (!eof) {
- int r = nonBlockingFileReader->Read(replayFile, b, Length);
+ uchar *b = NULL;
+ int r = nonBlockingFileReader->Result(&b);
if (r > 0) {
WaitingForData = false;
uint32_t Pts = 0;
@@ -473,15 +474,16 @@ void cDvbPlayer::Action(void)
LastReadIFrame = readIndex;
}
readFrame = new cFrame(b, -r, ftUnknown, readIndex, Pts); // hands over b to the ringBuffer
- b = NULL;
}
- else if (r == 0)
- eof = true;
else if (r < 0 && errno == EAGAIN)
WaitingForData = true;
- else if (r < 0 && FATALERRNO) {
- LOG_ERROR;
- break;
+ else {
+ if (r == 0)
+ eof = true;
+ else if (r < 0 && FATALERRNO) {
+ LOG_ERROR;
+ break;
+ }
}
}
}