/*
 * pvr350.c: A plugin for the Video Disk Recorder
 *
 * See the README file for copyright information and how to reach the author.
 *
 * $Id: pvr350.c,v 1.9 2007/01/02 20:00:00 dom Exp $
 */

#include <vdr/plugin.h>
#include "pvr350device.h"
#include "pvr350menu.h"
#include "pvr350.h"
#if VDRVERSNUM < 10507
#include "po/i18n.h"
#endif //VDRVERSNUM < 10507

static const char *VERSION        = "2008-09-07";
#if VDRVERSNUM < 10507
static const char *DESCRIPTION    = "An output device for the PVR350";
#else
static const char *DESCRIPTION    = trNOOP("An output device for the PVR350");
#endif

cPluginPvr350::cPluginPvr350(void)
{
  // Initialize any member variables here.
  // DON'T DO ANYTHING ELSE THAT MAY HAVE SIDE EFFECTS, REQUIRE GLOBAL
  // VDR OBJECTS TO EXIST OR PRODUCE ANY OUTPUT!
}

cPluginPvr350::~cPluginPvr350()
{
  // Clean up after yourself!
}

const char * cPluginPvr350::Version(void) {
  return VERSION;
}

const char * cPluginPvr350::Description(void) {
  return tr(DESCRIPTION);
}

const char *cPluginPvr350::CommandLineHelp(void)
{
  // Return a string that describes all known command line options.
  return NULL;
}

bool cPluginPvr350::ProcessArgs(int argc, char *argv[])
{
  // Implement command line argument processing here if applicable.
  return true;
}

bool cPluginPvr350::Initialize(void)
{
  // Initialize any background activities the plugin shall perform.
#if VDRVERSNUM < 10507
  RegisterI18n(pvr350_Phrases); 
#endif //VDRVERSNUM < 10507
  new cPvr350Device();
  return true;
}

bool cPluginPvr350::Start(void)
{
  // Start any background activities the plugin shall perform.
  return true;
}

void cPluginPvr350::Housekeeping(void)
{
  // Perform any cleanup or other regular tasks.
}

cMenuSetupPage * cPluginPvr350::SetupMenu(void)
{
  return new cPvr350MenuSetup();
}

bool cPluginPvr350::SetupParse(const char *Name, const char *Value)
{
  if      (!strcasecmp(Name, "LogLevel"))                Pvr350Setup.LogLevel              = atoi(Value);
  else if (!strcasecmp(Name, "UseWssBits"))              Pvr350Setup.UseWssBits            = atoi(Value);
  else if (!strcasecmp(Name, "WSS_16:9_for_pmExtern"))   Pvr350Setup.WSS_169_for_pmExtern  = atoi(Value);
  else if (!strcasecmp(Name, "DeviceNumber"))            Pvr350Setup.DeviceNumber          = atoi(Value);
  else if (!strcasecmp(Name, "AC3Gain"))                 Pvr350Setup.AC3Gain               = atoi(Value);
  else
    return false;
  return true;
}

VDRPLUGINCREATOR(cPluginPvr350); // Don't touch this!
