Asterisk - The Open Source Telephony Project  18.5.0
Macros | Functions
include/asterisk/format_compatibility.h File Reference

Media Format Bitfield Compatibility API. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define AST_FORMAT_ADPCM   (1ULL << 5)
 
#define AST_FORMAT_ALAW   (1ULL << 3)
 
#define AST_FORMAT_G719   (1ULL << 32)
 
#define AST_FORMAT_G722   (1ULL << 12)
 
#define AST_FORMAT_G723   (1ULL << 0)
 
#define AST_FORMAT_G726   (1ULL << 11)
 
#define AST_FORMAT_G726_AAL2   (1ULL << 4)
 
#define AST_FORMAT_G729   (1ULL << 8)
 
#define AST_FORMAT_GSM   (1ULL << 1)
 
#define AST_FORMAT_H261   (1ULL << 18)
 
#define AST_FORMAT_H263   (1ULL << 19)
 
#define AST_FORMAT_H263P   (1ULL << 20)
 
#define AST_FORMAT_H264   (1ULL << 21)
 
#define AST_FORMAT_ILBC   (1ULL << 10)
 
#define AST_FORMAT_JPEG   (1ULL << 16)
 
#define AST_FORMAT_LPC10   (1ULL << 7)
 
#define AST_FORMAT_MP4   (1ULL << 22)
 
#define AST_FORMAT_OPUS   (1ULL << 34)
 
#define AST_FORMAT_PNG   (1ULL << 17)
 
#define AST_FORMAT_SIREN14   (1ULL << 14)
 
#define AST_FORMAT_SIREN7   (1ULL << 13)
 
#define AST_FORMAT_SLIN   (1ULL << 6)
 
#define AST_FORMAT_SLIN16   (1ULL << 15)
 
#define AST_FORMAT_SPEEX   (1ULL << 9)
 
#define AST_FORMAT_SPEEX16   (1ULL << 33)
 
#define AST_FORMAT_T140   (1ULL << 27)
 
#define AST_FORMAT_T140_RED   (1ULL << 26)
 
#define AST_FORMAT_TESTLAW   (1ULL << 47)
 
#define AST_FORMAT_ULAW   (1ULL << 2)
 
#define AST_FORMAT_VP8   (1ULL << 23)
 

Functions

struct ast_formatast_format_compatibility_bitfield2format (uint64_t bitfield)
 Convert a bitfield to its respective format structure. More...
 
uint64_t ast_format_compatibility_codec2bitfield (const struct ast_codec *codec)
 Convert a codec structure to its respective bitfield. More...
 
uint64_t ast_format_compatibility_format2bitfield (const struct ast_format *format)
 Convert a format structure to its respective bitfield. More...
 

Detailed Description

Media Format Bitfield Compatibility API.

Author
Joshua Colp jcolp[email protected]@dig[email protected]ium.c[email protected]om

Definition in file include/asterisk/format_compatibility.h.

Macro Definition Documentation

◆ AST_FORMAT_ADPCM

#define AST_FORMAT_ADPCM   (1ULL << 5)

◆ AST_FORMAT_ALAW

#define AST_FORMAT_ALAW   (1ULL << 3)

◆ AST_FORMAT_G719

#define AST_FORMAT_G719   (1ULL << 32)

◆ AST_FORMAT_G722

#define AST_FORMAT_G722   (1ULL << 12)

◆ AST_FORMAT_G723

#define AST_FORMAT_G723   (1ULL << 0)

◆ AST_FORMAT_G726

#define AST_FORMAT_G726   (1ULL << 11)

◆ AST_FORMAT_G726_AAL2

#define AST_FORMAT_G726_AAL2   (1ULL << 4)

◆ AST_FORMAT_G729

#define AST_FORMAT_G729   (1ULL << 8)

◆ AST_FORMAT_GSM

#define AST_FORMAT_GSM   (1ULL << 1)

◆ AST_FORMAT_H261

#define AST_FORMAT_H261   (1ULL << 18)

◆ AST_FORMAT_H263

#define AST_FORMAT_H263   (1ULL << 19)

◆ AST_FORMAT_H263P

#define AST_FORMAT_H263P   (1ULL << 20)

◆ AST_FORMAT_H264

#define AST_FORMAT_H264   (1ULL << 21)

◆ AST_FORMAT_ILBC

#define AST_FORMAT_ILBC   (1ULL << 10)

◆ AST_FORMAT_JPEG

#define AST_FORMAT_JPEG   (1ULL << 16)

◆ AST_FORMAT_LPC10

#define AST_FORMAT_LPC10   (1ULL << 7)

◆ AST_FORMAT_MP4

#define AST_FORMAT_MP4   (1ULL << 22)

◆ AST_FORMAT_OPUS

#define AST_FORMAT_OPUS   (1ULL << 34)

◆ AST_FORMAT_PNG

#define AST_FORMAT_PNG   (1ULL << 17)

◆ AST_FORMAT_SIREN14

#define AST_FORMAT_SIREN14   (1ULL << 14)

◆ AST_FORMAT_SIREN7

#define AST_FORMAT_SIREN7   (1ULL << 13)

◆ AST_FORMAT_SLIN

#define AST_FORMAT_SLIN   (1ULL << 6)

◆ AST_FORMAT_SLIN16

#define AST_FORMAT_SLIN16   (1ULL << 15)

◆ AST_FORMAT_SPEEX

#define AST_FORMAT_SPEEX   (1ULL << 9)

◆ AST_FORMAT_SPEEX16

#define AST_FORMAT_SPEEX16   (1ULL << 33)

◆ AST_FORMAT_T140

#define AST_FORMAT_T140   (1ULL << 27)

◆ AST_FORMAT_T140_RED

#define AST_FORMAT_T140_RED   (1ULL << 26)

◆ AST_FORMAT_TESTLAW

#define AST_FORMAT_TESTLAW   (1ULL << 47)

◆ AST_FORMAT_ULAW

#define AST_FORMAT_ULAW   (1ULL << 2)

◆ AST_FORMAT_VP8

#define AST_FORMAT_VP8   (1ULL << 23)

Function Documentation

◆ ast_format_compatibility_bitfield2format()

struct ast_format* ast_format_compatibility_bitfield2format ( uint64_t  bitfield)

Convert a bitfield to its respective format structure.

Parameters
bitfieldThe bitfield for the media format
Return values
non-NULLsuccess
NULLfailure (The format bitfield value is not supported)
Note
The reference count of the returned format is NOT incremented

G.723.1 compression

GSM compression

Raw mu-law data (G.711)

Raw A-law data (G.711)

ADPCM (G.726, 32kbps, AAL2 codeword packing)

ADPCM (IMA)

Raw 16-bit Signed Linear (8000 Hz) PCM

LPC10, 180 samples/frame

G.729A audio

SpeeX Free Compression

iLBC Free Compression

ADPCM (G.726, 32kbps, RFC3551 codeword packing)

G.722

G.722.1 (also known as Siren7, 32kbps assumed)

G.722.1 Annex C (also known as Siren14, 48kbps assumed)

Raw 16-bit Signed Linear (16000 Hz) PCM

G.719 (64 kbps assumed)

SpeeX Wideband (16kHz) Free Compression

Opus audio (8kHz, 16kHz, 24kHz, 48Khz)

Raw mu-law data (G.711)

H.261 Video

H.263 Video

H.263+ Video

H.264 Video

MPEG4 Video

VP8 Video

JPEG Images

PNG Images

T.140 RED Text format RFC 4103

T.140 Text format - ITU T.140, RFC 4103

Definition at line 173 of file main/format_compatibility.c.

References AST_FORMAT_ADPCM, ast_format_adpcm, AST_FORMAT_ALAW, ast_format_alaw, AST_FORMAT_G719, ast_format_g719, AST_FORMAT_G722, ast_format_g722, AST_FORMAT_G723, ast_format_g723, AST_FORMAT_G726, ast_format_g726, AST_FORMAT_G726_AAL2, ast_format_g726_aal2, AST_FORMAT_G729, ast_format_g729, AST_FORMAT_GSM, ast_format_gsm, AST_FORMAT_H261, ast_format_h261, AST_FORMAT_H263, ast_format_h263, AST_FORMAT_H263P, ast_format_h263p, AST_FORMAT_H264, ast_format_h264, AST_FORMAT_ILBC, ast_format_ilbc, AST_FORMAT_JPEG, ast_format_jpeg, AST_FORMAT_LPC10, ast_format_lpc10, AST_FORMAT_MP4, ast_format_mp4, AST_FORMAT_OPUS, ast_format_opus, AST_FORMAT_PNG, ast_format_png, AST_FORMAT_SIREN14, ast_format_siren14, AST_FORMAT_SIREN7, ast_format_siren7, ast_format_slin, AST_FORMAT_SLIN, ast_format_slin16, AST_FORMAT_SLIN16, AST_FORMAT_SPEEX, ast_format_speex, AST_FORMAT_SPEEX16, ast_format_speex16, AST_FORMAT_T140, ast_format_t140, AST_FORMAT_T140_RED, ast_format_t140_red, AST_FORMAT_TESTLAW, ast_format_testlaw, AST_FORMAT_ULAW, ast_format_ulaw, AST_FORMAT_VP8, ast_format_vp8, and NULL.

Referenced by __get_from_jb(), codec_choose_from_prefs(), decode_frame(), iax2_codec_pref_best_bitfield2cap(), iax2_codec_pref_from_bitfield(), iax2_codec_pref_index(), iax2_codec_pref_to_cap(), iax2_format_compatibility_bitfield2cap(), iax2_getformatname(), iax2_send(), socket_process_helper(), and socket_process_meta().

174 {
175  switch (bitfield) {
176  /*! G.723.1 compression */
177  case AST_FORMAT_G723:
178  return ast_format_g723;
179  /*! GSM compression */
180  case AST_FORMAT_GSM:
181  return ast_format_gsm;
182  /*! Raw mu-law data (G.711) */
183  case AST_FORMAT_ULAW:
184  return ast_format_ulaw;
185  /*! Raw A-law data (G.711) */
186  case AST_FORMAT_ALAW:
187  return ast_format_alaw;
188  /*! ADPCM (G.726, 32kbps, AAL2 codeword packing) */
190  return ast_format_g726_aal2;
191  /*! ADPCM (IMA) */
192  case AST_FORMAT_ADPCM:
193  return ast_format_adpcm;
194  /*! Raw 16-bit Signed Linear (8000 Hz) PCM */
195  case AST_FORMAT_SLIN:
196  return ast_format_slin;
197  /*! LPC10, 180 samples/frame */
198  case AST_FORMAT_LPC10:
199  return ast_format_lpc10;
200  /*! G.729A audio */
201  case AST_FORMAT_G729:
202  return ast_format_g729;
203  /*! SpeeX Free Compression */
204  case AST_FORMAT_SPEEX:
205  return ast_format_speex;
206  /*! iLBC Free Compression */
207  case AST_FORMAT_ILBC:
208  return ast_format_ilbc;
209  /*! ADPCM (G.726, 32kbps, RFC3551 codeword packing) */
210  case AST_FORMAT_G726:
211  return ast_format_g726;
212  /*! G.722 */
213  case AST_FORMAT_G722:
214  return ast_format_g722;
215  /*! G.722.1 (also known as Siren7, 32kbps assumed) */
216  case AST_FORMAT_SIREN7:
217  return ast_format_siren7;
218  /*! G.722.1 Annex C (also known as Siren14, 48kbps assumed) */
219  case AST_FORMAT_SIREN14:
220  return ast_format_siren14;
221  /*! Raw 16-bit Signed Linear (16000 Hz) PCM */
222  case AST_FORMAT_SLIN16:
223  return ast_format_slin16;
224  /*! G.719 (64 kbps assumed) */
225  case AST_FORMAT_G719:
226  return ast_format_g719;
227  /*! SpeeX Wideband (16kHz) Free Compression */
228  case AST_FORMAT_SPEEX16:
229  return ast_format_speex16;
230  /*! Opus audio (8kHz, 16kHz, 24kHz, 48Khz) */
231  case AST_FORMAT_OPUS:
232  return ast_format_opus;
233  /*! Raw mu-law data (G.711) */
234  case AST_FORMAT_TESTLAW:
235  return ast_format_testlaw;
236 
237  /*! H.261 Video */
238  case AST_FORMAT_H261:
239  return ast_format_h261;
240  /*! H.263 Video */
241  case AST_FORMAT_H263:
242  return ast_format_h263;
243  /*! H.263+ Video */
244  case AST_FORMAT_H263P:
245  return ast_format_h263p;
246  /*! H.264 Video */
247  case AST_FORMAT_H264:
248  return ast_format_h264;
249  /*! MPEG4 Video */
250  case AST_FORMAT_MP4:
251  return ast_format_mp4;
252  /*! VP8 Video */
253  case AST_FORMAT_VP8:
254  return ast_format_vp8;
255 
256  /*! JPEG Images */
257  case AST_FORMAT_JPEG:
258  return ast_format_jpeg;
259  /*! PNG Images */
260  case AST_FORMAT_PNG:
261  return ast_format_png;
262 
263  /*! T.140 RED Text format RFC 4103 */
264  case AST_FORMAT_T140_RED:
265  return ast_format_t140_red;
266  /*! T.140 Text format - ITU T.140, RFC 4103 */
267  case AST_FORMAT_T140:
268  return ast_format_t140;
269  }
270  return NULL;
271 }
struct ast_format * ast_format_vp8
Built-in cached vp8 format.
Definition: format_cache.c:196
struct ast_format * ast_format_g726
Built-in cached g726 format.
Definition: format_cache.c:116
struct ast_format * ast_format_g723
Built-in cached g723.1 format.
Definition: format_cache.c:151
struct ast_format * ast_format_siren14
Built-in cached siren14 format.
Definition: format_cache.c:216
struct ast_format * ast_format_mp4
Built-in cached mp4 format.
Definition: format_cache.c:191
struct ast_format * ast_format_t140_red
Built-in cached t140 red format.
Definition: format_cache.c:241
struct ast_format * ast_format_ulaw
Built-in cached ulaw format.
Definition: format_cache.c:86
struct ast_format * ast_format_jpeg
Built-in cached jpeg format.
Definition: format_cache.c:206
struct ast_format * ast_format_g726_aal2
Built-in cached g726 aal2 format.
Definition: format_cache.c:121
#define NULL
Definition: resample.c:96
struct ast_format * ast_format_g722
Built-in cached g722 format.
Definition: format_cache.c:111
struct ast_format * ast_format_h261
Built-in cached h261 format.
Definition: format_cache.c:166
struct ast_format * ast_format_g719
Built-in cached g719 format.
Definition: format_cache.c:161
struct ast_format * ast_format_h263p
Built-in cached h263 plus format.
Definition: format_cache.c:176
struct ast_format * ast_format_lpc10
Built-in cached ilbc format.
Definition: format_cache.c:131
struct ast_format * ast_format_opus
Built-in cached opus format.
Definition: format_cache.c:226
struct ast_format * ast_format_gsm
Built-in cached gsm format.
Definition: format_cache.c:101
struct ast_format * ast_format_speex16
Built-in cached speex at 16kHz format.
Definition: format_cache.c:141
struct ast_format * ast_format_png
Built-in cached png format.
Definition: format_cache.c:211
struct ast_format * ast_format_speex
Built-in cached speex format.
Definition: format_cache.c:136
struct ast_format * ast_format_h264
Built-in cached h264 format.
Definition: format_cache.c:181
struct ast_format * ast_format_testlaw
Built-in cached testlaw format.
Definition: format_cache.c:96
struct ast_format * ast_format_siren7
Built-in cached siren7 format.
Definition: format_cache.c:221
struct ast_format * ast_format_alaw
Built-in cached alaw format.
Definition: format_cache.c:91
struct ast_format * ast_format_adpcm
Built-in cached adpcm format.
Definition: format_cache.c:106
struct ast_format * ast_format_slin16
Built-in cached signed linear 16kHz format.
Definition: format_cache.c:51
struct ast_format * ast_format_g729
Built-in cached g729 format.
Definition: format_cache.c:156
struct ast_format * ast_format_t140
Built-in cached t140 format.
Definition: format_cache.c:236
struct ast_format * ast_format_slin
Built-in cached signed linear 8kHz format.
Definition: format_cache.c:41
struct ast_format * ast_format_h263
Built-in cached h263 format.
Definition: format_cache.c:171
struct ast_format * ast_format_ilbc
Built-in cached ilbc format.
Definition: format_cache.c:126

◆ ast_format_compatibility_codec2bitfield()

uint64_t ast_format_compatibility_codec2bitfield ( const struct ast_codec codec)

Convert a codec structure to its respective bitfield.

Parameters
codecThe media codec
Return values
non-zerosuccess
zeroformat not supported

Definition at line 106 of file main/format_compatibility.c.

References AST_FORMAT_ADPCM, ast_format_adpcm, AST_FORMAT_ALAW, ast_format_alaw, AST_FORMAT_G719, ast_format_g719, AST_FORMAT_G722, ast_format_g722, AST_FORMAT_G723, ast_format_g723, AST_FORMAT_G726, ast_format_g726, AST_FORMAT_G726_AAL2, ast_format_g726_aal2, AST_FORMAT_G729, ast_format_g729, ast_format_get_codec_id(), AST_FORMAT_GSM, ast_format_gsm, AST_FORMAT_H261, ast_format_h261, AST_FORMAT_H263, ast_format_h263, AST_FORMAT_H263P, ast_format_h263p, AST_FORMAT_H264, ast_format_h264, AST_FORMAT_ILBC, ast_format_ilbc, AST_FORMAT_JPEG, ast_format_jpeg, AST_FORMAT_LPC10, ast_format_lpc10, AST_FORMAT_MP4, ast_format_mp4, AST_FORMAT_OPUS, ast_format_opus, AST_FORMAT_PNG, ast_format_png, AST_FORMAT_SIREN14, ast_format_siren14, AST_FORMAT_SIREN7, ast_format_siren7, ast_format_slin, AST_FORMAT_SLIN, ast_format_slin16, AST_FORMAT_SLIN16, AST_FORMAT_SPEEX, ast_format_speex, AST_FORMAT_SPEEX16, ast_format_speex16, AST_FORMAT_T140, ast_format_t140, AST_FORMAT_T140_RED, ast_format_t140_red, AST_FORMAT_TESTLAW, ast_format_testlaw, AST_FORMAT_ULAW, ast_format_ulaw, AST_FORMAT_VP8, ast_format_vp8, and ast_codec::id.

107 {
108  if (codec->id == ast_format_get_codec_id(ast_format_g723)) {
109  return AST_FORMAT_G723;
110  } else if (codec->id == ast_format_get_codec_id(ast_format_gsm)) {
111  return AST_FORMAT_GSM;
112  } else if (codec->id == ast_format_get_codec_id(ast_format_ulaw)) {
113  return AST_FORMAT_ULAW;
114  } else if (codec->id == ast_format_get_codec_id(ast_format_alaw)) {
115  return AST_FORMAT_ALAW;
116  } else if (codec->id == ast_format_get_codec_id(ast_format_g726_aal2)) {
117  return AST_FORMAT_G726_AAL2;
118  } else if (codec->id == ast_format_get_codec_id(ast_format_adpcm)) {
119  return AST_FORMAT_ADPCM;
120  } else if (codec->id == ast_format_get_codec_id(ast_format_slin)) {
121  return AST_FORMAT_SLIN;
122  } else if (codec->id == ast_format_get_codec_id(ast_format_lpc10)) {
123  return AST_FORMAT_LPC10;
124  } else if (codec->id == ast_format_get_codec_id(ast_format_g729)) {
125  return AST_FORMAT_G729;
126  } else if (codec->id == ast_format_get_codec_id(ast_format_speex)) {
127  return AST_FORMAT_SPEEX;
128  } else if (codec->id == ast_format_get_codec_id(ast_format_ilbc)) {
129  return AST_FORMAT_ILBC;
130  } else if (codec->id == ast_format_get_codec_id(ast_format_g726)) {
131  return AST_FORMAT_G726;
132  } else if (codec->id == ast_format_get_codec_id(ast_format_g722)) {
133  return AST_FORMAT_G722;
134  } else if (codec->id == ast_format_get_codec_id(ast_format_siren7)) {
135  return AST_FORMAT_SIREN7;
136  } else if (codec->id == ast_format_get_codec_id(ast_format_siren14)) {
137  return AST_FORMAT_SIREN14;
138  } else if (codec->id == ast_format_get_codec_id(ast_format_slin16)) {
139  return AST_FORMAT_SLIN16;
140  } else if (codec->id == ast_format_get_codec_id(ast_format_g719)) {
141  return AST_FORMAT_G719;
142  } else if (codec->id == ast_format_get_codec_id(ast_format_speex16)) {
143  return AST_FORMAT_SPEEX16;
144  } else if (codec->id == ast_format_get_codec_id(ast_format_opus)) {
145  return AST_FORMAT_OPUS;
146  } else if (codec->id == ast_format_get_codec_id(ast_format_testlaw)) {
147  return AST_FORMAT_TESTLAW;
148  } else if (codec->id == ast_format_get_codec_id(ast_format_h261)) {
149  return AST_FORMAT_H261;
150  } else if (codec->id == ast_format_get_codec_id(ast_format_h263)) {
151  return AST_FORMAT_H263;
152  } else if (codec->id == ast_format_get_codec_id(ast_format_h263p)) {
153  return AST_FORMAT_H263P;
154  } else if (codec->id == ast_format_get_codec_id(ast_format_h264)) {
155  return AST_FORMAT_H264;
156  } else if (codec->id == ast_format_get_codec_id(ast_format_mp4)) {
157  return AST_FORMAT_MP4;
158  } else if (codec->id == ast_format_get_codec_id(ast_format_vp8)) {
159  return AST_FORMAT_VP8;
160  } else if (codec->id == ast_format_get_codec_id(ast_format_jpeg)) {
161  return AST_FORMAT_JPEG;
162  } else if (codec->id == ast_format_get_codec_id(ast_format_png)) {
163  return AST_FORMAT_PNG;
164  } else if (codec->id == ast_format_get_codec_id(ast_format_t140_red)) {
165  return AST_FORMAT_T140_RED;
166  } else if (codec->id == ast_format_get_codec_id(ast_format_t140)) {
167  return AST_FORMAT_T140;
168  }
169 
170  return 0;
171 }
struct ast_format * ast_format_vp8
Built-in cached vp8 format.
Definition: format_cache.c:196
struct ast_format * ast_format_g726
Built-in cached g726 format.
Definition: format_cache.c:116
struct ast_format * ast_format_g723
Built-in cached g723.1 format.
Definition: format_cache.c:151
struct ast_format * ast_format_siren14
Built-in cached siren14 format.
Definition: format_cache.c:216
struct ast_format * ast_format_mp4
Built-in cached mp4 format.
Definition: format_cache.c:191
struct ast_format * ast_format_t140_red
Built-in cached t140 red format.
Definition: format_cache.c:241
unsigned int id
Internal unique identifier for this codec, set at registration time (starts at 1) ...
Definition: codec.h:44
struct ast_format * ast_format_ulaw
Built-in cached ulaw format.
Definition: format_cache.c:86
struct ast_format * ast_format_jpeg
Built-in cached jpeg format.
Definition: format_cache.c:206
struct ast_format * ast_format_g726_aal2
Built-in cached g726 aal2 format.
Definition: format_cache.c:121
struct ast_format * ast_format_g722
Built-in cached g722 format.
Definition: format_cache.c:111
struct ast_format * ast_format_h261
Built-in cached h261 format.
Definition: format_cache.c:166
struct ast_format * ast_format_g719
Built-in cached g719 format.
Definition: format_cache.c:161
struct ast_format * ast_format_h263p
Built-in cached h263 plus format.
Definition: format_cache.c:176
struct ast_format * ast_format_lpc10
Built-in cached ilbc format.
Definition: format_cache.c:131
struct ast_format * ast_format_opus
Built-in cached opus format.
Definition: format_cache.c:226
struct ast_format * ast_format_gsm
Built-in cached gsm format.
Definition: format_cache.c:101
struct ast_format * ast_format_speex16
Built-in cached speex at 16kHz format.
Definition: format_cache.c:141
struct ast_format * ast_format_png
Built-in cached png format.
Definition: format_cache.c:211
struct ast_format * ast_format_speex
Built-in cached speex format.
Definition: format_cache.c:136
struct ast_format * ast_format_h264
Built-in cached h264 format.
Definition: format_cache.c:181
struct ast_format * ast_format_testlaw
Built-in cached testlaw format.
Definition: format_cache.c:96
struct ast_format * ast_format_siren7
Built-in cached siren7 format.
Definition: format_cache.c:221
struct ast_format * ast_format_alaw
Built-in cached alaw format.
Definition: format_cache.c:91
struct ast_format * ast_format_adpcm
Built-in cached adpcm format.
Definition: format_cache.c:106
struct ast_format * ast_format_slin16
Built-in cached signed linear 16kHz format.
Definition: format_cache.c:51
struct ast_format * ast_format_g729
Built-in cached g729 format.
Definition: format_cache.c:156
struct ast_format * ast_format_t140
Built-in cached t140 format.
Definition: format_cache.c:236
struct ast_format * ast_format_slin
Built-in cached signed linear 8kHz format.
Definition: format_cache.c:41
struct ast_format * ast_format_h263
Built-in cached h263 format.
Definition: format_cache.c:171
unsigned int ast_format_get_codec_id(const struct ast_format *format)
Get the codec identifier associated with a format.
Definition: format.c:329
struct ast_format * ast_format_ilbc
Built-in cached ilbc format.
Definition: format_cache.c:126

◆ ast_format_compatibility_format2bitfield()

uint64_t ast_format_compatibility_format2bitfield ( const struct ast_format format)

Convert a format structure to its respective bitfield.

Parameters
formatThe media format
Return values
non-zerosuccess
zeroformat not supported

Definition at line 39 of file main/format_compatibility.c.

References AST_FORMAT_ADPCM, ast_format_adpcm, AST_FORMAT_ALAW, ast_format_alaw, ast_format_cmp(), AST_FORMAT_CMP_EQUAL, AST_FORMAT_G719, ast_format_g719, AST_FORMAT_G722, ast_format_g722, AST_FORMAT_G723, ast_format_g723, AST_FORMAT_G726, ast_format_g726, AST_FORMAT_G726_AAL2, ast_format_g726_aal2, AST_FORMAT_G729, ast_format_g729, AST_FORMAT_GSM, ast_format_gsm, AST_FORMAT_H261, ast_format_h261, AST_FORMAT_H263, ast_format_h263, AST_FORMAT_H263P, ast_format_h263p, AST_FORMAT_H264, ast_format_h264, AST_FORMAT_ILBC, ast_format_ilbc, AST_FORMAT_JPEG, ast_format_jpeg, AST_FORMAT_LPC10, ast_format_lpc10, AST_FORMAT_MP4, ast_format_mp4, AST_FORMAT_OPUS, ast_format_opus, AST_FORMAT_PNG, ast_format_png, AST_FORMAT_SIREN14, ast_format_siren14, AST_FORMAT_SIREN7, ast_format_siren7, ast_format_slin, AST_FORMAT_SLIN, ast_format_slin16, AST_FORMAT_SLIN16, AST_FORMAT_SPEEX, ast_format_speex, AST_FORMAT_SPEEX16, ast_format_speex16, AST_FORMAT_T140, ast_format_t140, AST_FORMAT_T140_RED, ast_format_t140_red, AST_FORMAT_TESTLAW, ast_format_testlaw, AST_FORMAT_ULAW, ast_format_ulaw, AST_FORMAT_VP8, and ast_format_vp8.

Referenced by conf_run(), iax2_codec_choose(), iax2_codec_pref_append(), iax2_codec_pref_prepend(), iax2_format_compatibility_cap2bitfield(), iax2_send(), iax_template_parse(), phone_write(), and socket_process_helper().

40 {
42  return AST_FORMAT_G723;
43  } else if (ast_format_cmp(format, ast_format_gsm) == AST_FORMAT_CMP_EQUAL) {
44  return AST_FORMAT_GSM;
45  } else if (ast_format_cmp(format, ast_format_ulaw) == AST_FORMAT_CMP_EQUAL) {
46  return AST_FORMAT_ULAW;
47  } else if (ast_format_cmp(format, ast_format_alaw) == AST_FORMAT_CMP_EQUAL) {
48  return AST_FORMAT_ALAW;
50  return AST_FORMAT_G726_AAL2;
51  } else if (ast_format_cmp(format, ast_format_adpcm) == AST_FORMAT_CMP_EQUAL) {
52  return AST_FORMAT_ADPCM;
53  } else if (ast_format_cmp(format, ast_format_slin) == AST_FORMAT_CMP_EQUAL) {
54  return AST_FORMAT_SLIN;
55  } else if (ast_format_cmp(format, ast_format_lpc10) == AST_FORMAT_CMP_EQUAL) {
56  return AST_FORMAT_LPC10;
57  } else if (ast_format_cmp(format, ast_format_g729) == AST_FORMAT_CMP_EQUAL) {
58  return AST_FORMAT_G729;
59  } else if (ast_format_cmp(format, ast_format_speex) == AST_FORMAT_CMP_EQUAL) {
60  return AST_FORMAT_SPEEX;
61  } else if (ast_format_cmp(format, ast_format_ilbc) == AST_FORMAT_CMP_EQUAL) {
62  return AST_FORMAT_ILBC;
63  } else if (ast_format_cmp(format, ast_format_g726) == AST_FORMAT_CMP_EQUAL) {
64  return AST_FORMAT_G726;
65  } else if (ast_format_cmp(format, ast_format_g722) == AST_FORMAT_CMP_EQUAL) {
66  return AST_FORMAT_G722;
67  } else if (ast_format_cmp(format, ast_format_siren7) == AST_FORMAT_CMP_EQUAL) {
68  return AST_FORMAT_SIREN7;
70  return AST_FORMAT_SIREN14;
71  } else if (ast_format_cmp(format, ast_format_slin16) == AST_FORMAT_CMP_EQUAL) {
72  return AST_FORMAT_SLIN16;
73  } else if (ast_format_cmp(format, ast_format_g719) == AST_FORMAT_CMP_EQUAL) {
74  return AST_FORMAT_G719;
76  return AST_FORMAT_SPEEX16;
77  } else if (ast_format_cmp(format, ast_format_opus) == AST_FORMAT_CMP_EQUAL) {
78  return AST_FORMAT_OPUS;
80  return AST_FORMAT_TESTLAW;
81  } else if (ast_format_cmp(format, ast_format_h261) == AST_FORMAT_CMP_EQUAL) {
82  return AST_FORMAT_H261;
83  } else if (ast_format_cmp(format, ast_format_h263) == AST_FORMAT_CMP_EQUAL) {
84  return AST_FORMAT_H263;
85  } else if (ast_format_cmp(format, ast_format_h263p) == AST_FORMAT_CMP_EQUAL) {
86  return AST_FORMAT_H263P;
87  } else if (ast_format_cmp(format, ast_format_h264) == AST_FORMAT_CMP_EQUAL) {
88  return AST_FORMAT_H264;
89  } else if (ast_format_cmp(format, ast_format_mp4) == AST_FORMAT_CMP_EQUAL) {
90  return AST_FORMAT_MP4;
91  } else if (ast_format_cmp(format, ast_format_vp8) == AST_FORMAT_CMP_EQUAL) {
92  return AST_FORMAT_VP8;
93  } else if (ast_format_cmp(format, ast_format_jpeg) == AST_FORMAT_CMP_EQUAL) {
94  return AST_FORMAT_JPEG;
95  } else if (ast_format_cmp(format, ast_format_png) == AST_FORMAT_CMP_EQUAL) {
96  return AST_FORMAT_PNG;
98  return AST_FORMAT_T140_RED;
99  } else if (ast_format_cmp(format, ast_format_t140) == AST_FORMAT_CMP_EQUAL) {
100  return AST_FORMAT_T140;
101  }
102 
103  return 0;
104 }
struct ast_format * ast_format_vp8
Built-in cached vp8 format.
Definition: format_cache.c:196
struct ast_format * ast_format_g726
Built-in cached g726 format.
Definition: format_cache.c:116
struct ast_format * ast_format_g723
Built-in cached g723.1 format.
Definition: format_cache.c:151
struct ast_format * ast_format_siren14
Built-in cached siren14 format.
Definition: format_cache.c:216
struct ast_format * ast_format_mp4
Built-in cached mp4 format.
Definition: format_cache.c:191
struct ast_format * ast_format_t140_red
Built-in cached t140 red format.
Definition: format_cache.c:241
struct ast_format * ast_format_ulaw
Built-in cached ulaw format.
Definition: format_cache.c:86
struct ast_format * ast_format_jpeg
Built-in cached jpeg format.
Definition: format_cache.c:206
struct ast_format * ast_format_g726_aal2
Built-in cached g726 aal2 format.
Definition: format_cache.c:121
struct ast_format * ast_format_g722
Built-in cached g722 format.
Definition: format_cache.c:111
struct ast_format * ast_format_h261
Built-in cached h261 format.
Definition: format_cache.c:166
struct ast_format * ast_format_g719
Built-in cached g719 format.
Definition: format_cache.c:161
struct ast_format * ast_format_h263p
Built-in cached h263 plus format.
Definition: format_cache.c:176
struct ast_format * ast_format_lpc10
Built-in cached ilbc format.
Definition: format_cache.c:131
enum ast_format_cmp_res ast_format_cmp(const struct ast_format *format1, const struct ast_format *format2)
Compare two formats.
Definition: format.c:201
struct ast_format * ast_format_opus
Built-in cached opus format.
Definition: format_cache.c:226
struct ast_format * ast_format_gsm
Built-in cached gsm format.
Definition: format_cache.c:101
struct ast_format * ast_format_speex16
Built-in cached speex at 16kHz format.
Definition: format_cache.c:141
struct ast_format * ast_format_png
Built-in cached png format.
Definition: format_cache.c:211
struct ast_format * ast_format_speex
Built-in cached speex format.
Definition: format_cache.c:136
struct ast_format * ast_format_h264
Built-in cached h264 format.
Definition: format_cache.c:181
struct ast_format * ast_format_testlaw
Built-in cached testlaw format.
Definition: format_cache.c:96
struct ast_format * ast_format_siren7
Built-in cached siren7 format.
Definition: format_cache.c:221
struct ast_format * ast_format_alaw
Built-in cached alaw format.
Definition: format_cache.c:91
struct ast_format * ast_format_adpcm
Built-in cached adpcm format.
Definition: format_cache.c:106
struct ast_format * ast_format_slin16
Built-in cached signed linear 16kHz format.
Definition: format_cache.c:51
struct ast_format * ast_format_g729
Built-in cached g729 format.
Definition: format_cache.c:156
struct ast_format * ast_format_t140
Built-in cached t140 format.
Definition: format_cache.c:236
struct ast_format * ast_format_slin
Built-in cached signed linear 8kHz format.
Definition: format_cache.c:41
struct ast_format * ast_format_h263
Built-in cached h263 format.
Definition: format_cache.c:171
struct ast_format * ast_format_ilbc
Built-in cached ilbc format.
Definition: format_cache.c:126