mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 00:36:51 +00:00
multifile: error out if no filename was set
Fixes #2483 Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4404>
This commit is contained in:
parent
fe6b76c64e
commit
b020d399cb
2 changed files with 30 additions and 4 deletions
|
@ -46,6 +46,7 @@
|
|||
|
||||
#include <gst/gst.h>
|
||||
#include <gst/base/gsttypefindhelper.h>
|
||||
#include <glib/gi18n-lib.h>
|
||||
|
||||
#include "gstimagesequencesrc.h"
|
||||
|
||||
|
@ -564,7 +565,12 @@ gst_image_sequence_src_get_filename (GstImageSequenceSrc * self)
|
|||
gchar *filename;
|
||||
|
||||
GST_DEBUG ("Reading filename at index %d.", self->index);
|
||||
filename = g_strdup_printf (self->path, self->index);
|
||||
if (self->path != NULL) {
|
||||
filename = g_strdup_printf (self->path, self->index);
|
||||
} else {
|
||||
GST_WARNING_OBJECT (self, "No filename location set!");
|
||||
filename = NULL;
|
||||
}
|
||||
|
||||
return filename;
|
||||
}
|
||||
|
@ -604,7 +610,7 @@ gst_image_sequence_src_create (GstPushSrc * src, GstBuffer ** buffer)
|
|||
UNLOCK (self);
|
||||
|
||||
if (!filename)
|
||||
goto handle_error;
|
||||
goto error_no_filename;
|
||||
|
||||
ret = g_file_get_contents (filename, &data, &size, &error);
|
||||
if (!ret)
|
||||
|
@ -645,6 +651,12 @@ gst_image_sequence_src_create (GstPushSrc * src, GstBuffer ** buffer)
|
|||
self->index += self->reverse ? -1 : 1;
|
||||
return GST_FLOW_OK;
|
||||
|
||||
error_no_filename:
|
||||
{
|
||||
GST_ELEMENT_ERROR (self, RESOURCE, NOT_FOUND,
|
||||
(_("No file name specified for reading.")), (NULL));
|
||||
return GST_FLOW_ERROR;
|
||||
}
|
||||
handle_error:
|
||||
{
|
||||
if (error != NULL) {
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
#endif
|
||||
|
||||
#include "gstmultifilesrc.h"
|
||||
|
||||
#include <glib/gi18n-lib.h>
|
||||
|
||||
static GstFlowReturn gst_multi_file_src_create (GstPushSrc * src,
|
||||
GstBuffer ** buffer);
|
||||
|
@ -392,7 +392,12 @@ gst_multi_file_src_get_filename (GstMultiFileSrc * multifilesrc)
|
|||
gchar *filename;
|
||||
|
||||
GST_DEBUG ("%d", multifilesrc->index);
|
||||
filename = g_strdup_printf (multifilesrc->filename, multifilesrc->index);
|
||||
if (multifilesrc->filename != NULL) {
|
||||
filename = g_strdup_printf (multifilesrc->filename, multifilesrc->index);
|
||||
} else {
|
||||
GST_WARNING_OBJECT (multifilesrc, "No filename location set!");
|
||||
filename = NULL;
|
||||
}
|
||||
|
||||
return filename;
|
||||
}
|
||||
|
@ -424,6 +429,9 @@ gst_multi_file_src_create (GstPushSrc * src, GstBuffer ** buffer)
|
|||
|
||||
filename = gst_multi_file_src_get_filename (multifilesrc);
|
||||
|
||||
if (!filename)
|
||||
goto error_no_filename;
|
||||
|
||||
GST_DEBUG_OBJECT (multifilesrc, "reading from file \"%s\".", filename);
|
||||
|
||||
ret = g_file_get_contents (filename, &data, &size, &error);
|
||||
|
@ -472,6 +480,12 @@ gst_multi_file_src_create (GstPushSrc * src, GstBuffer ** buffer)
|
|||
*buffer = buf;
|
||||
return GST_FLOW_OK;
|
||||
|
||||
error_no_filename:
|
||||
{
|
||||
GST_ELEMENT_ERROR (multifilesrc, RESOURCE, NOT_FOUND,
|
||||
(_("No file name specified for reading.")), (NULL));
|
||||
return GST_FLOW_ERROR;
|
||||
}
|
||||
handle_error:
|
||||
{
|
||||
if (error != NULL) {
|
||||
|
|
Loading…
Reference in a new issue