2 * Copyright (C) 2012-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
11 #include "guilib/guiinfo/GUIInfoProvider.h"
12 #include "pvr/PVRDescrambleInfo.h"
13 #include "pvr/PVRSignalStatus.h"
14 #include "pvr/addons/PVRClients.h"
15 #include "pvr/guilib/guiinfo/PVRGUITimerInfo.h"
16 #include "pvr/guilib/guiinfo/PVRGUITimesInfo.h"
17 #include "threads/CriticalSection.h"
18 #include "threads/Thread.h"
40 struct PVRChannelNumberInputChangedEvent
;
41 struct PVRPreviewAndPlayerShowInfoChangedEvent
;
43 class CPVRGUIInfo
: public KODI::GUILIB::GUIINFO::CGUIInfoProvider
, private CThread
47 ~CPVRGUIInfo() override
= default;
53 * @brief CEventStream callback for PVR events.
54 * @param event The event.
56 void Notify(const PVREvent
& event
);
59 * @brief CEventStream callback for channel number input changes.
60 * @param event The event.
62 void Notify(const PVRChannelNumberInputChangedEvent
& event
);
65 * @brief CEventStream callback for channel preview and player show info changes.
66 * @param event The event.
68 void Notify(const PVRPreviewAndPlayerShowInfoChangedEvent
& event
);
70 // KODI::GUILIB::GUIINFO::IGUIInfoProvider implementation
71 bool InitCurrentItem(CFileItem
* item
) override
;
72 bool GetLabel(std::string
& value
,
73 const CFileItem
* item
,
75 const KODI::GUILIB::GUIINFO::CGUIInfo
& info
,
76 std::string
* fallback
) const override
;
77 bool GetFallbackLabel(std::string
& value
,
78 const CFileItem
* item
,
80 const KODI::GUILIB::GUIINFO::CGUIInfo
& info
,
81 std::string
* fallback
) override
;
82 bool GetInt(int& value
,
83 const CGUIListItem
* item
,
85 const KODI::GUILIB::GUIINFO::CGUIInfo
& info
) const override
;
86 bool GetBool(bool& value
,
87 const CGUIListItem
* item
,
89 const KODI::GUILIB::GUIINFO::CGUIInfo
& info
) const override
;
92 void ResetProperties();
93 void ClearQualityInfo(CPVRSignalStatus
& qualityInfo
);
94 void ClearDescrambleInfo(CPVRDescrambleInfo
& descrambleInfo
);
96 void Process() override
;
98 void UpdateTimersCache();
99 void UpdateBackendCache();
100 void UpdateQualityData();
101 void UpdateDescrambleData();
103 void UpdateNextTimer();
104 void UpdateTimeshiftData();
105 void UpdateTimeshiftProgressData();
107 void UpdateTimersToggle();
109 bool GetListItemAndPlayerLabel(const CFileItem
* item
,
110 const KODI::GUILIB::GUIINFO::CGUIInfo
& info
,
111 std::string
& strValue
) const;
112 bool GetPVRLabel(const CFileItem
* item
,
113 const KODI::GUILIB::GUIINFO::CGUIInfo
& info
,
114 std::string
& strValue
) const;
115 bool GetRadioRDSLabel(const CFileItem
* item
,
116 const KODI::GUILIB::GUIINFO::CGUIInfo
& info
,
117 std::string
& strValue
) const;
119 bool GetListItemAndPlayerInt(const CFileItem
* item
,
120 const KODI::GUILIB::GUIINFO::CGUIInfo
& info
,
122 bool GetPVRInt(const CFileItem
* item
,
123 const KODI::GUILIB::GUIINFO::CGUIInfo
& info
,
125 int GetTimeShiftSeekPercent() const;
127 bool GetListItemAndPlayerBool(const CFileItem
* item
,
128 const KODI::GUILIB::GUIINFO::CGUIInfo
& info
,
130 bool GetPVRBool(const CFileItem
* item
,
131 const KODI::GUILIB::GUIINFO::CGUIInfo
& info
,
133 bool GetRadioRDSBool(const CFileItem
* item
,
134 const KODI::GUILIB::GUIINFO::CGUIInfo
& info
,
137 void CharInfoBackendNumber(std::string
& strValue
) const;
138 void CharInfoTotalDiskSpace(std::string
& strValue
) const;
139 void CharInfoSignal(std::string
& strValue
) const;
140 void CharInfoSNR(std::string
& strValue
) const;
141 void CharInfoBER(std::string
& strValue
) const;
142 void CharInfoUNC(std::string
& strValue
) const;
143 void CharInfoFrontendName(std::string
& strValue
) const;
144 void CharInfoFrontendStatus(std::string
& strValue
) const;
145 void CharInfoClientName(std::string
& strValue
) const;
146 void CharInfoInstanceName(std::string
& strValue
) const;
147 void CharInfoBackendName(std::string
& strValue
) const;
148 void CharInfoBackendVersion(std::string
& strValue
) const;
149 void CharInfoBackendHost(std::string
& strValue
) const;
150 void CharInfoBackendDiskspace(std::string
& strValue
) const;
151 void CharInfoBackendProviders(std::string
& strValue
) const;
152 void CharInfoBackendChannelGroups(std::string
& strValue
) const;
153 void CharInfoBackendChannels(std::string
& strValue
) const;
154 void CharInfoBackendTimers(std::string
& strValue
) const;
155 void CharInfoBackendRecordings(std::string
& strValue
) const;
156 void CharInfoBackendDeletedRecordings(std::string
& strValue
) const;
157 void CharInfoPlayingClientName(std::string
& strValue
) const;
158 void CharInfoEncryption(std::string
& strValue
) const;
159 void CharInfoService(std::string
& strValue
) const;
160 void CharInfoMux(std::string
& strValue
) const;
161 void CharInfoProvider(std::string
& strValue
) const;
163 /** @name PVRGUIInfo data */
165 CPVRGUIAnyTimerInfo m_anyTimersInfo
; // tv + radio
166 CPVRGUITVTimerInfo m_tvTimersInfo
;
167 CPVRGUIRadioTimerInfo m_radioTimersInfo
;
169 CPVRGUITimesInfo m_timesInfo
;
171 bool m_bHasTVRecordings
;
172 bool m_bHasRadioRecordings
;
173 unsigned int m_iCurrentActiveClient
;
174 std::string m_strPlayingClientName
;
175 std::string m_strClientName
;
176 std::string m_strInstanceName
;
177 std::string m_strBackendName
;
178 std::string m_strBackendVersion
;
179 std::string m_strBackendHost
;
180 std::string m_strBackendTimers
;
181 std::string m_strBackendRecordings
;
182 std::string m_strBackendDeletedRecordings
;
183 std::string m_strBackendProviders
;
184 std::string m_strBackendChannelGroups
;
185 std::string m_strBackendChannels
;
186 long long m_iBackendDiskTotal
;
187 long long m_iBackendDiskUsed
;
189 bool m_bIsPlayingRadio
;
190 bool m_bIsPlayingRecording
;
191 bool m_bIsPlayingEpgTag
;
192 bool m_bIsPlayingEncryptedStream
;
193 bool m_bHasTVChannels
;
194 bool m_bHasRadioChannels
;
195 bool m_bCanRecordPlayingChannel
;
196 bool m_bIsRecordingPlayingChannel
;
197 bool m_bIsPlayingActiveRecording
;
198 std::string m_strPlayingTVGroup
;
199 std::string m_strPlayingRadioGroup
;
203 CPVRSignalStatus m_qualityInfo
; /*!< stream quality information */
204 CPVRDescrambleInfo m_descrambleInfo
; /*!< stream descramble information */
205 std::vector
<SBackend
> m_backendProperties
;
207 std::string m_channelNumberInput
;
208 bool m_previewAndPlayerShowInfo
{false};
210 mutable CCriticalSection m_critSection
;
213 * The various backend-related fields will only be updated when this
214 * flag is set. This is done to limit the amount of unnecessary
215 * backend querying when we're not displaying any of the queried
218 mutable std::atomic
<bool> m_updateBackendCacheRequested
;