Asterisk - The Open Source Telephony Project GIT-master-27fb039
Loading...
Searching...
No Matches
Macros | Enumerations | Functions | Variables
codec_builtin.c File Reference

Built-in supported codecs. More...

#include "asterisk.h"
#include "asterisk/ilbc.h"
#include "asterisk/logger.h"
#include "asterisk/astobj2.h"
#include "asterisk/codec.h"
#include "asterisk/format.h"
#include "asterisk/format_cache.h"
#include "asterisk/frame.h"
#include "asterisk/smoother.h"
Include dependency graph for codec_builtin.c:

Go to the source code of this file.

Macros

#define CODEC_REGISTER_AND_CACHE(codec)
 
#define CODEC_REGISTER_AND_CACHE_NAMED(fmt_name, codec)
 
#define TYPE_MASK   0x3
 

Enumerations

enum  frame_type { TYPE_HIGH , TYPE_LOW , TYPE_SILENCE , TYPE_DONTSEND }
 

Functions

int __ast_codec_register_with_format (struct ast_codec *codec, const char *format_name, struct ast_module *mod)
 
int ast_codec_builtin_init (void)
 Initialize built-in codecs within the core.
 
static int codec2_length (unsigned int samples)
 
static int codec2_samples (struct ast_frame *frame)
 
static int g719_length (unsigned int samples)
 
static int g719_samples (struct ast_frame *frame)
 
static int g723_len (unsigned char buf)
 
static int g723_length (unsigned int samples)
 
static int g723_samples (struct ast_frame *frame)
 
static int g726_length (unsigned int samples)
 
static int g726_samples (struct ast_frame *frame)
 
static int g729_length (unsigned int samples)
 
static int g729_samples (struct ast_frame *frame)
 
static unsigned char get_n_bits_at (unsigned char *data, int n, int bit)
 
static int gsm_length (unsigned int samples)
 
static int gsm_samples (struct ast_frame *frame)
 
static int ilbc_samples (struct ast_frame *frame)
 
static int lpc10_samples (struct ast_frame *frame)
 
static int none_length (unsigned int samples)
 
static int none_samples (struct ast_frame *frame)
 
static int opus_samples (struct ast_frame *frame)
 
static int silk_samples (struct ast_frame *frame)
 
static int siren14_length (unsigned int samples)
 
static int siren14_samples (struct ast_frame *frame)
 
static int siren7_length (unsigned int samples)
 
static int siren7_samples (struct ast_frame *frame)
 
static int slin_length (unsigned int samples)
 
static int slin_samples (struct ast_frame *frame)
 
static int speex16_samples (struct ast_frame *frame)
 
static int speex32_samples (struct ast_frame *frame)
 
static int speex8_samples (struct ast_frame *frame)
 
static int speex_get_wb_sz_at (unsigned char *data, int len, int bit)
 
static int speex_samples (unsigned char *data, int len)
 
static int ulaw_length (unsigned int samples)
 
static int ulaw_samples (struct ast_frame *frame)
 

Variables

static struct ast_codec adpcm
 
static struct ast_codec alaw
 
static struct ast_codec codec2
 
static struct ast_codec g719
 
static struct ast_codec g722
 
static struct ast_codec g723
 
static struct ast_codec g726aal2
 
static struct ast_codec g726rfc3551
 
static struct ast_codec g729a
 
static struct ast_codec gsm
 
static struct ast_codec h261
 
static struct ast_codec h263
 
static struct ast_codec h263p
 
static struct ast_codec h264
 
static struct ast_codec h265
 
static struct ast_codec ilbc
 
static struct ast_codec jpeg
 
static struct ast_codec lpc10
 
static struct ast_codec mpeg4
 
static struct ast_codec none
 
static struct ast_codec opus
 
static struct ast_codec png
 
static struct ast_codec silk12
 
static struct ast_codec silk16
 
static struct ast_codec silk24
 
static struct ast_codec silk8
 
static struct ast_codec siren14
 
static struct ast_codec siren7
 
static struct ast_codec slin12
 
static struct ast_codec slin16
 
static struct ast_codec slin192
 
static struct ast_codec slin24
 
static struct ast_codec slin32
 
static struct ast_codec slin44
 
static struct ast_codec slin48
 
static struct ast_codec slin8
 
static struct ast_codec slin96
 
static struct ast_codec speex16
 
static struct ast_codec speex32
 
static struct ast_codec speex8
 
static struct ast_codec t140
 
static struct ast_codec t140red
 
static struct ast_codec t38
 
static struct ast_codec ulaw
 
static struct ast_codec vp8
 
static struct ast_codec vp9
 

Detailed Description

Built-in supported codecs.

Author
Joshua Colp jcolp.nosp@m.@dig.nosp@m.ium.c.nosp@m.om

Definition in file codec_builtin.c.

Macro Definition Documentation

◆ CODEC_REGISTER_AND_CACHE

#define CODEC_REGISTER_AND_CACHE (   codec)

Definition at line 928 of file codec_builtin.c.

929 { \
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__; \
940 })
static const char type[]
struct ast_codec * ast_codec_get(const char *name, enum ast_media_type type, unsigned int sample_rate)
Retrieve a codec given a name, type, and sample rate.
Definition codec.c:327
int __ast_codec_register_with_format(struct ast_codec *codec, const char *format_name, struct ast_module *mod)
Definition codec.c:278
struct ast_format * ast_format_create(struct ast_codec *codec)
Create a new media format.
Definition format.c:196
int ast_format_cache_set(struct ast_format *format)
Set a named format cache entry.
static const char name[]
Definition format_mp3.c:68
#define NULL
Definition resample.c:96
Represents a media codec within Asterisk.
Definition codec.h:42
unsigned int sample_rate
Sample rate (number of samples carried in a second)
Definition codec.h:52
Definition of a media format.
Definition format.c:43

◆ CODEC_REGISTER_AND_CACHE_NAMED

#define CODEC_REGISTER_AND_CACHE_NAMED (   fmt_name,
  codec 
)

Definition at line 942 of file codec_builtin.c.

943 { \
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__; \
954 })
struct ast_format * ast_format_create_named(const char *format_name, struct ast_codec *codec)
Create a new media format with a specific name.
Definition format.c:157

◆ TYPE_MASK

#define TYPE_MASK   0x3

Definition at line 51 of file codec_builtin.c.

Enumeration Type Documentation

◆ frame_type

enum frame_type
Enumerator
TYPE_HIGH 
TYPE_LOW 
TYPE_SILENCE 
TYPE_DONTSEND 

Definition at line 44 of file codec_builtin.c.

44 {
45 TYPE_HIGH, /* 0x0 */
46 TYPE_LOW, /* 0x1 */
47 TYPE_SILENCE, /* 0x2 */
48 TYPE_DONTSEND /* 0x3 */
49};
@ TYPE_LOW
@ TYPE_SILENCE
@ TYPE_HIGH
@ TYPE_DONTSEND

Function Documentation

◆ __ast_codec_register_with_format()

int __ast_codec_register_with_format ( struct ast_codec codec,
const char *  format_name,
struct ast_module mod 
)

Definition at line 278 of file codec.c.

279{
281 struct internal_ast_codec *codec_new;
282
283 /* Some types have specific requirements */
284 if (codec->type == AST_MEDIA_TYPE_UNKNOWN) {
285 ast_log(LOG_ERROR, "A media type must be specified for codec '%s'\n", codec->name);
286 return -1;
287 } else if (codec->type == AST_MEDIA_TYPE_AUDIO) {
288 if (!codec->sample_rate) {
289 ast_log(LOG_ERROR, "A sample rate must be specified for codec '%s' of type '%s'\n",
290 codec->name, ast_codec_media_type2str(codec->type));
291 return -1;
292 }
293 }
294
295 codec_new = ao2_find(codecs, codec, OBJ_SEARCH_OBJECT | OBJ_NOLOCK);
296 if (codec_new) {
297 ast_log(LOG_ERROR, "A codec with name '%s' of type '%s' and sample rate '%u' is already registered\n",
298 codec->name, ast_codec_media_type2str(codec->type), codec->sample_rate);
299 ao2_ref(codec_new, -1);
300 return -1;
301 }
302
303 codec_new = ao2_t_alloc_options(sizeof(*codec_new), codec_dtor,
305 if (!codec_new) {
306 ast_log(LOG_ERROR, "Could not allocate a codec with name '%s' of type '%s' and sample rate '%u'\n",
307 codec->name, ast_codec_media_type2str(codec->type), codec->sample_rate);
308 return -1;
309 }
310 codec_new->external = *codec;
311 codec_new->format_name = format_name;
312 codec_new->external.id = codec_id++;
313
314 ao2_link_flags(codecs, codec_new, OBJ_NOLOCK);
315
316 /* Once registered a codec can not be unregistered, and the module must persist until shutdown */
318
319 ast_verb(5, "Registered '%s' codec '%s' at sample rate '%u' with id '%u'\n",
320 ast_codec_media_type2str(codec->type), codec->name, codec->sample_rate, codec_new->external.id);
321
322 ao2_ref(codec_new, -1);
323
324 return 0;
325}
ast_mutex_t lock
Definition app_sla.c:337
#define ast_log
Definition astobj2.c:42
@ AO2_ALLOC_OPT_LOCK_NOLOCK
Definition astobj2.h:367
#define ao2_link_flags(container, obj, flags)
Add an object to a container.
Definition astobj2.h:1554
#define ao2_t_alloc_options(data_size, destructor_fn, options, debug_msg)
Allocate and initialize an object.
Definition astobj2.h:402
#define ao2_find(container, arg, flags)
Definition astobj2.h:1736
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
Definition astobj2.h:459
@ OBJ_SEARCH_OBJECT
The arg parameter is an object of the same type.
Definition astobj2.h:1087
@ OBJ_NOLOCK
Assume that the ao2_container is already locked.
Definition astobj2.h:1063
static int codec_id
Current identifier value for newly registered codec.
Definition codec.c:45
static struct ao2_container * codecs
Registered codecs.
Definition codec.c:48
const char * ast_codec_media_type2str(enum ast_media_type type)
Conversion function to take a media type and turn it into a string.
Definition codec.c:348
static void codec_dtor(void *obj)
Definition codec.c:264
@ AST_MEDIA_TYPE_AUDIO
Definition codec.h:32
@ AST_MEDIA_TYPE_UNKNOWN
Definition codec.h:31
#define LOG_ERROR
#define ast_verb(level,...)
#define SCOPED_AO2WRLOCK(varname, obj)
scoped lock specialization for ao2 write locks.
Definition lock.h:621
#define ast_module_shutdown_ref(mod)
Prevent unload of the module before shutdown.
Definition module.h:478
#define S_OR(a, b)
returns the equivalent of logic or for strings: first one if not empty, otherwise second one.
Definition strings.h:80
enum ast_media_type type
Type of media this codec contains.
Definition codec.h:50
const char * description
Brief description.
Definition codec.h:48
const char * name
Name for this codec.
Definition codec.h:46
unsigned int id
Internal unique identifier for this codec, set at registration time (starts at 1)
Definition codec.h:44
const char * format_name
A format name for a default sane format using this codec.
Definition codec.c:63
struct ast_codec external
Public codec structure. Must remain first.
Definition codec.c:61

References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_find, ao2_link_flags, ao2_ref, ao2_t_alloc_options, ast_codec_media_type2str(), ast_log, AST_MEDIA_TYPE_AUDIO, AST_MEDIA_TYPE_UNKNOWN, ast_module_shutdown_ref, ast_verb, codec_dtor(), codec_id, codecs, ast_codec::description, internal_ast_codec::external, internal_ast_codec::format_name, ast_codec::id, lock, LOG_ERROR, ast_codec::name, OBJ_NOLOCK, OBJ_SEARCH_OBJECT, S_OR, ast_codec::sample_rate, SCOPED_AO2WRLOCK, and ast_codec::type.

Referenced by __ast_codec_register().

◆ ast_codec_builtin_init()

int ast_codec_builtin_init ( void  )

Initialize built-in codecs within the core.

Return values
0success
-1failure

Definition at line 956 of file codec_builtin.c.

957{
958 int res = 0;
959
969 res |= CODEC_REGISTER_AND_CACHE_NAMED("slin12", slin12);
970 res |= CODEC_REGISTER_AND_CACHE_NAMED("slin16", slin16);
971 res |= CODEC_REGISTER_AND_CACHE_NAMED("slin24", slin24);
972 res |= CODEC_REGISTER_AND_CACHE_NAMED("slin32", slin32);
973 res |= CODEC_REGISTER_AND_CACHE_NAMED("slin44", slin44);
974 res |= CODEC_REGISTER_AND_CACHE_NAMED("slin48", slin48);
975 res |= CODEC_REGISTER_AND_CACHE_NAMED("slin96", slin96);
976 res |= CODEC_REGISTER_AND_CACHE_NAMED("slin192", slin192);
980 res |= CODEC_REGISTER_AND_CACHE_NAMED("speex16", speex16);
981 res |= CODEC_REGISTER_AND_CACHE_NAMED("speex32", speex32);
1002 res |= CODEC_REGISTER_AND_CACHE_NAMED("silk8", silk8);
1003 res |= CODEC_REGISTER_AND_CACHE_NAMED("silk12", silk12);
1004 res |= CODEC_REGISTER_AND_CACHE_NAMED("silk16", silk16);
1005 res |= CODEC_REGISTER_AND_CACHE_NAMED("silk24", silk24);
1006
1007 return res;
1008}
static struct ast_codec g722
static struct ast_codec codec2
static struct ast_codec jpeg
static struct ast_codec t38
static struct ast_codec siren7
static struct ast_codec silk16
static struct ast_codec h263p
static struct ast_codec h263
static struct ast_codec ulaw
static struct ast_codec silk24
static struct ast_codec slin16
static struct ast_codec siren14
static struct ast_codec adpcm
static struct ast_codec silk8
static struct ast_codec g723
static struct ast_codec g729a
static struct ast_codec slin32
static struct ast_codec h265
static struct ast_codec lpc10
static struct ast_codec vp8
static struct ast_codec slin192
static struct ast_codec g726rfc3551
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 struct ast_codec mpeg4
static struct ast_codec slin48
static struct ast_codec speex8
static struct ast_codec g726aal2
static struct ast_codec png
static struct ast_codec slin24
#define CODEC_REGISTER_AND_CACHE(codec)
static struct ast_codec speex32
static struct ast_codec speex16
static struct ast_codec slin8
static struct ast_codec alaw
static struct ast_codec h261
static struct ast_codec slin12
static struct ast_codec vp9
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 struct ast_codec slin44

References adpcm, alaw, codec2, CODEC_REGISTER_AND_CACHE, CODEC_REGISTER_AND_CACHE_NAMED, g719, g722, g723, g726aal2, g726rfc3551, g729a, h261, h263, h263p, h264, h265, ilbc, jpeg, lpc10, mpeg4, none, opus, png, silk12, silk16, silk24, silk8, siren14, siren7, slin12, slin16, slin192, slin24, slin32, slin44, slin48, slin8, slin96, speex16, speex32, speex8, t140, t140red, t38, ulaw, vp8, and vp9.

Referenced by asterisk_daemon().

◆ codec2_length()

static int codec2_length ( unsigned int  samples)
static

Definition at line 116 of file codec_builtin.c.

117{
118 return (samples / 160) * 6;
119}

◆ codec2_samples()

static int codec2_samples ( struct ast_frame frame)
static

Definition at line 111 of file codec_builtin.c.

112{
113 return 160 * (frame->datalen / 6);
114}

References ast_frame::datalen.

◆ g719_length()

static int g719_length ( unsigned int  samples)
static

Definition at line 736 of file codec_builtin.c.

737{
738 return (int) samples / ((float) 48000 / 8000);
739}

◆ g719_samples()

static int g719_samples ( struct ast_frame frame)
static

Definition at line 731 of file codec_builtin.c.

732{
733 return (int) frame->datalen * ((float) 48000 / 8000);
734}

References ast_frame::datalen.

◆ g723_len()

static int g723_len ( unsigned char  buf)
static

Definition at line 53 of file codec_builtin.c.

54{
56
57 switch(type) {
58 case TYPE_DONTSEND:
59 return 0;
60 break;
61 case TYPE_SILENCE:
62 return 4;
63 break;
64 case TYPE_HIGH:
65 return 24;
66 break;
67 case TYPE_LOW:
68 return 20;
69 break;
70 default:
71 ast_log(LOG_WARNING, "Badly encoded frame (%u)\n", type);
72 }
73 return -1;
74}
frame_type
#define TYPE_MASK
char buf[BUFSIZE]
Definition eagi_proxy.c:66
#define LOG_WARNING

References ast_log, buf, LOG_WARNING, type, TYPE_DONTSEND, TYPE_HIGH, TYPE_LOW, TYPE_MASK, and TYPE_SILENCE.

Referenced by g723_samples().

◆ g723_length()

static int g723_length ( unsigned int  samples)
static

Definition at line 92 of file codec_builtin.c.

93{
94 return (samples / 240) * 20;
95}

◆ g723_samples()

static int g723_samples ( struct ast_frame frame)
static

Definition at line 76 of file codec_builtin.c.

77{
78 unsigned char *buf = frame->data.ptr;
79 int pos = 0, samples = 0, res;
80
81 while(pos < frame->datalen) {
82 res = g723_len(buf[pos]);
83 if (res <= 0)
84 break;
85 samples += 240;
86 pos += res;
87 }
88
89 return samples;
90}
static int g723_len(unsigned char buf)
union ast_frame::@239 data

References buf, ast_frame::data, g723_len(), and ast_frame::ptr.

◆ g726_length()

static int g726_length ( unsigned int  samples)
static

Definition at line 227 of file codec_builtin.c.

228{
229 return samples / 2;
230}

◆ g726_samples()

static int g726_samples ( struct ast_frame frame)
static

Definition at line 222 of file codec_builtin.c.

223{
224 return frame->datalen * 2;
225}

References ast_frame::datalen.

◆ g729_length()

static int g729_length ( unsigned int  samples)
static

Definition at line 460 of file codec_builtin.c.

461{
462 return samples / 8;
463}

◆ g729_samples()

static int g729_samples ( struct ast_frame frame)
static

Definition at line 455 of file codec_builtin.c.

456{
457 return frame->datalen * 8;
458}

References ast_frame::datalen.

◆ get_n_bits_at()

static unsigned char get_n_bits_at ( unsigned char *  data,
int  n,
int  bit 
)
static

Definition at line 481 of file codec_builtin.c.

482{
483 int byte = bit / 8; /* byte containing first bit */
484 int rem = 8 - (bit % 8); /* remaining bits in first byte */
485 unsigned char ret = 0;
486
487 if (n <= 0 || n > 8)
488 return 0;
489
490 if (rem < n) {
491 ret = (data[byte] << (n - rem));
492 ret |= (data[byte + 1] >> (8 - n + rem));
493 } else {
494 ret = (data[byte] >> (rem - n));
495 }
496
497 return (ret & (0xff >> (8 - n)));
498}

Referenced by speex_get_wb_sz_at(), and speex_samples().

◆ gsm_length()

static int gsm_length ( unsigned int  samples)
static

Definition at line 202 of file codec_builtin.c.

203{
204 return (samples / 160) * 33;
205}

◆ gsm_samples()

static int gsm_samples ( struct ast_frame frame)
static

Definition at line 197 of file codec_builtin.c.

198{
199 return 160 * (frame->datalen / 33);
200}

References ast_frame::datalen.

◆ ilbc_samples()

static int ilbc_samples ( struct ast_frame frame)
static

Definition at line 644 of file codec_builtin.c.

645{
647 const unsigned int mode = attr ? attr->mode : 30;
648 const unsigned int samples_per_frame = mode * ast_format_get_sample_rate(frame->subclass.format) / 1000;
649 const unsigned int octets_per_frame = (mode == 20) ? 38 : 50;
650
651 return samples_per_frame * frame->datalen / octets_per_frame;
652}
void * ast_format_get_attribute_data(const struct ast_format *format)
Get the attribute data on a format.
Definition format.c:125
unsigned int ast_format_get_sample_rate(const struct ast_format *format)
Get the sample rate of a media format.
Definition format.c:379
struct ast_format * format
struct ast_frame_subclass subclass
unsigned int mode
Definition ilbc.h:5

References ast_format_get_attribute_data(), ast_format_get_sample_rate(), ast_frame::datalen, ast_frame_subclass::format, ilbc_attr::mode, and ast_frame::subclass.

◆ lpc10_samples()

static int lpc10_samples ( struct ast_frame frame)
static

Definition at line 431 of file codec_builtin.c.

432{
433 int samples = 22 * 8;
434
435 /* assumes that the RTP packet contains one LPC10 frame */
436 samples += (((char *)(frame->data.ptr))[7] & 0x1) * 8;
437
438 return samples;
439}

References ast_frame::data, and ast_frame::ptr.

◆ none_length()

static int none_length ( unsigned int  samples)
static

Definition at line 140 of file codec_builtin.c.

140 {
141 return samples;
142}

◆ none_samples()

static int none_samples ( struct ast_frame frame)
static

Definition at line 135 of file codec_builtin.c.

136{
137 return frame->datalen;
138}

References ast_frame::datalen.

◆ opus_samples()

static int opus_samples ( struct ast_frame frame)
static

Definition at line 755 of file codec_builtin.c.

756{
757 /*
758 * XXX This is likely not at all what's intended from this
759 * callback. If you have codec_opus.so loaded then this
760 * function is overridden anyway. However, since opus is
761 * variable bit rate and I cannot extract the calculation code
762 * from the opus library, I am going to punt and assume 20ms
763 * worth of samples. In testing, this has worked just fine.
764 * Pass through support doesn't seem to care about the value
765 * returned anyway.
766 */
767 return ast_format_get_sample_rate(frame->subclass.format) / 50;
768}

References ast_format_get_sample_rate(), ast_frame_subclass::format, and ast_frame::subclass.

◆ silk_samples()

static int silk_samples ( struct ast_frame frame)
static

Definition at line 869 of file codec_builtin.c.

870{
871 /* XXX This is likely not at all what's intended from this callback. However,
872 * since SILK is variable bit rate, I have no idea how to take a frame of data
873 * and determine the number of samples present. Instead, we base this on the
874 * sample rate of the codec and the expected number of samples to receive in 20ms.
875 * In testing, this has worked just fine.
876 */
877 return ast_format_get_sample_rate(frame->subclass.format) / 50;
878}

References ast_format_get_sample_rate(), ast_frame_subclass::format, and ast_frame::subclass.

◆ siren14_length()

static int siren14_length ( unsigned int  samples)
static

Definition at line 712 of file codec_builtin.c.

713{
714 return (int) samples / ((float) 32000 / 6000);;
715}

◆ siren14_samples()

static int siren14_samples ( struct ast_frame frame)
static

Definition at line 707 of file codec_builtin.c.

708{
709 return (int) frame->datalen * ((float) 32000 / 6000);
710}

References ast_frame::datalen.

◆ siren7_length()

static int siren7_length ( unsigned int  samples)
static

Definition at line 688 of file codec_builtin.c.

689{
690 return samples / (16000 / 4000);
691}

◆ siren7_samples()

static int siren7_samples ( struct ast_frame frame)
static

Definition at line 683 of file codec_builtin.c.

684{
685 return frame->datalen * (16000 / 4000);
686}

References ast_frame::datalen.

◆ slin_length()

static int slin_length ( unsigned int  samples)
static

Definition at line 282 of file codec_builtin.c.

283{
284 return samples * 2;
285}

◆ slin_samples()

static int slin_samples ( struct ast_frame frame)
static

Definition at line 277 of file codec_builtin.c.

278{
279 return frame->datalen / 2;
280}

References ast_frame::datalen.

◆ speex16_samples()

static int speex16_samples ( struct ast_frame frame)
static

Definition at line 608 of file codec_builtin.c.

609{
610 return 2 * speex_samples(frame->data.ptr, frame->datalen);
611}
static int speex_samples(unsigned char *data, int len)

References ast_frame::data, ast_frame::datalen, ast_frame::ptr, and speex_samples().

◆ speex32_samples()

static int speex32_samples ( struct ast_frame frame)
static

Definition at line 626 of file codec_builtin.c.

627{
628 return 4 * speex_samples(frame->data.ptr, frame->datalen);
629}

References ast_frame::data, ast_frame::datalen, ast_frame::ptr, and speex_samples().

◆ speex8_samples()

static int speex8_samples ( struct ast_frame frame)
static

Definition at line 590 of file codec_builtin.c.

591{
592 return speex_samples(frame->data.ptr, frame->datalen);
593}

References ast_frame::data, ast_frame::datalen, ast_frame::ptr, and speex_samples().

◆ speex_get_wb_sz_at()

static int speex_get_wb_sz_at ( unsigned char *  data,
int  len,
int  bit 
)
static

Definition at line 500 of file codec_builtin.c.

501{
502 static const int SpeexWBSubModeSz[] = {
503 4, 36, 112, 192,
504 352, 0, 0, 0 };
505 int off = bit;
506 unsigned char c;
507
508 /* skip up to two wideband frames */
509 if (((len * 8 - off) >= 5) &&
510 get_n_bits_at(data, 1, off)) {
511 c = get_n_bits_at(data, 3, off + 1);
512 off += SpeexWBSubModeSz[c];
513
514 if (((len * 8 - off) >= 5) &&
515 get_n_bits_at(data, 1, off)) {
516 c = get_n_bits_at(data, 3, off + 1);
517 off += SpeexWBSubModeSz[c];
518
519 if (((len * 8 - off) >= 5) &&
520 get_n_bits_at(data, 1, off)) {
521 ast_log(LOG_WARNING, "Encountered corrupt speex frame; too many wideband frames in a row.\n");
522 return -1;
523 }
524 }
525
526 }
527 return off - bit;
528}
static unsigned char get_n_bits_at(unsigned char *data, int n, int bit)
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
static struct test_val c

References ast_log, c, get_n_bits_at(), len(), and LOG_WARNING.

Referenced by speex_samples().

◆ speex_samples()

static int speex_samples ( unsigned char *  data,
int  len 
)
static

Definition at line 530 of file codec_builtin.c.

531{
532 static const int SpeexSubModeSz[] = {
533 5, 43, 119, 160,
534 220, 300, 364, 492,
535 79, 0, 0, 0,
536 0, 0, 0, 0 };
537 static const int SpeexInBandSz[] = {
538 1, 1, 4, 4,
539 4, 4, 4, 4,
540 8, 8, 16, 16,
541 32, 32, 64, 64 };
542 int bit = 0;
543 int cnt = 0;
544 int off;
545 unsigned char c;
546
547 while ((len * 8 - bit) >= 5) {
548 /* skip wideband frames */
549 off = speex_get_wb_sz_at(data, len, bit);
550 if (off < 0) {
551 ast_log(LOG_WARNING, "Had error while reading wideband frames for speex samples\n");
552 break;
553 }
554 bit += off;
555
556 if ((len * 8 - bit) < 5)
557 break;
558
559 /* get control bits */
560 c = get_n_bits_at(data, 5, bit);
561 bit += 5;
562
563 if (c == 15) {
564 /* terminator */
565 break;
566 } else if (c == 14) {
567 /* in-band signal; next 4 bits contain signal id */
568 c = get_n_bits_at(data, 4, bit);
569 bit += 4;
570 bit += SpeexInBandSz[c];
571 } else if (c == 13) {
572 /* user in-band; next 4 bits contain msg len */
573 c = get_n_bits_at(data, 4, bit);
574 bit += 4;
575 /* after which it's 5-bit signal id + c bytes of data */
576 bit += 5 + c * 8;
577 } else if (c > 8) {
578 /* unknown */
579 ast_log(LOG_WARNING, "Unknown speex control frame %d\n", c);
580 break;
581 } else {
582 /* skip number bits for submode (less the 5 control bits) */
583 bit += SpeexSubModeSz[c] - 5;
584 cnt += 160; /* new frame */
585 }
586 }
587 return cnt;
588}
static int speex_get_wb_sz_at(unsigned char *data, int len, int bit)

References ast_log, c, get_n_bits_at(), len(), LOG_WARNING, and speex_get_wb_sz_at().

Referenced by speex16_samples(), speex32_samples(), and speex8_samples().

◆ ulaw_length()

static int ulaw_length ( unsigned int  samples)
static

Definition at line 162 of file codec_builtin.c.

163{
164 return samples;
165}

◆ ulaw_samples()

static int ulaw_samples ( struct ast_frame frame)
static

Definition at line 157 of file codec_builtin.c.

158{
159 return frame->datalen;
160}

References ast_frame::datalen.

Variable Documentation

◆ adpcm

struct ast_codec adpcm
static

Definition at line 262 of file codec_builtin.c.

262 {
263 .name = "adpcm",
264 .description = "Dialogic ADPCM",
265 .type = AST_MEDIA_TYPE_AUDIO,
266 .sample_rate = 8000,
267 .minimum_ms = 10,
268 .maximum_ms = 300,
269 .default_ms = 20,
270 .minimum_bytes = 40,
271 .samples_count = g726_samples,
272 .get_length = g726_length,
273 .smooth = 1,
274 .quality = 80,
275};
static int g726_length(unsigned int samples)
static int g726_samples(struct ast_frame *frame)

Referenced by ast_codec_builtin_init(), and lintoadpcm_frameout().

◆ alaw

struct ast_codec alaw
static

Definition at line 182 of file codec_builtin.c.

182 {
183 .name = "alaw",
184 .description = "G.711 a-law",
185 .type = AST_MEDIA_TYPE_AUDIO,
186 .sample_rate = 8000,
187 .minimum_ms = 10,
188 .maximum_ms = 140,
189 .default_ms = 20,
190 .minimum_bytes = 80,
191 .samples_count = ulaw_samples,
192 .get_length = ulaw_length,
193 .smooth = 1,
194 .quality = 100, /* Just as good as ulaw */
195};
static int ulaw_length(unsigned int samples)
static int ulaw_samples(struct ast_frame *frame)

Referenced by alaw2linear(), ast_codec_builtin_init(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), and AST_TEST_DEFINE().

◆ codec2

struct ast_codec codec2
static

Definition at line 121 of file codec_builtin.c.

121 {
122 .name = "codec2",
123 .description = "Codec 2",
124 .type = AST_MEDIA_TYPE_AUDIO,
125 .sample_rate = 8000,
126 .minimum_ms = 20,
127 .maximum_ms = 300,
128 .default_ms = 20,
129 .minimum_bytes = 6,
130 .samples_count = codec2_samples,
131 .get_length = codec2_length,
132 .smooth = 1,
133};
static int codec2_length(unsigned int samples)
static int codec2_samples(struct ast_frame *frame)

Referenced by ast_codec_builtin_init(), and ast_format_cap_append_by_type().

◆ g719

struct ast_codec g719
static

Definition at line 741 of file codec_builtin.c.

741 {
742 .name = "g719",
743 .description = "ITU G.719",
744 .type = AST_MEDIA_TYPE_AUDIO,
745 .sample_rate = 48000,
746 .minimum_ms = 20,
747 .maximum_ms = 80,
748 .default_ms = 20,
749 .minimum_bytes = 160,
750 .samples_count = g719_samples,
751 .get_length = g719_length,
752 .quality = 95,
753};
static int g719_samples(struct ast_frame *frame)
static int g719_length(unsigned int samples)

Referenced by ast_codec_builtin_init().

◆ g722

struct ast_codec g722
static

Definition at line 668 of file codec_builtin.c.

668 {
669 .name = "g722",
670 .description = "G722",
671 .type = AST_MEDIA_TYPE_AUDIO,
672 .sample_rate = 16000,
673 .minimum_ms = 10,
674 .maximum_ms = 140,
675 .default_ms = 20,
676 .minimum_bytes = 80,
677 .samples_count = g726_samples,
678 .get_length = g726_length,
679 .smooth = 1,
680 .quality = 110, /* In theory, better than ulaw */
681};

Referenced by ast_codec_builtin_init().

◆ g723

struct ast_codec g723
static

Definition at line 97 of file codec_builtin.c.

97 {
98 .name = "g723",
99 .description = "G.723.1",
100 .type = AST_MEDIA_TYPE_AUDIO,
101 .sample_rate = 8000,
102 .minimum_ms = 30,
103 .maximum_ms = 300,
104 .default_ms = 30,
105 .minimum_bytes = 20,
106 .samples_count = g723_samples,
107 .get_length = g723_length,
108 .quality = 20,
109};
static int g723_samples(struct ast_frame *frame)
static int g723_length(unsigned int samples)

Referenced by ast_codec_builtin_init().

◆ g726aal2

struct ast_codec g726aal2
static

Definition at line 247 of file codec_builtin.c.

247 {
248 .name = "g726aal2",
249 .description = "G.726 AAL2",
250 .type = AST_MEDIA_TYPE_AUDIO,
251 .sample_rate = 8000,
252 .minimum_ms = 10,
253 .maximum_ms = 300,
254 .default_ms = 20,
255 .minimum_bytes = 40,
256 .samples_count = g726_samples,
257 .get_length = g726_length,
258 .smooth = 1,
259 .quality = 85,
260};

Referenced by ast_codec_builtin_init().

◆ g726rfc3551

struct ast_codec g726rfc3551
static

Definition at line 232 of file codec_builtin.c.

232 {
233 .name = "g726",
234 .description = "G.726 RFC3551",
235 .type = AST_MEDIA_TYPE_AUDIO,
236 .sample_rate = 8000,
237 .minimum_ms = 10,
238 .maximum_ms = 300,
239 .default_ms = 20,
240 .minimum_bytes = 40,
241 .samples_count = g726_samples,
242 .get_length = g726_length,
243 .smooth = 1,
244 .quality = 85,
245};

Referenced by ast_codec_builtin_init().

◆ g729a

struct ast_codec g729a
static

Definition at line 465 of file codec_builtin.c.

465 {
466 .name = "g729",
467 .description = "G.729A",
468 .type = AST_MEDIA_TYPE_AUDIO,
469 .sample_rate = 8000,
470 .minimum_ms = 10,
471 .maximum_ms = 220,
472 .default_ms = 20,
473 .minimum_bytes = 10,
474 .samples_count = g729_samples,
475 .get_length = g729_length,
476 .smooth = 1,
477 .smoother_flags = AST_SMOOTHER_FLAG_G729,
478 .quality = 45,
479};
static int g729_samples(struct ast_frame *frame)
static int g729_length(unsigned int samples)
#define AST_SMOOTHER_FLAG_G729
Definition smoother.h:34

Referenced by ast_codec_builtin_init().

◆ gsm

struct ast_codec gsm
static

Definition at line 207 of file codec_builtin.c.

207 {
208 .name = "gsm",
209 .description = "GSM",
210 .type = AST_MEDIA_TYPE_AUDIO,
211 .sample_rate = 8000,
212 .minimum_ms = 20,
213 .maximum_ms = 300,
214 .default_ms = 20,
215 .minimum_bytes = 33,
216 .samples_count = gsm_samples,
217 .get_length = gsm_length,
218 .smooth = 1,
219 .quality = 40,
220};
static int gsm_samples(struct ast_frame *frame)
static int gsm_length(unsigned int samples)

◆ h261

struct ast_codec h261
static

Definition at line 795 of file codec_builtin.c.

795 {
796 .name = "h261",
797 .description = "H.261 video",
798 .type = AST_MEDIA_TYPE_VIDEO,
799 .sample_rate = 1000,
800};
@ AST_MEDIA_TYPE_VIDEO
Definition codec.h:33

Referenced by ast_codec_builtin_init().

◆ h263

struct ast_codec h263
static

Definition at line 802 of file codec_builtin.c.

802 {
803 .name = "h263",
804 .description = "H.263 video",
805 .type = AST_MEDIA_TYPE_VIDEO,
806 .sample_rate = 1000,
807};

Referenced by ast_codec_builtin_init(), and AST_TEST_DEFINE().

◆ h263p

struct ast_codec h263p
static

Definition at line 809 of file codec_builtin.c.

809 {
810 .name = "h263p",
811 .description = "H.263+ video",
812 .type = AST_MEDIA_TYPE_VIDEO,
813 .sample_rate = 1000,
814};

Referenced by ast_codec_builtin_init().

◆ h264

struct ast_codec h264
static

Definition at line 816 of file codec_builtin.c.

816 {
817 .name = "h264",
818 .description = "H.264 video",
819 .type = AST_MEDIA_TYPE_VIDEO,
820 .sample_rate = 1000,
821};

Referenced by ast_codec_builtin_init().

◆ h265

struct ast_codec h265
static

Definition at line 823 of file codec_builtin.c.

823 {
824 .name = "h265",
825 .description = "H.265 video",
826 .type = AST_MEDIA_TYPE_VIDEO,
827 .sample_rate = 1000,
828};

Referenced by ast_codec_builtin_init().

◆ ilbc

struct ast_codec ilbc
static

Definition at line 654 of file codec_builtin.c.

654 {
655 .name = "ilbc",
656 .description = "iLBC",
657 .type = AST_MEDIA_TYPE_AUDIO,
658 .sample_rate = 8000,
659 .minimum_ms = 20,
660 .maximum_ms = 300,
661 .default_ms = 20,
662 .minimum_bytes = 38,
663 .samples_count = ilbc_samples,
664 .smooth = 0,
665 .quality = 35,
666};
static int ilbc_samples(struct ast_frame *frame)

Referenced by ast_codec_builtin_init().

◆ jpeg

struct ast_codec jpeg
static
Initial value:
= {
.name = "jpeg",
.description = "JPEG image",
}
@ AST_MEDIA_TYPE_IMAGE
Definition codec.h:34

Definition at line 783 of file codec_builtin.c.

783 {
784 .name = "jpeg",
785 .description = "JPEG image",
786 .type = AST_MEDIA_TYPE_IMAGE,
787};

Referenced by ast_codec_builtin_init().

◆ lpc10

struct ast_codec lpc10
static

Definition at line 441 of file codec_builtin.c.

441 {
442 .name = "lpc10",
443 .description = "LPC10",
444 .type = AST_MEDIA_TYPE_AUDIO,
445 .sample_rate = 8000,
446 .minimum_ms = 20,
447 .maximum_ms = 20,
448 .default_ms = 20,
449 .minimum_bytes = 7,
450 .samples_count = lpc10_samples,
451 .smooth = 1,
452 .quality = 8,
453};
static int lpc10_samples(struct ast_frame *frame)

Referenced by ast_codec_builtin_init().

◆ mpeg4

struct ast_codec mpeg4
static

Definition at line 830 of file codec_builtin.c.

830 {
831 .name = "mpeg4",
832 .description = "MPEG4 video",
833 .type = AST_MEDIA_TYPE_VIDEO,
834 .sample_rate = 1000,
835};

Referenced by ast_codec_builtin_init().

◆ none

struct ast_codec none
static

Definition at line 144 of file codec_builtin.c.

144 {
145 .name = "none",
146 .description = "<Null> codec",
147 .type = AST_MEDIA_TYPE_AUDIO,
148 .sample_rate = 8000, /* This must have some sample rate to prevent divide by 0 */
149 .minimum_ms = 10,
150 .maximum_ms = 140,
151 .default_ms = 20,
152 .minimum_bytes = 20,
153 .samples_count = none_samples,
154 .get_length = none_length,
155};
static int none_length(unsigned int samples)
static int none_samples(struct ast_frame *frame)

Referenced by ast_codec_builtin_init(), and AST_TEST_DEFINE().

◆ opus

struct ast_codec opus
static

Definition at line 770 of file codec_builtin.c.

770 {
771 .name = "opus",
772 .description = "Opus Codec",
773 .type = AST_MEDIA_TYPE_AUDIO,
774 .sample_rate = 48000,
775 .minimum_ms = 20,
776 .maximum_ms = 60,
777 .default_ms = 20,
778 .samples_count = opus_samples,
779 .minimum_bytes = 10,
780 .quality = 75,
781};
static int opus_samples(struct ast_frame *frame)

Referenced by ast_codec_builtin_init().

◆ png

struct ast_codec png
static
Initial value:
= {
.name = "png",
.description = "PNG Image",
}

Definition at line 789 of file codec_builtin.c.

789 {
790 .name = "png",
791 .description = "PNG Image",
792 .type = AST_MEDIA_TYPE_IMAGE,
793};

Referenced by ast_codec_builtin_init().

◆ silk12

struct ast_codec silk12
static

Definition at line 892 of file codec_builtin.c.

892 {
893 .name = "silk",
894 .description = "SILK Codec (12 KHz)",
895 .type = AST_MEDIA_TYPE_AUDIO,
896 .sample_rate = 12000,
897 .minimum_ms = 20,
898 .maximum_ms = 100,
899 .default_ms = 20,
900 .minimum_bytes = 240,
901 .samples_count = silk_samples
902};
static int silk_samples(struct ast_frame *frame)

Referenced by ast_codec_builtin_init().

◆ silk16

struct ast_codec silk16
static

Definition at line 904 of file codec_builtin.c.

904 {
905 .name = "silk",
906 .description = "SILK Codec (16 KHz)",
907 .type = AST_MEDIA_TYPE_AUDIO,
908 .sample_rate = 16000,
909 .minimum_ms = 20,
910 .maximum_ms = 100,
911 .default_ms = 20,
912 .minimum_bytes = 320,
913 .samples_count = silk_samples
914};

Referenced by ast_codec_builtin_init().

◆ silk24

struct ast_codec silk24
static

Definition at line 916 of file codec_builtin.c.

916 {
917 .name = "silk",
918 .description = "SILK Codec (24 KHz)",
919 .type = AST_MEDIA_TYPE_AUDIO,
920 .sample_rate = 24000,
921 .minimum_ms = 20,
922 .maximum_ms = 100,
923 .default_ms = 20,
924 .minimum_bytes = 480,
925 .samples_count = silk_samples
926};

Referenced by ast_codec_builtin_init().

◆ silk8

struct ast_codec silk8
static

Definition at line 880 of file codec_builtin.c.

880 {
881 .name = "silk",
882 .description = "SILK Codec (8 KHz)",
883 .type = AST_MEDIA_TYPE_AUDIO,
884 .sample_rate = 8000,
885 .minimum_ms = 20,
886 .maximum_ms = 100,
887 .default_ms = 20,
888 .minimum_bytes = 160,
889 .samples_count = silk_samples,
890};

Referenced by ast_codec_builtin_init().

◆ siren14

struct ast_codec siren14
static

Definition at line 717 of file codec_builtin.c.

717 {
718 .name = "siren14",
719 .description = "ITU G.722.1 Annex C, (Siren14, licensed from Polycom)",
720 .type = AST_MEDIA_TYPE_AUDIO,
721 .sample_rate = 32000,
722 .minimum_ms = 20,
723 .maximum_ms = 80,
724 .default_ms = 20,
725 .minimum_bytes = 120,
726 .samples_count = siren14_samples,
727 .get_length = siren14_length,
728 .quality = 90,
729};
static int siren14_length(unsigned int samples)
static int siren14_samples(struct ast_frame *frame)

Referenced by ast_codec_builtin_init().

◆ siren7

struct ast_codec siren7
static

Definition at line 693 of file codec_builtin.c.

693 {
694 .name = "siren7",
695 .description = "ITU G.722.1 (Siren7, licensed from Polycom)",
696 .type = AST_MEDIA_TYPE_AUDIO,
697 .sample_rate = 16000,
698 .minimum_ms = 20,
699 .maximum_ms = 80,
700 .default_ms = 20,
701 .minimum_bytes = 80,
702 .samples_count = siren7_samples,
703 .get_length = siren7_length,
704 .quality = 85,
705};
static int siren7_samples(struct ast_frame *frame)
static int siren7_length(unsigned int samples)

Referenced by ast_codec_builtin_init().

◆ slin12

struct ast_codec slin12
static

Definition at line 303 of file codec_builtin.c.

303 {
304 .name = "slin",
305 .description = "16 bit Signed Linear PCM (12kHz)",
306 .type = AST_MEDIA_TYPE_AUDIO,
307 .sample_rate = 12000,
308 .minimum_ms = 10,
309 .maximum_ms = 60,
310 .default_ms = 20,
311 .minimum_bytes = 240,
312 .samples_count = slin_samples,
313 .get_length = slin_length,
314 .smooth = 1,
316 .quality = 116,
317};
static int slin_length(unsigned int samples)
static int slin_samples(struct ast_frame *frame)
#define AST_SMOOTHER_FLAG_FORCED
Definition smoother.h:36
#define AST_SMOOTHER_FLAG_BE
Definition smoother.h:35

Referenced by ast_codec_builtin_init().

◆ slin16

struct ast_codec slin16
static

Definition at line 319 of file codec_builtin.c.

319 {
320 .name = "slin",
321 .description = "16 bit Signed Linear PCM (16kHz)",
322 .type = AST_MEDIA_TYPE_AUDIO,
323 .sample_rate = 16000,
324 .minimum_ms = 10,
325 .maximum_ms = 60,
326 .default_ms = 20,
327 .minimum_bytes = 320,
328 .samples_count = slin_samples,
329 .get_length = slin_length,
330 .smooth = 1,
332 .quality = 117,
333};

Referenced by ast_codec_builtin_init().

◆ slin192

struct ast_codec slin192
static

Definition at line 415 of file codec_builtin.c.

415 {
416 .name = "slin",
417 .description = "16 bit Signed Linear PCM (192kHz)",
418 .type = AST_MEDIA_TYPE_AUDIO,
419 .sample_rate = 192000,
420 .minimum_ms = 10,
421 .maximum_ms = 60,
422 .default_ms = 20,
423 .minimum_bytes = 3840,
424 .samples_count = slin_samples,
425 .get_length = slin_length,
426 .smooth = 1,
428 .quality = 123,
429};

Referenced by ast_codec_builtin_init().

◆ slin24

struct ast_codec slin24
static

Definition at line 335 of file codec_builtin.c.

335 {
336 .name = "slin",
337 .description = "16 bit Signed Linear PCM (24kHz)",
338 .type = AST_MEDIA_TYPE_AUDIO,
339 .sample_rate = 24000,
340 .minimum_ms = 10,
341 .maximum_ms = 60,
342 .default_ms = 20,
343 .minimum_bytes = 480,
344 .samples_count = slin_samples,
345 .get_length = slin_length,
346 .smooth = 1,
348 .quality = 118,
349};

Referenced by ast_codec_builtin_init().

◆ slin32

struct ast_codec slin32
static

Definition at line 351 of file codec_builtin.c.

351 {
352 .name = "slin",
353 .description = "16 bit Signed Linear PCM (32kHz)",
354 .type = AST_MEDIA_TYPE_AUDIO,
355 .sample_rate = 32000,
356 .minimum_ms = 10,
357 .maximum_ms = 60,
358 .default_ms = 20,
359 .minimum_bytes = 640,
360 .samples_count = slin_samples,
361 .get_length = slin_length,
362 .smooth = 1,
364 .quality = 119,
365};

Referenced by ast_codec_builtin_init().

◆ slin44

struct ast_codec slin44
static

Definition at line 367 of file codec_builtin.c.

367 {
368 .name = "slin",
369 .description = "16 bit Signed Linear PCM (44kHz)",
370 .type = AST_MEDIA_TYPE_AUDIO,
371 .sample_rate = 44100,
372 .minimum_ms = 10,
373 .maximum_ms = 60,
374 .default_ms = 20,
375 .minimum_bytes = 882,
376 .samples_count = slin_samples,
377 .get_length = slin_length,
378 .smooth = 1,
380 .quality = 120,
381};

Referenced by ast_codec_builtin_init().

◆ slin48

struct ast_codec slin48
static

Definition at line 383 of file codec_builtin.c.

383 {
384 .name = "slin",
385 .description = "16 bit Signed Linear PCM (48kHz)",
386 .type = AST_MEDIA_TYPE_AUDIO,
387 .sample_rate = 48000,
388 .minimum_ms = 10,
389 .maximum_ms = 60,
390 .default_ms = 20,
391 .minimum_bytes = 960,
392 .samples_count = slin_samples,
393 .get_length = slin_length,
394 .smooth = 1,
396 .quality = 121,
397};

Referenced by ast_codec_builtin_init().

◆ slin8

struct ast_codec slin8
static

Definition at line 287 of file codec_builtin.c.

287 {
288 .name = "slin",
289 .description = "16 bit Signed Linear PCM",
290 .type = AST_MEDIA_TYPE_AUDIO,
291 .sample_rate = 8000,
292 .minimum_ms = 10,
293 .maximum_ms = 60,
294 .default_ms = 20,
295 .minimum_bytes = 160,
296 .samples_count = slin_samples,
297 .get_length = slin_length,
298 .smooth = 1,
300 .quality = 115, /* Better than ulaw */
301};

Referenced by ast_codec_builtin_init().

◆ slin96

struct ast_codec slin96
static

Definition at line 399 of file codec_builtin.c.

399 {
400 .name = "slin",
401 .description = "16 bit Signed Linear PCM (96kHz)",
402 .type = AST_MEDIA_TYPE_AUDIO,
403 .sample_rate = 96000,
404 .minimum_ms = 10,
405 .maximum_ms = 60,
406 .default_ms = 20,
407 .minimum_bytes = 1920,
408 .samples_count = slin_samples,
409 .get_length = slin_length,
410 .smooth = 1,
412 .quality = 122,
413};

Referenced by ast_codec_builtin_init().

◆ speex16

struct ast_codec speex16
static

Definition at line 613 of file codec_builtin.c.

613 {
614 .name = "speex",
615 .description = "SpeeX 16khz",
616 .type = AST_MEDIA_TYPE_AUDIO,
617 .sample_rate = 16000,
618 .minimum_ms = 10,
619 .maximum_ms = 60,
620 .default_ms = 20,
621 .minimum_bytes = 10,
622 .samples_count = speex16_samples,
623 .quality = 40,
624};
static int speex16_samples(struct ast_frame *frame)

Referenced by ast_codec_builtin_init().

◆ speex32

struct ast_codec speex32
static

Definition at line 631 of file codec_builtin.c.

631 {
632 .name = "speex",
633 .description = "SpeeX 32khz",
634 .type = AST_MEDIA_TYPE_AUDIO,
635 .sample_rate = 32000,
636 .minimum_ms = 10,
637 .maximum_ms = 60,
638 .default_ms = 20,
639 .minimum_bytes = 10,
640 .samples_count = speex32_samples,
641 .quality = 40,
642};
static int speex32_samples(struct ast_frame *frame)

Referenced by ast_codec_builtin_init().

◆ speex8

struct ast_codec speex8
static

Definition at line 595 of file codec_builtin.c.

595 {
596 .name = "speex",
597 .description = "SpeeX",
598 .type = AST_MEDIA_TYPE_AUDIO,
599 .sample_rate = 8000,
600 .minimum_ms = 10,
601 .maximum_ms = 60,
602 .default_ms = 20,
603 .minimum_bytes = 10,
604 .samples_count = speex8_samples,
605 .quality = 40,
606};
static int speex8_samples(struct ast_frame *frame)

Referenced by ast_codec_builtin_init().

◆ t140

struct ast_codec t140
static
Initial value:
= {
.name = "t140",
.description = "Passthrough T.140 Realtime Text",
}
@ AST_MEDIA_TYPE_TEXT
Definition codec.h:35

Definition at line 857 of file codec_builtin.c.

857 {
858 .name = "t140",
859 .description = "Passthrough T.140 Realtime Text",
860 .type = AST_MEDIA_TYPE_TEXT,
861};

Referenced by ast_codec_builtin_init().

◆ t140red

struct ast_codec t140red
static
Initial value:
= {
.name = "red",
.description = "T.140 Realtime Text with redundancy",
}

Definition at line 851 of file codec_builtin.c.

851 {
852 .name = "red",
853 .description = "T.140 Realtime Text with redundancy",
854 .type = AST_MEDIA_TYPE_TEXT,
855};

Referenced by ast_codec_builtin_init().

◆ t38

struct ast_codec t38
static
Initial value:
= {
.name = "t38",
.description = "T.38 UDPTL Fax",
}

Definition at line 863 of file codec_builtin.c.

863 {
864 .name = "t38",
865 .description = "T.38 UDPTL Fax",
866 .type = AST_MEDIA_TYPE_IMAGE,
867};

Referenced by ast_codec_builtin_init().

◆ ulaw

struct ast_codec ulaw
static

Definition at line 167 of file codec_builtin.c.

167 {
168 .name = "ulaw",
169 .description = "G.711 u-law",
170 .type = AST_MEDIA_TYPE_AUDIO,
171 .sample_rate = 8000,
172 .minimum_ms = 10,
173 .maximum_ms = 140,
174 .default_ms = 20,
175 .minimum_bytes = 80,
176 .samples_count = ulaw_samples,
177 .get_length = ulaw_length,
178 .smooth = 1,
179 .quality = 100, /* We are the gold standard. */
180};

Referenced by ast_codec_builtin_init(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), AST_TEST_DEFINE(), and AST_TEST_DEFINE().

◆ vp8

struct ast_codec vp8
static

Definition at line 837 of file codec_builtin.c.

837 {
838 .name = "vp8",
839 .description = "VP8 video",
840 .type = AST_MEDIA_TYPE_VIDEO,
841 .sample_rate = 1000,
842};

Referenced by ast_codec_builtin_init().

◆ vp9

struct ast_codec vp9
static

Definition at line 844 of file codec_builtin.c.

844 {
845 .name = "vp9",
846 .description = "VP9 video",
847 .type = AST_MEDIA_TYPE_VIDEO,
848 .sample_rate = 1000,
849};

Referenced by ast_codec_builtin_init().