100 int changed_read_codec = 0;
114 changed_read_codec = 1;
128 while (cur_codec != NULL) {
130 cur_codec->
next = codec;
134 cur_codec = cur_codec->
next;
143 changed_read_codec = 1;
332 memset(impp, 0,
sizeof(*impp));
354 memset(impp, 0,
sizeof(*impp));
366 memset(impp, 0,
sizeof(*impp));
378 memset(impp, 0,
sizeof(*impp));
591 if (
zstr(codec_name) ||
zstr(fmtp) || !codec_fmtp) {
595 memset(codec_fmtp, 0,
sizeof(*codec_fmtp));
600 status = codec_interface->
parse_fmtp(fmtp, codec_fmtp);
644 uint32_t rate,
int ms,
int channels, uint32_t bitrate, uint32_t
flags,
653 memset(codec, 0,
sizeof(*codec));
659 if (strchr(codec_name,
'.')) {
662 if ((p = strchr(codec_name,
'.'))) {
664 modname = codec_name;
674 if (!strncasecmp(codec_name,
"PROXY", 5)) {
677 implementation = iptr;
689 if ((!rate || rate == crate) && (!bitrate || bitrate == (uint32_t)iptr->
bits_per_second) &&
691 implementation = iptr;
700 if ((!rate || rate == crate) && (!bitrate || bitrate == (uint32_t)iptr->
bits_per_second) &&
702 implementation = iptr;
709 if (implementation) {
728 implementation->
init(codec, flags, codec_settings);
734 codec_name, rate, ms, channels);
746 uint32_t decoded_data_len,
747 uint32_t decoded_rate,
748 void *encoded_data, uint32_t *encoded_data_len, uint32_t *encoded_rate,
unsigned int *flag)
768 decoded_rate, encoded_data, encoded_data_len, encoded_rate, flag);
778 uint32_t encoded_data_len,
779 uint32_t encoded_rate,
780 void *decoded_data, uint32_t *decoded_data_len, uint32_t *decoded_rate,
unsigned int *flag)
805 memset(decoded_data, 255, *decoded_data_len);
811 status = codec->
implementation->
decode(codec, other_codec, encoded_data, encoded_data_len, encoded_rate,
812 decoded_data, decoded_data_len, decoded_rate, flag);
924 mutex = codec->
mutex;
951 memset(codec, 0,
sizeof(*codec));
switch_status_t switch_core_codec_decode_video(switch_codec_t *codec, switch_frame_t *frame)
Decode video data using a codec handle.
switch_core_session_t * session
#define switch_event_fire(event)
Fire an event filling in most of the arguements with obvious values.
#define switch_core_new_memory_pool(p)
Create a new sub memory pool from the core's master pool.
switch_status_t switch_thread_rwlock_unlock(switch_thread_rwlock_t *rwlock)
switch_status_t switch_core_session_set_video_write_codec(switch_core_session_t *session, switch_codec_t *codec)
#define SWITCH_CHANNEL_SESSION_LOG(x)
switch_status_t switch_core_codec_parse_fmtp(const char *codec_name, const char *fmtp, uint32_t rate, switch_codec_fmtp_t *codec_fmtp)
switch_thread_rwlock_t * bug_rwlock
#define switch_set_flag(obj, flag)
Set a flag on an arbitrary object.
#define SWITCH_CHANNEL_LOG
switch_core_codec_destroy_func_t destroy
switch_mutex_t * codec_write_mutex
void switch_core_session_unset_write_codec(switch_core_session_t *session)
switch_frame_t enc_read_frame
switch_mutex_t * codec_read_mutex
void switch_channel_event_set_data(_In_ switch_channel_t *channel, _In_ switch_event_t *event)
Add information about a given channel to an event object.
#define switch_core_strdup(_pool, _todup)
Copy a string using memory allocation from a given pool.
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_session_set_read_impl(switch_core_session_t *session, const switch_codec_implementation_t *impp)
switch_codec_t * video_read_codec
#define switch_core_destroy_memory_pool(p)
Returns a subpool back to the main pool.
uint32_t decoded_bytes_per_packet
switch_memory_pool_t * pool
switch_codec_t * read_codec
switch_status_t switch_event_add_header(switch_event_t *event, switch_stack_t stack, const char *header_name, const char *fmt,...) PRINTF_FUNCTION(4
Add a header to an event.
Representation of an event.
switch_codec_t * real_read_codec
switch_codec_implementation_t * implementations
void * switch_core_memory_pool_get_data(switch_memory_pool_t *pool, const char *key)
switch_codec_implementation_t video_read_impl
switch_codec_t * video_write_codec
switch_status_t switch_core_session_get_real_read_impl(switch_core_session_t *session, switch_codec_implementation_t *impp)
switch_codec_implementation_t video_write_impl
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_core_codec_video_decode_func_t decode_video
switch_codec_implementation_t read_impl
switch_status_t switch_core_codec_destroy(switch_codec_t *codec)
Destroy an initalized codec handle.
switch_status_t switch_core_session_set_read_codec(switch_core_session_t *session, switch_codec_t *codec)
int switch_snprintf(_Out_z_cap_(len) char *buf, _In_ switch_size_t len, _In_z_ _Printf_format_string_ const char *format,...)
switch_status_t switch_core_session_set_write_codec(switch_core_session_t *session, switch_codec_t *codec)
switch_status_t switch_core_session_get_video_write_impl(switch_core_session_t *session, switch_codec_implementation_t *impp)
switch_status_t switch_core_codec_reset(switch_codec_t *codec)
switch_status_t switch_mutex_unlock(switch_mutex_t *lock)
switch_codec_t * switch_core_session_get_effective_write_codec(switch_core_session_t *session)
switch_status_t switch_core_session_get_read_impl(switch_core_session_t *session, switch_codec_implementation_t *impp)
_Ret_ switch_channel_t * switch_core_session_get_channel(_In_ switch_core_session_t *session)
Retrieve a pointer to the channel object associated with a given session.
switch_codec_control_command_t
#define UNPROTECT_INTERFACE(_it)
#define switch_clear_flag(obj, flag)
Clear a flag on an arbitrary object while locked.
switch_codec_implementation_t write_impl
#define SWITCH_MUTEX_NESTED
switch_status_t switch_thread_rwlock_wrlock(switch_thread_rwlock_t *rwlock)
switch_codec_control_type_t
const switch_codec_implementation_t * implementation
void switch_core_session_lock_codec_write(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_implementation_t real_read_impl
switch_channel_t * channel
switch_core_codec_decode_func_t decode
switch_codec_interface_t * codec_interface
switch_frame_flag_t flags
switch_status_t switch_mutex_lock(switch_mutex_t *lock)
switch_status_t switch_core_session_set_video_read_impl(switch_core_session_t *session, const switch_codec_implementation_t *impp)
uint32_t actual_samples_per_second
switch_memory_pool_t * memory_pool
switch_status_t switch_core_session_set_video_write_impl(switch_core_session_t *session, const switch_codec_implementation_t *impp)
switch_status_t switch_event_add_header_string(switch_event_t *event, switch_stack_t stack, const char *header_name, const char *data)
Add a string header to an event.
switch_codec_t * write_codec
Top level module interface to implement a series of codec implementations.
switch_status_t switch_core_codec_copy(switch_codec_t *codec, switch_codec_t *new_codec, const switch_codec_settings_t *codec_settings, switch_memory_pool_t *pool)
switch_status_t switch_mutex_init(switch_mutex_t **lock, unsigned int flags, switch_memory_pool_t *pool)
An abstraction of a data frame.
struct switch_codec * next
#define switch_core_codec_init(_codec, _codec_name, _modname, _fmtp, _rate, _ms, _channels, _flags, _codec_settings, _pool)
Initialize a codec handle.
uint32_t switch_core_codec_next_id(void)
switch_status_t switch_core_session_get_write_impl(switch_core_session_t *session, switch_codec_implementation_t *impp)
int microseconds_per_packet
switch_codec_t * switch_core_session_get_effective_read_codec(switch_core_session_t *session)
uint32_t actual_samples_per_second
switch_codec_interface_t * switch_loadable_module_get_codec_interface(const char *name, const char *modname)
Retrieve the codec interface by it's registered name.
switch_status_t switch_core_codec_encode_video(switch_codec_t *codec, switch_frame_t *frame)
Encode video data using a codec handle.
void switch_core_session_lock_codec_read(switch_core_session_t *session)
struct fspr_thread_mutex_t switch_mutex_t
switch_frame_t raw_read_frame
switch_codec_t * switch_core_session_get_video_read_codec(switch_core_session_t *session)
switch_status_t switch_core_codec_init_with_bitrate(switch_codec_t *codec, const char *codec_name, const char *modname, const char *fmtp, uint32_t rate, int ms, int channels, uint32_t bitrate, uint32_t flags, const switch_codec_settings_t *codec_settings, switch_memory_pool_t *pool)
uint8_t number_of_channels
uint32_t samples_per_second
switch_status_t
Common return values.
switch_core_codec_fmtp_parse_func_t parse_fmtp
switch_payload_t ianacode
#define switch_event_create(event, id)
Create a new event assuming it will not be custom event and therefore hiding the unused parameters...
uint32_t encoded_bytes_per_packet
switch_frame_t enc_write_frame
#define switch_channel_set_flag(_c, _f)
switch_core_codec_init_func_t init
void switch_core_session_unlock_codec_read(switch_core_session_t *session)
struct switch_codec_implementation * next
switch_core_codec_encode_func_t encode
#define switch_test_flag(obj, flag)
Test for the existance of a flag on an arbitary object.
static switch_bool_t switch_core_codec_ready(switch_codec_t *codec)
void switch_log_printf(_In_ switch_text_channel_t channel, _In_z_ const char *file, _In_z_ const char *func, _In_ int line, _In_opt_z_ const char *userdata, _In_ switch_log_level_t level, _In_z_ _Printf_format_string_ const char *fmt,...) PRINTF_FUNCTION(7
Write log data to the logging engine.
A table of settings and callbacks that define a paticular implementation of a codec.
switch_status_t switch_core_session_set_real_read_codec(switch_core_session_t *session, switch_codec_t *codec)
struct fspr_pool_t switch_memory_pool_t
switch_codec_t * real_write_codec
switch_core_codec_video_encode_func_t encode_video
switch_codec_t * switch_core_session_get_read_codec(switch_core_session_t *session)
switch_status_t switch_core_session_get_video_read_impl(switch_core_session_t *session, switch_codec_implementation_t *impp)
#define switch_channel_set_variable(_channel, _var, _val)
switch_frame_t raw_write_frame
char * switch_channel_get_name(switch_channel_t *channel)
Retrieve the name of a given channel.
void switch_core_session_unset_read_codec(switch_core_session_t *session)
switch_status_t switch_core_session_set_write_impl(switch_core_session_t *session, const switch_codec_implementation_t *impp)
void switch_core_session_unlock_codec_write(switch_core_session_t *session)
switch_codec_t * switch_core_session_get_video_write_codec(switch_core_session_t *session)
switch_core_codec_control_func_t codec_control
switch_status_t switch_core_codec_control(switch_codec_t *codec, switch_codec_control_command_t cmd, switch_codec_control_type_t ctype, void *cmd_data, switch_codec_control_type_t atype, void *cmd_arg, switch_codec_control_type_t *rtype, void **ret_data)
send control data using a codec handle
switch_codec_t * switch_core_session_get_write_codec(switch_core_session_t *session)