vdr 2.7.4
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.3 2025/02/12 21:18:53 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 OsdStatusMessage2(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 // The OSD displays the given single line Text as menu item at Index.
92 virtual void OsdItem2(const char *Text, int Index, bool Selectable) { OsdItem(Text, Index); }
93 // The OSD displays the given single line Text as menu item at Index.
94 // Selectable is true if this item can be selected.
95 virtual void OsdCurrentItem(const char *Text) {}
96 // The OSD displays the given single line Text as the current menu item.
97 virtual void OsdCurrentItem2(const char *Text, int Index) { OsdCurrentItem(Text); }
98 // The OSD displays the given single line Text as the current menu item.
99 // Index is the one that was given in OsdItem[2]() for this item.
100 virtual void OsdTextItem(const char *Text, bool Scroll) {}
101 // The OSD displays the given multi line text. If Text points to an
102 // actual string, that text shall be displayed and Scroll has no
103 // meaning. If Text is NULL, Scroll defines whether the previously
104 // received text shall be scrolled up (true) or down (false) and
105 // the text shall be redisplayed with the new offset.
106 virtual void OsdChannel(const char *Text) {}
107 // The OSD displays the single line Text with the current channel information.
108 virtual void OsdProgramme(time_t PresentTime, const char *PresentTitle, const char *PresentSubtitle, time_t FollowingTime, const char *FollowingTitle, const char *FollowingSubtitle) {}
109 // The OSD displays the given programme information.
110public:
111 cStatus(void);
112 virtual ~cStatus();
113 // These functions are called whenever the related status information changes:
114 static void MsgChannelChange(const cChannel *Channel);
115 static void MsgTimerChange(const cTimer *Timer, eTimerChange Change);
116 static void MsgChannelSwitch(const cDevice *Device, int ChannelNumber, bool LiveView);
117 static void MsgRecording(const cDevice *Device, const char *Name, const char *FileName, bool On);
118 static void MsgReplaying(const cControl *Control, const char *Name, const char *FileName, bool On);
119 static void MsgMarksModified(const cMarks* Marks);
120 static void MsgSetVolume(int Volume, bool Absolute);
121 static void MsgSetAudioTrack(int Index, const char * const *Tracks);
122 static void MsgSetAudioChannel(int AudioChannel);
123 static void MsgSetSubtitleTrack(int Index, const char * const *Tracks);
124 static void MsgOsdClear(void);
125 static void MsgOsdTitle(const char *Title);
126 [[deprecated("use MsgOsdStatusMessage(eMessageType Type, const char *Message) instead")]]
127 static void MsgOsdStatusMessage(const char *Message) { MsgOsdStatusMessage(mtStatus, Message); }
128 static void MsgOsdStatusMessage(eMessageType Type, const char *Message);
129 static void MsgOsdHelpKeys(const char *Red, const char *Green, const char *Yellow, const char *Blue);
130 static void MsgOsdItem(const char *Text, int Index, bool Selectable = true);
131 static void MsgOsdCurrentItem(const char *Text, int Index = -1);
132 static void MsgOsdTextItem(const char *Text, bool Scroll = false);
133 static void MsgOsdChannel(const char *Text);
134 static void MsgOsdProgramme(time_t PresentTime, const char *PresentTitle, const char *PresentSubtitle, time_t FollowingTime, const char *FollowingTitle, const char *FollowingSubtitle);
135 };
136
137#endif //__STATUS_H
cListObject(const cListObject &ListObject)
Definition tools.h:534
int Index(void) const
Definition tools.c:2095
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 OsdCurrentItem2(const char *Text, int Index)
Definition status.h:97
virtual void OsdStatusMessage2(eMessageType Type, const char *Message)
Definition status.h:85
virtual void OsdHelpKeys(const char *Red, const char *Green, const char *Yellow, const char *Blue)
Definition status.h:88
cStatus(void)
Definition status.c:16
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:110
virtual void OsdTextItem(const char *Text, bool Scroll)
Definition status.h:100
virtual void Recording(const cDevice *Device, const char *Name, const char *FileName, bool On)
Definition status.h:52
static void MsgOsdHelpKeys(const char *Red, const char *Green, const char *Yellow, const char *Blue)
Definition status.c:104
static void MsgOsdStatusMessage(const char *Message)
Definition status.h:127
virtual void ChannelChange(const cChannel *Channel)
Definition status.h:41
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:95
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:71
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:106
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:108
static void MsgOsdClear(void)
Definition status.c:86
virtual void OsdItem2(const char *Text, int Index, bool Selectable)
Definition status.h:92
virtual void MarksModified(const cMarks *Marks)
Definition status.h:63
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:80
static void MsgOsdCurrentItem(const char *Text, int Index=-1)
Definition status.c:116
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: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:80
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:38
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