[farsight2/master] Add failable fs_session_set_local_codecs_config()

Olivier Crête olivier.crete at collabora.co.uk
Tue Dec 23 15:22:21 PST 2008


---
 docs/libs/farsight2-libs-sections.txt |    1 +
 gst-libs/gst/farsight/fs-session.c    |   66 +++++++++++++++++++++++++++-----
 gst-libs/gst/farsight/fs-session.h    |    9 ++++
 gst-libs/gst/farsight/fs-stream.c     |    2 +-
 4 files changed, 66 insertions(+), 12 deletions(-)

diff --git a/docs/libs/farsight2-libs-sections.txt b/docs/libs/farsight2-libs-sections.txt
index 3d1526c..fd62491 100644
--- a/docs/libs/farsight2-libs-sections.txt
+++ b/docs/libs/farsight2-libs-sections.txt
@@ -50,6 +50,7 @@ fs_session_new_stream
 fs_session_start_telephony_event
 fs_session_stop_telephony_event
 fs_session_set_send_codec
+fs_session_set_local_codecs_config
 fs_session_emit_error
 <SUBSECTION Standard>
 FS_SESSION
diff --git a/gst-libs/gst/farsight/fs-session.c b/gst-libs/gst/farsight/fs-session.c
index 5c945ba..392f21c 100644
--- a/gst-libs/gst/farsight/fs-session.c
+++ b/gst-libs/gst/farsight/fs-session.c
@@ -187,13 +187,11 @@ fs_session_class_init (FsSessionClass *klass)
   /**
    * FsSession:local-codecs-config:
    *
-   * This is the current configuration list for the local codecs. It is usually
+   * This is the current configuration list for the local codecs. It is
    * set by the user to specify the codec options and priorities. The user may
-   * change this value during an ongoing session. Note that doing this can cause
-   * the local-codecs to be changed. Therefore this requires the user to fetch
-   * the new local-codecs and renegotiate them with the peers. It is a #GList
-   * of #FsCodec. User must free this codec list using fs_codec_list_destroy()
-   * when done.
+   * change its value with fs_session_set_local_codecs() at any time during a
+   * session. It is a #GList of #FsCodec. The user must free this codec list
+   * using fs_codec_list_destroy() when done.
    *
    * The payload type may be a valid dynamic PT (96-127), %FS_CODEC_ID_DISABLE
    * or %FS_CODEC_ID_ANY. If the encoding name is "reserve-pt", then the
@@ -207,7 +205,7 @@ fs_session_class_init (FsSessionClass *klass)
         "A GList of FsCodecs that allows user to set his codec options and"
         " priorities",
         FS_TYPE_CODEC_LIST,
-        G_PARAM_READWRITE));
+        G_PARAM_READABLE));
 
   /**
    * FsSession:negotiated-codecs:
@@ -285,6 +283,10 @@ fs_session_get_property (GObject *object,
                          GValue *value,
                          GParamSpec *pspec)
 {
+  GST_WARNING ("Subclass %s of FsSession does not override the %s property"
+      " getter",
+      G_OBJECT_TYPE_NAME(object),
+      g_param_spec_get_name (pspec));
 }
 
 static void
@@ -293,6 +295,10 @@ fs_session_set_property (GObject *object,
                          const GValue *value,
                          GParamSpec *pspec)
 {
+  GST_WARNING ("Subclass %s of FsSession does not override the %s property"
+      " setter",
+      G_OBJECT_TYPE_NAME(object),
+      g_param_spec_get_name (pspec));
 }
 
 static void
@@ -308,7 +314,7 @@ fs_session_error_forward (GObject *signal_src,
 
 /**
  * fs_session_new_stream:
- * @session: an #FsSession
+ * @session: a #FsSession
  * @participant: #FsParticipant of a participant for the new stream
  * @direction: #FsStreamDirection describing the direction of the new stream that will
  * be created for this participant
@@ -358,7 +364,7 @@ fs_session_new_stream (FsSession *session, FsParticipant *participant,
 
 /**
  * fs_session_start_telephony_event:
- * @session: an #FsSession
+ * @session: a #FsSession
  * @event: A #FsStreamDTMFEvent or another number defined at
  * http://www.iana.org/assignments/audio-telephone-event-registry
  * @volume: The volume in dBm0 without the negative sign. Should be between
@@ -417,8 +423,8 @@ fs_session_stop_telephony_event (FsSession *session, FsDTMFMethod method)
 
 /**
  * fs_session_set_send_codec:
- * @session: an #FsSession
- * @send_codec: an #FsCodec representing the codec to send
+ * @session: a #FsSession
+ * @send_codec: a #FsCodec representing the codec to send
  * @error: location of a #GError, or %NULL if no error occured
  *
  * This function will set the currently being sent codec for all streams in this
@@ -445,6 +451,44 @@ fs_session_set_send_codec (FsSession *session, FsCodec *send_codec,
 }
 
 /**
+ * fs_session_set_local_codecs_config:
+ * @session: a #FsSession
+ * @local_codecs_config: a #GList of #FsCodec with the desired configuration
+ * @error: location of a #GError, or %NULL if no error occured
+ *
+ * Set the list of desired codec configuration. The user may
+ * change this value during an ongoing session. Note that doing this can cause
+ * the local-codecs to be changed. Therefore this requires the user to fetch
+ * the new local-codecs and renegotiate them with the peers. It is a #GList
+ * of #FsCodec. The function does not take ownership of the list.
+ *
+ * The payload type may be a valid dynamic PT (96-127), %FS_CODEC_ID_DISABLE
+ * or %FS_CODEC_ID_ANY. If the encoding name is "reserve-pt", then the
+ * payload type of the codec will be "reserved" and not be used by any
+ * dynamically assigned payload type.
+ *
+ * If the list of specifications would invalidate all codecs, an error will
+ * be returned.
+ *
+ * Returns: %TRUE on success, %FALSE on error.
+ */
+gboolean
+fs_session_set_local_codecs_config (FsSession *session,
+    GList *local_codecs_config,
+    GError **error)
+{
+  FsSessionClass *klass = FS_SESSION_GET_CLASS (session);
+
+  if (klass->set_local_codecs_config) {
+    return klass->set_local_codecs_config (session, local_codecs_config, error);
+  } else {
+    g_set_error (error, FS_ERROR, FS_ERROR_NOT_IMPLEMENTED,
+        "set_local_codecs_config not defined in class");
+  }
+  return FALSE;
+}
+
+/**
  * fs_session_emit_error:
  * @session: #FsSession on which to emit the error signal
  * @error_no: The number of the error
diff --git a/gst-libs/gst/farsight/fs-session.h b/gst-libs/gst/farsight/fs-session.h
index 23a2a8d..210f503 100644
--- a/gst-libs/gst/farsight/fs-session.h
+++ b/gst-libs/gst/farsight/fs-session.h
@@ -106,6 +106,8 @@ typedef enum
  * @start_telephony_event: Starts a telephony event
  * @stop_telephony_event: Stops a telephony event
  * @set_send_codec: Forces sending with a specific codec
+ * @set_local_codecs_config: Specifies the favorite configurations for local
+ *   codecs
  *
  * You must override at least new_stream in a subclass.
  */
@@ -130,6 +132,9 @@ struct _FsSessionClass
 
   gboolean (* set_send_codec) (FsSession *session, FsCodec *send_codec,
                                GError **error);
+  gboolean (* set_local_codecs_config) (FsSession *session,
+      GList *local_codecs_config,
+      GError **error);
 
   /*< private >*/
   gpointer _padding[8];
@@ -170,6 +175,10 @@ gboolean fs_session_stop_telephony_event (FsSession *session,
 gboolean fs_session_set_send_codec (FsSession *session, FsCodec *send_codec,
                                     GError **error);
 
+gboolean fs_session_set_local_codecs_config (FsSession *session,
+    GList *local_codecs_config,
+    GError **error);
+
 void fs_session_emit_error (FsSession *session, gint error_no,
                             gchar *error_msg, gchar *debug_msg);
 
diff --git a/gst-libs/gst/farsight/fs-stream.c b/gst-libs/gst/farsight/fs-stream.c
index 64c9c12..511aaeb 100644
--- a/gst-libs/gst/farsight/fs-stream.c
+++ b/gst-libs/gst/farsight/fs-stream.c
@@ -397,7 +397,7 @@ fs_stream_remote_candidates_added (FsStream *stream)
  * fs_stream_select_candidate_pair:
  * @stream: a #FsStream
  * @local_foundation: The foundation of the local candidates to be selected
- * @rremote_foundation: The foundation of the remote candidates to be selected
+ * @remote_foundation: The foundation of the remote candidates to be selected
  * @error: location of a #GError, or %NULL if no error occured
  *
  * This function selects one pair of candidates to be selected to start
-- 
1.5.6.5




More information about the farsight-commits mailing list