Asterisk - The Open Source Telephony Project GIT-master-f36a736
|
Asterisk internal frame definitions. More...
#include <sys/time.h>
#include "asterisk/format.h"
#include "asterisk/endian.h"
#include "asterisk/linkedlists.h"
Go to the source code of this file.
Data Structures | |
struct | ast_control_pvt_cause_code |
struct | ast_control_read_action_payload |
struct | ast_control_t38_parameters |
struct | ast_frame |
Data structure associated with a single frame of data. More... | |
struct | ast_frame_subclass |
struct | ast_option_header |
struct | oprmode |
Macros | |
#define | ast_frame_byteswap_be(fr) do { ; } while(0) |
#define | ast_frame_byteswap_le(fr) do { struct ast_frame *__f = (fr); ast_swapcopy_samples(__f->data.ptr, __f->data.ptr, __f->samples); } while(0) |
#define | AST_FRAME_DTMF AST_FRAME_DTMF_END |
#define | AST_FRAME_SET_BUFFER(fr, _base, _ofs, _datalen) |
#define | ast_frdup(fr) __ast_frdup(fr, __FILE__, __LINE__, __PRETTY_FUNCTION__) |
Copies a frame. More... | |
#define | ast_frfree(fr) ast_frame_free(fr, 1) |
#define | AST_FRIENDLY_OFFSET 64 |
Offset into a frame's data buffer. More... | |
#define | ast_frisolate(fr) __ast_frisolate(fr, __FILE__, __LINE__, __PRETTY_FUNCTION__) |
Makes a frame independent of any static storage. More... | |
#define | AST_HTML_BEGIN 4 |
#define | AST_HTML_DATA 2 |
#define | AST_HTML_END 8 |
#define | AST_HTML_LDCOMPLETE 16 |
#define | AST_HTML_LINKREJECT 20 |
#define | AST_HTML_LINKURL 18 |
#define | AST_HTML_NOSUPPORT 17 |
#define | AST_HTML_UNLINK 19 |
#define | AST_HTML_URL 1 |
#define | AST_MALLOCD_DATA (1 << 1) |
#define | AST_MALLOCD_HDR (1 << 0) |
#define | AST_MALLOCD_SRC (1 << 2) |
#define | AST_MIN_OFFSET 32 /*! Make sure we keep at least this much handy */ |
#define | AST_MODEM_T38 1 |
#define | AST_MODEM_V150 2 |
#define | AST_OPTION_AUDIO_MODE 4 |
#define | AST_OPTION_CC_AGENT_TYPE 17 |
#define | AST_OPTION_CHANNEL_WRITE 9 |
Handle channel write data If a channel needs to process the data from a func_channel write operation after func_channel_write executes, it can define the setoption callback and process this option. A pointer to an ast_chan_write_info_t will be passed. More... | |
#define | AST_OPTION_DEVICE_NAME 16 |
#define | AST_OPTION_DIGIT_DETECT 14 |
#define | AST_OPTION_ECHOCAN 8 |
#define | AST_OPTION_FAX_DETECT 15 |
#define | AST_OPTION_FLAG_ACCEPT 1 |
#define | AST_OPTION_FLAG_ANSWER 5 |
#define | AST_OPTION_FLAG_QUERY 4 |
#define | AST_OPTION_FLAG_REJECT 2 |
#define | AST_OPTION_FLAG_REQUEST 0 |
#define | AST_OPTION_FLAG_WTF 6 |
#define | AST_OPTION_FORMAT_READ 11 |
#define | AST_OPTION_FORMAT_WRITE 12 |
#define | AST_OPTION_MAKE_COMPATIBLE 13 |
#define | AST_OPTION_OPRMODE 7 |
#define | AST_OPTION_RELAXDTMF 3 |
#define | AST_OPTION_RXGAIN 6 |
#define | AST_OPTION_SECURE_MEDIA 19 |
#define | AST_OPTION_SECURE_SIGNALING 18 |
#define | AST_OPTION_T38_STATE 10 |
#define | AST_OPTION_TDD 2 |
#define | AST_OPTION_TONE_VERIFY 1 |
#define | AST_OPTION_TXGAIN 5 |
Functions | |
struct ast_frame * | __ast_frdup (const struct ast_frame *fr, const char *file, int line, const char *func) |
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 components are malloc'ed More... | |
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_adjust_volume_float (struct ast_frame *f, float 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_dtor (struct ast_frame *frame) |
NULL-safe wrapper for ast_frfree, good for RAII_VAR. More... | |
void | ast_frame_dump (const char *name, struct ast_frame *f, char *prefix) |
struct ast_frame * | ast_frame_enqueue (struct ast_frame *head, struct ast_frame *f, int maxlen, int dupe) |
Appends a frame to the end of a list of frames, truncating the maximum length of the list. More... | |
void | ast_frame_free (struct ast_frame *frame, int cache) |
Frees a frame or list of frames. More... | |
int | ast_frame_slinear_sum (struct ast_frame *f1, struct ast_frame *f2) |
Sums two frames of audio samples. More... | |
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. More... | |
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. More... | |
void | ast_swapcopy_samples (void *dst, const void *src, int samples) |
Variables | |
struct ast_frame | ast_null_frame |
Asterisk internal frame definitions.
Definition in file include/asterisk/frame.h.
#define ast_frame_byteswap_be | ( | fr | ) | do { ; } while(0) |
Definition at line 602 of file include/asterisk/frame.h.
#define ast_frame_byteswap_le | ( | fr | ) | do { struct ast_frame *__f = (fr); ast_swapcopy_samples(__f->data.ptr, __f->data.ptr, __f->samples); } while(0) |
Definition at line 601 of file include/asterisk/frame.h.
#define AST_FRAME_DTMF AST_FRAME_DTMF_END |
Definition at line 139 of file include/asterisk/frame.h.
#define AST_FRAME_SET_BUFFER | ( | fr, | |
_base, | |||
_ofs, | |||
_datalen | |||
) |
Set the various field of a frame to point to a buffer. Typically you set the base address of the buffer, the offset as AST_FRIENDLY_OFFSET, and the datalen as the amount of bytes queued. The remaining things (to be done manually) is set the number of samples, which cannot be derived from the datalen unless you know the number of bits per sample.
Definition at line 208 of file include/asterisk/frame.h.
#define ast_frdup | ( | fr | ) | __ast_frdup(fr, __FILE__, __LINE__, __PRETTY_FUNCTION__) |
Copies a frame.
fr | frame to copy Duplicates a frame – should only rarely be used, typically frisolate is good enough |
Definition at line 590 of file include/asterisk/frame.h.
#define ast_frfree | ( | fr | ) | ast_frame_free(fr, 1) |
Definition at line 561 of file include/asterisk/frame.h.
#define AST_FRIENDLY_OFFSET 64 |
Offset into a frame's data buffer.
By providing some "empty" space prior to the actual data of an ast_frame, this gives any consumer of the frame ample space to prepend other necessary information without having to create a new buffer.
As an example, RTP can use the data from an ast_frame and simply prepend the RTP header information into the space provided by AST_FRIENDLY_OFFSET instead of having to create a new buffer with the necessary space allocated.
Definition at line 229 of file include/asterisk/frame.h.
#define ast_frisolate | ( | fr | ) | __ast_frisolate(fr, __FILE__, __LINE__, __PRETTY_FUNCTION__) |
Makes a frame independent of any static storage.
fr | frame to act upon Take a frame, and if it's not been malloc'd, make a malloc'd copy and if the data hasn't been malloced then make the data malloc'd. If you need to store frames, say for queueing, then you should call this function. |
Definition at line 582 of file include/asterisk/frame.h.
#define AST_HTML_BEGIN 4 |
Beginning frame
Definition at line 251 of file include/asterisk/frame.h.
#define AST_HTML_DATA 2 |
Data frame
Definition at line 249 of file include/asterisk/frame.h.
#define AST_HTML_END 8 |
End frame
Definition at line 253 of file include/asterisk/frame.h.
#define AST_HTML_LDCOMPLETE 16 |
Load is complete
Definition at line 255 of file include/asterisk/frame.h.
#define AST_HTML_LINKREJECT 20 |
Reject link request
Definition at line 263 of file include/asterisk/frame.h.
#define AST_HTML_LINKURL 18 |
Send URL, and track
Definition at line 259 of file include/asterisk/frame.h.
#define AST_HTML_NOSUPPORT 17 |
Peer is unable to support HTML
Definition at line 257 of file include/asterisk/frame.h.
#define AST_HTML_UNLINK 19 |
No more HTML linkage
Definition at line 261 of file include/asterisk/frame.h.
#define AST_HTML_URL 1 |
Sending a URL
Definition at line 247 of file include/asterisk/frame.h.
#define AST_MALLOCD_DATA (1 << 1) |
Need the data be free'd?
Definition at line 235 of file include/asterisk/frame.h.
#define AST_MALLOCD_HDR (1 << 0) |
Need the header be free'd?
Definition at line 233 of file include/asterisk/frame.h.
#define AST_MALLOCD_SRC (1 << 2) |
Need the source be free'd? (haha!)
Definition at line 237 of file include/asterisk/frame.h.
#define AST_MIN_OFFSET 32 /*! Make sure we keep at least this much handy */ |
Definition at line 230 of file include/asterisk/frame.h.
#define AST_MODEM_T38 1 |
T.38 Fax-over-IP
Definition at line 241 of file include/asterisk/frame.h.
#define AST_MODEM_V150 2 |
V.150 Modem-over-IP
Definition at line 243 of file include/asterisk/frame.h.
#define AST_OPTION_AUDIO_MODE 4 |
Set (or clear) Audio (Not-Clear) Mode Option data is a single signed char value 0 or 1
Definition at line 443 of file include/asterisk/frame.h.
#define AST_OPTION_CC_AGENT_TYPE 17 |
Get the CC agent type from the channel (Read only) Option data is a character buffer of suitable length
Definition at line 515 of file include/asterisk/frame.h.
#define AST_OPTION_CHANNEL_WRITE 9 |
Handle channel write data If a channel needs to process the data from a func_channel write operation after func_channel_write executes, it can define the setoption callback and process this option. A pointer to an ast_chan_write_info_t will be passed.
Definition at line 479 of file include/asterisk/frame.h.
#define AST_OPTION_DEVICE_NAME 16 |
Get the device name from the channel (Read only) Option data is a character buffer of suitable length
Definition at line 511 of file include/asterisk/frame.h.
#define AST_OPTION_DIGIT_DETECT 14 |
Get or set the digit detection state of the channel Option data is a single signed char value 0 or 1
Definition at line 503 of file include/asterisk/frame.h.
#define AST_OPTION_ECHOCAN 8 |
Explicitly enable or disable echo cancelation for the given channel Option data is a single signed char value 0 or 1
Definition at line 471 of file include/asterisk/frame.h.
#define AST_OPTION_FAX_DETECT 15 |
Get or set the fax tone detection state of the channel Option data is a single signed char value 0 or 1
Definition at line 507 of file include/asterisk/frame.h.
#define AST_OPTION_FLAG_ACCEPT 1 |
Definition at line 422 of file include/asterisk/frame.h.
#define AST_OPTION_FLAG_ANSWER 5 |
Definition at line 425 of file include/asterisk/frame.h.
#define AST_OPTION_FLAG_QUERY 4 |
Definition at line 424 of file include/asterisk/frame.h.
#define AST_OPTION_FLAG_REJECT 2 |
Definition at line 423 of file include/asterisk/frame.h.
#define AST_OPTION_FLAG_REQUEST 0 |
Definition at line 421 of file include/asterisk/frame.h.
#define AST_OPTION_FLAG_WTF 6 |
Definition at line 426 of file include/asterisk/frame.h.
#define AST_OPTION_FORMAT_READ 11 |
Request that the channel driver deliver frames in a specific format Option data is a format_t
Definition at line 489 of file include/asterisk/frame.h.
#define AST_OPTION_FORMAT_WRITE 12 |
Request that the channel driver be prepared to accept frames in a specific format Option data is a format_t
Definition at line 493 of file include/asterisk/frame.h.
#define AST_OPTION_MAKE_COMPATIBLE 13 |
Request that the channel driver make two channels of the same tech type compatible if possible Option data is an ast_channel
Definition at line 499 of file include/asterisk/frame.h.
#define AST_OPTION_OPRMODE 7 |
Definition at line 459 of file include/asterisk/frame.h.
#define AST_OPTION_RELAXDTMF 3 |
Relax the parameters for DTMF reception (mainly for radio use) Option data is a single signed char value 0 or 1
Definition at line 439 of file include/asterisk/frame.h.
#define AST_OPTION_RXGAIN 6 |
Set channel receive gain Option data is a single signed char representing number of decibels (dB) to set gain to (on top of any gain specified in channel driver)
Definition at line 453 of file include/asterisk/frame.h.
#define AST_OPTION_SECURE_MEDIA 19 |
Definition at line 520 of file include/asterisk/frame.h.
#define AST_OPTION_SECURE_SIGNALING 18 |
Get or set the security options on a channel Option data is an integer value of 0 or 1
Definition at line 519 of file include/asterisk/frame.h.
#define AST_OPTION_T38_STATE 10 |
Definition at line 485 of file include/asterisk/frame.h.
#define AST_OPTION_TDD 2 |
Put a compatible channel into TDD (TTY for the hearing-impaired) mode Option data is a single signed char value 0 or 1
Definition at line 435 of file include/asterisk/frame.h.
#define AST_OPTION_TONE_VERIFY 1 |
Verify touchtones by muting audio transmission (and reception) and verify the tone is still present Option data is a single signed char value 0 or 1
Definition at line 431 of file include/asterisk/frame.h.
#define AST_OPTION_TXGAIN 5 |
Set channel transmit gain Option data is a single signed char representing number of decibels (dB) to set gain to (on top of any gain specified in channel driver)
Definition at line 448 of file include/asterisk/frame.h.
anonymous enum |
Definition at line 141 of file include/asterisk/frame.h.
Internal control frame subtype field values.
Enumerator | |
---|---|
AST_CONTROL_HANGUP | Other end has hungup |
AST_CONTROL_RING | Local ring |
AST_CONTROL_RINGING | Remote end is ringing |
AST_CONTROL_ANSWER | Remote end has answered |
AST_CONTROL_BUSY | Remote end is busy |
AST_CONTROL_TAKEOFFHOOK | Make it go off hook |
AST_CONTROL_OFFHOOK | Line is off hook |
AST_CONTROL_CONGESTION | Congestion (circuits busy) |
AST_CONTROL_FLASH | Flash hook |
AST_CONTROL_WINK | Wink |
AST_CONTROL_OPTION | Set a low-level option |
AST_CONTROL_RADIO_KEY | Key Radio |
AST_CONTROL_RADIO_UNKEY | Un-Key Radio |
AST_CONTROL_PROGRESS | Indicate PROGRESS |
AST_CONTROL_PROCEEDING | Indicate CALL PROCEEDING |
AST_CONTROL_HOLD | Indicate call is placed on hold |
AST_CONTROL_UNHOLD | Indicate call is left from hold |
AST_CONTROL_VIDUPDATE | Indicate video frame update |
_XXX_AST_CONTROL_T38 | T38 state change request/notification
|
AST_CONTROL_SRCUPDATE | Indicate source of media has changed |
AST_CONTROL_TRANSFER | Indicate status of a transfer request |
AST_CONTROL_CONNECTED_LINE | Indicate connected line has changed |
AST_CONTROL_REDIRECTING | Indicate redirecting id has changed |
AST_CONTROL_T38_PARAMETERS | T38 state change request/notification with parameters |
AST_CONTROL_CC | Indication that Call completion service is possible |
AST_CONTROL_SRCCHANGE | Media source has changed and requires a new RTP SSRC |
AST_CONTROL_READ_ACTION | Tell ast_read to take a specific action |
AST_CONTROL_AOC | Advice of Charge with encoded generic AOC payload |
AST_CONTROL_END_OF_Q | Indicate that this position was the end of the channel queue for a softhangup. |
AST_CONTROL_INCOMPLETE | Indication that the extension dialed is incomplete |
AST_CONTROL_MCID | Indicate that the caller is being malicious. |
AST_CONTROL_UPDATE_RTP_PEER | Interrupt the bridge and have it update the peer |
AST_CONTROL_PVT_CAUSE_CODE | Contains an update to the protocol-specific cause-code stored for branching dials |
AST_CONTROL_MASQUERADE_NOTIFY | A masquerade is about to begin/end. (Never sent as a frame but directly with ast_indicate_data().) |
AST_CONTROL_STREAM_TOPOLOGY_REQUEST_CHANGE | Channel indication that a stream topology change has been requested |
AST_CONTROL_STREAM_TOPOLOGY_CHANGED | Channel indication that a stream topology change has occurred |
AST_CONTROL_STREAM_TOPOLOGY_SOURCE_CHANGED | Channel indication that one of the source streams has changed its source |
AST_CONTROL_STREAM_STOP | Indicate to a channel in playback to stop the stream |
AST_CONTROL_STREAM_SUSPEND | Indicate to a channel in playback to suspend the stream |
AST_CONTROL_STREAM_RESTART | Indicate to a channel in playback to restart the stream |
AST_CONTROL_STREAM_REVERSE | Indicate to a channel in playback to rewind |
AST_CONTROL_STREAM_FORWARD | Indicate to a channel in playback to fast forward |
AST_CONTROL_RECORD_CANCEL | Indicated to a channel in record to stop recording and discard the file |
AST_CONTROL_RECORD_STOP | Indicated to a channel in record to stop recording |
AST_CONTROL_RECORD_SUSPEND | Indicated to a channel in record to suspend/unsuspend recording |
AST_CONTROL_RECORD_MUTE | Indicated to a channel in record to mute/unmute (i.e. write silence) recording |
Definition at line 277 of file include/asterisk/frame.h.
enum ast_control_t38 |
Definition at line 370 of file include/asterisk/frame.h.
enum ast_control_t38_rate |
Enumerator | |
---|---|
AST_T38_RATE_2400 | |
AST_T38_RATE_4800 | |
AST_T38_RATE_7200 | |
AST_T38_RATE_9600 | |
AST_T38_RATE_12000 | |
AST_T38_RATE_14400 |
Definition at line 379 of file include/asterisk/frame.h.
Enumerator | |
---|---|
AST_T38_RATE_MANAGEMENT_TRANSFERRED_TCF | |
AST_T38_RATE_MANAGEMENT_LOCAL_TCF |
Definition at line 392 of file include/asterisk/frame.h.
enum ast_control_transfer |
Enumerator | |
---|---|
AST_TRANSFER_SUCCESS | Transfer request on the channel worked |
AST_TRANSFER_FAILED | Transfer request on the channel failed |
Definition at line 408 of file include/asterisk/frame.h.
Actions to indicate to, and be handled on channel read.
The subtype to specify for an AST_CONTROL_READ_ACTION frame. These frames are then to be enacted on within a channel's read thread.
Enumerator | |
---|---|
AST_FRAME_READ_ACTION_CONNECTED_LINE_MACRO | |
AST_FRAME_READ_ACTION_SEND_TEXT | |
AST_FRAME_READ_ACTION_SEND_TEXT_DATA |
Definition at line 351 of file include/asterisk/frame.h.
enum ast_frame_type |
Frame types.
Enumerator | |
---|---|
AST_FRAME_DTMF_END | DTMF end event, subclass is the digit |
AST_FRAME_VOICE | Voice data, subclass is AST_FORMAT_* |
AST_FRAME_VIDEO | Video frame, maybe?? :) |
AST_FRAME_CONTROL | A control frame, subclass is AST_CONTROL_* |
AST_FRAME_NULL | An empty, useless frame |
AST_FRAME_IAX | Inter Asterisk Exchange private frame type |
AST_FRAME_TEXT | Text messages. The character data may not be zero-terminated, so care should be taken when passing it to functions that expect a zero-terminated string. The frame's datalen member should be used as it indicates the actual number of bytes available. |
AST_FRAME_IMAGE | Image Frames |
AST_FRAME_HTML | HTML Frame |
AST_FRAME_CNG | Comfort Noise frame (subclass is level of CNG in -dBov), body may include zero or more 8-bit quantization coefficients |
AST_FRAME_MODEM | Modem-over-IP data streams |
AST_FRAME_DTMF_BEGIN | DTMF begin event, subclass is the digit |
AST_FRAME_BRIDGE_ACTION | Internal bridge module action. |
AST_FRAME_BRIDGE_ACTION_SYNC | Internal synchronous bridge module action. Synchronous bridge actions may be queued onto bridge channels, but they absolutely must not ever be written directly into bridges. |
AST_FRAME_RTCP | RTCP feedback (the subclass will contain the payload type) |
AST_FRAME_TEXT_DATA | Text message in an ast_msg_data structure |
Definition at line 97 of file include/asterisk/frame.h.
struct ast_frame * __ast_frdup | ( | const struct ast_frame * | fr, |
const char * | file, | ||
int | line, | ||
const char * | func | ||
) |
Definition at line 305 of file main/frame.c.
References __ast_calloc(), ao2_bump, AST_CONTROL_ANSWER, ast_copy_flags, AST_FLAGS_ALL, AST_FRAME_CONTROL, AST_FRAME_IMAGE, AST_FRAME_TEXT, AST_FRAME_VIDEO, AST_FRAME_VOICE, AST_FRIENDLY_OFFSET, AST_LIST_REMOVE_CURRENT, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, AST_MALLOCD_HDR, ast_threadstorage_get(), buf, ast_frame::data, ast_frame::datalen, ast_frame::delivery, make_ari_stubs::file, frame_cache, frames, ast_frame::frametype, ast_frame_subclass::integer, len(), ast_frame::len, NULL, out, ast_frame::ptr, ast_frame::samples, ast_frame::seqno, ast_frame::src, ast_frame::stream_num, ast_frame::subclass, ast_frame::ts, and ast_frame::uint32.
Referenced by __ast_frisolate().
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 components are malloc'ed
Definition at line 197 of file main/frame.c.
References __ast_frdup(), ao2_bump, AST_CONTROL_ANSWER, ast_copy_flags, AST_FLAGS_ALL, ast_frame_free(), ast_frame_header_new(), AST_FRAME_IMAGE, AST_FRAME_TEXT, AST_FRAME_VIDEO, AST_FRAME_VOICE, 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::data, ast_frame::datalen, make_ari_stubs::file, ast_frame::frametype, ast_frame_subclass::integer, ast_frame::len, ast_frame::mallocd, NULL, ast_frame::offset, out, ast_frame::ptr, ast_frame::samples, ast_frame::seqno, ast_frame::src, ast_frame::stream_num, ast_frame::subclass, ast_frame::ts, and ast_frame::uint32.
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 787 of file main/frame.c.
References abs, ast_format_cache_is_slinear(), AST_FRAME_VOICE, ast_slinear_saturated_divide(), ast_slinear_saturated_multiply(), ast_frame::data, ast_frame_subclass::format, ast_frame::frametype, ast_frame::ptr, ast_frame::samples, and ast_frame::subclass.
Referenced by audiohook_read_frame_single(), audiohook_volume_callback(), and conf_run().
int ast_frame_adjust_volume_float | ( | struct ast_frame * | f, |
float | 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 812 of file main/frame.c.
References ast_format_cache_is_slinear(), AST_FRAME_VOICE, ast_slinear_saturated_divide_float(), ast_slinear_saturated_multiply_float(), ast_frame::data, ast_frame_subclass::format, ast_frame::frametype, ast_frame::ptr, ast_frame::samples, and ast_frame::subclass.
Referenced by 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 859 of file main/frame.c.
References AST_LIST_NEXT, ast_frame::data, ast_frame::datalen, ast_frame::next, NULL, and ast_frame::ptr.
Referenced by audiohook_read_frame_single().
void ast_frame_dtor | ( | struct ast_frame * | frame | ) |
NULL-safe wrapper for ast_frfree, good for RAII_VAR.
frame | Frame to free, or head of list to free. |
Definition at line 187 of file main/frame.c.
References ast_frfree.
Referenced by __ast_play_and_record(), and stasis_app_exec().
void ast_frame_dump | ( | const char * | name, |
struct ast_frame * | f, | ||
char * | prefix | ||
) |
Dump a frame for debugging purposes
Definition at line 731 of file main/frame.c.
References AST_FRAME_RTCP, ast_frame_subclass2str(), ast_frame_type2str(), AST_FRAME_VIDEO, AST_FRAME_VOICE, ast_strlen_zero(), ast_verb, COLOR_BLACK, COLOR_BRCYAN, COLOR_BRGREEN, COLOR_BRMAGENTA, COLOR_BRRED, COLOR_YELLOW, ast_frame::frametype, ast_frame_subclass::integer, name, prefix, ast_frame::subclass, and term_color().
Referenced by __ast_read(), and ast_write_stream().
struct ast_frame * ast_frame_enqueue | ( | struct ast_frame * | head, |
struct ast_frame * | f, | ||
int | maxlen, | ||
int | dupe | ||
) |
Appends a frame to the end of a list of frames, truncating the maximum length of the list.
void ast_frame_free | ( | struct ast_frame * | frame, |
int | cache | ||
) |
Frees a frame or list of frames.
frame | Frame to free, or head of list to free |
cache | Whether to consider this frame for frame caching |
Definition at line 176 of file main/frame.c.
References __frame_free(), AST_LIST_NEXT, cache, and ast_frame::next.
Referenced by __ast_frisolate(), ast_rtp_read(), mixmonitor_thread(), and spy_generate().
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 837 of file main/frame.c.
References ast_format_cmp(), AST_FORMAT_CMP_NOT_EQUAL, ast_format_slin, AST_FRAME_VOICE, ast_slinear_saturated_add(), ast_frame::data, ast_frame_subclass::format, ast_frame::frametype, ast_frame::ptr, ast_frame::samples, and ast_frame::subclass.
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.
f | The frame to get the information from |
subclass | Buffer to fill with subclass information |
slen | Length of subclass buffer |
moreinfo | Buffer to fill with additional information |
mlen | Length of moreinfo buffer |
Definition at line 406 of file main/frame.c.
References AST_CONTROL_ANSWER, AST_CONTROL_AOC, AST_CONTROL_BUSY, AST_CONTROL_CC, AST_CONTROL_CONGESTION, AST_CONTROL_CONNECTED_LINE, AST_CONTROL_END_OF_Q, AST_CONTROL_FLASH, AST_CONTROL_HANGUP, AST_CONTROL_HOLD, AST_CONTROL_INCOMPLETE, AST_CONTROL_MASQUERADE_NOTIFY, AST_CONTROL_MCID, AST_CONTROL_OFFHOOK, AST_CONTROL_OPTION, AST_CONTROL_PROCEEDING, AST_CONTROL_PROGRESS, AST_CONTROL_PVT_CAUSE_CODE, AST_CONTROL_RADIO_KEY, AST_CONTROL_RADIO_UNKEY, AST_CONTROL_READ_ACTION, AST_CONTROL_RECORD_CANCEL, AST_CONTROL_RECORD_MUTE, AST_CONTROL_RECORD_STOP, AST_CONTROL_RECORD_SUSPEND, AST_CONTROL_REDIRECTING, AST_CONTROL_RING, AST_CONTROL_RINGING, AST_CONTROL_SRCCHANGE, AST_CONTROL_SRCUPDATE, AST_CONTROL_STREAM_FORWARD, AST_CONTROL_STREAM_RESTART, AST_CONTROL_STREAM_REVERSE, AST_CONTROL_STREAM_STOP, AST_CONTROL_STREAM_SUSPEND, AST_CONTROL_STREAM_TOPOLOGY_CHANGED, AST_CONTROL_STREAM_TOPOLOGY_REQUEST_CHANGE, AST_CONTROL_STREAM_TOPOLOGY_SOURCE_CHANGED, AST_CONTROL_T38_PARAMETERS, AST_CONTROL_TAKEOFFHOOK, AST_CONTROL_TRANSFER, AST_CONTROL_UNHOLD, AST_CONTROL_UPDATE_RTP_PEER, AST_CONTROL_VIDUPDATE, AST_CONTROL_WINK, ast_copy_string(), ast_format_get_name(), AST_FRAME_BRIDGE_ACTION, AST_FRAME_BRIDGE_ACTION_SYNC, 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_RTCP, AST_FRAME_TEXT, 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_T38_NEGOTIATED, AST_T38_REFUSED, AST_T38_REQUEST_NEGOTIATE, AST_T38_REQUEST_TERMINATE, AST_T38_TERMINATED, ast_frame::data, ast_frame::datalen, ast_frame_subclass::format, ast_frame::frametype, ast_frame_subclass::integer, ast_frame::ptr, ast_control_t38_parameters::request_response, and ast_frame::subclass.
Referenced by ast_frame_dump(), chan_pjsip_indicate(), and handle_dump_frames().
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.
frame_type | The frame type to be described |
ftype | Buffer to fill with frame type description |
len | Length of subclass buffer |
Definition at line 671 of file main/frame.c.
References ast_copy_string(), AST_FRAME_BRIDGE_ACTION, AST_FRAME_BRIDGE_ACTION_SYNC, 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_RTCP, AST_FRAME_TEXT, AST_FRAME_TEXT_DATA, AST_FRAME_VIDEO, AST_FRAME_VOICE, and len().
Referenced by ast_frame_dump(), handle_dump_frames(), softmix_bridge_write_text(), and stream_echo_write_error().
void ast_swapcopy_samples | ( | void * | dst, |
const void * | src, | ||
int | samples | ||
) |
Definition at line 396 of file main/frame.c.
Referenced by __ast_smoother_feed(), iax_frame_wrap(), and smoother_frame_feed().
|
extern |
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 79 of file main/frame.c.
Referenced by __analog_handle_event(), __ast_read(), aoc_framehook(), apply_negotiated_sdp_stream(), ast_audiosocket_receive_frame(), ast_channel_set_unbridged_nolock(), ast_channel_setwhentohangup_tv(), ast_rtcp_interpret(), ast_rtcp_read(), ast_rtp_interpret(), ast_rtp_read(), ast_softhangup_nolock(), AST_TEST_DEFINE(), ast_translate(), ast_udptl_read(), ast_unreal_read(), bridge_channel_internal_push_full(), bridge_channel_poke(), chan_msg_read(), chan_pjsip_cng_tone_detected(), chan_pjsip_read_stream(), channel_do_masquerade(), conf_run(), console_read(), create_dtmf_frame(), dahdi_handle_event(), dahdi_read(), exec_command_on_condition(), fax_detect_framehook(), fax_gateway_detect_t38(), fax_gateway_framehook(), handle_negotiated_sdp(), hold_intercept_framehook(), hook_event_cb(), iax2_read(), jb_get_adaptive(), jb_get_fixed(), jingle_read(), mbl_read(), media_session_rtcp_read_callback(), media_session_rtp_read_callback(), media_session_udptl_read_callback(), multicast_rtp_read(), ooh323_rtp_read(), rec_read(), refer_incoming_invite_request(), rtp_read(), set_interval_hook(), snoop_read(), spandsp_fax_read(), stream_periodic_frames(), suppress_framehook_event_cb(), test_vm_api_mock_channel_read(), unistim_rtp_read(), and wakeup_sub().