2004-12-30 23:43:55 +01:00
|
|
|
/*
|
|
|
|
* streamdev.c: A plugin for the Video Disk Recorder
|
|
|
|
*
|
|
|
|
* See the README file for copyright information and how to reach the author.
|
|
|
|
*
|
2006-11-24 12:45:36 +01:00
|
|
|
* $Id: streamdev-server.c,v 1.4 2006/11/24 11:45:36 schmirl Exp $
|
2004-12-30 23:43:55 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "streamdev-server.h"
|
|
|
|
#include "server/setup.h"
|
|
|
|
#include "server/server.h"
|
|
|
|
#include "server/suspend.h"
|
|
|
|
#include "i18n.h"
|
|
|
|
|
|
|
|
const char *cPluginStreamdevServer::DESCRIPTION = "VDR Streaming Server";
|
|
|
|
|
2005-05-09 22:22:29 +02:00
|
|
|
cPluginStreamdevServer::cPluginStreamdevServer(void)
|
|
|
|
{
|
2004-12-30 23:43:55 +01:00
|
|
|
}
|
|
|
|
|
2005-05-09 22:22:29 +02:00
|
|
|
cPluginStreamdevServer::~cPluginStreamdevServer()
|
|
|
|
{
|
2004-12-30 23:43:55 +01:00
|
|
|
}
|
|
|
|
|
2005-05-09 22:22:29 +02:00
|
|
|
const char *cPluginStreamdevServer::Description(void)
|
|
|
|
{
|
2004-12-30 23:43:55 +01:00
|
|
|
return tr(DESCRIPTION);
|
|
|
|
}
|
|
|
|
|
2005-05-09 22:22:29 +02:00
|
|
|
bool cPluginStreamdevServer::Start(void)
|
|
|
|
{
|
2004-12-30 23:43:55 +01:00
|
|
|
i18n_name = Name();
|
|
|
|
RegisterI18n(Phrases);
|
|
|
|
|
2005-05-09 22:22:29 +02:00
|
|
|
if (!StreamdevHosts.Load(STREAMDEVHOSTSPATH, true, true)) {
|
|
|
|
esyslog("streamdev-server: error while loading %s", STREAMDEVHOSTSPATH);
|
2004-12-30 23:43:55 +01:00
|
|
|
fprintf(stderr, "streamdev-server: error while loading %s\n");
|
2005-05-09 22:22:29 +02:00
|
|
|
if (access(STREAMDEVHOSTSPATH, F_OK) != 0) {
|
2004-12-30 23:43:55 +01:00
|
|
|
fprintf(stderr, " Please install streamdevhosts.conf into the path "
|
|
|
|
"printed above. Without it\n"
|
2005-05-09 22:22:29 +02:00
|
|
|
" no client will be able to access your streaming-"
|
|
|
|
"server. An example can be\n"
|
|
|
|
" found together with this plugin's sources.\n");
|
|
|
|
}
|
2004-12-30 23:43:55 +01:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2005-05-09 22:22:29 +02:00
|
|
|
cStreamdevServer::Initialize();
|
2004-12-30 23:43:55 +01:00
|
|
|
|
2005-05-09 22:22:29 +02:00
|
|
|
return true;
|
2004-12-30 23:43:55 +01:00
|
|
|
}
|
|
|
|
|
2005-05-09 22:22:29 +02:00
|
|
|
void cPluginStreamdevServer::Stop(void)
|
|
|
|
{
|
|
|
|
cStreamdevServer::Destruct();
|
|
|
|
}
|
|
|
|
|
2006-07-05 22:36:58 +02:00
|
|
|
cString cPluginStreamdevServer::Active(void)
|
2005-05-09 22:22:29 +02:00
|
|
|
{
|
2006-07-05 22:36:58 +02:00
|
|
|
if (cStreamdevServer::Active())
|
|
|
|
{
|
2006-11-24 12:45:36 +01:00
|
|
|
static const char *Message = NULL;
|
|
|
|
if (!Message) Message = tr("Streaming active");
|
|
|
|
return Message;
|
2006-07-05 22:36:58 +02:00
|
|
|
}
|
|
|
|
return NULL;
|
2004-12-30 23:43:55 +01:00
|
|
|
}
|
|
|
|
|
2005-05-09 22:22:29 +02:00
|
|
|
const char *cPluginStreamdevServer::MainMenuEntry(void)
|
|
|
|
{
|
2004-12-30 23:43:55 +01:00
|
|
|
if (StreamdevServerSetup.SuspendMode == smOffer && !cSuspendCtl::IsActive())
|
|
|
|
return tr("Suspend Live TV");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2005-05-09 22:22:29 +02:00
|
|
|
cOsdObject *cPluginStreamdevServer::MainMenuAction(void)
|
|
|
|
{
|
2004-12-30 23:43:55 +01:00
|
|
|
cControl::Launch(new cSuspendCtl);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2005-05-09 22:22:29 +02:00
|
|
|
cMenuSetupPage *cPluginStreamdevServer::SetupMenu(void)
|
|
|
|
{
|
|
|
|
return new cStreamdevServerMenuSetupPage;
|
2004-12-30 23:43:55 +01:00
|
|
|
}
|
|
|
|
|
2005-05-09 22:22:29 +02:00
|
|
|
bool cPluginStreamdevServer::SetupParse(const char *Name, const char *Value)
|
|
|
|
{
|
|
|
|
return StreamdevServerSetup.SetupParse(Name, Value);
|
2004-12-30 23:43:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
VDRPLUGINCREATOR(cPluginStreamdevServer); // Don't touch this!
|