48 #if (defined(LOW_MEMORY) || defined(MALLOC_DEBUG)) && !defined(NO_FRAME_CACHE) 49 #define NO_FRAME_CACHE 52 #if !defined(NO_FRAME_CACHE) 67 #define FRAME_CACHE_MAX_SIZE 10 85 #if !defined(NO_FRAME_CACHE) 92 memset(f, 0,
sizeof(*f));
100 if (!(f =
__ast_calloc(1,
sizeof(*f), file, line, func))) {
109 #if !defined(NO_FRAME_CACHE) 127 #if !defined(NO_FRAME_CACHE) 262 }
else if (out != fr) {
294 }
else if (out != fr) {
297 memset(&fr->
data, 0,
sizeof(fr->
data));
311 #if !defined(NO_FRAME_CACHE) 323 srclen = strlen(f->
src);
327 #if !defined(NO_FRAME_CACHE) 334 memset(out, 0,
sizeof(*out));
384 src = (
char *) out->
src;
399 unsigned short *dst_s = dst;
400 const unsigned short *src_s = src;
402 for (i = 0; i < samples; i++)
403 dst_s[i] = (src_s[i]<<8) | (src_s[i]>>8);
485 message =
"Negotiation Requested";
487 message =
"Negotiation Request Terminated";
489 message =
"Negotiated";
491 message =
"Terminated";
495 snprintf(subclass, slen,
"T38_Parameters/%s", message);
597 snprintf(subclass, slen,
"Synchronous Bridge Frametype %d", f->
subclass.
integer);
644 snprintf(subclass, slen,
"Unknown HTML frame '%d'\n", f->
subclass.
integer);
657 snprintf(subclass, slen,
"Unknown MODEM frame '%d'\n", f->
subclass.
integer);
673 switch (frame_type) {
723 snprintf(ftype, len,
"Unknown Frametype '%u'", frame_type);
733 const char noname[] =
"unknown";
734 char ftype[40] =
"Unknown Frametype";
736 char subclass[40] =
"Unknown Subclass";
738 char moreinfo[40] =
"";
748 ast_verb(-1,
"%s [ %s (NULL) ] [%s]\n",
769 ast_verb(-1,
"%s [ TYPE: %s (%u) SUBCLASS: %s (%d) '%s' ] [%s]\n",
778 ast_verb(-1,
"%s [ TYPE: %s (%u) SUBCLASS: %s (%d) ] [%s]\n",
791 short adjust_value =
abs(adjustment);
801 for (count = 0; count < f->
samples; count++) {
802 if (adjustment > 0) {
804 }
else if (adjustment < 0) {
816 float adjust_value = fabs(adjustment);
826 for (count = 0; count < f->
samples; count++) {
827 if (adjustment > 0) {
829 }
else if (adjustment < 0) {
840 short *data1, *data2;
853 count++, data1++, data2++)
This is just so ast_frames, a list head struct for holding a list of ast_frame structures, is defined.
void ast_swapcopy_samples(void *dst, const void *src, int samples)
void * __ast_calloc(size_t nmemb, size_t size, const char *file, int lineno, const char *func) attribute_malloc
struct ast_frame * __ast_frisolate(struct ast_frame *fr, const char *file, int line, const char *func)
'isolates' a frame by duplicating non-malloc'ed components (header, src, data). On return all compone...
Asterisk locking-related definitions:
Asterisk main include file. File version handling, generic pbx functions.
void * ast_threadstorage_get(struct ast_threadstorage *ts, size_t init_size)
Retrieve thread storage.
void ast_frame_free(struct ast_frame *frame, int cache)
Requests a frame to be allocated.
struct ast_frame * __ast_frdup(const struct ast_frame *f, const char *file, int line, const char *func)
#define AST_HTML_NOSUPPORT
char * ast_frame_type2str(enum ast_frame_type frame_type, char *ftype, size_t len)
Copy the discription of a frame type into the provided string.
#define ast_test_flag(p, flag)
Support for translation of data formats. translate.c.
#define AST_HTML_LDCOMPLETE
Convenient Signal Processing routines.
#define AST_HTML_LINKREJECT
#define AST_LIST_NEXT(elm, field)
Returns the next entry in the list after the given entry.
enum ast_control_t38 request_response
char * ast_frame_subclass2str(struct ast_frame *f, char *subclass, size_t slen, char *moreinfo, size_t mlen)
Copy the discription of a frame's subclass into the provided string.
void ast_frame_dtor(struct ast_frame *f)
NULL-safe wrapper for ast_frfree, good for RAII_VAR.
#define ast_copy_flags(dest, src, flagz)
#define ast_strdup(str)
A wrapper for strdup()
Generic File Format Support. Should be included by clients of the file handling routines. File service providers should instead include mod_format.h.
Definitions to aid in the use of thread local storage.
void ast_frame_dump(const char *name, struct ast_frame *f, char *prefix)
#define AST_LIST_TRAVERSE_SAFE_END
Closes a safe loop traversal block.
static void __frame_free(struct ast_frame *fr, int cache)
#define ast_verb(level,...)
struct ast_frame_subclass subclass
#define ast_strlen_zero(foo)
General Asterisk PBX channel definitions.
#define AST_FRIENDLY_OFFSET
Offset into a frame's data buffer.
#define ast_opt_cache_media_frames
#define FRAME_CACHE_MAX_SIZE
Maximum ast_frame cache size.
#define AST_LIST_REMOVE_CURRENT(field)
Removes the current entry from a list during a traversal.
Asterisk internal frame definitions.
static force_inline void ast_slinear_saturated_add(short *input, short *value)
static force_inline void ast_slinear_saturated_multiply(short *input, short *value)
A set of macros to manage forward-linked lists.
#define ast_malloc(len)
A wrapper for malloc()
#define AST_LIST_REMOVE_HEAD(head, field)
Removes and returns the head entry from a list.
AST_LIST_HEAD_NOLOCK(contactliststruct, contact)
int ast_frame_slinear_sum(struct ast_frame *f1, struct ast_frame *f2)
Sums two frames of audio samples.
static struct ast_frame * ast_frame_header_new(const char *file, int line, const char *func)
static force_inline void ast_slinear_saturated_divide_float(short *input, float *value)
char * term_color(char *outbuf, const char *inbuf, int fgcolor, int bgcolor, int maxout)
Colorize a specified string by adding terminal color codes.
ast_frame_type
Frame types.
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
#define AST_LIST_INSERT_HEAD(head, elm, field)
Inserts a list entry at the head of a list.
static force_inline void ast_slinear_saturated_divide(short *input, short *value)
Prototypes for public functions only of internal interest,.
struct ao2_container * cache
struct ast_frame ast_null_frame
#define AST_THREADSTORAGE_CUSTOM(a, b, c)
Define a thread storage variable, with custom initialization and cleanup.
int ast_frame_adjust_volume_float(struct ast_frame *f, float adjustment)
Adjusts the volume of the audio samples contained in a frame.
Standard Command Line Interface.
static void frame_cache_cleanup(void *data)
static force_inline void ast_slinear_saturated_multiply_float(short *input, float *value)
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
Data structure associated with a single frame of data.
Handy terminal functions for vt* terms.
int ast_frame_adjust_volume(struct ast_frame *f, int adjustment)
Adjusts the volume of the audio samples contained in a frame.
union ast_frame::@263 data
#define AST_LIST_TRAVERSE_SAFE_BEGIN(head, var, field)
Loops safely over (traverses) the entries in a list.
enum ast_frame_type frametype
struct ast_format * format
static struct ast_threadstorage frame_cache
struct ast_stream_topology * topology
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.
static char prefix[MAX_PREFIX]