summaryrefslogtreecommitdiff
path: root/ext/gio
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian.droege@collabora.co.uk>2009-07-08 16:55:41 +0200
committerSebastian Dröge <sebastian.droege@collabora.co.uk>2009-07-08 16:55:41 +0200
commit6025412707d687bd8e1b3117409662a16c877258 (patch)
tree5b3aa46fede1a90c31bc4dd6868b202e16d63090 /ext/gio
parent7228ba6acd1c4ccf2ea01e538b08d3f76a85b82d (diff)
gio: Post a custom file-exists message on the bus if the file already exists
An application can handle this message, remove the file in question and restart the pipeline again without showing an error. This fixes bug #529300.
Diffstat (limited to 'ext/gio')
-rw-r--r--ext/gio/gstgiosink.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/ext/gio/gstgiosink.c b/ext/gio/gstgiosink.c
index dba1d75f2..cf8cea5b9 100644
--- a/ext/gio/gstgiosink.c
+++ b/ext/gio/gstgiosink.c
@@ -263,12 +263,21 @@ gst_gio_sink_get_stream (GstGioBaseSink * bsink)
/*if (GST_GIO_ERROR_MATCHES (err, EXISTS)) */
/* FIXME: Retry with replace if overwrite == TRUE! */
- if (GST_GIO_ERROR_MATCHES (err, NOT_FOUND))
+ if (GST_GIO_ERROR_MATCHES (err, NOT_FOUND)) {
GST_ELEMENT_ERROR (sink, RESOURCE, NOT_FOUND, (NULL),
("Could not open location %s for writing: %s", uri, err->message));
- else
+ } else if (GST_GIO_ERROR_MATCHES (err, EXISTS)) {
+ gst_element_post_message (GST_ELEMENT_CAST (sink),
+ gst_message_new_element (GST_OBJECT_CAST (sink),
+ gst_structure_new ("file-exists", "file", G_TYPE_FILE,
+ sink->file, "uri", G_TYPE_STRING, uri, NULL)));
+
+ GST_ELEMENT_ERROR (sink, RESOURCE, OPEN_WRITE, (NULL),
+ ("Location %s already exists: %s", uri, err->message));
+ } else {
GST_ELEMENT_ERROR (sink, RESOURCE, OPEN_WRITE, (NULL),
("Could not open location %s for writing: %s", uri, err->message));
+ }
g_clear_error (&err);
}