vdr 2.7.3
status.h
Go to the documentation of this file.
1/*
2 * status.h: Status monitoring
3 *
4 * See the main source file 'vdr.c' for copyright information and
5 * how to reach the author.
6 *
7 * $Id: status.h 4.4 2018/01/29 13:42:17 kls Exp $
8 */
9
10#ifndef __STATUS_H
11#define __STATUS_H
12
13#include "config.h"
14#include "device.h"
15#include "player.h"
16#include "tools.h"
17
18// Several member functions of the following classes are called with a pointer to
19// an object from a global list (cTimer, cChannel, cRecording or cEvent). In these
20// cases the core VDR code holds a lock on the respective list. While in general a
21// plugin should only work with the objects and data that is explicitly given to it
22// in the function call, the called function may itself set a read lock (not a write
23// lock!) on this list, because read locks can be nested. It may also set read locks
24// (not write locks!) on higher order lists.
25// For instance, a function that is called with a cChannel may lock cRecordings and/or
26// cSchedules (which contains cEvent objects), but not cTimers. If a plugin needs to
27// set locks of its own (on mutexes defined inside the plugin code), it shall do so
28// after setting any locks on VDR's global lists, and it shall always set these
29// locks in the same sequence, to avoid deadlocks.
30
31enum eTimerChange { tcMod, tcAdd, tcDel }; // tcMod is obsolete and no longer used!
32
33class cTimer;
34
35class cStatus : public cListObject {
36private:
38protected:
39 // These functions can be implemented by derived classes to receive status information:
40 virtual void ChannelChange(const cChannel *Channel) {}
41 // Indicates a change in the parameters of the given Channel that may
42 // require a retune.
43 virtual void TimerChange(const cTimer *Timer, eTimerChange Change) {}
44 // Indicates a change in the timer settings.
45 // Timer points to the timer that has been added or will be deleted, respectively.
46 virtual void ChannelSwitch(const cDevice *Device, int ChannelNumber, bool LiveView) {}
47 // Indicates a channel switch on the given DVB device.
48 // If ChannelNumber is 0, this is before the channel is being switched,
49 // otherwise ChannelNumber is the number of the channel that has been switched to.
50 // LiveView tells whether this channel switch is for live viewing.
51 virtual void Recording(const cDevice *Device, const char *Name, const char *FileName, bool On) {}
52 // The given DVB device has started (On = true) or stopped (On = false) recording Name.
53 // Name is the name of the recording, without any directory path. The full file name
54 // of the recording is given in FileName, which may be NULL in case there is no
55 // actual file involved. If On is false, Name may be NULL.
56 virtual void Replaying(const cControl *Control, const char *Name, const char *FileName, bool On) {}
57 // The given player control has started (On = true) or stopped (On = false) replaying Name.
58 // Name is the name of the recording, without any directory path. In case of a player that can't provide
59 // a name, Name can be a string that identifies the player type (like, e.g., "DVD").
60 // The full file name of the recording is given in FileName, which may be NULL in case there is no
61 // actual file involved. If On is false, Name may be NULL.
62 virtual void MarksModified(const cMarks *Marks) {}
63 // If the editing marks of the recording that is currently being played
64 // are modified in any way, this function is called with the list of
65 // Marks. If Marks is NULL, the editing marks for the currently played
66 // recording have been deleted entirely.
67 virtual void SetVolume(int Volume, bool Absolute) {}
68 // The volume has been set to the given value, either
69 // absolutely or relative to the current volume.
70 virtual void SetAudioTrack(int Index, const char * const *Tracks) {}
71 // The audio track has been set to the one given by Index, which
72 // points into the Tracks array of strings. Tracks is NULL terminated.
73 virtual void SetAudioChannel(int AudioChannel) {}
74 // The audio channel has been set to the given value.
75 // 0=stereo, 1=left, 2=right, -1=no information available.
76 virtual void SetSubtitleTrack(int Index, const char * const *Tracks) {}
77 // The subtitle track has been set to the one given by Index, which
78 // points into the Tracks array of strings. Tracks is NULL terminated.
79 virtual void OsdClear(void) {}
80 // The OSD has been cleared.
81 virtual void OsdTitle(const char *Title) {}
82 // Title has been displayed in the title line of the menu.
83 virtual void OsdStatusMessage(const char *Message) {}
84 // Message has been displayed in the status line of the menu.
85 // If Message is NULL, the status line has been cleared.
86 virtual void OsdHelpKeys(const char *Red, const char *Green, const char *Yellow, const char *Blue) {}
87 // The help keys have been set to the given values (may be NULL).
88 virtual void OsdItem(const char *Text, int Index) {}
89 // The OSD displays the given single line Text as menu item at Index.
90 virtual void OsdCurrentItem(const char *Text) {}
91 // The OSD displays the given single line Text as the current menu item.
92 virtual void OsdTextItem(const char *Text, bool Scroll) {}
93 // The OSD displays the given multi line text. If Text points to an
94 // actual string, that text shall be displayed and Scroll has no
95 // meaning. If Text is NULL, Scroll defines whether the previously
96 // received text shall be scrolled up (true) or down (false) and
97 // the text shall be redisplayed with the new offset.
98 virtual void OsdChannel(const char *Text) {}
99 // The OSD displays the single line Text with the current channel information.
100 virtual void OsdProgramme(time_t PresentTime, const char *PresentTitle, const char *PresentSubtitle, time_t FollowingTime, const char *FollowingTitle, const char *FollowingSubtitle) {}
101 // The OSD displays the given programme information.
102public:
103 cStatus(void);
104 virtual ~cStatus();
105 // These functions are called whenever the related status information changes:
106 static void MsgChannelChange(const cChannel *Channel);
107 static void MsgTimerChange(const cTimer *Timer, eTimerChange Change);
108 static void MsgChannelSwitch(const cDevice *Device, int ChannelNumber, bool LiveView);
109 static void MsgRecording(const cDevice *Device, const char *Name, const char *FileName, bool On);
110 static void MsgReplaying(const cControl *Control, const char *Name, const char *FileName, bool On);
111 static void MsgMarksModified(const cMarks* Marks);
112 static void MsgSetVolume(int Volume, bool Absolute);
113 static void MsgSetAudioTrack(int Index, const char * const *Tracks);
114 static void MsgSetAudioChannel(int AudioChannel);
115 static void MsgSetSubtitleTrack(int Index, const char * const *Tracks);
116 static void MsgOsdClear(void);
117 static void MsgOsdTitle(const char *Title);
118 static void MsgOsdStatusMessage(const char *Message);
119 static void MsgOsdHelpKeys(const char *Red, const char *Green, const char *Yellow, const char *Blue);
120 static void MsgOsdItem(const char *Text, int Index);
121 static void MsgOsdCurrentItem(const char *Text);
122 static void MsgOsdTextItem(const char *Text, bool Scroll = false);
123 static void MsgOsdChannel(const char *Text);
124 static void MsgOsdProgramme(time_t PresentTime, const char *PresentTitle, const char *PresentSubtitle, time_t FollowingTime, const char *FollowingTitle, const char *FollowingSubtitle);
125 };
126
127#endif //__STATUS_H
int Index(void) const
Definition tools.c:2088
Definition tools.h:631
static void MsgMarksModified(const cMarks *Marks)
Definition status.c:56
static void MsgOsdTitle(const char *Title)
Definition status.c:92
static void MsgOsdChannel(const char *Text)
Definition status.c:128
virtual void OsdHelpKeys(const char *Red, const char *Green, const char *Yellow, const char *Blue)
Definition status.h:86
cStatus(void)
Definition status.c:16
virtual void SetSubtitleTrack(int Index, const char *const *Tracks)
Definition status.h:76
virtual void SetAudioChannel(int AudioChannel)
Definition status.h:73
virtual void ChannelSwitch(const cDevice *Device, int ChannelNumber, bool LiveView)
Definition status.h:46
virtual void OsdItem(const char *Text, int Index)
Definition status.h:88
virtual void OsdTextItem(const char *Text, bool Scroll)
Definition status.h:92
virtual void Recording(const cDevice *Device, const char *Name, const char *FileName, bool On)
Definition status.h:51
static void MsgOsdHelpKeys(const char *Red, const char *Green, const char *Yellow, const char *Blue)
Definition status.c:104
virtual void ChannelChange(const cChannel *Channel)
Definition status.h:40
static void MsgSetAudioChannel(int AudioChannel)
Definition status.c:74
static void MsgOsdProgramme(time_t PresentTime, const char *PresentTitle, const char *PresentSubtitle, time_t FollowingTime, const char *FollowingTitle, const char *FollowingSubtitle)
Definition status.c:134
virtual ~cStatus()
Definition status.c:21
virtual void OsdCurrentItem(const char *Text)
Definition status.h:90
static void MsgOsdStatusMessage(const char *Message)
Definition status.c:98
static void MsgReplaying(const cControl *Control, const char *Name, const char *FileName, bool On)
Definition status.c:50
static void MsgSetVolume(int Volume, bool Absolute)
Definition status.c:62
static void MsgRecording(const cDevice *Device, const char *Name, const char *FileName, bool On)
Definition status.c:44
virtual void SetAudioTrack(int Index, const char *const *Tracks)
Definition status.h:70
static void MsgOsdItem(const char *Text, int Index)
Definition status.c:110
virtual void Replaying(const cControl *Control, const char *Name, const char *FileName, bool On)
Definition status.h:56
virtual void OsdChannel(const char *Text)
Definition status.h:98
static cList< cStatus > statusMonitors
Definition status.h:37
virtual void OsdProgramme(time_t PresentTime, const char *PresentTitle, const char *PresentSubtitle, time_t FollowingTime, const char *FollowingTitle, const char *FollowingSubtitle)
Definition status.h:100
static void MsgOsdClear(void)
Definition status.c:86
static void MsgOsdCurrentItem(const char *Text)
Definition status.c:116
virtual void MarksModified(const cMarks *Marks)
Definition status.h:62
static void MsgChannelChange(const cChannel *Channel)
Definition status.c:26
static void MsgSetAudioTrack(int Index, const char *const *Tracks)
Definition status.c:68
virtual void OsdClear(void)
Definition status.h:79
static void MsgTimerChange(const cTimer *Timer, eTimerChange Change)
Definition status.c:32
static void MsgOsdTextItem(const char *Text, bool Scroll=false)
Definition status.c:122
virtual void OsdTitle(const char *Title)
Definition status.h:81
virtual void SetVolume(int Volume, bool Absolute)
Definition status.h:67
virtual void OsdStatusMessage(const char *Message)
Definition status.h:83
static void MsgSetSubtitleTrack(int Index, const char *const *Tracks)
Definition status.c:80
virtual void TimerChange(const cTimer *Timer, eTimerChange Change)
Definition status.h:43
static void MsgChannelSwitch(const cDevice *Device, int ChannelNumber, bool LiveView)
Definition status.c:38
eTimerChange
Definition status.h:31
@ tcDel
Definition status.h:31
@ tcMod
Definition status.h:31
@ tcAdd
Definition status.h:31