[mythtv] Need help debugging problem with scrambled TS streams.

Jesper Sörensen jesper at datapartner.se
Wed Jan 12 10:53:18 EST 2005


>> What I can tell from the logs is that the CA_PMT that is sent 
>> fromMythTV is 8 bytes shorted than the CA_PMT that is sent from VDR
>> and that I got 'Malformed PAT' errors in the MythTV.
>
>
>
> OK, I see a couple of differences. There is some "private data" in the 
> CA descriptor that is stripped by Myth which it shouldn't do. I'll try 
> to make a patch for that later today. I can't promise this will fix 
> anything for you but it's a bug no less.


Please try the attached patch (against patch 3.5). Unfortunately the 
paths in the patch are wrong but it should work if you specify the file 
names manually when applying the patch. Let me know if you can't get it 
to apply and I'll try and make a new one for you.

-------------- next part --------------
Index: dvbcam.cpp
===================================================================
RCS file: /storage/cvs/mythscan/dvbcam.cpp,v
retrieving revision 1.7
diff -u -r1.7 dvbcam.cpp
--- dvbcam.cpp	5 Dec 2004 15:51:04 -0000	1.7
+++ dvbcam.cpp	12 Jan 2005 13:13:07 -0000
@@ -286,7 +286,7 @@
             if (ca != pmt.CA.end())
             {
                 GENERAL(QString("CA: Adding CA descriptor: CASID=0x%1, ECM PID=%2").arg((*ca).CASystemID, 0, 16).arg((*ca).PID));
-                capmt.AddCaDescriptor((*ca).CASystemID, (*ca).PID);
+                capmt.AddCaDescriptor((*ca).CASystemID, (*ca).PID, (*ca).Data_Length, (*ca).Data);
             }
         }
 
@@ -305,7 +305,7 @@
                     if (ca != (*es).CA.end())
                     {
                         GENERAL(QString("CA: Adding CA descriptor: CASID=0x%1, ECM PID=%2").arg((*ca).CASystemID, 0, 16).arg((*ca).PID));
-                        capmt.AddCaDescriptor((*ca).CASystemID, (*ca).PID);
+                        capmt.AddCaDescriptor((*ca).CASystemID, (*ca).PID, (*ca).Data_Length, (*ca).Data);
                     }
                 }
             }
Index: dvbci.cpp
===================================================================
RCS file: /storage/cvs/mythscan/dvbci.cpp,v
retrieving revision 1.2
diff -u -r1.2 dvbci.cpp
--- dvbci.cpp	17 Nov 2004 19:25:51 -0000	1.2
+++ dvbci.cpp	12 Jan 2005 13:13:08 -0000
@@ -1383,7 +1383,7 @@
   capmt[length++] = 0x00;
 }
 
-void cCiCaPmt::AddCaDescriptor(int ca_system_id, int ca_pid)
+void cCiCaPmt::AddCaDescriptor(int ca_system_id, int ca_pid, int data_len, uint8_t *data)
 {
   if (!infoLengthPos)
   {
@@ -1391,7 +1391,7 @@
     return;
   }
 
-  if (length + 7 > int(sizeof(capmt)))
+  if (length + data_len + 7 > int(sizeof(capmt)))
   {
     esyslog("ERROR: buffer overflow in CA_PMT");
     return;
@@ -1406,6 +1406,12 @@
   capmt[length++] = ca_system_id & 0xFF;
   capmt[length++] = (ca_pid >> 8) & 0xFF;
   capmt[length++] = ca_pid & 0xFF;
+  
+  if (data_len > 0)
+  {
+    memcpy(&capmt[length], data, data_len);
+    length += data_len;
+  }
 
   // update program_info_length/ES_info_length
   int l = length - infoLengthPos - 2;
Index: dvbci.h
===================================================================
RCS file: /storage/cvs/mythscan/dvbci.h,v
retrieving revision 1.2
diff -u -r1.2 dvbci.h
--- dvbci.h	17 Nov 2004 19:25:51 -0000	1.2
+++ dvbci.h	12 Jan 2005 13:13:08 -0000
@@ -126,7 +126,7 @@
 public:
   cCiCaPmt(int ProgramNumber, uint8_t cplm = CPLM_ONLY);
   void AddElementaryStream(int type, int pid);
-  void AddCaDescriptor(int ca_system_id, int ca_pid);
+  void AddCaDescriptor(int ca_system_id, int ca_pid, int data_len, uint8_t *data);
   };
 
 #define MAX_CI_SESSION  16 //XXX
Index: siparser.cpp
===================================================================
RCS file: /storage/cvs/mythscan/siparser.cpp,v
retrieving revision 1.69
diff -u -r1.69 siparser.cpp
--- siparser.cpp	5 Jan 2005 00:21:16 -0000	1.69
+++ siparser.cpp	12 Jan 2005 13:13:08 -0000
@@ -1236,6 +1236,11 @@
 
     retval.CASystemID = buffer[2] << 8 | buffer[3];
     retval.PID = (buffer[4] & 0x1F) << 8 | buffer[5];
+    retval.Data_Length = buffer[1] - 4;
+    if (retval.Data_Length > 0)
+    {
+        memcpy(retval.Data, &buffer[6], retval.Data_Length);
+    }
 
     return retval;
 }
Index: sitypes.h
===================================================================
RCS file: /storage/cvs/mythscan/sitypes.h,v
retrieving revision 1.22
diff -u -r1.22 sitypes.h
--- sitypes.h	4 Jan 2005 02:36:34 -0000	1.22
+++ sitypes.h	12 Jan 2005 13:13:09 -0000
@@ -291,10 +291,13 @@
         {
             CASystemID = 0;
     	    PID = 0;
+            Data_Length = 0;
+            memset(Data, 0, sizeof(Data));
         }
         uint16_t CASystemID;
         uint16_t PID;
-
+        uint8_t  Data_Length;
+        uint8_t  Data[256];
 };
 typedef QMap<uint16_t, CAPMTObject> CAMap;
 


More information about the mythtv-dev mailing list