79 int pos = 0, samples = 0, res;
81 while(pos < frame->datalen) {
94 return (samples / 240) * 20;
99 .description =
"G.723.1",
113 return 160 * (frame->
datalen / 6);
118 return (samples / 160) * 6;
123 .description =
"Codec 2",
146 .description =
"<Null> codec",
169 .description =
"G.711 u-law",
184 .description =
"G.711 a-law",
199 return 160 * (frame->
datalen / 33);
204 return (samples / 160) * 33;
209 .description =
"GSM",
234 .description =
"G.726 RFC3551",
249 .description =
"G.726 AAL2",
264 .description =
"Dialogic ADPCM",
289 .description =
"16 bit Signed Linear PCM",
295 .minimum_bytes = 160,
305 .description =
"16 bit Signed Linear PCM (12kHz)",
307 .sample_rate = 12000,
311 .minimum_bytes = 240,
321 .description =
"16 bit Signed Linear PCM (16kHz)",
323 .sample_rate = 16000,
327 .minimum_bytes = 320,
337 .description =
"16 bit Signed Linear PCM (24kHz)",
339 .sample_rate = 24000,
343 .minimum_bytes = 480,
353 .description =
"16 bit Signed Linear PCM (32kHz)",
355 .sample_rate = 32000,
359 .minimum_bytes = 640,
369 .description =
"16 bit Signed Linear PCM (44kHz)",
371 .sample_rate = 44100,
375 .minimum_bytes = 882,
385 .description =
"16 bit Signed Linear PCM (48kHz)",
387 .sample_rate = 48000,
391 .minimum_bytes = 960,
401 .description =
"16 bit Signed Linear PCM (96kHz)",
403 .sample_rate = 96000,
407 .minimum_bytes = 1920,
417 .description =
"16 bit Signed Linear PCM (192kHz)",
419 .sample_rate = 192000,
423 .minimum_bytes = 3840,
433 int samples = 22 * 8;
436 samples += (((
char *)(frame->
data.
ptr))[7] & 0x1) * 8;
443 .description =
"LPC10",
467 .description =
"G.729A",
484 int rem = 8 - (bit % 8);
485 unsigned char ret = 0;
491 ret = (data[byte] << (n - rem));
492 ret |= (data[
byte + 1] >> (8 - n + rem));
494 ret = (data[byte] >> (rem - n));
497 return (ret & (0xff >> (8 - n)));
502 static const int SpeexWBSubModeSz[] = {
509 if (((
len * 8 - off) >= 5) &&
512 off += SpeexWBSubModeSz[
c];
514 if (((
len * 8 - off) >= 5) &&
517 off += SpeexWBSubModeSz[
c];
519 if (((
len * 8 - off) >= 5) &&
521 ast_log(
LOG_WARNING,
"Encountered corrupt speex frame; too many wideband frames in a row.\n");
532 static const int SpeexSubModeSz[] = {
537 static const int SpeexInBandSz[] = {
547 while ((
len * 8 - bit) >= 5) {
556 if ((
len * 8 - bit) < 5)
566 }
else if (
c == 14) {
570 bit += SpeexInBandSz[
c];
571 }
else if (
c == 13) {
583 bit += SpeexSubModeSz[
c] - 5;
597 .description =
"SpeeX",
615 .description =
"SpeeX 16khz",
617 .sample_rate = 16000,
633 .description =
"SpeeX 32khz",
635 .sample_rate = 32000,
647 const unsigned int mode = attr ? attr->
mode : 30;
649 const unsigned int octets_per_frame = (
mode == 20) ? 38 : 50;
651 return samples_per_frame * frame->
datalen / octets_per_frame;
656 .description =
"iLBC",
670 .description =
"G722",
672 .sample_rate = 16000,
685 return frame->
datalen * (16000 / 4000);
690 return samples / (16000 / 4000);
695 .description =
"ITU G.722.1 (Siren7, licensed from Polycom)",
697 .sample_rate = 16000,
709 return (
int) frame->
datalen * ((float) 32000 / 6000);
714 return (
int) samples / ((float) 32000 / 6000);;
719 .description =
"ITU G.722.1 Annex C, (Siren14, licensed from Polycom)",
721 .sample_rate = 32000,
725 .minimum_bytes = 120,
733 return (
int) frame->
datalen * ((float) 48000 / 8000);
738 return (
int) samples / ((float) 48000 / 8000);
743 .description =
"ITU G.719",
745 .sample_rate = 48000,
749 .minimum_bytes = 160,
772 .description =
"Opus Codec",
774 .sample_rate = 48000,
785 .description =
"JPEG image",
791 .description =
"PNG Image",
797 .description =
"H.261 video",
804 .description =
"H.263 video",
811 .description =
"H.263+ video",
818 .description =
"H.264 video",
825 .description =
"H.265 video",
832 .description =
"MPEG4 video",
839 .description =
"VP8 video",
846 .description =
"VP9 video",
853 .description =
"T.140 Realtime Text with redundancy",
859 .description =
"Passthrough T.140 Realtime Text",
865 .description =
"T.38 UDPTL Fax",
882 .description =
"SILK Codec (8 KHz)",
888 .minimum_bytes = 160,
894 .description =
"SILK Codec (12 KHz)",
896 .sample_rate = 12000,
900 .minimum_bytes = 240,
906 .description =
"SILK Codec (16 KHz)",
908 .sample_rate = 16000,
912 .minimum_bytes = 320,
918 .description =
"SILK Codec (24 KHz)",
920 .sample_rate = 24000,
924 .minimum_bytes = 480,
928#define CODEC_REGISTER_AND_CACHE(codec) \
930 int __res_ ## __LINE__ = 0; \
931 struct ast_format *__fmt_ ## __LINE__; \
932 struct ast_codec *__codec_ ## __LINE__; \
933 res |= __ast_codec_register_with_format(&(codec), (codec).name, NULL); \
934 __codec_ ## __LINE__ = ast_codec_get((codec).name, (codec).type, (codec).sample_rate); \
935 __fmt_ ## __LINE__ = __codec_ ## __LINE__ ? ast_format_create(__codec_ ## __LINE__) : NULL; \
936 res |= ast_format_cache_set(__fmt_ ## __LINE__); \
937 ao2_ref(__fmt_ ## __LINE__, -1); \
938 ao2_ref(__codec_ ## __LINE__, -1); \
939 __res_ ## __LINE__; \
942#define CODEC_REGISTER_AND_CACHE_NAMED(fmt_name, codec) \
944 int __res_ ## __LINE__ = 0; \
945 struct ast_format *__fmt_ ## __LINE__; \
946 struct ast_codec *__codec_ ## __LINE__; \
947 res |= __ast_codec_register_with_format(&(codec), fmt_name, NULL); \
948 __codec_ ## __LINE__ = ast_codec_get((codec).name, (codec).type, (codec).sample_rate); \
949 __fmt_ ## __LINE__ = ast_format_create_named((fmt_name), __codec_ ## __LINE__); \
950 res |= ast_format_cache_set(__fmt_ ## __LINE__); \
951 ao2_ref(__fmt_ ## __LINE__, -1); \
952 ao2_ref(__codec_ ## __LINE__, -1); \
953 __res_ ## __LINE__; \
Asterisk main include file. File version handling, generic pbx functions.
static int silk_samples(struct ast_frame *frame)
static int ulaw_length(unsigned int samples)
static struct ast_codec g722
static int g723_samples(struct ast_frame *frame)
static struct ast_codec codec2
static int speex_get_wb_sz_at(unsigned char *data, int len, int bit)
static int slin_length(unsigned int samples)
static struct ast_codec jpeg
static struct ast_codec t38
static int ulaw_samples(struct ast_frame *frame)
static int speex32_samples(struct ast_frame *frame)
static struct ast_codec siren7
static struct ast_codec silk16
static int g719_samples(struct ast_frame *frame)
static int none_length(unsigned int samples)
static struct ast_codec h263p
static int speex8_samples(struct ast_frame *frame)
static int codec2_length(unsigned int samples)
static int siren7_samples(struct ast_frame *frame)
static unsigned char get_n_bits_at(unsigned char *data, int n, int bit)
static struct ast_codec h263
static struct ast_codec ulaw
static struct ast_codec silk24
static int slin_samples(struct ast_frame *frame)
static struct ast_codec slin16
static struct ast_codec siren14
static int lpc10_samples(struct ast_frame *frame)
static struct ast_codec adpcm
static struct ast_codec silk8
static int g729_samples(struct ast_frame *frame)
static int g723_len(unsigned char buf)
static struct ast_codec g723
static struct ast_codec g729a
static int g719_length(unsigned int samples)
static struct ast_codec slin32
static struct ast_codec h265
static struct ast_codec lpc10
int __ast_codec_register_with_format(struct ast_codec *codec, const char *format_name, struct ast_module *mod)
static struct ast_codec vp8
static struct ast_codec slin192
static struct ast_codec g726rfc3551
static int speex16_samples(struct ast_frame *frame)
static struct ast_codec none
static struct ast_codec g719
static struct ast_codec t140
static struct ast_codec ilbc
static struct ast_codec t140red
static int g723_length(unsigned int samples)
static int gsm_samples(struct ast_frame *frame)
static struct ast_codec mpeg4
static struct ast_codec slin48
static struct ast_codec speex8
static int ilbc_samples(struct ast_frame *frame)
static struct ast_codec g726aal2
static struct ast_codec png
static struct ast_codec slin24
static int none_samples(struct ast_frame *frame)
#define CODEC_REGISTER_AND_CACHE(codec)
static struct ast_codec speex32
static struct ast_codec speex16
static int siren14_length(unsigned int samples)
static struct ast_codec slin8
static int g726_length(unsigned int samples)
static int gsm_length(unsigned int samples)
static struct ast_codec alaw
static struct ast_codec h261
static int g729_length(unsigned int samples)
static struct ast_codec slin12
static struct ast_codec vp9
int ast_codec_builtin_init(void)
Initialize built-in codecs within the core.
static int speex_samples(unsigned char *data, int len)
static int g726_samples(struct ast_frame *frame)
static struct ast_codec opus
static struct ast_codec h264
static struct ast_codec silk12
static struct ast_codec slin96
#define CODEC_REGISTER_AND_CACHE_NAMED(fmt_name, codec)
static int siren14_samples(struct ast_frame *frame)
static int siren7_length(unsigned int samples)
static int opus_samples(struct ast_frame *frame)
static struct ast_codec slin44
static int codec2_samples(struct ast_frame *frame)
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
Asterisk internal frame definitions.
Support for logging to various files, console and syslog Configuration in file logger....
Asterisk internal frame definitions.
#define AST_SMOOTHER_FLAG_G729
#define AST_SMOOTHER_FLAG_FORCED
#define AST_SMOOTHER_FLAG_BE
Represents a media codec within Asterisk.
const char * name
Name for this codec.
struct ast_format * format
Data structure associated with a single frame of data.
struct ast_frame_subclass subclass
union ast_frame::@226 data