Commit 11f04d6c authored by Philip Withnall's avatar Philip Withnall Committed by Olivier Crête

agent: Add nice_agent_build_io_stream() API

This allows creation of a NiceIOStream from an existing NiceAgent
instance.
parent 949f979a
......@@ -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);
}
......@@ -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 */
......
......@@ -75,7 +75,6 @@ GType nice_io_stream_get_type (void);
struct _NiceIOStreamClass
{
GIOStreamClass parent_class;
};
struct _NiceIOStream
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment