stream id stuff

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@307 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale
2006-01-09 18:40:56 +00:00
parent 5ddfc55d23
commit 208ec3ff7a
12 changed files with 144 additions and 74 deletions
+36 -7
View File
@@ -44,14 +44,15 @@ extern "C" {
#include <switch.h>
#define MAX_CORE_THREAD_SESSION_OBJS 128
#define SWITCH_MAX_CORE_THREAD_SESSION_OBJS 128
#define SWITCH_MAX_STREAMS 128
/*! \brief A generic object to pass as a thread's session object to allow mutiple arguements and a pool */
struct switch_core_thread_session {
/*! status of the thread */
int running;
/*! array of void pointers to pass mutiple data objects */
void *objs[MAX_CORE_THREAD_SESSION_OBJS];
void *objs[SWITCH_MAX_CORE_THREAD_SESSION_OBJS];
/*! a pointer to a memory pool if the thread has it's own pool */
switch_memory_pool *pool;
};
@@ -227,6 +228,29 @@ SWITCH_DECLARE(void *) switch_core_session_get_private(switch_core_session *sess
*/
SWITCH_DECLARE(switch_status) switch_core_session_set_private(switch_core_session *session, void *private);
/*!
\brief Add a logical stream to a session
\param session the session to add the stream to
\param private an optional pointer to private data for the new stream
\return the stream id of the new stream
*/
SWITCH_DECLARE(int) switch_core_session_add_stream(switch_core_session *session, void *private);
/*!
\brief Retreive a logical stream from a session
\param session the session to add the stream to
\param index the index to retrieve
\return the private data (if any)
*/
SWITCH_DECLARE(void *) switch_core_session_get_stream(switch_core_session *session, int index);
/*!
\brief Determine the number of logical streams a session has
\param session the session to query
\return the total number of logical streams
*/
SWITCH_DECLARE(int) switch_core_session_get_stream_count(switch_core_session *session);
/*!
\brief Launch a thread designed to exist within the scope of a given session
\param session a session to allocate the thread from
@@ -244,9 +268,10 @@ SWITCH_DECLARE(void) switch_core_thread_session_end(switch_core_thread_session *
/*!
\brief Launch a service thread on a session to drop inbound data
\param session the session the launch thread on
\param stream_id which logical media channel to use
\param thread_session the thread_session to use
*/
SWITCH_DECLARE(void) switch_core_service_session(switch_core_session *session, switch_core_thread_session *thread_session);
SWITCH_DECLARE(void) switch_core_service_session(switch_core_session *session, switch_core_thread_session *thread_session, int stream_id);
/*!
\brief Request an outgoing session spawned from an existing session using a desired endpoing module
@@ -273,18 +298,20 @@ SWITCH_DECLARE(switch_status) switch_core_session_answer_channel(switch_core_ses
\param session the session to read from
\param frame a NULL pointer to a frame to aim at the newly read frame
\param timeout number of milliseconds to wait for data
\param stream_id which logical media channel to use
\return SWITCH_STATUS_SUCCESS a the frame was read
*/
SWITCH_DECLARE(switch_status) switch_core_session_read_frame(switch_core_session *session, switch_frame **frame, int timeout);
SWITCH_DECLARE(switch_status) switch_core_session_read_frame(switch_core_session *session, switch_frame **frame, int timeout, int stream_id);
/*!
\brief Write a frame to a session
\param session the session to write to
\param frame the frame to write
\param timeout number of milliseconds to wait for data
\param stream_id which logical media channel to use
\return SWITCH_STATUS_SUCCESS a the frame was written
*/
SWITCH_DECLARE(switch_status) switch_core_session_write_frame(switch_core_session *session, switch_frame *frame, int timeout);
SWITCH_DECLARE(switch_status) switch_core_session_write_frame(switch_core_session *session, switch_frame *frame, int timeout, int stream_id);
/*!
\brief Send a signal to a channel
@@ -298,17 +325,19 @@ SWITCH_DECLARE(switch_status) switch_core_session_kill_channel(switch_core_sessi
\brief Wait for a session to be ready for input
\param session session to wait for
\param timeout number of milliseconds to wait for data
\param stream_id which logical media channel to use
\return SWITCH_STATUS_SUCCESS if data is available for read within timeframe specified
*/
SWITCH_DECLARE(switch_status) switch_core_session_waitfor_read(switch_core_session *session, int timeout);
SWITCH_DECLARE(switch_status) switch_core_session_waitfor_read(switch_core_session *session, int timeout, int stream_id);
/*!
\brief Wait for a session to be ready for output
\param session session to wait for
\param timeout number of milliseconds to wait for data
\param stream_id which logical media channel to use
\return SWITCH_STATUS_SUCCESS if the session is available for write within timeframe specified
*/
SWITCH_DECLARE(switch_status) switch_core_session_waitfor_write(switch_core_session *session, int timeout);
SWITCH_DECLARE(switch_status) switch_core_session_waitfor_write(switch_core_session *session, int timeout, int stream_id);
/*!
\brief Send DTMF to a session
+4 -4
View File
@@ -145,15 +145,15 @@ struct switch_io_routines {
/*! answers the given session's channel */
switch_status (*answer_channel)(switch_core_session *);
/*! read a frame from a session */
switch_status (*read_frame)(switch_core_session *, switch_frame **, int, switch_io_flag);
switch_status (*read_frame)(switch_core_session *, switch_frame **, int, switch_io_flag, int);
/*! write a frame to a session */
switch_status (*write_frame)(switch_core_session *, switch_frame *, int, switch_io_flag);
switch_status (*write_frame)(switch_core_session *, switch_frame *, int, switch_io_flag, int);
/*! send a kill signal to the session's channel */
switch_status (*kill_channel)(switch_core_session *, int);
/*! wait for the session's channel to be ready to read audio */
switch_status (*waitfor_read)(switch_core_session *, int);
switch_status (*waitfor_read)(switch_core_session *, int, int);
/*! wait for the session's channel to be ready to write audio */
switch_status (*waitfor_write)(switch_core_session *, int);
switch_status (*waitfor_write)(switch_core_session *, int, int);
/*! send a string of DTMF digits to a session's channel */
switch_status (*send_dtmf)(switch_core_session *, char *);
};
+5 -5
View File
@@ -228,7 +228,7 @@ SWITCH_FILE_DATA_SHORT = (1 << 3) - Read data in shorts
SWITCH_FILE_DATA_INT = (1 << 4) - Read data in ints
SWITCH_FILE_DATA_FLOAT = (1 << 5) - Read data in floats
SWITCH_FILE_DATA_DOUBLE = (1 << 6) - Read data in doubles
SWITCH_FILE_DATA_RAW = (1 << 7) - Read data asis
SWITCH_FILE_DATA_RAW = (1 << 7) - Read data as is
</pre>
*/
typedef enum {
@@ -329,11 +329,11 @@ typedef switch_caller_extension *(*switch_dialplan_hunt_function)(switch_core_se
typedef switch_status (*switch_event_handler)(switch_core_session *);
typedef switch_status (*switch_outgoing_channel_hook)(switch_core_session *, switch_caller_profile *, switch_core_session *);
typedef switch_status (*switch_answer_channel_hook)(switch_core_session *);
typedef switch_status (*switch_read_frame_hook)(switch_core_session *, switch_frame **, int, switch_io_flag);
typedef switch_status (*switch_write_frame_hook)(switch_core_session *, switch_frame *, int, switch_io_flag);
typedef switch_status (*switch_read_frame_hook)(switch_core_session *, switch_frame **, int, switch_io_flag, int);
typedef switch_status (*switch_write_frame_hook)(switch_core_session *, switch_frame *, int, switch_io_flag, int);
typedef switch_status (*switch_kill_channel_hook)(switch_core_session *, int);
typedef switch_status (*switch_waitfor_read_hook)(switch_core_session *, int);
typedef switch_status (*switch_waitfor_write_hook)(switch_core_session *, int);
typedef switch_status (*switch_waitfor_read_hook)(switch_core_session *, int, int);
typedef switch_status (*switch_waitfor_write_hook)(switch_core_session *, int, int);
typedef switch_status (*switch_send_dtmf_hook)(switch_core_session *, char *);
typedef switch_status (*switch_api_function)(char *in, char *out, size_t outlen);