summaryrefslogtreecommitdiff
path: root/tests/examples/mpegts
diff options
context:
space:
mode:
authorJesper Larsen <jesper.larsen@ixonos.com>2013-10-31 14:27:10 +0100
committerEdward Hervey <edward@collabora.com>2014-03-15 18:16:13 +0100
commit5f3270814810ccbc5e01864aa0c2c05bf733d716 (patch)
treea88d3d6902a6eedf2a41de40bcafc80a88191609 /tests/examples/mpegts
parent1f2f0f31bf50aab4fd02c8f8c4e9708f777530bb (diff)
examples: ts-parser: Add table_id_name function
https://bugzilla.gnome.org/show_bug.cgi?id=721682
Diffstat (limited to 'tests/examples/mpegts')
-rw-r--r--tests/examples/mpegts/ts-parser.c33
1 files changed, 31 insertions, 2 deletions
diff --git a/tests/examples/mpegts/ts-parser.c b/tests/examples/mpegts/ts-parser.c
index 3fee8a4e8..978d4312a 100644
--- a/tests/examples/mpegts/ts-parser.c
+++ b/tests/examples/mpegts/ts-parser.c
@@ -106,6 +106,30 @@ descriptor_name (gint val)
}
static const gchar *
+table_id_name (gint val)
+{
+ GEnumValue *en;
+
+ en = g_enum_get_value (G_ENUM_CLASS (g_type_class_peek
+ (GST_TYPE_MPEG_TS_SECTION_TABLE_ID)), val);
+ if (en == NULL)
+ /* Else try with DVB enum types */
+ en = g_enum_get_value (G_ENUM_CLASS (g_type_class_peek
+ (GST_TYPE_MPEG_TS_SECTION_DVB_TABLE_ID)), val);
+ if (en == NULL)
+ /* Else try with ATSC enum types */
+ en = g_enum_get_value (G_ENUM_CLASS (g_type_class_peek
+ (GST_TYPE_MPEG_TS_SECTION_ATSC_TABLE_ID)), val);
+ if (en == NULL)
+ /* Else try with SCTE enum types */
+ en = g_enum_get_value (G_ENUM_CLASS (g_type_class_peek
+ (GST_TYPE_MPEG_TS_SECTION_SCTE_TABLE_ID)), val);
+ if (en == NULL)
+ return "UNKNOWN/PRIVATE";
+ return en->value_nick;
+}
+
+static const gchar *
enum_name (GType instance_type, gint val)
{
GEnumValue *en;
@@ -509,12 +533,14 @@ _on_bus_message (GstBus * bus, GstMessage * message, GMainLoop * mainloop)
{
GstMpegTsSection *section;
if ((section = gst_message_parse_mpegts_section (message))) {
+ const gchar *table_name;
+
+ table_name = table_id_name (section->table_id);
g_print
("Got section: PID:0x%04x type:%s (table_id 0x%02x (%s)) at offset %"
G_GUINT64_FORMAT "\n", section->pid,
enum_name (GST_TYPE_MPEG_TS_SECTION_TYPE, section->section_type),
- section->table_id, enum_name (GST_TYPE_MPEG_TS_SECTION_TABLE_ID,
- section->table_id), section->offset);
+ section->table_id, table_name, section->offset);
if (!section->short_section) {
g_print
(" subtable_extension:0x%04x, version_number:0x%02x\n",
@@ -567,6 +593,9 @@ main (int argc, gchar ** argv)
g_type_class_ref (GST_TYPE_MPEG_TS_DVB_SERVICE_TYPE);
g_type_class_ref (GST_TYPE_MPEG_TS_DVB_TELETEXT_TYPE);
g_type_class_ref (GST_TYPE_MPEG_TS_STREAM_TYPE);
+ g_type_class_ref (GST_TYPE_MPEG_TS_SECTION_DVB_TABLE_ID);
+ g_type_class_ref (GST_TYPE_MPEG_TS_SECTION_ATSC_TABLE_ID);
+ g_type_class_ref (GST_TYPE_MPEG_TS_SECTION_SCTE_TABLE_ID);
mainloop = g_main_loop_new (NULL, FALSE);