mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-29 20:35:40 +00:00
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.
This commit is contained in:
parent
df08a2dd9e
commit
8f79daef5e
4 changed files with 13 additions and 60 deletions
|
@ -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 */
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue