}
}
+static void
+mpegts_base_apply_cat (MpegTSBase * base, GstStructure * cat_info)
+{
+ GST_DEBUG_OBJECT (base, "CAT %" GST_PTR_FORMAT, cat_info);
+
+ gst_element_post_message (GST_ELEMENT_CAST (base),
+ gst_message_new_element (GST_OBJECT (base),
+ gst_structure_copy (cat_info)));
+}
+
static void
mpegts_base_apply_nit (MpegTSBase * base,
guint16 pmt_pid, GstStructure * nit_info)
res = FALSE;
break;
+ case 0x01:
+ /* CAT */
+ structure = mpegts_packetizer_parse_cat (base->packetizer, section);
+ if (structure)
+ mpegts_base_apply_cat (base, structure);
+ else
+ res = FALSE;
+ break;
case 0x02:
+ /* PMT */
structure = mpegts_packetizer_parse_pmt (base->packetizer, section);
if (G_LIKELY (structure))
mpegts_base_apply_pmt (base, section->pid, structure);
static GQuark QUARK_PID;
static GQuark QUARK_PROGRAMS;
+static GQuark QUARK_CAT;
+
static GQuark QUARK_PMT;
static GQuark QUARK_PCR_PID;
static GQuark QUARK_VERSION_NUMBER;
return FALSE;
}
+GstStructure *
+mpegts_packetizer_parse_cat (MpegTSPacketizer2 * packetizer,
+ MpegTSPacketizerSection * section)
+{
+ GstStructure *cat_info = NULL;
+ guint8 *data;
+ guint8 tmp;
+ GValueArray *descriptors;
+ GstMPEGDescriptor *desc;
+ guint desc_len;
+
+ /* Skip parts already parsed */
+ data = section->data + 3;
+
+ /* reserved : 18bits */
+ data += 2;
+
+ /* version_number : 5 bits
+ * current_next_indicator : 1 bit */
+ tmp = *data++;
+ section->version_number = (tmp >> 1) & 0x1F;
+ section->current_next_indicator = tmp & 0x01;
+
+ /* skip already handled section_number and last_section_number */
+ data += 2;
+
+ cat_info = gst_structure_new_id_empty (QUARK_CAT);
+
+ /* descriptors */
+ desc_len = section->section_length - 4 - 8;
+ desc = gst_mpeg_descriptor_parse (data, desc_len);
+ if (desc)
+ gst_mpeg_descriptor_free (desc);
+ descriptors = g_value_array_new (0);
+ if (!mpegts_packetizer_parse_descriptors (packetizer, &data, data + desc_len,
+ descriptors)) {
+ g_value_array_free (descriptors);
+ goto error;
+ }
+ gst_structure_id_set (cat_info, QUARK_DESCRIPTORS, G_TYPE_VALUE_ARRAY,
+ descriptors, NULL);
+ g_value_array_free (descriptors);
+
+ return cat_info;
+error:
+ if (cat_info)
+ gst_structure_free (cat_info);
+ return NULL;
+}
+
GstStructure *
mpegts_packetizer_parse_pat (MpegTSPacketizer2 * packetizer,
MpegTSPacketizerSection * section)
QUARK_PID = g_quark_from_string ("pid");
QUARK_PROGRAMS = g_quark_from_string ("programs");
+ QUARK_CAT = g_quark_from_string ("pat");
+
QUARK_PMT = g_quark_from_string ("pmt");
QUARK_PCR_PID = g_quark_from_string ("pcr-pid");
QUARK_VERSION_NUMBER = g_quark_from_string ("version-number");
gboolean mpegts_packetizer_push_section (MpegTSPacketizer2 *packetzer,
MpegTSPacketizerPacket *packet, MpegTSPacketizerSection *section);
+GstStructure *mpegts_packetizer_parse_cat (MpegTSPacketizer2 *packetizer,
+ MpegTSPacketizerSection *section);
GstStructure *mpegts_packetizer_parse_pat (MpegTSPacketizer2 *packetizer,
MpegTSPacketizerSection *section);
GstStructure *mpegts_packetizer_parse_pmt (MpegTSPacketizer2 *packetizer,