summaryrefslogtreecommitdiff
path: root/audio.c
diff options
context:
space:
mode:
Diffstat (limited to 'audio.c')
-rw-r--r--audio.c35
1 files changed, 17 insertions, 18 deletions
diff --git a/audio.c b/audio.c
index c958256..742c50b 100644
--- a/audio.c
+++ b/audio.c
@@ -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 {