Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 642 lines (520 sloc) 16.708 kb
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
1 /*
2 * Copyright (C) 2010 Alwin Esch (Team XBMC)
3 * http://xbmc.org
4 *
5 * This Program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
8 * any later version.
9 *
10 * This Program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with XBMC; see the file COPYING. If not, write to
17 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
18 * http://www.gnu.org/copyleft/gpl.html
19 *
20 */
21
22 #include "client.h"
23 #include "xbmc_pvr_dll.h"
24 #include "VNSIDemux.h"
25 #include "VNSIRecording.h"
26 #include "VNSIData.h"
27 #include "VNSIChannelScan.h"
28
2ff979e @pipelka vnsi addon: code cleanup
pipelka authored
29 #include <sstream>
30 #include <string>
31 #include <iostream>
32
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
33 using namespace std;
34
35 bool m_bCreated = false;
c1fa534 @opdenkamp pvr: rename add-on status and add-on methods in the pvrclients becaus…
authored
36 ADDON_STATUS m_CurStatus = ADDON_STATUS_UNKNOWN;
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
37
38 /* User adjustable settings are saved here.
39 * Default values are defined inside client.h
40 * and exported to the other source files.
41 */
2ff979e @pipelka vnsi addon: code cleanup
pipelka authored
42 std::string g_szHostname = DEFAULT_HOST;
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
43 int g_iPort = DEFAULT_PORT;
44 bool g_bCharsetConv = DEFAULT_CHARCONV; ///< Convert VDR's incoming strings to UTF8 character set
45 bool g_bHandleMessages = DEFAULT_HANDLE_MSG; ///< Send VDR's OSD status messages to XBMC OSD
46 int g_iConnectTimeout = DEFAULT_TIMEOUT; ///< The Socket connection timeout
47 int g_iPriority = DEFAULT_PRIORITY; ///< The Priority this client have in response to other clients
77cd0a1 @pipelka vnsi addon: support for channel groups
pipelka authored
48 bool g_bAutoChannelGroups = DEFAULT_AUTOGROUPS;
f2d6b11 @pipelka vnsi addon: code cosmetics
pipelka authored
49
d181ecb @opdenkamp pvr: give the addon helper methods sane names to avoid problems on ca…
authored
50 CHelper_libXBMC_addon *XBMC = NULL;
51 CHelper_libXBMC_gui *GUI = NULL;
52 CHelper_libXBMC_pvr *PVR = NULL;
f2d6b11 @pipelka vnsi addon: code cosmetics
pipelka authored
53
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
54 cVNSIDemux *VNSIDemuxer = NULL;
55 cVNSIData *VNSIData = NULL;
56 cVNSIRecording *VNSIRecording = NULL;
57
58 extern "C" {
59
60 /***********************************************************
61 * Standart AddOn related public library functions
62 ***********************************************************/
63
c1fa534 @opdenkamp pvr: rename add-on status and add-on methods in the pvrclients becaus…
authored
64 ADDON_STATUS ADDON_Create(void* hdl, void* props)
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
65 {
66 if (!hdl || !props)
c1fa534 @opdenkamp pvr: rename add-on status and add-on methods in the pvrclients becaus…
authored
67 return ADDON_STATUS_UNKNOWN;
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
68
d181ecb @opdenkamp pvr: give the addon helper methods sane names to avoid problems on ca…
authored
69 XBMC = new CHelper_libXBMC_addon;
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
70 if (!XBMC->RegisterMe(hdl))
0b1708e @margro vnsi pvr addon: fix memory leaks on failed initialization and cleanup
margro authored
71 {
72 delete XBMC;
73 XBMC = NULL;
c1fa534 @opdenkamp pvr: rename add-on status and add-on methods in the pvrclients becaus…
authored
74 return ADDON_STATUS_UNKNOWN;
0b1708e @margro vnsi pvr addon: fix memory leaks on failed initialization and cleanup
margro authored
75 }
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
76
d181ecb @opdenkamp pvr: give the addon helper methods sane names to avoid problems on ca…
authored
77 GUI = new CHelper_libXBMC_gui;
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
78 if (!GUI->RegisterMe(hdl))
c1fa534 @opdenkamp pvr: rename add-on status and add-on methods in the pvrclients becaus…
authored
79 return ADDON_STATUS_UNKNOWN;
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
80
d181ecb @opdenkamp pvr: give the addon helper methods sane names to avoid problems on ca…
authored
81 PVR = new CHelper_libXBMC_pvr;
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
82 if (!PVR->RegisterMe(hdl))
0b1708e @margro vnsi pvr addon: fix memory leaks on failed initialization and cleanup
margro authored
83 {
84 delete PVR;
85 delete XBMC;
86 PVR = NULL;
87 XBMC = NULL;
c1fa534 @opdenkamp pvr: rename add-on status and add-on methods in the pvrclients becaus…
authored
88 return ADDON_STATUS_UNKNOWN;
0b1708e @margro vnsi pvr addon: fix memory leaks on failed initialization and cleanup
margro authored
89 }
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
90
91 XBMC->Log(LOG_DEBUG, "Creating VDR VNSI PVR-Client");
92
c1fa534 @opdenkamp pvr: rename add-on status and add-on methods in the pvrclients becaus…
authored
93 m_CurStatus = ADDON_STATUS_UNKNOWN;
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
94
95 /* Read setting "host" from settings.xml */
f2d6b11 @pipelka vnsi addon: code cosmetics
pipelka authored
96 char * buffer = (char*) malloc(128);
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
97 buffer[0] = 0; /* Set the end of string */
98
99 if (XBMC->GetSetting("host", buffer))
100 g_szHostname = buffer;
101 else
102 {
103 /* If setting is unknown fallback to defaults */
104 XBMC->Log(LOG_ERROR, "Couldn't get 'host' setting, falling back to '%s' as default", DEFAULT_HOST);
105 g_szHostname = DEFAULT_HOST;
106 }
f2d6b11 @pipelka vnsi addon: code cosmetics
pipelka authored
107 free(buffer);
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
108
109 /* Read setting "port" from settings.xml */
110 if (!XBMC->GetSetting("port", &g_iPort))
111 {
112 /* If setting is unknown fallback to defaults */
113 XBMC->Log(LOG_ERROR, "Couldn't get 'port' setting, falling back to '%i' as default", DEFAULT_PORT);
114 g_iPort = DEFAULT_PORT;
115 }
116
117 /* Read setting "priority" from settings.xml */
118 if (!XBMC->GetSetting("priority", &g_iPriority))
119 {
120 /* If setting is unknown fallback to defaults */
121 XBMC->Log(LOG_ERROR, "Couldn't get 'priority' setting, falling back to %i as default", DEFAULT_PRIORITY);
122 g_iPriority = DEFAULT_PRIORITY;
123 }
124
125 /* Read setting "convertchar" from settings.xml */
126 if (!XBMC->GetSetting("convertchar", &g_bCharsetConv))
127 {
128 /* If setting is unknown fallback to defaults */
129 XBMC->Log(LOG_ERROR, "Couldn't get 'convertchar' setting, falling back to 'false' as default");
130 g_bCharsetConv = DEFAULT_CHARCONV;
131 }
132
133 /* Read setting "timeout" from settings.xml */
134 if (!XBMC->GetSetting("timeout", &g_iConnectTimeout))
135 {
136 /* If setting is unknown fallback to defaults */
137 XBMC->Log(LOG_ERROR, "Couldn't get 'timeout' setting, falling back to %i seconds as default", DEFAULT_TIMEOUT);
138 g_iConnectTimeout = DEFAULT_TIMEOUT;
139 }
140
141 /* Read setting "handlemessages" from settings.xml */
142 if (!XBMC->GetSetting("handlemessages", &g_bHandleMessages))
143 {
144 /* If setting is unknown fallback to defaults */
145 XBMC->Log(LOG_ERROR, "Couldn't get 'handlemessages' setting, falling back to 'true' as default");
146 g_bHandleMessages = DEFAULT_HANDLE_MSG;
147 }
148
77cd0a1 @pipelka vnsi addon: support for channel groups
pipelka authored
149 /* Read setting "autochannelgroups" from settings.xml */
150 if (!XBMC->GetSetting("autochannelgroups", &g_bAutoChannelGroups))
151 {
152 /* If setting is unknown fallback to defaults */
153 XBMC->Log(LOG_ERROR, "Couldn't get 'autochannelgroups' setting, falling back to 'false' as default");
154 g_bAutoChannelGroups = DEFAULT_AUTOGROUPS;
155 }
156
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
157 VNSIData = new cVNSIData;
770f228 @pipelka vdr vnsi: use the plugin timeout parameter for network communication
pipelka authored
158 if (!VNSIData->Open(g_szHostname, g_iPort))
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
159 {
0b1708e @margro vnsi pvr addon: fix memory leaks on failed initialization and cleanup
margro authored
160 delete VNSIData;
161 delete PVR;
162 delete XBMC;
163 VNSIData = NULL;
164 PVR = NULL;
165 XBMC = NULL;
c1fa534 @opdenkamp pvr: rename add-on status and add-on methods in the pvrclients becaus…
authored
166 m_CurStatus = ADDON_STATUS_LOST_CONNECTION;
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
167 return m_CurStatus;
168 }
169
aaafa5f @pipelka vnsi addon: prevent recursive reconnect tries on "connection lost"
pipelka authored
170 if (!VNSIData->Login())
171 {
172 m_CurStatus = ADDON_STATUS_LOST_CONNECTION;
173 return m_CurStatus;
174 }
175
4aa5ec7 @FernetMenta vdr-vnsi: don't return ok if EnableStatusInterface fails
FernetMenta authored
176 if (!VNSIData->EnableStatusInterface(g_bHandleMessages))
aaafa5f @pipelka vnsi addon: prevent recursive reconnect tries on "connection lost"
pipelka authored
177 {
178 m_CurStatus = ADDON_STATUS_LOST_CONNECTION;
4aa5ec7 @FernetMenta vdr-vnsi: don't return ok if EnableStatusInterface fails
FernetMenta authored
179 return m_CurStatus;
aaafa5f @pipelka vnsi addon: prevent recursive reconnect tries on "connection lost"
pipelka authored
180 }
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
181
c1fa534 @opdenkamp pvr: rename add-on status and add-on methods in the pvrclients becaus…
authored
182 m_CurStatus = ADDON_STATUS_OK;
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
183 m_bCreated = true;
184 return m_CurStatus;
185 }
186
c1fa534 @opdenkamp pvr: rename add-on status and add-on methods in the pvrclients becaus…
authored
187 ADDON_STATUS ADDON_GetStatus()
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
188 {
189 return m_CurStatus;
190 }
191
c1fa534 @opdenkamp pvr: rename add-on status and add-on methods in the pvrclients becaus…
authored
192 void ADDON_Destroy()
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
193 {
194 if (m_bCreated)
195 {
196 delete VNSIData;
197 VNSIData = NULL;
198 }
0b1708e @margro vnsi pvr addon: fix memory leaks on failed initialization and cleanup
margro authored
199
200 if (PVR)
201 {
202 delete PVR;
203 PVR = NULL;
204 }
205
206 if (XBMC)
207 {
208 delete XBMC;
209 XBMC = NULL;
210 }
211
c1fa534 @opdenkamp pvr: rename add-on status and add-on methods in the pvrclients becaus…
authored
212 m_CurStatus = ADDON_STATUS_UNKNOWN;
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
213 }
214
c1fa534 @opdenkamp pvr: rename add-on status and add-on methods in the pvrclients becaus…
authored
215 bool ADDON_HasSettings()
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
216 {
217 return true;
218 }
219
c1fa534 @opdenkamp pvr: rename add-on status and add-on methods in the pvrclients becaus…
authored
220 unsigned int ADDON_GetSettings(ADDON_StructSetting ***sSet)
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
221 {
222 return 0;
223 }
224
c1fa534 @opdenkamp pvr: rename add-on status and add-on methods in the pvrclients becaus…
authored
225 ADDON_STATUS ADDON_SetSetting(const char *settingName, const void *settingValue)
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
226 {
227 string str = settingName;
228 if (str == "host")
229 {
230 string tmp_sHostname;
231 XBMC->Log(LOG_INFO, "Changed Setting 'host' from %s to %s", g_szHostname.c_str(), (const char*) settingValue);
232 tmp_sHostname = g_szHostname;
233 g_szHostname = (const char*) settingValue;
234 if (tmp_sHostname != g_szHostname)
c1fa534 @opdenkamp pvr: rename add-on status and add-on methods in the pvrclients becaus…
authored
235 return ADDON_STATUS_NEED_RESTART;
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
236 }
237 else if (str == "port")
238 {
239 XBMC->Log(LOG_INFO, "Changed Setting 'port' from %u to %u", g_iPort, *(int*) settingValue);
240 if (g_iPort != *(int*) settingValue)
241 {
242 g_iPort = *(int*) settingValue;
c1fa534 @opdenkamp pvr: rename add-on status and add-on methods in the pvrclients becaus…
authored
243 return ADDON_STATUS_NEED_RESTART;
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
244 }
245 }
246 else if (str == "priority")
247 {
248 XBMC->Log(LOG_INFO, "Changed Setting 'priority' from %u to %u", g_iPriority, *(int*) settingValue);
249 g_iPriority = *(int*) settingValue;
250 }
251 else if (str == "convertchar")
252 {
253 XBMC->Log(LOG_INFO, "Changed Setting 'convertchar' from %u to %u", g_bCharsetConv, *(bool*) settingValue);
254 g_bCharsetConv = *(bool*) settingValue;
255 }
256 else if (str == "timeout")
257 {
258 XBMC->Log(LOG_INFO, "Changed Setting 'timeout' from %u to %u", g_iConnectTimeout, *(int*) settingValue);
259 g_iConnectTimeout = *(int*) settingValue;
260 }
261 else if (str == "handlemessages")
262 {
263 XBMC->Log(LOG_INFO, "Changed Setting 'handlemessages' from %u to %u", g_bHandleMessages, *(bool*) settingValue);
264 g_bHandleMessages = *(bool*) settingValue;
265 if (VNSIData) VNSIData->EnableStatusInterface(g_bHandleMessages);
266 }
77cd0a1 @pipelka vnsi addon: support for channel groups
pipelka authored
267 else if (str == "autochannelgroups")
268 {
269 XBMC->Log(LOG_INFO, "Changed Setting 'autochannelgroups' from %u to %u", g_bAutoChannelGroups, *(bool*) settingValue);
270 if (g_bAutoChannelGroups != *(bool*) settingValue)
271 {
272 g_bAutoChannelGroups = *(bool*) settingValue;
273 return ADDON_STATUS_NEED_RESTART;
274 }
275 }
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
276
c1fa534 @opdenkamp pvr: rename add-on status and add-on methods in the pvrclients becaus…
authored
277 return ADDON_STATUS_OK;
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
278 }
279
c1fa534 @opdenkamp pvr: rename add-on status and add-on methods in the pvrclients becaus…
authored
280 void ADDON_Stop()
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
281 {
282 }
283
c1fa534 @opdenkamp pvr: rename add-on status and add-on methods in the pvrclients becaus…
authored
284 void ADDON_FreeSettings()
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
285 {
286
287 }
288
289 /***********************************************************
290 * PVR Client AddOn specific public library functions
291 ***********************************************************/
292
1eb039e @opdenkamp pvr: interface cleanup.
authored
293 PVR_ERROR GetAddonCapabilities(PVR_ADDON_CAPABILITIES* pCapabilities)
294 {
295 pCapabilities->bSupportsTimeshift = false;
296 pCapabilities->bSupportsEPG = true;
297 pCapabilities->bSupportsRecordings = true;
298 pCapabilities->bSupportsTimers = true;
299 pCapabilities->bSupportsTV = true;
300 pCapabilities->bSupportsRadio = true;
301 pCapabilities->bSupportsChannelSettings = false;
77cd0a1 @pipelka vnsi addon: support for channel groups
pipelka authored
302 pCapabilities->bSupportsChannelGroups = true;
1eb039e @opdenkamp pvr: interface cleanup.
authored
303 pCapabilities->bHandlesInputStream = true;
304 pCapabilities->bHandlesDemuxing = true;
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
305 if (VNSIData && VNSIData->SupportChannelScan())
1eb039e @opdenkamp pvr: interface cleanup.
authored
306 pCapabilities->bSupportsChannelScan = true;
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
307 else
1eb039e @opdenkamp pvr: interface cleanup.
authored
308 pCapabilities->bSupportsChannelScan = false;
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
309
310 return PVR_ERROR_NO_ERROR;
311 }
312
1eb039e @opdenkamp pvr: interface cleanup.
authored
313 const char * GetBackendName(void)
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
314 {
2ff979e @pipelka vnsi addon: code cleanup
pipelka authored
315 static std::string BackendName = VNSIData ? VNSIData->GetServerName() : "unknown";
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
316 return BackendName.c_str();
317 }
318
1eb039e @opdenkamp pvr: interface cleanup.
authored
319 const char * GetBackendVersion(void)
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
320 {
2ff979e @pipelka vnsi addon: code cleanup
pipelka authored
321 static std::string BackendVersion;
322 if (VNSIData) {
323 std::stringstream format;
324 format << VNSIData->GetVersion() << "(Protocol: " << VNSIData->GetProtocol() << ")";
325 BackendVersion = format.str();
326 }
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
327 return BackendVersion.c_str();
328 }
329
1eb039e @opdenkamp pvr: interface cleanup.
authored
330 const char * GetConnectionString(void)
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
331 {
2ff979e @pipelka vnsi addon: code cleanup
pipelka authored
332 static std::string ConnectionString;
333 std::stringstream format;
334
335 if (VNSIData) {
66fde2d @pipelka vnsi addon: proper reconnect to VDR server if connection was lost
pipelka authored
336 format << g_szHostname << ":" << g_iPort;
2ff979e @pipelka vnsi addon: code cleanup
pipelka authored
337 }
338 else {
339 format << g_szHostname << ":" << g_iPort << " (addon error!)";
340 }
341 ConnectionString = format.str();
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
342 return ConnectionString.c_str();
343 }
344
1eb039e @opdenkamp pvr: interface cleanup.
authored
345 PVR_ERROR GetDriveSpace(long long *iTotal, long long *iUsed)
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
346 {
5dbca64 @pipelka vnsi addon: review of currently implemented client functions. checked…
pipelka authored
347 if (!VNSIData)
348 return PVR_ERROR_SERVER_ERROR;
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
349
1eb039e @opdenkamp pvr: interface cleanup.
authored
350 return (VNSIData->GetDriveSpace(iTotal, iUsed) ? PVR_ERROR_NO_ERROR : PVR_ERROR_SERVER_ERROR);
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
351 }
352
1eb039e @opdenkamp pvr: interface cleanup.
authored
353 PVR_ERROR DialogChannelScan(void)
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
354 {
355 cVNSIChannelScan scanner;
e269963 @pipelka vnsi addon: data handling cleanup
pipelka authored
356 scanner.Open(g_szHostname, g_iPort);
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
357 return PVR_ERROR_NO_ERROR;
358 }
359
360 /*******************************************/
361 /** PVR EPG Functions **/
362
1eb039e @opdenkamp pvr: interface cleanup.
authored
363 PVR_ERROR GetEPGForChannel(PVR_HANDLE handle, const PVR_CHANNEL &channel, time_t iStart, time_t iEnd)
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
364 {
5dbca64 @pipelka vnsi addon: review of currently implemented client functions. checked…
pipelka authored
365 if (!VNSIData)
366 return PVR_ERROR_SERVER_ERROR;
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
367
1eb039e @opdenkamp pvr: interface cleanup.
authored
368 return (VNSIData->GetEPGForChannel(handle, channel, iStart, iEnd) ? PVR_ERROR_NO_ERROR: PVR_ERROR_SERVER_ERROR);
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
369 }
370
371
372 /*******************************************/
373 /** PVR Channel Functions **/
374
1eb039e @opdenkamp pvr: interface cleanup.
authored
375 int GetChannelsAmount(void)
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
376 {
66fde2d @pipelka vnsi addon: proper reconnect to VDR server if connection was lost
pipelka authored
377 if (!VNSIData)
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
378 return 0;
379
380 return VNSIData->GetChannelsCount();
381 }
382
1eb039e @opdenkamp pvr: interface cleanup.
authored
383 PVR_ERROR GetChannels(PVR_HANDLE handle, bool bRadio)
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
384 {
5dbca64 @pipelka vnsi addon: review of currently implemented client functions. checked…
pipelka authored
385 if (!VNSIData)
386 return PVR_ERROR_SERVER_ERROR;
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
387
1eb039e @opdenkamp pvr: interface cleanup.
authored
388 return (VNSIData->GetChannelsList(handle, bRadio) ? PVR_ERROR_NO_ERROR : PVR_ERROR_SERVER_ERROR);
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
389 }
390
391
392 /*******************************************/
77cd0a1 @pipelka vnsi addon: support for channel groups
pipelka authored
393 /** PVR Channelgroups Functions **/
394
395 int GetChannelGroupsAmount()
396 {
397 if (!VNSIData)
398 return PVR_ERROR_SERVER_ERROR;
399
400 return VNSIData->GetChannelGroupCount(g_bAutoChannelGroups);
401 }
402
403 PVR_ERROR GetChannelGroups(PVR_HANDLE handle, bool bRadio)
404 {
405 if (!VNSIData)
406 return PVR_ERROR_SERVER_ERROR;
407
408 if(VNSIData->GetChannelGroupCount(g_bAutoChannelGroups) > 0)
409 return VNSIData->GetChannelGroupList(handle, bRadio) ? PVR_ERROR_NO_ERROR : PVR_ERROR_SERVER_ERROR;
410
411 return PVR_ERROR_NO_ERROR;
412 }
413
414 PVR_ERROR GetChannelGroupMembers(PVR_HANDLE handle, const PVR_CHANNEL_GROUP &group)
415 {
416 if (!VNSIData)
417 return PVR_ERROR_SERVER_ERROR;
418
419 return VNSIData->GetChannelGroupMembers(handle, group) ? PVR_ERROR_NO_ERROR : PVR_ERROR_SERVER_ERROR;
420 }
421
422
423 /*******************************************/
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
424 /** PVR Timer Functions **/
425
1eb039e @opdenkamp pvr: interface cleanup.
authored
426 int GetTimersAmount(void)
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
427 {
66fde2d @pipelka vnsi addon: proper reconnect to VDR server if connection was lost
pipelka authored
428 if (!VNSIData)
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
429 return 0;
430
431 return VNSIData->GetTimersCount();
432 }
433
1eb039e @opdenkamp pvr: interface cleanup.
authored
434 PVR_ERROR GetTimers(PVR_HANDLE handle)
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
435 {
5dbca64 @pipelka vnsi addon: review of currently implemented client functions. checked…
pipelka authored
436 if (!VNSIData)
437 return PVR_ERROR_SERVER_ERROR;
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
438
5dbca64 @pipelka vnsi addon: review of currently implemented client functions. checked…
pipelka authored
439 return (VNSIData->GetTimersList(handle) ? PVR_ERROR_NO_ERROR : PVR_ERROR_SERVER_ERROR);
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
440 }
441
1eb039e @opdenkamp pvr: interface cleanup.
authored
442 PVR_ERROR AddTimer(const PVR_TIMER &timer)
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
443 {
66fde2d @pipelka vnsi addon: proper reconnect to VDR server if connection was lost
pipelka authored
444 if (!VNSIData)
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
445 return PVR_ERROR_SERVER_ERROR;
446
1eb039e @opdenkamp pvr: interface cleanup.
authored
447 return VNSIData->AddTimer(timer);
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
448 }
449
1eb039e @opdenkamp pvr: interface cleanup.
authored
450 PVR_ERROR DeleteTimer(const PVR_TIMER &timer, bool bForce)
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
451 {
66fde2d @pipelka vnsi addon: proper reconnect to VDR server if connection was lost
pipelka authored
452 if (!VNSIData)
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
453 return PVR_ERROR_SERVER_ERROR;
454
1eb039e @opdenkamp pvr: interface cleanup.
authored
455 return VNSIData->DeleteTimer(timer, bForce);
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
456 }
457
1eb039e @opdenkamp pvr: interface cleanup.
authored
458 PVR_ERROR UpdateTimer(const PVR_TIMER &timer)
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
459 {
66fde2d @pipelka vnsi addon: proper reconnect to VDR server if connection was lost
pipelka authored
460 if (!VNSIData)
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
461 return PVR_ERROR_SERVER_ERROR;
462
1eb039e @opdenkamp pvr: interface cleanup.
authored
463 return VNSIData->UpdateTimer(timer);
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
464 }
465
466
467 /*******************************************/
468 /** PVR Recording Functions **/
469
1eb039e @opdenkamp pvr: interface cleanup.
authored
470 int GetRecordingsAmount(void)
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
471 {
66fde2d @pipelka vnsi addon: proper reconnect to VDR server if connection was lost
pipelka authored
472 if (!VNSIData)
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
473 return 0;
474
475 return VNSIData->GetRecordingsCount();
476 }
477
1eb039e @opdenkamp pvr: interface cleanup.
authored
478 PVR_ERROR GetRecordings(PVR_HANDLE handle)
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
479 {
66fde2d @pipelka vnsi addon: proper reconnect to VDR server if connection was lost
pipelka authored
480 if (!VNSIData)
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
481 return PVR_ERROR_SERVER_ERROR;
482
483 return VNSIData->GetRecordingsList(handle);
484 }
485
1eb039e @opdenkamp pvr: interface cleanup.
authored
486 PVR_ERROR RenameRecording(const PVR_RECORDING &recording)
2a2ca81 @pipelka vnsi addon: added RenameRecording client function
pipelka authored
487 {
488 if (!VNSIData)
489 return PVR_ERROR_SERVER_ERROR;
490
1eb039e @opdenkamp pvr: interface cleanup.
authored
491 return VNSIData->RenameRecording(recording, recording.strTitle);
2a2ca81 @pipelka vnsi addon: added RenameRecording client function
pipelka authored
492 }
493
1eb039e @opdenkamp pvr: interface cleanup.
authored
494 PVR_ERROR DeleteRecording(const PVR_RECORDING &recording)
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
495 {
5dbca64 @pipelka vnsi addon: review of currently implemented client functions. checked…
pipelka authored
496 if (!VNSIData)
497 return PVR_ERROR_SERVER_ERROR;
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
498
1eb039e @opdenkamp pvr: interface cleanup.
authored
499 return VNSIData->DeleteRecording(recording);
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
500 }
501
502 /*******************************************/
503 /** PVR Live Stream Functions **/
504
1eb039e @opdenkamp pvr: interface cleanup.
authored
505 bool OpenLiveStream(const PVR_CHANNEL &channel)
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
506 {
507 CloseLiveStream();
508
509 VNSIDemuxer = new cVNSIDemux;
aaafa5f @pipelka vnsi addon: prevent recursive reconnect tries on "connection lost"
pipelka authored
510 return VNSIDemuxer->OpenChannel(channel);
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
511 }
512
1eb039e @opdenkamp pvr: interface cleanup.
authored
513 void CloseLiveStream(void)
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
514 {
66fde2d @pipelka vnsi addon: proper reconnect to VDR server if connection was lost
pipelka authored
515 if (VNSIDemuxer)
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
516 {
517 VNSIDemuxer->Close();
518 delete VNSIDemuxer;
519 VNSIDemuxer = NULL;
520 }
521 }
522
1eb039e @opdenkamp pvr: interface cleanup.
authored
523 PVR_ERROR GetStreamProperties(PVR_STREAM_PROPERTIES* pProperties)
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
524 {
5dbca64 @pipelka vnsi addon: review of currently implemented client functions. checked…
pipelka authored
525 if (!VNSIDemuxer)
526 return PVR_ERROR_SERVER_ERROR;
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
527
1eb039e @opdenkamp pvr: interface cleanup.
authored
528 return (VNSIDemuxer->GetStreamProperties(pProperties) ? PVR_ERROR_NO_ERROR : PVR_ERROR_SERVER_ERROR);
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
529 }
530
1eb039e @opdenkamp pvr: interface cleanup.
authored
531 void DemuxAbort(void)
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
532 {
66fde2d @pipelka vnsi addon: proper reconnect to VDR server if connection was lost
pipelka authored
533 if (VNSIDemuxer) VNSIDemuxer->Abort();
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
534 }
535
1eb039e @opdenkamp pvr: interface cleanup.
authored
536 DemuxPacket* DemuxRead(void)
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
537 {
66fde2d @pipelka vnsi addon: proper reconnect to VDR server if connection was lost
pipelka authored
538 if (!VNSIDemuxer)
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
539 return NULL;
540
541 return VNSIDemuxer->Read();
542 }
543
1eb039e @opdenkamp pvr: interface cleanup.
authored
544 int GetCurrentClientChannel(void)
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
545 {
66fde2d @pipelka vnsi addon: proper reconnect to VDR server if connection was lost
pipelka authored
546 if (VNSIDemuxer)
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
547 return VNSIDemuxer->CurrentChannel();
548
549 return -1;
550 }
551
1eb039e @opdenkamp pvr: interface cleanup.
authored
552 bool SwitchChannel(const PVR_CHANNEL &channel)
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
553 {
66fde2d @pipelka vnsi addon: proper reconnect to VDR server if connection was lost
pipelka authored
554 if (VNSIDemuxer)
1eb039e @opdenkamp pvr: interface cleanup.
authored
555 return VNSIDemuxer->SwitchChannel(channel);
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
556
557 return false;
558 }
559
1eb039e @opdenkamp pvr: interface cleanup.
authored
560 PVR_ERROR SignalStatus(PVR_SIGNAL_STATUS &signalStatus)
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
561 {
5dbca64 @pipelka vnsi addon: review of currently implemented client functions. checked…
pipelka authored
562 if (!VNSIDemuxer)
563 return PVR_ERROR_SERVER_ERROR;
564
1eb039e @opdenkamp pvr: interface cleanup.
authored
565 return (VNSIDemuxer->GetSignalStatus(signalStatus) ? PVR_ERROR_NO_ERROR : PVR_ERROR_SERVER_ERROR);
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
566
567 }
568
569
570 /*******************************************/
571 /** PVR Recording Stream Functions **/
572
1eb039e @opdenkamp pvr: interface cleanup.
authored
573 bool OpenRecordedStream(const PVR_RECORDING &recording)
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
574 {
66fde2d @pipelka vnsi addon: proper reconnect to VDR server if connection was lost
pipelka authored
575 if(!VNSIData)
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
576 return false;
577
578 CloseRecordedStream();
579
580 VNSIRecording = new cVNSIRecording;
aaafa5f @pipelka vnsi addon: prevent recursive reconnect tries on "connection lost"
pipelka authored
581 return VNSIRecording->OpenRecording(recording);
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
582 }
583
584 void CloseRecordedStream(void)
585 {
66fde2d @pipelka vnsi addon: proper reconnect to VDR server if connection was lost
pipelka authored
586 if (VNSIRecording)
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
587 {
588 VNSIRecording->Close();
589 delete VNSIRecording;
590 VNSIRecording = NULL;
591 }
592 }
593
1eb039e @opdenkamp pvr: interface cleanup.
authored
594 int ReadRecordedStream(unsigned char *pBuffer, unsigned int iBufferSize)
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
595 {
66fde2d @pipelka vnsi addon: proper reconnect to VDR server if connection was lost
pipelka authored
596 if (!VNSIRecording)
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
597 return -1;
598
1eb039e @opdenkamp pvr: interface cleanup.
authored
599 return VNSIRecording->Read(pBuffer, iBufferSize);
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
600 }
601
1eb039e @opdenkamp pvr: interface cleanup.
authored
602 long long SeekRecordedStream(long long iPosition, int iWhence /* = SEEK_SET */)
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
603 {
66fde2d @pipelka vnsi addon: proper reconnect to VDR server if connection was lost
pipelka authored
604 if (VNSIRecording)
1eb039e @opdenkamp pvr: interface cleanup.
authored
605 return VNSIRecording->Seek(iPosition, iWhence);
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
606
607 return -1;
608 }
609
610 long long PositionRecordedStream(void)
611 {
66fde2d @pipelka vnsi addon: proper reconnect to VDR server if connection was lost
pipelka authored
612 if (VNSIRecording)
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
613 return VNSIRecording->Position();
614
615 return 0;
616 }
617
618 long long LengthRecordedStream(void)
619 {
66fde2d @pipelka vnsi addon: proper reconnect to VDR server if connection was lost
pipelka authored
620 if (VNSIRecording)
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
621 return VNSIRecording->Length();
622
623 return 0;
624 }
625
626 /** UNUSED API FUNCTIONS */
1eb039e @opdenkamp pvr: interface cleanup.
authored
627 PVR_ERROR CallMenuHook(const PVR_MENUHOOK &menuhook) { return PVR_ERROR_NOT_IMPLEMENTED; }
628 PVR_ERROR DeleteChannel(const PVR_CHANNEL &channel) { return PVR_ERROR_NOT_IMPLEMENTED; }
629 PVR_ERROR RenameChannel(const PVR_CHANNEL &channel) { return PVR_ERROR_NOT_IMPLEMENTED; }
630 PVR_ERROR MoveChannel(const PVR_CHANNEL &channel) { return PVR_ERROR_NOT_IMPLEMENTED; }
631 PVR_ERROR DialogChannelSettings(const PVR_CHANNEL &channel) { return PVR_ERROR_NOT_IMPLEMENTED; }
632 PVR_ERROR DialogAddChannel(const PVR_CHANNEL &channel) { return PVR_ERROR_NOT_IMPLEMENTED; }
633 void DemuxReset(void) {}
634 void DemuxFlush(void) {}
635 int ReadLiveStream(unsigned char *pBuffer, unsigned int iBufferSize) { return 0; }
636 long long SeekLiveStream(long long iPosition, int iWhence /* = SEEK_SET */) { return -1; }
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
637 long long PositionLiveStream(void) { return -1; }
638 long long LengthLiveStream(void) { return -1; }
1eb039e @opdenkamp pvr: interface cleanup.
authored
639 const char * GetLiveStreamURL(const PVR_CHANNEL &channel) { return ""; }
414983a @opdenkamp Fix my git's f*ckup in upstream/master.
authored
640
641 }
Something went wrong with that request. Please try again.