summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Withnall <philip.withnall@collabora.co.uk>2013-12-12 11:49:09 +0000
committerOlivier Crête <olivier.crete@collabora.com>2014-01-31 01:48:59 -0500
commit11f04d6cbd3772f4fafc503b477de6517bab1e68 (patch)
treef7bfead39d671372a4de98f68edd387237cd71f4
parent949f979a98498d8ceab2a70696f1dbdc9ab96b7f (diff)
downloadlibnice-11f04d6cbd3772f4fafc503b477de6517bab1e68.tar.gz
agent: Add nice_agent_build_io_stream() API
This allows creation of a NiceIOStream from an existing NiceAgent instance.
-rw-r--r--agent/agent.c31
-rw-r--r--agent/agent.h22
-rw-r--r--agent/iostream.h1
-rw-r--r--docs/reference/libnice/libnice-sections.txt1
4 files changed, 54 insertions, 1 deletions
diff --git a/agent/agent.c b/agent/agent.c
index 020e60c..231f5b4 100644
--- a/agent/agent.c
+++ b/agent/agent.c
@@ -3826,3 +3826,34 @@ nice_agent_parse_remote_candidate_sdp (NiceAgent *agent, guint stream_id,
return candidate;
}
+
+/**
+ * nice_agent_build_io_stream:
+ * @agent: A reliable #NiceAgent
+ * @stream_id: The ID of the agent’s stream to wrap
+ * @component_id: The ID of the agent’s component to wrap
+ *
+ * Create a new #NiceIOStream wrapping the given stream/component from @agent,
+ * which must be a reliable #NiceAgent. The given stream/component must be
+ * created using nice_agent_add_stream() before any I/O operations are performed
+ * on the #NiceIOStream.
+ *
+ * Note that if multiple I/O streams are created for a single stream/component,
+ * only one of them may be used at any time.
+ *
+ * Returns: (transfer full): The new #NiceIOStream object
+ *
+ * Since: 0.1.5
+ */
+NICEAPI_EXPORT GIOStream *
+nice_agent_build_io_stream (NiceAgent *agent, guint stream_id,
+ guint component_id)
+{
+ g_return_val_if_fail (NICE_IS_AGENT (agent), NULL);
+ g_return_val_if_fail (stream_id >= 1, NULL);
+ g_return_val_if_fail (component_id >= 1, NULL);
+
+ g_return_val_if_fail (agent->reliable, NULL);
+
+ return nice_io_stream_new (agent, stream_id, component_id);
+}
diff --git a/agent/agent.h b/agent/agent.h
index d888148..f7e808b 100644
--- a/agent/agent.h
+++ b/agent/agent.h
@@ -1113,6 +1113,28 @@ nice_agent_parse_remote_candidate_sdp (
guint stream_id,
const gchar *sdp);
+/**
+ * nice_agent_build_io_stream:
+ * @agent: A #NiceAgent
+ * @stream_id: The ID of the stream to wrap
+ * @component_id: The ID of the component to wrap
+ *
+ * Build a #GIOStream wrapper around the given stream and component in
+ * @agent. The I/O stream will be valid for as long as @stream_id is valid.
+ *
+ * This function may only be called on reliable #NiceAgents. It is an error to
+ * try and create an I/O stream wrapper for an unreliable stream.
+ *
+ * Returns: (transfer full): A new #GIOStream.
+ *
+ * Since: 0.1.5
+ */
+GIOStream *
+nice_agent_build_io_stream (
+ NiceAgent *agent,
+ guint stream_id,
+ guint component_id);
+
G_END_DECLS
#endif /* _AGENT_H */
diff --git a/agent/iostream.h b/agent/iostream.h
index 88f42c0..ad5b959 100644
--- a/agent/iostream.h
+++ b/agent/iostream.h
@@ -75,7 +75,6 @@ GType nice_io_stream_get_type (void);
struct _NiceIOStreamClass
{
GIOStreamClass parent_class;
-
};
struct _NiceIOStream
diff --git a/docs/reference/libnice/libnice-sections.txt b/docs/reference/libnice/libnice-sections.txt
index 57fed70..74fdb24 100644
--- a/docs/reference/libnice/libnice-sections.txt
+++ b/docs/reference/libnice/libnice-sections.txt
@@ -40,6 +40,7 @@ nice_agent_generate_local_candidate_sdp
nice_agent_parse_remote_sdp
nice_agent_parse_remote_stream_sdp
nice_agent_parse_remote_candidate_sdp
+nice_agent_build_io_stream
<SUBSECTION Standard>
NICE_AGENT
NICE_IS_AGENT