mpegtsparse: add parsing of data broadcast descriptors
authorZaheer Abbas Merali <zaheerabbas@merali.org>
Tue, 7 Jul 2009 14:28:04 +0000 (15:28 +0100)
committerZaheer Abbas Merali <zaheerabbas@merali.org>
Wed, 8 Jul 2009 09:33:29 +0000 (10:33 +0100)
gst/mpegdemux/gstmpegdesc.h
gst/mpegdemux/mpegtspacketizer.c

index 84b400093247623f3df7c9a5a8a9871d4f4f7f04..3f99b843f8eb51befbba6d3cb9beadc90084db3e 100644 (file)
 #define DESC_DVB_CABLE_DELIVERY_SYSTEM_symbol_rate(desc)       (desc + 9)
 #define DESC_DVB_CABLE_DELIVERY_SYSTEM_fec_inner(desc)         (desc[12] & 0x0F)
 
+/* DVB Data Broadcast Descriptor */
+#define DESC_DVB_DATA_BROADCAST_data_broadcast_id(desc)                (GST_READ_UINT16_BE((desc) + 2))
+#define DESC_DVB_DATA_BROADCAST_component_tag(desc)            (desc[4])
+#define DESC_DVB_DATA_BROADCAST_selector_length(desc)          (desc[5])
+#define DESC_DVB_DATA_BROADCAST_selector(desc)                 (desc + 6)
+#define DESC_DVB_DATA_BROADCAST_iso639_language_code(desc)     (desc + 6 + DESC_DVB_DATA_BROADCAST_selector_length(desc))
+#define DESC_DVB_DATA_BROADCAST_text_length(desc)              (desc + 9 + DESC_DVB_DATA_BROADCAST_selector_length(desc))
+#define DESC_DVB_DATA_BROADCAST_text(desc)                     (desc + 10 + DESC_DVB_DATA_BROADCAST_selector_length(desc))
+
+/* DVB Data Broadcast Id Descriptor */
+#define DESC_DVB_DATA_BROADCAST_ID_data_broadcast_id(desc)     (GST_READ_UINT16_BE((desc) + 2))
+#define DESC_DVB_DATA_BROADCAST_ID_id_selector_byte(desc)      (desc + 4)
+
 typedef struct {
   guint    n_desc;
   guint8   data_length;
index c9fc325f758410dec40ca3b86e6e34391ecad733..8d8e3c1fa9849e4f72b24eaad142f01abec2e8a5 100644 (file)
@@ -507,10 +507,34 @@ mpegts_packetizer_parse_pmt (MpegTSPacketizer * packetizer,
       GstMPEGDescriptor *desc =
           gst_mpeg_descriptor_parse (data, stream_info_length);
       if (desc != NULL) {
+        guint8 *desc_data;
         if (gst_mpeg_descriptor_find (desc, DESC_DVB_AC3)) {
           gst_structure_set (stream_info, "has-ac3", G_TYPE_BOOLEAN, TRUE,
               NULL);
         }
+        desc_data = gst_mpeg_descriptor_find (desc, DESC_DVB_DATA_BROADCAST_ID);
+        if (desc_data) {
+          guint16 data_broadcast_id;
+          data_broadcast_id =
+              DESC_DVB_DATA_BROADCAST_ID_data_broadcast_id (desc_data);
+          gst_structure_set (stream_info, "data-broadcast-id", G_TYPE_UINT,
+              data_broadcast_id, NULL);
+        }
+        desc_data = gst_mpeg_descriptor_find (desc, DESC_DVB_DATA_BROADCAST);
+        if (desc_data) {
+          GstStructure *databroadcast_info;
+          guint16 data_broadcast_id;
+          guint8 component_tag;
+          data_broadcast_id =
+              DESC_DVB_DATA_BROADCAST_data_broadcast_id (desc_data);
+          component_tag = DESC_DVB_DATA_BROADCAST_component_tag (desc_data);
+          databroadcast_info = gst_structure_new ("data-broadcast", "id",
+              G_TYPE_UINT, data_broadcast_id, "component-tag", component_tag,
+              NULL);
+          gst_structure_set (stream_info, "data-broadcast", GST_TYPE_STRUCTURE,
+              databroadcast_info, NULL);
+        }
+
         gst_mpeg_descriptor_free (desc);
       }