Mailing List archive

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

[vdr] How to determine the APID languages?



I'm currently implementing a way to determine which APID broadcasts
which language. To do so I parse the ISO639LanguageDescriptor that
comes in the PMT together with the APIDs (see the attached patch
if you'd like to test this).

This appears to work on many channels, but for instance for the
"Premiere 1" channel both APIDs always report "deu" (or "ger" for
that matter). I wonder how I can detect that the second APID on
this channel actually broadcasts the English version.

Any ideas?

Klaus
--- ./libsi/descriptor.c	2004/01/12 16:17:20	1.3
+++ ./libsi/descriptor.c	2004/01/23 14:31:14
@@ -514,6 +514,14 @@
    return (LinkageType)s->linkage_type;
 }
 
+void ISO639LanguageDescriptor::Parse() {
+   unsigned int offset=0;
+   data.setPointerAndOffset<const descr_iso_639_language>(s, offset);
+   languageCode[0]=s->lang_code1;
+   languageCode[1]=s->lang_code2;
+   languageCode[2]=s->lang_code3;
+}
+
 void ApplicationSignallingDescriptor::Parse() {
    entryLoop.setData(data+sizeof(descr_application_signalling), getLength()-sizeof(descr_application_signalling));
 }
--- ./libsi/descriptor.h	2004/01/12 16:17:47	1.3
+++ ./libsi/descriptor.h	2004/01/23 14:29:55
@@ -374,6 +374,15 @@
    const descr_linkage *s;
 };
 
+class ISO639LanguageDescriptor : public Descriptor {
+public:
+   char languageCode[3];
+protected:
+   virtual void Parse();
+private:
+   const descr_iso_639_language *s;
+};
+
 //a descriptor currently unimplemented in this library
 class UnimplementedDescriptor : public Descriptor {
 protected:
--- ./libsi/si.c	2004/01/12 22:19:34	1.5
+++ ./libsi/si.c	2004/01/23 14:27:45
@@ -323,6 +323,9 @@
          case LinkageDescriptorTag:
             d=new LinkageDescriptor();
             break;
+         case ISO639LanguageDescriptorTag:
+            d=new ISO639LanguageDescriptor();
+            break;
 
          //note that it is no problem to implement one
          //of the unimplemented descriptors.
@@ -335,7 +338,6 @@
          case DataStreamAlignmentDescriptorTag:
          case TargetBackgroundGridDescriptorTag:
          case VideoWindowDescriptorTag:
-         case ISO639LanguageDescriptorTag:
          case SystemClockDescriptorTag:
          case MultiplexBufferUtilizationDescriptorTag:
          case CopyrightDescriptorTag:
--- ./pat.c	2004/01/16 15:43:34	1.5
+++ ./pat.c	2004/01/23 16:06:18
@@ -337,8 +337,24 @@
               case 3: // STREAMTYPE_11172_AUDIO
               case 4: // STREAMTYPE_13818_AUDIO
                       {
-                      if (NumApids < MAXAPIDS)
+                      if (NumApids < MAXAPIDS) {
                          Apids[NumApids++] = stream.getPid();
+                         }//XXX
+                         else NumApids++;//XXX
+                         SI::Descriptor *d;
+                         for (SI::Loop::Iterator it; (d = stream.streamDescriptors.getNext(it)); ) {
+                             switch (d->getDescriptorTag()) {
+                               case SI::ISO639LanguageDescriptorTag: {
+                                    SI::ISO639LanguageDescriptor *ld = (SI::ISO639LanguageDescriptor *)d;
+                                    printf("language APID %d %5d %3d %c%c%c\n", NumApids, stream.getPid(), d->getLength(), ld->languageCode[0], ld->languageCode[1], ld->languageCode[2]);//XXX
+                                    }
+                                    break;
+                               default: ;
+                               printf("PAT: %02X %3d\n", d->getDescriptorTag(), d->getLength());//XXX
+                               }
+                             delete d;
+                             }
+                         //XXX }
                       }
                       break;
               case 5: // STREAMTYPE_13818_PRIVATE

Home | Main Index | Thread Index