Cleanups and doc updates
authorWim Taymans <wim.taymans@collabora.co.uk>
Thu, 22 Jan 2009 17:35:17 +0000 (18:35 +0100)
committerWim Taymans <wim@wtay.(none)>
Thu, 22 Jan 2009 17:35:17 +0000 (18:35 +0100)
Add some more documentation and do some minor cleanups here and there.

gst/rtsp-server/rtsp-client.c
gst/rtsp-server/rtsp-media-mapping.c
gst/rtsp-server/rtsp-media-mapping.h
gst/rtsp-server/rtsp-media.h
gst/rtsp-server/rtsp-session-pool.h

index a45f618..4d518fe 100644 (file)
@@ -451,9 +451,6 @@ handle_describe_response (GstRTSPClient *client, GstRTSPUrl *uri, GstRTSPMessage
   GstElement *pipeline;
   GstStateChangeReturn ret;
 
-  /* find the factory for the uri first */
-  if (!(factory = gst_rtsp_media_mapping_find_factory (client->mapping, uri)))
-    goto no_factory;
 
   /* check what kind of format is accepted, we don't really do anything with it
    * and always return SDP for now. */
@@ -468,12 +465,16 @@ handle_describe_response (GstRTSPClient *client, GstRTSPUrl *uri, GstRTSPMessage
       break;
   }
 
-  /* create a pipeline to preroll the media */
-  pipeline = gst_pipeline_new ("client-describe-pipeline");
+  /* find the factory for the uri first */
+  if (!(factory = gst_rtsp_media_mapping_find_factory (client->mapping, uri)))
+    goto no_factory;
 
   /* prepare the media and add it to the pipeline */
   if (!(media = gst_rtsp_media_factory_construct (factory, uri)))
     goto no_media;
+
+  /* create a pipeline to preroll the media */
+  pipeline = gst_pipeline_new ("client-describe-pipeline");
   
   gst_bin_add (GST_BIN_CAST (pipeline), media->element);
 
@@ -662,9 +663,6 @@ handle_options_response (GstRTSPClient *client, GstRTSPUrl *uri, GstRTSPMessage
   GstRTSPMethod options;
   GString *str;
 
-  gst_rtsp_message_init_response (&response, GST_RTSP_STS_OK, 
-       gst_rtsp_status_as_text (GST_RTSP_STS_OK), request);
-
   options = GST_RTSP_DESCRIBE |
            GST_RTSP_OPTIONS |
     //        GST_RTSP_PAUSE |
@@ -696,6 +694,9 @@ handle_options_response (GstRTSPClient *client, GstRTSPUrl *uri, GstRTSPMessage
   if (options & GST_RTSP_TEARDOWN)
     g_string_append (str, ", TEARDOWN");
 
+  gst_rtsp_message_init_response (&response, GST_RTSP_STS_OK, 
+       gst_rtsp_status_as_text (GST_RTSP_STS_OK), request);
+
   gst_rtsp_message_add_header (&response, GST_RTSP_HDR_PUBLIC, str->str);
 
   g_string_free (str, TRUE);
index 2471be7..52490cd 100644 (file)
@@ -69,7 +69,9 @@ find_media (GstRTSPMediaMapping *mapping, const GstRTSPUrl *url)
 {
   GstRTSPMediaFactory *result;
 
-  /* find the location of the media in the hashtable */
+  /* find the location of the media in the hashtable we only use the absolute
+   * path of the uri to find a mapping. If the mapping depends on other
+   * properties found in the url, this method should be overridden. */
   result = g_hash_table_lookup (mapping->mappings, url->abspath);
   if (result) 
     g_object_ref (result);
@@ -84,7 +86,8 @@ find_media (GstRTSPMediaMapping *mapping, const GstRTSPUrl *url)
  * @mapping: a #GstRTSPMediaMapping
  * @url: a url
  *
- * Find the #GstRTSPMediaFactory for @url from the mappings registered in @mapping.
+ * Find the #GstRTSPMediaFactory for @url. The default implementation of this object 
+ * will use the mappings added with gst_rtsp_media_mapping_add_factory ().
  *
  * Returns: the #GstRTSPMediaFactory for @url. g_object_unref() after usage.
  */
index 6544246..07d4efa 100644 (file)
@@ -44,7 +44,7 @@ typedef struct _GstRTSPMediaMappingClass GstRTSPMediaMappingClass;
  * GstRTSPMediaMapping:
  * @mappings: the mountpoint to media mappings
  *
- * Creates a #GstRTSPMedia object for a given url.
+ * Creates a #GstRTSPMediaFactory object for a given url.
  */
 struct _GstRTSPMediaMapping {
   GObject       parent;
@@ -52,6 +52,14 @@ struct _GstRTSPMediaMapping {
   GHashTable   *mappings;
 };
 
+/**
+ * GstRTSPMediaMappingClass:
+ * @find_media: Create or return a previously cached #GstRTSPMediaFactory object
+ *        for the given url. the default implementation will use the mappings
+ *        added with gst_rtsp_media_mapping_add_factory ().
+ *
+ * The class for the media mapping object.
+ */
 struct _GstRTSPMediaMappingClass {
   GObjectClass  parent_class;
 
index 4bd3556..17fa4ee 100644 (file)
@@ -67,8 +67,10 @@ struct _GstRTSPMediaStream {
  * GstRTSPMedia:
  * @media: the owner #GstRTSPMedia
  *
- * A class that contains the elements to handle the media
- * provided by @media.
+ * A class that contains the GStreamer element along with a list of
+ * #GstRTSPediaStream objects that can produce data.
+ *
+ * This object is usually created from a #GstRTSPMediaFactory.
  */
 struct _GstRTSPMedia {
   GObject       parent;
index fafe606..9f65f41 100644 (file)
@@ -44,7 +44,8 @@ typedef struct _GstRTSPSessionPoolClass GstRTSPSessionPoolClass;
  * @lock: locking the session hashtable
  * @session: hashtable of sessions indexed by the session id.
  *
- * An object that keeps track of the active sessions.
+ * An object that keeps track of the active sessions. This object is usually
+ * attached to a #GstRTSPServer object to manage the sessions in that server.
  */
 struct _GstRTSPSessionPool {
   GObject       parent;
@@ -55,9 +56,8 @@ struct _GstRTSPSessionPool {
 
 /**
  * GstRTSPSessionPoolClass:
- *
- * @create_session_id: create a new random session id. Subclasses should not
- * check if the session exists.
+ * @create_session_id: create a new random session id. Subclasses can create
+ * custom session ids and should not check if the session exists.
  */
 struct _GstRTSPSessionPoolClass {
   GObjectClass  parent_class;