Allow setting a custom media factory for a client.
authorWim Taymans <wim.taymans@collabora.co.uk>
Tue, 20 Jan 2009 18:46:21 +0000 (19:46 +0100)
committerWim Taymans <wim@wtay.(none)>
Tue, 20 Jan 2009 18:46:21 +0000 (19:46 +0100)
gst/rtsp-server/rtsp-client.c
gst/rtsp-server/rtsp-client.h

index 5249b4d..b884941 100644 (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:
index 1f80480..5dff20c 100644 (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);
+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);
+gboolean              gst_rtsp_client_accept            (GstRTSPClient *client, 
+                                                         GIOChannel *channel);
 
 G_END_DECLS