Changed the interface of cStatus::Replaying()

This commit is contained in:
Klaus Schmidinger 2002-07-13 11:16:27 +02:00
parent d5208be84b
commit f2b637ed85
7 changed files with 38 additions and 18 deletions

View File

@ -1364,3 +1364,7 @@ Video Disk Recorder Revision History
- Added direct access to the index data of cPalette (needed for displaying SPUs, - Added direct access to the index data of cPalette (needed for displaying SPUs,
thanks to Andreas Schultz). thanks to Andreas Schultz).
- The status monitor function cStatus::Replaying() now gets a 'cControl *' argument instead
of a 'cDvbPlayerControl *' in order to allow additional players to call this function.
cPlayer and cControl have been given the functions GetIndex() and GetReplayMode() to
allow access to the player's status.

View File

@ -4,3 +4,7 @@ VDR Plugin 'status' Revision History
2002-05-18: Version 0.0.1 2002-05-18: Version 0.0.1
- Initial revision. - Initial revision.
2002-07-13: Version 0.0.2
- Changed the interface of cStatus::Replaying().

View File

@ -3,13 +3,13 @@
* *
* See the README file for copyright information and how to reach the author. * See the README file for copyright information and how to reach the author.
* *
* $Id: status.c 1.1 2002/06/16 13:26:00 kls Exp $ * $Id: status.c 1.2 2002/07/13 10:55:55 kls Exp $
*/ */
#include <vdr/plugin.h> #include <vdr/plugin.h>
#include <vdr/status.h> #include <vdr/status.h>
static const char *VERSION = "0.0.1"; static const char *VERSION = "0.0.2";
static const char *DESCRIPTION = "Status monitor test"; static const char *DESCRIPTION = "Status monitor test";
static const char *MAINMENUENTRY = NULL; static const char *MAINMENUENTRY = NULL;
@ -19,7 +19,7 @@ class cStatusTest : public cStatus {
protected: protected:
virtual void ChannelSwitch(const cDevice *Device, int ChannelNumber); virtual void ChannelSwitch(const cDevice *Device, int ChannelNumber);
virtual void Recording(const cDevice *Device, const char *Name); virtual void Recording(const cDevice *Device, const char *Name);
virtual void Replaying(const cDvbPlayerControl *DvbPlayerControl, const char *Name); virtual void Replaying(const cControl *Control, const char *Name);
virtual void SetVolume(int Volume, bool Absolute); virtual void SetVolume(int Volume, bool Absolute);
virtual void OsdClear(void); virtual void OsdClear(void);
virtual void OsdTitle(const char *Title); virtual void OsdTitle(const char *Title);
@ -41,7 +41,7 @@ void cStatusTest::Recording(const cDevice *Device, const char *Name)
dsyslog("status: cStatusTest::Recording %d %s", Device->CardIndex(), Name); dsyslog("status: cStatusTest::Recording %d %s", Device->CardIndex(), Name);
} }
void cStatusTest::Replaying(const cDvbPlayerControl *DvbPlayerControl, const char *Name) void cStatusTest::Replaying(const cControl *Control, const char *Name)
{ {
dsyslog("status: cStatusTest::Replaying %s", Name); dsyslog("status: cStatusTest::Replaying %s", Name);
} }

View File

@ -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: dvbplayer.c 1.4 2002/06/23 10:52:51 kls Exp $ * $Id: dvbplayer.c 1.5 2002/07/13 11:11:08 kls Exp $
*/ */
#include "dvbplayer.h" #include "dvbplayer.h"
@ -116,8 +116,8 @@ public:
int SkipFrames(int Frames); int SkipFrames(int Frames);
void SkipSeconds(int Seconds); void SkipSeconds(int Seconds);
void Goto(int Position, bool Still = false); void Goto(int Position, bool Still = false);
void GetIndex(int &Current, int &Total, bool SnapToIFrame = false); virtual bool GetIndex(int &Current, int &Total, bool SnapToIFrame = false);
bool GetReplayMode(bool &Play, bool &Forward, int &Speed); virtual bool GetReplayMode(bool &Play, bool &Forward, int &Speed);
}; };
#define MAX_VIDEO_SLOWMOTION 63 // max. arg to pass to VIDEO_SLOWMOTION // TODO is this value correct? #define MAX_VIDEO_SLOWMOTION 63 // max. arg to pass to VIDEO_SLOWMOTION // TODO is this value correct?
@ -593,7 +593,7 @@ void cDvbPlayer::Goto(int Index, bool Still)
} }
} }
void cDvbPlayer::GetIndex(int &Current, int &Total, bool SnapToIFrame) bool cDvbPlayer::GetIndex(int &Current, int &Total, bool SnapToIFrame)
{ {
if (index) { if (index) {
if (playMode == pmStill) if (playMode == pmStill)
@ -607,9 +607,10 @@ void cDvbPlayer::GetIndex(int &Current, int &Total, bool SnapToIFrame)
} }
} }
Total = index->Last(); Total = index->Last();
return true;
} }
else Current = Total = -1;
Current = Total = -1; return false;
} }
bool cDvbPlayer::GetReplayMode(bool &Play, bool &Forward, int &Speed) bool cDvbPlayer::GetReplayMode(bool &Play, bool &Forward, int &Speed)

View File

@ -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.4 2002/06/23 12:56:38 kls Exp $ * $Id: player.h 1.5 2002/07/13 11:12:26 kls Exp $
*/ */
#ifndef __PLAYER_H #ifndef __PLAYER_H
@ -41,6 +41,15 @@ public:
cPlayer(void); cPlayer(void);
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; }
// Returns the current and total frame index, optionally snapped to the
// nearest I-frame.
virtual bool GetReplayMode(bool &Play, bool &Forward, int &Speed) { return false; }
// Returns the current replay mode (if applicable).
// 'Play' tells whether we are playing or pausing, 'Forward' tells whether
// we are going forward or backward and 'Speed' is -1 if this is normal
// play/pause mode, 0 if it is single speed fast/slow forward/back mode
// and >0 if this is multi speed mode.
}; };
class cControl : public cOsdObject { class cControl : public cOsdObject {
@ -54,6 +63,8 @@ public:
cControl(cPlayer *Player, bool Hidden = false); cControl(cPlayer *Player, bool Hidden = false);
virtual ~cControl(); virtual ~cControl();
virtual void Hide(void) = 0; virtual void Hide(void) = 0;
bool GetIndex(int &Current, int &Total, bool SnapToIFrame = false) { return player->GetIndex(Current, Total, SnapToIFrame); }
bool GetReplayMode(bool &Play, bool &Forward, int &Speed) { return player->GetReplayMode(Play, Forward, Speed); }
static void Launch(cControl *Control); static void Launch(cControl *Control);
static void Attach(void); static void Attach(void);
static void Shutdown(void); static void Shutdown(void);

View File

@ -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: status.c 1.3 2002/06/16 13:24:36 kls Exp $ * $Id: status.c 1.4 2002/07/13 10:49:34 kls Exp $
*/ */
#include "status.h" #include "status.h"
@ -35,10 +35,10 @@ void cStatus::MsgRecording(const cDevice *Device, const char *Name)
sm->Recording(Device, Name); sm->Recording(Device, Name);
} }
void cStatus::MsgReplaying(const cDvbPlayerControl *DvbPlayerControl, const char *Name) void cStatus::MsgReplaying(const cControl *Control, const char *Name)
{ {
for (cStatus *sm = statusMonitors.First(); sm; sm = statusMonitors.Next(sm)) for (cStatus *sm = statusMonitors.First(); sm; sm = statusMonitors.Next(sm))
sm->Replaying(DvbPlayerControl, Name); sm->Replaying(Control, Name);
} }
void cStatus::MsgSetVolume(int Volume, bool Absolute) void cStatus::MsgSetVolume(int Volume, bool Absolute)

View File

@ -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: status.h 1.3 2002/06/16 13:24:50 kls Exp $ * $Id: status.h 1.4 2002/07/13 10:48:50 kls Exp $
*/ */
#ifndef __STATUS_H #ifndef __STATUS_H
@ -12,7 +12,7 @@
#include "config.h" #include "config.h"
#include "device.h" #include "device.h"
#include "dvbplayer.h" #include "player.h"
#include "tools.h" #include "tools.h"
class cStatus : public cListObject { class cStatus : public cListObject {
@ -27,7 +27,7 @@ protected:
virtual void Recording(const cDevice *Device, const char *Name) {} virtual void Recording(const cDevice *Device, const char *Name) {}
// The given DVB device has started recording Name. Name is the full directory // The given DVB device has started recording Name. Name is the full directory
// name of the recording. If Name is NULL, the recording has ended. // name of the recording. If Name is NULL, the recording has ended.
virtual void Replaying(const cDvbPlayerControl *DvbPlayerControl, const char *Name) {} virtual void Replaying(const cControl *Control, const char *Name) {}
// The given player control has started replaying Name. Name is the full directory // The given player control has started replaying Name. Name is the full directory
// name of the recording. If Name is NULL, the replay has ended. // name of the recording. If Name is NULL, the replay has ended.
virtual void SetVolume(int Volume, bool Absolute) {} virtual void SetVolume(int Volume, bool Absolute) {}
@ -60,7 +60,7 @@ public:
// These functions are called whenever the related status information changes: // These functions are called whenever the related status information changes:
static void MsgChannelSwitch(const cDevice *Device, int ChannelNumber); static void MsgChannelSwitch(const cDevice *Device, int ChannelNumber);
static void MsgRecording(const cDevice *Device, const char *Name); static void MsgRecording(const cDevice *Device, const char *Name);
static void MsgReplaying(const cDvbPlayerControl *DvbPlayerControl, const char *Name); static void MsgReplaying(const cControl *Control, const char *Name);
static void MsgSetVolume(int Volume, bool Absolute); static void MsgSetVolume(int Volume, bool Absolute);
static void MsgOsdClear(void); static void MsgOsdClear(void);
static void MsgOsdTitle(const char *Title); static void MsgOsdTitle(const char *Title);