summaryrefslogtreecommitdiffstats
path: root/gst
diff options
context:
space:
mode:
authorVincent Genieux <mutex@runbox.com>2009-05-03 17:42:44 +0100
committerZaheer Merali <zaheerabbas@merali.org>2009-05-03 17:42:44 +0100
commite41401e3174b80b2e2ce4febf99f15e766dfc5c6 (patch)
tree46c829e8ac3359d8133633f0a205ad314433435c /gst
parent8ef8daf4dbdbab23ff49757a6223c3a9bfba11d3 (diff)
downloadgst-plugins-bad-e41401e3174b80b2e2ce4febf99f15e766dfc5c6.tar.gz
gst-plugins-bad-e41401e3174b80b2e2ce4febf99f15e766dfc5c6.tar.bz2
gst-plugins-bad-e41401e3174b80b2e2ce4febf99f15e766dfc5c6.zip
mpegtsparse: Ignore subtable extension when parsing PAT
Fixes #569673.
Diffstat (limited to 'gst')
-rw-r--r--gst/mpegdemux/mpegtspacketizer.c19
-rw-r--r--gst/mpegdemux/mpegtspacketizer.h2
-rw-r--r--gst/mpegdemux/mpegtsparse.c7
3 files changed, 23 insertions, 5 deletions
diff --git a/gst/mpegdemux/mpegtspacketizer.c b/gst/mpegdemux/mpegtspacketizer.c
index 1abbf1fe..b986fa60 100644
--- a/gst/mpegdemux/mpegtspacketizer.c
+++ b/gst/mpegdemux/mpegtspacketizer.c
@@ -241,7 +241,8 @@ mpegts_packetizer_parse_section_header (MpegTSPacketizer * packetizer,
data = GST_BUFFER_DATA (section->buffer);
section->table_id = *data++;
- if ((data[0] & 0x80) == 0)
+ /* if table_id is 0 (pat) then ignore the subtable extension */
+ if ((data[0] & 0x80) == 0 || section->table_id == 0)
section->subtable_extension = 0;
else
section->subtable_extension = GST_READ_UINT16_BE (data + 2);
@@ -1844,6 +1845,22 @@ mpegts_packetizer_clear (MpegTSPacketizer * packetizer)
gst_adapter_clear (packetizer->adapter);
}
+void
+mpegts_packetizer_remove_stream (MpegTSPacketizer * packetizer, gint16 pid)
+{
+ MpegTSPacketizerStream *stream =
+ (MpegTSPacketizerStream *) g_hash_table_lookup (packetizer->streams,
+ GINT_TO_POINTER ((gint) pid));
+ if (stream) {
+ GST_INFO ("Removing stream for PID %d", pid);
+
+ g_hash_table_remove (packetizer->streams, GINT_TO_POINTER ((gint) pid));
+
+ g_object_unref (stream->section_adapter);
+ g_free (stream);
+ }
+}
+
MpegTSPacketizer *
mpegts_packetizer_new ()
{
diff --git a/gst/mpegdemux/mpegtspacketizer.h b/gst/mpegdemux/mpegtspacketizer.h
index c54228af..97e15cf2 100644
--- a/gst/mpegdemux/mpegtspacketizer.h
+++ b/gst/mpegdemux/mpegtspacketizer.h
@@ -116,6 +116,8 @@ gboolean mpegts_packetizer_next_packet (MpegTSPacketizer *packetizer,
MpegTSPacketizerPacket *packet);
void mpegts_packetizer_clear_packet (MpegTSPacketizer *packetizer,
MpegTSPacketizerPacket *packet);
+void mpegts_packetizer_remove_stream(MpegTSPacketizer *packetizer,
+ gint16 pid);
gboolean mpegts_packetizer_push_section (MpegTSPacketizer *packetzer,
MpegTSPacketizerPacket *packet, MpegTSPacketizerSection *section);
diff --git a/gst/mpegdemux/mpegtsparse.c b/gst/mpegdemux/mpegtsparse.c
index de4de35f..614da36c 100644
--- a/gst/mpegdemux/mpegtsparse.c
+++ b/gst/mpegdemux/mpegtsparse.c
@@ -350,7 +350,7 @@ mpegts_parse_add_program (MpegTSParse * parse,
program->pcr_pid = G_MAXUINT16;
program->streams = g_hash_table_new_full (g_direct_hash, g_direct_equal,
NULL, (GDestroyNotify) mpegts_parse_free_stream);
- program->patcount = 1;
+ program->patcount = 0;
program->selected = 0;
program->active = FALSE;
@@ -890,14 +890,12 @@ mpegts_parse_apply_pat (MpegTSParse * parse, GstStructure * pat_info)
g_hash_table_insert (parse->psi_pids,
GINT_TO_POINTER ((gint) pid), GINT_TO_POINTER (1));
}
-
- program->patcount += 1;
} else {
g_hash_table_insert (parse->psi_pids,
GINT_TO_POINTER ((gint) pid), GINT_TO_POINTER (1));
program = mpegts_parse_add_program (parse, program_number, pid);
}
-
+ program->patcount += 1;
if (program->selected && !program->active)
parse->pads_to_add = g_list_append (parse->pads_to_add,
mpegts_parse_activate_program (parse, program));
@@ -938,6 +936,7 @@ mpegts_parse_apply_pat (MpegTSParse * parse, GstStructure * pat_info)
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);
}
gst_structure_free (old_pat);