tsmux: Remove program_array_index

It's only used for removal. Let's just scan the array.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1510>
This commit is contained in:
Jan Alexander Steffens (heftig) 2022-01-10 13:03:11 +01:00 committed by GStreamer Marge Bot
parent 2acaa3940a
commit 853178894e
3 changed files with 3 additions and 19 deletions

View file

@ -612,8 +612,6 @@ tsmux_program_add_stream (TsMuxProgram * program, TsMuxStream * stream)
g_return_if_fail (program != NULL);
g_return_if_fail (stream != NULL);
stream->program_array_index = program->streams->len;
g_ptr_array_add (program->streams, stream);
program->pmt_changed = TRUE;
}
@ -746,21 +744,10 @@ static gboolean
tsmux_program_remove_stream (TsMuxProgram * program, TsMuxStream * stream)
{
GPtrArray *streams = program->streams;
TsMuxStream *s;
gint i;
i = stream->program_array_index;
g_return_val_if_fail (i >= 0, FALSE);
s = g_ptr_array_index (streams, i);
g_return_val_if_fail (s == stream, FALSE);
g_ptr_array_remove_index (streams, i);
/* Correct indices of remaining streams, if any */
for (; i < streams->len; i++) {
s = g_ptr_array_index (streams, i);
s->program_array_index -= 1;
if (!g_ptr_array_remove (streams, stream)) {
g_warn_if_reached ();
return FALSE;
}
return streams->len == 0;

View file

@ -117,7 +117,6 @@ tsmux_stream_new (guint16 pid, guint stream_type)
stream->pes_payload_size = 0;
stream->cur_pes_payload_size = 0;
stream->pes_bytes_written = 0;
stream->program_array_index = -1;
switch (stream_type) {
case TSMUX_ST_VIDEO_MPEG1:

View file

@ -150,8 +150,6 @@ struct TsMuxStream {
guint8 id;
/* extended stream id (13818-1 Amdt 2) */
guint8 id_extended;
/* array index in program array */
gint program_array_index;
gboolean is_video_stream;