mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-25 11:11:08 +00:00
imagesequencesrc: fix regular image deadlock
With one regular image file path provided (without %05d), the element was stuck in a dead loop counting the frames: gst_image_sequence_src_count_frames This allows to display any image file out of the element for a given number of buffers. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5471>
This commit is contained in:
parent
6fbe4d55c4
commit
7c7a90b99d
1 changed files with 6 additions and 5 deletions
|
@ -489,24 +489,25 @@ static gint
|
||||||
gst_image_sequence_src_count_frames (GstImageSequenceSrc * self,
|
gst_image_sequence_src_count_frames (GstImageSequenceSrc * self,
|
||||||
gboolean can_read)
|
gboolean can_read)
|
||||||
{
|
{
|
||||||
|
gchar *previous_filename = NULL;
|
||||||
if (can_read && self->stop_index < 0 && self->path) {
|
if (can_read && self->stop_index < 0 && self->path) {
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
for (i = self->start_index;; i++) {
|
for (i = self->start_index;; i++) {
|
||||||
gchar *filename = g_strdup_printf (self->path, i);
|
gchar *filename = g_strdup_printf (self->path, i);
|
||||||
|
if (!g_file_test (filename, G_FILE_TEST_IS_REGULAR)
|
||||||
if (!g_file_test (filename, G_FILE_TEST_IS_REGULAR)) {
|
|| !g_strcmp0 (previous_filename, filename)) {
|
||||||
i--;
|
i--;
|
||||||
g_free (filename);
|
g_free (filename);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
g_free (previous_filename);
|
||||||
g_free (filename);
|
previous_filename = filename;
|
||||||
}
|
}
|
||||||
if (i > self->start_index)
|
if (i > self->start_index)
|
||||||
self->stop_index = i;
|
self->stop_index = i;
|
||||||
}
|
}
|
||||||
|
g_free (previous_filename);
|
||||||
if (self->stop_index >= self->start_index)
|
if (self->stop_index >= self->start_index)
|
||||||
self->n_frames = self->stop_index - self->start_index + 1;
|
self->n_frames = self->stop_index - self->start_index + 1;
|
||||||
return self->n_frames;
|
return self->n_frames;
|
||||||
|
|
Loading…
Reference in a new issue