vdr-plugin-streamdev/streamdev-server.c
schmirl 7c300e2a12 Cache translation in cPluginStreamdevServer::Active() as this method
may be called very often. Though tr() is not producing too much overhead
it is not neglectible either. If the actual translation is missing,
the resulting syslog messages will become annoying.

Note that the current OSD language is not monitored. Changes won't be
reflected until the next restart.

Thanks to Urig for the patch (#197).
2006-11-24 11:45:36 +00:00

93 lines
2.2 KiB
C

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