modest core framework for video stuff

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4977 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale
2007-04-19 21:40:50 +00:00
parent bdaab6dbbd
commit a1725ad334
18 changed files with 1128 additions and 77 deletions
+3
View File
@@ -714,6 +714,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_dequeue_private_event(switch
*/
SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_session_t *session, switch_frame_t **frame, int timeout, int stream_id);
SWITCH_DECLARE(switch_status_t) switch_core_session_read_video_frame(switch_core_session_t *session, switch_frame_t **frame, int timeout, int stream_id);
SWITCH_DECLARE(switch_status_t) switch_core_session_write_video_frame(switch_core_session_t *session, switch_frame_t *frame, int timeout, int stream_id);
/*!
\brief Reset the buffers and resampler on a session
\param session the session to reset
+38
View File
@@ -38,7 +38,9 @@ typedef struct switch_io_event_hook_outgoing_channel switch_io_event_hook_outgoi
typedef struct switch_io_event_hook_receive_message switch_io_event_hook_receive_message_t;
typedef struct switch_io_event_hook_receive_event switch_io_event_hook_receive_event_t;
typedef struct switch_io_event_hook_read_frame switch_io_event_hook_read_frame_t;
typedef struct switch_io_event_hook_video_read_frame switch_io_event_hook_video_read_frame_t;
typedef struct switch_io_event_hook_write_frame switch_io_event_hook_write_frame_t;
typedef struct switch_io_event_hook_video_write_frame switch_io_event_hook_video_write_frame_t;
typedef struct switch_io_event_hook_kill_channel switch_io_event_hook_kill_channel_t;
typedef struct switch_io_event_hook_waitfor_read switch_io_event_hook_waitfor_read_t;
typedef struct switch_io_event_hook_waitfor_write switch_io_event_hook_waitfor_write_t;
@@ -50,7 +52,9 @@ typedef switch_status_t (*switch_outgoing_channel_hook_t) (switch_core_session_t
typedef switch_status_t (*switch_receive_message_hook_t) (switch_core_session_t *, switch_core_session_message_t *);
typedef switch_status_t (*switch_receive_event_hook_t) (switch_core_session_t *, switch_event_t *);
typedef switch_status_t (*switch_read_frame_hook_t) (switch_core_session_t *, switch_frame_t **, int, switch_io_flag_t, int);
typedef switch_status_t (*switch_video_read_frame_hook_t) (switch_core_session_t *, switch_frame_t **, int, switch_io_flag_t, int);
typedef switch_status_t (*switch_write_frame_hook_t) (switch_core_session_t *, switch_frame_t *, int, switch_io_flag_t, int);
typedef switch_status_t (*switch_video_write_frame_hook_t) (switch_core_session_t *, switch_frame_t *, int, switch_io_flag_t, int);
typedef switch_status_t (*switch_kill_channel_hook_t) (switch_core_session_t *, int);
typedef switch_status_t (*switch_waitfor_read_hook_t) (switch_core_session_t *, int, int);
typedef switch_status_t (*switch_waitfor_write_hook_t) (switch_core_session_t *, int, int);
@@ -86,6 +90,13 @@ struct switch_io_event_hook_read_frame {
struct switch_io_event_hook_read_frame *next;
};
/*! \brief Node in which to store custom read frame channel callback hooks */
struct switch_io_event_hook_video_read_frame {
/*! the read frame channel callback hook */
switch_read_frame_hook_t video_read_frame;
struct switch_io_event_hook_video_read_frame *next;
};
/*! \brief Node in which to store custom write_frame channel callback hooks */
struct switch_io_event_hook_write_frame {
/*! the write_frame channel callback hook */
@@ -93,6 +104,13 @@ struct switch_io_event_hook_write_frame {
struct switch_io_event_hook_write_frame *next;
};
/*! \brief Node in which to store custom video_write_frame channel callback hooks */
struct switch_io_event_hook_video_write_frame {
/*! the video_write_frame channel callback hook */
switch_video_write_frame_hook_t video_write_frame;
struct switch_io_event_hook_video_write_frame *next;
};
/*! \brief Node in which to store custom kill channel callback hooks */
struct switch_io_event_hook_kill_channel {
/*! the kill channel callback hook */
@@ -138,8 +156,12 @@ struct switch_io_event_hooks {
switch_io_event_hook_receive_event_t *receive_event;
/*! a list of read frame hooks */
switch_io_event_hook_read_frame_t *read_frame;
/*! a list of video read frame hooks */
switch_io_event_hook_video_read_frame_t *video_read_frame;
/*! a list of write frame hooks */
switch_io_event_hook_write_frame_t *write_frame;
/*! a list of video write frame hooks */
switch_io_event_hook_video_write_frame_t *video_write_frame;
/*! a list of kill channel hooks */
switch_io_event_hook_kill_channel_t *kill_channel;
/*! a list of wait for read hooks */
@@ -185,6 +207,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_event_hook_add_receive_message(switc
*/
SWITCH_DECLARE(switch_status_t) switch_core_event_hook_add_read_frame(switch_core_session_t *session, switch_read_frame_hook_t read_frame);
/*!
\brief Add an event hook to be executed when a session reads a frame
\param session session to bind hook to
\param video_read_frame hook to bind
\return SWITCH_STATUS_SUCCESS on suceess
*/
SWITCH_DECLARE(switch_status_t) switch_core_event_hook_add_video_read_frame(switch_core_session_t *session, switch_read_frame_hook_t video_read_frame);
/*!
\brief Add an event hook to be executed when a session writes a frame
\param session session to bind hook to
@@ -193,6 +223,14 @@ SWITCH_DECLARE(switch_status_t) switch_core_event_hook_add_read_frame(switch_cor
*/
SWITCH_DECLARE(switch_status_t) switch_core_event_hook_add_write_frame(switch_core_session_t *session, switch_write_frame_hook_t write_frame);
/*!
\brief Add an event hook to be executed when a session writes a video frame
\param session session to bind hook to
\param write_frame hook to bind
\return SWITCH_STATUS_SUCCESS on suceess
*/
SWITCH_DECLARE(switch_status_t) switch_core_event_hook_add_video_write_frame(switch_core_session_t *session, switch_video_write_frame_hook_t video_write_frame);
/*!
\brief Add an event hook to be executed when a session kills a channel
\param session session to bind hook to
+5 -2
View File
@@ -30,7 +30,7 @@
*
*/
/*! \file switch_frame.h
\brief Media Frame Structure
\brief Media Frame Structure
*/
#ifndef SWITCH_FRAME_H
@@ -40,7 +40,7 @@
SWITCH_BEGIN_EXTERN_C
/*! \brief An abstraction of a data frame */
struct switch_frame {
struct switch_frame {
/*! a pointer to the codec information */
switch_codec_t *codec;
/*! the originating source of the frame */
@@ -63,6 +63,9 @@ SWITCH_BEGIN_EXTERN_C
switch_payload_t payload;
/*! the timestamp of the frame */
switch_size_t timestamp;
uint16_t seq;
uint32_t ssrc;
switch_bool_t m;
/*! frame flags */
switch_frame_flag_t flags;
};
+1
View File
@@ -203,6 +203,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_stop_record_session(switch_core_sessi
SWITCH_DECLARE(switch_status_t) switch_ivr_inband_dtmf_session(switch_core_session_t *session);
SWITCH_DECLARE(switch_status_t) switch_ivr_stop_inband_dtmf_session(switch_core_session_t *session);
SWITCH_DECLARE(void) switch_ivr_session_echo(switch_core_session_t *session);
/*!
\brief play a file from the disk to the session
+4
View File
@@ -99,6 +99,10 @@ struct switch_io_routines {
switch_status_t (*receive_event) (switch_core_session_t *, switch_event_t *);
/*! change a sessions channel state */
switch_status_t (*state_change) (switch_core_session_t *);
/*! read a video frame from a session */
switch_status_t (*read_video_frame) (switch_core_session_t *, switch_frame_t **, int, switch_io_flag_t, int);
/*! write a video frame to a session */
switch_status_t (*write_video_frame) (switch_core_session_t *, switch_frame_t *, int, switch_io_flag_t, int);
};
/*! \brief Abstraction of an module endpoint interface
+10 -2
View File
@@ -110,6 +110,10 @@ SWITCH_BEGIN_EXTERN_C
#define SWITCH_LOCAL_MEDIA_PORT_VARIABLE "local_media_port"
#define SWITCH_REMOTE_MEDIA_IP_VARIABLE "remote_media_ip"
#define SWITCH_REMOTE_MEDIA_PORT_VARIABLE "remote_media_port"
#define SWITCH_REMOTE_VIDEO_IP_VARIABLE "remote_video_ip"
#define SWITCH_REMOTE_VIDEO_PORT_VARIABLE "remote_video_port"
#define SWITCH_LOCAL_VIDEO_IP_VARIABLE "local_video_ip"
#define SWITCH_LOCAL_VIDEO_PORT_VARIABLE "local_video_port"
#define SWITCH_HANGUP_AFTER_BRIDGE_VARIABLE "hangup_after_bridge"
#define SWITCH_MAX_FORWARDS_VARIABLE "max_forwards"
#define SWITCH_SPEECH_KEY "speech"
@@ -542,6 +546,7 @@ CF_RING_READY = (1 << 18) - Channel is ready to send ringback
CF_BREAK = (1 << 19) - Channel should stop what it's doing
CF_BROADCAST = (1 << 20) - Channel is broadcasting
CF_UNICAST = (1 << 21) - Channel has a unicast connection
CF_VIDEO = (1 << 22) - Channel has video
</pre>
*/
@@ -567,7 +572,8 @@ typedef enum {
CF_RING_READY = (1 << 18),
CF_BREAK = (1 << 19),
CF_BROADCAST = (1 << 20),
CF_UNICAST = (1 << 21)
CF_UNICAST = (1 << 21),
CF_VIDEO = (1 << 22)
} switch_channel_flag_t;
@@ -578,12 +584,14 @@ typedef enum {
<pre>
SFF_CNG = (1 << 0) - Frame represents comfort noise
SFF_RAW_RTP = (1 << 1) - Frame has raw rtp accessible
SFF_RTP_HEADER = (1 << 2) - Get the rtp header from the frame header
</pre>
*/
typedef enum {
SFF_NONE = 0,
SFF_CNG = (1 << 0),
SFF_RAW_RTP = (1 << 1)
SFF_RAW_RTP = (1 << 1),
SFF_RTP_HEADER = (1 << 2)
} switch_frame_flag_t;