Added option to suspend live TV when the server starts (closes #1296)

This commit is contained in:
Frank Schmirler 2013-11-02 16:58:17 +01:00
parent 1d4a7e06b4
commit f194ca2074
7 changed files with 45 additions and 6 deletions

View File

@ -1,6 +1,7 @@
VDR Plugin 'streamdev' Revision History
---------------------------------------
- Added option to suspend live TV when the server starts
- Set device occupied when streamdev switches away LiveTV on the server, to
reduce the risk that the VDR main loop immediately switches back, resulting
in a black screen on the client (reported by hummel99)

4
README
View File

@ -218,6 +218,10 @@ image is displayed instead. This would allow a low priority client to switch
to a different transponder. Enable "Client may suspend" in the server setup
to allow VDR clients to suspend live TV remotely.
In the server's setup there's also an option to suspend live TV when starting
the server. The "auto" option will suspend live TV if there's no device with
an MPEG decoder available which is typically the case on a headless server.
NOTE: Precedence is mainly an issue on One-Card-Systems, since with multiple
cards there is no need to switch transponders on the primary interface, if on
of the other cards is idle (i.e. if it is not blocked by a recording). If all

View File

@ -5,9 +5,9 @@
#
msgid ""
msgstr ""
"Project-Id-Version: streamdev 0.5.0\n"
"Report-Msgid-Bugs-To: <http://www.vdr-developer.org/mantisbt/>\n"
"POT-Creation-Date: 2012-03-31 15:06+0200\n"
"Project-Id-Version: streamdev\n"
"Report-Msgid-Bugs-To: <vdrdev@schmirler.de>\n"
"POT-Creation-Date: 2013-11-02 16:55+0100\n"
"PO-Revision-Date: 2008-03-30 02:11+0200\n"
"Last-Translator: Frank Schmirler <vdrdev@schmirler.de>\n"
"Language-Team: German <vdr@linuxtv.org>\n"
@ -16,9 +16,6 @@ msgstr ""
"Content-Type: text/plain; charset=ISO-8859-15\n"
"Content-Transfer-Encoding: 8bit\n"
msgid "VDR Streaming Server"
msgstr "VDR Streaming Server"
msgid "Streaming active"
msgstr "Streamen im Gange"
@ -37,6 +34,9 @@ msgstr "Allgemeines"
msgid "Hide Mainmenu Entry"
msgstr "Hauptmenüeintrag verstecken"
msgid "Start with Live TV suspended"
msgstr "Live-TV beim Start pausieren"
msgid "Maximum Number of Clients"
msgstr "Maximalanzahl an Clients"
@ -87,3 +87,7 @@ msgstr "Port des Multicast Clients"
msgid "Multicast Streamtype"
msgstr "Multicast Streamtyp"
msgid "VDR Streaming Server"
msgstr "VDR Streaming Server"

View File

@ -12,6 +12,7 @@ cStreamdevServerSetup StreamdevServerSetup;
cStreamdevServerSetup::cStreamdevServerSetup(void) {
HideMenuEntry = false;
MaxClients = 5;
StartSuspended = ssAuto;
StartVTPServer = true;
VTPServerPort = 2004;
VTPPriority = 0;
@ -33,6 +34,7 @@ cStreamdevServerSetup::cStreamdevServerSetup(void) {
bool cStreamdevServerSetup::SetupParse(const char *Name, const char *Value) {
if (strcmp(Name, "HideMenuEntry") == 0) HideMenuEntry = atoi(Value);
else if (strcmp(Name, "MaxClients") == 0) MaxClients = atoi(Value);
else if (strcmp(Name, "StartSuspended") == 0) StartSuspended = atoi(Value);
else if (strcmp(Name, "StartServer") == 0) StartVTPServer = atoi(Value);
else if (strcmp(Name, "ServerPort") == 0) VTPServerPort = atoi(Value);
else if (strcmp(Name, "VTPPriority") == 0) VTPPriority = atoi(Value);
@ -71,10 +73,18 @@ cStreamdevServerMenuSetupPage::~cStreamdevServerMenuSetupPage() {
}
void cStreamdevServerMenuSetupPage::Set(void) {
static const char *StartSuspendedItems[ss_Count] =
{
trVDR("no"),
trVDR("yes"),
trVDR("auto")
};
int current = Current();
Clear();
AddCategory (tr("Common Settings"));
Add(new cMenuEditBoolItem(tr("Hide Mainmenu Entry"), &m_NewSetup.HideMenuEntry));
Add(new cMenuEditStraItem(tr("Start with Live TV suspended"), &m_NewSetup.StartSuspended, ss_Count, StartSuspendedItems));
Add(new cMenuEditIntItem (tr("Maximum Number of Clients"), &m_NewSetup.MaxClients, 0, 100));
@ -131,6 +141,7 @@ void cStreamdevServerMenuSetupPage::Store(void) {
SetupStore("HideMenuEntry", m_NewSetup.HideMenuEntry);
SetupStore("MaxClients", m_NewSetup.MaxClients);
SetupStore("StartSuspended", m_NewSetup.StartSuspended);
SetupStore("StartServer", m_NewSetup.StartVTPServer);
SetupStore("ServerPort", m_NewSetup.VTPServerPort);
SetupStore("VTPBindIP", m_NewSetup.VTPBindIP);

View File

@ -7,6 +7,13 @@
#include "common.h"
enum eStartSuspended {
ssNo,
ssYes,
ssAuto,
ss_Count
};
struct cStreamdevServerSetup {
cStreamdevServerSetup(void);
@ -14,6 +21,7 @@ struct cStreamdevServerSetup {
int HideMenuEntry;
int MaxClients;
int StartSuspended;
int StartVTPServer;
int VTPServerPort;
char VTPBindIP[20];

View File

@ -12,6 +12,7 @@
#include "server/menu.h"
#include "server/setup.h"
#include "server/server.h"
#include "server/suspend.h"
#if !defined(APIVERSNUM) || APIVERSNUM < 10725
#error "VDR-1.7.25 or greater required to compile server! Use 'make client' to compile client only."
@ -21,6 +22,7 @@ const char *cPluginStreamdevServer::DESCRIPTION = trNOOP("VDR Streaming Server")
cPluginStreamdevServer::cPluginStreamdevServer(void)
{
m_Suspend = false;
}
cPluginStreamdevServer::~cPluginStreamdevServer()
@ -98,6 +100,9 @@ bool cPluginStreamdevServer::Start(void)
cStreamdevServer::Initialize();
m_Suspend = StreamdevServerSetup.StartSuspended == ssAuto ?
!cDevice::PrimaryDevice()->HasDecoder() :
StreamdevServerSetup.StartSuspended;
return true;
}
@ -129,6 +134,11 @@ cOsdObject *cPluginStreamdevServer::MainMenuAction(void)
void cPluginStreamdevServer::MainThreadHook(void)
{
if (m_Suspend) {
cControl::Launch(new cSuspendCtl);
m_Suspend = false;
}
cThreadLock lock;
const cList<cServerConnection>& clients = cStreamdevServer::Clients(lock);
for (cServerConnection *s = clients.First(); s; s = clients.Next(s))

View File

@ -12,6 +12,7 @@
class cPluginStreamdevServer : public cPlugin {
private:
static const char *DESCRIPTION;
bool m_Suspend;
public:
cPluginStreamdevServer(void);