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