gst/mpegtsparse/: Add parsing of cable delivery system descriptor.
authorZaheer Abbas Merali <zaheerabbas@merali.org>
Tue, 4 Mar 2008 17:49:15 +0000 (17:49 +0000)
committerZaheer Abbas Merali <zaheerabbas@merali.org>
Tue, 4 Mar 2008 17:49:15 +0000 (17:49 +0000)
Original commit message from CVS:
* gst/mpegtsparse/gstmpegdesc.h:
* gst/mpegtsparse/mpegtspacketizer.c:
Add parsing of cable delivery system descriptor.

ChangeLog
common
gst/mpegtsparse/gstmpegdesc.h
gst/mpegtsparse/mpegtspacketizer.c

index 038e363ac717017fea399b0066d282828d759ac1..2415ad36a8b3acf0034453c60400b121f9898e92 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-03-04  Zaheer Abbas Merali  <zaheerabbas at merali dot org>
+
+       * gst/mpegtsparse/gstmpegdesc.h:
+       * gst/mpegtsparse/mpegtspacketizer.c:
+       Add parsing of cable delivery system descriptor.
+
 2008-03-03  Peter Kjellerstedt  <pkj@axis.com>
 
        * configure.ac:
diff --git a/common b/common
index 668c3f0b72d50813c30eb04be7048f638037c571..e02bd43fe6b9e45536eccbf5b7a5f9eae62030fd 160000 (submodule)
--- a/common
+++ b/common
@@ -1 +1 @@
-Subproject commit 668c3f0b72d50813c30eb04be7048f638037c571
+Subproject commit e02bd43fe6b9e45536eccbf5b7a5f9eae62030fd
index 1003c801600816013b32afe203a594e7f8c80f8f..494a2498ba29c24409164693434ccfb0eb1294df 100644 (file)
 #define DESC_DVB_TERRESTRIAL_DELIVERY_SYSTEM_transmission_mode(desc)   (desc[8] & 0x06)
 #define DESC_DVB_TERRESTRIAL_DELIVERY_SYSTEM_other_frequency(desc)     ((desc[8] & 0x01) == 0x01)
 
+/* DVB Cable Delivery System Descriptor */
+#define DESC_DVB_CABLE_DELIVERY_SYSTEM_frequency(desc)         (desc + 2)
+#define DESC_DVB_CABLE_DELIVERY_SYSTEM_fec_outer(desc)         (desc[7] & 0x0F)
+#define DESC_DVB_CABLE_DELIVERY_SYSTEM_modulation(desc)                (desc[8])
+#define DESC_DVB_CABLE_DELIVERY_SYSTEM_symbol_rate(desc)       (desc + 9)
+#define DESC_DVB_CABLE_DELIVERY_SYSTEM_fec_inner(desc)         (desc[12] & 0x0F)
+
 typedef struct {
   guint    n_desc;
   guint8   data_length;
index cc361e61f789776fcd5728d4bb442cdba0752209..6e80f0513c63ab36ca10c968d55ff0d840cecd43 100644 (file)
@@ -935,6 +935,93 @@ mpegts_packetizer_parse_nit (MpegTSPacketizer * packetizer,
             "other-frequency", G_TYPE_BOOLEAN, other_frequency, NULL);
         gst_structure_set (transport, "delivery", GST_TYPE_STRUCTURE,
             delivery_structure, NULL);
+      } else if ((delivery =
+              gst_mpeg_descriptor_find (mpegdescriptor,
+                  DESC_DVB_CABLE_DELIVERY_SYSTEM))) {
+
+        guint8 *frequency_bcd =
+            DESC_DVB_CABLE_DELIVERY_SYSTEM_frequency (delivery);
+        guint32 frequency =
+            10 * ((frequency_bcd[3] & 0x0F) +
+            10 * ((frequency_bcd[3] & 0xF0) >> 4) +
+            100 * (frequency_bcd[2] & 0x0F) +
+            1000 * ((frequency_bcd[2] & 0xF0) >> 4) +
+            10000 * (frequency_bcd[1] & 0x0F) +
+            100000 * ((frequency_bcd[1] & 0xF0) >> 4) +
+            1000000 * (frequency_bcd[0] & 0x0F) +
+            10000000 * ((frequency_bcd[0] & 0xF0) >> 4));
+        guint8 modulation =
+            DESC_DVB_CABLE_DELIVERY_SYSTEM_modulation (delivery);
+        gchar *modulation_str;
+        guint8 *symbol_rate_bcd =
+            DESC_DVB_CABLE_DELIVERY_SYSTEM_symbol_rate (delivery);
+        guint32 symbol_rate =
+            (symbol_rate_bcd[2] & 0x0F) +
+            10 * ((symbol_rate_bcd[2] & 0xF0) >> 4) +
+            100 * (symbol_rate_bcd[1] & 0x0F) +
+            1000 * ((symbol_rate_bcd[1] & 0xF0) >> 4) +
+            10000 * (symbol_rate_bcd[0] & 0x0F) +
+            100000 * ((symbol_rate_bcd[0] & 0xF0) >> 4);
+        guint8 fec_inner = DESC_DVB_CABLE_DELIVERY_SYSTEM_fec_inner (delivery);
+        gchar *fec_inner_str;
+
+        switch (fec_inner) {
+          case 0:
+            fec_inner_str = "undefined";
+            break;
+          case 1:
+            fec_inner_str = "1/2";
+            break;
+          case 2:
+            fec_inner_str = "2/3";
+            break;
+          case 3:
+            fec_inner_str = "3/4";
+            break;
+          case 4:
+            fec_inner_str = "5/6";
+            break;
+          case 5:
+            fec_inner_str = "7/8";
+            break;
+          case 6:
+            fec_inner_str = "8/9";
+            break;
+          case 0xF:
+            fec_inner_str = "none";
+            break;
+          default:
+            fec_inner_str = "reserved";
+        }
+        switch (modulation) {
+          case 0x00:
+            modulation_str = "undefined";
+            break;
+          case 0x01:
+            modulation_str = "QAM16";
+            break;
+          case 0x02:
+            modulation_str = "QAM32";
+            break;
+          case 0x03:
+            modulation_str = "QAM64";
+            break;
+          case 0x04:
+            modulation_str = "QAM128";
+            break;
+          case 0x05:
+            modulation_str = "QAM256";
+            break;
+          default:
+            modulation_str = "reserved";
+        }
+        delivery_structure = gst_structure_new ("cable",
+            "modulation", G_TYPE_STRING, modulation_str,
+            "frequency", G_TYPE_UINT, frequency,
+            "symbol-rate", G_TYPE_UINT, symbol_rate,
+            "inner-fec", G_TYPE_STRING, fec_inner_str, NULL);
+        gst_structure_set (transport, "delivery", GST_TYPE_STRUCTURE,
+            delivery_structure, NULL);
       }
       if ((delivery =
               gst_mpeg_descriptor_find (mpegdescriptor,