mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 01:45:33 +00:00
soup, pushfile, rtsp, udp, v4l2: update for GstURIHandler API changes
This commit is contained in:
parent
b0ccc61ed3
commit
a150d1e734
7 changed files with 72 additions and 59 deletions
|
@ -139,7 +139,7 @@ static gboolean gst_soup_http_src_query (GstBaseSrc * bsrc, GstQuery * query);
|
|||
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);
|
||||
|
@ -387,7 +387,7 @@ gst_soup_http_src_set_property (GObject * object, guint prop_id,
|
|||
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;
|
||||
}
|
||||
|
@ -1410,7 +1410,8 @@ gst_soup_http_src_query (GstBaseSrc * bsrc, GstQuery * query)
|
|||
}
|
||||
|
||||
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);
|
||||
|
@ -1453,20 +1454,22 @@ gst_soup_http_src_uri_get_protocols (GType type)
|
|||
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
|
||||
|
|
|
@ -154,27 +154,39 @@ gst_push_file_src_uri_get_protocols (GType type)
|
|||
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
|
||||
|
|
|
@ -264,7 +264,7 @@ static GstRTSPResult gst_rtspsrc_close (GstRTSPSrc * src, gboolean async,
|
|||
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);
|
||||
|
@ -642,7 +642,7 @@ gst_rtspsrc_set_property (GObject * object, guint prop_id, const GValue * value,
|
|||
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);
|
||||
|
@ -4667,7 +4667,7 @@ error_response:
|
|||
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)
|
||||
|
@ -6667,17 +6667,18 @@ gst_rtspsrc_uri_get_protocols (GType type)
|
|||
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;
|
||||
|
@ -6737,6 +6738,8 @@ was_ok:
|
|||
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:
|
||||
|
@ -6744,12 +6747,16 @@ 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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -124,7 +124,7 @@ gst_udpsink_finalize (GstUDPSink * udpsink)
|
|||
}
|
||||
|
||||
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);
|
||||
|
@ -142,6 +142,8 @@ wrong_uri:
|
|||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -220,7 +222,7 @@ gst_udpsink_uri_get_protocols (GType type)
|
|||
return protocols;
|
||||
}
|
||||
|
||||
static const gchar *
|
||||
static gchar *
|
||||
gst_udpsink_uri_get_uri (GstURIHandler * handler)
|
||||
{
|
||||
GstUDPSink *sink = GST_UDPSINK (handler);
|
||||
|
@ -228,18 +230,14 @@ gst_udpsink_uri_get_uri (GstURIHandler * 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
|
||||
|
|
|
@ -599,7 +599,7 @@ skip_error:
|
|||
}
|
||||
|
||||
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;
|
||||
|
@ -614,6 +614,8 @@ 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;
|
||||
}
|
||||
}
|
||||
|
@ -650,7 +652,7 @@ gst_udpsrc_set_property (GObject * object, guint prop_id, const GValue * value,
|
|||
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:
|
||||
{
|
||||
|
@ -1025,27 +1027,23 @@ gst_udpsrc_uri_get_protocols (GType type)
|
|||
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
|
||||
|
|
|
@ -519,7 +519,7 @@ gst_v4l2radio_uri_get_protocols (GType type)
|
|||
return protocols;
|
||||
}
|
||||
|
||||
static const gchar *
|
||||
static gchar *
|
||||
gst_v4l2radio_uri_get_uri (GstURIHandler * handler)
|
||||
{
|
||||
GstV4l2Radio *radio = GST_V4L2RADIO (handler);
|
||||
|
@ -527,19 +527,17 @@ gst_v4l2radio_uri_get_uri (GstURIHandler * 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;
|
||||
|
@ -564,6 +562,8 @@ gst_v4l2radio_uri_set_uri (GstURIHandler * handler, const gchar * uri)
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -831,26 +831,21 @@ gst_v4l2src_uri_get_protocols (GType type)
|
|||
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;
|
||||
|
|
Loading…
Reference in a new issue