1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Added 'uchar Id' to cAudio::Play()'

This commit is contained in:
Klaus Schmidinger 2005-02-12 13:01:24 +01:00
parent d1fb8d586d
commit 25c942c0e3
6 changed files with 59 additions and 51 deletions

View File

@ -273,6 +273,7 @@ Werner Fink <werner@suse.de>
recordings can be triggered in the default branch
for pointing out that pesAssembler->Reset() needs to be called between subsequent
Transfer Modes
for suggestions that led to the addition of the 'Id' parameter to cAudio::Play().
Rolf Hakenes <hakenes@hippomi.de>
for providing 'libdtv' and adapting the EIT mechanisms to it
@ -1136,6 +1137,7 @@ Marco Schl
when clearing the transfer buffer to avoid overflows
for adding CMD_SPU_CHG_COLCON to cDvbSpuDecoder::setTime()
for suggesting to force a new resync after a call to cRemux::Clear()
for suggestions that led to the addition of the 'Id' parameter to cAudio::Play().
Jürgen Schmitz <j.schmitz@web.de>
for reporting a bug in displaying the current channel when switching via the SVDRP

View File

@ -3388,3 +3388,7 @@ Video Disk Recorder Revision History
Huelswitt).
- Completed the Danish OSD texts (thanks to Mogens Elneff).
- Forcing a new resync after a call to cRemux::Clear() (suggested by Marco Schlüßler).
- The cAudio::Play() function now has an additional parameter 'uchar Id' which tells
the function the substream id of the given audio packet, so that a plugin can
take the right action for the various kinds if audio data (based on suggestions
by Werner Fink and Macro Schlüßler).

View File

@ -14,18 +14,18 @@ Copyright &copy; 2004 Klaus Schmidinger<br>
<a href="http://www.cadsoft.de/vdr">www.cadsoft.de/vdr</a>
</center>
<p>
<!--X1.3.8--><table width=100%><tr><td bgcolor=#0000AA>&nbsp;</td><td width=100%>
Important modifications introduced in version 1.3.8 are marked like this.
<!--X1.3.8--></td></tr></table>
<!--X1.3.18--><table width=100%><tr><td bgcolor=#00AA00>&nbsp;</td><td width=100%>
<!--X1.3.18--><table width=100%><tr><td bgcolor=#0000AA>&nbsp;</td><td width=100%>
Important modifications introduced in version 1.3.18 are marked like this.
<!--X1.3.18--></td></tr></table>
<!--X1.3.19--><table width=100%><tr><td bgcolor=#AA0000>&nbsp;</td><td width=100%>
<!--X1.3.19--><table width=100%><tr><td bgcolor=#00AA00>&nbsp;</td><td width=100%>
Important modifications introduced in version 1.3.19 are marked like this.
<!--X1.3.19--></td></tr></table>
<!--X1.3.20--><table width=100%><tr><td bgcolor=#FF0000>&nbsp;</td><td width=100%>
<!--X1.3.20--><table width=100%><tr><td bgcolor=#AA0000>&nbsp;</td><td width=100%>
Important modifications introduced in version 1.3.20 are marked like this.
<!--X1.3.20--></td></tr></table>
<!--X1.3.21--><table width=100%><tr><td bgcolor=#FF0000>&nbsp;</td><td width=100%>
Important modifications introduced in version 1.3.21 are marked like this.
<!--X1.3.21--></td></tr></table>
<p>
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.
@ -58,7 +58,7 @@ structures and allows it to hook itself into specific areas to perform special a
<li><a href="#Command line arguments">Command line arguments</a>
<li><a href="#Command line help">Command line help</a>
<li><a href="#Getting started">Getting started</a>
<!--X1.3.20--><table width=100%><tr><td bgcolor=#FF0000>&nbsp;</td><td width=100%>
<!--X1.3.20--><table width=100%><tr><td bgcolor=#AA0000>&nbsp;</td><td width=100%>
<li><a href="#Shutting down">Shutting down</a>
<!--X1.3.20--></td></tr></table>
<li><a href="#Main menu entry">Main menu entry</a>
@ -306,7 +306,7 @@ 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.
<p>
The <b>destructor</b> has to clean up any data created by the plugin.
<!--X1.3.20--><table width=100%><tr><td bgcolor=#FF0000>&nbsp;</td><td width=100%>
<!--X1.3.20--><table width=100%><tr><td bgcolor=#AA0000>&nbsp;</td><td width=100%>
Any threads the plugin may have created shall be stopped in the
<a href="#Shutting down"><tt>Stop()</tt></a> function.
<!--X1.3.20--></td></tr></table>
@ -504,7 +504,7 @@ VDR to exit.
If the plugin doesn't implement any background functionality or internationalized
texts, it doesn't need to implement either of these functions.
<!--X1.3.20--><table width=100%><tr><td bgcolor=#FF0000>&nbsp;</td><td width=100%>
<!--X1.3.20--><table width=100%><tr><td bgcolor=#AA0000>&nbsp;</td><td width=100%>
<a name="Shutting down"><hr><h2>Shutting down</h2>
<center><i><b>Stop it, right there!</b></i></center><p>
@ -1044,7 +1044,7 @@ public:
Take a look at the files <tt>player.h</tt> and <tt>dvbplayer.c</tt> to see how VDR implements
its own player for the VDR recordings.
<p>
<!--X1.3.18--><table width=100%><tr><td bgcolor=#00AA00>&nbsp;</td><td width=100%>
<!--X1.3.18--><table width=100%><tr><td bgcolor=#0000AA>&nbsp;</td><td width=100%>
To play the actual data, the player needs to call its member function
<p><table><tr><td bgcolor=#F0F0F0><pre>
@ -1067,7 +1067,7 @@ bool DevicePoll(cPoller &amp;Poller, int TimeoutMs = 0);
to determine whether the device is ready for further data.
<p>
<!--X1.3.18--><table width=100%><tr><td bgcolor=#00AA00>&nbsp;</td><td width=100%>
<!--X1.3.18--><table width=100%><tr><td bgcolor=#0000AA>&nbsp;</td><td width=100%>
By default all audio track handling is done by the device a player is
attached to.
If the player can provide more than a single audio track, and has special
@ -1204,7 +1204,7 @@ public:
};
cMyReceiver::cMyReceiver(int Pid)
<!--X1.3.19--><table width=100%><tr><td bgcolor=#AA0000>&nbsp;</td><td width=100%>
<!--X1.3.19--><table width=100%><tr><td bgcolor=#00AA00>&nbsp;</td><td width=100%>
:cReceiver(0, -1, Pid)
<!--X1.3.19--></td></tr></table>
{
@ -1382,7 +1382,7 @@ public:
virtual cSkinDisplayMenu *DisplayMenu(void);
virtual cSkinDisplayReplay *DisplayReplay(bool ModeOnly);
virtual cSkinDisplayVolume *DisplayVolume(void);
<!--X1.3.18--><table width=100%><tr><td bgcolor=#00AA00>&nbsp;</td><td width=100%>
<!--X1.3.18--><table width=100%><tr><td bgcolor=#0000AA>&nbsp;</td><td width=100%>
virtual cSkinDisplayMessage *DisplayTrack(int NumTracks, const char * const *Tracks);
<!--X1.3.18--></td></tr></table>
virtual cSkinDisplayMessage *DisplayMessage(void);
@ -1404,7 +1404,6 @@ new cMySkin;
in the <a href="#Getting started"><tt>Start()</tt></a> function of your plugin.
Do not delete this object, it will be automatically deleted when the program ends.
<p>
<!--X1.3.8--><table width=100%><tr><td bgcolor=#0000AA>&nbsp;</td><td width=100%>
In order to be able to easily identify plugins that implement a skin it is recommended
that the name of such a plugin should be
@ -1414,8 +1413,6 @@ skinxyz
where <tt>xyz</tt> is the actual name of the skin.
<!--X1.3.8--></td></tr></table>
<a name="Themes"><hr><h2>Themes</h2>
<center><i><b>Eye of the beholder...</b></i></center><p>
@ -1514,7 +1511,7 @@ repectively.
If the device can provide more than a single audio track, it can implement the
following function to make them available:
<!--X1.3.18--><table width=100%><tr><td bgcolor=#00AA00>&nbsp;</td><td width=100%>
<!--X1.3.18--><table width=100%><tr><td bgcolor=#0000AA>&nbsp;</td><td width=100%>
<p><table><tr><td bgcolor=#F0F0F0><pre>
virtual void SetAudioTrackDevice(eTrackType Type);
virtual int GetAudioChannelDevice(void);
@ -1679,7 +1676,9 @@ private:
virtual void Action(void);
public:
cMyAudio(void);
virtual void Play(const uchar *Data, int Length);
<!--X1.3.21--><table width=100%><tr><td bgcolor=#FF0000>&nbsp;</td><td width=100%>
virtual void Play(const uchar *Data, int Length, uchar Id);
<!--X1.3.21--></td></tr></table>
virtual void Mute(bool On);
virtual void Clear(void);
};

35
audio.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: audio.c 1.2 2002/11/03 11:53:34 kls Exp $
* $Id: audio.c 1.3 2005/02/12 12:40:51 kls Exp $
*/
#include "audio.h"
@ -25,10 +25,10 @@ cAudio::~cAudio()
cAudios Audios;
void cAudios::PlayAudio(const uchar *Data, int Length)
void cAudios::PlayAudio(const uchar *Data, int Length, uchar Id)
{
for (cAudio *audio = First(); audio; audio = Next(audio))
audio->Play(Data, Length);
audio->Play(Data, Length, Id);
}
void cAudios::MuteAudio(bool On)
@ -56,25 +56,24 @@ cExternalAudio::~cExternalAudio()
free(command);
}
void cExternalAudio::Play(const uchar *Data, int Length)
void cExternalAudio::Play(const uchar *Data, int Length, uchar Id)
{
if (command && !mute) {
if (pipe || pipe.Open(command, "w")) {
if (Data[0] == 0x00 && Data[1] == 0x00 && Data[2] == 0x01) {
if (Data[3] == 0xBD) { // dolby
//XXX??? int written = Data[8] + (skipAC3bytes ? 13 : 9); // skips the PES header
int written = Data[8] + 9; // skips the PES header
Length -= written;
while (Length > 0) {
int w = fwrite(Data + written, 1, Length, pipe);
if (w < 0) {
LOG_ERROR;
break;
}
Length -= w;
written += w;
if (0x80 <= Id && Id <= 0x87 || Id == 0xBD) { // AC3
int written = Data[8] + 9; // skips the PES header
if (Id != 0xBD)
written += 4; // skips AC3 bytes
Length -= written;
while (Length > 0) {
int w = fwrite(Data + written, 1, Length, pipe);
if (w < 0) {
LOG_ERROR;
break;
}
}
Length -= w;
written += w;
}
}
}
else {

23
audio.h
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: audio.h 1.2 2002/11/03 11:50:02 kls Exp $
* $Id: audio.h 1.3 2005/02/12 12:20:19 kls Exp $
*/
#ifndef __AUDIO_H
@ -18,21 +18,22 @@ protected:
cAudio(void);
public:
virtual ~cAudio();
virtual void Play(const uchar *Data, int Length) = 0;
// Plays the given block of audio Data. Must return as soon as possible.
// If the entire block of data can't be processed immediately, it must
// be copied and processed in a separate thread. The Data is always a
// complete PES audio packet.
virtual void Play(const uchar *Data, int Length, uchar Id) = 0;
///< Plays the given block of audio Data. Must return as soon as possible.
///< If the entire block of data can't be processed immediately, it must
///< be copied and processed in a separate thread. The Data is always a
///< complete PES audio packet. Id indicates the type of audio data this
///< packet holds.
virtual void Mute(bool On) = 0;
// Immediately sets the audio device to be silent (On==true) or to
// normal replay (On==false).
///< Immediately sets the audio device to be silent (On==true) or to
///< normal replay (On==false).
virtual void Clear(void) = 0;
// Clears all data that might still be awaiting processing.
///< Clears all data that might still be awaiting processing.
};
class cAudios : public cList<cAudio> {
public:
void PlayAudio(const uchar *Data, int Length);
void PlayAudio(const uchar *Data, int Length, uchar Id);
void MuteAudio(bool On);
void ClearAudio(void);
};
@ -47,7 +48,7 @@ private:
public:
cExternalAudio(const char *Command);
virtual ~cExternalAudio();
virtual void Play(const uchar *Data, int Length);
virtual void Play(const uchar *Data, int Length, uchar Id);
virtual void Mute(bool On);
virtual void Clear(void);
};

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: device.c 1.89 2005/02/08 13:06:12 kls Exp $
* $Id: device.c 1.90 2005/02/12 12:26:49 kls Exp $
*/
#include "device.h"
@ -908,15 +908,18 @@ int cDevice::PlayPesPacket(const uchar *Data, int Length, bool VideoOnly)
SetAvailableTrack(ttDolby, SubStreamIndex, SubStreamId);
if (!VideoOnly && SubStreamId == availableTracks[currentAudioTrack].id) {
w = PlayAudio(Start, d);
if (FirstLoop && !(SubStreamId & 0x08)) // no DTS
Audios.PlayAudio(Data, Length);
if (FirstLoop)
Audios.PlayAudio(Data, Length, SubStreamId);
}
}
break;
case 0xA0: // LPCM
SetAvailableTrack(ttAudio, SubStreamIndex, SubStreamId);
if (!VideoOnly && SubStreamId == availableTracks[currentAudioTrack].id)
if (!VideoOnly && SubStreamId == availableTracks[currentAudioTrack].id) {
w = PlayAudio(Start, d);
if (FirstLoop)
Audios.PlayAudio(Data, Length, SubStreamId);
}
break;
default:
// Compatibility mode for old VDR recordings, where 0xBD was only AC3: