diff options
author | Mikael Magnusson <mikma@users.sourceforge.net> | 2009-07-21 13:14:00 +0200 |
---|---|---|
committer | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2009-07-21 13:18:09 +0200 |
commit | 6233d1c9500410773b5bb796535963f361c7dbfe (patch) | |
tree | 942b92d66f8a637f46b517d92350516dd78033dc /gst/mpegdemux/mpegtsparse.c | |
parent | 0dd755bca315090564ac4c7b56760846dce598df (diff) | |
download | gst-plugins-bad-6233d1c9500410773b5bb796535963f361c7dbfe.tar.gz gst-plugins-bad-6233d1c9500410773b5bb796535963f361c7dbfe.tar.bz2 gst-plugins-bad-6233d1c9500410773b5bb796535963f361c7dbfe.zip |
mpegtsparse: Remove old PES PIDs when receiving PAT tables
Fixes bug #583470.
Diffstat (limited to 'gst/mpegdemux/mpegtsparse.c')
-rw-r--r-- | gst/mpegdemux/mpegtsparse.c | 54 |
1 files changed, 32 insertions, 22 deletions
diff --git a/gst/mpegdemux/mpegtsparse.c b/gst/mpegdemux/mpegtsparse.c index 976935f2..f947cc50 100644 --- a/gst/mpegdemux/mpegtsparse.c +++ b/gst/mpegdemux/mpegtsparse.c @@ -553,6 +553,35 @@ mpegts_parse_program_remove_stream (MpegTSParse * parse, g_hash_table_remove (program->streams, GINT_TO_POINTER ((gint) pid)); } +static void +mpegts_parse_deactivate_pmt (MpegTSParse * parse, MpegTSParseProgram * program) +{ + gint i; + guint pid; + guint stream_type; + GstStructure *stream; + const GValue *streams; + const GValue *value; + + if (program->pmt_info) { + streams = gst_structure_get_value (program->pmt_info, "streams"); + + for (i = 0; i < gst_value_list_get_size (streams); ++i) { + value = gst_value_list_get_value (streams, i); + stream = g_value_get_boxed (value); + gst_structure_get_uint (stream, "pid", &pid); + gst_structure_get_uint (stream, "stream-type", &stream_type); + mpegts_parse_program_remove_stream (parse, program, (guint16) pid); + g_hash_table_remove (parse->pes_pids, GINT_TO_POINTER ((gint) pid)); + } + + /* remove pcr stream */ + mpegts_parse_program_remove_stream (parse, program, program->pcr_pid); + g_hash_table_remove (parse->pes_pids, + GINT_TO_POINTER ((gint) program->pcr_pid)); + } +} + static MpegTSParsePad * mpegts_parse_create_tspad (MpegTSParse * parse, const gchar * pad_name) { @@ -940,6 +969,7 @@ mpegts_parse_apply_pat (MpegTSParse * parse, GstStructure * pat_info) parse->pads_to_remove = g_list_append (parse->pads_to_remove, mpegts_parse_deactivate_program (parse, program)); + mpegts_parse_deactivate_pmt (parse, program); mpegts_parse_remove_program (parse, program_number); g_hash_table_remove (parse->psi_pids, GINT_TO_POINTER ((gint) pid)); mpegts_packetizer_remove_stream (parse->packetizer, pid); @@ -964,7 +994,6 @@ mpegts_parse_apply_pmt (MpegTSParse * parse, guint stream_type; GstStructure *stream; gint i; - const GValue *old_streams; const GValue *new_streams; const GValue *value; @@ -975,27 +1004,8 @@ mpegts_parse_apply_pmt (MpegTSParse * parse, GST_OBJECT_LOCK (parse); program = mpegts_parse_get_program (parse, program_number); if (program) { - if (program->pmt_info) { - /* deactivate old pmt */ - old_streams = gst_structure_get_value (program->pmt_info, "streams"); - - for (i = 0; i < gst_value_list_get_size (old_streams); ++i) { - value = gst_value_list_get_value (old_streams, i); - stream = g_value_get_boxed (value); - gst_structure_get_uint (stream, "pid", &pid); - gst_structure_get_uint (stream, "stream-type", &stream_type); - mpegts_parse_program_remove_stream (parse, program, (guint16) pid); - g_hash_table_remove (parse->pes_pids, GINT_TO_POINTER ((gint) pid)); - } - - /* remove pcr stream */ - mpegts_parse_program_remove_stream (parse, program, program->pcr_pid); - g_hash_table_remove (parse->pes_pids, - GINT_TO_POINTER ((gint) program->pcr_pid)); - - gst_structure_free (program->pmt_info); - program->pmt_info = NULL; - } + /* deactivate old pmt */ + mpegts_parse_deactivate_pmt (parse, program); } else { /* no PAT?? */ g_hash_table_insert (parse->psi_pids, |