From 0a517afdf8c4824d2961c477bda753ca81e800db Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 3 Nov 2002 11:53:58 +0100 Subject: Implemented audio plugin interface --- PLUGINS.html | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 65 insertions(+), 13 deletions(-) (limited to 'PLUGINS.html') diff --git a/PLUGINS.html b/PLUGINS.html index e71d8b5a..e5948868 100644 --- a/PLUGINS.html +++ b/PLUGINS.html @@ -21,18 +21,18 @@ 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.11 are marked like this. -
-
  +
  Important modifications introduced in version 1.1.12 are marked like this.
-
  +
  Important modifications introduced in version 1.1.13 are marked like this.
-
  +
  Important modifications introduced in version 1.1.14 are marked like this.
+
  +Important modifications introduced in version 1.1.15 are marked like this. +

Part I - The Outside Interface

@@ -964,7 +964,7 @@ bool DevicePoll(cPoller &Poller, int TimeoutMs = 0);

to determine whether the device is ready for further data. -
  +
 

If the player can provide more than a single audio track, it can implement the following functions to make them available: @@ -977,7 +977,16 @@ virtual void SetAudioTrack(int Index);

-TODO: PlayAudio()??? +
  +If there is an additional audio track that has to be replayed with external hardware, +the player shall call its member function + +


+void PlayAudio(const uchar *Data, int Length); +

+ +where Data points to a complete audio PES packet of Length bytes. +

The second part needed here is a control object that receives user input from the main program loop and reacts on this by telling the player what to do: @@ -1196,7 +1205,7 @@ If the new device can receive, it most likely needs to provide a way of selecting which channel it shall tune to:


-
  +
  virtual bool ProvidesSource(int Source) const;
virtual bool ProvidesChannel(const cChannel *Channel, int Priority = -1, bool *NeedsDetachReceivers = NULL); @@ -1206,7 +1215,7 @@ virtual bool SetChannelDevice(const cChannel *Channel, bool LiveView); These functions will be called with the desired source or channel and shall return whether this device can provide the requested source or channel and whether tuning to it was successful, repectively. -
  +
 

Audio selection

@@ -1253,7 +1262,7 @@ The functions to implement replaying capabilites are


virtual bool HasDecoder(void) const; -
  +
  virtual bool CanReplay(void) const;
virtual bool SetPlayMode(ePlayMode PlayMode); @@ -1315,7 +1324,51 @@ shut down (delete) all devices when the program terminates. It is therefore important that the devices are created on the heap, using the new operator! -
  +
  +

Dolby Digital

+ +
"The stereo effect may only be experienced if stereo equipment is used!"

+ +There are many different ways to replay additional audio tracks, like Dolby Digital. +So VDR offers a plugin interface that allows for the implementation of any kind of +audio replay facility. +

+To implement a new audio output facility, simply derive a class from cAudio, +as in + +


+#include <vdr/audio.h> +#include <vdr/thread.h> + +class cMyAudio : public cAudio, private cThread { +private: + virtual void Action(void); +public: + cMyAudio(void); + virtual void Play(const uchar *Data, int Length); + virtual void Mute(bool On); + virtual void Clear(void); + }; +

+ +You should create your derived audio object in the +Start() function of your plugin. +Note that the object has to be created on the heap (using new), +and you shall not delete it at any point (it will be deleted automatically +when the program ends). +

+The Play() function will be offered complete audio PES packets +and has to accept each packet immediately. It must return as soon as possible, +in order to not delay the overall replay process. Therefore you may want to +also derive your class from cThread and run the actual audio processing +as a separate thread. Note that the offered data is only valid within the call +to Play(), so if you can't process the entire block immediately, you +will need to copy it for later processing in your thread. +

+The Mute() and Clear() functions will be called whenever the audio shall +be muted, or any buffered data shall be cleared, respectively. +

+

Remote Control

The joy of zapping!

@@ -1427,7 +1480,6 @@ Put(uint64 Code, bool Repeat = false, bool Release = false);

The other parameters have the same meaning as in the first version of this function. -

-- cgit v1.2.3