The new functions cControl::GetRecording() and cControl::GetHeader() can be used to retrieve information about what the current player is playing

This commit is contained in:
Klaus Schmidinger 2012-04-28 13:09:42 +02:00
parent 109586571a
commit 97e242d1b5
9 changed files with 50 additions and 8 deletions

View File

@ -7091,3 +7091,5 @@ Video Disk Recorder Revision History
(reported by Lars Hanisch). (reported by Lars Hanisch).
- cControl::Control() now has an additional boolean parameter, which can be set to - cControl::Control() now has an additional boolean parameter, which can be set to
true to get the current player control even if it is hidden. true to get the current player control even if it is hidden.
- The new functions cControl::GetRecording() and cControl::GetHeader() can be used
to retrieve information about what the current player is playing.

View File

@ -71,3 +71,7 @@ VDR Plugin 'pictures' Revision History
2012-02-27: Version 0.1.2 2012-02-27: Version 0.1.2
- Removed an obsolete command line option. - Removed an obsolete command line option.
2012-04-2r8 Version 0.1.3
- Added cPictureControl::GetHeader().

View File

@ -3,7 +3,7 @@
* *
* 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: pictures.c 2.5 2012/02/27 12:35:45 kls Exp $ * $Id: pictures.c 2.6 2012/04/28 11:58:42 kls Exp $
*/ */
#include <getopt.h> #include <getopt.h>
@ -11,7 +11,7 @@
#include "menu.h" #include "menu.h"
#include "player.h" #include "player.h"
static const char *VERSION = "0.1.2"; static const char *VERSION = "0.1.3";
static const char *DESCRIPTION = trNOOP("A simple picture viewer"); static const char *DESCRIPTION = trNOOP("A simple picture viewer");
static const char *MAINMENUENTRY = trNOOP("Pictures"); static const char *MAINMENUENTRY = trNOOP("Pictures");

View File

@ -3,7 +3,7 @@
* *
* 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: player.c 2.1 2011/02/20 17:15:25 kls Exp $ * $Id: player.c 2.2 2012/04/28 11:58:15 kls Exp $
*/ */
#include "player.h" #include "player.h"
@ -204,6 +204,11 @@ void cPictureControl::DisplayCaption(void)
osd->Flush(); osd->Flush();
} }
cString cPictureControl::GetHeader(void)
{
return tr("Pictures");
}
eOSState cPictureControl::ProcessKey(eKeys Key) eOSState cPictureControl::ProcessKey(eKeys Key)
{ {
switch (Key) { switch (Key) {

View File

@ -3,7 +3,7 @@
* *
* 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: player.h 1.1 2008/01/13 11:29:27 kls Exp $ * $Id: player.h 2.1 2012/04/28 11:56:01 kls Exp $
*/ */
#ifndef _PLAYER_H #ifndef _PLAYER_H
@ -39,6 +39,7 @@ private:
public: public:
cPictureControl(cPictureEntry *Pictures, const cPictureEntry *PictureEntry, bool SlideShow = false); cPictureControl(cPictureEntry *Pictures, const cPictureEntry *PictureEntry, bool SlideShow = false);
virtual ~cPictureControl(); virtual ~cPictureControl();
virtual cString GetHeader(void);
virtual eOSState ProcessKey(eKeys Key); virtual eOSState ProcessKey(eKeys Key);
static bool Active(void) { return active > 0; } static bool Active(void) { return active > 0; }
static const char *LastDisplayed(void); static const char *LastDisplayed(void);

9
menu.c
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: menu.c 2.52 2012/04/25 09:42:54 kls Exp $ * $Id: menu.c 2.53 2012/04/28 11:13:09 kls Exp $
*/ */
#include "menu.h" #include "menu.h"
@ -4773,6 +4773,13 @@ cOsdObject *cReplayControl::GetInfo(void)
return NULL; return NULL;
} }
const cRecording *cReplayControl::GetRecording(void)
{
if (const cRecording *Recording = Recordings.GetByName(LastReplayed()))
return Recording;
return NULL;
}
eOSState cReplayControl::ProcessKey(eKeys Key) eOSState cReplayControl::ProcessKey(eKeys Key)
{ {
if (!Active()) if (!Active())

3
menu.h
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: menu.h 2.7 2012/04/22 15:08:58 kls Exp $ * $Id: menu.h 2.8 2012/04/28 11:13:03 kls Exp $
*/ */
#ifndef __MENU_H #ifndef __MENU_H
@ -283,6 +283,7 @@ public:
virtual ~cReplayControl(); virtual ~cReplayControl();
void Stop(void); void Stop(void);
virtual cOsdObject *GetInfo(void); virtual cOsdObject *GetInfo(void);
virtual const cRecording *GetRecording(void);
virtual eOSState ProcessKey(eKeys Key); virtual eOSState ProcessKey(eKeys Key);
virtual void Show(void); virtual void Show(void);
virtual void Hide(void); virtual void Hide(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: player.c 2.1 2012/04/28 10:56:00 kls Exp $ * $Id: player.c 2.2 2012/04/28 11:52:50 kls Exp $
*/ */
#include "player.h" #include "player.h"
@ -60,6 +60,16 @@ cOsdObject *cControl::GetInfo(void)
return NULL; return NULL;
} }
const cRecording *cControl::GetRecording(void)
{
return NULL;
}
cString cControl::GetHeader(void)
{
return "";
}
cControl *cControl::Control(bool Hidden) cControl *cControl::Control(bool Hidden)
{ {
cMutexLock MutexLock(&mutex); cMutexLock MutexLock(&mutex);

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 2.5 2012/04/28 10:56:00 kls Exp $ * $Id: player.h 2.6 2012/04/28 13:04:17 kls Exp $
*/ */
#ifndef __PLAYER_H #ifndef __PLAYER_H
@ -86,6 +86,18 @@ public:
virtual ~cControl(); virtual ~cControl();
virtual void Hide(void) = 0; virtual void Hide(void) = 0;
virtual cOsdObject *GetInfo(void); virtual cOsdObject *GetInfo(void);
///< Returns an OSD object that displays information about the currently
///< played programme. If no such information is available, NULL will be
///< returned.
virtual const cRecording *GetRecording(void);
///< Returns the cRecording that is currently being replayed, or NULL if
///< this player is not playing a cRecording.
virtual cString GetHeader(void);
///< This can be used by players that don't play a cRecording, but rather
///< do something completely different. The resulting string may be used by
///< skins as a last resort, in case they want to display the state of the
///< current player. The return value is expected to be a short, single line
///< string. The default implementation returns an empty string.
double FramesPerSecond(void) { return player->FramesPerSecond(); } double FramesPerSecond(void) { return player->FramesPerSecond(); }
bool GetIndex(int &Current, int &Total, bool SnapToIFrame = false) { return player->GetIndex(Current, Total, SnapToIFrame); } 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); } bool GetReplayMode(bool &Play, bool &Forward, int &Speed) { return player->GetReplayMode(Play, Forward, Speed); }