From f06d2c27fca449148d9d8fac19d81c668744f170 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 16 Jun 2002 18:00:00 +0200 Subject: 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. --- PLUGINS.html | 125 +++++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 108 insertions(+), 17 deletions(-) (limited to 'PLUGINS.html') diff --git a/PLUGINS.html b/PLUGINS.html index 4cc27da..9b5a496 100644 --- a/PLUGINS.html +++ b/PLUGINS.html @@ -4,7 +4,7 @@ -

The VDR Plugin System

+

The VDR Plugin System

VDR provides an easy to use plugin interface that allows additional functionality to be added to the program by implementing a dynamically loadable library file. @@ -12,18 +12,30 @@ This interface allows programmers to develop additional functionality for VDR co separate from the core VDR source, without the need of patching the original VDR code (and all the problems of correlating various patches).

-This document describes the "outside" interface of the plugin system. -It handles everything necessary for a plugin to get hooked into the core +
  +This document is divided into two parts, the first one describing the +outside interface +of the plugin system, and the second one describing the +inside interface. +The outside interface handles everything necessary for a plugin to get hooked into the core VDR program and present itself to the user. +The inside interface provides the plugin code access to VDR's internal data +structures and allows it to hook itself into specific areas to perform special actions. +

-
  +
  Important modifications introduced in version 1.1.1 are marked like this.
-
  +
  Important modifications introduced in version 1.1.2 are marked like this.
+
  +Important modifications introduced in version 1.1.3 are marked like this. +
+

Part I - The Outside Interface

+

Quick start

Can't wait, can't wait!

@@ -117,7 +129,7 @@ from the web, it will typically have a name like

and will unpack into a directory named

-
  +
  hello-0.0.1

@@ -125,7 +137,7 @@ To use the plugins and plugins-clean targets from the VDR you need to unpack such an archive into the VDR/PLUGINS/SRC directory and create a symbolic link with the basic plugin name, as in -
  +
 


ln -s hello-0.0.1 hello

@@ -191,7 +203,7 @@ its memory. You don't need to worry about the details behind all this. If your plugin requires additional source files, simply add them to your plugin's source directory and adjust the Makefile accordingly.

-
  +
  Header files usually contain preprocessor statements that prevent the same file (or rather its contents, to be precise) from being included more than once, like @@ -410,7 +422,7 @@ If a plugin implements a function that runs in the background (presumably in a thread of its own), or wants to make use of internationalization, it needs to implement the function -
  +
 


virtual bool Start(void);

@@ -422,7 +434,7 @@ its task. This may, for instance, be a thread that collects data from the DVB stream, which is later presented to the user via a function that is available from the main menu.

-
  +
  A return value of false indicates that something has gone wrong and the plugin will not be able to perform its task. In that case, the plugin should write a proper error message to the log file. The first plugin that returns @@ -486,7 +498,7 @@ interaction is possible. If a specific action takes longer than a few seconds, the plugin should launch a separate thread to do this. -
  +
 

Housekeeping

Chores, chores...

@@ -533,7 +545,7 @@ previously stored in the global setup data (see below). It shall return true if the parameter was parsed correctly, false in case of an error. If false is returned, an error message will be written to the log file (and program execution will continue). -
  +
  A possible implementation of SetupParse() could look like this:


@@ -588,7 +600,7 @@ needs setup parameters that are not directly user adjustable. It can use SetupStore() and SetupParse() without presenting these parameters to the user. -
  +
 

The Setup menu

Have it your way!

@@ -648,7 +660,7 @@ your setup parameters and use that one to copy all parameters with one single st (like VDR does with its cSetup class).

-
  +
 

Configuration files

I want my own stuff!

@@ -815,16 +827,18 @@ and display their help and/or version information in addition to its own output. If you want to make your plugin available to other VDR users, you'll need to make a package that can be easily distributed. +
  The Makefile that has been created by the call to newplugin -provides the target package, which does this for you. +provides the target dist, which does this for you.

-Simply change into your source directory and execute make package: +Simply change into your source directory and execute make dist:


cd VDR/PLUGINS/SRC/hello -make package +make dist

+

After this you should find a file named like @@ -835,5 +849,82 @@ vdr-hello-0.0.1.tgz in your source directory, where hello will be replaced with your actual plugin's name, and 0.0.1 will be your plugin's current version number. +
  +

Part II - The Inside Interface

+ +

Status monitor

+ +
A piece of the action

+ +If a plugin wants to get informed on various events in VDR, it can derive a class from +cStatus, as in + +


+#include <vdr/status.h> + +class cMyStatusMonitor : public cStatus { +protected: + virtual void ChannelSwitch(const cDevice *Device, int ChannelNumber); + }; + +void cMyStatusMonitor::ChannelSwitch(const cDevice *Device, int ChannelNumber) +{ + if (ChannelNumber) + dsyslog("channel switched to %d on DVB %d", ChannelNumber, Device->CardIndex()); + else + dsyslog("about to switch channel on DVB %d", Device->CardIndex()); +} +

+ +An object of this class will be informed whenever the channel is switched on one of +the DVB devices. It could be used in a plugin like this: + +


+#include <vdr/plugin.h> + +class cPluginStatus : public cPlugin { +private: + cMyStatusMonitor *statusMonitor; +public: + cPluginStatus(void); + virtual ~cPluginStatus(); + ... + virtual bool Start(void); + ... + }; + +cPluginStatus::cPluginStatus(void) +{ + statusMonitor = NULL; +} + +cPluginStatus::~cPluginStatus() +{ + delete statusMonitor; +} + +bool cPluginStatus::Start(void) +{ + statusMonitor = new cMyStatusMonitor; + return true; +} +

+ +Note that the actual object is created in the Start() function, not in the +constructor! It is also important to delete the object in the destructor, in order to +avoid memory leaks. +

+A Plugin can implement any number of cStatus derived objects, and once +the plugin has been started it may create and delete them as necessary. +No further action apart from creating an object derived from cStatus +is necessary. VDR will automatically hook it into a list of status monitors, with +their individual virtual member functions being called in the same sequence as the +objects were created. +

+See the file status.h for detailed information on which status monitor +member functions are available in cStatus. You only need to implement +the functions you actually want to use. +

+ -- cgit v1.2.3