mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-22 12:52:33 +00:00
Expand codec bitfield from 32 bits to 64 bits.
Reviewboard: https://reviewboard.asterisk.org/r/416/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@227580 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -32,6 +32,8 @@
|
||||
|
||||
#include <sys/time.h>
|
||||
|
||||
#include "asterisk/frame_defs.h"
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -92,7 +94,7 @@ struct ast_jb
|
||||
/*! \brief The time the next frame should be played. */
|
||||
long next;
|
||||
/*! \brief Voice format of the last frame in. */
|
||||
int last_format;
|
||||
format_t last_format;
|
||||
/*! \brief File for frame timestamp tracing. */
|
||||
FILE *logfile;
|
||||
/*! \brief Jitterbuffer internal state flags. */
|
||||
|
||||
@@ -30,7 +30,7 @@ extern "C" {
|
||||
/* these two are used in struct ast_audiohook */
|
||||
#include "asterisk/lock.h"
|
||||
#include "asterisk/linkedlists.h"
|
||||
|
||||
#include "asterisk/frame_defs.h"
|
||||
#include "asterisk/slinfactory.h"
|
||||
|
||||
enum ast_audiohook_type {
|
||||
@@ -133,7 +133,7 @@ int ast_audiohook_write_frame(struct ast_audiohook *audiohook, enum ast_audiohoo
|
||||
* \param format Format of frame remote side wants back
|
||||
* \return Returns frame on success, NULL on failure
|
||||
*/
|
||||
struct ast_frame *ast_audiohook_read_frame(struct ast_audiohook *audiohook, size_t samples, enum ast_audiohook_direction direction, int format);
|
||||
struct ast_frame *ast_audiohook_read_frame(struct ast_audiohook *audiohook, size_t samples, enum ast_audiohook_direction direction, format_t format);
|
||||
|
||||
/*! \brief Attach audiohook to channel
|
||||
* \param chan Channel
|
||||
|
||||
@@ -352,6 +352,9 @@
|
||||
/* Define to the version of the Hoard Memory Allocator library. */
|
||||
#undef HAVE_HOARD_VERSION
|
||||
|
||||
/* Define to 1 if you have the `htonll' function. */
|
||||
#undef HAVE_HTONLL
|
||||
|
||||
/* Define to 1 if you have the ical libraries library. */
|
||||
#undef HAVE_ICAL
|
||||
|
||||
@@ -576,6 +579,9 @@
|
||||
/* Define to the version of the newt library. */
|
||||
#undef HAVE_NEWT_VERSION
|
||||
|
||||
/* Define to 1 if you have the `ntohll' function. */
|
||||
#undef HAVE_NTOHLL
|
||||
|
||||
/* Define to 1 if your ODBC library has wide (Unicode) types. */
|
||||
#undef HAVE_ODBC_WCHAR
|
||||
|
||||
|
||||
@@ -193,7 +193,7 @@ struct ast_bridge {
|
||||
* This creates a simple two party bridge that will be destroyed once one of
|
||||
* the channels hangs up.
|
||||
*/
|
||||
struct ast_bridge *ast_bridge_new(int capabilities, int flags);
|
||||
struct ast_bridge *ast_bridge_new(format_t capabilities, int flags);
|
||||
|
||||
/*! \brief See if it is possible to create a bridge
|
||||
*
|
||||
@@ -211,7 +211,7 @@ struct ast_bridge *ast_bridge_new(int capabilities, int flags);
|
||||
* This sees if it is possible to create a bridge capable of bridging two channels
|
||||
* together.
|
||||
*/
|
||||
int ast_bridge_check(int capabilities);
|
||||
int ast_bridge_check(format_t capabilities);
|
||||
|
||||
/*! \brief Destroy a bridge
|
||||
*
|
||||
|
||||
@@ -45,7 +45,7 @@ struct ast_bridge_technology {
|
||||
/*! Unique name to this bridge technology */
|
||||
const char *name;
|
||||
/*! The capabilities that this bridge technology is capable of */
|
||||
int capabilities;
|
||||
format_t capabilities;
|
||||
/*! Preference level that should be used when determining whether to use this bridge technology or not */
|
||||
enum ast_bridge_preference preference;
|
||||
/*! Callback for when a bridge is being created */
|
||||
@@ -71,7 +71,7 @@ struct ast_bridge_technology {
|
||||
/*! Callback for poking a bridge thread */
|
||||
int (*poke)(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel);
|
||||
/*! Formats that the bridge technology supports */
|
||||
int formats;
|
||||
format_t formats;
|
||||
/*! Bit to indicate whether the bridge technology is currently suspended or not */
|
||||
unsigned int suspended:1;
|
||||
/*! Module this bridge technology belongs to. Is used for reference counting when creating/destroying a bridge. */
|
||||
|
||||
@@ -417,12 +417,12 @@ struct ast_channel_tech {
|
||||
const char * const type;
|
||||
const char * const description;
|
||||
|
||||
int capabilities; /*!< Bitmap of formats this channel can handle */
|
||||
format_t capabilities; /*!< Bitmap of formats this channel can handle */
|
||||
|
||||
int properties; /*!< Technology Properties */
|
||||
int properties; /*!< Technology Properties */
|
||||
|
||||
/*! \brief Requester - to set up call data structures (pvt's) */
|
||||
struct ast_channel *(* const requester)(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause);
|
||||
struct ast_channel *(* const requester)(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause);
|
||||
|
||||
int (* const devicestate)(void *data); /*!< Devicestate call back */
|
||||
|
||||
@@ -731,7 +731,7 @@ struct ast_channel {
|
||||
int fdno; /*!< Which fd had an event detected on */
|
||||
int streamid; /*!< For streaming playback, the schedule ID */
|
||||
int vstreamid; /*!< For streaming video playback, the schedule ID */
|
||||
int oldwriteformat; /*!< Original writer format */
|
||||
format_t oldwriteformat; /*!< Original writer format */
|
||||
int timingfd; /*!< Timing fd */
|
||||
enum ast_channel_state _state; /*!< State of line -- Don't write directly, use ast_setstate() */
|
||||
int rings; /*!< Number of rings so far */
|
||||
@@ -746,11 +746,11 @@ struct ast_channel {
|
||||
int hangupcause; /*!< Why is the channel hanged up. See causes.h */
|
||||
unsigned int flags; /*!< channel flags of AST_FLAG_ type */
|
||||
int alertpipe[2];
|
||||
int nativeformats; /*!< Kinds of data this channel can natively handle */
|
||||
int readformat; /*!< Requested read format */
|
||||
int writeformat; /*!< Requested write format */
|
||||
int rawreadformat; /*!< Raw read format */
|
||||
int rawwriteformat; /*!< Raw write format */
|
||||
format_t nativeformats; /*!< Kinds of data this channel can natively handle */
|
||||
format_t readformat; /*!< Requested read format */
|
||||
format_t writeformat; /*!< Requested write format */
|
||||
format_t rawreadformat; /*!< Raw read format */
|
||||
format_t rawwriteformat; /*!< Raw write format */
|
||||
unsigned int emulate_dtmf_duration; /*!< Number of ms left to emulate DTMF for */
|
||||
#ifdef HAVE_EPOLL
|
||||
int epfd;
|
||||
@@ -1139,7 +1139,7 @@ struct ast_channel *ast_channel_release(struct ast_channel *chan);
|
||||
* \retval NULL failure
|
||||
* \retval non-NULL channel on success
|
||||
*/
|
||||
struct ast_channel *ast_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *status);
|
||||
struct ast_channel *ast_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *status);
|
||||
|
||||
/*!
|
||||
* \brief Request a channel of a given type, with data as optional information used
|
||||
@@ -1156,7 +1156,7 @@ struct ast_channel *ast_request(const char *type, int format, const struct ast_c
|
||||
* \return Returns an ast_channel on success or no answer, NULL on failure. Check the value of chan->_state
|
||||
* to know if the call was answered or not.
|
||||
*/
|
||||
struct ast_channel *ast_request_and_dial(const char *type, int format, const struct ast_channel *requestor, void *data,
|
||||
struct ast_channel *ast_request_and_dial(const char *type, format_t format, const struct ast_channel *requestor, void *data,
|
||||
int timeout, int *reason, const char *cid_num, const char *cid_name);
|
||||
|
||||
/*!
|
||||
@@ -1173,7 +1173,7 @@ struct ast_channel *ast_request_and_dial(const char *type, int format, const str
|
||||
* \return Returns an ast_channel on success or no answer, NULL on failure. Check the value of chan->_state
|
||||
* to know if the call was answered or not.
|
||||
*/
|
||||
struct ast_channel *__ast_request_and_dial(const char *type, int format, const struct ast_channel *requestor, void *data,
|
||||
struct ast_channel *__ast_request_and_dial(const char *type, format_t format, const struct ast_channel *requestor, void *data,
|
||||
int timeout, int *reason, const char *cid_num, const char *cid_name, struct outgoing_helper *oh);
|
||||
|
||||
/*!
|
||||
@@ -1186,7 +1186,7 @@ struct ast_channel *__ast_request_and_dial(const char *type, int format, const s
|
||||
* \param outstate reason why unsuccessful (if uncuccessful)
|
||||
* \return Returns the forwarded call's ast_channel on success or NULL on failure
|
||||
*/
|
||||
struct ast_channel *ast_call_forward(struct ast_channel *caller, struct ast_channel *orig, int *timeout, int format, struct outgoing_helper *oh, int *outstate);
|
||||
struct ast_channel *ast_call_forward(struct ast_channel *caller, struct ast_channel *orig, int *timeout, format_t format, struct outgoing_helper *oh, int *outstate);
|
||||
|
||||
/*!
|
||||
* \brief Register a channel technology (a new channel driver)
|
||||
@@ -1591,7 +1591,7 @@ int ast_prod(struct ast_channel *chan);
|
||||
* \param format format to change to
|
||||
* \return Returns 0 on success, -1 on failure
|
||||
*/
|
||||
int ast_set_read_format(struct ast_channel *chan, int format);
|
||||
int ast_set_read_format(struct ast_channel *chan, format_t format);
|
||||
|
||||
/*!
|
||||
* \brief Sets write format on channel chan
|
||||
@@ -1600,7 +1600,7 @@ int ast_set_read_format(struct ast_channel *chan, int format);
|
||||
* \param format new format for writing
|
||||
* \return Returns 0 on success, -1 on failure
|
||||
*/
|
||||
int ast_set_write_format(struct ast_channel *chan, int format);
|
||||
int ast_set_write_format(struct ast_channel *chan, format_t format);
|
||||
|
||||
/*!
|
||||
* \brief Sends text to a channel
|
||||
@@ -1821,7 +1821,7 @@ int ast_channel_setoption(struct ast_channel *channel, int option, void *data, i
|
||||
|
||||
/*! Pick the best codec
|
||||
* Choose the best codec... Uhhh... Yah. */
|
||||
int ast_best_codec(int fmts);
|
||||
format_t ast_best_codec(format_t fmts);
|
||||
|
||||
|
||||
/*!
|
||||
|
||||
@@ -81,6 +81,14 @@ int __attribute__((format(printf, 2, 3))) asprintf(char **str, const char *fmt,
|
||||
int getloadavg(double *list, int nelem);
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_HTONLL
|
||||
uint64_t htonll(uint64_t host64);
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_NTOHLL
|
||||
uint64_t ntohll(uint64_t net64);
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_SETENV
|
||||
int setenv(const char *name, const char *value, int overwrite);
|
||||
#endif
|
||||
|
||||
@@ -31,12 +31,13 @@ extern "C" {
|
||||
|
||||
#include <sys/time.h>
|
||||
|
||||
#include "asterisk/frame_defs.h"
|
||||
#include "asterisk/endian.h"
|
||||
#include "asterisk/linkedlists.h"
|
||||
|
||||
struct ast_codec_pref {
|
||||
char order[32];
|
||||
char framing[32];
|
||||
char order[sizeof(format_t) * 8];
|
||||
char framing[sizeof(format_t) * 8];
|
||||
};
|
||||
|
||||
/*!
|
||||
@@ -136,7 +137,10 @@ struct ast_frame {
|
||||
/*! Kind of frame */
|
||||
enum ast_frame_type frametype;
|
||||
/*! Subclass, frame dependent */
|
||||
int subclass;
|
||||
union {
|
||||
int integer;
|
||||
format_t codec;
|
||||
} subclass;
|
||||
/*! Length of data */
|
||||
int datalen;
|
||||
/*! Number of samples in this frame */
|
||||
@@ -232,61 +236,65 @@ extern struct ast_frame ast_null_frame;
|
||||
|
||||
/* Data formats for capabilities and frames alike */
|
||||
/*! G.723.1 compression */
|
||||
#define AST_FORMAT_G723_1 (1 << 0)
|
||||
#define AST_FORMAT_G723_1 (1ULL << 0)
|
||||
/*! GSM compression */
|
||||
#define AST_FORMAT_GSM (1 << 1)
|
||||
#define AST_FORMAT_GSM (1ULL << 1)
|
||||
/*! Raw mu-law data (G.711) */
|
||||
#define AST_FORMAT_ULAW (1 << 2)
|
||||
#define AST_FORMAT_ULAW (1ULL << 2)
|
||||
/*! Raw A-law data (G.711) */
|
||||
#define AST_FORMAT_ALAW (1 << 3)
|
||||
#define AST_FORMAT_ALAW (1ULL << 3)
|
||||
/*! ADPCM (G.726, 32kbps, AAL2 codeword packing) */
|
||||
#define AST_FORMAT_G726_AAL2 (1 << 4)
|
||||
#define AST_FORMAT_G726_AAL2 (1ULL << 4)
|
||||
/*! ADPCM (IMA) */
|
||||
#define AST_FORMAT_ADPCM (1 << 5)
|
||||
#define AST_FORMAT_ADPCM (1ULL << 5)
|
||||
/*! Raw 16-bit Signed Linear (8000 Hz) PCM */
|
||||
#define AST_FORMAT_SLINEAR (1 << 6)
|
||||
#define AST_FORMAT_SLINEAR (1ULL << 6)
|
||||
/*! LPC10, 180 samples/frame */
|
||||
#define AST_FORMAT_LPC10 (1 << 7)
|
||||
#define AST_FORMAT_LPC10 (1ULL << 7)
|
||||
/*! G.729A audio */
|
||||
#define AST_FORMAT_G729A (1 << 8)
|
||||
#define AST_FORMAT_G729A (1ULL << 8)
|
||||
/*! SpeeX Free Compression */
|
||||
#define AST_FORMAT_SPEEX (1 << 9)
|
||||
#define AST_FORMAT_SPEEX (1ULL << 9)
|
||||
/*! iLBC Free Compression */
|
||||
#define AST_FORMAT_ILBC (1 << 10)
|
||||
#define AST_FORMAT_ILBC (1ULL << 10)
|
||||
/*! ADPCM (G.726, 32kbps, RFC3551 codeword packing) */
|
||||
#define AST_FORMAT_G726 (1 << 11)
|
||||
#define AST_FORMAT_G726 (1ULL << 11)
|
||||
/*! G.722 */
|
||||
#define AST_FORMAT_G722 (1 << 12)
|
||||
#define AST_FORMAT_G722 (1ULL << 12)
|
||||
/*! G.722.1 (also known as Siren7, 32kbps assumed) */
|
||||
#define AST_FORMAT_SIREN7 (1 << 13)
|
||||
#define AST_FORMAT_SIREN7 (1ULL << 13)
|
||||
/*! G.722.1 Annex C (also known as Siren14, 48kbps assumed) */
|
||||
#define AST_FORMAT_SIREN14 (1 << 14)
|
||||
#define AST_FORMAT_SIREN14 (1ULL << 14)
|
||||
/*! Raw 16-bit Signed Linear (16000 Hz) PCM */
|
||||
#define AST_FORMAT_SLINEAR16 (1 << 15)
|
||||
#define AST_FORMAT_SLINEAR16 (1ULL << 15)
|
||||
/*! Maximum audio mask */
|
||||
#define AST_FORMAT_AUDIO_MASK ((1 << 16)-1)
|
||||
#define AST_FORMAT_AUDIO_MASK 0xFFFF0000FFFFULL
|
||||
/*! JPEG Images */
|
||||
#define AST_FORMAT_JPEG (1 << 16)
|
||||
#define AST_FORMAT_JPEG (1ULL << 16)
|
||||
/*! PNG Images */
|
||||
#define AST_FORMAT_PNG (1 << 17)
|
||||
#define AST_FORMAT_PNG (1ULL << 17)
|
||||
/*! H.261 Video */
|
||||
#define AST_FORMAT_H261 (1 << 18)
|
||||
#define AST_FORMAT_H261 (1ULL << 18)
|
||||
/*! H.263 Video */
|
||||
#define AST_FORMAT_H263 (1 << 19)
|
||||
#define AST_FORMAT_H263 (1ULL << 19)
|
||||
/*! H.263+ Video */
|
||||
#define AST_FORMAT_H263_PLUS (1 << 20)
|
||||
#define AST_FORMAT_H263_PLUS (1ULL << 20)
|
||||
/*! H.264 Video */
|
||||
#define AST_FORMAT_H264 (1 << 21)
|
||||
#define AST_FORMAT_H264 (1ULL << 21)
|
||||
/*! MPEG4 Video */
|
||||
#define AST_FORMAT_MP4_VIDEO (1 << 22)
|
||||
#define AST_FORMAT_VIDEO_MASK (((1 << 25)-1) & ~(AST_FORMAT_AUDIO_MASK))
|
||||
#define AST_FORMAT_MP4_VIDEO (1ULL << 22)
|
||||
#define AST_FORMAT_VIDEO_MASK ((((1ULL << 25)-1) & ~(AST_FORMAT_AUDIO_MASK)) | 0x7FFF000000000000ULL)
|
||||
/*! T.140 RED Text format RFC 4103 */
|
||||
#define AST_FORMAT_T140RED (1 << 26)
|
||||
#define AST_FORMAT_T140RED (1ULL << 26)
|
||||
/*! T.140 Text format - ITU T.140, RFC 4103 */
|
||||
#define AST_FORMAT_T140 (1 << 27)
|
||||
#define AST_FORMAT_T140 (1ULL << 27)
|
||||
/*! Maximum text mask */
|
||||
#define AST_FORMAT_MAX_TEXT (1 << 28))
|
||||
#define AST_FORMAT_TEXT_MASK (((1 << 30)-1) & ~(AST_FORMAT_AUDIO_MASK) & ~(AST_FORMAT_VIDEO_MASK))
|
||||
#define AST_FORMAT_MAX_TEXT (1ULL << 28)
|
||||
#define AST_FORMAT_TEXT_MASK (((1ULL << 30)-1) & ~(AST_FORMAT_AUDIO_MASK) & ~(AST_FORMAT_VIDEO_MASK))
|
||||
/*! Raw mu-law data (G.711) */
|
||||
#define AST_FORMAT_TESTLAW (1ULL << 47)
|
||||
/*! Reserved bit - do not use */
|
||||
#define AST_FORMAT_RESERVED (1ULL << 63)
|
||||
|
||||
enum ast_control_frame_type {
|
||||
AST_CONTROL_HANGUP = 1, /*!< Other end has hungup */
|
||||
@@ -444,7 +452,7 @@ struct ast_option_header {
|
||||
|
||||
/*! \brief Definition of supported media formats (codecs) */
|
||||
struct ast_format_list {
|
||||
int bits; /*!< bitmask value */
|
||||
format_t bits; /*!< bitmask value */
|
||||
char *name; /*!< short name */
|
||||
int samplespersecond; /*!< Number of samples per second (8000/16000) */
|
||||
char *desc; /*!< Description */
|
||||
@@ -517,7 +525,7 @@ void ast_swapcopy_samples(void *dst, const void *src, int samples);
|
||||
* \param format id of format
|
||||
* \return A static string containing the name of the format or "unknown" if unknown.
|
||||
*/
|
||||
char* ast_getformatname(int format);
|
||||
char* ast_getformatname(format_t format);
|
||||
|
||||
/*! \brief Get the names of a set of formats
|
||||
* \param buf a buffer for the output string
|
||||
@@ -527,21 +535,21 @@ char* ast_getformatname(int 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.
|
||||
*/
|
||||
char* ast_getformatname_multiple(char *buf, size_t size, int format);
|
||||
char* ast_getformatname_multiple(char *buf, size_t size, format_t 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.
|
||||
*/
|
||||
int ast_getformatbyname(const char *name);
|
||||
format_t ast_getformatbyname(const 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.
|
||||
*/
|
||||
char *ast_codec2str(int codec);
|
||||
char *ast_codec2str(format_t codec);
|
||||
|
||||
/*! \name AST_Smoother
|
||||
*/
|
||||
@@ -617,38 +625,38 @@ void ast_codec_pref_init(struct ast_codec_pref *pref);
|
||||
* \brief Codec located at a particular place in the preference index.
|
||||
* \arg \ref AudioCodecPref
|
||||
*/
|
||||
int ast_codec_pref_index(struct ast_codec_pref *pref, int index);
|
||||
format_t ast_codec_pref_index(struct ast_codec_pref *pref, int index);
|
||||
|
||||
/*! \brief Remove audio a codec from a preference list */
|
||||
void ast_codec_pref_remove(struct ast_codec_pref *pref, int format);
|
||||
void ast_codec_pref_remove(struct ast_codec_pref *pref, format_t format);
|
||||
|
||||
/*! \brief Append a audio codec to a preference list, removing it first if it was already there
|
||||
*/
|
||||
int ast_codec_pref_append(struct ast_codec_pref *pref, int format);
|
||||
int ast_codec_pref_append(struct ast_codec_pref *pref, format_t format);
|
||||
|
||||
/*! \brief Prepend an audio codec to a preference list, removing it first if it was already there
|
||||
*/
|
||||
void ast_codec_pref_prepend(struct ast_codec_pref *pref, int format, int only_if_existing);
|
||||
void ast_codec_pref_prepend(struct ast_codec_pref *pref, format_t format, int only_if_existing);
|
||||
|
||||
/*! \brief 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. */
|
||||
int ast_codec_choose(struct ast_codec_pref *pref, int formats, int find_best);
|
||||
format_t ast_codec_choose(struct ast_codec_pref *pref, format_t formats, int find_best);
|
||||
|
||||
/*! \brief Set packet size for codec
|
||||
*/
|
||||
int ast_codec_pref_setsize(struct ast_codec_pref *pref, int format, int framems);
|
||||
int ast_codec_pref_setsize(struct ast_codec_pref *pref, format_t format, int framems);
|
||||
|
||||
/*! \brief Get packet size for codec
|
||||
*/
|
||||
struct ast_format_list ast_codec_pref_getsize(struct ast_codec_pref *pref, int format);
|
||||
struct ast_format_list ast_codec_pref_getsize(struct ast_codec_pref *pref, format_t format);
|
||||
|
||||
/*! \brief 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
|
||||
\return Returns number of errors encountered during parsing
|
||||
*/
|
||||
int ast_parse_allow_disallow(struct ast_codec_pref *pref, int *mask, const char *list, int allowing);
|
||||
int ast_parse_allow_disallow(struct ast_codec_pref *pref, format_t *mask, const char *list, int allowing);
|
||||
|
||||
/*! \brief Dump audio codec preference list into a string */
|
||||
int ast_codec_pref_string(struct ast_codec_pref *pref, char *buf, size_t size);
|
||||
@@ -660,14 +668,14 @@ void ast_codec_pref_convert(struct ast_codec_pref *pref, char *buf, size_t size,
|
||||
int ast_codec_get_samples(struct ast_frame *f);
|
||||
|
||||
/*! \brief Returns the number of bytes for the number of samples of the given format */
|
||||
int ast_codec_get_len(int format, int samples);
|
||||
int ast_codec_get_len(format_t format, int samples);
|
||||
|
||||
/*! \brief Appends a frame to the end of a list of frames, truncating the maximum length of the list */
|
||||
struct ast_frame *ast_frame_enqueue(struct ast_frame *head, struct ast_frame *f, int maxlen, int dupe);
|
||||
|
||||
|
||||
/*! \brief Gets duration in ms of interpolation frame for a format */
|
||||
static inline int ast_codec_interp_len(int format)
|
||||
static inline int ast_codec_interp_len(format_t format)
|
||||
{
|
||||
return (format == AST_FORMAT_ILBC) ? 30 : 20;
|
||||
}
|
||||
@@ -694,7 +702,7 @@ int ast_frame_slinear_sum(struct ast_frame *f1, struct ast_frame *f2);
|
||||
/*!
|
||||
* \brief Get the sample rate for a given format.
|
||||
*/
|
||||
static force_inline int ast_format_rate(int format)
|
||||
static force_inline int ast_format_rate(format_t format)
|
||||
{
|
||||
switch (format) {
|
||||
case AST_FORMAT_G722:
|
||||
|
||||
38
include/asterisk/frame_defs.h
Normal file
38
include/asterisk/frame_defs.h
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Asterisk -- An open source telephony toolkit.
|
||||
*
|
||||
* Copyright (C) 1999 - 2009, Digium, Inc.
|
||||
*
|
||||
* Mark Spencer <markster@digium.com>
|
||||
*
|
||||
* See http://www.asterisk.org for more information about
|
||||
* the Asterisk project. Please do not directly contact
|
||||
* any of the maintainers of this project for assistance;
|
||||
* the project provides a web site, mailing lists and IRC
|
||||
* channels for your use.
|
||||
*
|
||||
* This program is free software, distributed under the terms of
|
||||
* the GNU General Public License Version 2. See the LICENSE file
|
||||
* at the top of the source tree.
|
||||
*/
|
||||
|
||||
/*! \file
|
||||
* \brief Asterisk internal frame definitions.
|
||||
* \arg For an explanation of frames, see \ref Def_Frame
|
||||
* \arg Frames are send of Asterisk channels, see \ref Def_Channel
|
||||
*/
|
||||
|
||||
#ifndef _ASTERISK_FRAME_DEFS_H
|
||||
#define _ASTERISK_FRAME_DEFS_H
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef int64_t format_t;
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _ASTERISK_FRAME_DEFS_H */
|
||||
@@ -879,11 +879,11 @@ int ast_async_goto_by_name(const char *chan, const char *context, const char *ex
|
||||
|
||||
/*! Synchronously or asynchronously make an outbound call and send it to a
|
||||
particular extension */
|
||||
int ast_pbx_outgoing_exten(const char *type, int format, void *data, int timeout, const char *context, const char *exten, int priority, int *reason, int sync, const char *cid_num, const char *cid_name, struct ast_variable *vars, const char *account, struct ast_channel **locked_channel);
|
||||
int ast_pbx_outgoing_exten(const char *type, format_t format, void *data, int timeout, const char *context, const char *exten, int priority, int *reason, int sync, const char *cid_num, const char *cid_name, struct ast_variable *vars, const char *account, struct ast_channel **locked_channel);
|
||||
|
||||
/*! Synchronously or asynchronously make an outbound call and send it to a
|
||||
particular application with given extension */
|
||||
int ast_pbx_outgoing_app(const char *type, int format, void *data, int timeout, const char *app, const char *appdata, int *reason, int sync, const char *cid_num, const char *cid_name, struct ast_variable *vars, const char *account, struct ast_channel **locked_channel);
|
||||
int ast_pbx_outgoing_app(const char *type, format_t format, void *data, int timeout, const char *app, const char *appdata, int *reason, int sync, const char *cid_num, const char *cid_name, struct ast_variable *vars, const char *account, struct ast_channel **locked_channel);
|
||||
|
||||
/*!
|
||||
* \brief Evaluate a condition
|
||||
|
||||
@@ -221,7 +221,7 @@ struct ast_rtp_payload_type {
|
||||
/*! Is this an Asterisk value */
|
||||
int asterisk_format;
|
||||
/*! Actual internal value of the payload */
|
||||
int code;
|
||||
format_t code;
|
||||
};
|
||||
|
||||
/*! Structure that represents statistics from an RTP instance */
|
||||
@@ -328,7 +328,7 @@ struct ast_rtp_engine {
|
||||
/*! Callback for setting an RTP property */
|
||||
void (*prop_set)(struct ast_rtp_instance *instance, enum ast_rtp_property property, int value);
|
||||
/*! Callback for setting a payload */
|
||||
void (*payload_set)(struct ast_rtp_instance *instance, int payload, int astformat, int format);
|
||||
void (*payload_set)(struct ast_rtp_instance *instance, int payload, int astformat, format_t format);
|
||||
/*! Callback for setting packetization preferences */
|
||||
void (*packetization_set)(struct ast_rtp_instance *instance, struct ast_codec_pref *pref);
|
||||
/*! Callback for setting the remote address that RTP is to be sent to */
|
||||
@@ -352,9 +352,9 @@ struct ast_rtp_engine {
|
||||
/*! Callback to locally bridge two RTP instances */
|
||||
int (*local_bridge)(struct ast_rtp_instance *instance0, struct ast_rtp_instance *instance1);
|
||||
/*! Callback to set the read format */
|
||||
int (*set_read_format)(struct ast_rtp_instance *instance, int format);
|
||||
int (*set_read_format)(struct ast_rtp_instance *instance, format_t format);
|
||||
/*! Callback to set the write format */
|
||||
int (*set_write_format)(struct ast_rtp_instance *instance, int format);
|
||||
int (*set_write_format)(struct ast_rtp_instance *instance, format_t format);
|
||||
/*! Callback to make two instances compatible */
|
||||
int (*make_compatible)(struct ast_channel *chan0, struct ast_rtp_instance *instance0, struct ast_channel *chan1, struct ast_rtp_instance *instance1);
|
||||
/*! Callback to see if two instances are compatible with DTMF */
|
||||
@@ -399,9 +399,9 @@ struct ast_rtp_glue {
|
||||
*/
|
||||
enum ast_rtp_glue_result (*get_trtp_info)(struct ast_channel *chan, struct ast_rtp_instance **instance);
|
||||
/*! Callback for updating the destination that the remote side should send RTP to */
|
||||
int (*update_peer)(struct ast_channel *chan, struct ast_rtp_instance *instance, struct ast_rtp_instance *vinstance, struct ast_rtp_instance *tinstance, int codecs, int nat_active);
|
||||
int (*update_peer)(struct ast_channel *chan, struct ast_rtp_instance *instance, struct ast_rtp_instance *vinstance, struct ast_rtp_instance *tinstance, format_t codecs, int nat_active);
|
||||
/*! Callback for retrieving codecs that the channel can do */
|
||||
int (*get_codec)(struct ast_channel *chan);
|
||||
format_t (*get_codec)(struct ast_channel *chan);
|
||||
/*! Linked list information */
|
||||
AST_RWLIST_ENTRY(ast_rtp_glue) entry;
|
||||
};
|
||||
@@ -994,7 +994,7 @@ struct ast_rtp_payload_type ast_rtp_codecs_payload_lookup(struct ast_rtp_codecs
|
||||
*
|
||||
* \since 1.6.3
|
||||
*/
|
||||
unsigned int ast_rtp_lookup_sample_rate2(int asterisk_format, int code);
|
||||
unsigned int ast_rtp_lookup_sample_rate2(int asterisk_format, format_t code);
|
||||
|
||||
/*!
|
||||
* \brief Retrieve all formats that were found
|
||||
@@ -1015,7 +1015,7 @@ unsigned int ast_rtp_lookup_sample_rate2(int asterisk_format, int code);
|
||||
*
|
||||
* \since 1.6.3
|
||||
*/
|
||||
void ast_rtp_codecs_payload_formats(struct ast_rtp_codecs *codecs, int *astformats, int *nonastformats);
|
||||
void ast_rtp_codecs_payload_formats(struct ast_rtp_codecs *codecs, format_t *astformats, int *nonastformats);
|
||||
|
||||
/*!
|
||||
* \brief Retrieve a payload based on whether it is an Asterisk format and the code
|
||||
@@ -1036,7 +1036,7 @@ void ast_rtp_codecs_payload_formats(struct ast_rtp_codecs *codecs, int *astforma
|
||||
*
|
||||
* \since 1.6.3
|
||||
*/
|
||||
int ast_rtp_codecs_payload_code(struct ast_rtp_codecs *codecs, const int asterisk_format, const int code);
|
||||
int ast_rtp_codecs_payload_code(struct ast_rtp_codecs *codecs, const int asterisk_format, const format_t code);
|
||||
|
||||
/*!
|
||||
* \brief Retrieve mime subtype information on a payload
|
||||
@@ -1058,7 +1058,7 @@ int ast_rtp_codecs_payload_code(struct ast_rtp_codecs *codecs, const int asteris
|
||||
*
|
||||
* \since 1.6.3
|
||||
*/
|
||||
const char *ast_rtp_lookup_mime_subtype2(const int asterisk_format, const int code, enum ast_rtp_options options);
|
||||
const char *ast_rtp_lookup_mime_subtype2(const int asterisk_format, const format_t code, enum ast_rtp_options options);
|
||||
|
||||
/*!
|
||||
* \brief Convert formats into a string and put them into a buffer
|
||||
@@ -1082,7 +1082,7 @@ const char *ast_rtp_lookup_mime_subtype2(const int asterisk_format, const int co
|
||||
*
|
||||
* \since 1.6.3
|
||||
*/
|
||||
char *ast_rtp_lookup_mime_multiple2(struct ast_str *buf, const int capability, const int asterisk_format, enum ast_rtp_options options);
|
||||
char *ast_rtp_lookup_mime_multiple2(struct ast_str *buf, const format_t capability, const int asterisk_format, enum ast_rtp_options options);
|
||||
|
||||
/*!
|
||||
* \brief Set codec packetization preferences
|
||||
@@ -1464,7 +1464,7 @@ char *ast_rtp_instance_get_quality(struct ast_rtp_instance *instance, enum ast_r
|
||||
*
|
||||
* \since 1.6.3
|
||||
*/
|
||||
int ast_rtp_instance_set_read_format(struct ast_rtp_instance *instance, int format);
|
||||
int ast_rtp_instance_set_read_format(struct ast_rtp_instance *instance, format_t format);
|
||||
|
||||
/*!
|
||||
* \brief Tell underlying RTP engine that audio frames will be provided in a specific format
|
||||
@@ -1485,7 +1485,7 @@ int ast_rtp_instance_set_read_format(struct ast_rtp_instance *instance, int form
|
||||
*
|
||||
* \since 1.6.3
|
||||
*/
|
||||
int ast_rtp_instance_set_write_format(struct ast_rtp_instance *instance, int format);
|
||||
int ast_rtp_instance_set_write_format(struct ast_rtp_instance *instance, format_t format);
|
||||
|
||||
/*!
|
||||
* \brief Request that the underlying RTP engine make two RTP instances compatible with eachother
|
||||
@@ -1527,7 +1527,7 @@ int ast_rtp_instance_make_compatible(struct ast_channel *chan, struct ast_rtp_in
|
||||
*
|
||||
* \since 1.6.3
|
||||
*/
|
||||
int ast_rtp_instance_available_formats(struct ast_rtp_instance *instance, int to_endpoint, int to_asterisk);
|
||||
format_t ast_rtp_instance_available_formats(struct ast_rtp_instance *instance, int to_endpoint, int to_asterisk);
|
||||
|
||||
/*!
|
||||
* \brief Indicate to the RTP engine that packets are now expected to be sent/received on the RTP instance
|
||||
|
||||
@@ -86,7 +86,7 @@ static inline struct ast_frame *slin8_sample(void)
|
||||
{
|
||||
static struct ast_frame f = {
|
||||
.frametype = AST_FRAME_VOICE,
|
||||
.subclass = AST_FORMAT_SLINEAR,
|
||||
.subclass.codec = AST_FORMAT_SLINEAR,
|
||||
.datalen = sizeof(ex_slin8),
|
||||
.samples = ARRAY_LEN(ex_slin8) / 2,
|
||||
.mallocd = 0,
|
||||
@@ -102,7 +102,7 @@ static inline struct ast_frame *slin16_sample(void)
|
||||
{
|
||||
static struct ast_frame f = {
|
||||
.frametype = AST_FRAME_VOICE,
|
||||
.subclass = AST_FORMAT_SLINEAR16,
|
||||
.subclass.codec = AST_FORMAT_SLINEAR16,
|
||||
.datalen = sizeof(ex_slin16),
|
||||
.samples = ARRAY_LEN(ex_slin16) / 2,
|
||||
.mallocd = 0,
|
||||
|
||||
@@ -37,8 +37,8 @@ struct ast_slinfactory {
|
||||
short *offset; /*!< Offset into the hold where audio begins */
|
||||
size_t holdlen; /*!< Number of samples currently in the hold */
|
||||
unsigned int size; /*!< Number of samples currently in the factory */
|
||||
unsigned int format; /*!< Current format the translation path is converting from */
|
||||
unsigned int output_format; /*!< The output format desired */
|
||||
format_t format; /*!< Current format the translation path is converting from */
|
||||
format_t output_format; /*!< The output format desired */
|
||||
};
|
||||
|
||||
/*!
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
#ifndef _ASTERISK_TRANSLATE_H
|
||||
#define _ASTERISK_TRANSLATE_H
|
||||
|
||||
#define MAX_AUDIO_FORMAT 15 /* Do not include video here */
|
||||
#define MAX_FORMAT 32 /* Do include video here */
|
||||
#define MAX_AUDIO_FORMAT 47 /* Do not include video here */
|
||||
#define MAX_FORMAT 64 /* Do include video here */
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
extern "C" {
|
||||
@@ -69,51 +69,51 @@ struct ast_trans_pvt; /* declared below */
|
||||
* Generic plc is only available for dstfmt = SLINEAR
|
||||
*/
|
||||
struct ast_translator {
|
||||
const char name[80]; /*!< Name of translator */
|
||||
int srcfmt; /*!< Source format (note: bit position,
|
||||
converted to index during registration) */
|
||||
int dstfmt; /*!< Destination format (note: bit position,
|
||||
converted to index during registration) */
|
||||
const char name[80]; /*!< Name of translator */
|
||||
format_t srcfmt; /*!< Source format (note: bit position,
|
||||
* converted to index during registration) */
|
||||
format_t dstfmt; /*!< Destination format (note: bit position,
|
||||
* converted to index during registration) */
|
||||
|
||||
int (*newpvt)(struct ast_trans_pvt *); /*!< initialize private data
|
||||
associated with the translator */
|
||||
* associated with the translator */
|
||||
|
||||
int (*framein)(struct ast_trans_pvt *pvt, struct ast_frame *in);
|
||||
/*!< Input frame callback. Store
|
||||
(and possibly convert) input frame. */
|
||||
/*!< Input frame callback. Store
|
||||
* (and possibly convert) input frame. */
|
||||
|
||||
struct ast_frame * (*frameout)(struct ast_trans_pvt *pvt);
|
||||
/*!< Output frame callback. Generate a frame
|
||||
with outbuf content. */
|
||||
/*!< Output frame callback. Generate a frame
|
||||
* with outbuf content. */
|
||||
|
||||
void (*destroy)(struct ast_trans_pvt *pvt);
|
||||
/*!< cleanup private data, if needed
|
||||
(often unnecessary). */
|
||||
/*!< cleanup private data, if needed
|
||||
* (often unnecessary). */
|
||||
|
||||
struct ast_frame * (*sample)(void); /*!< Generate an example frame */
|
||||
struct ast_frame * (*sample)(void); /*!< Generate an example frame */
|
||||
|
||||
/*! \brief size of outbuf, in samples. Leave it 0 if you want the framein
|
||||
/*!\brief size of outbuf, in samples. Leave it 0 if you want the framein
|
||||
* callback deal with the frame. Set it appropriately if you
|
||||
* want the code to checks if the incoming frame fits the
|
||||
* outbuf (this is e.g. required for plc).
|
||||
*/
|
||||
int buffer_samples; /*< size of outbuf, in samples */
|
||||
int buffer_samples; /*< size of outbuf, in samples */
|
||||
|
||||
/*! \brief size of outbuf, in bytes. Mandatory. The wrapper code will also
|
||||
* allocate an AST_FRIENDLY_OFFSET space before.
|
||||
*/
|
||||
int buf_size;
|
||||
|
||||
int desc_size; /*!< size of private descriptor in pvt->pvt, if any */
|
||||
int plc_samples; /*!< set to the plc block size if used, 0 otherwise */
|
||||
int useplc; /*!< current status of plc, changed at runtime */
|
||||
int native_plc; /*!< true if the translator can do native plc */
|
||||
int desc_size; /*!< size of private descriptor in pvt->pvt, if any */
|
||||
int plc_samples; /*!< set to the plc block size if used, 0 otherwise */
|
||||
int useplc; /*!< current status of plc, changed at runtime */
|
||||
int native_plc; /*!< true if the translator can do native plc */
|
||||
|
||||
struct ast_module *module; /* opaque reference to the parent module */
|
||||
struct ast_module *module; /*!< opaque reference to the parent module */
|
||||
|
||||
int cost; /*!< Cost in milliseconds for encoding/decoding 1 second of sound */
|
||||
int active; /*!< Whether this translator should be used or not */
|
||||
AST_LIST_ENTRY(ast_translator) list; /*!< link field */
|
||||
int cost; /*!< Cost in milliseconds for encoding/decoding 1 second of sound */
|
||||
int active; /*!< Whether this translator should be used or not */
|
||||
AST_LIST_ENTRY(ast_translator) list; /*!< link field */
|
||||
};
|
||||
|
||||
/*! \brief
|
||||
@@ -205,7 +205,7 @@ void ast_translator_deactivate(struct ast_translator *t);
|
||||
* \return Returns 0 on success, -1 if no path could be found.
|
||||
* \note Modifies dests and srcs in place
|
||||
*/
|
||||
int ast_translator_best_choice(int *dsts, int *srcs);
|
||||
format_t ast_translator_best_choice(format_t *dsts, format_t *srcs);
|
||||
|
||||
/*!
|
||||
* \brief Builds a translator path
|
||||
@@ -214,7 +214,7 @@ int ast_translator_best_choice(int *dsts, int *srcs);
|
||||
* \param source source format
|
||||
* \return ast_trans_pvt on success, NULL on failure
|
||||
* */
|
||||
struct ast_trans_pvt *ast_translator_build_path(int dest, int source);
|
||||
struct ast_trans_pvt *ast_translator_build_path(format_t dest, format_t source);
|
||||
|
||||
/*!
|
||||
* \brief Frees a translator path
|
||||
@@ -240,7 +240,7 @@ struct ast_frame *ast_translate(struct ast_trans_pvt *tr, struct ast_frame *f, i
|
||||
* \param src source format
|
||||
* \return the number of translation steps required, or -1 if no path is available
|
||||
*/
|
||||
unsigned int ast_translate_path_steps(unsigned int dest, unsigned int src);
|
||||
unsigned int ast_translate_path_steps(format_t dest, format_t src);
|
||||
|
||||
/*!
|
||||
* \brief Mask off unavailable formats from a format bitmask
|
||||
@@ -254,7 +254,7 @@ unsigned int ast_translate_path_steps(unsigned int dest, unsigned int src);
|
||||
* \note Only a single audio format and a single video format can be
|
||||
* present in 'src', or the function will produce unexpected results.
|
||||
*/
|
||||
unsigned int ast_translate_available_formats(unsigned int dest, unsigned int src);
|
||||
format_t ast_translate_available_formats(format_t dest, format_t src);
|
||||
|
||||
#if defined(__cplusplus) || defined(c_plusplus)
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Asterisk -- An open source telephony toolkit.
|
||||
*
|
||||
* Copyright (C) 1999 - 2005, Digium, Inc.
|
||||
* Copyright (C) 1999 - 2009, Digium, Inc.
|
||||
*
|
||||
* Mark Spencer <markster@digium.com>
|
||||
*
|
||||
@@ -29,6 +29,12 @@ extern "C" {
|
||||
|
||||
#ifdef __GNUC__
|
||||
/* If we just tell GCC what's going on, we can trust it to behave optimally */
|
||||
static inline uint64_t get_unaligned_uint64(const void *p)
|
||||
{
|
||||
const struct { uint64_t d; } __attribute__((packed)) *pp = p;
|
||||
return pp->d;
|
||||
}
|
||||
|
||||
static inline unsigned int get_unaligned_uint32(const void *p)
|
||||
{
|
||||
const struct { unsigned int d; } __attribute__((packed)) *pp = p;
|
||||
@@ -42,6 +48,13 @@ static inline unsigned short get_unaligned_uint16(const void *p)
|
||||
return pp->d;
|
||||
}
|
||||
|
||||
static inline void put_unaligned_uint64(void *p, uint64_t datum)
|
||||
{
|
||||
struct { uint64_t d; } __attribute__((packed)) *pp = p;
|
||||
|
||||
pp->d = datum;
|
||||
}
|
||||
|
||||
static inline void put_unaligned_uint32(void *p, unsigned int datum)
|
||||
{
|
||||
struct { unsigned int d; } __attribute__((packed)) *pp = p;
|
||||
@@ -56,6 +69,21 @@ static inline void put_unaligned_uint16(void *p, unsigned short datum)
|
||||
pp->d = datum;
|
||||
}
|
||||
#elif defined(SOLARIS) && defined(__sparc__)
|
||||
static inline uint64_t get_unaligned_uint64(const void *p)
|
||||
{
|
||||
const unsigned char *cp = p;
|
||||
|
||||
return
|
||||
(((uint64_t) cp[0]) << 56) |
|
||||
(((uint64_t) cp[1]) << 48) |
|
||||
(((uint64_t) cp[2]) << 40) |
|
||||
(((uint64_t) cp[3]) << 32) |
|
||||
(((uint64_t) cp[4]) << 24) |
|
||||
(((uint64_t) cp[5]) << 16) |
|
||||
(((uint64_t) cp[6]) << 8) |
|
||||
(((uint64_t) cp[7]) << 0);
|
||||
}
|
||||
|
||||
static inline unsigned int get_unaligned_uint32(const void *p)
|
||||
{
|
||||
const unsigned char *cp = p;
|
||||
@@ -70,6 +98,20 @@ static inline unsigned short get_unaligned_uint16(const void *p)
|
||||
return (cp[0] << 8) | cp[1] ;
|
||||
}
|
||||
|
||||
static inline void put_unaligned_uint64(void *p, uint64_t datum)
|
||||
{
|
||||
unsigned char *cp = p;
|
||||
|
||||
cp[0] = (datum >> 56) & 0xff;
|
||||
cp[1] = (datum >> 48) & 0xff;
|
||||
cp[2] = (datum >> 40) & 0xff;
|
||||
cp[3] = (datum >> 32) & 0xff;
|
||||
cp[4] = (datum >> 24) & 0xff;
|
||||
cp[5] = (datum >> 16) & 0xff;
|
||||
cp[6] = (datum >> 8) & 0xff;
|
||||
cp[7] = (datum >> 0) & 0xff;
|
||||
}
|
||||
|
||||
static inline void put_unaligned_uint32(void *p, unsigned int datum)
|
||||
{
|
||||
unsigned char *cp = p;
|
||||
@@ -88,8 +130,10 @@ static inline void put_unaligned_uint16(void *p, unsigned int datum)
|
||||
cp[1] = datum;
|
||||
}
|
||||
#else /* Not GCC, not Solaris/SPARC. Assume we can handle direct load/store. */
|
||||
#define get_unaligned_uint64(p) (*((uint64_t *)(p)))
|
||||
#define get_unaligned_uint32(p) (*((unsigned int *)(p)))
|
||||
#define get_unaligned_uint16(p) (*((unsigned short *)(p)))
|
||||
#define put_unaligned_uint64(p,d) do { uint64_t *__P = (p); *__P = d; } while(0)
|
||||
#define put_unaligned_uint32(p,d) do { unsigned int *__P = (p); *__P = d; } while(0)
|
||||
#define put_unaligned_uint16(p,d) do { unsigned short *__P = (p); *__P = d; } while(0)
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user