mpegtsparse: add parsing of data broadcast descriptors

This commit is contained in:
Zaheer Abbas Merali 2009-07-07 15:28:04 +01:00
parent 9b9b8cd58e
commit 66a5549094
2 changed files with 37 additions and 0 deletions

View file

@ -302,6 +302,19 @@
#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;

View 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);
}