⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frame.h

📁 一个非常美妙的proxy。功能强大。基于sip的协议。如果还要的话
💻 H
📖 第 1 页 / 共 2 页
字号:
/*! Indicate video frame update */#define AST_CONTROL_VIDUPDATE		18#define AST_SMOOTHER_FLAG_G729		(1 << 0)/* Option identifiers and flags */#define AST_OPTION_FLAG_REQUEST		0#define AST_OPTION_FLAG_ACCEPT		1#define AST_OPTION_FLAG_REJECT		2#define AST_OPTION_FLAG_QUERY		4#define AST_OPTION_FLAG_ANSWER		5#define AST_OPTION_FLAG_WTF		6/*! Verify touchtones by muting audio transmission 	(and reception) and verify the tone is still present */#define AST_OPTION_TONE_VERIFY		1		/*! Put a compatible channel into TDD (TTY for the hearing-impared) mode */#define	AST_OPTION_TDD			2/*! Relax the parameters for DTMF reception (mainly for radio use) */#define	AST_OPTION_RELAXDTMF		3/*! Set (or clear) Audio (Not-Clear) Mode */#define	AST_OPTION_AUDIO_MODE		4/*! 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)*/#define AST_OPTION_TXGAIN		5/*! 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)*/#define AST_OPTION_RXGAIN		6struct ast_option_header {	/* Always keep in network byte order */#if __BYTE_ORDER == __BIG_ENDIAN        u_int16_t flag:3;        u_int16_t option:13;#else#if __BYTE_ORDER == __LITTLE_ENDIAN        u_int16_t option:13;        u_int16_t flag:3;#else#error Byte order not defined#endif#endif		u_int8_t data[0];};/*! \brief  Requests a frame to be allocated  *  * \param 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  */#if 0 /* Unimplemented */struct ast_frame *ast_fralloc(char *source, int len);#endif/*!  \brief Frees a frame  * \param fr Frame to free * Free a frame, and the memory it used if applicable * \return no return. */void ast_frfree(struct ast_frame *fr);/*! \brief Copies a frame  * \param 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. * \return Returns a frame on success, NULL on error */struct ast_frame *ast_frisolate(struct ast_frame *fr);/*! \brief Copies a frame  * \param fr frame to copy * Dupliates a frame -- should only rarely be used, typically frisolate is good enough * \return Returns a frame on success, NULL on error */struct ast_frame *ast_frdup(struct ast_frame *fr);/*! \brief Reads a frame from an fd * Read a frame from a stream or packet fd, as written by fd_write * \param fd an opened fd to read from * \return returns a frame on success, NULL on error */struct ast_frame *ast_fr_fdread(int fd);/*! Writes a frame to an fd * Write a frame to an fd * \param fd Which fd to write to * \param frame frame to write to the fd * \return Returns 0 on success, -1 on failure */int ast_fr_fdwrite(int fd, struct ast_frame *frame);/*! \brief Sends a hangup to an fd  * Send a hangup (NULL equivalent) on an fd * \param fd fd to write to * \return Returns 0 on success, -1 on failure */int ast_fr_fdhangup(int fd);void ast_swapcopy_samples(void *dst, const void *src, int samples);/* Helpers for byteswapping native samples to/from    little-endian and big-endian. */#if __BYTE_ORDER == __LITTLE_ENDIAN#define ast_frame_byteswap_le(fr) do { ; } while(0)#define ast_frame_byteswap_be(fr) do { struct ast_frame *__f = (fr); ast_swapcopy_samples(__f->data, __f->data, __f->samples); } while(0)#else#define ast_frame_byteswap_le(fr) do { struct ast_frame *__f = (fr); ast_swapcopy_samples(__f->data, __f->data, __f->samples); } while(0)#define ast_frame_byteswap_be(fr) do { ; } while(0)#endif/*! \brief Get the name of a format * \param format id of format * \return A static string containing the name of the format or "UNKN" if unknown. */extern char* ast_getformatname(int format);/*! \brief Get the names of a set of formats * \param buf a buffer for the output string * \param size size of buf (bytes) * \param 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)" * \return The return value is buf. */extern char* ast_getformatname_multiple(char *buf, size_t size, int format);/*! * \brief Gets a format from a name. * \param name string of format * \return This returns the form of the format in binary on success, 0 on error. */extern int ast_getformatbyname(char *name);/*! \brief Get a name from a format  * Gets a name from a format * \param codec codec number (1,2,4,8,16,etc.) * \return This returns a static string identifying the format on success, 0 on error. */extern char *ast_codec2str(int codec);struct ast_smoother;extern struct ast_format_list *ast_get_format_list_index(int index);extern struct ast_format_list *ast_get_format_list(size_t *size);extern struct ast_smoother *ast_smoother_new(int bytes);extern void ast_smoother_set_flags(struct ast_smoother *smoother, int flags);extern int ast_smoother_get_flags(struct ast_smoother *smoother);extern void ast_smoother_free(struct ast_smoother *s);extern void ast_smoother_reset(struct ast_smoother *s, int bytes);extern int __ast_smoother_feed(struct ast_smoother *s, struct ast_frame *f, int swap);extern struct ast_frame *ast_smoother_read(struct ast_smoother *s);#define ast_smoother_feed(s,f) __ast_smoother_feed(s, f, 0)#if __BYTE_ORDER == __LITTLE_ENDIAN#define ast_smoother_feed_be(s,f) __ast_smoother_feed(s, f, 1)#define ast_smoother_feed_le(s,f) __ast_smoother_feed(s, f, 0)#else#define ast_smoother_feed_be(s,f) __ast_smoother_feed(s, f, 0)#define ast_smoother_feed_le(s,f) __ast_smoother_feed(s, f, 1)#endifextern void ast_frame_dump(char *name, struct ast_frame *f, char *prefix);/*! \brief Initialize a codec preference to "no preference" */extern void ast_codec_pref_init(struct ast_codec_pref *pref);/*! \brief Codec located at  a particular place in the preference index */extern int ast_codec_pref_index(struct ast_codec_pref *pref, int index);/*! \brief Remove a codec from a preference list */extern void ast_codec_pref_remove(struct ast_codec_pref *pref, int format);/*! \brief Append a codec to a preference list, removing it first if it was already there */extern int ast_codec_pref_append(struct ast_codec_pref *pref, int format);/*! \brief Select the best 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. */extern int ast_codec_choose(struct ast_codec_pref *pref, int formats, int find_best);/*! \brief Parse an "allow" or "deny" line and update the mask and pref if provided */extern void ast_parse_allow_disallow(struct ast_codec_pref *pref, int *mask, const char *list, int allowing);/*! \brief Dump codec preference list into a string */extern int ast_codec_pref_string(struct ast_codec_pref *pref, char *buf, size_t size);/*! \brief Shift a codec preference list up or down 65 bytes so that it becomes an ASCII string */extern void ast_codec_pref_convert(struct ast_codec_pref *pref, char *buf, size_t size, int right);/*! \brief Returns the number of samples contained in the frame */extern int ast_codec_get_samples(struct ast_frame *f);/*! \brief Returns the number of bytes for the number of samples of the given format */extern int ast_codec_get_len(int format, int samples);/*! \brief Gets duration in ms of interpolation frame for a format */static inline int ast_codec_interp_len(int format) { 	return (format == AST_FORMAT_ILBC) ? 30 : 20;}/*!  \brief Adjusts the volume of the audio samples contained in a frame.  \param f The frame containing the samples (must be AST_FRAME_VOICE and AST_FORMAT_SLINEAR)  \param adjustment The number of dB to adjust up or down.  \return 0 for success, non-zero for an error */int ast_frame_adjust_volume(struct ast_frame *f, int adjustment);/*!  \brief Sums two frames of audio samples.  \param f1 The first frame (which will contain the result)  \param f2 The second frame  \return 0 for success, non-zero for an error  The frames must be AST_FRAME_VOICE and must contain AST_FORMAT_SLINEAR samples,  and must contain the same number of samples. */int ast_frame_slinear_sum(struct ast_frame *f1, struct ast_frame *f2);#if defined(__cplusplus) || defined(c_plusplus)}#endif#endif /* _ASTERISK_FRAME_H */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -