diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2005-02-12 13:01:24 +0100 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2005-02-12 13:01:24 +0100 |
commit | 25c942c0e388e17ffd239e871a362d6c702eec33 (patch) | |
tree | 889e29837c839d03eff55bbfe09f479faf29fdf7 /audio.c | |
parent | d1fb8d586d1d51028bd7d555ee63d40d27449fb5 (diff) | |
download | vdr-25c942c0e388e17ffd239e871a362d6c702eec33.tar.gz vdr-25c942c0e388e17ffd239e871a362d6c702eec33.tar.bz2 |
Added 'uchar Id' to cAudio::Play()'
Diffstat (limited to 'audio.c')
-rw-r--r-- | audio.c | 35 |
1 files changed, 17 insertions, 18 deletions
@@ -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 { |