vdr/PLUGINS/SRC/hello/hello.c
Klaus Schmidinger f06d2c27fc Version 1.1.3
- Improved the VDR Makefile to avoid a warning if the '.dependencies' file does
  not exist, and also using $(MAKE) to call recursive makes.
- Changed the name of the 'package' target in the plugin Makefiles to 'dist'
  (following the suggestions in the "GNU Make" manual). If you already have started
  a plugin project, you may want to change this in your Makefile accordingly.
- Improved the plugin Makefile to avoid a warning if the '.dependencies' file does
  not exist, and also using $(shell...) to get the version numbers. If you already have
  started a plugin project, you may want to change this in your Makefile accordingly.
- Fixed some function headers to make them compile with gcc 3.x (thanks to
  Gregoire Favre).
- Fixed the cutting mechanism to make it re-sync in case a frame is larger than the
  buffer (thanks to Sven Grothklags).
- Added an error message if the directory specified in the '-L' option can't be
  accessed (suggested by Stefan Huelswitt).
- Rearranged OSD class names to make 'cOsd' available for the main OSD interface.
- Completely moved OSD handling out of the cDvbApi class, into the new cOsd.
- Implemented cStatus to allow plugins to set up a status monitor.
  See PLUGINS.html for details.
- Moved the cEITScanner out of dvbapi.h/.c, into the new eitscan.h/.c.
- Added Swedish language texts (thanks to Tomas Prybil).
- Fixed parsing 'E' records in epg2html.pl (thanks to Matthias Fechner for pointing
  out this one).
- Removed compiler option '-m486' to make it work on non-Intel platforms. If you
  have already started a plugin project, you may want to make sure you remove this
  option from your existing Makefile.
- Completely rearranged the recording and replay functions to make them available
  to plugins.
- Replay is now done in a single thread (no more syncing between input and output
  thread necessary).
- It is now possible to record several channels on the same transponder with "budget
  cards". VDR automatically attaches a recording timer to a card that already
  records on the appropriate transponder. How many parallel recordings can actually
  be done depends on the computer's performance. Currently any number of recordings
  gets attached to a card, so you should carefully plan your timers to not exceed
  the limit. On a K6-II/450 it was possible to record three channels from transponder
  12480 with a single WinTV NOVA-S.
- Timers that record two successive shows on the same channel may now overlap and
  will use the same DVB card. During the time where both timers record the data
  is simply saved to both files.
- The following limitations apply to this version:
  + Transfer mode doesn't work yet.
  + The '-a' option (for Dolby Digital audio) doesn't work yet.
  + Switching between different language tracks doesn't work yet.
  + Cutting doesn't work yet.
2002-06-16 18:00:00 +02:00

150 lines
4.1 KiB
C

/*
* hello.c: A plugin for the Video Disk Recorder
*
* See the README file for copyright information and how to reach the author.
*
* $Id: hello.c 1.5 2002/05/14 21:23:25 kls Exp $
*/
#include <getopt.h>
#include <vdr/interface.h>
#include <vdr/plugin.h>
#include "i18n.h"
static const char *VERSION = "0.0.4";
static const char *DESCRIPTION = "A friendly greeting";
static const char *MAINMENUENTRY = "Hello";
class cPluginHello : public cPlugin {
private:
// Add any member variables or functions you may need here.
const char *option_a;
bool option_b;
public:
cPluginHello(void);
virtual ~cPluginHello();
virtual const char *Version(void) { return VERSION; }
virtual const char *Description(void) { return tr(DESCRIPTION); }
virtual const char *CommandLineHelp(void);
virtual bool ProcessArgs(int argc, char *argv[]);
virtual bool Start(void);
virtual void Housekeeping(void);
virtual const char *MainMenuEntry(void) { return tr(MAINMENUENTRY); }
virtual cOsdMenu *MainMenuAction(void);
virtual cMenuSetupPage *SetupMenu(void);
virtual bool SetupParse(const char *Name, const char *Value);
};
// Global variables that control the overall behaviour:
int GreetingTime = 3;
int UseAlternateGreeting = false;
// --- cMenuSetupHello -------------------------------------------------------
class cMenuSetupHello : public cMenuSetupPage {
private:
int newGreetingTime;
int newUseAlternateGreeting;
protected:
virtual void Store(void);
public:
cMenuSetupHello(void);
};
cMenuSetupHello::cMenuSetupHello(void)
{
newGreetingTime = GreetingTime;
newUseAlternateGreeting = UseAlternateGreeting;
Add(new cMenuEditIntItem( tr("Greeting time (s)"), &newGreetingTime));
Add(new cMenuEditBoolItem(tr("Use alternate greeting"), &newUseAlternateGreeting));
}
void cMenuSetupHello::Store(void)
{
SetupStore("GreetingTime", GreetingTime = newGreetingTime);
SetupStore("UseAlternateGreeting", UseAlternateGreeting = newUseAlternateGreeting);
}
// --- cPluginHello ----------------------------------------------------------
cPluginHello::cPluginHello(void)
{
// Initialize any member varaiables here.
// DON'T DO ANYTHING ELSE THAT MAY HAVE SIDE EFFECTS, REQUIRE GLOBAL
// VDR OBJECTS TO EXIST OR PRODUCE ANY OUTPUT!
option_a = NULL;
option_b = false;
}
cPluginHello::~cPluginHello()
{
// Clean up after yourself!
}
const char *cPluginHello::CommandLineHelp(void)
{
// Return a string that describes all known command line options.
return " -a ABC, --aaa=ABC do something nice with ABC\n"
" -b, --bbb activate 'plan B'\n";
}
bool cPluginHello::ProcessArgs(int argc, char *argv[])
{
// Implement command line argument processing here if applicable.
static struct option long_options[] = {
{ "aaa", required_argument, NULL, 'a' },
{ "bbb", no_argument, NULL, 'b' },
{ NULL }
};
int c;
while ((c = getopt_long(argc, argv, "a:b", long_options, NULL)) != -1) {
switch (c) {
case 'a': option_a = optarg;
break;
case 'b': option_b = true;
break;
default: return false;
}
}
return true;
}
bool cPluginHello::Start(void)
{
// Start any background activities the plugin shall perform.
RegisterI18n(Phrases);
return true;
}
void cPluginHello::Housekeeping(void)
{
// Perform any cleanup or other regular tasks.
}
cOsdMenu *cPluginHello::MainMenuAction(void)
{
// Perform the action when selected from the main VDR menu.
Interface->Confirm(UseAlternateGreeting ? tr("Howdy folks!") : tr("Hello world!"), GreetingTime);
return NULL;
}
cMenuSetupPage *cPluginHello::SetupMenu(void)
{
// Return a setup menu in case the plugin supports one.
return new cMenuSetupHello;
}
bool cPluginHello::SetupParse(const char *Name, const char *Value)
{
// Parse your own setup parameters and store their values.
if (!strcasecmp(Name, "GreetingTime")) GreetingTime = atoi(Value);
else if (!strcasecmp(Name, "UseAlternateGreeting")) UseAlternateGreeting = atoi(Value);
else
return false;
return true;
}
VDRPLUGINCREATOR(cPluginHello); // Don't touch this!