client: make make_path_from_uri a vmethod

This commit is contained in:
Patricia Muscalu 2013-11-07 13:22:09 +01:00 committed by Wim Taymans
parent 8d5ce0d4ee
commit 8ce453d97d
2 changed files with 16 additions and 6 deletions

View file

@ -133,6 +133,8 @@ static GstRTSPResult default_params_set (GstRTSPClient * client,
GstRTSPContext * ctx); GstRTSPContext * ctx);
static GstRTSPResult default_params_get (GstRTSPClient * client, static GstRTSPResult default_params_get (GstRTSPClient * client,
GstRTSPContext * ctx); GstRTSPContext * ctx);
static gchar * default_make_path_from_uri (GstRTSPClient *client,
const GstRTSPUrl *uri);
G_DEFINE_TYPE (GstRTSPClient, gst_rtsp_client, G_TYPE_OBJECT); G_DEFINE_TYPE (GstRTSPClient, gst_rtsp_client, G_TYPE_OBJECT);
@ -153,6 +155,7 @@ gst_rtsp_client_class_init (GstRTSPClientClass * klass)
klass->configure_client_transport = default_configure_client_transport; klass->configure_client_transport = default_configure_client_transport;
klass->params_set = default_params_set; klass->params_set = default_params_set;
klass->params_get = default_params_get; klass->params_get = default_params_get;
klass->make_path_from_uri = default_make_path_from_uri;
g_object_class_install_property (gobject_class, PROP_SESSION_POOL, g_object_class_install_property (gobject_class, PROP_SESSION_POOL,
g_param_spec_object ("session-pool", "Session Pool", g_param_spec_object ("session-pool", "Session Pool",
@ -712,7 +715,7 @@ close_connection (GstRTSPClient * client)
} }
static gchar * static gchar *
make_path_from_uri (GstRTSPClient * client, GstRTSPUrl * uri) default_make_path_from_uri (GstRTSPClient * client, const GstRTSPUrl * uri)
{ {
gchar *path; gchar *path;
@ -728,6 +731,7 @@ static gboolean
handle_teardown_request (GstRTSPClient * client, GstRTSPContext * ctx) handle_teardown_request (GstRTSPClient * client, GstRTSPContext * ctx)
{ {
GstRTSPClientPrivate *priv = client->priv; GstRTSPClientPrivate *priv = client->priv;
GstRTSPClientClass *klass;
GstRTSPSession *session; GstRTSPSession *session;
GstRTSPSessionMedia *sessmedia; GstRTSPSessionMedia *sessmedia;
GstRTSPStatusCode code; GstRTSPStatusCode code;
@ -742,7 +746,8 @@ handle_teardown_request (GstRTSPClient * client, GstRTSPContext * ctx)
if (!ctx->uri) if (!ctx->uri)
goto no_uri; goto no_uri;
path = make_path_from_uri (client, ctx->uri); klass = GST_RTSP_CLIENT_GET_CLASS (client);
path = klass->make_path_from_uri (client, ctx->uri);
/* get a handle to the configuration of the media in the session */ /* get a handle to the configuration of the media in the session */
sessmedia = gst_rtsp_session_get_media (session, path, &matched); sessmedia = gst_rtsp_session_get_media (session, path, &matched);
@ -912,6 +917,7 @@ static gboolean
handle_pause_request (GstRTSPClient * client, GstRTSPContext * ctx) handle_pause_request (GstRTSPClient * client, GstRTSPContext * ctx)
{ {
GstRTSPSession *session; GstRTSPSession *session;
GstRTSPClientClass *klass;
GstRTSPSessionMedia *sessmedia; GstRTSPSessionMedia *sessmedia;
GstRTSPStatusCode code; GstRTSPStatusCode code;
GstRTSPState rtspstate; GstRTSPState rtspstate;
@ -924,7 +930,8 @@ handle_pause_request (GstRTSPClient * client, GstRTSPContext * ctx)
if (!ctx->uri) if (!ctx->uri)
goto no_uri; goto no_uri;
path = make_path_from_uri (client, ctx->uri); klass = GST_RTSP_CLIENT_GET_CLASS (client);
path = klass->make_path_from_uri (client, ctx->uri);
/* get a handle to the configuration of the media in the session */ /* get a handle to the configuration of the media in the session */
sessmedia = gst_rtsp_session_get_media (session, path, &matched); sessmedia = gst_rtsp_session_get_media (session, path, &matched);
@ -1027,6 +1034,7 @@ static gboolean
handle_play_request (GstRTSPClient * client, GstRTSPContext * ctx) handle_play_request (GstRTSPClient * client, GstRTSPContext * ctx)
{ {
GstRTSPSession *session; GstRTSPSession *session;
GstRTSPClientClass *klass;
GstRTSPSessionMedia *sessmedia; GstRTSPSessionMedia *sessmedia;
GstRTSPMedia *media; GstRTSPMedia *media;
GstRTSPStatusCode code; GstRTSPStatusCode code;
@ -1047,7 +1055,8 @@ handle_play_request (GstRTSPClient * client, GstRTSPContext * ctx)
if (!(uri = ctx->uri)) if (!(uri = ctx->uri))
goto no_uri; goto no_uri;
path = make_path_from_uri (client, uri); klass = GST_RTSP_CLIENT_GET_CLASS (client);
path = klass->make_path_from_uri (client, uri);
/* get a handle to the configuration of the media in the session */ /* get a handle to the configuration of the media in the session */
sessmedia = gst_rtsp_session_get_media (session, path, &matched); sessmedia = gst_rtsp_session_get_media (session, path, &matched);
@ -1413,7 +1422,8 @@ handle_setup_request (GstRTSPClient * client, GstRTSPContext * ctx)
goto no_uri; goto no_uri;
uri = ctx->uri; uri = ctx->uri;
path = make_path_from_uri (client, uri); klass = GST_RTSP_CLIENT_GET_CLASS (client);
path = klass->make_path_from_uri (client, uri);
/* parse the transport */ /* parse the transport */
res = res =
@ -1512,7 +1522,6 @@ handle_setup_request (GstRTSPClient * client, GstRTSPContext * ctx)
goto unsupported_transports; goto unsupported_transports;
/* update the client transport */ /* update the client transport */
klass = GST_RTSP_CLIENT_GET_CLASS (client);
if (!klass->configure_client_transport (client, ctx, ct)) if (!klass->configure_client_transport (client, ctx, ct))
goto unsupported_client_transport; goto unsupported_client_transport;

View file

@ -92,6 +92,7 @@ struct _GstRTSPClientClass {
GstRTSPTransport * ct); GstRTSPTransport * ct);
GstRTSPResult (*params_set) (GstRTSPClient *client, GstRTSPContext *ctx); GstRTSPResult (*params_set) (GstRTSPClient *client, GstRTSPContext *ctx);
GstRTSPResult (*params_get) (GstRTSPClient *client, GstRTSPContext *ctx); GstRTSPResult (*params_get) (GstRTSPClient *client, GstRTSPContext *ctx);
gchar * (*make_path_from_uri) (GstRTSPClient *client, const GstRTSPUrl *uri);
/* signals */ /* signals */
void (*closed) (GstRTSPClient *client); void (*closed) (GstRTSPClient *client);