mpegts: change to GType and from gchar[] to gchar*

https://bugzilla.gnome.org/show_bug.cgi?id=730914
This commit is contained in:
Stefan Ringel 2014-06-01 10:44:23 +02:00 committed by Edward Hervey
parent 5409a3ea2f
commit 7c884374eb
7 changed files with 445 additions and 140 deletions

View File

@ -162,7 +162,7 @@ gst_mpegts_descriptor_parse_dvb_service_list (const GstMpegTsDescriptor *
/** /**
* gst_mpegts_descriptor_parse_dvb_stuffing: * gst_mpegts_descriptor_parse_dvb_stuffing:
* @descriptor: a %GST_MTS_DESC_DVB_STUFFING #GstMpegTsDescriptor * @descriptor: a %GST_MTS_DESC_DVB_STUFFING #GstMpegTsDescriptor
* @stuffing_bytes: (out): the stuffing bytes * @stuffing_bytes: (out) (transfer full): the stuffing bytes
* *
* Parses out the stuffing bytes from the @descriptor. * Parses out the stuffing bytes from the @descriptor.
* *
@ -283,7 +283,6 @@ gst_mpegts_descriptor_parse_satellite_delivery_system (const GstMpegTsDescriptor
break; break;
} }
return TRUE; return TRUE;
} }
@ -529,6 +528,61 @@ beach:
} }
/* GST_MTS_DESC_DVB_LINKAGE (0x4A) */ /* GST_MTS_DESC_DVB_LINKAGE (0x4A) */
static GstMpegTsDVBLinkageDescriptor *
_gst_mpegts_dvb_linkage_descriptor_copy (GstMpegTsDVBLinkageDescriptor * source)
{
GstMpegTsDVBLinkageDescriptor *copy;
copy = g_slice_dup (GstMpegTsDVBLinkageDescriptor, source);
switch (source->linkage_type) {
case GST_MPEGTS_DVB_LINKAGE_MOBILE_HAND_OVER:
copy->linkage_data = g_slice_dup (GstMpegTsDVBLinkageMobileHandOver,
source->linkage_data);
break;
case GST_MPEGTS_DVB_LINKAGE_EVENT:
copy->linkage_data = g_slice_dup (GstMpegTsDVBLinkageEvent,
source->linkage_data);
break;
case GST_MPEGTS_DVB_LINKAGE_EXTENDED_EVENT:
copy->linkage_data = g_ptr_array_ref (source->linkage_data);
break;
default:
break;
}
copy->private_data_bytes = g_slice_copy (source->private_data_length,
source->private_data_bytes);
return copy;
}
void
gst_mpegts_dvb_linkage_descriptor_free (GstMpegTsDVBLinkageDescriptor * source)
{
switch (source->linkage_type) {
case GST_MPEGTS_DVB_LINKAGE_MOBILE_HAND_OVER:
g_slice_free (GstMpegTsDVBLinkageMobileHandOver, source->linkage_data);
break;
case GST_MPEGTS_DVB_LINKAGE_EVENT:
g_slice_free (GstMpegTsDVBLinkageEvent, source->linkage_data);
break;
case GST_MPEGTS_DVB_LINKAGE_EXTENDED_EVENT:
g_ptr_array_unref (source->linkage_data);
break;
default:
break;
}
g_slice_free1 (source->private_data_length, source->private_data_bytes);
g_slice_free (GstMpegTsDVBLinkageDescriptor, source);
}
G_DEFINE_BOXED_TYPE (GstMpegTsDVBLinkageDescriptor,
gst_mpegts_dvb_linkage_descriptor,
(GBoxedCopyFunc) _gst_mpegts_dvb_linkage_descriptor_copy,
(GFreeFunc) gst_mpegts_dvb_linkage_descriptor_free);
static void static void
_gst_mpegts_dvb_linkage_extened_event_free (GstMpegTsDVBLinkageExtendedEvent * _gst_mpegts_dvb_linkage_extened_event_free (GstMpegTsDVBLinkageExtendedEvent *
item) item)
@ -539,7 +593,7 @@ _gst_mpegts_dvb_linkage_extened_event_free (GstMpegTsDVBLinkageExtendedEvent *
/** /**
* gst_mpegts_descriptor_parse_dvb_linkage: * gst_mpegts_descriptor_parse_dvb_linkage:
* @descriptor: a %GST_MTS_DESC_DVB_LINKAGE #GstMpegTsDescriptor * @descriptor: a %GST_MTS_DESC_DVB_LINKAGE #GstMpegTsDescriptor
* @res: (out) (transfer none): the #GstMpegTsDVBLinkageDescriptor to fill * @res: (out) (transfer full): the #GstMpegTsDVBLinkageDescriptor to fill
* *
* Extracts the DVB linkage information from @descriptor. * Extracts the DVB linkage information from @descriptor.
* *
@ -547,17 +601,20 @@ _gst_mpegts_dvb_linkage_extened_event_free (GstMpegTsDVBLinkageExtendedEvent *
*/ */
gboolean gboolean
gst_mpegts_descriptor_parse_dvb_linkage (const GstMpegTsDescriptor * descriptor, gst_mpegts_descriptor_parse_dvb_linkage (const GstMpegTsDescriptor * descriptor,
GstMpegTsDVBLinkageDescriptor * res) GstMpegTsDVBLinkageDescriptor ** desc)
{ {
guint i; guint i;
guint8 *data, *end; guint8 *data, *end;
GstMpegTsDVBLinkageDescriptor *res;
g_return_val_if_fail (descriptor != NULL && res != NULL, FALSE); g_return_val_if_fail (descriptor != NULL && desc != NULL, FALSE);
__common_desc_checks (descriptor, GST_MTS_DESC_DVB_LINKAGE, 7, FALSE); __common_desc_checks (descriptor, GST_MTS_DESC_DVB_LINKAGE, 7, FALSE);
data = (guint8 *) descriptor->data + 2; data = (guint8 *) descriptor->data + 2;
end = data + descriptor->length; end = data + descriptor->length;
res = g_slice_new0 (GstMpegTsDVBLinkageDescriptor);
res->transport_stream_id = GST_READ_UINT16_BE (data); res->transport_stream_id = GST_READ_UINT16_BE (data);
data += 2; data += 2;
@ -700,6 +757,8 @@ gst_mpegts_descriptor_parse_dvb_linkage (const GstMpegTsDescriptor * descriptor,
res->private_data_length = end - data; res->private_data_length = end - data;
res->private_data_bytes = g_memdup (data, res->private_data_length); res->private_data_bytes = g_memdup (data, res->private_data_length);
*desc = res;
return TRUE; return TRUE;
fail: fail:
@ -732,10 +791,9 @@ gst_mpegts_descriptor_parse_dvb_short_event (const GstMpegTsDescriptor *
data = (guint8 *) descriptor->data + 2; data = (guint8 *) descriptor->data + 2;
if (language_code) { if (language_code)
*language_code = g_malloc0 (4); *language_code = convert_lang_code (data);
memcpy (*language_code, data, 3);
}
data += 3; data += 3;
if (event_name) if (event_name)
*event_name = get_encoding_and_convert ((const gchar *) data + 1, *data); *event_name = get_encoding_and_convert ((const gchar *) data + 1, *data);
@ -750,7 +808,7 @@ gst_mpegts_descriptor_parse_dvb_short_event (const GstMpegTsDescriptor *
* gst_mpegts_descriptor_parse_dvb_teletext_idx: * gst_mpegts_descriptor_parse_dvb_teletext_idx:
* @descriptor: a %GST_MTS_DESC_DVB_TELETEXT #GstMpegTsDescriptor * @descriptor: a %GST_MTS_DESC_DVB_TELETEXT #GstMpegTsDescriptor
* @idx: The id of the teletext to get * @idx: The id of the teletext to get
* @language_code: (out) (allow-none): a 4-byte gchar array to hold language * @language_code: (out) (transfer full) (allow-none): a null-terminated string
* @teletext_type: (out) (allow-none): #GstMpegTsDVBTeletextType * @teletext_type: (out) (allow-none): #GstMpegTsDVBTeletextType
* @magazine_number: (out) (allow-none): * @magazine_number: (out) (allow-none):
* @page_number: (out) (allow-none): * @page_number: (out) (allow-none):
@ -761,7 +819,7 @@ gst_mpegts_descriptor_parse_dvb_short_event (const GstMpegTsDescriptor *
*/ */
gboolean gboolean
gst_mpegts_descriptor_parse_dvb_teletext_idx (const GstMpegTsDescriptor * gst_mpegts_descriptor_parse_dvb_teletext_idx (const GstMpegTsDescriptor *
descriptor, guint idx, gchar (*language_code)[4], descriptor, guint idx, gchar ** language_code,
GstMpegTsDVBTeletextType * teletext_type, guint8 * magazine_number, GstMpegTsDVBTeletextType * teletext_type, guint8 * magazine_number,
guint8 * page_number) guint8 * page_number)
{ {
@ -775,10 +833,8 @@ gst_mpegts_descriptor_parse_dvb_teletext_idx (const GstMpegTsDescriptor *
data = (guint8 *) descriptor->data + 2 + idx * 5; data = (guint8 *) descriptor->data + 2 + idx * 5;
if (language_code) { if (language_code)
memcpy (language_code, data, 3); *language_code = convert_lang_code (data);
(*language_code)[3] = 0;
}
if (teletext_type) if (teletext_type)
*teletext_type = data[3] >> 3; *teletext_type = data[3] >> 3;
@ -816,7 +872,7 @@ gst_mpegts_descriptor_parse_dvb_teletext_nb (const GstMpegTsDescriptor *
* gst_mpegts_descriptor_parse_dvb_subtitling_idx: * gst_mpegts_descriptor_parse_dvb_subtitling_idx:
* @descriptor: a %GST_MTS_DESC_DVB_SUBTITLING #GstMpegTsDescriptor * @descriptor: a %GST_MTS_DESC_DVB_SUBTITLING #GstMpegTsDescriptor
* @idx: Table id of the entry to parse * @idx: Table id of the entry to parse
* @lang: (out) (transfer none): 4-byte gchar array to hold the language code * @lang: (out) (transfer full): the language code
* @type: (out) (transfer none) (allow-none): the type of subtitling * @type: (out) (transfer none) (allow-none): the type of subtitling
* @composition_page_id: (out) (transfer none) (allow-none): the composition page id * @composition_page_id: (out) (transfer none) (allow-none): the composition page id
* @ancillary_page_id: (out) (transfer none) (allow-none): the ancillary page id * @ancillary_page_id: (out) (transfer none) (allow-none): the ancillary page id
@ -830,7 +886,7 @@ gst_mpegts_descriptor_parse_dvb_teletext_nb (const GstMpegTsDescriptor *
*/ */
gboolean gboolean
gst_mpegts_descriptor_parse_dvb_subtitling_idx (const GstMpegTsDescriptor * gst_mpegts_descriptor_parse_dvb_subtitling_idx (const GstMpegTsDescriptor *
descriptor, guint idx, gchar (*lang)[4], guint8 * type, descriptor, guint idx, gchar ** lang, guint8 * type,
guint16 * composition_page_id, guint16 * ancillary_page_id) guint16 * composition_page_id, guint16 * ancillary_page_id)
{ {
guint8 *data; guint8 *data;
@ -844,8 +900,7 @@ gst_mpegts_descriptor_parse_dvb_subtitling_idx (const GstMpegTsDescriptor *
data = (guint8 *) descriptor->data + 2 + idx * 8; data = (guint8 *) descriptor->data + 2 + idx * 8;
memcpy (lang, data, 3); *lang = convert_lang_code (data);
(*lang)[3] = 0;
data += 3; data += 3;
@ -911,17 +966,45 @@ gst_mpegts_descriptor_from_dvb_subtitling (const gchar * lang,
} }
/* GST_MTS_DESC_DVB_EXTENDED_EVENT (0x4E) */ /* GST_MTS_DESC_DVB_EXTENDED_EVENT (0x4E) */
static GstMpegTsExtendedEventDescriptor *
_gst_mpegts_extended_event_descriptor_copy (GstMpegTsExtendedEventDescriptor *
source)
{
GstMpegTsExtendedEventDescriptor *copy;
copy = g_slice_dup (GstMpegTsExtendedEventDescriptor, source);
copy->items = g_ptr_array_ref (source->items);
copy->text = g_slice_copy (sizeof (source->text), source->text);
return copy;
}
void
gst_mpegts_extended_event_descriptor_free (GstMpegTsExtendedEventDescriptor *
source)
{
g_free (source->text);
g_ptr_array_unref (source->items);
g_slice_free (GstMpegTsExtendedEventDescriptor, source);
}
G_DEFINE_BOXED_TYPE (GstMpegTsExtendedEventDescriptor,
gst_mpegts_extended_event_descriptor,
(GBoxedCopyFunc) _gst_mpegts_extended_event_descriptor_copy,
(GFreeFunc) gst_mpegts_extended_event_descriptor_free);
static void static void
_gst_mpegts_extended_event_item_free (GstMpegTsExtendedEventItem * item) _gst_mpegts_extended_event_item_free (GstMpegTsExtendedEventItem * item)
{ {
g_free (item->item);
g_free (item->item_description);
g_slice_free (GstMpegTsExtendedEventItem, item); g_slice_free (GstMpegTsExtendedEventItem, item);
} }
/** /**
* gst_mpegts_descriptor_parse_dvb_extended_event: * gst_mpegts_descriptor_parse_dvb_extended_event:
* @descriptor: a %GST_MTS_DESC_DVB_EXTENDED_EVENT #GstMpegTsDescriptor * @descriptor: a %GST_MTS_DESC_DVB_EXTENDED_EVENT #GstMpegTsDescriptor
* @res: (out) (transfer none): the #GstMpegTsExtendedEventDescriptor to fill * @res: (out) (transfer full): the #GstMpegTsExtendedEventDescriptor to fill
* *
* Extracts the DVB extended event information from @descriptor. * Extracts the DVB extended event information from @descriptor.
* *
@ -929,16 +1012,19 @@ _gst_mpegts_extended_event_item_free (GstMpegTsExtendedEventItem * item)
*/ */
gboolean gboolean
gst_mpegts_descriptor_parse_dvb_extended_event (const GstMpegTsDescriptor gst_mpegts_descriptor_parse_dvb_extended_event (const GstMpegTsDescriptor
* descriptor, GstMpegTsExtendedEventDescriptor * res) * descriptor, GstMpegTsExtendedEventDescriptor ** desc)
{ {
guint8 *data, *pdata; guint8 *data, *pdata;
guint8 tmp, len_item; guint8 tmp, len_item;
GstMpegTsExtendedEventItem *item; GstMpegTsExtendedEventItem *item;
GstMpegTsExtendedEventDescriptor *res;
g_return_val_if_fail (descriptor != NULL && res != NULL, FALSE); g_return_val_if_fail (descriptor != NULL && desc != NULL, FALSE);
/* Need at least 6 bytes (1 for desc number, 3 for language code, 2 for the loop length) */ /* Need at least 6 bytes (1 for desc number, 3 for language code, 2 for the loop length) */
__common_desc_checks (descriptor, GST_MTS_DESC_DVB_EXTENDED_EVENT, 6, FALSE); __common_desc_checks (descriptor, GST_MTS_DESC_DVB_EXTENDED_EVENT, 6, FALSE);
res = g_slice_new0 (GstMpegTsExtendedEventDescriptor);
data = (guint8 *) descriptor->data + 2; data = (guint8 *) descriptor->data + 2;
tmp = *data; tmp = *data;
@ -947,14 +1033,14 @@ gst_mpegts_descriptor_parse_dvb_extended_event (const GstMpegTsDescriptor
data += 1; data += 1;
memcpy (res->language_code, data, 3); res->language_code = convert_lang_code (data);
res->language_code[3] = 0;
data += 3; data += 3;
len_item = *data; len_item = *data;
if (len_item > descriptor->length - 5) if (len_item > descriptor->length - 5) {
gst_mpegts_extended_event_descriptor_free (res);
return FALSE; return FALSE;
}
data += 1; data += 1;
@ -975,30 +1061,64 @@ gst_mpegts_descriptor_parse_dvb_extended_event (const GstMpegTsDescriptor
g_ptr_array_add (res->items, item); g_ptr_array_add (res->items, item);
} }
if (pdata != data) if (pdata != data) {
gst_mpegts_extended_event_descriptor_free (res);
return FALSE; return FALSE;
}
res->text = get_encoding_and_convert ((const gchar *) data + 1, *data); res->text = get_encoding_and_convert ((const gchar *) data + 1, *data);
*desc = res;
return TRUE; return TRUE;
} }
/* GST_MTS_DESC_DVB_COMPONENT (0x50) */ /* GST_MTS_DESC_DVB_COMPONENT (0x50) */
static GstMpegTsComponentDescriptor *
_gst_mpegts_dvb_component_descriptor_copy (GstMpegTsComponentDescriptor *
source)
{
GstMpegTsComponentDescriptor *copy;
copy = g_slice_dup (GstMpegTsComponentDescriptor, source);
copy->language_code = g_strdup (source->language_code);
copy->text = g_strdup (source->text);
return copy;
}
void
gst_mpegts_dvb_component_descriptor_free (GstMpegTsComponentDescriptor * source)
{
if (source->language_code)
g_free (source->language_code);
if (source->text)
g_free (source->text);
g_slice_free (GstMpegTsComponentDescriptor, source);
}
G_DEFINE_BOXED_TYPE (GstMpegTsComponentDescriptor,
gst_mpegts_component_descriptor,
(GBoxedCopyFunc) _gst_mpegts_dvb_component_descriptor_copy,
(GFreeFunc) gst_mpegts_dvb_component_descriptor_free);
/** /**
* gst_mpegts_descriptor_parse_dvb_component: * gst_mpegts_descriptor_parse_dvb_component:
* @descriptor: a %GST_MTS_DESC_DVB_COMPONENT #GstMpegTsDescriptor * @descriptor: a %GST_MTS_DESC_DVB_COMPONENT #GstMpegTsDescriptor
* @res: (out) (transfer none): the #GstMpegTsComponentDescriptor to fill * @res: (out) (transfer full): the #GstMpegTsComponentDescriptor to fill
* *
* Extracts the DVB component information from @descriptor. * Extracts the DVB component information from @descriptor.
* *
* Returns: %TRUE if parsing succeeded, else %FALSE. * Returns: %TRUE if parsing succeeded, else %FALSE.
*/ */
gboolean gboolean
gst_mpegts_descriptor_parse_dvb_component (const GstMpegTsDescriptor gst_mpegts_descriptor_parse_dvb_component (const GstMpegTsDescriptor
* descriptor, GstMpegTsComponentDescriptor * res) * descriptor, GstMpegTsComponentDescriptor ** res)
{ {
guint8 *data; guint8 *data;
guint8 len; guint8 len;
GstMpegTsComponentDescriptor *desc;
g_return_val_if_fail (descriptor != NULL && res != NULL, FALSE); g_return_val_if_fail (descriptor != NULL && res != NULL, FALSE);
/* Need 6 bytes at least (1 for content, 1 for type, 1 for tag, 3 for language code) */ /* Need 6 bytes at least (1 for content, 1 for type, 1 for tag, 3 for language code) */
@ -1006,22 +1126,25 @@ gst_mpegts_descriptor_parse_dvb_component (const GstMpegTsDescriptor
data = (guint8 *) descriptor->data + 2; data = (guint8 *) descriptor->data + 2;
res->stream_content = *data & 0x0f; desc = g_slice_new0 (GstMpegTsComponentDescriptor);
desc->stream_content = *data & 0x0f;
data += 1; data += 1;
res->component_type = *data; desc->component_type = *data;
data += 1; data += 1;
res->component_tag = *data; desc->component_tag = *data;
data += 1; data += 1;
memcpy (res->language_code, data, 3); desc->language_code = convert_lang_code (data);
res->language_code[3] = 0;
data += 3; data += 3;
len = descriptor->length - 6; len = descriptor->length - 6;
if (len) if (len)
res->text = get_encoding_and_convert ((const gchar *) data, len); desc->text = get_encoding_and_convert ((const gchar *) data, len);
*res = desc;
return TRUE; return TRUE;
} }
@ -1057,9 +1180,9 @@ gst_mpegts_descriptor_parse_dvb_stream_identifier (const GstMpegTsDescriptor
/** /**
* gst_mpegts_descriptor_parse_dvb_ca_identifier: * gst_mpegts_descriptor_parse_dvb_ca_identifier:
* @descriptor: a %GST_MTS_DESC_DVB_CA_IDENTIFIER #GstMpegTsDescriptor * @descriptor: a %GST_MTS_DESC_DVB_CA_IDENTIFIER #GstMpegTsDescriptor
* @list: (out) (transfer none) (element-type guint16): This 16-bit field * @list: (out) (transfer full) (element-type guint16): a list of ca identifier.
* identifies the CA system. Allocations of the value of this field are found * Edge entry identifies the CA system. Allocations of the value of this field
* in http://www.dvbservices.com * are found in http://www.dvbservices.com
* *
* Extracts ca id's from @descriptor. * Extracts ca id's from @descriptor.
* *
@ -1100,7 +1223,7 @@ _gst_mpegts_content_free (GstMpegTsContent * content)
/** /**
* gst_mpegts_descriptor_parse_dvb_content: * gst_mpegts_descriptor_parse_dvb_content:
* @descriptor: a %GST_MTS_DESC_DVB_CONTENT #GstMpegTsDescriptor * @descriptor: a %GST_MTS_DESC_DVB_CONTENT #GstMpegTsDescriptor
* @content: (out) (transfer none) (element-type GstMpegTsContent): #GstMpegTsContent * @content: (out) (transfer full) (element-type GstMpegTsContent): #GstMpegTsContent
* *
* Extracts the DVB content information from @descriptor. * Extracts the DVB content information from @descriptor.
* *
@ -1142,13 +1265,14 @@ static void
_gst_mpegts_dvb_parental_rating_item_free (GstMpegTsDVBParentalRatingItem * _gst_mpegts_dvb_parental_rating_item_free (GstMpegTsDVBParentalRatingItem *
item) item)
{ {
g_free (item->country_code);
g_slice_free (GstMpegTsDVBParentalRatingItem, item); g_slice_free (GstMpegTsDVBParentalRatingItem, item);
} }
/** /**
* gst_mpegts_descriptor_parse_dvb_parental_rating: * gst_mpegts_descriptor_parse_dvb_parental_rating:
* @descriptor: a %GST_MTS_DESC_DVB_PARENTAL_RATING #GstMpegTsDescriptor * @descriptor: a %GST_MTS_DESC_DVB_PARENTAL_RATING #GstMpegTsDescriptor
* @rating: (out) (transfer none) (element-type GstMpegTsDVBParentalRatingItem): * @rating: (out) (transfer full) (element-type GstMpegTsDVBParentalRatingItem):
* #GstMpegTsDVBParentalRatingItem * #GstMpegTsDVBParentalRatingItem
* *
* Extracts the DVB parental rating information from @descriptor. * Extracts the DVB parental rating information from @descriptor.
@ -1175,8 +1299,7 @@ gst_mpegts_descriptor_parse_dvb_parental_rating (const GstMpegTsDescriptor
g_slice_new0 (GstMpegTsDVBParentalRatingItem); g_slice_new0 (GstMpegTsDVBParentalRatingItem);
g_ptr_array_add (*rating, item); g_ptr_array_add (*rating, item);
memcpy (item->country_code, data, 3); item->country_code = convert_lang_code (data);
item->country_code[3] = 0;
data += 3; data += 3;
if (g_strcmp0 (item->country_code, "BRA") == 0) { if (g_strcmp0 (item->country_code, "BRA") == 0) {
@ -1395,6 +1518,8 @@ static void
_gst_mpegts_dvb_multilingual_network_name_item_free _gst_mpegts_dvb_multilingual_network_name_item_free
(GstMpegTsDvbMultilingualNetworkNameItem * item) (GstMpegTsDvbMultilingualNetworkNameItem * item)
{ {
g_free (item->network_name);
g_free (item->language_code);
g_slice_free (GstMpegTsDvbMultilingualNetworkNameItem, item); g_slice_free (GstMpegTsDvbMultilingualNetworkNameItem, item);
} }
@ -1402,7 +1527,7 @@ static void
* gst_mpegts_descriptor_parse_dvb_multilingual_network_name: * gst_mpegts_descriptor_parse_dvb_multilingual_network_name:
* @descriptor: a %GST_MTS_DESC_DVB_MULTILINGUAL_NETWORK_NAME * @descriptor: a %GST_MTS_DESC_DVB_MULTILINGUAL_NETWORK_NAME
* #GstMpegTsDescriptor * #GstMpegTsDescriptor
* @network_name_items: (out) (element-type GstMpegTsDvbMultilingualNetworkNameItem): * @network_name_items: (out) (transfer full) (element-type GstMpegTsDvbMultilingualNetworkNameItem):
* a #GstMpegTsDvbMultilingualNetworkNameItem * a #GstMpegTsDvbMultilingualNetworkNameItem
* *
* Parses out the multilingual network name from the @descriptor. * Parses out the multilingual network name from the @descriptor.
@ -1429,7 +1554,7 @@ gst_mpegts_descriptor_parse_dvb_multilingual_network_name (const
for (i = 0; i < descriptor->length - 3;) { for (i = 0; i < descriptor->length - 3;) {
item = g_slice_new0 (GstMpegTsDvbMultilingualNetworkNameItem); item = g_slice_new0 (GstMpegTsDvbMultilingualNetworkNameItem);
g_ptr_array_add (*network_name_items, item); g_ptr_array_add (*network_name_items, item);
memcpy (item->language_code, data, 3); item->language_code = convert_lang_code (data);
data += 3; data += 3;
i += 3; i += 3;
@ -1448,6 +1573,8 @@ static void
_gst_mpegts_dvb_multilingual_bouquet_name_item_free _gst_mpegts_dvb_multilingual_bouquet_name_item_free
(GstMpegTsDvbMultilingualBouquetNameItem * item) (GstMpegTsDvbMultilingualBouquetNameItem * item)
{ {
g_free (item->language_code);
g_free (item->bouquet_name);
g_slice_free (GstMpegTsDvbMultilingualBouquetNameItem, item); g_slice_free (GstMpegTsDvbMultilingualBouquetNameItem, item);
} }
@ -1455,7 +1582,7 @@ static void
* gst_mpegts_descriptor_parse_dvb_multilingual_bouquet_name: * gst_mpegts_descriptor_parse_dvb_multilingual_bouquet_name:
* @descriptor: a %GST_MTS_DESC_DVB_MULTILINGUAL_BOUQUET_NAME * @descriptor: a %GST_MTS_DESC_DVB_MULTILINGUAL_BOUQUET_NAME
* #GstMpegTsDescriptor * #GstMpegTsDescriptor
* @bouquet_name_items: (out) (element-type GstMpegTsDvbMultilingualBouquetNameItem): * @bouquet_name_items: (out) (transfer full) (element-type GstMpegTsDvbMultilingualBouquetNameItem):
* a #GstMpegTsDvbMultilingualBouquetNameItem * a #GstMpegTsDvbMultilingualBouquetNameItem
* *
* Parses out the multilingual bouquet name from the @descriptor. * Parses out the multilingual bouquet name from the @descriptor.
@ -1482,7 +1609,7 @@ gst_mpegts_descriptor_parse_dvb_multilingual_bouquet_name (const
for (i = 0; i < descriptor->length - 3;) { for (i = 0; i < descriptor->length - 3;) {
item = g_slice_new0 (GstMpegTsDvbMultilingualBouquetNameItem); item = g_slice_new0 (GstMpegTsDvbMultilingualBouquetNameItem);
g_ptr_array_add (*bouquet_name_items, item); g_ptr_array_add (*bouquet_name_items, item);
memcpy (item->language_code, data, 3); item->language_code = convert_lang_code (data);
data += 3; data += 3;
i += 3; i += 3;
@ -1501,6 +1628,9 @@ static void
_gst_mpegts_dvb_multilingual_service_name_item_free _gst_mpegts_dvb_multilingual_service_name_item_free
(GstMpegTsDvbMultilingualServiceNameItem * item) (GstMpegTsDvbMultilingualServiceNameItem * item)
{ {
g_free (item->provider_name);
g_free (item->service_name);
g_free (item->language_code);
g_slice_free (GstMpegTsDvbMultilingualServiceNameItem, item); g_slice_free (GstMpegTsDvbMultilingualServiceNameItem, item);
} }
@ -1508,7 +1638,7 @@ static void
* gst_mpegts_descriptor_parse_dvb_multilingual_service_name: * gst_mpegts_descriptor_parse_dvb_multilingual_service_name:
* @descriptor: a %GST_MTS_DESC_DVB_MULTILINGUAL_SERVICE_NAME * @descriptor: a %GST_MTS_DESC_DVB_MULTILINGUAL_SERVICE_NAME
* #GstMpegTsDescriptor * #GstMpegTsDescriptor
* @service_name_items: (out) (element-type GstMpegTsDvbMultilingualServiceNameItem): * @service_name_items: (out) (transfer full) (element-type GstMpegTsDvbMultilingualServiceNameItem):
* a #GstMpegTsDvbMultilingualServiceNameItem * a #GstMpegTsDvbMultilingualServiceNameItem
* *
* Parses out the multilingual service name from the @descriptor. * Parses out the multilingual service name from the @descriptor.
@ -1535,7 +1665,7 @@ gst_mpegts_descriptor_parse_dvb_multilingual_service_name (const
for (i = 0; i < descriptor->length - 3;) { for (i = 0; i < descriptor->length - 3;) {
item = g_slice_new0 (GstMpegTsDvbMultilingualServiceNameItem); item = g_slice_new0 (GstMpegTsDvbMultilingualServiceNameItem);
g_ptr_array_add (*service_name_items, item); g_ptr_array_add (*service_name_items, item);
memcpy (item->language_code, data, 3); item->language_code = convert_lang_code (data);
data += 3; data += 3;
i += 3; i += 3;
@ -1560,6 +1690,8 @@ static void
_gst_mpegts_dvb_multilingual_component_item_free _gst_mpegts_dvb_multilingual_component_item_free
(GstMpegTsDvbMultilingualComponentItem * item) (GstMpegTsDvbMultilingualComponentItem * item)
{ {
g_free (item->language_code);
g_free (item->description);
g_slice_free (GstMpegTsDvbMultilingualComponentItem, item); g_slice_free (GstMpegTsDvbMultilingualComponentItem, item);
} }
@ -1568,7 +1700,7 @@ static void
* @descriptor: a %GST_MTS_DESC_DVB_MULTILINGUAL_COMPONENT * @descriptor: a %GST_MTS_DESC_DVB_MULTILINGUAL_COMPONENT
* #GstMpegTsDescriptor * #GstMpegTsDescriptor
* @component_tag: the component tag * @component_tag: the component tag
* @component_description_items: (out) (element-type GstMpegTsDvbMultilingualComponentItem): * @component_description_items: (out) (transfer full) (element-type GstMpegTsDvbMultilingualComponentItem):
* a #GstMpegTsDvbMultilingualComponentItem * a #GstMpegTsDvbMultilingualComponentItem
* *
* Parses out the multilingual component from the @descriptor. * Parses out the multilingual component from the @descriptor.
@ -1600,7 +1732,7 @@ gst_mpegts_descriptor_parse_dvb_multilingual_component (const
for (i = 0; i < descriptor->length - 3;) { for (i = 0; i < descriptor->length - 3;) {
item = g_slice_new0 (GstMpegTsDvbMultilingualComponentItem); item = g_slice_new0 (GstMpegTsDvbMultilingualComponentItem);
g_ptr_array_add (*component_description_items, item); g_ptr_array_add (*component_description_items, item);
memcpy (item->language_code, data, 3); item->language_code = convert_lang_code (data);
data += 3; data += 3;
i += 3; i += 3;
@ -1620,7 +1752,7 @@ gst_mpegts_descriptor_parse_dvb_multilingual_component (const
* @descriptor: a %GST_MTS_DESC_DVB_PRIVATE_DATA_SPECIFIER #GstMpegTsDescriptor * @descriptor: a %GST_MTS_DESC_DVB_PRIVATE_DATA_SPECIFIER #GstMpegTsDescriptor
* @private_data_specifier: (out): the private data specifier id * @private_data_specifier: (out): the private data specifier id
* registered by http://www.dvbservices.com/ * registered by http://www.dvbservices.com/
* @private_data: (out) (allow-none): additional data or NULL * @private_data: (out) (transfer full)(allow-none): additional data or NULL
* @length: (out) (allow-none): length of %private_data * @length: (out) (allow-none): length of %private_data
* *
* Parses out the private data specifier from the @descriptor. * Parses out the private data specifier from the @descriptor.
@ -1656,7 +1788,7 @@ gst_mpegts_descriptor_parse_dvb_private_data_specifier (const
* gst_mpegts_descriptor_parse_dvb_frequency_list: * gst_mpegts_descriptor_parse_dvb_frequency_list:
* @descriptor: a %GST_MTS_DESC_DVB_FREQUENCY_LIST #GstMpegTsDescriptor * @descriptor: a %GST_MTS_DESC_DVB_FREQUENCY_LIST #GstMpegTsDescriptor
* @offset: (out): %FALSE in Hz, %TRUE in kHz * @offset: (out): %FALSE in Hz, %TRUE in kHz
* @list: (out) (element-type guint32): a list of all frequencies in Hz/kHz * @list: (out) (transfer full) (element-type guint32): a list of all frequencies in Hz/kHz
* depending on %offset * depending on %offset
* *
* Parses out a list of frequencies from the @descriptor. * Parses out a list of frequencies from the @descriptor.
@ -1716,10 +1848,40 @@ gst_mpegts_descriptor_parse_dvb_frequency_list (const GstMpegTsDescriptor
} }
/* GST_MTS_DESC_DVB_DATA_BROADCAST (0x64) */ /* GST_MTS_DESC_DVB_DATA_BROADCAST (0x64) */
static GstMpegTsDataBroadcastDescriptor *
_gst_mpegts_dvb_data_broadcast_descriptor_copy (GstMpegTsDataBroadcastDescriptor
* source)
{
GstMpegTsDataBroadcastDescriptor *copy;
copy = g_slice_dup (GstMpegTsDataBroadcastDescriptor, source);
copy->selector_bytes = g_slice_copy (source->length, source->selector_bytes);
copy->language_code = g_strdup (source->language_code);
copy->text = g_strdup (source->text);
return copy;
}
void
gst_mpegts_dvb_data_broadcast_descriptor_free (GstMpegTsDataBroadcastDescriptor
* source)
{
g_free (source->selector_bytes);
g_free (source->language_code);
g_free (source->text);
g_slice_free (GstMpegTsDataBroadcastDescriptor, source);
}
G_DEFINE_BOXED_TYPE (GstMpegTsDataBroadcastDescriptor,
gst_mpegts_dvb_data_broadcast_descriptor,
(GBoxedCopyFunc) _gst_mpegts_dvb_data_broadcast_descriptor_copy,
(GFreeFunc) gst_mpegts_dvb_data_broadcast_descriptor_free);
/** /**
* gst_mpegts_descriptor_parse_dvb_data_broadcast: * gst_mpegts_descriptor_parse_dvb_data_broadcast:
* @descriptor: a %GST_MTS_DESC_DVB_DATA_BROADCAST #GstMpegTsDescriptor * @descriptor: a %GST_MTS_DESC_DVB_DATA_BROADCAST #GstMpegTsDescriptor
* @res: (out) (transfer none): #GstMpegTsDataBroadcastDescriptor * @res: (out) (transfer full): #GstMpegTsDataBroadcastDescriptor
* *
* Parses out the data broadcast from the @descriptor. * Parses out the data broadcast from the @descriptor.
* *
@ -1727,33 +1889,37 @@ gst_mpegts_descriptor_parse_dvb_frequency_list (const GstMpegTsDescriptor
*/ */
gboolean gboolean
gst_mpegts_descriptor_parse_dvb_data_broadcast (const GstMpegTsDescriptor gst_mpegts_descriptor_parse_dvb_data_broadcast (const GstMpegTsDescriptor
* descriptor, GstMpegTsDataBroadcastDescriptor * res) * descriptor, GstMpegTsDataBroadcastDescriptor ** desc)
{ {
guint8 *data; guint8 *data;
guint8 len; GstMpegTsDataBroadcastDescriptor *res;
g_return_val_if_fail (descriptor != NULL && res != NULL, FALSE); g_return_val_if_fail (descriptor != NULL && desc != NULL, FALSE);
__common_desc_checks (descriptor, GST_MTS_DESC_DVB_DATA_BROADCAST, 8, FALSE); __common_desc_checks (descriptor, GST_MTS_DESC_DVB_DATA_BROADCAST, 8, FALSE);
data = (guint8 *) descriptor->data + 2; data = (guint8 *) descriptor->data + 2;
res = g_slice_new0 (GstMpegTsDataBroadcastDescriptor);
res->data_broadcast_id = GST_READ_UINT16_BE (data); res->data_broadcast_id = GST_READ_UINT16_BE (data);
data += 2; data += 2;
res->component_tag = *data; res->component_tag = *data;
data += 1; data += 1;
len = *data; res->length = *data;
data += 1; data += 1;
res->selector_bytes = g_memdup (data, len); res->selector_bytes = g_memdup (data, res->length);
data += len; data += res->length;
memcpy (res->language_code, data, 3); res->language_code = convert_lang_code (data);
data += 3; data += 3;
res->text = get_encoding_and_convert ((const gchar *) data + 1, *data); res->text = get_encoding_and_convert ((const gchar *) data + 1, *data);
*desc = res;
return TRUE; return TRUE;
} }
@ -1793,7 +1959,7 @@ gst_mpegts_descriptor_parse_dvb_scrambling (const GstMpegTsDescriptor *
* gst_mpegts_descriptor_parse_dvb_data_broadcast_id: * gst_mpegts_descriptor_parse_dvb_data_broadcast_id:
* @descriptor: a %GST_MTS_DESC_DVB_DATA_BROADCAST_ID #GstMpegTsDescriptor * @descriptor: a %GST_MTS_DESC_DVB_DATA_BROADCAST_ID #GstMpegTsDescriptor
* @data_broadcast_id: (out): the data broadcast id * @data_broadcast_id: (out): the data broadcast id
* @id_selector_bytes: (out): the selector bytes, if present * @id_selector_bytes: (out) (transfer full): the selector bytes, if present
* @len: (out): the length of #id_selector_bytes * @len: (out): the length of #id_selector_bytes
* *
* Parses out the data broadcast id from the @descriptor. * Parses out the data broadcast id from the @descriptor.
@ -1825,6 +1991,30 @@ gst_mpegts_descriptor_parse_dvb_data_broadcast_id (const GstMpegTsDescriptor
} }
/* GST_MTS_DESC_EXT_DVB_T2_DELIVERY_SYSTEM (0x7F && 0x04) */ /* GST_MTS_DESC_EXT_DVB_T2_DELIVERY_SYSTEM (0x7F && 0x04) */
static GstMpegTsT2DeliverySystemDescriptor
* _gst_mpegts_t2_delivery_system_descriptor_copy
(GstMpegTsT2DeliverySystemDescriptor * source)
{
GstMpegTsT2DeliverySystemDescriptor *copy;
copy = g_slice_dup (GstMpegTsT2DeliverySystemDescriptor, source);
copy->cells = g_ptr_array_ref (source->cells);
return copy;
}
void gst_mpegts_t2_delivery_system_descriptor_free
(GstMpegTsT2DeliverySystemDescriptor * source)
{
g_ptr_array_unref (source->cells);
g_slice_free (GstMpegTsT2DeliverySystemDescriptor, source);
}
G_DEFINE_BOXED_TYPE (GstMpegTsT2DeliverySystemDescriptor,
gst_mpegts_t2_delivery_system_descriptor,
(GBoxedCopyFunc) _gst_mpegts_t2_delivery_system_descriptor_copy,
(GFreeFunc) gst_mpegts_t2_delivery_system_descriptor_free);
static void static void
_gst_mpegts_t2_delivery_system_cell_extension_free _gst_mpegts_t2_delivery_system_cell_extension_free
(GstMpegTsT2DeliverySystemCellExtension * ext) (GstMpegTsT2DeliverySystemCellExtension * ext)
@ -1836,13 +2026,14 @@ static void
_gst_mpegts_t2_delivery_system_cell_free (GstMpegTsT2DeliverySystemCell * cell) _gst_mpegts_t2_delivery_system_cell_free (GstMpegTsT2DeliverySystemCell * cell)
{ {
g_ptr_array_unref (cell->sub_cells); g_ptr_array_unref (cell->sub_cells);
g_array_unref (cell->centre_frequencies);
g_slice_free (GstMpegTsT2DeliverySystemCell, cell); g_slice_free (GstMpegTsT2DeliverySystemCell, cell);
} }
/** /**
* gst_mpegts_descriptor_parse_dvb_t2_delivery_system: * gst_mpegts_descriptor_parse_dvb_t2_delivery_system:
* @descriptor: a %GST_MTS_DESC_EXT_DVB_T2_DELIVERY_SYSTEM #GstMpegTsDescriptor * @descriptor: a %GST_MTS_DESC_EXT_DVB_T2_DELIVERY_SYSTEM #GstMpegTsDescriptor
* @res: (out) (transfer none): #GstMpegTsT2DeliverySystemDescriptor * @res: (out) (transfer full): #GstMpegTsT2DeliverySystemDescriptor
* *
* Parses out the DVB-T2 delivery system from the @descriptor. * Parses out the DVB-T2 delivery system from the @descriptor.
* *
@ -1850,19 +2041,22 @@ _gst_mpegts_t2_delivery_system_cell_free (GstMpegTsT2DeliverySystemCell * cell)
*/ */
gboolean gboolean
gst_mpegts_descriptor_parse_dvb_t2_delivery_system (const GstMpegTsDescriptor gst_mpegts_descriptor_parse_dvb_t2_delivery_system (const GstMpegTsDescriptor
* descriptor, GstMpegTsT2DeliverySystemDescriptor * res) * descriptor, GstMpegTsT2DeliverySystemDescriptor ** desc)
{ {
guint8 *data; guint8 *data;
guint8 len, freq_len, sub_cell_len; guint8 len, freq_len, sub_cell_len;
guint32 tmp_freq; guint32 tmp_freq;
guint8 i; guint8 i;
GstMpegTsT2DeliverySystemDescriptor *res;
g_return_val_if_fail (descriptor != NULL && res != NULL, FALSE); g_return_val_if_fail (descriptor != NULL && desc != NULL, FALSE);
__common_desc_ext_checks (descriptor, GST_MTS_DESC_EXT_DVB_T2_DELIVERY_SYSTEM, __common_desc_ext_checks (descriptor, GST_MTS_DESC_EXT_DVB_T2_DELIVERY_SYSTEM,
4, FALSE); 4, FALSE);
data = (guint8 *) descriptor->data + 3; data = (guint8 *) descriptor->data + 3;
res = g_slice_new0 (GstMpegTsT2DeliverySystemDescriptor);
res->plp_id = *data; res->plp_id = *data;
data += 1; data += 1;
@ -2007,5 +2201,7 @@ gst_mpegts_descriptor_parse_dvb_t2_delivery_system (const GstMpegTsDescriptor
} }
} }
} }
*desc = res;
return TRUE; return TRUE;
} }

View File

@ -449,8 +449,14 @@ struct _GstMpegTsDVBLinkageDescriptor
guint8 *private_data_bytes; guint8 *private_data_bytes;
}; };
#define GST_TYPE_MPEGTS_DVB_LINKAGE_DESCRIPTOR ( gst_mpegts_dvb_linkage_descriptor_get_type())
GType gst_mpegts_dvb_linkage_descriptor_get_type (void);
void gst_mpegts_dvb_linkage_descriptor_free (GstMpegTsDVBLinkageDescriptor * source);
gboolean gst_mpegts_descriptor_parse_dvb_linkage (const GstMpegTsDescriptor * descriptor, gboolean gst_mpegts_descriptor_parse_dvb_linkage (const GstMpegTsDescriptor * descriptor,
GstMpegTsDVBLinkageDescriptor * res); GstMpegTsDVBLinkageDescriptor ** res);
/* GST_MTS_DESC_DVB_SHORT_EVENT (0x4D) */ /* GST_MTS_DESC_DVB_SHORT_EVENT (0x4D) */
gboolean gst_mpegts_descriptor_parse_dvb_short_event (const GstMpegTsDescriptor *descriptor, gboolean gst_mpegts_descriptor_parse_dvb_short_event (const GstMpegTsDescriptor *descriptor,
@ -483,15 +489,20 @@ struct _GstMpegTsExtendedEventDescriptor
{ {
guint8 descriptor_number; guint8 descriptor_number;
guint8 last_descriptor_number; guint8 last_descriptor_number;
gchar language_code[4]; gchar *language_code;
GPtrArray *items; GPtrArray *items;
gchar *text; gchar *text;
}; };
#define GST_TYPE_MPEGTS_EXTENDED_EVENT_DESCRIPTOR (gst_mpegts_extended_event_descriptor_get_type())
GType gst_mpegts_extended_event_descriptor_get_type (void);
void gst_mpegts_extended_event_descriptor_free (GstMpegTsExtendedEventDescriptor * source);
gboolean gst_mpegts_descriptor_parse_dvb_extended_event (const GstMpegTsDescriptor *descriptor, gboolean gst_mpegts_descriptor_parse_dvb_extended_event (const GstMpegTsDescriptor *descriptor,
GstMpegTsExtendedEventDescriptor *res); GstMpegTsExtendedEventDescriptor **res);
/* GST_MTS_DESC_DVB_COMPONENT (0x50) */ /* GST_MTS_DESC_DVB_COMPONENT (0x50) */
#define GST_TYPE_MPEGTS_COMPONENT_DESCRIPTOR (gst_mpegts_component_descriptor_get_type ())
typedef enum { typedef enum {
GST_MPEGTS_STREAM_CONTENT_MPEG2_VIDEO = 0x01, GST_MPEGTS_STREAM_CONTENT_MPEG2_VIDEO = 0x01,
GST_MPEGTS_STREAM_CONTENT_MPEG1_LAYER2_AUDIO = 0x02, GST_MPEGTS_STREAM_CONTENT_MPEG1_LAYER2_AUDIO = 0x02,
@ -509,13 +520,14 @@ struct _GstMpegTsComponentDescriptor
guint8 stream_content; guint8 stream_content;
guint8 component_type; guint8 component_type;
guint8 component_tag; guint8 component_tag;
/* FIXME : Make it a separate (allocated, null-terminated) return value */ gchar *language_code;
gchar language_code[4];
gchar *text; gchar *text;
}; };
GType gst_mpegts_component_descriptor_get_type (void);
void gst_mpegts_dvb_component_descriptor_free (GstMpegTsComponentDescriptor * source);
gboolean gst_mpegts_descriptor_parse_dvb_component (const GstMpegTsDescriptor *descriptor, gboolean gst_mpegts_descriptor_parse_dvb_component (const GstMpegTsDescriptor *descriptor,
GstMpegTsComponentDescriptor *res); GstMpegTsComponentDescriptor **res);
/* GST_MTS_DESC_DVB_STREAM_IDENTIFIER (0x52) */ /* GST_MTS_DESC_DVB_STREAM_IDENTIFIER (0x52) */
gboolean gst_mpegts_descriptor_parse_dvb_stream_identifier (const GstMpegTsDescriptor *descriptor, gboolean gst_mpegts_descriptor_parse_dvb_stream_identifier (const GstMpegTsDescriptor *descriptor,
@ -562,7 +574,7 @@ typedef struct _GstMpegTsDVBParentalRatingItem GstMpegTsDVBParentalRatingItem;
*/ */
struct _GstMpegTsDVBParentalRatingItem struct _GstMpegTsDVBParentalRatingItem
{ {
gchar country_code[4]; gchar *country_code;
guint8 rating; guint8 rating;
}; };
@ -586,7 +598,7 @@ typedef enum {
} GstMpegTsDVBTeletextType; } GstMpegTsDVBTeletextType;
gboolean gst_mpegts_descriptor_parse_dvb_teletext_idx (const GstMpegTsDescriptor * gboolean gst_mpegts_descriptor_parse_dvb_teletext_idx (const GstMpegTsDescriptor *
descriptor, guint idx, gchar (*language_code)[4], descriptor, guint idx, gchar ** language_code,
GstMpegTsDVBTeletextType * teletext_type, guint8 * magazine_number, GstMpegTsDVBTeletextType * teletext_type, guint8 * magazine_number,
guint8 * page_number); guint8 * page_number);
@ -595,7 +607,7 @@ guint gst_mpegts_descriptor_parse_dvb_teletext_nb (const GstMpegTsDescriptor *
/* GST_MTS_DESC_DVB_SUBTITLING (0x59) */ /* GST_MTS_DESC_DVB_SUBTITLING (0x59) */
gboolean gst_mpegts_descriptor_parse_dvb_subtitling_idx (const GstMpegTsDescriptor *descriptor, gboolean gst_mpegts_descriptor_parse_dvb_subtitling_idx (const GstMpegTsDescriptor *descriptor,
guint idx, gchar (*lang)[4], guint idx, gchar ** lang,
guint8 *type, guint16 *composition_page_id, guint8 *type, guint16 *composition_page_id,
guint16 *ancillary_page_id); guint16 *ancillary_page_id);
guint gst_mpegts_descriptor_parse_dvb_subtitling_nb (const GstMpegTsDescriptor *descriptor); guint gst_mpegts_descriptor_parse_dvb_subtitling_nb (const GstMpegTsDescriptor *descriptor);
@ -691,7 +703,7 @@ typedef struct _GstMpegTsDvbMultilingualNetworkNameItem GstMpegTsDvbMultilingual
*/ */
struct _GstMpegTsDvbMultilingualNetworkNameItem struct _GstMpegTsDvbMultilingualNetworkNameItem
{ {
gchar language_code[4]; gchar *language_code;
gchar *network_name; gchar *network_name;
}; };
@ -710,7 +722,7 @@ typedef struct _GstMpegTsDvbMultilingualBouquetNameItem GstMpegTsDvbMultilingual
*/ */
struct _GstMpegTsDvbMultilingualBouquetNameItem struct _GstMpegTsDvbMultilingualBouquetNameItem
{ {
gchar language_code[4]; gchar *language_code;
gchar *bouquet_name; gchar *bouquet_name;
}; };
@ -730,7 +742,7 @@ typedef struct _GstMpegTsDvbMultilingualServiceNameItem GstMpegTsDvbMultilingual
*/ */
struct _GstMpegTsDvbMultilingualServiceNameItem struct _GstMpegTsDvbMultilingualServiceNameItem
{ {
gchar language_code[4]; gchar *language_code;
gchar *provider_name; gchar *provider_name;
gchar *service_name; gchar *service_name;
}; };
@ -748,7 +760,7 @@ typedef struct _GstMpegTsDvbMultilingualComponentItem GstMpegTsDvbMultilingualCo
*/ */
struct _GstMpegTsDvbMultilingualComponentItem struct _GstMpegTsDvbMultilingualComponentItem
{ {
gchar language_code[4]; gchar *language_code;
gchar *description; gchar *description;
}; };
@ -779,13 +791,18 @@ struct _GstMpegTsDataBroadcastDescriptor
{ {
guint16 data_broadcast_id; guint16 data_broadcast_id;
guint8 component_tag; guint8 component_tag;
guint8 length;
guint8 *selector_bytes; guint8 *selector_bytes;
gchar language_code[4]; gchar *language_code;
gchar *text; gchar *text;
}; };
#define GST_TYPE_MPEGTS_DVB_DATA_BROADCAST_DESCRIPTOR (gst_mpegts_dvb_data_broadcast_descriptor_get_type ())
GType gst_mpegts_dvb_data_broadcast_descriptor_get_type (void);
void gst_mpegts_dvb_data_broadcast_descriptor_free (GstMpegTsDataBroadcastDescriptor * source);
gboolean gst_mpegts_descriptor_parse_dvb_data_broadcast (const GstMpegTsDescriptor gboolean gst_mpegts_descriptor_parse_dvb_data_broadcast (const GstMpegTsDescriptor
*descriptor, GstMpegTsDataBroadcastDescriptor * res); *descriptor, GstMpegTsDataBroadcastDescriptor ** res);
/* GST_MTS_DESC_DVB_SCRAMBLING (0x65) */ /* GST_MTS_DESC_DVB_SCRAMBLING (0x65) */
typedef enum typedef enum
@ -872,8 +889,11 @@ struct _GstMpegTsT2DeliverySystemDescriptor
GPtrArray *cells; GPtrArray *cells;
}; };
#define GST_TYPE_MPEGTS_T2_DELIVERY_SYSTEM_DESCRIPTOR (gst_mpegts_t2_delivery_system_descriptor_get_type ())
GType gst_mpegts_t2_delivery_system_descriptor_get_type (void);
void gst_mpegts_t2_delivery_system_descriptor_free (GstMpegTsT2DeliverySystemDescriptor * source);
gboolean gst_mpegts_descriptor_parse_dvb_t2_delivery_system (const GstMpegTsDescriptor gboolean gst_mpegts_descriptor_parse_dvb_t2_delivery_system (const GstMpegTsDescriptor
*descriptor, GstMpegTsT2DeliverySystemDescriptor * res); *descriptor, GstMpegTsT2DeliverySystemDescriptor ** res);
G_END_DECLS G_END_DECLS

View File

@ -32,6 +32,7 @@ GST_DEBUG_CATEGORY_EXTERN (gst_mpegts_debug);
G_GNUC_INTERNAL void __initialize_descriptors (void); G_GNUC_INTERNAL void __initialize_descriptors (void);
G_GNUC_INTERNAL guint32 _calc_crc32 (const guint8 *data, guint datalen); G_GNUC_INTERNAL guint32 _calc_crc32 (const guint8 *data, guint datalen);
G_GNUC_INTERNAL gchar *get_encoding_and_convert (const gchar *text, guint length); G_GNUC_INTERNAL gchar *get_encoding_and_convert (const gchar *text, guint length);
G_GNUC_INTERNAL gchar *convert_lang_code (guint8 * data);
G_GNUC_INTERNAL guint8 *dvb_text_from_utf8 (const gchar * text, gsize *out_size); G_GNUC_INTERNAL guint8 *dvb_text_from_utf8 (const gchar * text, gsize *out_size);
G_GNUC_INTERNAL void _free_descriptor (GstMpegTsDescriptor *descriptor); G_GNUC_INTERNAL void _free_descriptor (GstMpegTsDescriptor *descriptor);
G_GNUC_INTERNAL GstMpegTsDescriptor *_new_descriptor (guint8 tag, guint8 length); G_GNUC_INTERNAL GstMpegTsDescriptor *_new_descriptor (guint8 tag, guint8 length);

View File

@ -622,6 +622,17 @@ failed:
} }
} }
gchar *
convert_lang_code (guint8 * data)
{
gchar *code;
/* the iso language code and country code is always 3 byte long */
code = g_malloc0 (4);
memcpy (code, data, 3);
return code;
}
void void
_packetize_descriptor_array (GPtrArray * array, guint8 ** out_data) _packetize_descriptor_array (GPtrArray * array, guint8 ** out_data)
{ {
@ -855,10 +866,43 @@ gst_mpegts_descriptor_from_registration (const gchar * format_identifier,
} }
/* GST_MTS_DESC_ISO_639_LANGUAGE (0x0A) */ /* GST_MTS_DESC_ISO_639_LANGUAGE (0x0A) */
static GstMpegTsISO639LanguageDescriptor *
_gst_mpegts_iso_639_language_descriptor_copy (GstMpegTsISO639LanguageDescriptor
* source)
{
GstMpegTsISO639LanguageDescriptor *copy;
guint i;
copy = g_slice_dup (GstMpegTsISO639LanguageDescriptor, source);
for (i = 0; i < source->nb_language; i++) {
copy->language[i] = g_strdup (source->language[i]);
}
return copy;
}
void
gst_mpegts_iso_639_language_descriptor_free (GstMpegTsISO639LanguageDescriptor
* desc)
{
guint i;
for (i = 0; i < desc->nb_language; i++) {
g_free (desc->language[i]);
}
g_slice_free (GstMpegTsISO639LanguageDescriptor, desc);
}
G_DEFINE_BOXED_TYPE (GstMpegTsISO639LanguageDescriptor,
gst_mpegts_iso_639_language,
(GBoxedCopyFunc) _gst_mpegts_iso_639_language_descriptor_copy,
(GFreeFunc) gst_mpegts_iso_639_language_descriptor_free);
/** /**
* gst_mpegts_descriptor_parse_iso_639_language: * gst_mpegts_descriptor_parse_iso_639_language:
* @descriptor: a %GST_MTS_DESC_ISO_639_LANGUAGE #GstMpegTsDescriptor * @descriptor: a %GST_MTS_DESC_ISO_639_LANGUAGE #GstMpegTsDescriptor
* @res: (out) (transfer none): the #GstMpegTsISO639LanguageDescriptor to fill * @res: (out) (transfer full): the #GstMpegTsISO639LanguageDescriptor to fill
* *
* Extracts the iso 639-2 language information from @descriptor. * Extracts the iso 639-2 language information from @descriptor.
* *
@ -869,23 +913,30 @@ gst_mpegts_descriptor_from_registration (const gchar * format_identifier,
*/ */
gboolean gboolean
gst_mpegts_descriptor_parse_iso_639_language (const GstMpegTsDescriptor * gst_mpegts_descriptor_parse_iso_639_language (const GstMpegTsDescriptor *
descriptor, GstMpegTsISO639LanguageDescriptor * res) descriptor, GstMpegTsISO639LanguageDescriptor ** desc)
{ {
guint i; guint i;
guint8 *data; guint8 *data;
GstMpegTsISO639LanguageDescriptor *res;
g_return_val_if_fail (descriptor != NULL && res != NULL, FALSE); g_return_val_if_fail (descriptor != NULL && desc != NULL, FALSE);
/* This descriptor can be empty, no size check needed */ /* This descriptor can be empty, no size check needed */
__common_desc_checks (descriptor, GST_MTS_DESC_ISO_639_LANGUAGE, 0, FALSE); __common_desc_checks (descriptor, GST_MTS_DESC_ISO_639_LANGUAGE, 0, FALSE);
data = (guint8 *) descriptor->data + 2; data = (guint8 *) descriptor->data + 2;
res = g_slice_new0 (GstMpegTsISO639LanguageDescriptor);
/* Each language is 3 + 1 bytes */ /* Each language is 3 + 1 bytes */
res->nb_language = descriptor->length / 4; res->nb_language = descriptor->length / 4;
for (i = 0; i < res->nb_language; i++) { for (i = 0; i < res->nb_language; i++) {
memcpy (res->language[i], data, 3); res->language[i] = convert_lang_code (data);
res->audio_type[i] = data[3]; res->audio_type[i] = data[3];
data += 4; data += 4;
} }
*desc = res;
return TRUE; return TRUE;
} }
@ -894,7 +945,7 @@ gst_mpegts_descriptor_parse_iso_639_language (const GstMpegTsDescriptor *
* gst_mpegts_descriptor_parse_iso_639_language_idx: * gst_mpegts_descriptor_parse_iso_639_language_idx:
* @descriptor: a %GST_MTS_DESC_ISO_639_LANGUAGE #GstMpegTsDescriptor * @descriptor: a %GST_MTS_DESC_ISO_639_LANGUAGE #GstMpegTsDescriptor
* @idx: Table id of the language to parse * @idx: Table id of the language to parse
* @lang: (out) (transfer none): 4-byte gchar array to hold the language code * @lang: (out) (transfer full): 4-byte gchar array to hold the language code
* @audio_type: (out) (transfer none) (allow-none): the #GstMpegTsIso639AudioType to set * @audio_type: (out) (transfer none) (allow-none): the #GstMpegTsIso639AudioType to set
* *
* Extracts the iso 639-2 language information from specific table id in @descriptor. * Extracts the iso 639-2 language information from specific table id in @descriptor.
@ -906,8 +957,7 @@ gst_mpegts_descriptor_parse_iso_639_language (const GstMpegTsDescriptor *
*/ */
gboolean gboolean
gst_mpegts_descriptor_parse_iso_639_language_idx (const GstMpegTsDescriptor * gst_mpegts_descriptor_parse_iso_639_language_idx (const GstMpegTsDescriptor *
descriptor, guint idx, gchar (*lang)[4], descriptor, guint idx, gchar ** lang, GstMpegTsIso639AudioType * audio_type)
GstMpegTsIso639AudioType * audio_type)
{ {
guint8 *data; guint8 *data;
@ -920,8 +970,7 @@ gst_mpegts_descriptor_parse_iso_639_language_idx (const GstMpegTsDescriptor *
data = (guint8 *) descriptor->data + 2 + idx * 4; data = (guint8 *) descriptor->data + 2 + idx * 4;
memcpy (lang, data, 3); *lang = convert_lang_code (data);
(*lang)[3] = 0;
data += 3; data += 3;
@ -969,6 +1018,7 @@ gst_mpegts_descriptor_parse_logical_channel (const GstMpegTsDescriptor *
__common_desc_checks (descriptor, GST_MTS_DESC_DTG_LOGICAL_CHANNEL, 0, FALSE); __common_desc_checks (descriptor, GST_MTS_DESC_DTG_LOGICAL_CHANNEL, 0, FALSE);
data = (guint8 *) descriptor->data + 2; data = (guint8 *) descriptor->data + 2;
res->nb_channels = descriptor->length / 4; res->nb_channels = descriptor->length / 4;
for (i = 0; i < res->nb_channels; i++) { for (i = 0; i < res->nb_channels; i++) {

View File

@ -287,14 +287,17 @@ typedef struct _GstMpegTsISO639LanguageDescriptor GstMpegTsISO639LanguageDescrip
struct _GstMpegTsISO639LanguageDescriptor struct _GstMpegTsISO639LanguageDescriptor
{ {
guint nb_language; guint nb_language;
gchar language[64][3]; gchar *language[64];
GstMpegTsIso639AudioType audio_type[64]; GstMpegTsIso639AudioType audio_type[64];
}; };
#define GST_TYPE_MPEGTS_ISO_639_LANGUAGE (gst_mpegts_iso_639_language_get_type ())
GType gst_mpegts_iso_639_language_get_type (void);
void gst_mpegts_iso_639_language_descriptor_free (GstMpegTsISO639LanguageDescriptor * desc);
gboolean gst_mpegts_descriptor_parse_iso_639_language (const GstMpegTsDescriptor *descriptor, gboolean gst_mpegts_descriptor_parse_iso_639_language (const GstMpegTsDescriptor *descriptor,
GstMpegTsISO639LanguageDescriptor *res); GstMpegTsISO639LanguageDescriptor **res);
gboolean gst_mpegts_descriptor_parse_iso_639_language_idx (const GstMpegTsDescriptor *descriptor, gboolean gst_mpegts_descriptor_parse_iso_639_language_idx (const GstMpegTsDescriptor *descriptor,
guint idx, gchar (*lang)[4], guint idx, gchar **lang,
GstMpegTsIso639AudioType *audio_type); GstMpegTsIso639AudioType *audio_type);
guint gst_mpegts_descriptor_parse_iso_639_language_nb (const GstMpegTsDescriptor *descriptor); guint gst_mpegts_descriptor_parse_iso_639_language_nb (const GstMpegTsDescriptor *descriptor);

View File

@ -967,7 +967,7 @@ gst_ts_demux_create_tags (TSDemuxStream * stream)
mpegts_get_descriptor_from_stream (bstream, mpegts_get_descriptor_from_stream (bstream,
GST_MTS_DESC_ISO_639_LANGUAGE); GST_MTS_DESC_ISO_639_LANGUAGE);
if (desc) { if (desc) {
gchar lang_code[4]; gchar *lang_code;
nb = gst_mpegts_descriptor_parse_iso_639_language_nb (desc); nb = gst_mpegts_descriptor_parse_iso_639_language_nb (desc);
@ -975,8 +975,10 @@ gst_ts_demux_create_tags (TSDemuxStream * stream)
for (i = 0; i < nb; i++) for (i = 0; i < nb; i++)
if (gst_mpegts_descriptor_parse_iso_639_language_idx (desc, i, &lang_code, if (gst_mpegts_descriptor_parse_iso_639_language_idx (desc, i, &lang_code,
NULL)) NULL)) {
add_iso639_language_to_tags (stream, lang_code); add_iso639_language_to_tags (stream, lang_code);
g_free (lang_code);
}
return; return;
} }
@ -985,7 +987,7 @@ gst_ts_demux_create_tags (TSDemuxStream * stream)
mpegts_get_descriptor_from_stream (bstream, GST_MTS_DESC_DVB_SUBTITLING); mpegts_get_descriptor_from_stream (bstream, GST_MTS_DESC_DVB_SUBTITLING);
if (desc) { if (desc) {
gchar lang_code[4]; gchar *lang_code;
nb = gst_mpegts_descriptor_parse_dvb_subtitling_nb (desc); nb = gst_mpegts_descriptor_parse_dvb_subtitling_nb (desc);
@ -993,8 +995,10 @@ gst_ts_demux_create_tags (TSDemuxStream * stream)
for (i = 0; i < nb; i++) for (i = 0; i < nb; i++)
if (gst_mpegts_descriptor_parse_dvb_subtitling_idx (desc, i, &lang_code, if (gst_mpegts_descriptor_parse_dvb_subtitling_idx (desc, i, &lang_code,
NULL, NULL, NULL)) NULL, NULL, NULL)) {
add_iso639_language_to_tags (stream, lang_code); add_iso639_language_to_tags (stream, lang_code);
g_free (lang_code);
}
} }
} }

View File

@ -178,8 +178,9 @@ dump_terrestrial_delivery (GstMpegTsDescriptor * desc, guint spacing)
g_printf ("%*s Constellation : %d (%s)\n", spacing, "", g_printf ("%*s Constellation : %d (%s)\n", spacing, "",
res.constellation, enum_name (GST_TYPE_MPEG_TS_MODULATION_TYPE, res.constellation, enum_name (GST_TYPE_MPEG_TS_MODULATION_TYPE,
res.constellation)); res.constellation));
g_printf ("%*s Hierarchy : %d (%s)\n", spacing, "", res.hierarchy, g_printf ("%*s Hierarchy : %d (%s)\n", spacing, "",
enum_name (GST_TYPE_MPEG_TS_TERRESTRIAL_HIERARCHY, res.hierarchy)); res.hierarchy, enum_name (GST_TYPE_MPEG_TS_TERRESTRIAL_HIERARCHY,
res.hierarchy));
g_printf ("%*s Code Rate HP : %d (%s)\n", spacing, "", g_printf ("%*s Code Rate HP : %d (%s)\n", spacing, "",
res.code_rate_hp, enum_name (GST_TYPE_MPEG_TS_DVB_CODE_RATE, res.code_rate_hp, enum_name (GST_TYPE_MPEG_TS_DVB_CODE_RATE,
res.code_rate_hp)); res.code_rate_hp));
@ -310,28 +311,25 @@ dump_multiligual_component (GstMpegTsDescriptor * desc, guint spacing)
static void static void
dump_linkage (GstMpegTsDescriptor * desc, guint spacing) dump_linkage (GstMpegTsDescriptor * desc, guint spacing)
{ {
GstMpegTsDVBLinkageDescriptor res; GstMpegTsDVBLinkageDescriptor *res;
res.private_data_length = 0;
res.private_data_bytes = NULL;
if (gst_mpegts_descriptor_parse_dvb_linkage (desc, &res)) { if (gst_mpegts_descriptor_parse_dvb_linkage (desc, &res)) {
g_printf ("%*s Linkage Descriptor : 0x%02x (%s)\n", spacing, "", g_printf ("%*s Linkage Descriptor : 0x%02x (%s)\n", spacing, "",
res.linkage_type, enum_name (GST_TYPE_MPEG_TS_DVB_LINKAGE_TYPE, res->linkage_type, enum_name (GST_TYPE_MPEG_TS_DVB_LINKAGE_TYPE,
res.linkage_type)); res->linkage_type));
g_printf ("%*s Transport Stream ID : 0x%04x\n", spacing, "", g_printf ("%*s Transport Stream ID : 0x%04x\n", spacing, "",
res.transport_stream_id); res->transport_stream_id);
g_printf ("%*s Original Network ID : 0x%04x\n", spacing, "", g_printf ("%*s Original Network ID : 0x%04x\n", spacing, "",
res.original_network_id); res->original_network_id);
g_printf ("%*s Service ID : 0x%04x\n", spacing, "", g_printf ("%*s Service ID : 0x%04x\n", spacing, "",
res.service_id); res->service_id);
switch (res.linkage_type) { switch (res->linkage_type) {
case GST_MPEGTS_DVB_LINKAGE_MOBILE_HAND_OVER: case GST_MPEGTS_DVB_LINKAGE_MOBILE_HAND_OVER:
{ {
GstMpegTsDVBLinkageMobileHandOver *linkage = GstMpegTsDVBLinkageMobileHandOver *linkage =
(GstMpegTsDVBLinkageMobileHandOver *) res.linkage_data; (GstMpegTsDVBLinkageMobileHandOver *) res->linkage_data;
g_printf ("%*s hand_over_type : 0x%02x (%s)\n", spacing, g_printf ("%*s hand_over_type : 0x%02x (%s)\n", spacing,
"", linkage->hand_over_type, "", linkage->hand_over_type,
enum_name (GST_TYPE_MPEG_TS_DVB_LINKAGE_HAND_OVER_TYPE, enum_name (GST_TYPE_MPEG_TS_DVB_LINKAGE_HAND_OVER_TYPE,
@ -347,7 +345,7 @@ dump_linkage (GstMpegTsDescriptor * desc, guint spacing)
case GST_MPEGTS_DVB_LINKAGE_EVENT: case GST_MPEGTS_DVB_LINKAGE_EVENT:
{ {
GstMpegTsDVBLinkageEvent *linkage = GstMpegTsDVBLinkageEvent *linkage =
(GstMpegTsDVBLinkageEvent *) res.linkage_data; (GstMpegTsDVBLinkageEvent *) res->linkage_data;
g_printf ("%*s target_event_id : 0x%04x\n", spacing, "", g_printf ("%*s target_event_id : 0x%04x\n", spacing, "",
linkage->target_event_id); linkage->target_event_id);
g_printf ("%*s target_listed : %s\n", spacing, "", g_printf ("%*s target_listed : %s\n", spacing, "",
@ -359,7 +357,7 @@ dump_linkage (GstMpegTsDescriptor * desc, guint spacing)
case GST_MPEGTS_DVB_LINKAGE_EXTENDED_EVENT: case GST_MPEGTS_DVB_LINKAGE_EXTENDED_EVENT:
{ {
guint i; guint i;
GPtrArray *items = (GPtrArray *) res.linkage_data; GPtrArray *items = (GPtrArray *) res->linkage_data;
for (i = 0; i < items->len; i++) { for (i = 0; i < items->len; i++) {
GstMpegTsDVBLinkageExtendedEvent *linkage = GstMpegTsDVBLinkageExtendedEvent *linkage =
@ -398,31 +396,31 @@ dump_linkage (GstMpegTsDescriptor * desc, guint spacing)
default: default:
break; break;
} }
if (res.private_data_length > 0) { if (res->private_data_length > 0) {
dump_memory_bytes (res.private_data_bytes, res.private_data_length, dump_memory_bytes (res->private_data_bytes, res->private_data_length,
spacing + 2); spacing + 2);
g_free ((gpointer) res.private_data_bytes);
} }
gst_mpegts_dvb_linkage_descriptor_free (res);
} }
} }
static void static void
dump_component (GstMpegTsDescriptor * desc, guint spacing) dump_component (GstMpegTsDescriptor * desc, guint spacing)
{ {
GstMpegTsComponentDescriptor res; GstMpegTsComponentDescriptor *res;
res.text = NULL;
if (gst_mpegts_descriptor_parse_dvb_component (desc, &res)) { if (gst_mpegts_descriptor_parse_dvb_component (desc, &res)) {
g_printf ("%*s stream_content : 0x%02x (%s)\n", spacing, "", g_printf ("%*s stream_content : 0x%02x (%s)\n", spacing, "",
res.stream_content, res->stream_content,
enum_name (GST_TYPE_MPEG_TS_COMPONENT_STREAM_CONTENT, enum_name (GST_TYPE_MPEG_TS_COMPONENT_STREAM_CONTENT,
res.stream_content)); res->stream_content));
g_printf ("%*s component_type : 0x%02x\n", spacing, "", res.component_type); g_printf ("%*s component_type : 0x%02x\n", spacing, "",
g_printf ("%*s component_tag : 0x%02x\n", spacing, "", res.component_tag); res->component_type);
g_printf ("%*s language_code : %s\n", spacing, "", res.language_code); g_printf ("%*s component_tag : 0x%02x\n", spacing, "", res->component_tag);
g_printf ("%*s language_code : %s\n", spacing, "", res->language_code);
g_printf ("%*s text : %s\n", spacing, "", g_printf ("%*s text : %s\n", spacing, "",
res.text ? res.text : "NULL"); res->text ? res->text : "NULL");
gst_mpegts_dvb_component_descriptor_free (res);
} }
} }
@ -452,35 +450,37 @@ static void
dump_iso_639_language (GstMpegTsDescriptor * desc, guint spacing) dump_iso_639_language (GstMpegTsDescriptor * desc, guint spacing)
{ {
guint i; guint i;
GstMpegTsISO639LanguageDescriptor res; GstMpegTsISO639LanguageDescriptor *res;
if (gst_mpegts_descriptor_parse_iso_639_language (desc, &res)) { if (gst_mpegts_descriptor_parse_iso_639_language (desc, &res)) {
for (i = 0; i < res.nb_language; i++) for (i = 0; i < res->nb_language; i++) {
g_print g_print
("%*s ISO 639 Language Descriptor %c%c%c , audio_type:0x%x (%s)\n", ("%*s ISO 639 Language Descriptor %s , audio_type:0x%x (%s)\n",
spacing, "", res.language[i][0], res.language[i][1], spacing, "", res->language[i], res->audio_type[i],
res.language[i][2], res.audio_type[i], enum_name (GST_TYPE_MPEG_TS_ISO639_AUDIO_TYPE, res->audio_type[i]));
enum_name (GST_TYPE_MPEG_TS_ISO639_AUDIO_TYPE, res.audio_type[i])); }
gst_mpegts_iso_639_language_descriptor_free (res);
} }
} }
static void static void
dump_dvb_extended_event (GstMpegTsDescriptor * desc, guint spacing) dump_dvb_extended_event (GstMpegTsDescriptor * desc, guint spacing)
{ {
GstMpegTsExtendedEventDescriptor res; GstMpegTsExtendedEventDescriptor *res;
if (gst_mpegts_descriptor_parse_dvb_extended_event (desc, &res)) { if (gst_mpegts_descriptor_parse_dvb_extended_event (desc, &res)) {
guint i; guint i;
g_printf ("%*s DVB Extended Event\n", spacing, ""); g_printf ("%*s DVB Extended Event\n", spacing, "");
g_printf ("%*s descriptor_number:%d, last_descriptor_number:%d\n", g_printf ("%*s descriptor_number:%d, last_descriptor_number:%d\n",
spacing, "", res.descriptor_number, res.last_descriptor_number); spacing, "", res->descriptor_number, res->last_descriptor_number);
g_printf ("%*s language_code:%s\n", spacing, "", res.language_code); g_printf ("%*s language_code:%s\n", spacing, "", res->language_code);
g_printf ("%*s text : %s\n", spacing, "", res.text); g_printf ("%*s text : %s\n", spacing, "", res->text);
for (i = 0; i < res.items->len; i++) { for (i = 0; i < res->items->len; i++) {
GstMpegTsExtendedEventItem *item = g_ptr_array_index (res.items, i); GstMpegTsExtendedEventItem *item = g_ptr_array_index (res->items, i);
g_printf ("%*s #%d [description:item] %s : %s\n", g_printf ("%*s #%d [description:item] %s : %s\n",
spacing, "", i, item->item_description, item->item); spacing, "", i, item->item_description, item->item);
} }
gst_mpegts_extended_event_descriptor_free (res);
} }
} }
@ -579,8 +579,18 @@ dump_descriptors (GPtrArray * descriptors, guint spacing)
} }
case GST_MTS_DESC_DVB_PRIVATE_DATA_SPECIFIER: case GST_MTS_DESC_DVB_PRIVATE_DATA_SPECIFIER:
{ {
if (!DUMP_DESCRIPTORS) guint32 specifier;
dump_memory_content (desc, spacing + 2); guint8 len = 0, *data = NULL;
if (gst_mpegts_descriptor_parse_dvb_private_data_specifier (desc,
&specifier, &data, &len)) {
g_printf ("%*s private_data_specifier : 0x%08x\n", spacing, "",
specifier);
if (len > 0) {
dump_memory_bytes (data, len, spacing + 2);
g_free (data);
}
}
break; break;
} }
case GST_MTS_DESC_DVB_FREQUENCY_LIST: case GST_MTS_DESC_DVB_FREQUENCY_LIST:
@ -647,6 +657,25 @@ dump_descriptors (GPtrArray * descriptors, guint spacing)
} }
break; break;
} }
case GST_MTS_DESC_DVB_DATA_BROADCAST:
{
GstMpegTsDataBroadcastDescriptor *res;
if (gst_mpegts_descriptor_parse_dvb_data_broadcast (desc, &res)) {
g_printf ("%*s data_broadcast_id : 0x%04x\n", spacing, "",
res->data_broadcast_id);
g_printf ("%*s component_tag : 0x%02x\n", spacing, "",
res->component_tag);
if (res->length > 0) {
g_printf ("%*s selector_bytes:\n", spacing, "");
dump_memory_bytes (res->selector_bytes, res->length, spacing + 2);
}
g_printf ("%*s text : %s\n", spacing, "",
res->text ? res->text : "NULL");
gst_mpegts_dvb_data_broadcast_descriptor_free (res);
}
break;
}
case GST_MTS_DESC_ISO_639_LANGUAGE: case GST_MTS_DESC_ISO_639_LANGUAGE:
dump_iso_639_language (desc, spacing + 2); dump_iso_639_language (desc, spacing + 2);
break; break;
@ -672,7 +701,7 @@ dump_descriptors (GPtrArray * descriptors, guint spacing)
} }
case GST_MTS_DESC_DVB_SUBTITLING: case GST_MTS_DESC_DVB_SUBTITLING:
{ {
gchar lang[4]; gchar *lang;
guint8 type; guint8 type;
guint16 composition; guint16 composition;
guint16 ancillary; guint16 ancillary;
@ -687,13 +716,14 @@ dump_descriptors (GPtrArray * descriptors, guint spacing)
composition); composition);
g_printf ("%*s ancillary page id : %u\n", spacing, "", g_printf ("%*s ancillary page id : %u\n", spacing, "",
ancillary); ancillary);
g_free (lang);
} }
} }
break; break;
case GST_MTS_DESC_DVB_TELETEXT: case GST_MTS_DESC_DVB_TELETEXT:
{ {
GstMpegTsDVBTeletextType type; GstMpegTsDVBTeletextType type;
gchar lang[4]; gchar *lang;
guint8 magazine, page_number; guint8 magazine, page_number;
guint j; guint j;
@ -705,6 +735,7 @@ dump_descriptors (GPtrArray * descriptors, guint spacing)
g_printf ("%*s language : %s\n", spacing, "", lang); g_printf ("%*s language : %s\n", spacing, "", lang);
g_printf ("%*s magazine : %u\n", spacing, "", magazine); g_printf ("%*s magazine : %u\n", spacing, "", magazine);
g_printf ("%*s page number : %u\n", spacing, "", page_number); g_printf ("%*s page number : %u\n", spacing, "", page_number);
g_free (lang);
} }
} }
break; break;