From c84022554aaacc9b1c3d9627501cdbb8276871f6 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 11 May 2003 18:00:00 +0200 Subject: Version 1.1.31 - Introduced the new function cPlugin::Initialize(), in order to be able to separate the startup of a plugin into an "early" (Initialize()) and "late" (Start()) phase (suggested by Andreas Schultz). Plugin authors should please read the section about "Getting started" in PLUGINS.html and adapt their code if applicable. - Implemented the CableDeliverySystemDescriptor and TerrestrialDeliverySystemDescriptor in libdtv (thanks to Sven Grothklags and Andreas Schultz). - Fixed keeping live video active in case the primary device doesn't have an MPEG decoder (thanks to Wolfgang Goeller for reporting this one). - Implemented cDevice::ActualDevice(), which returns the actual receiving device in case of 'Transfer Mode', or the primary device otherwise. This may be useful for plugins that want to attach a cReceiver to the device where the current live video is actually coming from. - Added VDRVERSNUM to config.h, which can be used by the preprocessor to check the actual VDR version (suggested by Stefan Huelswitt). - Removed the WaitForPut/WaitForGet stuff from cRingBuffer, since it appears to no longer be necessary due to the implementation of cNonBlockingFileReader in dvbplayer.c. Also, the long timeout in WaitForPut caused problems with cReceivers that use a ring buffer and didn't immediately return from their Receive() function if the buffer runs full (thanks to Sascha Volkenandt for reporting this one). - Fixed handling EPG data where the "extended event descriptor" comes before the "short event" or a "time shifted event" (thanks to Jonan Santiago). - Disabled the "Received stuffing section in EIT" log message. - Updated 'channels.conf.terr' for Berlin (thanks to Juri Haberland). - Avoiding short display of the "Main" menu when pressing the "Recordings" button or the "Back" button during replay. - Further increased the timeout until an index file is considerd no longer to be written. - Implemented separate PausePriority and PauseLifetime parameters for the recordings created when pausing live video (suggested by Alfred Zastrow). - Changed C++ style comments in libdtv into C style to avoid warnings in gcc 3.x (thanks to Andreas Schultz). --- PLUGINS.html | 76 ++++++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 51 insertions(+), 25 deletions(-) (limited to 'PLUGINS.html') diff --git a/PLUGINS.html b/PLUGINS.html index d6c3776..bd1a0d0 100644 --- a/PLUGINS.html +++ b/PLUGINS.html @@ -21,18 +21,18 @@ VDR program and present itself to the user. The internal 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.14 are marked like this. -
-
  +
  Important modifications introduced in version 1.1.15 are marked like this.
-
  +
  Important modifications introduced in version 1.1.17 are marked like this.
-
  +
  Important modifications introduced in version 1.1.27 are marked like this.
+
  +Important modifications introduced in version 1.1.31 are marked like this. +

Table Of Contents

@@ -283,7 +283,12 @@ virtual ~cPlugin(); The constructor shall initialize any member variables the plugin defines, but must not access any global structures of VDR. It also must not create any threads or other large data structures. These things -are done in the Start() function later. +are done in the +
  +Initialize() or +Start() +
+function later. Constructing a plugin object shall not have any side effects or produce any output, since VDR, for instance, has to create the plugin objects in order to get their command line help - and after that immediately destroys them again. @@ -452,13 +457,28 @@ be shorter than 80 characters. 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 +it needs to implement one of the functions


+
 
+virtual bool Initialize(void);
+
virtual bool Start(void);

-which is called once for each plugin at program startup. +which are called once for each plugin at program startup. +
  +The difference between these two functions is that Initialize() is +called early at program startup, while Start() is called after everything +else has been set up, right before the main program loop is entered. Inside the +Start() function of any plugin it is guaranteed that the Initialize() +functions of all plugins have already been called. For many plugins it probably +doesn't matter which of these functions they implement, but it may be of importance +for, e.g., plugins that implement devices. Such plugins should create their cDevice +derived objects in Initialize(), so that other plugins can use them in their +Start() functions. +
+

Inside this function the plugin must set up everything necessary to perform 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 @@ -467,10 +487,11 @@ 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 -false from its Start() function will cause VDR to exit. +false from its Initialize() or Start() function will cause +VDR to exit.

If the plugin doesn't implement any background functionality or internationalized -texts, it doesn't need to implement this function. +texts, it doesn't need to implement either of these functions.


Main menu entry

@@ -506,7 +527,7 @@ in the call to VDR. If the user selects the main menu entry of a plugin, VDR calls the function -
  +
 


virtual cOsdObject *MainMenuAction(void);

@@ -759,7 +780,8 @@ void RegisterI18n(const tI18nPhrase * const Phrases); to register them with VDR's internationalization mechanism.

-The call to this function must be done in the Start() function of the plugin: +The call to this function must be done in the Initialize() +or Start() function of the plugin:


const tI18nPhrase Phrases[] = { @@ -1022,7 +1044,7 @@ virtual void SetAudioTrack(int Index);

-
  +
  If there is an additional audio track that has to be replayed with external hardware, the player shall call its member function @@ -1178,9 +1200,16 @@ a cDevice:


cMyReceiver *Receiver = new cMyReceiver(123); -cDevice::PrimaryDevice()->AttachReceiver(Receiver); +
  +cDevice::ActualDevice()->AttachReceiver(Receiver); +

+Noteh the use of cDevice::ActualDevice() here, which makes sure that +the receiver is attached to the device that actually receives the current live +video stream (this may be different from the primary device in case of Transfer +Mode). +

If the cReceiver isn't needed any more, it may simply be deleted and will automatically detach itself from the cDevice. @@ -1303,9 +1332,7 @@ The functions to implement replaying capabilites are


virtual bool HasDecoder(void) const; -
  virtual bool CanReplay(void) const; -
virtual bool SetPlayMode(ePlayMode PlayMode); virtual void TrickSpeed(int Speed); virtual void Clear(void); @@ -1345,20 +1372,19 @@ needed.

Initializing new devices

+
  A derived cDevice class shall implement a static function - -


-static bool Initialize(void); -

- in which it determines whether the necessary hardware to run this sort of device is actually present in this machine (or whatever other prerequisites might be important), and then creates as many device objects as necessary. See VDR/dvbdevice.c for the implementation of the cDvbDevice initialize function.

-A plugin that adds devices to a VDR instance shall call this initializing -function from its Start() function. +A plugin that adds devices to a VDR instance shall call this +function from its Initialize() function +to make sure other plugins that may need to have access to all available devices +will see them in their Start() function. +

Nothing needs to be done to shut down the devices. VDR will automatically shut down (delete) all devices when the program terminates. It is therefore @@ -1476,7 +1502,7 @@ the incoming data (by calling your Action() function). In case you need to do any other setup steps, like opening a file or initializing member variables, you should do so before calling Start().

-
  +
  If your remote control for some reason can't work (maybe because it was unable to open some file handle it requires) it can implement the virtual function -- cgit v1.2.3