2004-12-30 23:43:55 +01:00
|
|
|
/*
|
2010-06-08 07:55:16 +02:00
|
|
|
* $Id: setup.c,v 1.10 2010/06/08 05:55:17 schmirl Exp $
|
2004-12-30 23:43:55 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <vdr/menuitems.h>
|
|
|
|
|
|
|
|
#include "client/setup.h"
|
2013-01-29 00:02:17 +01:00
|
|
|
#include "client/streamdev-client.h"
|
2004-12-30 23:43:55 +01:00
|
|
|
|
2012-04-21 22:28:58 +02:00
|
|
|
#ifndef MINPRIORITY
|
|
|
|
#define MINPRIORITY -MAXPRIORITY
|
|
|
|
#endif
|
|
|
|
|
2004-12-30 23:43:55 +01:00
|
|
|
cStreamdevClientSetup StreamdevClientSetup;
|
|
|
|
|
|
|
|
cStreamdevClientSetup::cStreamdevClientSetup(void) {
|
|
|
|
StartClient = false;
|
|
|
|
RemotePort = 2004;
|
2012-03-03 23:24:30 +01:00
|
|
|
Timeout = 2;
|
2004-12-30 23:43:55 +01:00
|
|
|
StreamFilters = false;
|
2008-04-07 16:50:32 +02:00
|
|
|
HideMenuEntry = false;
|
2012-03-04 01:15:40 +01:00
|
|
|
LivePriority = 0;
|
2012-04-21 22:28:58 +02:00
|
|
|
MinPriority = MINPRIORITY;
|
2009-01-29 08:48:58 +01:00
|
|
|
MaxPriority = MAXPRIORITY;
|
2011-02-16 08:57:05 +01:00
|
|
|
#if APIVERSNUM >= 10700
|
|
|
|
NumProvidedSystems = 1;
|
|
|
|
#endif
|
2004-12-30 23:43:55 +01:00
|
|
|
strcpy(RemoteIp, "");
|
|
|
|
}
|
|
|
|
|
|
|
|
bool cStreamdevClientSetup::SetupParse(const char *Name, const char *Value) {
|
|
|
|
if (strcmp(Name, "StartClient") == 0) StartClient = atoi(Value);
|
|
|
|
else if (strcmp(Name, "RemoteIp") == 0) {
|
|
|
|
if (strcmp(Value, "-none-") == 0)
|
|
|
|
strcpy(RemoteIp, "");
|
|
|
|
else
|
|
|
|
strcpy(RemoteIp, Value);
|
|
|
|
}
|
|
|
|
else if (strcmp(Name, "RemotePort") == 0) RemotePort = atoi(Value);
|
2012-03-03 23:24:30 +01:00
|
|
|
else if (strcmp(Name, "Timeout") == 0) Timeout = atoi(Value);
|
2004-12-30 23:43:55 +01:00
|
|
|
else if (strcmp(Name, "StreamFilters") == 0) StreamFilters = atoi(Value);
|
2008-04-07 16:50:32 +02:00
|
|
|
else if (strcmp(Name, "HideMenuEntry") == 0) HideMenuEntry = atoi(Value);
|
2012-03-04 01:15:40 +01:00
|
|
|
else if (strcmp(Name, "LivePriority") == 0) LivePriority = atoi(Value);
|
2009-02-03 11:26:21 +01:00
|
|
|
else if (strcmp(Name, "MinPriority") == 0) MinPriority = atoi(Value);
|
|
|
|
else if (strcmp(Name, "MaxPriority") == 0) MaxPriority = atoi(Value);
|
2011-05-16 08:46:17 +02:00
|
|
|
#if APIVERSNUM >= 10700
|
2011-02-16 08:57:05 +01:00
|
|
|
else if (strcmp(Name, "NumProvidedSystems") == 0) NumProvidedSystems = atoi(Value);
|
2011-05-16 08:46:17 +02:00
|
|
|
#endif
|
2004-12-30 23:43:55 +01:00
|
|
|
else return false;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2013-01-29 00:02:17 +01:00
|
|
|
cStreamdevClientMenuSetupPage::cStreamdevClientMenuSetupPage(cPluginStreamdevClient *Plugin) {
|
|
|
|
m_Plugin = Plugin;
|
2004-12-30 23:43:55 +01:00
|
|
|
m_NewSetup = StreamdevClientSetup;
|
|
|
|
|
2009-09-18 12:41:41 +02:00
|
|
|
Add(new cMenuEditBoolItem(tr("Hide Mainmenu Entry"), &m_NewSetup.HideMenuEntry));
|
2013-01-29 00:02:17 +01:00
|
|
|
Add(new cMenuEditIntItem (tr("Simultaneously used Devices"), &m_NewSetup.StartClient, 0, STREAMDEV_MAXDEVICES));
|
2009-09-18 12:41:41 +02:00
|
|
|
Add(new cMenuEditIpItem (tr("Remote IP"), m_NewSetup.RemoteIp));
|
|
|
|
Add(new cMenuEditIntItem (tr("Remote Port"), &m_NewSetup.RemotePort, 0, 65535));
|
2012-03-03 23:24:30 +01:00
|
|
|
Add(new cMenuEditIntItem (tr("Timeout (s)"), &m_NewSetup.Timeout, 1, 15));
|
2009-09-18 12:41:41 +02:00
|
|
|
Add(new cMenuEditBoolItem(tr("Filter Streaming"), &m_NewSetup.StreamFilters));
|
2012-04-21 22:28:58 +02:00
|
|
|
Add(new cMenuEditIntItem (tr("Live TV Priority"), &m_NewSetup.LivePriority, MINPRIORITY, MAXPRIORITY));
|
|
|
|
Add(new cMenuEditIntItem (tr("Minimum Priority"), &m_NewSetup.MinPriority, MINPRIORITY, MAXPRIORITY));
|
|
|
|
Add(new cMenuEditIntItem (tr("Maximum Priority"), &m_NewSetup.MaxPriority, MINPRIORITY, MAXPRIORITY));
|
2011-02-16 08:57:05 +01:00
|
|
|
#if APIVERSNUM >= 10715
|
|
|
|
Add(new cMenuEditIntItem (tr("Broadcast Systems / Cost"), &m_NewSetup.NumProvidedSystems, 1, 15));
|
|
|
|
#elif APIVERSNUM >= 10700
|
|
|
|
Add(new cMenuEditIntItem (tr("Broadcast Systems / Cost"), &m_NewSetup.NumProvidedSystems, 1, 4));
|
|
|
|
#endif
|
2004-12-30 23:43:55 +01:00
|
|
|
SetCurrent(Get(0));
|
|
|
|
}
|
|
|
|
|
|
|
|
cStreamdevClientMenuSetupPage::~cStreamdevClientMenuSetupPage() {
|
|
|
|
}
|
|
|
|
|
|
|
|
void cStreamdevClientMenuSetupPage::Store(void) {
|
|
|
|
SetupStore("StartClient", m_NewSetup.StartClient);
|
|
|
|
if (strcmp(m_NewSetup.RemoteIp, "") == 0)
|
|
|
|
SetupStore("RemoteIp", "-none-");
|
|
|
|
else
|
|
|
|
SetupStore("RemoteIp", m_NewSetup.RemoteIp);
|
|
|
|
SetupStore("RemotePort", m_NewSetup.RemotePort);
|
2012-03-03 23:24:30 +01:00
|
|
|
SetupStore("Timeout", m_NewSetup.Timeout);
|
2004-12-30 23:43:55 +01:00
|
|
|
SetupStore("StreamFilters", m_NewSetup.StreamFilters);
|
2008-04-07 16:50:32 +02:00
|
|
|
SetupStore("HideMenuEntry", m_NewSetup.HideMenuEntry);
|
2012-03-04 01:15:40 +01:00
|
|
|
SetupStore("LivePriority", m_NewSetup.LivePriority);
|
2009-01-29 08:48:58 +01:00
|
|
|
SetupStore("MinPriority", m_NewSetup.MinPriority);
|
|
|
|
SetupStore("MaxPriority", m_NewSetup.MaxPriority);
|
2011-05-16 08:46:17 +02:00
|
|
|
#if APIVERSNUM >= 10700
|
2011-02-16 08:57:05 +01:00
|
|
|
SetupStore("NumProvidedSystems", m_NewSetup.NumProvidedSystems);
|
2011-05-16 08:46:17 +02:00
|
|
|
#endif
|
2004-12-30 23:43:55 +01:00
|
|
|
|
|
|
|
StreamdevClientSetup = m_NewSetup;
|
|
|
|
|
2013-01-29 00:02:17 +01:00
|
|
|
m_Plugin->Initialize();
|
2004-12-30 23:43:55 +01:00
|
|
|
}
|
|
|
|
|