From 8f79daef5e007ecc2e32bf1fac53dca9e94dc7ec Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 3 Jul 2013 11:04:53 +0200 Subject: [PATCH] mount-points: remove useless vmethod Making lookups in the mount points should not be done with a URL, if there is a mapping to be done from URL to mount points, we'll need to do it somewhere else. --- gst/rtsp-server/rtsp-client.c | 4 ++-- gst/rtsp-server/rtsp-mount-points.c | 44 ------------------------------------- gst/rtsp-server/rtsp-mount-points.h | 10 +-------- tests/check/gst/mountpoints.c | 15 ++++++++----- 4 files changed, 13 insertions(+), 60 deletions(-) diff --git a/gst/rtsp-server/rtsp-client.c b/gst/rtsp-server/rtsp-client.c index 03bd4e3..b61efaa 100644 --- a/gst/rtsp-server/rtsp-client.c +++ b/gst/rtsp-server/rtsp-client.c @@ -503,8 +503,8 @@ find_media (GstRTSPClient * client, GstRTSPClientState * state) /* find the factory for the uri first */ if (!(factory = - gst_rtsp_mount_points_find_factory (priv->mount_points, - state->uri))) + gst_rtsp_mount_points_match (priv->mount_points, + state->uri->abspath, NULL))) goto no_factory; /* check if we have access to the factory */ diff --git a/gst/rtsp-server/rtsp-mount-points.c b/gst/rtsp-server/rtsp-mount-points.c index a8db8b3..9df3c75 100644 --- a/gst/rtsp-server/rtsp-mount-points.c +++ b/gst/rtsp-server/rtsp-mount-points.c @@ -87,9 +87,6 @@ GST_DEBUG_CATEGORY_STATIC (rtsp_media_debug); static void gst_rtsp_mount_points_finalize (GObject * obj); -static GstRTSPMediaFactory *find_factory (GstRTSPMountPoints * mounts, - const GstRTSPUrl * url); - static void gst_rtsp_mount_points_class_init (GstRTSPMountPointsClass * klass) { @@ -101,8 +98,6 @@ gst_rtsp_mount_points_class_init (GstRTSPMountPointsClass * klass) gobject_class->finalize = gst_rtsp_mount_points_finalize; - klass->find_factory = find_factory; - GST_DEBUG_CATEGORY_INIT (rtsp_media_debug, "rtspmountpoints", 0, "GstRTSPMountPoints"); } @@ -152,45 +147,6 @@ gst_rtsp_mount_points_new (void) return result; } -static GstRTSPMediaFactory * -find_factory (GstRTSPMountPoints * mounts, const GstRTSPUrl * url) -{ - g_return_val_if_fail (GST_IS_RTSP_MOUNT_POINTS (mounts), NULL); - g_return_val_if_fail (url != NULL, NULL); - - return gst_rtsp_mount_points_match (mounts, url->abspath, NULL); -} - -/** - * gst_rtsp_mount_points_find_factory: - * @mounts: a #GstRTSPMountPoints - * @url: a url - * - * Find the #GstRTSPMediaFactory for @url. The default implementation of this object - * will use the media factory added with gst_rtsp_mount_points_add_factory (). - * - * Returns: (transfer full): the #GstRTSPMediaFactory for @url. g_object_unref() after usage. - */ -GstRTSPMediaFactory * -gst_rtsp_mount_points_find_factory (GstRTSPMountPoints * mounts, - const GstRTSPUrl * url) -{ - GstRTSPMediaFactory *result; - GstRTSPMountPointsClass *klass; - - 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->find_factory) - result = klass->find_factory (mounts, url); - else - result = NULL; - - return result; -} - static gboolean has_prefix (DataItem * str, DataItem * prefix) { diff --git a/gst/rtsp-server/rtsp-mount-points.h b/gst/rtsp-server/rtsp-mount-points.h index 2aae301..b57c041 100644 --- a/gst/rtsp-server/rtsp-mount-points.h +++ b/gst/rtsp-server/rtsp-mount-points.h @@ -19,8 +19,6 @@ #include -#include - #include "rtsp-media-factory.h" #ifndef __GST_RTSP_MOUNT_POINTS_H__ @@ -65,9 +63,6 @@ struct _GstRTSPMountPoints { */ struct _GstRTSPMountPointsClass { GObjectClass parent_class; - - GstRTSPMediaFactory * (*find_factory) (GstRTSPMountPoints *mounts, - const GstRTSPUrl *url); }; GType gst_rtsp_mount_points_get_type (void); @@ -75,13 +70,10 @@ GType gst_rtsp_mount_points_get_type (void); /* creating a mount points */ GstRTSPMountPoints * gst_rtsp_mount_points_new (void); -GstRTSPMediaFactory * gst_rtsp_mount_points_find_factory (GstRTSPMountPoints *mounts, - const GstRTSPUrl *url); - +/* finding a media factory */ GstRTSPMediaFactory * gst_rtsp_mount_points_match (GstRTSPMountPoints *mounts, const gchar *path, gint * matched); -/* finding a media factory */ /* managing media to a mount point */ void gst_rtsp_mount_points_add_factory (GstRTSPMountPoints *mounts, const gchar *path, diff --git a/tests/check/gst/mountpoints.c b/tests/check/gst/mountpoints.c index e620f16..7099604 100644 --- a/tests/check/gst/mountpoints.c +++ b/tests/check/gst/mountpoints.c @@ -34,19 +34,24 @@ GST_START_TEST (test_create) fail_unless (gst_rtsp_url_parse ("rtsp://localhost:8554/test2", &url2) == GST_RTSP_OK); - fail_unless (gst_rtsp_mount_points_find_factory (mounts, url) == NULL); + fail_unless (gst_rtsp_mount_points_match (mounts, url->abspath, + NULL) == NULL); factory = gst_rtsp_media_factory_new (); gst_rtsp_mount_points_add_factory (mounts, "/test", factory); - fail_unless (gst_rtsp_mount_points_find_factory (mounts, url) == factory); + fail_unless (gst_rtsp_mount_points_match (mounts, url->abspath, + NULL) == factory); g_object_unref (factory); - fail_unless (gst_rtsp_mount_points_find_factory (mounts, url2) == NULL); + fail_unless (gst_rtsp_mount_points_match (mounts, url2->abspath, + NULL) == NULL); gst_rtsp_mount_points_remove_factory (mounts, "/test"); - fail_unless (gst_rtsp_mount_points_find_factory (mounts, url) == NULL); - fail_unless (gst_rtsp_mount_points_find_factory (mounts, url2) == NULL); + fail_unless (gst_rtsp_mount_points_match (mounts, url->abspath, + NULL) == NULL); + fail_unless (gst_rtsp_mount_points_match (mounts, url2->abspath, + NULL) == NULL); gst_rtsp_url_free (url); gst_rtsp_url_free (url2); -- 2.7.4