Commit 8a4a358c authored by Dafydd Harries's avatar Dafydd Harries

add user data parameter to recv callback

darcs-hash:20070129171427-c9803-febd6b6907659bcdde4ae4fb353002f56d1b0a74.gz
parent 78fe2cac
...@@ -68,6 +68,7 @@ struct _stream ...@@ -68,6 +68,7 @@ struct _stream
/* XXX: streams can have multiple components */ /* XXX: streams can have multiple components */
Component *component; Component *component;
NiceAgentRecvHandler handle_recv; NiceAgentRecvHandler handle_recv;
gpointer handle_recv_data;
}; };
...@@ -237,7 +238,8 @@ nice_agent_add_local_host_candidate ( ...@@ -237,7 +238,8 @@ nice_agent_add_local_host_candidate (
guint guint
nice_agent_add_stream ( nice_agent_add_stream (
NiceAgent *agent, NiceAgent *agent,
NiceAgentRecvHandler handle_recv) NiceAgentRecvHandler handle_recv,
gpointer handle_recv_data)
{ {
Stream *stream; Stream *stream;
GSList *i; GSList *i;
...@@ -245,6 +247,7 @@ nice_agent_add_stream ( ...@@ -245,6 +247,7 @@ nice_agent_add_stream (
stream = stream_new (); stream = stream_new ();
stream->id = agent->next_stream_id++; stream->id = agent->next_stream_id++;
stream->handle_recv = handle_recv; stream->handle_recv = handle_recv;
stream->handle_recv_data = handle_recv_data;
agent->streams = g_slist_append (agent->streams, stream); agent->streams = g_slist_append (agent->streams, stream);
/* generate a local host candidate for each local address */ /* generate a local host candidate for each local address */
...@@ -404,7 +407,7 @@ nice_agent_recv ( ...@@ -404,7 +407,7 @@ nice_agent_recv (
/* XXX: should a NULL data handler be permitted? */ /* XXX: should a NULL data handler be permitted? */
g_assert (stream->handle_recv != NULL); g_assert (stream->handle_recv != NULL);
stream->handle_recv (agent, candidate->stream_id, stream->handle_recv (agent, candidate->stream_id,
candidate->component_id, len, buf); candidate->component_id, len, buf, stream->handle_recv_data);
} }
else if ((buf[0] & 0xc0) == 0) else if ((buf[0] & 0xc0) == 0)
{ {
......
...@@ -67,7 +67,7 @@ struct _agent ...@@ -67,7 +67,7 @@ struct _agent
typedef void (*NiceAgentRecvHandler) ( typedef void (*NiceAgentRecvHandler) (
NiceAgent *agent, guint stream_id, guint component_id, guint len, NiceAgent *agent, guint stream_id, guint component_id, guint len,
gchar *buf); gchar *buf, gpointer user_data);
NiceAgent * NiceAgent *
...@@ -79,7 +79,8 @@ nice_agent_add_local_address (NiceAgent *agent, NiceAddress *addr); ...@@ -79,7 +79,8 @@ nice_agent_add_local_address (NiceAgent *agent, NiceAddress *addr);
guint guint
nice_agent_add_stream ( nice_agent_add_stream (
NiceAgent *agent, NiceAgent *agent,
NiceAgentRecvHandler handle_recv); NiceAgentRecvHandler handle_recv,
gpointer handle_recv_data);
void void
nice_agent_free (NiceAgent *agent); nice_agent_free (NiceAgent *agent);
void void
......
...@@ -13,7 +13,8 @@ handle_recv ( ...@@ -13,7 +13,8 @@ handle_recv (
guint stream_id, guint stream_id,
guint component_id, guint component_id,
guint len, guint len,
gchar *buf) gchar *buf,
gpointer user_data)
{ {
g_assert_not_reached (); g_assert_not_reached ();
} }
...@@ -24,9 +25,9 @@ main (void) ...@@ -24,9 +25,9 @@ main (void)
NiceAgent *agent; NiceAgent *agent;
agent = nice_agent_new (NULL); agent = nice_agent_new (NULL);
g_assert (nice_agent_add_stream (agent, handle_recv) == 1); g_assert (nice_agent_add_stream (agent, handle_recv, NULL) == 1);
g_assert (nice_agent_add_stream (agent, handle_recv) == 2); g_assert (nice_agent_add_stream (agent, handle_recv, NULL) == 2);
g_assert (nice_agent_add_stream (agent, handle_recv) == 3); g_assert (nice_agent_add_stream (agent, handle_recv, NULL) == 3);
nice_agent_free (agent); nice_agent_free (agent);
return 0; return 0;
......
...@@ -18,7 +18,8 @@ handle_recv ( ...@@ -18,7 +18,8 @@ handle_recv (
guint stream_id, guint stream_id,
guint component_id, guint component_id,
guint len, guint len,
gchar *buf) gchar *buf,
gpointer data)
{ {
g_assert (cb_called == FALSE); g_assert (cb_called == FALSE);
g_assert (stream_id == 1); g_assert (stream_id == 1);
...@@ -44,7 +45,7 @@ main (void) ...@@ -44,7 +45,7 @@ main (void)
agent = nice_agent_new (&mgr); agent = nice_agent_new (&mgr);
nice_address_set_ipv4_from_string (&addr, "192.168.0.1"); nice_address_set_ipv4_from_string (&addr, "192.168.0.1");
nice_agent_add_local_address (agent, &addr); nice_agent_add_local_address (agent, &addr);
nice_agent_add_stream (agent, handle_recv); nice_agent_add_stream (agent, handle_recv, NULL);
g_assert (agent->local_candidates != NULL); g_assert (agent->local_candidates != NULL);
/* recieve an RTP packet */ /* recieve an RTP packet */
......
...@@ -17,7 +17,8 @@ handle_recv ( ...@@ -17,7 +17,8 @@ handle_recv (
guint stream_id, guint stream_id,
guint component_id, guint component_id,
guint len, guint len,
gchar *buf) gchar *buf,
gpointer data)
{ {
g_assert_not_reached (); g_assert_not_reached ();
} }
...@@ -51,7 +52,7 @@ main (void) ...@@ -51,7 +52,7 @@ main (void)
/* set up agent */ /* set up agent */
agent = nice_agent_new (&mgr); agent = nice_agent_new (&mgr);
nice_agent_add_local_address (agent, &local_addr); nice_agent_add_local_address (agent, &local_addr);
nice_agent_add_stream (agent, handle_recv); nice_agent_add_stream (agent, handle_recv, NULL);
g_assert (agent->local_candidates != NULL); g_assert (agent->local_candidates != NULL);
candidate = agent->local_candidates->data; candidate = agent->local_candidates->data;
sock = &(candidate->sock); sock = &(candidate->sock);
......
...@@ -14,7 +14,8 @@ handle_recv ( ...@@ -14,7 +14,8 @@ handle_recv (
guint stream_id, guint stream_id,
guint component_id, guint component_id,
guint len, guint len,
gchar *buf) gchar *buf,
gpointer data)
{ {
g_assert_not_reached (); g_assert_not_reached ();
} }
...@@ -49,7 +50,7 @@ main (void) ...@@ -49,7 +50,7 @@ main (void)
g_assert (agent->local_candidates == NULL); g_assert (agent->local_candidates == NULL);
/* add an audio stream */ /* add an audio stream */
nice_agent_add_stream (agent, handle_recv); nice_agent_add_stream (agent, handle_recv, NULL);
/* adding a stream should cause host candidates to be generated */ /* adding a stream should cause host candidates to be generated */
g_assert (agent->local_candidates != NULL); g_assert (agent->local_candidates != NULL);
......
...@@ -19,7 +19,8 @@ handle_recv ( ...@@ -19,7 +19,8 @@ handle_recv (
guint stream_id, guint stream_id,
guint component_id, guint component_id,
guint len, guint len,
gchar *buf) gchar *buf,
gpointer data)
{ {
g_debug ("got media"); g_debug ("got media");
} }
...@@ -41,7 +42,7 @@ make_agent ( ...@@ -41,7 +42,7 @@ make_agent (
nice_address_set_ipv4_from_string (&addr_local, ip); nice_address_set_ipv4_from_string (&addr_local, ip);
nice_agent_add_local_address (agent, &addr_local); nice_agent_add_local_address (agent, &addr_local);
nice_agent_add_stream (agent, handle_recv); nice_agent_add_stream (agent, handle_recv, NULL);
g_assert (agent->local_candidates != NULL); g_assert (agent->local_candidates != NULL);
candidate = agent->local_candidates->data; candidate = agent->local_candidates->data;
......
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