[BUG] VDR incorrectly sets caid on FTA channel

Message ID 4B336B25.3000607@tvdr.de
State New
Headers

Commit Message

Klaus Schmidinger Dec. 24, 2009, 1:22 p.m. UTC
  On 20.12.2009 19:50, Francesco Saverio Schiavarelli wrote:
> Hello,
> 
> I found a problem with VDR 1.6.0 with the following channel:
> 
> cielo:12034:vC34:S13.0E:27500:166:414=ita,415=und:476:0:11110:64511:6600:0
> 
> If I set "Update channels" to "names and pid" that line gets updated:
> 
> cielo:12034:vC34:S13.0E:27500:166:414=ita,415=und:476:919,93B:11110:64511:6600:0
> 
> 
> and the channels becomes unavailable even if audio and video pids are
> _unscrambled_.
> 
> After a short investigation with dvbsnoop I think I've found the culprit
> (excerpt from PMT table dump follows):
> 
> Stream_type: 5 (0x05)  [= ITU-T Rec. H.222.0 | ISO/IEC 13818-1 private
> sections]
> reserved_1: 7 (0x07)
> Elementary_PID: 2085 (0x0825)
> reserved_2: 15 (0x0f)
> ES_info_length: 27 (0x001b)
> 
>     MPEG-DescriptorTag: 15 (0x0f)  [= private_data_indicator_descriptor]
>     descriptor_length: 4 (0x04)
>     Descriptor-data:
>         0000:  4f 54 56 00                  OTV.
> 
>     DVB-DescriptorTag: 144 (0x90)  [= User defined/ATSC reserved]
>     descriptor_length: 1 (0x01)
>     Descriptor-data:
>         0000:  9d                              .
> 
>     DVB-DescriptorTag: 254 (0xfe)  [= User defined]
>     descriptor_length: 4 (0x04)
>     Descriptor-data:
>         0000:  54 47 54 00                  TGT.
> 
>     MPEG-DescriptorTag: 9 (0x09)  [= CA_descriptor]
>     descriptor_length: 4 (0x04)
>     CA_system_ID: 2329 (0x0919)  [= News Datacom (Videoguard)]
>     reserved: 7 (0x07)
>     CA_PID: 1603 (0x0643)
> 
>     MPEG-DescriptorTag: 9 (0x09)  [= CA_descriptor]
>     descriptor_length: 4 (0x04)
>     CA_system_ID: 2363 (0x093b)  [= News Datacom (Videoguard)]
>     reserved: 7 (0x07)
>     CA_PID: 1703 (0x06a7)
> 
> 
> There is a private data stream declared in the channel PMT that contains
> CA_descriptor and so the whole channel is treated like scrambled.
> 
> The actual vdr approach, although correct in principle, seems a bit too
> conservative to me. There are cases where a channel is completely
> unavailable even if just one component is unavailable because of
> scrambling.

Please try the attached patch.

Klaus
  

Comments

Francesco Saverio Schiavarelli Dec. 28, 2009, 5:51 p.m. UTC | #1
Klaus Schmidinger wrote:
> On 20.12.2009 19:50, Francesco Saverio Schiavarelli wrote:
>> Hello,
>>
>> I found a problem with VDR 1.6.0 with the following channel:
>>
>> cielo:12034:vC34:S13.0E:27500:166:414=ita,415=und:476:0:11110:64511:6600:0
>>
>> If I set "Update channels" to "names and pid" that line gets updated:
>>
>> cielo:12034:vC34:S13.0E:27500:166:414=ita,415=und:476:919,93B:11110:64511:6600:0
>>
>>
>> and the channels becomes unavailable even if audio and video pids are
>> _unscrambled_.
>>
>> The actual vdr approach, although correct in principle, seems a bit too
>> conservative to me. There are cases where a channel is completely
>> unavailable even if just one component is unavailable because of
>> scrambling.
> 
> Please try the attached patch.
> 
> Klaus
> 

I backported the patch to VDR 1.6.0 and the problem is gone.

thank you
Francesco
  

Patch

--- pat.c	2009/12/06 11:39:17	2.5
+++ pat.c	2009/12/24 13:01:18
@@ -345,6 +345,7 @@ 
         int NumDpids = 0;
         int NumSpids = 0;
         for (SI::Loop::Iterator it; pmt.streamLoop.getNext(stream, it); ) {
+            bool ProcessCaDescriptors = false;
             int esPid = stream.getPid();
             switch (stream.getStreamType()) {
               case 1: // STREAMTYPE_11172_VIDEO
@@ -353,6 +354,7 @@ 
                       Vpid = esPid;
                       Ppid = pmt.getPCRPid();
                       Vtype = stream.getStreamType();
+                      ProcessCaDescriptors = true;
                       break;
               case 3: // STREAMTYPE_11172_AUDIO
               case 4: // STREAMTYPE_13818_AUDIO
@@ -385,6 +387,7 @@ 
                              }
                          NumApids++;
                          }
+                      ProcessCaDescriptors = true;
                       }
                       break;
               case 5: // STREAMTYPE_13818_PRIVATE
@@ -398,6 +401,7 @@ 
                           switch (d->getDescriptorTag()) {
                             case SI::AC3DescriptorTag:
                                  dpid = esPid;
+                                 ProcessCaDescriptors = true;
                                  break;
                             case SI::SubtitlingDescriptorTag:
                                  if (NumSpids < MAXSPIDS) {
@@ -445,10 +449,12 @@ 
                       break;
               default: ;//printf("PID: %5d %5d %2d %3d %3d\n", pmt.getServiceId(), stream.getPid(), stream.getStreamType(), pmt.getVersionNumber(), Channel->Number());
               }
-            for (SI::Loop::Iterator it; (d = (SI::CaDescriptor*)stream.streamDescriptors.getNext(it, SI::CaDescriptorTag)); ) {
-                CaDescriptors->AddCaDescriptor(d, esPid);
-                delete d;
-                }
+            if (ProcessCaDescriptors) {
+               for (SI::Loop::Iterator it; (d = (SI::CaDescriptor*)stream.streamDescriptors.getNext(it, SI::CaDescriptorTag)); ) {
+                   CaDescriptors->AddCaDescriptor(d, esPid);
+                   delete d;
+                   }
+               }
             }
         if (Setup.UpdateChannels >= 2) {
            Channel->SetPids(Vpid, Ppid, Vtype, Apids, ALangs, Dpids, DLangs, Spids, SLangs, Tpid);