Added cDevice::Flush()

This commit is contained in:
Klaus Schmidinger 2004-06-19 08:58:14 +02:00
parent 480afc6bc8
commit b1737a8bcb
8 changed files with 36 additions and 8 deletions

View File

@ -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

View File

@ -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.

View File

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -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);

View File

@ -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

View File

@ -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(); }