Allow setting a custom media factory for a client.

This commit is contained in:
Wim Taymans 2009-01-20 19:46:21 +01:00 committed by Wim Taymans
parent f38c390736
commit 94d60a8611
2 changed files with 59 additions and 10 deletions

View file

@ -803,6 +803,49 @@ gst_rtsp_client_get_session_pool (GstRTSPClient *client)
return result;
}
/**
* gst_rtsp_client_set_media_factory:
* @client: a #GstRTSPClient
* @factory: a #GstRTSPMediaFactory
*
* Set @factory as the media factory for @client which it will use to map urls
* to media streams.
*/
void
gst_rtsp_client_set_media_factory (GstRTSPClient *client, GstRTSPMediaFactory *factory)
{
GstRTSPMediaFactory *old;
old = client->factory;
if (old != factory) {
if (factory)
g_object_ref (factory);
client->factory = factory;
if (old)
g_object_unref (old);
}
}
/**
* gst_rtsp_client_get_media_factory:
* @client: a #GstRTSPClient
*
* Get the #GstRTSPMediaFactory object that @client uses to manage its sessions.
*
* Returns: a #GstRTSPMediaFactory, unref after usage.
*/
GstRTSPMediaFactory *
gst_rtsp_client_get_media_factory (GstRTSPClient *client)
{
GstRTSPMediaFactory *result;
if ((result = client->factory))
g_object_ref (result);
return result;
}
/**
* gst_rtsp_client_attach:

View file

@ -38,6 +38,7 @@
#define __GST_RTSP_CLIENT_H__
#include "rtsp-media.h"
#include "rtsp-media-factory.h"
#include "rtsp-session-pool.h"
G_BEGIN_DECLS
@ -70,28 +71,33 @@ struct _GstRTSPClient {
GstRTSPConnection *connection;
struct sockaddr_in address;
GstRTSPMedia *media;
GThread *thread;
GstRTSPSessionPool *pool;
GThread *thread;
GstRTSPMedia *media;
GstRTSPMediaFactory *factory;
};
struct _GstRTSPClientClass {
GObjectClass parent_class;
};
GType gst_rtsp_client_get_type (void);
GType gst_rtsp_client_get_type (void);
GstRTSPClient * gst_rtsp_client_new (void);
GstRTSPClient * gst_rtsp_client_new (void);
void gst_rtsp_client_set_session_pool (GstRTSPClient *client,
GstRTSPSessionPool *pool);
GstRTSPSessionPool * gst_rtsp_client_get_session_pool (GstRTSPClient *client);
void gst_rtsp_client_set_session_pool (GstRTSPClient *client,
GstRTSPSessionPool *pool);
GstRTSPSessionPool * gst_rtsp_client_get_session_pool (GstRTSPClient *client);
gboolean gst_rtsp_client_accept (GstRTSPClient *client,
GIOChannel *channel);
void gst_rtsp_client_set_media_factory (GstRTSPClient *client,
GstRTSPMediaFactory *factory);
GstRTSPMediaFactory * gst_rtsp_client_get_media_factory (GstRTSPClient *client);
gboolean gst_rtsp_client_accept (GstRTSPClient *client,
GIOChannel *channel);
G_END_DECLS