diff options
Diffstat (limited to 'audio.c')
-rw-r--r-- | audio.c | 31 |
1 files changed, 30 insertions, 1 deletions
@@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: audio.c 2.0 2006/05/28 15:03:24 kls Exp $ + * $Id: audio.c 2.1 2008/07/06 11:42:58 kls Exp $ */ #include "audio.h" @@ -32,6 +32,12 @@ void cAudios::PlayAudio(const uchar *Data, int Length, uchar Id) audio->Play(Data, Length, Id); } +void cAudios::PlayTsAudio(const uchar *Data, int Length) +{ + for (cAudio *audio = First(); audio; audio = Next(audio)) + audio->PlayTs(Data, Length); +} + void cAudios::MuteAudio(bool On) { for (cAudio *audio = First(); audio; audio = Next(audio)) @@ -86,6 +92,29 @@ void cExternalAudio::Play(const uchar *Data, int Length, uchar Id) } } +void cExternalAudio::PlayTs(const uchar *Data, int Length) +{ + if (command && !mute) { + if (pipe || pipe.Open(command, "w")) { + int written = 0; + while (Length > 0) { + int w = fwrite(Data + written, 1, Length, pipe); + if (w < 0) { + LOG_ERROR; + break; + } + Length -= w; + written += w; + } + } + else { + esyslog("ERROR: can't open pipe to audio command '%s'", command); + free(command); + command = NULL; + } + } +} + void cExternalAudio::Mute(bool On) { mute = On; |