if (!priv->mount_points)
goto no_mount_points;
- path = ctx->uri->abspath;
+ if (!(path = gst_rtsp_mount_points_make_path (priv->mount_points, ctx->uri)))
+ goto no_path;
/* find the longest matching factory for the uri first */
if (!(factory = gst_rtsp_mount_points_match (priv->mount_points,
g_object_unref (factory);
ctx->factory = NULL;
+ g_free (path);
if (media)
g_object_ref (media);
send_generic_response (client, GST_RTSP_STS_NOT_FOUND, ctx);
return NULL;
}
+no_path:
+ {
+ GST_ERROR ("client %p: can't find path for url", client);
+ send_generic_response (client, GST_RTSP_STS_NOT_FOUND, ctx);
+ return NULL;
+ }
no_factory:
{
GST_ERROR ("client %p: no factory for uri %s", client, path);
+ g_free (path);
send_generic_response (client, GST_RTSP_STS_NOT_FOUND, ctx);
return NULL;
}
no_factory_access:
{
GST_ERROR ("client %p: not authorized to see factory uri %s", client, path);
+ g_free (path);
return NULL;
}
not_authorized:
{
GST_ERROR ("client %p: not authorized for factory uri %s", client, path);
+ g_free (path);
return NULL;
}
no_media:
send_generic_response (client, GST_RTSP_STS_SERVICE_UNAVAILABLE, ctx);
g_object_unref (factory);
ctx->factory = NULL;
+ g_free (path);
return NULL;
}
no_thread:
ctx->media = NULL;
g_object_unref (factory);
ctx->factory = NULL;
+ g_free (path);
return NULL;
}
no_prepare:
ctx->media = NULL;
g_object_unref (factory);
ctx->factory = NULL;
+ g_free (path);
return NULL;
}
}
GST_DEBUG_CATEGORY_STATIC (rtsp_media_debug);
#define GST_CAT_DEFAULT rtsp_media_debug
+static gchar *default_make_path (GstRTSPMountPoints * mounts,
+ const GstRTSPUrl * url);
static void gst_rtsp_mount_points_finalize (GObject * obj);
static void
gobject_class->finalize = gst_rtsp_mount_points_finalize;
+ klass->make_path = default_make_path;
+
GST_DEBUG_CATEGORY_INIT (rtsp_media_debug, "rtspmountpoints", 0,
"GstRTSPMountPoints");
}
return result;
}
+static gchar *
+default_make_path (GstRTSPMountPoints * mounts, const GstRTSPUrl * url)
+{
+ return g_strdup (url->abspath);
+}
+
+/**
+ * gst_rtsp_mount_points_make_path:
+ * @mounts: a #GstRTSPMountPoints
+ * @url: a #GstRTSPUrl
+ *
+ * Make a path string from @url.
+ *
+ * Returns: a path string for @url, g_free() after usage.
+ */
+gchar *
+gst_rtsp_mount_points_make_path (GstRTSPMountPoints * mounts,
+ const GstRTSPUrl * url)
+{
+ GstRTSPMountPointsClass *klass;
+ gchar *result;
+
+ g_return_val_if_fail (GST_IS_RTSP_MOUNT_POINTS (mounts), NULL);
+ g_return_val_if_fail (url != NULL, NULL);
+
+ klass = GST_RTSP_MOUNT_POINTS_GET_CLASS (mounts);
+
+ if (klass->make_path)
+ result = klass->make_path (mounts, url);
+ else
+ result = NULL;
+
+ return result;
+}
+
static gboolean
has_prefix (DataItem * str, DataItem * prefix)
{
/**
* GstRTSPMountPointsClass:
+ * @make_path: make a path from the given url.
*
* The class for the media mounts object.
*/
struct _GstRTSPMountPointsClass {
GObjectClass parent_class;
+
+ gchar * (*make_path) (GstRTSPMountPoints *mounts,
+ const GstRTSPUrl *url);
};
GType gst_rtsp_mount_points_get_type (void);
/* creating a mount points */
GstRTSPMountPoints * gst_rtsp_mount_points_new (void);
+gchar * gst_rtsp_mount_points_make_path (GstRTSPMountPoints *mounts,
+ const GstRTSPUrl * url);
/* finding a media factory */
GstRTSPMediaFactory * gst_rtsp_mount_points_match (GstRTSPMountPoints *mounts,
const gchar *path,