From 32d802282065e3c4313501f6c87f110beaaa2014 Mon Sep 17 00:00:00 2001 From: Thiago Santos Date: Fri, 16 May 2014 15:39:48 -0300 Subject: [PATCH] tsbase: parse the mgt and add listed EIT/ETT pids to the known psi This will make tsbase also parse the EITs and ETTs from ATSC streams that have their pids reported on the MGT and post to the bus https://bugzilla.gnome.org/show_bug.cgi?id=730435 --- gst/mpegtsdemux/mpegtsbase.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/gst/mpegtsdemux/mpegtsbase.c b/gst/mpegtsdemux/mpegtsbase.c index 0fef7c720d..101f999e68 100644 --- a/gst/mpegtsdemux/mpegtsbase.c +++ b/gst/mpegtsdemux/mpegtsbase.c @@ -88,6 +88,8 @@ static GstStateChangeReturn mpegts_base_change_state (GstElement * element, GstStateChange transition); static gboolean mpegts_base_get_tags_from_eit (MpegTSBase * base, GstMpegTsSection * section); +static gboolean mpegts_base_parse_atsc_mgt (MpegTSBase * base, + GstMpegTsSection * section); static gboolean remove_each_program (gpointer key, MpegTSBaseProgram * program, MpegTSBase * base); @@ -915,6 +917,9 @@ mpegts_base_handle_psi (MpegTSBase * base, GstMpegTsSection * section) /* some tag xtraction + posting */ post_message = mpegts_base_get_tags_from_eit (base, section); break; + case GST_MPEGTS_SECTION_ATSC_MGT: + post_message = mpegts_base_parse_atsc_mgt (base, section); + break; default: break; } @@ -926,6 +931,29 @@ mpegts_base_handle_psi (MpegTSBase * base, GstMpegTsSection * section) gst_mpegts_section_unref (section); } +static gboolean +mpegts_base_parse_atsc_mgt (MpegTSBase * base, GstMpegTsSection * section) +{ + const GstMpegTsAtscMGT *mgt; + gint i; + + mgt = gst_mpegts_section_get_atsc_mgt (section); + if (G_UNLIKELY (mgt == NULL)) + return FALSE; + + for (i = 0; i < mgt->tables->len; ++i) { + GstMpegTsAtscMGTTable *table = g_ptr_array_index (mgt->tables, i); + + if ((table->table_type >= GST_MPEG_TS_ATSC_MGT_TABLE_TYPE_EIT0 && + table->table_type <= GST_MPEG_TS_ATSC_MGT_TABLE_TYPE_EIT127) || + (table->table_type >= GST_MPEG_TS_ATSC_MGT_TABLE_TYPE_ETT0 && + table->table_type <= GST_MPEG_TS_ATSC_MGT_TABLE_TYPE_ETT127)) { + MPEGTS_BIT_SET (base->known_psi, table->pid); + } + } + + return TRUE; +} static gboolean mpegts_base_get_tags_from_eit (MpegTSBase * base, GstMpegTsSection * section)