static gboolean gst_file_sink_set_location (GstFileSink * sink, const gchar * location) { if (sink->file) goto was_open; g_free (sink->filename); g_free (sink->uri); if (location != NULL) { /* we store the filename as we received it from the application. On Windows * this should be in UTF8 */ sink->filename = g_strdup (location); sink->uri = gst_uri_construct ("file", sink->filename); } else { sink->filename = NULL; sink->uri = NULL; } return TRUE; /* ERRORS */ was_open: { g_warning ("Changing the `location' property on filesink when a file is " "open is not supported."); return FALSE; } }
static gboolean gst_file_src_set_location (GstFileSrc * src, const gchar * location) { GstState state; /* the element must be stopped in order to do this */ GST_OBJECT_LOCK (src); state = GST_STATE (src); if (state != GST_STATE_READY && state != GST_STATE_NULL) goto wrong_state; GST_OBJECT_UNLOCK (src); g_free (src->filename); g_free (src->uri); /* clear the filename if we get a NULL (is that possible?) */ if (location == NULL) { src->filename = NULL; src->uri = NULL; } else { /* we store the filename as received by the application. On Windoes this * should be UTF8 */ src->filename = g_strdup (location); src->uri = gst_uri_construct ("file", src->filename); } g_object_notify (G_OBJECT (src), "location"); gst_uri_handler_new_uri (GST_URI_HANDLER (src), src->uri); return TRUE; /* ERROR */ wrong_state: { g_warning ("Changing the `location' property on filesrc when a file is " "open is not supported."); GST_OBJECT_UNLOCK (src); return FALSE; } }
static gboolean gst_file_src_set_location (GstFileSrc * src, const gchar * location) { GstState state; /* the element must be stopped in order to do this */ GST_OBJECT_LOCK (src); state = GST_STATE (src); if (state != GST_STATE_READY && state != GST_STATE_NULL) goto wrong_state; GST_OBJECT_UNLOCK (src); g_free (src->filename); g_free (src->uri); /* clear the filename if we get a NULL (is that possible?) */ if (location == NULL) { src->filename = NULL; src->uri = NULL; } else { src->filename = g_strdup (location); src->uri = gst_uri_construct ("file", src->filename); } g_object_notify (G_OBJECT (src), "location"); gst_uri_handler_new_uri (GST_URI_HANDLER (src), src->uri); return TRUE; /* ERROR */ wrong_state: { GST_DEBUG_OBJECT (src, "setting location in wrong state"); GST_OBJECT_UNLOCK (src); return FALSE; } }