diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2008-08-15 14:49:34 +0200 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2008-08-15 14:49:34 +0200 |
commit | d9e56db9fca760da1f2dc29288f0b55b2d67ec6f (patch) | |
tree | db05afb1bd0cd57c88a35cf4d95a570770dc764b /audio.c | |
parent | 2ee1e61d35d87d17c23b69525790a560dac69156 (diff) | |
download | vdr-d9e56db9fca760da1f2dc29288f0b55b2d67ec6f.tar.gz vdr-d9e56db9fca760da1f2dc29288f0b55b2d67ec6f.tar.bz2 |
First step towards switching to TS (Transport Stream) as recording format
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 1.5 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; |