Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vdr] Re: AC3Out as a setting?



On Thu, Mar 14, 2002 at 08:37:07PM +0100, Robert Schneider wrote:
> Hi folks,
> 
> every now and then I find a recording where the AC3 data isn't present due 
> to driver problems. Before using the AC3Out patch, I could work around 
> that by just renaming my ac3dec command so that vdr didn't find it and by 
> that was playing the PCM sound. Now with AC3Out this is not possible any 
> more, however, the AC3-less-recordings still exist (I mean there seems to 
> be AC3 packages 0xbd, but there's obviously nothing in it).
> 
> Would it be asked too much if the AC3 Out would be made a setting in vdr? 
> Actually, one only had to put an "if" around the call to ExtractAC3Stream 
> in dvbapi and that would switch between PCM and AC3 sound.
> 
> I know I can do that myself, I just wanted to post that in case others 
> face the same problem and would also appreciate such a solution.
> 
> Being frank: Andy Grobb, as the obvious maintainer of the AIO patch, would 
> you incorporate that if others would express that wish, too?

Without using AC3Out this patch may help you as it does it for me.

----------------------------------------------------------------------------
--- dvbapi.c
+++ dvbapi.c	Fri Mar 15 11:26:19 2002
@@ -734,10 +734,6 @@
   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()
@@ -746,10 +742,14 @@
 
 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;
+           int l = ((b[4] << 8) | b[5]) + 6;
            int written = b[8] + (skipAC3bytes ? 13 : 9); // skips the PES header
            int n = min(l - written, MaxLength);
            while (n > 0) {
@@ -1164,20 +1164,17 @@
      for (int i = 0; i < Length - 6; i++) {
          if (b[i] == 0x00 && b[i + 1] == 0x00 && b[i + 2] == 0x01) {
             uchar c = b[i + 3];
-            int l = b[i + 4] * 256 + b[i + 5] + 6;
+            int l = ((b[i + 4] << 8) | 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
                    if (c == 0xC1)
                       canToggleAudioTrack = true;
-                   if (!Except || c != Except) {
-                      int n = l;
-                      for (int j = i; j < Length && n--; j++)
-                          b[j] = 0x00;
-                      }
+                   if (!Except || c != Except)
+                      memset(&b[i], 0x00, min(l, Length-i));
                    break;
               case 0xE0 ... 0xEF: // video
                    break;
--- thread.c
+++ thread.c	Mon Mar 11 15:02:41 2002
@@ -298,14 +298,21 @@
      f = NULL;
      }
 
-  if (pid >= 0) {
+  if (pid > 0) {
      int status = 0;
-     struct rusage ru;
      int i = 5;
-     while (ret == -1 && i > 0) {
-           usleep(1000);
-           ret = wait4(pid, &status, WNOHANG, &ru);
+     while (i > 0) {
+           ret = waitpid(pid, &status, WNOHANG);
+           if (ret < 0) {
+              if (errno != EINTR && errno != ECHILD) {
+                 LOG_ERROR;
+                 break;
+                 }
+              }
+           else if (ret == pid)
+              break;
            i--;
+           usleep(100000);
            }
    
      if (!i) {
----------------------------------------------------------------------------


      Werner



Home | Main Index | Thread Index