Fixes #569673.
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);
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 ()
{
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);
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;
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));
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);