From f2b637ed852c81301ea1f64692447733745ffa06 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sat, 13 Jul 2002 11:16:27 +0200 Subject: [PATCH] Changed the interface of cStatus::Replaying() --- HISTORY | 4 ++++ PLUGINS/src/status/HISTORY | 4 ++++ PLUGINS/src/status/status.c | 8 ++++---- dvbplayer.c | 13 +++++++------ player.h | 13 ++++++++++++- status.c | 6 +++--- status.h | 8 ++++---- 7 files changed, 38 insertions(+), 18 deletions(-) diff --git a/HISTORY b/HISTORY index 37c49f74..e507b651 100644 --- a/HISTORY +++ b/HISTORY @@ -1364,3 +1364,7 @@ Video Disk Recorder Revision History - Added direct access to the index data of cPalette (needed for displaying SPUs, 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. diff --git a/PLUGINS/src/status/HISTORY b/PLUGINS/src/status/HISTORY index 27929362..f0c208f1 100644 --- a/PLUGINS/src/status/HISTORY +++ b/PLUGINS/src/status/HISTORY @@ -4,3 +4,7 @@ VDR Plugin 'status' Revision History 2002-05-18: Version 0.0.1 - Initial revision. + +2002-07-13: Version 0.0.2 + +- Changed the interface of cStatus::Replaying(). diff --git a/PLUGINS/src/status/status.c b/PLUGINS/src/status/status.c index 2d5f42f3..dc274e81 100644 --- a/PLUGINS/src/status/status.c +++ b/PLUGINS/src/status/status.c @@ -3,13 +3,13 @@ * * 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 #include -static const char *VERSION = "0.0.1"; +static const char *VERSION = "0.0.2"; static const char *DESCRIPTION = "Status monitor test"; static const char *MAINMENUENTRY = NULL; @@ -19,7 +19,7 @@ class cStatusTest : public cStatus { protected: virtual void ChannelSwitch(const cDevice *Device, int ChannelNumber); 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 OsdClear(void); 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); } -void cStatusTest::Replaying(const cDvbPlayerControl *DvbPlayerControl, const char *Name) +void cStatusTest::Replaying(const cControl *Control, const char *Name) { dsyslog("status: cStatusTest::Replaying %s", Name); } diff --git a/dvbplayer.c b/dvbplayer.c index 9ea8eb13..7dd8dd84 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.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" @@ -116,8 +116,8 @@ public: int SkipFrames(int Frames); void SkipSeconds(int Seconds); void Goto(int Position, bool Still = false); - void GetIndex(int &Current, int &Total, bool SnapToIFrame = false); - bool GetReplayMode(bool &Play, bool &Forward, int &Speed); + virtual bool GetIndex(int &Current, int &Total, bool SnapToIFrame = false); + 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? @@ -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 (playMode == pmStill) @@ -607,9 +607,10 @@ void cDvbPlayer::GetIndex(int &Current, int &Total, bool SnapToIFrame) } } Total = index->Last(); + return true; } - else - Current = Total = -1; + Current = Total = -1; + return false; } bool cDvbPlayer::GetReplayMode(bool &Play, bool &Forward, int &Speed) diff --git a/player.h b/player.h index 51265f32..1bf6d371 100644 --- a/player.h +++ b/player.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * 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 @@ -41,6 +41,15 @@ public: cPlayer(void); virtual ~cPlayer(); 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 { @@ -54,6 +63,8 @@ public: cControl(cPlayer *Player, bool Hidden = false); virtual ~cControl(); 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 Attach(void); static void Shutdown(void); diff --git a/status.c b/status.c index 76dc8404..0bc4dd8e 100644 --- a/status.c +++ b/status.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * 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" @@ -35,10 +35,10 @@ void cStatus::MsgRecording(const cDevice *Device, const char *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)) - sm->Replaying(DvbPlayerControl, Name); + sm->Replaying(Control, Name); } void cStatus::MsgSetVolume(int Volume, bool Absolute) diff --git a/status.h b/status.h index d68f23ad..b72b2027 100644 --- a/status.h +++ b/status.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * 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 @@ -12,7 +12,7 @@ #include "config.h" #include "device.h" -#include "dvbplayer.h" +#include "player.h" #include "tools.h" class cStatus : public cListObject { @@ -27,7 +27,7 @@ protected: virtual void Recording(const cDevice *Device, const char *Name) {} // 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. - 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 // name of the recording. If Name is NULL, the replay has ended. virtual void SetVolume(int Volume, bool Absolute) {} @@ -60,7 +60,7 @@ public: // These functions are called whenever the related status information changes: static void MsgChannelSwitch(const cDevice *Device, int ChannelNumber); 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 MsgOsdClear(void); static void MsgOsdTitle(const char *Title);