static gboolean gst_soup_http_src_unlock (GstBaseSrc * bsrc);
static gboolean gst_soup_http_src_unlock_stop (GstBaseSrc * bsrc);
static gboolean gst_soup_http_src_set_location (GstSoupHTTPSrc * src,
- const gchar * uri);
+ const gchar * uri, GError ** error);
static gboolean gst_soup_http_src_set_proxy (GstSoupHTTPSrc * src,
const gchar * uri);
static char *gst_soup_http_src_unicodify (const char *str);
GST_WARNING ("location property cannot be NULL");
goto done;
}
- if (!gst_soup_http_src_set_location (src, location)) {
+ if (!gst_soup_http_src_set_location (src, location, NULL)) {
GST_WARNING ("badly formatted location");
goto done;
}
}
static gboolean
-gst_soup_http_src_set_location (GstSoupHTTPSrc * src, const gchar * uri)
+gst_soup_http_src_set_location (GstSoupHTTPSrc * src, const gchar * uri,
+ GError ** error)
{
if (src->location) {
g_free (src->location);
return (gchar **) protocols;
}
-static const gchar *
+static gchar *
gst_soup_http_src_uri_get_uri (GstURIHandler * handler)
{
GstSoupHTTPSrc *src = GST_SOUP_HTTP_SRC (handler);
- return src->location;
+ /* FIXME: make thread-safe */
+ return g_strdup (src->location);
}
static gboolean
-gst_soup_http_src_uri_set_uri (GstURIHandler * handler, const gchar * uri)
+gst_soup_http_src_uri_set_uri (GstURIHandler * handler, const gchar * uri,
+ GError ** error)
{
GstSoupHTTPSrc *src = GST_SOUP_HTTP_SRC (handler);
- return gst_soup_http_src_set_location (src, uri);
+ return gst_soup_http_src_set_location (src, uri, error);
}
static void
return protocols;
}
-static const gchar *
+static gchar *
gst_push_file_src_uri_get_uri (GstURIHandler * handler)
{
GstPushFileSrc *src = GST_PUSH_FILE_SRC (handler);
+ gchar *fileuri, *pushfileuri;
if (src->filesrc == NULL)
return NULL;
- return gst_uri_handler_get_uri (GST_URI_HANDLER (src->filesrc));
+ fileuri = gst_uri_handler_get_uri (GST_URI_HANDLER (src->filesrc));;
+ if (fileuri == NULL)
+ return NULL;
+ pushfileuri = g_strconcat ("push", fileuri, NULL);
+ g_free (fileuri);
+
+ return pushfileuri;
}
static gboolean
-gst_push_file_src_uri_set_uri (GstURIHandler * handler, const gchar * uri)
+gst_push_file_src_uri_set_uri (GstURIHandler * handler, const gchar * uri,
+ GError ** error)
{
GstPushFileSrc *src = GST_PUSH_FILE_SRC (handler);
- if (src->filesrc == NULL || !g_str_has_prefix (uri, "pushfile://"))
+ if (src->filesrc == NULL) {
+ g_set_error_literal (error, GST_URI_ERROR, GST_URI_ERROR_BAD_STATE,
+ "Could not create file source element");
return FALSE;
+ }
/* skip 'push' bit */
- return gst_uri_handler_set_uri (GST_URI_HANDLER (src->filesrc), uri + 4);
+ return gst_uri_handler_set_uri (GST_URI_HANDLER (src->filesrc), uri + 4,
+ error);
}
static void
gboolean only_close);
static gboolean gst_rtspsrc_uri_set_uri (GstURIHandler * handler,
- const gchar * uri);
+ const gchar * uri, GError ** error);
static gboolean gst_rtspsrc_activate_streams (GstRTSPSrc * src);
static gboolean gst_rtspsrc_loop (GstRTSPSrc * src);
switch (prop_id) {
case PROP_LOCATION:
gst_rtspsrc_uri_set_uri (GST_URI_HANDLER (rtspsrc),
- g_value_get_string (value));
+ g_value_get_string (value), NULL);
break;
case PROP_PROTOCOLS:
rtspsrc->protocols = g_value_get_flags (value);
else
transports = GST_RTSP_LOWER_TRANS_UNKNOWN;
- gst_rtspsrc_uri_set_uri (GST_URI_HANDLER (src), new_location);
+ gst_rtspsrc_uri_set_uri (GST_URI_HANDLER (src), new_location, NULL);
/* set old transports */
if (src->conninfo.url && transports != GST_RTSP_LOWER_TRANS_UNKNOWN)
return (gchar **) protocols;
}
-static const gchar *
+static gchar *
gst_rtspsrc_uri_get_uri (GstURIHandler * handler)
{
GstRTSPSrc *src = GST_RTSPSRC (handler);
- /* should not dup */
- return src->conninfo.location;
+ /* FIXME: make thread-safe */
+ return g_strdup (src->conninfo.location);
}
static gboolean
-gst_rtspsrc_uri_set_uri (GstURIHandler * handler, const gchar * uri)
+gst_rtspsrc_uri_set_uri (GstURIHandler * handler, const gchar * uri,
+ GError ** error)
{
GstRTSPSrc *src;
GstRTSPResult res;
sdp_failed:
{
GST_ERROR_OBJECT (src, "Could not create new SDP (%d)", res);
+ g_set_error_literal (error, GST_URI_ERROR, GST_URI_ERROR_BAD_URI,
+ "Could not create SDP");
return FALSE;
}
invalid_sdp:
GST_ERROR_OBJECT (src, "Not a valid SDP (%d) '%s'", res,
GST_STR_NULL (uri));
gst_sdp_message_free (sdp);
+ g_set_error_literal (error, GST_URI_ERROR, GST_URI_ERROR_BAD_URI,
+ "Invalid SDP");
return FALSE;
}
parse_error:
{
GST_ERROR_OBJECT (src, "Not a valid RTSP url '%s' (%d)",
GST_STR_NULL (uri), res);
+ g_set_error_literal (error, GST_URI_ERROR, GST_URI_ERROR_BAD_URI,
+ "Invalid RTSP URI");
return FALSE;
}
}
}
static gboolean
-gst_udpsink_set_uri (GstUDPSink * sink, const gchar * uri)
+gst_udpsink_set_uri (GstUDPSink * sink, const gchar * uri, GError ** error)
{
gst_multiudpsink_remove (GST_MULTIUDPSINK (sink), sink->uri.host,
sink->uri.port);
{
GST_ELEMENT_ERROR (sink, RESOURCE, READ, (NULL),
("error parsing uri %s", uri));
+ g_set_error_literal (error, GST_URI_ERROR, GST_URI_ERROR_BAD_URI,
+ "Could not parse UDP URI");
return FALSE;
}
}
return protocols;
}
-static const gchar *
+static gchar *
gst_udpsink_uri_get_uri (GstURIHandler * handler)
{
GstUDPSink *sink = GST_UDPSINK (handler);
g_free (sink->uristr);
sink->uristr = gst_udp_uri_string (&sink->uri);
- return sink->uristr;
+ return g_strdup (sink->uristr);
}
static gboolean
-gst_udpsink_uri_set_uri (GstURIHandler * handler, const gchar * uri)
+gst_udpsink_uri_set_uri (GstURIHandler * handler, const gchar * uri,
+ GError ** error)
{
- gboolean ret;
- GstUDPSink *sink = GST_UDPSINK (handler);
-
- ret = gst_udpsink_set_uri (sink, uri);
-
- return ret;
+ return gst_udpsink_set_uri (GST_UDPSINK (handler), uri, error);
}
static void
}
static gboolean
-gst_udpsrc_set_uri (GstUDPSrc * src, const gchar * uri)
+gst_udpsrc_set_uri (GstUDPSrc * src, const gchar * uri, GError ** error)
{
if (gst_udp_parse_uri (uri, &src->uri) < 0)
goto wrong_uri;
{
GST_ELEMENT_ERROR (src, RESOURCE, READ, (NULL),
("error parsing uri %s", uri));
+ g_set_error_literal (error, GST_URI_ERROR, GST_URI_ERROR_BAD_URI,
+ "Could not parse UDP URI");
return FALSE;
}
}
udpsrc->multi_iface = g_value_dup_string (value);
break;
case PROP_URI:
- gst_udpsrc_set_uri (udpsrc, g_value_get_string (value));
+ gst_udpsrc_set_uri (udpsrc, g_value_get_string (value), NULL);
break;
case PROP_CAPS:
{
return protocols;
}
-static const gchar *
+static gchar *
gst_udpsrc_uri_get_uri (GstURIHandler * handler)
{
GstUDPSrc *src = GST_UDPSRC (handler);
+ /* FIXME: make thread-safe; maybe we can get rid of this assignment here? */
g_free (src->uristr);
src->uristr = gst_udp_uri_string (&src->uri);
- return src->uristr;
+ return g_strdup (src->uristr);
}
static gboolean
-gst_udpsrc_uri_set_uri (GstURIHandler * handler, const gchar * uri)
+gst_udpsrc_uri_set_uri (GstURIHandler * handler, const gchar * uri,
+ GError ** error)
{
- gboolean ret;
-
- GstUDPSrc *src = GST_UDPSRC (handler);
-
- ret = gst_udpsrc_set_uri (src, uri);
-
- return ret;
+ return gst_udpsrc_set_uri (GST_UDPSRC (handler), uri, error);
}
static void
return protocols;
}
-static const gchar *
+static gchar *
gst_v4l2radio_uri_get_uri (GstURIHandler * handler)
{
GstV4l2Radio *radio = GST_V4L2RADIO (handler);
if (radio->v4l2object->videodev != NULL) {
if (gst_v4l2_get_frequency (radio->v4l2object,
0, &(radio->v4l2object->frequency))) {
- gchar uri[20];
- gchar freq[6];
- g_ascii_formatd (freq, 6, "%4.1f", radio->v4l2object->frequency / 1e6);
- g_snprintf (uri, sizeof (uri), "radio://%s", freq);
- return g_intern_string (uri);
+ return g_strdup_printf ("radio://%4.1f",
+ radio->v4l2object->frequency / 1e6);
}
}
- return "radio://";
+ return g_strdup ("radio://");
}
static gboolean
-gst_v4l2radio_uri_set_uri (GstURIHandler * handler, const gchar * uri)
+gst_v4l2radio_uri_set_uri (GstURIHandler * handler, const gchar * uri,
+ GError ** error)
{
GstV4l2Radio *radio = GST_V4L2RADIO (handler);
gdouble dfreq;
return TRUE;
uri_failed:
+ g_set_error_literal (error, GST_URI_ERROR, GST_URI_ERROR_BAD_REFERENCE,
+ "Bad radio URI, could not parse frequency");
return FALSE;
}
return protocols;
}
-static const gchar *
+static gchar *
gst_v4l2src_uri_get_uri (GstURIHandler * handler)
{
GstV4l2Src *v4l2src = GST_V4L2SRC (handler);
if (v4l2src->v4l2object->videodev != NULL) {
- gchar uri[256];
-
- /* need to return a const string, but also don't want to leak the generated
- * string, so just intern it - there's a limited number of video devices
- * after all */
- g_snprintf (uri, sizeof (uri), "v4l2://%s", v4l2src->v4l2object->videodev);
- return g_intern_string (uri);
+ return g_strdup_printf ("v4l2://%s", v4l2src->v4l2object->videodev);
}
- return "v4l2://";
+ return g_strdup ("v4l2://");
}
static gboolean
-gst_v4l2src_uri_set_uri (GstURIHandler * handler, const gchar * uri)
+gst_v4l2src_uri_set_uri (GstURIHandler * handler, const gchar * uri,
+ GError ** error)
{
GstV4l2Src *v4l2src = GST_V4L2SRC (handler);
const gchar *device = DEFAULT_PROP_DEVICE;