mount-points: remove useless vmethod
authorWim Taymans <wim.taymans@collabora.co.uk>
Wed, 3 Jul 2013 09:04:53 +0000 (11:04 +0200)
committerWim Taymans <wim.taymans@collabora.co.uk>
Wed, 3 Jul 2013 09:10:27 +0000 (11:10 +0200)
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
gst/rtsp-server/rtsp-mount-points.c
gst/rtsp-server/rtsp-mount-points.h
tests/check/gst/mountpoints.c

index 03bd4e3..b61efaa 100644 (file)
@@ -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 */
index a8db8b3..9df3c75 100644 (file)
@@ -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)
 {
index 2aae301..b57c041 100644 (file)
@@ -19,8 +19,6 @@
 
 #include <gst/gst.h>
 
-#include <gst/rtsp/gstrtspurl.h>
-
 #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,
index e620f16..7099604 100644 (file)
@@ -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);