example: ts-parser: add content descriptor

https://bugzilla.gnome.org/show_bug.cgi?id=730854
This commit is contained in:
Stefan Ringel 2014-05-28 12:23:12 +02:00 committed by Edward Hervey
parent 1c9bbb1e00
commit c35dc33b7f
2 changed files with 40 additions and 0 deletions

View file

@ -526,6 +526,20 @@ gboolean gst_mpegts_descriptor_parse_dvb_ca_identifier (const GstMpegTsDescripto
GArray ** list);
/* GST_MTS_DESC_DVB_CONTENT (0x54) */
typedef enum {
GST_MPEGTS_CONTENT_MOVIE_DRAMA = 0x01,
GST_MPEGTS_CONTENT_NEWS_CURRENT_AFFAIRS = 0x02,
GST_MPEGTS_CONTENT_SHOW_GAME_SHOW = 0x03,
GST_MPEGTS_CONTENT_SPORTS = 0x04,
GST_MPEGTS_CONTENT_CHILDREN_YOUTH_PROGRAM = 0x05,
GST_MPEGTS_CONTENT_MUSIC_BALLET_DANCE = 0x06,
GST_MPEGTS_CONTENT_ARTS_CULTURE = 0x07,
GST_MPEGTS_CONTENT_SOCIAL_POLITICAL_ECONOMICS = 0x08,
GST_MPEGTS_CONTENT_EDUCATION_SCIENCE_FACTUAL = 0x09,
GST_MPEGTS_CONTENT_LEISURE_HOBBIES = 0x0A,
GST_MPEGTS_CONTENT_SPECIAL_CHARACTERISTICS = 0x0B
} GstMpegTsContentNibbleHi;
typedef struct _GstMpegTsContent GstMpegTsContent;
struct _GstMpegTsContent
{

View file

@ -426,6 +426,28 @@ dump_component (GstMpegTsDescriptor * desc, guint spacing)
}
}
static void
dump_content (GstMpegTsDescriptor * desc, guint spacing)
{
GPtrArray *contents;
guint i;
if (gst_mpegts_descriptor_parse_dvb_content (desc, &contents)) {
for (i = 0; i < contents->len; i++) {
GstMpegTsContent *item = g_ptr_array_index (contents, i);
g_printf ("%*s content nibble 1 : 0x%01x (%s)\n", spacing, "",
item->content_nibble_1,
enum_name (GST_TYPE_MPEG_TS_CONTENT_NIBBLE_HI,
item->content_nibble_1));
g_printf ("%*s content nibble 2 : 0x%01x\n", spacing, "",
item->content_nibble_2);
g_printf ("%*s user_byte : 0x%02x\n", spacing, "",
item->user_byte);
}
g_ptr_array_unref (contents);
}
}
static void
dump_iso_639_language (GstMpegTsDescriptor * desc, guint spacing)
{
@ -583,6 +605,9 @@ dump_descriptors (GPtrArray * descriptors, guint spacing)
case GST_MTS_DESC_DVB_COMPONENT:
dump_component (desc, spacing + 2);
break;
case GST_MTS_DESC_DVB_CONTENT:
dump_content (desc, spacing + 2);
break;
case GST_MTS_DESC_ISO_639_LANGUAGE:
dump_iso_639_language (desc, spacing + 2);
break;
@ -1123,6 +1148,7 @@ main (int argc, gchar ** argv)
g_type_class_ref (GST_TYPE_MPEG_TS_DVB_LINKAGE_TYPE);
g_type_class_ref (GST_TYPE_MPEG_TS_DVB_LINKAGE_HAND_OVER_TYPE);
g_type_class_ref (GST_TYPE_MPEG_TS_COMPONENT_STREAM_CONTENT);
g_type_class_ref (GST_TYPE_MPEG_TS_CONTENT_NIBBLE_HI);
mainloop = g_main_loop_new (NULL, FALSE);