From cb90e9b8dc05164c5a3f1b4550003a2a55409144 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sat, 9 Mar 2002 12:09:57 +0100 Subject: [PATCH] Now starting the Dolby Digital output thread only if the recording actually contains Dolby Digital audio data --- CONTRIBUTORS | 2 ++ HISTORY | 2 ++ dvbapi.c | 14 +++++++------- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index a00f6633..300832a4 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -147,6 +147,8 @@ Werner Fink for making I/O more robust by handling EINTR for fixing closing all unused file descriptors when opening a pipe for helping to debug leftover 'zombie' processes when closing a pipe + for making the Dolby Digital thread start only if the recording actually + contains Dolby Digital data Rolf Hakenes for providing 'libdtv' and adapting the EIT mechanisms to it diff --git a/HISTORY b/HISTORY index e9361f67..3beab653 100644 --- a/HISTORY +++ b/HISTORY @@ -1086,3 +1086,5 @@ Video Disk Recorder Revision History - Fixed closing a pipe (used for replaying Dolby Digital audio), which sometimes left 'zombie' processes behind (thanks to Werner Fink for helping to debug this one). +- Now starting the Dolby Digital output thread only if the recording actually + contains Dolby Digital audio data (thanks to Werner Fink). diff --git a/dvbapi.c b/dvbapi.c index dd009369..a0bcb1bd 100644 --- a/dvbapi.c +++ b/dvbapi.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: dvbapi.c 1.159 2002/03/09 10:14:07 kls Exp $ + * $Id: dvbapi.c 1.160 2002/03/09 11:59:39 kls Exp $ */ #include "dvbapi.h" @@ -746,10 +746,6 @@ cPlayBuffer::cPlayBuffer(cDvbApi *DvbApi, int VideoDev, int AudioDev) canToggleAudioTrack = false; skipAC3bytes = false; audioTrack = 0xC0; - if (cDvbApi::AudioCommand()) { - if (!dolbyDev.Open(cDvbApi::AudioCommand(), "w")) - esyslog(LOG_ERR, "ERROR: can't open pipe to audio command '%s'", cDvbApi::AudioCommand()); - } } cPlayBuffer::~cPlayBuffer() @@ -758,7 +754,11 @@ cPlayBuffer::~cPlayBuffer() void cPlayBuffer::PlayExternalDolby(const uchar *b, int MaxLength) { - if (dolbyDev) { + if (cDvbApi::AudioCommand()) { + if (!dolbyDev && !dolbyDev.Open(cDvbApi::AudioCommand(), "w")) { + esyslog(LOG_ERR, "ERROR: can't open pipe to audio command '%s'", cDvbApi::AudioCommand()); + return; + } if (b[0] == 0x00 && b[1] == 0x00 && b[2] == 0x01) { if (b[3] == 0xBD) { // dolby int l = b[4] * 256 + b[5] + 6; @@ -1150,7 +1150,7 @@ void cReplayBuffer::StripAudioPackets(uchar *b, int Length, uchar Except) int l = b[i + 4] * 256 + b[i + 5] + 6; switch (c) { case 0xBD: // dolby - if (Except && dolbyDev) + if (Except) PlayExternalDolby(&b[i], Length - i); // continue with deleting the data - otherwise it disturbs DVB replay case 0xC0 ... 0xC1: // audio