client: add support for setting the server.

Add support for keeping a ref to the server that started this client
connection.
This commit is contained in:
Wim Taymans 2011-01-12 10:42:52 +01:00
parent 9f52f281ba
commit 8ccebd90b4
2 changed files with 52 additions and 6 deletions

View file

@ -1461,6 +1461,47 @@ gst_rtsp_client_get_session_pool (GstRTSPClient * client)
return result;
}
/**
* gst_rtsp_client_set_server:
* @client: a #GstRTSPClient
* @server: a #GstRTSPServer
*
* Set @server as the server that created @client.
*/
void
gst_rtsp_client_set_server (GstRTSPClient * client, GstRTSPServer * server)
{
GstRTSPServer *old;
old = client->server;
if (old != server) {
if (server)
g_object_ref (server);
client->server = server;
if (old)
g_object_unref (old);
}
}
/**
* gst_rtsp_client_get_server:
* @client: a #GstRTSPClient
*
* Get the #GstRTSPServer object that @client was created from.
*
* Returns: a #GstRTSPServer, unref after usage.
*/
GstRTSPServer *
gst_rtsp_client_get_server (GstRTSPClient * client)
{
GstRTSPServer *result;
if ((result = client->server))
g_object_ref (result);
return result;
}
/**
* gst_rtsp_client_set_media_mapping:
* @client: a #GstRTSPClient

View file

@ -23,11 +23,16 @@
#ifndef __GST_RTSP_CLIENT_H__
#define __GST_RTSP_CLIENT_H__
G_BEGIN_DECLS
typedef struct _GstRTSPClient GstRTSPClient;
typedef struct _GstRTSPClientClass GstRTSPClientClass;
#include "rtsp-server.h"
#include "rtsp-media.h"
#include "rtsp-media-mapping.h"
#include "rtsp-session-pool.h"
G_BEGIN_DECLS
#include "rtsp-auth.h"
#define GST_TYPE_RTSP_CLIENT (gst_rtsp_client_get_type ())
#define GST_IS_RTSP_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_RTSP_CLIENT))
@ -38,10 +43,6 @@ G_BEGIN_DECLS
#define GST_RTSP_CLIENT_CAST(obj) ((GstRTSPClient*)(obj))
#define GST_RTSP_CLIENT_CLASS_CAST(klass) ((GstRTSPClientClass*)(klass))
typedef struct _GstRTSPClient GstRTSPClient;
typedef struct _GstRTSPClientClass GstRTSPClientClass;
#include "rtsp-auth.h"
/**
* GstRTSPClient:
@ -68,6 +69,7 @@ struct _GstRTSPClient {
gchar *server_ip;
gboolean is_ipv6;
GstRTSPServer *server;
GstRTSPSessionPool *session_pool;
GstRTSPMediaMapping *media_mapping;
GstRTSPAuth *auth;
@ -87,6 +89,9 @@ GType gst_rtsp_client_get_type (void);
GstRTSPClient * gst_rtsp_client_new (void);
void gst_rtsp_client_set_server (GstRTSPClient * client, GstRTSPServer * server);
GstRTSPServer * gst_rtsp_client_get_server (GstRTSPClient * client);
void gst_rtsp_client_set_session_pool (GstRTSPClient *client,
GstRTSPSessionPool *pool);
GstRTSPSessionPool * gst_rtsp_client_get_session_pool (GstRTSPClient *client);