mpegts: add parsing data broadcast descriptor

Signed-off-by: Stefan Ringel <linuxtv@stefanringel.de>

https://bugzilla.gnome.org/show_bug.cgi?id=727187
This commit is contained in:
Stefan Ringel 2014-03-27 21:21:23 +01:00 committed by Edward Hervey
parent f8b7a130cc
commit 8b8ceb2dd9
3 changed files with 63 additions and 3 deletions

View file

@ -43,7 +43,6 @@
* * Add parsing methods for the following descriptors that were previously
* handled in mpegtsbase:
* * GST_MTS_DESC_DVB_DATA_BROADCAST_ID
* * GST_MTS_DESC_DVB_DATA_BROADCAST
* * GST_MTS_DESC_DVB_CAROUSEL_IDENTIFIER
* * GST_MTS_DESC_DVB_FREQUENCY_LIST
*/
@ -921,3 +920,45 @@ gst_mpegts_descriptor_parse_terrestrial_delivery_system (const
return TRUE;
}
/* GST_MTS_DESC_DVB_DATA_BROADCAST (0x64) */
/**
* gst_mpegts_descriptor_parse_data_broadcast:
* @descriptor: a %GST_MTS_DESC_DVB_DATA_BROADCAST #GstMpegTsDescriptor
* @res: (out) (transfer none): #GstMpegTsDataBroadcastDescriptor
*
* Parses out the data broadcast from the @descriptor.
*
* Returns: %TRUE if the parsing happened correctly, else %FALSE.
*/
gboolean
gst_mpegts_descriptor_parse_dvb_data_broadcast (const GstMpegTsDescriptor
* descriptor, GstMpegTsDataBroadcastDescriptor * res)
{
guint8 *data;
guint8 len;
g_return_val_if_fail (descriptor != NULL && res != NULL, FALSE);
__common_desc_checks (descriptor, GST_MTS_DESC_DVB_DATA_BROADCAST, 8, FALSE);
data = (guint8 *) descriptor->data + 2;
res->data_broadcast_id = GST_READ_UINT16_BE (data);
data += 2;
res->component_tag = *data;
data += 1;
len = *data;
data += 1;
res->selector_bytes = g_memdup (data, len);
data += len;
memcpy (data, res->language_code, 3);
data += 3;
res->text = get_encoding_and_convert ((const gchar *) data + 1, *data);
return TRUE;
}

View file

@ -480,7 +480,27 @@ gboolean gst_mpegts_descriptor_parse_terrestrial_delivery_system (const GstMpegT
/* FIXME : Implement */
/* GST_MTS_DESC_DVB_DATA_BROADCAST (0x64) */
/* FIXME: Implement */
typedef struct _GstMpegTsDataBroadcastDescriptor GstMpegTsDataBroadcastDescriptor;
/**
* GstMpegTsDataBroadcastDescriptor:
* @data_broadcast_id: the data broadcast id
* @component_tag: the component tag
* @selector_bytes: the selector byte field
* @language_code: language of @text
* @text: description of data broadcast
*/
struct _GstMpegTsDataBroadcastDescriptor
{
guint16 data_broadcast_id;
guint8 component_tag;
guint8 *selector_bytes;
gchar language_code[3];
gchar *text;
};
gboolean gst_mpegts_descriptor_parse_dvb_data_broadcast (const GstMpegTsDescriptor
*descriptor, GstMpegTsDataBroadcastDescriptor * res);
/* GST_MTS_DESC_DVB_DATA_BROADCAST_ID (0x66) */
/* FIXME : Implement */

View file

@ -64,7 +64,6 @@
* * Add parsing methods for the following descriptors that were previously
* handled in mpegtsbase:
* * GST_MTS_DESC_DVB_DATA_BROADCAST_ID
* * GST_MTS_DESC_DVB_DATA_BROADCAST
* * GST_MTS_DESC_DVB_CAROUSEL_IDENTIFIER
* * GST_MTS_DESC_DVB_FREQUENCY_LIST
*/