guint8 *data;
guint8 tmp;
GValueArray *descriptors;
- GstMPEGDescriptor *desc;
+ GstMPEGDescriptor desc;
guint desc_len;
/* Skip parts already parsed */
/* 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);
+ gst_mpeg_descriptor_parse (&desc, data, desc_len);
+ descriptors = g_value_array_new (desc.n_desc);
if (!mpegts_packetizer_parse_descriptors (packetizer, &data, data + desc_len,
descriptors)) {
g_value_array_free (descriptors);
if (stream_info_length) {
/* check for AC3 descriptor */
- GstMPEGDescriptor *desc =
- gst_mpeg_descriptor_parse (data, stream_info_length);
- if (desc != NULL) {
+ GstMPEGDescriptor desc;
+
+ if (gst_mpeg_descriptor_parse (&desc, data, stream_info_length)) {
/* DVB AC3 */
guint8 *desc_data;
- if (gst_mpeg_descriptor_find (desc, DESC_DVB_AC3)) {
+ if (gst_mpeg_descriptor_find (&desc, DESC_DVB_AC3)) {
gst_structure_set (stream_info, "has-ac3", G_TYPE_BOOLEAN, TRUE,
NULL);
}
/* DATA BROADCAST ID */
- desc_data = gst_mpeg_descriptor_find (desc, DESC_DVB_DATA_BROADCAST_ID);
+ desc_data =
+ gst_mpeg_descriptor_find (&desc, DESC_DVB_DATA_BROADCAST_ID);
if (desc_data) {
guint16 data_broadcast_id;
data_broadcast_id =
}
/* DATA BROADCAST */
- desc_data = gst_mpeg_descriptor_find (desc, DESC_DVB_DATA_BROADCAST);
+ desc_data = gst_mpeg_descriptor_find (&desc, DESC_DVB_DATA_BROADCAST);
if (desc_data) {
GstStructure *databroadcast_info;
guint16 data_broadcast_id;
/* DVB CAROUSEL IDENTIFIER */
desc_data =
- gst_mpeg_descriptor_find (desc, DESC_DVB_CAROUSEL_IDENTIFIER);
+ gst_mpeg_descriptor_find (&desc, DESC_DVB_CAROUSEL_IDENTIFIER);
if (desc_data) {
guint32 carousel_id;
carousel_id = DESC_DVB_CAROUSEL_IDENTIFIER_carousel_id (desc_data);
}
/* DVB STREAM IDENTIFIER */
- desc_data = gst_mpeg_descriptor_find (desc, DESC_DVB_STREAM_IDENTIFIER);
+ desc_data =
+ gst_mpeg_descriptor_find (&desc, DESC_DVB_STREAM_IDENTIFIER);
if (desc_data) {
guint8 component_tag;
component_tag = DESC_DVB_STREAM_IDENTIFIER_component_tag (desc_data);
}
/* ISO 639 LANGUAGE */
- desc_data = gst_mpeg_descriptor_find (desc, DESC_ISO_639_LANGUAGE);
+ desc_data = gst_mpeg_descriptor_find (&desc, DESC_ISO_639_LANGUAGE);
if (desc_data && DESC_ISO_639_LANGUAGE_codes_n (desc_data)) {
gchar *lang_code;
gchar *language_n = (gchar *)
g_free (lang_code);
}
- gst_mpeg_descriptor_free (desc);
- }
+ descriptors = g_value_array_new (desc.n_desc);
+ if (!mpegts_packetizer_parse_descriptors (packetizer,
+ &data, data + stream_info_length, descriptors)) {
+ g_value_unset (&programs);
+ gst_structure_free (stream_info);
+ g_value_array_free (descriptors);
+ goto error;
+ }
- descriptors = g_value_array_new (0);
- if (!mpegts_packetizer_parse_descriptors (packetizer,
- &data, data + stream_info_length, descriptors)) {
- g_value_unset (&programs);
- gst_structure_free (stream_info);
+ gst_structure_id_set (stream_info,
+ QUARK_DESCRIPTORS, G_TYPE_VALUE_ARRAY, descriptors, NULL);
g_value_array_free (descriptors);
- goto error;
}
-
- gst_structure_id_set (stream_info,
- QUARK_DESCRIPTORS, G_TYPE_VALUE_ARRAY, descriptors, NULL);
- g_value_array_free (descriptors);
-
}
g_value_init (&stream_value, GST_TYPE_STRUCTURE);
/* see if the buffer is large enough */
if (descriptors_loop_length) {
guint8 *networkname_descriptor;
- GstMPEGDescriptor *mpegdescriptor;
+ GstMPEGDescriptor mpegdescriptor;
if (data + descriptors_loop_length > end - 4) {
GST_WARNING ("PID %d invalid NIT descriptors loop length %d",
gst_structure_free (nit);
goto error;
}
- mpegdescriptor = gst_mpeg_descriptor_parse (data, descriptors_loop_length);
- networkname_descriptor =
- gst_mpeg_descriptor_find (mpegdescriptor, DESC_DVB_NETWORK_NAME);
- if (networkname_descriptor != NULL) {
- gchar *networkname_tmp;
-
- /* No need to bounds check this value as it comes from the descriptor length itself */
- guint8 networkname_length =
- DESC_DVB_NETWORK_NAME_length (networkname_descriptor);
- gchar *networkname =
- (gchar *) DESC_DVB_NETWORK_NAME_text (networkname_descriptor);
-
- networkname_tmp =
- get_encoding_and_convert (networkname, networkname_length);
- gst_structure_id_set (nit, QUARK_NETWORK_NAME, G_TYPE_STRING,
- networkname_tmp, NULL);
- g_free (networkname_tmp);
- }
- gst_mpeg_descriptor_free (mpegdescriptor);
+ if (gst_mpeg_descriptor_parse (&mpegdescriptor, data,
+ descriptors_loop_length)) {
+ networkname_descriptor =
+ gst_mpeg_descriptor_find (&mpegdescriptor, DESC_DVB_NETWORK_NAME);
+ if (networkname_descriptor != NULL) {
+ gchar *networkname_tmp;
+
+ /* No need to bounds check this value as it comes from the descriptor length itself */
+ guint8 networkname_length =
+ DESC_DVB_NETWORK_NAME_length (networkname_descriptor);
+ gchar *networkname =
+ (gchar *) DESC_DVB_NETWORK_NAME_text (networkname_descriptor);
+
+ networkname_tmp =
+ get_encoding_and_convert (networkname, networkname_length);
+ gst_structure_id_set (nit, QUARK_NETWORK_NAME, G_TYPE_STRING,
+ networkname_tmp, NULL);
+ g_free (networkname_tmp);
+ }
- descriptors = g_value_array_new (0);
- if (!mpegts_packetizer_parse_descriptors (packetizer,
- &data, data + descriptors_loop_length, descriptors)) {
- gst_structure_free (nit);
+ descriptors = g_value_array_new (mpegdescriptor.n_desc);
+ if (!mpegts_packetizer_parse_descriptors (packetizer,
+ &data, data + descriptors_loop_length, descriptors)) {
+ gst_structure_free (nit);
+ g_value_array_free (descriptors);
+ goto error;
+ }
+ gst_structure_id_set (nit, QUARK_DESCRIPTORS, G_TYPE_VALUE_ARRAY,
+ descriptors, NULL);
g_value_array_free (descriptors);
- goto error;
}
-
- gst_structure_id_set (nit, QUARK_DESCRIPTORS, G_TYPE_VALUE_ARRAY,
- descriptors, NULL);
- g_value_array_free (descriptors);
}
transport_stream_loop_length = GST_READ_UINT16_BE (data) & 0x0FFF;
QUARK_ORIGINAL_NETWORK_ID, G_TYPE_UINT, original_network_id, NULL);
if (descriptors_loop_length) {
- GstMPEGDescriptor *mpegdescriptor;
+ GstMPEGDescriptor mpegdescriptor;
guint8 *delivery;
if (data + descriptors_loop_length > end - 4) {
gst_structure_free (transport);
goto error;
}
- mpegdescriptor =
- gst_mpeg_descriptor_parse (data, descriptors_loop_length);
+ gst_mpeg_descriptor_parse (&mpegdescriptor, data,
+ descriptors_loop_length);
- if ((delivery =
- gst_mpeg_descriptor_find (mpegdescriptor,
+ if ((delivery = gst_mpeg_descriptor_find (&mpegdescriptor,
DESC_DVB_SATELLITE_DELIVERY_SYSTEM))) {
guint8 *frequency_bcd =
"inner-fec", G_TYPE_STRING, fec_inner_str, NULL);
gst_structure_set (transport, "delivery", GST_TYPE_STRUCTURE,
delivery_structure, NULL);
- } else if ((delivery =
- gst_mpeg_descriptor_find (mpegdescriptor,
+ } else if ((delivery = gst_mpeg_descriptor_find (&mpegdescriptor,
DESC_DVB_TERRESTRIAL_DELIVERY_SYSTEM))) {
guint32 frequency =
"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,
+ } else if ((delivery = gst_mpeg_descriptor_find (&mpegdescriptor,
DESC_DVB_CABLE_DELIVERY_SYSTEM))) {
guint8 *frequency_bcd =
gst_structure_free (delivery_structure);
delivery_structure = NULL;
}
- if ((delivery =
- gst_mpeg_descriptor_find (mpegdescriptor,
+ if ((delivery = gst_mpeg_descriptor_find (&mpegdescriptor,
DESC_DTG_LOGICAL_CHANNEL))) {
guint8 *current_pos = delivery + 2;
GValue channel_numbers = { 0 };
gst_structure_set_value (transport, "channels", &channel_numbers);
g_value_unset (&channel_numbers);
}
- if ((delivery =
- gst_mpeg_descriptor_find (mpegdescriptor,
+ if ((delivery = gst_mpeg_descriptor_find (&mpegdescriptor,
DESC_DVB_FREQUENCY_LIST))) {
guint8 *current_pos = delivery + 2;
GValue frequencies = { 0 };
g_value_unset (&frequencies);
}
}
- gst_mpeg_descriptor_free (mpegdescriptor);
- descriptors = g_value_array_new (0);
+ descriptors = g_value_array_new (mpegdescriptor.n_desc);
if (!mpegts_packetizer_parse_descriptors (packetizer,
&data, data + descriptors_loop_length, descriptors)) {
gst_structure_free (transport);
if (descriptors_loop_length) {
guint8 *service_descriptor;
- GstMPEGDescriptor *mpegdescriptor;
+ GstMPEGDescriptor mpegdescriptor;
if (data + descriptors_loop_length > end - 4) {
GST_WARNING ("PID %d invalid SDT entry %d descriptors loop length %d",
gst_structure_free (service);
goto error;
}
- mpegdescriptor =
- gst_mpeg_descriptor_parse (data, descriptors_loop_length);
+ gst_mpeg_descriptor_parse (&mpegdescriptor, data,
+ descriptors_loop_length);
service_descriptor =
- gst_mpeg_descriptor_find (mpegdescriptor, DESC_DVB_SERVICE);
+ gst_mpeg_descriptor_find (&mpegdescriptor, DESC_DVB_SERVICE);
if (service_descriptor != NULL) {
gchar *servicename_tmp, *serviceprovider_name_tmp;
guint8 serviceprovider_name_length =
g_free (serviceprovider_name_tmp);
}
}
- gst_mpeg_descriptor_free (mpegdescriptor);
- descriptors = g_value_array_new (0);
+ descriptors = g_value_array_new (mpegdescriptor.n_desc);
if (!mpegts_packetizer_parse_descriptors (packetizer,
&data, data + descriptors_loop_length, descriptors)) {
gst_structure_free (service);
guint8 *event_descriptor;
GArray *component_descriptors;
GArray *extended_event_descriptors;
- GstMPEGDescriptor *mpegdescriptor;
+ GstMPEGDescriptor mpegdescriptor;
if (data + descriptors_loop_length > end - 4) {
GST_WARNING ("PID %d invalid EIT descriptors loop length %d",
gst_structure_free (event);
goto error;
}
- mpegdescriptor =
- gst_mpeg_descriptor_parse (data, descriptors_loop_length);
+ gst_mpeg_descriptor_parse (&mpegdescriptor, data,
+ descriptors_loop_length);
event_descriptor =
- gst_mpeg_descriptor_find (mpegdescriptor, DESC_DVB_SHORT_EVENT);
+ gst_mpeg_descriptor_find (&mpegdescriptor, DESC_DVB_SHORT_EVENT);
if (event_descriptor != NULL) {
gchar *eventname_tmp, *eventdescription_tmp;
guint8 eventname_length =
get_encoding_and_convert (eventdescription,
eventdescription_length);
- gst_structure_set (event, "name", G_TYPE_STRING, eventname_tmp, NULL);
- gst_structure_set (event, "description", G_TYPE_STRING,
- eventdescription_tmp, NULL);
+ gst_structure_set (event, "name", G_TYPE_STRING, eventname_tmp,
+ "description", G_TYPE_STRING, eventdescription_tmp, NULL);
g_free (eventname_tmp);
g_free (eventdescription_tmp);
}
}
- extended_event_descriptors = gst_mpeg_descriptor_find_all (mpegdescriptor,
+ extended_event_descriptors =
+ gst_mpeg_descriptor_find_all (&mpegdescriptor,
DESC_DVB_EXTENDED_EVENT);
if (extended_event_descriptors) {
int i;
g_array_free (extended_event_descriptors, TRUE);
}
- component_descriptors = gst_mpeg_descriptor_find_all (mpegdescriptor,
+ component_descriptors = gst_mpeg_descriptor_find_all (&mpegdescriptor,
DESC_DVB_COMPONENT);
if (component_descriptors) {
int i;
g_value_unset (&components);
g_array_free (component_descriptors, TRUE);
}
- gst_mpeg_descriptor_free (mpegdescriptor);
- descriptors = g_value_array_new (0);
+ descriptors = g_value_array_new (mpegdescriptor.n_desc);
if (!mpegts_packetizer_parse_descriptors (packetizer,
&data, data + descriptors_loop_length, descriptors)) {
gst_structure_free (event);