Frame and codec manipulation routines. More...
#include "asterisk.h"
#include "asterisk/_private.h"
#include "asterisk/lock.h"
#include "asterisk/frame.h"
#include "asterisk/channel.h"
#include "asterisk/cli.h"
#include "asterisk/term.h"
#include "asterisk/utils.h"
#include "asterisk/threadstorage.h"
#include "asterisk/linkedlists.h"
#include "asterisk/translate.h"
#include "asterisk/dsp.h"
#include "asterisk/file.h"
Go to the source code of this file.
Data Structures | |
struct | ast_codec_alias_table |
struct | ast_frame_cache |
struct | ast_frames |
This is just so ast_frames, a list head struct for holding a list of ast_frame structures, is defined. More... | |
struct | ast_smoother |
Macros | |
#define | FRAME_CACHE_MAX_SIZE 10 |
Maximum ast_frame cache size. More... | |
#define | SMOOTHER_SIZE 8000 |
#define | TYPE_MASK 0x3 |
Enumerations | |
enum | frame_type { TYPE_HIGH, TYPE_LOW, TYPE_SILENCE, TYPE_DONTSEND } |
Functions | |
int | __ast_smoother_feed (struct ast_smoother *s, struct ast_frame *f, int swap) |
static void | __frame_free (struct ast_frame *fr, int cache) |
static void | __init_frame_cache (void) |
A per-thread cache of frame headers. More... | |
char * | ast_codec2str (format_t codec) |
Get a name from a format Gets a name from a format. More... | |
format_t | ast_codec_choose (struct ast_codec_pref *pref, format_t formats, int find_best) |
Pick a codec. More... | |
int | ast_codec_get_len (format_t format, int samples) |
Returns the number of bytes for the number of samples of the given format. More... | |
int | ast_codec_get_samples (struct ast_frame *f) |
Returns the number of samples contained in the frame. More... | |
int | ast_codec_pref_append (struct ast_codec_pref *pref, format_t format) |
Append codec to list. More... | |
void | ast_codec_pref_convert (struct ast_codec_pref *pref, char *buf, size_t size, int right) |
Shift an audio codec preference list up or down 65 bytes so that it becomes an ASCII string. More... | |
struct ast_format_list | ast_codec_pref_getsize (struct ast_codec_pref *pref, format_t format) |
Get packet size for codec. More... | |
format_t | ast_codec_pref_index (struct ast_codec_pref *pref, int idx) |
Codec located at a particular place in the preference index. More... | |
void | ast_codec_pref_prepend (struct ast_codec_pref *pref, format_t format, int only_if_existing) |
Prepend codec to list. More... | |
void | ast_codec_pref_remove (struct ast_codec_pref *pref, format_t format) |
Remove codec from pref list. More... | |
int | ast_codec_pref_setsize (struct ast_codec_pref *pref, format_t format, int framems) |
Set packet size for codec. More... | |
int | ast_codec_pref_string (struct ast_codec_pref *pref, char *buf, size_t size) |
Dump audio codec preference list into a string. More... | |
static const char * | ast_expand_codec_alias (const char *in) |
int | ast_frame_adjust_volume (struct ast_frame *f, int adjustment) |
Adjusts the volume of the audio samples contained in a frame. More... | |
int | ast_frame_clear (struct ast_frame *frame) |
Clear all audio samples from an ast_frame. The frame must be AST_FRAME_VOICE and AST_FORMAT_SLINEAR. More... | |
void | ast_frame_dump (const char *name, struct ast_frame *f, char *prefix) |
void | ast_frame_free (struct ast_frame *frame, int cache) |
Requests a frame to be allocated. More... | |
static struct ast_frame * | ast_frame_header_new (void) |
int | ast_frame_slinear_sum (struct ast_frame *f1, struct ast_frame *f2) |
Sums two frames of audio samples. More... | |
struct ast_frame * | ast_frdup (const struct ast_frame *f) |
Copies a frame. More... | |
struct ast_frame * | ast_frisolate (struct ast_frame *fr) |
'isolates' a frame by duplicating non-malloc'ed components (header, src, data). On return all components are malloc'ed More... | |
struct ast_format_list * | ast_get_format_list (size_t *size) |
struct ast_format_list * | ast_get_format_list_index (int idx) |
format_t | ast_getformatbyname (const char *name) |
Gets a format from a name. More... | |
char * | ast_getformatname (format_t format) |
Get the name of a format. More... | |
char * | ast_getformatname_multiple (char *buf, size_t size, format_t format) |
Get the names of a set of formats. More... | |
int | ast_parse_allow_disallow (struct ast_codec_pref *pref, format_t *mask, const char *list, int allowing) |
Parse an "allow" or "deny" line in a channel or device configuration and update the capabilities mask and pref if provided. Video codecs are not added to codec preference lists, since we can not transcode. More... | |
void | ast_smoother_free (struct ast_smoother *s) |
int | ast_smoother_get_flags (struct ast_smoother *s) |
struct ast_smoother * | ast_smoother_new (int size) |
struct ast_frame * | ast_smoother_read (struct ast_smoother *s) |
void | ast_smoother_reconfigure (struct ast_smoother *s, int bytes) |
Reconfigure an existing smoother to output a different number of bytes per frame. More... | |
void | ast_smoother_reset (struct ast_smoother *s, int bytes) |
void | ast_smoother_set_flags (struct ast_smoother *s, int flags) |
int | ast_smoother_test_flag (struct ast_smoother *s, int flag) |
void | ast_swapcopy_samples (void *dst, const void *src, int samples) |
static void | frame_cache_cleanup (void *data) |
static void | framer_shutdown (void) |
static int | g723_len (unsigned char buf) |
static int | g723_samples (unsigned char *buf, int maxlen) |
static unsigned char | get_n_bits_at (unsigned char *data, int n, int bit) |
int | init_framer (void) |
static char * | show_codec_n (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | show_codecs (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static int | smoother_frame_feed (struct ast_smoother *s, struct ast_frame *f, int swap) |
static int | speex_get_wb_sz_at (unsigned char *data, int len, int bit) |
static int | speex_samples (unsigned char *data, int len) |
Variables | |
static struct ast_codec_alias_table | ast_codec_alias_table [] |
static struct ast_format_list | AST_FORMAT_LIST [] |
Definition of supported media formats (codecs) More... | |
struct ast_frame | ast_null_frame = { AST_FRAME_NULL, } |
static struct ast_threadstorage | frame_cache = { .once = PTHREAD_ONCE_INIT , .key_init = __init_frame_cache , .custom_init = NULL , } |
static struct ast_cli_entry | my_clis [] |
Frame and codec manipulation routines.
Definition in file frame.c.
#define FRAME_CACHE_MAX_SIZE 10 |
Maximum ast_frame cache size.
In most cases where the frame header cache will be useful, the size of the cache will stay very small. However, it is not always the case that the same thread that allocates the frame will be the one freeing them, so sometimes a thread will never have any frames in its cache, or the cache will never be pulled from. For the latter case, we limit the maximum size.
Definition at line 62 of file frame.c.
Referenced by __frame_free().
#define SMOOTHER_SIZE 8000 |
Definition at line 74 of file frame.c.
Referenced by __ast_smoother_feed().
#define TYPE_MASK 0x3 |
Definition at line 83 of file frame.c.
Referenced by g723_len().
enum frame_type |
Enumerator | |
---|---|
TYPE_HIGH | |
TYPE_LOW | |
TYPE_SILENCE | |
TYPE_DONTSEND |
int __ast_smoother_feed | ( | struct ast_smoother * | s, |
struct ast_frame * | f, | ||
int | swap | ||
) |
Definition at line 208 of file frame.c.
References AST_FRAME_VOICE, ast_getformatname(), ast_log(), AST_MIN_OFFSET, AST_SMOOTHER_FLAG_G729, ast_swapcopy_samples(), ast_frame_subclass::codec, ast_frame::data, ast_frame::datalen, f, ast_smoother::flags, ast_smoother::format, ast_frame::frametype, ast_smoother::len, LOG_WARNING, ast_frame::offset, ast_smoother::opt, ast_smoother::opt_needs_swap, ast_frame::ptr, ast_frame::samples, ast_smoother::samplesperbyte, ast_smoother::size, smoother_frame_feed(), SMOOTHER_SIZE, and ast_frame::subclass.
|
static |
Definition at line 341 of file frame.c.
References ast_free, AST_LIST_INSERT_HEAD, AST_MALLOCD_DATA, AST_MALLOCD_HDR, AST_MALLOCD_SRC, ast_threadstorage_get(), ast_frame::data, frame_cache, FRAME_CACHE_MAX_SIZE, frames, ast_frame_cache::list, ast_frame::mallocd, ast_frame::offset, ast_frame::ptr, ast_frame_cache::size, and ast_frame::src.
Referenced by ast_frame_free().
|
static |
char* ast_codec2str | ( | format_t | codec | ) |
Get a name from a format Gets a name from a format.
codec | codec number (1,2,4,8,16,etc.) |
Definition at line 660 of file frame.c.
References ARRAY_LEN, and ast_format_list::desc.
Referenced by moh_alloc(), show_codec_n(), and show_codecs().
format_t ast_codec_choose | ( | struct ast_codec_pref * | pref, |
format_t | formats, | ||
int | find_best | ||
) |
Pick a codec.
Select the best audio format according to preference list from supplied options. If "find_best" is non-zero then if nothing is found, the "Best" format of the format list is selected, otherwise 0 is returned.
Definition at line 1249 of file frame.c.
References ARRAY_LEN, ast_best_codec(), ast_debug, AST_FORMAT_AUDIO_MASK, ast_format_list::bits, and ast_codec_pref::order.
Referenced by __oh323_new(), gtalk_new(), jingle_new(), process_sdp(), sip_new(), and socket_process().
int ast_codec_get_len | ( | format_t | format, |
int | samples | ||
) |
Returns the number of bytes for the number of samples of the given format.
Definition at line 1532 of file frame.c.
References AST_FORMAT_ADPCM, AST_FORMAT_ALAW, AST_FORMAT_G719, AST_FORMAT_G722, AST_FORMAT_G723_1, AST_FORMAT_G726, AST_FORMAT_G726_AAL2, AST_FORMAT_G729A, AST_FORMAT_GSM, AST_FORMAT_ILBC, AST_FORMAT_SIREN14, AST_FORMAT_SIREN7, AST_FORMAT_SLINEAR, AST_FORMAT_SLINEAR16, AST_FORMAT_TESTLAW, AST_FORMAT_ULAW, ast_getformatname(), ast_log(), len(), and LOG_WARNING.
Referenced by moh_generate(), and monmp3thread().
int ast_codec_get_samples | ( | struct ast_frame * | f | ) |
Returns the number of samples contained in the frame.
Definition at line 1470 of file frame.c.
References AST_FORMAT_ADPCM, AST_FORMAT_ALAW, AST_FORMAT_G719, AST_FORMAT_G722, AST_FORMAT_G723_1, AST_FORMAT_G726, AST_FORMAT_G726_AAL2, AST_FORMAT_G729A, AST_FORMAT_GSM, AST_FORMAT_ILBC, AST_FORMAT_LPC10, AST_FORMAT_SIREN14, AST_FORMAT_SIREN7, AST_FORMAT_SLINEAR, AST_FORMAT_SLINEAR16, AST_FORMAT_SPEEX, AST_FORMAT_SPEEX16, AST_FORMAT_TESTLAW, AST_FORMAT_ULAW, ast_getformatname_multiple(), ast_log(), ast_frame_subclass::codec, ast_frame::data, ast_frame::datalen, g723_samples(), LOG_WARNING, ast_frame::ptr, speex_samples(), and ast_frame::subclass.
Referenced by ast_rtp_read(), dahdi_encoder_frameout(), isAnsweringMachine(), moh_generate(), schedule_delivery(), socket_process(), and socket_process_meta().
int ast_codec_pref_append | ( | struct ast_codec_pref * | pref, |
format_t | format | ||
) |
Append codec to list.
Append a audio codec to a preference list, removing it first if it was already there.
Definition at line 1099 of file frame.c.
References ARRAY_LEN, ast_codec_pref_remove(), and ast_codec_pref::order.
Referenced by ast_parse_allow_disallow().
void ast_codec_pref_convert | ( | struct ast_codec_pref * | pref, |
char * | buf, | ||
size_t | size, | ||
int | right | ||
) |
Shift an audio codec preference list up or down 65 bytes so that it becomes an ASCII string.
pref | A codec preference list structure |
buf | A string denoting codec preference, appropriate for use in line transmission |
size | Size of buf |
right | Boolean: if 0, convert from buf to pref; if 1, convert from pref to buf. |
Definition at line 1002 of file frame.c.
References ast_codec_pref::order.
Referenced by check_access(), create_addr(), dump_prefs(), and socket_process().
struct ast_format_list ast_codec_pref_getsize | ( | struct ast_codec_pref * | pref, |
format_t | format | ||
) |
Get packet size for codec.
Definition at line 1205 of file frame.c.
References ARRAY_LEN, ast_getformatname(), ast_log(), AST_LOG_WARNING, ast_format_list::bits, ast_format_list::cur_ms, ast_format_list::def_ms, format, ast_format_list::inc_ms, ast_format_list::max_ms, and ast_format_list::min_ms.
Referenced by add_codec_to_sdp(), ast_rtp_instance_bridge(), ast_rtp_write(), handle_open_receive_channel_ack_message(), skinny_set_rtp_peer(), and transmit_connect().
format_t ast_codec_pref_index | ( | struct ast_codec_pref * | pref, |
int | index | ||
) |
Codec located at a particular place in the preference index.
Definition at line 1061 of file frame.c.
References ast_format_list::bits, and ast_codec_pref::order.
Referenced by _sip_show_peer(), _skinny_show_line(), add_sdp(), ast_codec_pref_string(), function_iaxpeer(), function_sippeer(), gtalk_invite(), handle_cli_iax2_show_peer(), jingle_accept_call(), print_codec_to_cli(), and socket_process().
void ast_codec_pref_prepend | ( | struct ast_codec_pref * | pref, |
format_t | format, | ||
int | only_if_existing | ||
) |
Prepend codec to list.
Prepend an audio codec to a preference list, removing it first if it was already there.
Definition at line 1125 of file frame.c.
References ARRAY_LEN, ast_codec_pref::framing, and ast_codec_pref::order.
Referenced by create_addr().
void ast_codec_pref_remove | ( | struct ast_codec_pref * | pref, |
format_t | format | ||
) |
Remove codec from pref list.
Remove audio a codec from a preference list.
Definition at line 1073 of file frame.c.
References ARRAY_LEN, ast_codec_pref::framing, and ast_codec_pref::order.
Referenced by ast_codec_pref_append(), and ast_parse_allow_disallow().
int ast_codec_pref_setsize | ( | struct ast_codec_pref * | pref, |
format_t | format, | ||
int | framems | ||
) |
Set packet size for codec.
Definition at line 1167 of file frame.c.
References ARRAY_LEN, ast_format_list::def_ms, ast_codec_pref::framing, ast_format_list::inc_ms, ast_format_list::max_ms, ast_format_list::min_ms, and ast_codec_pref::order.
Referenced by ast_parse_allow_disallow(), and process_sdp_a_audio().
int ast_codec_pref_string | ( | struct ast_codec_pref * | pref, |
char * | buf, | ||
size_t | size | ||
) |
Dump audio codec preference list into a string.
Definition at line 1025 of file frame.c.
References ast_codec_pref_index(), and ast_getformatname().
Referenced by dump_prefs(), and socket_process().
|
static |
Definition at line 630 of file frame.c.
References ARRAY_LEN.
Referenced by ast_getformatbyname().
int ast_frame_adjust_volume | ( | struct ast_frame * | f, |
int | adjustment | ||
) |
Adjusts the volume of the audio samples contained in a frame.
f | The frame containing the samples (must be AST_FRAME_VOICE and AST_FORMAT_SLINEAR) |
adjustment | The number of dB to adjust up or down. |
Definition at line 1584 of file frame.c.
References AST_FORMAT_SLINEAR, AST_FRAME_VOICE, ast_slinear_saturated_divide(), ast_slinear_saturated_multiply(), ast_frame_subclass::codec, ast_frame::data, ast_frame::frametype, ast_frame::ptr, ast_frame::samples, and ast_frame::subclass.
Referenced by audiohook_read_frame_single(), audiohook_volume_callback(), conf_run(), and volume_callback().
int ast_frame_clear | ( | struct ast_frame * | frame | ) |
Clear all audio samples from an ast_frame. The frame must be AST_FRAME_VOICE and AST_FORMAT_SLINEAR.
Definition at line 1629 of file frame.c.
References AST_LIST_NEXT, ast_frame::data, ast_frame::datalen, ast_frame::next, and ast_frame::ptr.
Referenced by ast_audiohook_write_frame(), and mute_callback().
void ast_frame_dump | ( | const char * | name, |
struct ast_frame * | f, | ||
char * | prefix | ||
) |
Dump a frame for debugging purposes
Definition at line 778 of file frame.c.
References AST_CONTROL_ANSWER, AST_CONTROL_BUSY, AST_CONTROL_CONGESTION, AST_CONTROL_FLASH, AST_CONTROL_HANGUP, AST_CONTROL_HOLD, AST_CONTROL_OFFHOOK, AST_CONTROL_OPTION, AST_CONTROL_RADIO_KEY, AST_CONTROL_RADIO_UNKEY, AST_CONTROL_RING, AST_CONTROL_RINGING, AST_CONTROL_T38_PARAMETERS, AST_CONTROL_TAKEOFFHOOK, AST_CONTROL_UNHOLD, AST_CONTROL_WINK, ast_copy_string(), AST_FRAME_CONTROL, AST_FRAME_DTMF_BEGIN, AST_FRAME_DTMF_END, AST_FRAME_HTML, AST_FRAME_IAX, AST_FRAME_IMAGE, AST_FRAME_MODEM, AST_FRAME_NULL, AST_FRAME_TEXT, AST_FRAME_VIDEO, AST_FRAME_VOICE, ast_getformatname(), AST_HTML_BEGIN, AST_HTML_DATA, AST_HTML_END, AST_HTML_LDCOMPLETE, AST_HTML_LINKREJECT, AST_HTML_LINKURL, AST_HTML_NOSUPPORT, AST_HTML_UNLINK, AST_HTML_URL, AST_MODEM_T38, AST_MODEM_V150, ast_strlen_zero(), AST_T38_NEGOTIATED, AST_T38_REFUSED, AST_T38_REQUEST_NEGOTIATE, AST_T38_REQUEST_TERMINATE, AST_T38_TERMINATED, ast_verbose(), ast_frame_subclass::codec, COLOR_BLACK, COLOR_BRCYAN, COLOR_BRGREEN, COLOR_BRMAGENTA, COLOR_BRRED, COLOR_YELLOW, ast_frame::data, ast_frame::datalen, ast_frame::frametype, ast_frame_subclass::integer, ast_frame::ptr, ast_control_t38_parameters::request_response, ast_frame::subclass, and term_color().
Referenced by __ast_read(), and ast_write().
void ast_frame_free | ( | struct ast_frame * | fr, |
int | cache | ||
) |
Requests a frame to be allocated.
source | Request a frame be allocated. source is an optional source of the frame, len is the requested length, or "0" if the caller will supply the buffer |
Frees a frame or list of frames
fr | Frame to free, or head of list to free |
cache | Whether to consider this frame for frame caching |
Definition at line 375 of file frame.c.
References __frame_free(), AST_LIST_NEXT, and ast_frame::next.
Referenced by mixmonitor_thread().
|
static |
Definition at line 299 of file frame.c.
References ast_calloc, ast_calloc_cache, AST_LIST_REMOVE_HEAD, AST_MALLOCD_HDR, ast_threadstorage_get(), f, frame_cache, frames, ast_frame_cache::list, ast_frame::mallocd, ast_frame::mallocd_hdr_len, and ast_frame_cache::size.
Referenced by ast_frisolate().
Sums two frames of audio samples.
f1 | The first frame (which will contain the result) |
f2 | The second frame |
The frames must be AST_FRAME_VOICE and must contain AST_FORMAT_SLINEAR samples, and must contain the same number of samples.
Definition at line 1607 of file frame.c.
References AST_FORMAT_SLINEAR, AST_FRAME_VOICE, ast_slinear_saturated_add(), ast_frame_subclass::codec, ast_frame::data, ast_frame::frametype, ast_frame::ptr, ast_frame::samples, and ast_frame::subclass.
Copies a frame.
fr | frame to copy Duplicates a frame – should only rarely be used, typically frisolate is good enough |
Definition at line 474 of file frame.c.
References ast_calloc_cache, ast_copy_flags, AST_FRFLAG_HAS_TIMING_INFO, AST_FRIENDLY_OFFSET, AST_LIST_REMOVE_CURRENT, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, AST_MALLOCD_HDR, ast_threadstorage_get(), ast_frame_subclass::codec, ast_frame::data, ast_frame::datalen, ast_frame::delivery, frame_cache, frames, ast_frame::frametype, ast_frame::len, len(), ast_frame_cache::list, ast_frame::mallocd, ast_frame::mallocd_hdr_len, ast_frame::offset, ast_frame::ptr, ast_frame::samples, ast_frame::seqno, ast_frame_cache::size, ast_frame::src, ast_frame::subclass, ast_frame::ts, and ast_frame::uint32.
Referenced by __ast_queue_frame(), ast_frisolate(), ast_indicate_data(), ast_jb_put(), ast_rtp_write(), ast_slinfactory_feed(), audiohook_read_frame_both(), audiohook_read_frame_single(), autoservice_run(), multicast_rtp_write(), process_dtmf_rfc2833(), and recordthread().
'isolates' a frame by duplicating non-malloc'ed components (header, src, data). On return all components are malloc'ed
Makes a frame independent of any static storage.
Definition at line 391 of file frame.c.
References ast_copy_flags, ast_frame_header_new(), ast_frdup(), ast_free, AST_FRFLAG_HAS_TIMING_INFO, AST_FRIENDLY_OFFSET, ast_malloc, AST_MALLOCD_DATA, AST_MALLOCD_HDR, AST_MALLOCD_SRC, ast_strdup, ast_test_flag, ast_frame_subclass::codec, ast_frame::data, ast_frame::datalen, ast_frame::frametype, ast_frame::len, ast_frame::mallocd, ast_frame::offset, ast_frame::ptr, ast_frame::samples, ast_frame::seqno, ast_frame::src, ast_frame::subclass, ast_frame::ts, and ast_frame::uint32.
Referenced by __ast_answer(), ast_dsp_process(), ast_rtp_read(), ast_safe_sleep_conditional(), ast_slinfactory_feed(), ast_trans_frameout(), ast_write(), autoservice_run(), dahdi_decoder_frameout(), dahdi_encoder_frameout(), feature_request_and_dial(), jpeg_read_image(), read_frame(), spandsp_fax_read(), and t38_tx_packet_handler().
struct ast_format_list* ast_get_format_list | ( | size_t * | size | ) |
Definition at line 572 of file frame.c.
References ARRAY_LEN, and AST_FORMAT_LIST.
Referenced by ast_data_add_codecs(), complete_trans_path_choice(), and handle_cli_core_show_translation().
struct ast_format_list* ast_get_format_list_index | ( | int | idx | ) |
Definition at line 567 of file frame.c.
format_t ast_getformatbyname | ( | const char * | name | ) |
Gets a format from a name.
name | string of format |
Definition at line 641 of file frame.c.
References ARRAY_LEN, ast_expand_codec_alias(), ast_format_list::bits, and format.
Referenced by ast_parse_allow_disallow(), iax_template_parse(), load_moh_classes(), local_ast_moh_start(), reload_config(), and try_suggested_sip_codec().
char* ast_getformatname | ( | format_t | format | ) |
Get the name of a format.
format | id of format |
Definition at line 578 of file frame.c.
References ARRAY_LEN, ast_format_list::bits, and ast_format_list::name.
Referenced by __ast_play_and_record(), __ast_read(), __ast_register_translator(), __ast_smoother_feed(), _sip_show_peer(), _skinny_show_line(), add_codec_to_answer(), add_codec_to_sdp(), add_sdp(), add_tcodec_to_sdp(), add_vcodec_to_sdp(), agent_call(), ast_channel_make_compatible_helper(), ast_codec_get_len(), ast_codec_pref_getsize(), ast_codec_pref_string(), ast_do_masquerade(), ast_dsp_process(), ast_frame_dump(), ast_openvstream(), ast_rtp_instance_bridge(), ast_rtp_write(), ast_slinfactory_feed(), ast_stopstream(), ast_streamfile(), ast_translate_path_to_str(), ast_translator_build_path(), ast_unregister_translator(), ast_write(), ast_writestream(), background_detect_exec(), bridge_channel_join(), bridge_make_compatible(), conf_run(), dahdi_read(), dahdi_write(), do_waiting(), dump_versioned_codec(), eagi_exec(), func_channel_read(), function_iaxpeer(), function_sippeer(), g719write(), g726_write(), g729_write(), gsm_write(), gtalk_rtp_read(), gtalk_show_channels(), gtalk_write(), h263_write(), h264_write(), handle_cli_core_show_file_formats(), handle_cli_core_show_translation(), handle_cli_iax2_show_channels(), handle_cli_iax2_show_peer(), handle_cli_moh_show_classes(), handle_core_show_image_formats(), handle_open_receive_channel_ack_message(), iax2_request(), iax_show_provisioning(), ilbc_write(), isAnsweringMachine(), jack_hook_callback(), jingle_rtp_read(), jingle_show_channels(), jingle_write(), login_exec(), mgcp_rtp_read(), mgcp_write(), misdn_write(), moh_files_release(), moh_release(), nbs_request(), nbs_xwrite(), ogg_vorbis_write(), oh323_rtp_read(), oh323_write(), pcm_write(), phone_setup(), phone_write(), print_codec_to_cli(), print_frame(), process_sdp_a_audio(), rebuild_matrix(), register_translator(), remote_bridge_loop(), set_format(), set_local_capabilities(), set_peer_capabilities(), setup_rtp_connection(), show_codecs(), sip_request_call(), sip_rtp_read(), sip_write(), siren14write(), siren7write(), skinny_new(), skinny_rtp_read(), skinny_set_rtp_peer(), skinny_write(), slinear_write(), socket_process(), start_rtp(), unistim_new(), unistim_request(), unistim_rtp_read(), unistim_write(), vox_write(), and wav_write().
char* ast_getformatname_multiple | ( | char * | buf, |
size_t | size, | ||
format_t | format | ||
) |
Get the names of a set of formats.
buf | a buffer for the output string |
size | size of buf (bytes) |
format | the format (combined IDs of codecs) Prints a list of readable codec names corresponding to "format". ex: for format=AST_FORMAT_GSM|AST_FORMAT_SPEEX|AST_FORMAT_ILBC it will return "0x602 (GSM|SPEEX|ILBC)" |
Definition at line 591 of file frame.c.
References ARRAY_LEN, ast_copy_string(), ast_format_list::bits, len(), and name.
Referenced by __ast_read(), _sip_show_peer(), _skinny_show_device(), _skinny_show_line(), add_sdp(), alsa_request(), ast_best_codec(), ast_codec_get_samples(), ast_request(), ast_streamfile(), ast_write(), bridge_make_compatible(), console_request(), function_iaxpeer(), function_sippeer(), gtalk_is_answered(), gtalk_newcall(), gtalk_write(), handle_capabilities_res_message(), handle_cli_core_show_channeltype(), handle_cli_iax2_show_peer(), handle_showchan(), iax2_bridge(), jingle_write(), mgcp_request(), mgcp_write(), oh323_request(), oh323_write(), oss_request(), phone_request(), process_sdp(), serialize_showchan(), set_format(), setup_rtp_connection(), show_channels_cb(), sip_new(), sip_request_call(), sip_show_channel(), sip_show_settings(), sip_write(), skinny_new(), skinny_request(), skinny_write(), socket_process(), start_rtp(), unistim_new(), unistim_request(), and unistim_write().
int ast_parse_allow_disallow | ( | struct ast_codec_pref * | pref, |
format_t * | mask, | ||
const char * | list, | ||
int | allowing | ||
) |
Parse an "allow" or "deny" line in a channel or device configuration and update the capabilities mask and pref if provided. Video codecs are not added to codec preference lists, since we can not transcode.
Definition at line 1272 of file frame.c.
References ast_codec_pref_append(), ast_codec_pref_remove(), ast_codec_pref_setsize(), ast_debug, AST_FORMAT_AUDIO_MASK, ast_getformatbyname(), ast_log(), ast_strdupa, format, LOG_WARNING, parse(), and strsep().
Referenced by action_originate(), apply_outgoing(), build_peer(), build_user(), config_parse_variables(), gtalk_create_member(), gtalk_load_config(), jingle_create_member(), jingle_load_config(), reload_config(), set_config(), skinny_unregister(), and update_common_options().
void ast_smoother_free | ( | struct ast_smoother * | s | ) |
Definition at line 294 of file frame.c.
References ast_free.
Referenced by ast_rtp_destroy(), ast_rtp_write(), destroy_session(), and generic_fax_exec().
int ast_smoother_get_flags | ( | struct ast_smoother * | s | ) |
Definition at line 193 of file frame.c.
References ast_smoother::flags.
struct ast_smoother* ast_smoother_new | ( | int | size | ) |
Definition at line 183 of file frame.c.
References ast_malloc, and ast_smoother_reset().
Referenced by ast_rtp_write(), and generic_fax_exec().
struct ast_frame* ast_smoother_read | ( | struct ast_smoother * | s | ) |
Definition at line 244 of file frame.c.
References ast_format_rate(), AST_FRAME_VOICE, AST_FRIENDLY_OFFSET, ast_log(), ast_samp2tv(), AST_SMOOTHER_FLAG_G729, ast_tvadd(), ast_tvzero(), ast_frame_subclass::codec, ast_smoother::data, ast_frame::data, ast_frame::datalen, ast_smoother::delivery, ast_frame::delivery, ast_smoother::f, ast_smoother::flags, ast_smoother::format, ast_smoother::framedata, ast_frame::frametype, ast_smoother::len, len(), LOG_WARNING, ast_frame::offset, ast_smoother::opt, ast_frame::ptr, ast_frame::samples, ast_smoother::samplesperbyte, ast_smoother::size, and ast_frame::subclass.
Referenced by ast_rtp_write(), and generic_fax_exec().
void ast_smoother_reconfigure | ( | struct ast_smoother * | s, |
int | bytes | ||
) |
Reconfigure an existing smoother to output a different number of bytes per frame.
s | the smoother to reconfigure |
bytes | the desired number of bytes per output frame |
Definition at line 161 of file frame.c.
References ast_smoother::opt, ast_smoother::opt_needs_swap, ast_smoother::size, and smoother_frame_feed().
void ast_smoother_reset | ( | struct ast_smoother * | s, |
int | bytes | ||
) |
Definition at line 155 of file frame.c.
References ast_smoother::size.
Referenced by ast_smoother_new().
void ast_smoother_set_flags | ( | struct ast_smoother * | s, |
int | flags | ||
) |
Definition at line 198 of file frame.c.
References ast_smoother::flags.
Referenced by ast_rtp_write().
int ast_smoother_test_flag | ( | struct ast_smoother * | s, |
int | flag | ||
) |
Definition at line 203 of file frame.c.
References ast_smoother::flags.
Referenced by ast_rtp_write().
void ast_swapcopy_samples | ( | void * | dst, |
const void * | src, | ||
int | samples | ||
) |
Definition at line 556 of file frame.c.
Referenced by __ast_smoother_feed(), iax_frame_wrap(), phone_write_buf(), and smoother_frame_feed().
|
static |
Definition at line 329 of file frame.c.
References ast_free, AST_LIST_REMOVE_HEAD, f, frames, and ast_frame_cache::list.
|
static |
Definition at line 990 of file frame.c.
References ARRAY_LEN, and ast_cli_unregister_multiple().
Referenced by init_framer().
|
static |
Definition at line 1323 of file frame.c.
References ast_log(), LOG_WARNING, type, TYPE_DONTSEND, TYPE_HIGH, TYPE_LOW, TYPE_MASK, and TYPE_SILENCE.
Referenced by g723_samples().
|
static |
Definition at line 1346 of file frame.c.
References g723_len().
Referenced by ast_codec_get_samples().
|
static |
Definition at line 1361 of file frame.c.
Referenced by speex_get_wb_sz_at(), and speex_samples().
int init_framer | ( | void | ) |
Provided by frame.c
Definition at line 995 of file frame.c.
References ARRAY_LEN, ast_cli_register_multiple(), ast_register_atexit(), and framer_shutdown().
Referenced by main().
|
static |
Definition at line 740 of file frame.c.
References ast_cli_args::argc, ast_cli_args::argv, ast_cli(), ast_codec2str(), CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, ast_cli_args::fd, and ast_cli_entry::usage.
|
static |
Definition at line 673 of file frame.c.
References ast_cli_args::argc, ast_cli_args::argv, ast_cli(), ast_codec2str(), AST_FORMAT_AUDIO_MASK, AST_FORMAT_TEXT_MASK, AST_FORMAT_VIDEO_MASK, ast_getformatname(), ast_opt_dont_warn, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, ast_cli_args::fd, and ast_cli_entry::usage.
|
static |
Definition at line 133 of file frame.c.
References ast_log(), AST_SMOOTHER_FLAG_G729, ast_swapcopy_samples(), ast_tvzero(), ast_smoother::data, ast_frame::data, ast_frame::datalen, ast_smoother::delivery, ast_frame::delivery, ast_smoother::flags, ast_smoother::len, LOG_NOTICE, ast_frame::ptr, and ast_frame::samples.
Referenced by __ast_smoother_feed(), and ast_smoother_reconfigure().
|
static |
Definition at line 1380 of file frame.c.
References ast_log(), get_n_bits_at(), and LOG_WARNING.
Referenced by speex_samples().
|
static |
Definition at line 1410 of file frame.c.
References ast_log(), get_n_bits_at(), LOG_WARNING, and speex_get_wb_sz_at().
Referenced by ast_codec_get_samples().
|
static |
|
static |
Definition of supported media formats (codecs)
Definition at line 100 of file frame.c.
Referenced by ast_get_format_list().
struct ast_frame ast_null_frame = { AST_FRAME_NULL, } |
Queueing a null frame is fairly common, so we declare a global null frame object for this purpose instead of having to declare one on the stack
Definition at line 131 of file frame.c.
Referenced by __analog_handle_event(), __ast_channel_masquerade(), __ast_read(), __oh323_rtp_create(), __oh323_update_info(), agent_read(), agent_request(), ast_channel_setwhentohangup_tv(), ast_do_masquerade(), ast_rtcp_read(), ast_rtp_read(), ast_softhangup_nolock(), ast_udptl_read(), bridge_read(), conf_run(), console_read(), create_dtmf_frame(), dahdi_handle_event(), dahdi_read(), gtalk_rtp_read(), handle_request_invite(), handle_response_invite(), iax2_read(), jingle_rtp_read(), local_read(), mgcp_rtp_read(), multicast_rtp_read(), oh323_read(), oh323_rtp_read(), process_sdp(), sig_pri_handle_subcmds(), sip_read(), sip_rtp_read(), skinny_rtp_read(), spandsp_fax_read(), unistim_rtp_read(), and wakeup_sub().
|
static |
Definition at line 51 of file frame.c.
Referenced by __frame_free(), ast_frame_header_new(), and ast_frdup().
|
static |