mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-07-23 12:42:02 +00:00
standardize to some more specific int types for frame size and rate variables.
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@1095 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
+27
-24
@@ -30,9 +30,9 @@
|
||||
*
|
||||
*/
|
||||
/*! \file switch_core.h
|
||||
\brief Core Library
|
||||
\brief Core Library
|
||||
|
||||
This module is the main core library and is the intended location of all fundamental operations.
|
||||
This module is the main core library and is the intended location of all fundamental operations.
|
||||
*/
|
||||
|
||||
#ifndef SWITCH_CORE_H
|
||||
@@ -41,6 +41,9 @@
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#ifdef _FORMATBUG
|
||||
}
|
||||
#endif
|
||||
|
||||
#include <switch.h>
|
||||
|
||||
@@ -306,7 +309,7 @@ SWITCH_DECLARE(switch_status) switch_core_session_set_private(switch_core_sessio
|
||||
\param session the session to add the stream to
|
||||
\param private_info 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_info);
|
||||
|
||||
/*!
|
||||
@@ -314,14 +317,14 @@ SWITCH_DECLARE(int) switch_core_session_add_stream(switch_core_session *session,
|
||||
\param session the session to add the stream to
|
||||
\param index the index to retrieve
|
||||
\return the stream
|
||||
*/
|
||||
*/
|
||||
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);
|
||||
|
||||
/*!
|
||||
@@ -607,7 +610,7 @@ SWITCH_DECLARE(switch_status) switch_core_timer_destroy(switch_timer *timer);
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status) switch_core_codec_init(switch_codec *codec,
|
||||
char *codec_name,
|
||||
int rate,
|
||||
uint32_t rate,
|
||||
int ms,
|
||||
int channels,
|
||||
uint32_t flags,
|
||||
@@ -629,14 +632,14 @@ SWITCH_DECLARE(switch_status) switch_core_codec_init(switch_codec *codec,
|
||||
\note encoded_data_len will be rewritten to the in-use size of encoded_data
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status) switch_core_codec_encode(switch_codec *codec,
|
||||
switch_codec *other_codec,
|
||||
void *decoded_data,
|
||||
switch_size_t decoded_data_len,
|
||||
int decoded_rate,
|
||||
void *encoded_data,
|
||||
switch_size_t *encoded_data_len,
|
||||
int *encoded_rate,
|
||||
unsigned int *flag);
|
||||
switch_codec *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);
|
||||
|
||||
/*!
|
||||
\brief Decode data using a codec handle
|
||||
@@ -653,14 +656,14 @@ SWITCH_DECLARE(switch_status) switch_core_codec_encode(switch_codec *codec,
|
||||
\note decoded_data_len will be rewritten to the in-use size of decoded_data
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status) switch_core_codec_decode(switch_codec *codec,
|
||||
switch_codec *other_codec,
|
||||
void *encoded_data,
|
||||
switch_size_t encoded_data_len,
|
||||
int encoded_rate,
|
||||
void *decoded_data,
|
||||
switch_size_t *decoded_data_len,
|
||||
int *decoded_rate,
|
||||
unsigned int *flag);
|
||||
switch_codec *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);
|
||||
|
||||
/*!
|
||||
\brief Destroy an initalized codec handle
|
||||
@@ -827,10 +830,10 @@ SWITCH_DECLARE(switch_status) switch_core_speech_feed_tts(switch_speech_handle *
|
||||
\param flags flags in/out for fine tuning
|
||||
\return SWITCH_STATUS_SUCCESS with len adjusted to the bytes written if successful
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status) switch_core_speech_read_tts(switch_speech_handle *sh,
|
||||
SWITCH_DECLARE(switch_status) switch_core_speech_read_tts(switch_speech_handle *sh,
|
||||
void *data,
|
||||
switch_size_t *datalen,
|
||||
switch_size_t *rate,
|
||||
uint32_t *rate,
|
||||
switch_speech_flag *flags);
|
||||
/*!
|
||||
\brief Close an open speech handle
|
||||
|
||||
@@ -49,13 +49,13 @@ struct switch_frame {
|
||||
/*! the frame data */
|
||||
void *data;
|
||||
/*! the size of the buffer that is in use */
|
||||
switch_size_t datalen;
|
||||
uint32_t datalen;
|
||||
/*! the entire size of the buffer */
|
||||
switch_size_t buflen;
|
||||
uint32_t buflen;
|
||||
/*! the number of audio samples present (audio only) */
|
||||
switch_size_t samples;
|
||||
uint32_t samples;
|
||||
/*! the rate of the frame */
|
||||
int rate;
|
||||
uint32_t rate;
|
||||
/*! frame flags */
|
||||
switch_frame_flag flags;
|
||||
};
|
||||
|
||||
@@ -144,7 +144,7 @@ SWITCH_DECLARE(switch_status) switch_ivr_speak_text(switch_core_session *session
|
||||
char *tts_name,
|
||||
char *voice_name,
|
||||
char *timer_name,
|
||||
switch_size_t rate,
|
||||
uint32_t rate,
|
||||
switch_dtmf_callback_function dtmf_callback,
|
||||
char *text,
|
||||
void *buf,
|
||||
|
||||
@@ -262,9 +262,9 @@ struct switch_file_handle {
|
||||
/*! samples position of the handle */
|
||||
unsigned int samples;
|
||||
/*! the current samplerate */
|
||||
unsigned int samplerate;
|
||||
uint32_t samplerate;
|
||||
/*! the number of channels */
|
||||
unsigned int channels;
|
||||
uint8_t channels;
|
||||
/*! integer representation of the format */
|
||||
unsigned int format;
|
||||
/*! integer representation of the sections */
|
||||
@@ -305,7 +305,7 @@ struct switch_speech_interface {
|
||||
switch_status (*speech_read_tts)(switch_speech_handle *sh,
|
||||
void *data,
|
||||
switch_size_t *datalen,
|
||||
switch_size_t *rate,
|
||||
uint32_t *rate,
|
||||
switch_speech_flag *flags);
|
||||
|
||||
const struct switch_speech_interface *next;
|
||||
@@ -415,19 +415,19 @@ struct switch_codec {
|
||||
/*! \brief A table of settings and callbacks that define a paticular implementation of a codec */
|
||||
struct switch_codec_implementation {
|
||||
/*! samples transferred per second */
|
||||
int samples_per_second;
|
||||
uint32_t samples_per_second;
|
||||
/*! bits transferred per second */
|
||||
int bits_per_second;
|
||||
/*! number of microseconds that denote one frame */
|
||||
int microseconds_per_frame;
|
||||
/*! number of samples that denote one frame */
|
||||
int samples_per_frame;
|
||||
uint32_t samples_per_frame;
|
||||
/*! number of bytes that denote one frame decompressed */
|
||||
switch_size_t bytes_per_frame;
|
||||
uint32_t bytes_per_frame;
|
||||
/*! number of bytes that denote one frame compressed */
|
||||
int encoded_bytes_per_frame;
|
||||
uint32_t encoded_bytes_per_frame;
|
||||
/*! number of channels represented */
|
||||
int number_of_channels;
|
||||
uint8_t number_of_channels;
|
||||
/*! number of frames to send in one netowrk packet */
|
||||
int pref_frames_per_packet;
|
||||
/*! max number of frames to send in one network packet */
|
||||
@@ -438,21 +438,21 @@ struct switch_codec_implementation {
|
||||
switch_status (*encode)(switch_codec *codec,
|
||||
switch_codec *other_codec,
|
||||
void *decoded_data,
|
||||
switch_size_t decoded_data_len,
|
||||
int decoded_rate,
|
||||
uint32_t decoded_data_len,
|
||||
uint32_t decoded_rate,
|
||||
void *encoded_data,
|
||||
switch_size_t *encoded_data_len,
|
||||
int *encoded_rate,
|
||||
uint32_t *encoded_data_len,
|
||||
uint32_t *encoded_rate,
|
||||
unsigned int *flag);
|
||||
/*! function to decode encoded data into raw data */
|
||||
switch_status (*decode)(switch_codec *codec,
|
||||
switch_codec *other_codec,
|
||||
void *encoded_data,
|
||||
switch_size_t encoded_data_len,
|
||||
int encoded_rate,
|
||||
uint32_t encoded_data_len,
|
||||
uint32_t encoded_rate,
|
||||
void *decoded_data,
|
||||
switch_size_t *decoded_data_len,
|
||||
int *decoded_rate,
|
||||
uint32_t *decoded_data_len,
|
||||
uint32_t *decoded_rate,
|
||||
unsigned int *flag);
|
||||
/*! deinitalize a codec handle using this implementation */
|
||||
switch_status (*destroy)(switch_codec *);
|
||||
@@ -466,7 +466,7 @@ struct switch_codec_interface {
|
||||
/*! enumeration defining the type of the codec */
|
||||
const switch_codec_type codec_type;
|
||||
/*! the IANA code number */
|
||||
unsigned int ianacode;
|
||||
uint8_t ianacode;
|
||||
/*! the IANA code name */
|
||||
char *iananame;
|
||||
/*! a list of codec implementations related to the codec */
|
||||
|
||||
@@ -67,9 +67,9 @@ struct switch_audio_resampler {
|
||||
/*! a pointer to store a float buffer for resampled data */
|
||||
float *to;
|
||||
/*! the size of the to buffer used */
|
||||
int to_len;
|
||||
uint32_t to_len;
|
||||
/*! the total size of the to buffer */
|
||||
switch_size_t to_size;
|
||||
uint32_t to_size;
|
||||
};
|
||||
|
||||
/*!
|
||||
@@ -86,7 +86,7 @@ SWITCH_DECLARE(switch_status) switch_resample_create(switch_audio_resampler **ne
|
||||
int from_rate,
|
||||
switch_size_t from_size,
|
||||
int to_rate,
|
||||
switch_size_t to_size,
|
||||
uint32_t to_size,
|
||||
switch_memory_pool *pool);
|
||||
|
||||
/*!
|
||||
@@ -105,7 +105,7 @@ SWITCH_DECLARE(void) switch_resample_destroy(switch_audio_resampler *resampler);
|
||||
\param last parameter denoting the last sample is being resampled
|
||||
\return the used size of dst
|
||||
*/
|
||||
SWITCH_DECLARE(int) switch_resample_process(switch_audio_resampler *resampler, float *src, int srclen, float *dst, int dstlen, int last);
|
||||
SWITCH_DECLARE(uint32_t) switch_resample_process(switch_audio_resampler *resampler, float *src, int srclen, float *dst, uint32_t dstlen, int last);
|
||||
|
||||
/*!
|
||||
\brief Convert an array of floats to an array of shorts
|
||||
|
||||
@@ -81,8 +81,8 @@ SWITCH_DECLARE(switch_port_t) switch_rtp_request_port(void);
|
||||
\return the new RTP session or NULL on failure
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status)switch_rtp_create(switch_rtp **new_rtp_session,
|
||||
int payload,
|
||||
switch_size_t packet_size,
|
||||
uint8_t payload,
|
||||
uint32_t packet_size,
|
||||
uint32_t ms_per_packet,
|
||||
switch_rtp_flag_t flags,
|
||||
const char **err,
|
||||
@@ -107,8 +107,8 @@ SWITCH_DECLARE(switch_rtp *)switch_rtp_new(char *rx_host,
|
||||
switch_port_t rx_port,
|
||||
char *tx_host,
|
||||
switch_port_t tx_port,
|
||||
int payload,
|
||||
switch_size_t packet_size,
|
||||
uint8_t payload,
|
||||
uint32_t packet_size,
|
||||
uint32_t ms_per_packet,
|
||||
switch_rtp_flag_t flags,
|
||||
const char **err,
|
||||
@@ -164,7 +164,7 @@ SWITCH_DECLARE(switch_socket_t *)switch_rtp_get_rtp_socket(switch_rtp *rtp_sessi
|
||||
\param rtp_session the RTP session to set the packet size on
|
||||
\param packet_size the new default packet size
|
||||
*/
|
||||
SWITCH_DECLARE(void) switch_rtp_set_default_packet_size(switch_rtp *rtp_session, uint32_t packet_size);
|
||||
SWITCH_DECLARE(void) switch_rtp_set_default_packet_size(switch_rtp *rtp_session, uint16_t packet_size);
|
||||
|
||||
/*!
|
||||
\brief Get the default packet size for a given RTP session
|
||||
@@ -178,7 +178,7 @@ SWITCH_DECLARE(uint32_t) switch_rtp_get_default_packet_size(switch_rtp *rtp_sess
|
||||
\param rtp_session the RTP session to set the payload number on
|
||||
\param payload the new default payload number
|
||||
*/
|
||||
SWITCH_DECLARE(void) switch_rtp_set_default_payload(switch_rtp *rtp_session, uint32_t payload);
|
||||
SWITCH_DECLARE(void) switch_rtp_set_default_payload(switch_rtp *rtp_session, uint8_t payload);
|
||||
|
||||
/*!
|
||||
\brief Get the default payload number for a given RTP session
|
||||
@@ -225,7 +225,7 @@ SWITCH_DECLARE(int) switch_rtp_zerocopy_read(switch_rtp *rtp_session, void **dat
|
||||
\param ts then number of bytes to increment the timestamp by
|
||||
\return the number of bytes written
|
||||
*/
|
||||
SWITCH_DECLARE(int) switch_rtp_write(switch_rtp *rtp_session, void *data, int datalen, uint32_t ts);
|
||||
SWITCH_DECLARE(int) switch_rtp_write(switch_rtp *rtp_session, void *data, uint32_t datalen, uint32_t ts);
|
||||
|
||||
/*!
|
||||
\brief Write data with a specified payload and sequence number to a given RTP session
|
||||
@@ -237,7 +237,7 @@ SWITCH_DECLARE(int) switch_rtp_write(switch_rtp *rtp_session, void *data, int da
|
||||
\param mseq the specific sequence number to use
|
||||
\return the number of bytes written
|
||||
*/
|
||||
SWITCH_DECLARE(int) switch_rtp_write_payload(switch_rtp *rtp_session, void *data, int datalen, uint8_t payload, uint32_t ts, uint16_t mseq);
|
||||
SWITCH_DECLARE(int) switch_rtp_write_payload(switch_rtp *rtp_session, void *data, uint16_t datalen, uint8_t payload, uint32_t ts, uint16_t mseq);
|
||||
|
||||
/*!
|
||||
\brief Retrieve the SSRC from a given RTP session
|
||||
|
||||
@@ -460,7 +460,6 @@ typedef enum {
|
||||
SWITCH_EVENT_ALL
|
||||
} switch_event_t;
|
||||
|
||||
|
||||
typedef struct switch_rtp switch_rtp;
|
||||
typedef struct switch_core_session_message switch_core_session_message;
|
||||
typedef struct switch_audio_resampler switch_audio_resampler;
|
||||
|
||||
Reference in New Issue
Block a user