mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-24 02:31:03 +00:00
multifilesrc: fix stop index handling
Make sure the stop index is always honoured. Avoids endless loop if one wants to read and output the same file N times, for example. https://bugzilla.gnome.org/show_bug.cgi?id=654853
This commit is contained in:
parent
78193dfe71
commit
238a5ec826
1 changed files with 9 additions and 4 deletions
|
@ -340,6 +340,15 @@ gst_multi_file_src_create (GstPushSrc * src, GstBuffer ** buffer)
|
||||||
if (multifilesrc->index < multifilesrc->start_index) {
|
if (multifilesrc->index < multifilesrc->start_index) {
|
||||||
multifilesrc->index = multifilesrc->start_index;
|
multifilesrc->index = multifilesrc->start_index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (multifilesrc->stop_index != -1 &&
|
||||||
|
multifilesrc->index > multifilesrc->stop_index) {
|
||||||
|
if (multifilesrc->loop)
|
||||||
|
multifilesrc->index = multifilesrc->start_index;
|
||||||
|
else
|
||||||
|
return GST_FLOW_EOS;
|
||||||
|
}
|
||||||
|
|
||||||
filename = gst_multi_file_src_get_filename (multifilesrc);
|
filename = gst_multi_file_src_get_filename (multifilesrc);
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (multifilesrc, "reading from file \"%s\".", filename);
|
GST_DEBUG_OBJECT (multifilesrc, "reading from file \"%s\".", filename);
|
||||||
|
@ -376,10 +385,6 @@ gst_multi_file_src_create (GstPushSrc * src, GstBuffer ** buffer)
|
||||||
|
|
||||||
multifilesrc->successful_read = TRUE;
|
multifilesrc->successful_read = TRUE;
|
||||||
multifilesrc->index++;
|
multifilesrc->index++;
|
||||||
if (multifilesrc->stop_index != -1 &&
|
|
||||||
multifilesrc->index >= multifilesrc->stop_index) {
|
|
||||||
multifilesrc->index = multifilesrc->start_index;
|
|
||||||
}
|
|
||||||
|
|
||||||
buf = gst_buffer_new ();
|
buf = gst_buffer_new ();
|
||||||
gst_buffer_append_memory (buf,
|
gst_buffer_append_memory (buf,
|
||||||
|
|
Loading…
Reference in a new issue