Main Page | Modules | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

switch_core_codec.c File Reference


Functions

uint32_t switch_core_codec_next_id (void)
switch_status_t switch_core_session_set_read_codec (switch_core_session_t *session, switch_codec_t *codec)
switch_codec_tswitch_core_session_get_read_codec (switch_core_session_t *session)
switch_status_t switch_core_session_set_write_codec (switch_core_session_t *session, switch_codec_t *codec)
switch_codec_tswitch_core_session_get_write_codec (switch_core_session_t *session)
switch_status_t switch_core_session_set_video_read_codec (switch_core_session_t *session, switch_codec_t *codec)
switch_codec_tswitch_core_session_get_video_read_codec (switch_core_session_t *session)
switch_status_t switch_core_session_set_video_write_codec (switch_core_session_t *session, switch_codec_t *codec)
switch_codec_tswitch_core_session_get_video_write_codec (switch_core_session_t *session)
switch_status_t switch_core_codec_copy (switch_codec_t *codec, switch_codec_t *new_codec, switch_memory_pool_t *pool)
switch_status_t switch_core_codec_init (switch_codec_t *codec, char *codec_name, char *fmtp, uint32_t rate, int ms, int channels, uint32_t flags, const switch_codec_settings_t *codec_settings, switch_memory_pool_t *pool)
 Initialize a codec handle.
switch_status_t switch_core_codec_encode (switch_codec_t *codec, switch_codec_t *other_codec, void *decoded_data, uint32_t decoded_data_len, uint32_t decoded_rate, void *encoded_data, uint32_t *encoded_data_len, uint32_t *encoded_rate, unsigned int *flag)
 Encode data using a codec handle.
switch_status_t switch_core_codec_decode (switch_codec_t *codec, switch_codec_t *other_codec, void *encoded_data, uint32_t encoded_data_len, uint32_t encoded_rate, void *decoded_data, uint32_t *decoded_data_len, uint32_t *decoded_rate, unsigned int *flag)
 Decode data using a codec handle.
switch_status_t switch_core_codec_destroy (switch_codec_t *codec)
 Destroy an initalized codec handle.


Function Documentation

switch_codec_t* switch_core_session_get_read_codec switch_core_session_t session  ) 
 

00078 {
00079         return session->read_codec;
00080 }

switch_codec_t* switch_core_session_get_video_read_codec switch_core_session_t session  ) 
 

00138 {
00139         return session->video_read_codec;
00140 }

switch_codec_t* switch_core_session_get_video_write_codec switch_core_session_t session  ) 
 

00164 {
00165         return session->video_write_codec;
00166 }

switch_codec_t* switch_core_session_get_write_codec switch_core_session_t session  ) 
 

00109 {
00110         return session->write_codec;
00111 }

switch_status_t switch_core_session_set_read_codec switch_core_session_t session,
switch_codec_t codec
 

00047 {
00048         switch_event_t *event;
00049         switch_channel_t *channel = switch_core_session_get_channel(session);
00050         char tmp[30];
00051 
00052         switch_assert(codec->implementation);
00053         
00054         if (switch_event_create(&event, SWITCH_EVENT_CODEC) == SWITCH_STATUS_SUCCESS) {
00055                 switch_channel_event_set_data(session->channel, event);
00056                 switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-read-codec-name", "%s", codec->implementation->iananame);
00057                 switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-read-codec-rate", "%d", codec->implementation->actual_samples_per_second);
00058                 if (codec->implementation->actual_samples_per_second != codec->implementation->samples_per_second) {
00059                         switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-reported-read-codec-rate", "%d", codec->implementation->samples_per_second);
00060                 }
00061                 switch_event_fire(&event);
00062         }
00063 
00064         switch_channel_set_variable(channel, "read_codec", codec->implementation->iananame);
00065         switch_snprintf(tmp, sizeof(tmp), "%d", codec->implementation->actual_samples_per_second);
00066         switch_channel_set_variable(channel, "read_rate", tmp);
00067 
00068         session->read_codec = codec;
00069         session->raw_read_frame.codec = session->read_codec;
00070         session->raw_write_frame.codec = session->read_codec;
00071         session->enc_read_frame.codec = session->read_codec;
00072         session->enc_write_frame.codec = session->read_codec;
00073 
00074         return SWITCH_STATUS_SUCCESS;
00075 }

Here is the call graph for this function:

switch_status_t switch_core_session_set_video_read_codec switch_core_session_t session,
switch_codec_t codec
 

00116 {
00117         switch_event_t *event;
00118         switch_channel_t *channel = switch_core_session_get_channel(session);
00119         char tmp[30];
00120 
00121         if (switch_event_create(&event, SWITCH_EVENT_CODEC) == SWITCH_STATUS_SUCCESS) {
00122                 switch_channel_event_set_data(session->channel, event);
00123                 switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-video-read-codec-name", "%s", codec->implementation->iananame);
00124                 switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-video-read-codec-rate", "%d", codec->implementation->actual_samples_per_second);
00125                 switch_event_fire(&event);
00126         }
00127 
00128         switch_channel_set_variable(channel, "video_read_codec", codec->implementation->iananame);
00129         switch_snprintf(tmp, sizeof(tmp), "%d", codec->implementation->actual_samples_per_second);
00130         switch_channel_set_variable(channel, "video_read_rate", tmp);
00131 
00132         session->video_read_codec = codec;
00133 
00134         return SWITCH_STATUS_SUCCESS;
00135 }

Here is the call graph for this function:

switch_status_t switch_core_session_set_video_write_codec switch_core_session_t session,
switch_codec_t codec
 

00143 {
00144         switch_event_t *event;
00145         switch_channel_t *channel = switch_core_session_get_channel(session);
00146         char tmp[30];
00147 
00148         if (switch_event_create(&event, SWITCH_EVENT_CODEC) == SWITCH_STATUS_SUCCESS) {
00149                 switch_channel_event_set_data(session->channel, event);
00150                 switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-video-write-codec-name", "%s", codec->implementation->iananame);
00151                 switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-video-write-codec-rate", "%d", codec->implementation->actual_samples_per_second);
00152                 switch_event_fire(&event);
00153         }
00154 
00155         switch_channel_set_variable(channel, "video_write_codec", codec->implementation->iananame);
00156         switch_snprintf(tmp, sizeof(tmp), "%d", codec->implementation->actual_samples_per_second);
00157         switch_channel_set_variable(channel, "video_write_rate", tmp);
00158 
00159         session->video_write_codec = codec;
00160         return SWITCH_STATUS_SUCCESS;
00161 }

Here is the call graph for this function:

switch_status_t switch_core_session_set_write_codec switch_core_session_t session,
switch_codec_t codec
 

00083 {
00084         switch_event_t *event;
00085         switch_channel_t *channel = switch_core_session_get_channel(session);
00086         char tmp[30];
00087 
00088         switch_assert(codec->implementation);
00089 
00090         if (switch_event_create(&event, SWITCH_EVENT_CODEC) == SWITCH_STATUS_SUCCESS) {
00091                 switch_channel_event_set_data(session->channel, event);
00092                 switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-write-codec-name", "%s", codec->implementation->iananame);
00093                 switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-write-codec-rate", "%d", codec->implementation->actual_samples_per_second);
00094                 if (codec->implementation->actual_samples_per_second != codec->implementation->samples_per_second) {
00095                         switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-reported-write-codec-rate", "%d", codec->implementation->actual_samples_per_second);
00096                 }
00097                 switch_event_fire(&event);
00098         }
00099 
00100         switch_channel_set_variable(channel, "write_codec", codec->implementation->iananame);
00101         switch_snprintf(tmp, sizeof(tmp), "%d", codec->implementation->actual_samples_per_second);
00102         switch_channel_set_variable(channel, "write_rate", tmp);
00103 
00104         session->write_codec = codec;
00105         return SWITCH_STATUS_SUCCESS;
00106 }

Here is the call graph for this function:


Generated on Mon May 26 22:06:51 2008 for FreeSWITCH by  doxygen 1.3.9.1