diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2004-06-19 08:58:14 +0200 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2004-06-19 08:58:14 +0200 |
commit | b1737a8bcb3a259c9c57e76b818539191b96f045 (patch) | |
tree | 8a1274f7b89e37bf127a35af0bfbd0ec44afae5c | |
parent | 480afc6bc8636b10849a9e61b73151e81b794f93 (diff) | |
download | vdr-b1737a8bcb3a259c9c57e76b818539191b96f045.tar.gz vdr-b1737a8bcb3a259c9c57e76b818539191b96f045.tar.bz2 |
Added cDevice::Flush()
-rw-r--r-- | CONTRIBUTORS | 2 | ||||
-rw-r--r-- | HISTORY | 5 | ||||
-rw-r--r-- | device.c | 7 | ||||
-rw-r--r-- | device.h | 8 | ||||
-rw-r--r-- | dvbdevice.c | 8 | ||||
-rw-r--r-- | dvbdevice.h | 3 | ||||
-rw-r--r-- | dvbplayer.c | 8 | ||||
-rw-r--r-- | player.h | 3 |
8 files changed, 36 insertions, 8 deletions
diff --git a/CONTRIBUTORS b/CONTRIBUTORS index cf0a9c2d..a1e30c60 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -854,6 +854,8 @@ Reinhard Nissl <rnissl@gmx.de> when using other libraries that also implement a function by that name for reporting a bug in handling ':' characters in channel names when reading channels.conf + for adding cDevice::Flush() to make sure that all data in the video card's buffers + has been processed Richard Robson <richard_robson@beeb.net> for reporting freezing replay if a timer starts while in Transfer Mode from the @@ -2893,7 +2893,7 @@ Video Disk Recorder Revision History strings in order to avoid buffer overflows (thanks to Philip Lawatsch for debugging a buffer overflow in eit.c). -2004-06-18: Version 1.3.11 +2004-06-19: Version 1.3.11 - In order to avoid problems on NPTL systems, VDR now checks for the presence of NPTL at program start, and if it is, exists and tells the user to do @@ -2921,3 +2921,6 @@ Video Disk Recorder Revision History If some external tool manipulates the video directory, it can touch the file '.update' in the video directory to trigger an update of the list of recordings. - Fixed a memory leak in theme description handling (thanks to Sascha Volkenandt). +- Added cDevice::Flush() to make sure that all data in the video card's buffers + has been processed (thanks to Reinhard Nissl). Currently this is not yet actually + implemented for FF DVB cards. @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: device.c 1.55 2004/05/16 12:14:47 kls Exp $ + * $Id: device.c 1.56 2004/06/19 08:51:05 kls Exp $ */ #include "device.h" @@ -619,6 +619,11 @@ bool cDevice::Poll(cPoller &Poller, int TimeoutMs) return false; } +bool cDevice::Flush(int TimeoutMs) +{ + return true; +} + int cDevice::PlayVideo(const uchar *Data, int Length) { return -1; @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: device.h 1.43 2004/05/23 10:10:08 kls Exp $ + * $Id: device.h 1.44 2004/06/19 08:50:37 kls Exp $ */ #ifndef __DEVICE_H @@ -373,6 +373,12 @@ public: ///< 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 bool Flush(int TimeoutMs = 0); + ///< Returns true if the device's output buffers are empty, i. e. any + ///< data which was bufferd so far has been processed. + ///< If TimeoutMs is not zero, the device will wait up to the given + ///< number of milliseconds before returning in case there is still + ///< data in the buffers.. virtual int PlayVideo(const uchar *Data, int Length); ///< Actually plays the given data block as video. The data must be ///< part of a PES (Packetized Elementary Stream) which can contain diff --git a/dvbdevice.c b/dvbdevice.c index fae2408a..2f43bc8c 100644 --- a/dvbdevice.c +++ b/dvbdevice.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: dvbdevice.c 1.91 2004/06/12 14:50:23 kls Exp $ + * $Id: dvbdevice.c 1.92 2004/06/19 08:52:24 kls Exp $ */ #include "dvbdevice.h" @@ -1069,6 +1069,12 @@ bool cDvbDevice::Poll(cPoller &Poller, int TimeoutMs) return Poller.Poll(TimeoutMs); } +bool cDvbDevice::Flush(int TimeoutMs) +{ + //TODO actually this function should wait until all buffered data has been processed by the card, but how? + return true; +} + int cDvbDevice::PlayVideo(const uchar *Data, int Length) { int fd = (playMode == pmAudioOnly || playMode == pmAudioOnlyBlack) ? fd_audio : fd_video; diff --git a/dvbdevice.h b/dvbdevice.h index 2c5bd8eb..f7a4b925 100644 --- a/dvbdevice.h +++ b/dvbdevice.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: dvbdevice.h 1.27 2004/04/17 11:56:22 kls Exp $ + * $Id: dvbdevice.h 1.28 2004/06/19 08:51:33 kls Exp $ */ #ifndef __DVBDEVICE_H @@ -115,6 +115,7 @@ public: virtual void Mute(void); virtual void StillPicture(const uchar *Data, int Length); virtual bool Poll(cPoller &Poller, int TimeoutMs = 0); + virtual bool Flush(int TimeoutMs = 0); virtual int PlayVideo(const uchar *Data, int Length); virtual void PlayAudio(const uchar *Data, int Length); diff --git a/dvbplayer.c b/dvbplayer.c index c3bd542d..8b60c2e1 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 1.23 2003/10/18 11:31:54 kls Exp $ + * $Id: dvbplayer.c 1.24 2004/06/19 08:55:49 kls Exp $ */ #include "dvbplayer.h" @@ -418,7 +418,7 @@ void cDvbPlayer::Action(void) int AudioTrack = 0; // -1 = any, 0 = none, >0 = audioTrack running = true; - while (running && (NextFile() || readIndex >= 0 || ringBuffer->Available())) { + while (running && (NextFile() || readIndex >= 0 || ringBuffer->Available() || !DeviceFlush(100))) { cPoller Poller; if (DevicePoll(Poller, 100)) { @@ -438,6 +438,10 @@ void cDvbPlayer::Action(void) continue; } else { + // hit begin of recording: wait for device buffers to drain + // before changing play mode: + if (!DeviceFlush(100)) + continue; // 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 @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: player.h 1.11 2004/04/30 13:45:59 kls Exp $ + * $Id: player.h 1.12 2004/06/19 08:53:07 kls Exp $ */ #ifndef __PLAYER_H @@ -20,6 +20,7 @@ private: ePlayMode playMode; protected: bool DevicePoll(cPoller &Poller, int TimeoutMs = 0) { return device ? device->Poll(Poller, TimeoutMs) : false; } + bool DeviceFlush(int TimeoutMs = 0) { return device ? device->Flush(TimeoutMs) : true; } void DeviceTrickSpeed(int Speed) { if (device) device->TrickSpeed(Speed); } void DeviceClear(void) { if (device) device->Clear(); } void DevicePlay(void) { if (device) device->Play(); } |