mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 19:51:11 +00:00
mpegts: Handle glib < 2.58
By using a workaround to the lack of g_ptr_array_steal_index. Fixes #1078 Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1917>
This commit is contained in:
parent
ccd1b76625
commit
fb81c4dbf5
2 changed files with 16 additions and 1 deletions
|
@ -501,8 +501,15 @@ mpegts_base_steal_program (MpegTSBase * base, gint program_number)
|
|||
|
||||
for (i = 0; i < base->programs->len; i++) {
|
||||
MpegTSBaseProgram *program = g_ptr_array_index (base->programs, i);
|
||||
if (program->program_number == program_number)
|
||||
if (program->program_number == program_number) {
|
||||
#if GLIB_CHECK_VERSION(2, 58, 0)
|
||||
return g_ptr_array_steal_index (base->programs, i);
|
||||
#else
|
||||
program->recycle = TRUE;
|
||||
g_ptr_array_remove_index (base->programs, i);
|
||||
return program;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
@ -523,6 +530,11 @@ mpegts_base_free_program (MpegTSBaseProgram * program)
|
|||
{
|
||||
GList *tmp;
|
||||
|
||||
if (program->recycle) {
|
||||
program->recycle = FALSE;
|
||||
return;
|
||||
}
|
||||
|
||||
if (program->pmt) {
|
||||
gst_mpegts_section_unref (program->section);
|
||||
program->pmt = NULL;
|
||||
|
|
|
@ -95,6 +95,9 @@ struct _MpegTSBaseProgram
|
|||
gboolean active;
|
||||
/* TRUE if this is the first program created */
|
||||
gboolean initial_program;
|
||||
|
||||
/* TRUE if the program shouldn't be freed */
|
||||
gboolean recycle;
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
|
|
Loading…
Reference in a new issue