[asterisk-commits] file: branch group/media_formats r406039 - in /team/group/media_formats: incl...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jan 21 14:04:51 CST 2014


Author: file
Date: Tue Jan 21 14:04:48 2014
New Revision: 406039

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=406039
Log:
Add the beginnings of the codec API.

The codec API is a runtime method of making Asterisk aware of codecs.
Codecs define information about themselves and then register with the core.
The core also registers built-in codecs that have been defined within Asterisk
from past versions.

The gist of it is: No more defined numerical values for codecs and no more
having to modify Asterisk to add them.

Added:
    team/group/media_formats/include/asterisk/codec.h   (with props)
    team/group/media_formats/main/codec.c   (with props)
    team/group/media_formats/main/codec_builtin.c   (with props)
Modified:
    team/group/media_formats/main/asterisk.c

Added: team/group/media_formats/include/asterisk/codec.h
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats/include/asterisk/codec.h?view=auto&rev=406039
==============================================================================
--- team/group/media_formats/include/asterisk/codec.h (added)
+++ team/group/media_formats/include/asterisk/codec.h Tue Jan 21 14:04:48 2014
@@ -1,0 +1,131 @@
+/*
+ * Asterisk -- An open source telephony toolkit.
+ *
+ * Copyright (C) 2014, Digium, Inc.
+ *
+ * Joshua Colp <jcolp at 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 Codec API
+ *
+ * \author Joshua Colp <jcolp at digium.com>
+ */
+
+#ifndef _AST_CODEC_H_
+#define _AST_CODEC_H_
+
+/*! \brief Types of media */
+enum ast_media_type {
+	AST_MEDIA_TYPE_AUDIO = 0,
+	AST_MEDIA_TYPE_VIDEO,
+	AST_MEDIA_TYPE_IMAGE,
+	AST_MEDIA_TYPE_TEXT,
+};
+
+/*! \brief Represents a media codec within Asterisk. */
+struct ast_codec {
+	/*! \brief Internal unique identifier for this codec, set at registration time (starts at 1) */
+	unsigned int id;
+	/*! \brief Original Asterisk codec identifier */
+	uint64_t original_id;
+	/*! \brief Name for this codec */
+	const char *name;
+	/*! \brief Brief description */
+	const char *description;
+	/*! \brief Type of media this codec contains */
+	enum ast_media_type type;
+	/*! \brief Sample rate */
+	unsigned int sample_rate;
+	/*! \brief Minimum length of media that can be carried (in milliseconds) */
+	unsigned int minimum_ms;
+	/*! \brief Maximum length of media that can be carried (in milliseconds) */
+	unsigned int maximum_ms;
+	/*! \brief The number of milliseconds the length can be incremented by */
+	unsigned int increment_ms;
+	/*! \brief Default length of media carried (in milliseconds) */
+	unsigned int default_ms;
+	/*! \brief Callback function for getting the number of samples in a frame */
+	int (*get_samples)(struct ast_frame *frame);
+	/*! \brief Callback function for getting the length of media based on number of samples */
+	int (*get_length)(unsigned int samples);
+	/*! \brief Callback function for getting the duration in ms of an interpolation frame */
+	int (*get_interpolation_length)(void);
+	/*! \brief Whether the media can be smoothed or not */
+	unsigned int smooth:1;
+};
+
+/*!
+ * \brief Initialize codec support within the core.
+ *
+ * \retval 0 success
+ * \retval -1 failure
+ */
+int ast_codec_init(void);
+
+/*!
+ * \brief Initialize built-in codecs within the core.
+ *
+ * \retval 0 success
+ * \retval -1 failure
+ */
+int ast_codec_builtin_init(void);
+
+/*!
+ * \brief This function is used to register a codec with the Asterisk core. Registering
+ * allows it to be passed through in frames and configured in channel drivers.
+ *
+ * \param codec to register
+ *
+ * \retval 0 success
+ * \retval -1 failure
+ */
+int __ast_codec_register(struct ast_codec *codec, struct ast_module *mod);
+
+/*!
+ * \brief This function is used to register a codec with the Asterisk core. Registering
+ * allows it to be passed through in frames and configured in channel drivers.
+ *
+ * \param codec to register
+ *
+ * \retval 0 success
+ * \retval -1 failure
+ */
+#define ast_codec_register(codec) __ast_codec_register(codec, ast_module_info->self)
+
+/*!
+ * \brief Retrieve a codec given a name, type, and sample rate
+ *
+ * \param name The name of the codec
+ * \param type The type of the codec
+ * \param sample_rate Optional sample rate, may not be applicable for some types
+ *
+ * \retval non-NULL success
+ * \retval NULL failure
+ *
+ * \note The returned codec is reference counted and ao2_ref or ao2_cleanup
+ * must be used to release the reference.
+ */
+struct ast_codec *ast_codec_get(const char *name, enum ast_media_type type, unsigned int sample_rate);
+
+/*!
+ * \brief Conversion function to take a media type and turn it into a string
+ *
+ * \param type The media type
+ *
+ * \retval string representation of the media type
+ */
+const char *ast_codec_media_type2str(enum ast_media_type type);
+
+#endif /* _AST_CODEC_H */

Propchange: team/group/media_formats/include/asterisk/codec.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: team/group/media_formats/include/asterisk/codec.h
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: team/group/media_formats/include/asterisk/codec.h
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: team/group/media_formats/main/asterisk.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats/main/asterisk.c?view=diff&rev=406039&r1=406038&r2=406039
==============================================================================
--- team/group/media_formats/main/asterisk.c (original)
+++ team/group/media_formats/main/asterisk.c Tue Jan 21 14:04:48 2014
@@ -248,6 +248,7 @@
 #include "asterisk/stasis_system.h"
 #include "asterisk/security_events.h"
 #include "asterisk/endpoints.h"
+#include "asterisk/codec.h"
 
 #include "../defaults.h"
 
@@ -4319,6 +4320,16 @@
 		exit(1);
 	}
 
+	if (ast_codec_init()) {
+		printf("%s", term_quit());
+		exit(1);
+	}
+
+	if (ast_codec_builtin_init()) {
+		printf("%s", term_quit());
+		exit(1);
+	}
+
 #ifdef AST_XML_DOCS
 	/* Load XML documentation. */
 	ast_xmldoc_load_documentation();

Added: team/group/media_formats/main/codec.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats/main/codec.c?view=auto&rev=406039
==============================================================================
--- team/group/media_formats/main/codec.c (added)
+++ team/group/media_formats/main/codec.c Tue Jan 21 14:04:48 2014
@@ -1,0 +1,187 @@
+/*
+ * Asterisk -- An open source telephony toolkit.
+ *
+ * Copyright (C) 2014, Digium, Inc.
+ *
+ * Joshua Colp <jcolp at 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 Codecs API
+ *
+ * \author Joshua Colp <jcolp at digium.com>
+ */
+
+/*** MODULEINFO
+	<support_level>core</support_level>
+ ***/
+
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
+#include "asterisk/logger.h"
+#include "asterisk/codec.h"
+#include "asterisk/astobj2.h"
+#include "asterisk/strings.h"
+#include "asterisk/module.h"
+
+/*! \brief Number of buckets to use for codecs (should be prime for performance reasons) */
+#define CODEC_BUCKETS 53
+
+/*! \brief Current identifier value for newly registered codec */
+static int codec_id = 1;
+
+/*! \brief Registered codecs */
+struct ao2_container *codecs;
+
+static int codec_hash(const void *obj, int flags)
+{
+	const struct ast_codec *codec;
+	const char *key;
+
+	switch (flags & OBJ_SEARCH_MASK) {
+	case OBJ_SEARCH_KEY:
+		key = obj;
+		return ast_str_hash(key);
+	case OBJ_SEARCH_OBJECT:
+		codec = obj;
+		return ast_str_hash(codec->name);
+	default:
+		/* Hash can only work on something with a full key. */
+		ast_assert(0);
+		return 0;
+	}
+}
+
+static int codec_cmp(void *obj, void *arg, int flags)
+{
+	const struct ast_codec *left = obj;
+	const struct ast_codec *right = arg;
+	const char *right_key = arg;
+	int cmp;
+
+	switch (flags & OBJ_SEARCH_MASK) {
+	case OBJ_SEARCH_OBJECT:
+		right_key = right->name;
+		cmp = strcmp(left->name, right_key);
+		cmp |= (right->type != left->type);
+		cmp |= (right->sample_rate != left->sample_rate);
+		break;
+	case OBJ_SEARCH_KEY:
+		cmp = strcmp(left->name, right_key);
+		break;
+	case OBJ_SEARCH_PARTIAL_KEY:
+		cmp = strncmp(left->name, right_key, strlen(right_key));
+		break;
+	default:
+		ast_assert(0);
+		cmp = 0;
+		break;
+	}
+	if (cmp) {
+		return 0;
+	}
+
+	return CMP_MATCH;
+}
+
+/*! \brief Function called when the process is shutting down */
+static void codec_shutdown(void)
+{
+	ao2_cleanup(codecs);
+}
+
+int ast_codec_init(void)
+{
+	codecs = ao2_container_alloc_options(AO2_ALLOC_OPT_LOCK_RWLOCK, CODEC_BUCKETS, codec_hash, codec_cmp);
+	if (!codecs) {
+		return -1;
+	}
+
+	ast_register_atexit(codec_shutdown);
+
+	return 0;
+}
+
+int __ast_codec_register(struct ast_codec *codec, struct ast_module *mod)
+{
+	SCOPED_AO2WRLOCK(lock, codecs);
+	struct ast_codec *codec_new;
+
+	/* Some types have specific requirements */
+	if (codec->type == AST_MEDIA_TYPE_AUDIO) {
+		if (!codec->sample_rate) {
+			ast_log(LOG_ERROR, "A sample rate must be specified for codec '%s' of type '%s'\n",
+				codec->name, ast_codec_media_type2str(codec->type));
+			return -1;
+		}
+	}
+
+	codec_new = ao2_find(codecs, codec, OBJ_SEARCH_OBJECT | OBJ_NOLOCK);
+	if (codec_new) {
+		ast_log(LOG_ERROR, "A codec with name '%s' of type '%s' and sample rate '%d' is already registered\n",
+			codec->name, ast_codec_media_type2str(codec->type), codec->sample_rate);
+		ao2_ref(codec_new, -1);
+		return -1;
+	}
+
+	codec_new = ao2_alloc_options(sizeof(*codec_new), NULL, AO2_ALLOC_OPT_LOCK_NOLOCK);
+	if (!codec_new) {
+		ast_log(LOG_ERROR, "Could not allocate a codec with name '%s' of type '%s' and sample rate '%d'\n",
+			codec->name, ast_codec_media_type2str(codec->type), codec->sample_rate);
+		return -1;
+	}
+	*codec_new = *codec;
+	codec_new->id = codec_id++;
+
+	ao2_link_flags(codecs, codec_new, OBJ_NOLOCK);
+
+	/* Once registered a codec can not be unregistered, and the module must persist */
+	ast_module_ref(mod);
+
+	ast_verb(2, "Registered '%s' codec '%s' at sample rate '%d' with id '%d'\n",
+		ast_codec_media_type2str(codec->type), codec->name, codec->sample_rate, codec_new->id);
+
+	ao2_ref(codec_new, -1);
+
+	return 0;
+}
+
+struct ast_codec *ast_codec_get(const char *name, enum ast_media_type type, unsigned int sample_rate)
+{
+	struct ast_codec codec = {
+		.name = name,
+		.type = type,
+		.sample_rate = sample_rate,
+	};
+
+	return ao2_find(codecs, &codec, OBJ_SEARCH_OBJECT);
+}
+
+const char *ast_codec_media_type2str(enum ast_media_type type)
+{
+	switch (type) {
+	case AST_MEDIA_TYPE_AUDIO:
+		return "audio";
+	case AST_MEDIA_TYPE_VIDEO:
+		return "video";
+	case AST_MEDIA_TYPE_IMAGE:
+		return "image";
+	case AST_MEDIA_TYPE_TEXT:
+		return "text";
+	default:
+		return "<unknown>";
+	}
+}

Propchange: team/group/media_formats/main/codec.c
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: team/group/media_formats/main/codec.c
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: team/group/media_formats/main/codec.c
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: team/group/media_formats/main/codec_builtin.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats/main/codec_builtin.c?view=auto&rev=406039
==============================================================================
--- team/group/media_formats/main/codec_builtin.c (added)
+++ team/group/media_formats/main/codec_builtin.c Tue Jan 21 14:04:48 2014
@@ -1,0 +1,449 @@
+/*
+ * Asterisk -- An open source telephony toolkit.
+ *
+ * Copyright (C) 2014, Digium, Inc.
+ *
+ * Joshua Colp <jcolp at 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 Built-in supported codecs
+ *
+ * \author Joshua Colp <jcolp at digium.com>
+ */
+
+/*** MODULEINFO
+	<support_level>core</support_level>
+ ***/
+
+#include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
+#include "asterisk/logger.h"
+#include "asterisk/codec.h"
+
+static struct ast_codec g723 = {
+	.name = "g723",
+	.description = "G.723.1",
+	.type = AST_MEDIA_TYPE_AUDIO,
+	.sample_rate = 8000,
+	.minimum_ms = 30,
+	.maximum_ms = 300,
+	.increment_ms = 30,
+	.default_ms = 30,
+};
+
+static struct ast_codec ulaw = {
+	.name = "ulaw",
+	.description = "G.711 u-law",
+	.type = AST_MEDIA_TYPE_AUDIO,
+	.sample_rate = 8000,
+	.minimum_ms = 10,
+	.maximum_ms = 150,
+	.increment_ms = 10,
+	.default_ms = 20,
+};
+
+static struct ast_codec alaw = {
+	.name = "alaw",
+	.description = "G.711 a-law",
+	.type = AST_MEDIA_TYPE_AUDIO,
+	.sample_rate = 8000,
+	.minimum_ms = 10,
+	.maximum_ms = 150,
+	.increment_ms = 10,
+	.default_ms = 20,
+};
+
+static struct ast_codec gsm = {
+	.name = "gsm",
+	.description = "GSM",
+	.type = AST_MEDIA_TYPE_AUDIO,
+	.sample_rate = 8000,
+	.minimum_ms = 20,
+	.maximum_ms = 300,
+	.increment_ms = 20,
+	.default_ms = 20,
+};
+
+static struct ast_codec g726rfc3551 = {
+	.name = "g726",
+	.description = "G.726 RFC3551",
+	.type = AST_MEDIA_TYPE_AUDIO,
+	.sample_rate = 8000,
+	.minimum_ms = 10,
+	.maximum_ms = 300,
+	.increment_ms = 10,
+	.default_ms = 20,
+};
+
+static struct ast_codec g726aal2 = {
+	.name = "g726aal2",
+	.description = "G.726 AAL2",
+	.type = AST_MEDIA_TYPE_AUDIO,
+	.sample_rate = 8000,
+	.minimum_ms = 10,
+	.maximum_ms = 300,
+	.increment_ms = 10,
+	.default_ms = 20,
+};
+
+static struct ast_codec adpcm = {
+	.name = "adpcm",
+	.description = "ADPCM",
+	.type = AST_MEDIA_TYPE_AUDIO,
+	.sample_rate = 8000,
+	.minimum_ms = 10,
+	.maximum_ms = 300,
+	.increment_ms = 10,
+	.default_ms = 20,
+};
+
+static struct ast_codec slin8 = {
+	.name = "slin",
+	.description = "16 bit Signed Linear PCM",
+	.type = AST_MEDIA_TYPE_AUDIO,
+	.sample_rate = 8000,
+	.minimum_ms = 10,
+	.maximum_ms = 70,
+	.increment_ms = 10,
+	.default_ms = 20,
+};
+
+static struct ast_codec slin12 = {
+	.name = "slin",
+	.description = "16 bit Signed Linear PCM (12kHz)",
+	.type = AST_MEDIA_TYPE_AUDIO,
+	.sample_rate = 12000,
+	.minimum_ms = 10,
+	.maximum_ms = 70,
+	.increment_ms = 10,
+	.default_ms = 20,
+};
+
+static struct ast_codec slin16 = {
+	.name = "slin",
+	.description = "16 bit Signed Linear PCM (16kHz)",
+	.type = AST_MEDIA_TYPE_AUDIO,
+	.sample_rate = 16000,
+	.minimum_ms = 10,
+	.maximum_ms = 70,
+	.increment_ms = 10,
+	.default_ms = 20,
+};
+
+static struct ast_codec slin24 = {
+	.name = "slin",
+	.description = "16 bit Signed Linear PCM (24kHz)",
+	.type = AST_MEDIA_TYPE_AUDIO,
+	.sample_rate = 24000,
+	.minimum_ms = 10,
+	.maximum_ms = 70,
+	.increment_ms = 10,
+	.default_ms = 20,
+};
+
+static struct ast_codec slin32 = {
+	.name = "slin",
+	.description = "16 bit Signed Linear PCM (32kHz)",
+	.type = AST_MEDIA_TYPE_AUDIO,
+	.sample_rate = 32000,
+	.minimum_ms = 10,
+	.maximum_ms = 70,
+	.increment_ms = 10,
+	.default_ms = 20,
+};
+
+static struct ast_codec slin44 = {
+	.name = "slin",
+	.description = "16 bit Signed Linear PCM (44kHz)",
+	.type = AST_MEDIA_TYPE_AUDIO,
+	.sample_rate = 44000,
+	.minimum_ms = 10,
+	.maximum_ms = 70,
+	.increment_ms = 10,
+	.default_ms = 20,
+};
+
+static struct ast_codec slin48 = {
+	.name = "slin",
+	.description = "16 bit Signed Linear PCM (48kHz)",
+	.type = AST_MEDIA_TYPE_AUDIO,
+	.sample_rate = 48000,
+	.minimum_ms = 10,
+	.maximum_ms = 70,
+	.increment_ms = 10,
+	.default_ms = 20,
+};
+
+static struct ast_codec slin96 = {
+	.name = "slin",
+	.description = "16 bit Signed Linear PCM (96kHz)",
+	.type = AST_MEDIA_TYPE_AUDIO,
+	.sample_rate = 96000,
+	.minimum_ms = 10,
+	.maximum_ms = 70,
+	.increment_ms = 10,
+	.default_ms = 20,
+};
+
+static struct ast_codec slin192 = {
+	.name = "slin",
+	.description = "16 bit Signed Linear PCM (192kHz)",
+	.type = AST_MEDIA_TYPE_AUDIO,
+	.sample_rate = 192000,
+	.minimum_ms = 10,
+	.maximum_ms = 70,
+	.increment_ms = 10,
+	.default_ms = 20,
+};
+
+static struct ast_codec lpc10 = {
+	.name = "lpc10",
+	.description = "LPC10",
+	.type = AST_MEDIA_TYPE_AUDIO,
+	.sample_rate = 8000,
+	.minimum_ms = 20,
+	.maximum_ms = 20,
+	.increment_ms = 20,
+	.default_ms = 20,
+};
+
+static struct ast_codec g729a = {
+	.name = "g729",
+	.description = "G.729A",
+	.type = AST_MEDIA_TYPE_AUDIO,
+	.sample_rate = 8000,
+	.minimum_ms = 10,
+	.maximum_ms = 230,
+	.increment_ms = 10,
+	.default_ms = 20,
+};
+
+static struct ast_codec speex8 = {
+	.name = "speex",
+	.description = "SpeeX",
+	.type = AST_MEDIA_TYPE_AUDIO,
+	.sample_rate = 8000,
+	.minimum_ms = 10,
+	.maximum_ms = 60,
+	.increment_ms = 10,
+	.default_ms = 20,
+};
+
+static struct ast_codec speex16 = {
+	.name = "speex",
+	.description = "SpeeX 16khz",
+	.type = AST_MEDIA_TYPE_AUDIO,
+	.sample_rate = 16000,
+	.minimum_ms = 10,
+	.maximum_ms = 60,
+	.increment_ms = 10,
+	.default_ms = 20,
+};
+
+static struct ast_codec speex32 = {
+	.name = "speex",
+	.description = "SpeeX 32khz",
+	.type = AST_MEDIA_TYPE_AUDIO,
+	.sample_rate = 32000,
+	.minimum_ms = 10,
+	.maximum_ms = 60,
+	.increment_ms = 10,
+	.default_ms = 20,
+};
+
+static struct ast_codec ilbc = {
+	.name = "ilbc",
+	.description = "iLBC",
+	.type = AST_MEDIA_TYPE_AUDIO,
+	.sample_rate = 8000,
+	.minimum_ms = 30,
+	.maximum_ms = 30,
+	.increment_ms = 30,
+	.default_ms = 30,
+};
+
+static struct ast_codec g722 = {
+	.name = "g722",
+	.description = "G722",
+	.type = AST_MEDIA_TYPE_AUDIO,
+	.sample_rate = 16000,
+	.minimum_ms = 10,
+	.maximum_ms = 150,
+	.increment_ms = 10,
+	.default_ms = 20,
+};
+
+static struct ast_codec siren7 = {
+	.name = "siren7",
+	.description = "ITU G.722.1 (Siren7, licensed from Polycom)",
+	.type = AST_MEDIA_TYPE_AUDIO,
+	.sample_rate = 16000,
+	.minimum_ms = 20,
+	.maximum_ms = 80,
+	.increment_ms = 20,
+	.default_ms = 20,
+};
+
+static struct ast_codec siren14 = {
+	.name = "siren14",
+	.description = "ITU G.722.1 Annex C, (Siren14, licensed from Polycom)",
+	.type = AST_MEDIA_TYPE_AUDIO,
+	.sample_rate = 32000,
+	.minimum_ms = 20,
+	.maximum_ms = 80,
+	.increment_ms = 20,
+	.default_ms = 20,
+};
+
+static struct ast_codec testlaw = {
+	.name = "testlaw",
+	.description = "G.711 test-law",
+	.type = AST_MEDIA_TYPE_AUDIO,
+	.sample_rate = 8000,
+	.minimum_ms = 10,
+	.maximum_ms = 150,
+	.increment_ms = 10,
+	.default_ms = 20,
+};
+
+static struct ast_codec g719 = {
+	.name = "g719",
+	.description = "ITU G.719",
+	.type = AST_MEDIA_TYPE_AUDIO,
+	.sample_rate = 48000,
+	.minimum_ms = 20,
+	.maximum_ms = 80,
+	.increment_ms = 20,
+	.default_ms = 20,
+};
+
+static struct ast_codec opus = {
+	.name = "opus",
+	.description = "Opus Codec",
+	.type = AST_MEDIA_TYPE_AUDIO,
+	.sample_rate = 48000,
+	.minimum_ms = 20,
+	.maximum_ms = 60,
+	.increment_ms = 20,
+	.default_ms = 20,
+};
+
+static struct ast_codec jpeg = {
+	.name = "jpeg",
+	.description = "JPEG image",
+	.type = AST_MEDIA_TYPE_IMAGE,
+};
+
+static struct ast_codec png = {
+	.name = "png",
+	.description = "PNG Image",
+	.type = AST_MEDIA_TYPE_IMAGE,
+};
+
+static struct ast_codec h261 = {
+	.name = "h261",
+	.description = "H.261 video",
+	.type = AST_MEDIA_TYPE_VIDEO,
+};
+
+static struct ast_codec h263 = {
+	.name = "h263",
+	.description = "H.263 video",
+	.type = AST_MEDIA_TYPE_VIDEO,
+};
+
+static struct ast_codec h263p = {
+	.name = "h263p",
+	.description = "H.263+ video",
+	.type = AST_MEDIA_TYPE_VIDEO,
+};
+
+static struct ast_codec h264 = {
+	.name = "h264",
+	.description = "H.264 video",
+	.type = AST_MEDIA_TYPE_VIDEO,
+};
+
+static struct ast_codec mpeg4 = {
+	.name = "mpeg4",
+	.description = "MPEG4 video",
+	.type = AST_MEDIA_TYPE_VIDEO,
+};
+
+static struct ast_codec vp8 = {
+	.name = "vp8",
+	.description = "VP8 video",
+	.type = AST_MEDIA_TYPE_VIDEO,
+};
+
+static struct ast_codec t140red = {
+	.name = "red",
+	.description = "T.140 Realtime Text with redundancy",
+	.type = AST_MEDIA_TYPE_TEXT,
+};
+
+static struct ast_codec t140 = {
+	.name = "t140",
+	.description = "Passthrough T.140 Realtime Text",
+	.type = AST_MEDIA_TYPE_TEXT,
+};
+
+int ast_codec_builtin_init(void)
+{
+	int res = 0;
+
+	res |= __ast_codec_register(&g723, NULL);
+	res |= __ast_codec_register(&ulaw, NULL);
+	res |= __ast_codec_register(&alaw, NULL);
+	res |= __ast_codec_register(&gsm, NULL);
+	res |= __ast_codec_register(&g726rfc3551, NULL);
+	res |= __ast_codec_register(&g726aal2, NULL);
+	res |= __ast_codec_register(&adpcm, NULL);
+	res |= __ast_codec_register(&slin8, NULL);
+	res |= __ast_codec_register(&slin12, NULL);
+	res |= __ast_codec_register(&slin16, NULL);
+	res |= __ast_codec_register(&slin24, NULL);
+	res |= __ast_codec_register(&slin32, NULL);
+	res |= __ast_codec_register(&slin44, NULL);
+	res |= __ast_codec_register(&slin48, NULL);
+	res |= __ast_codec_register(&slin96, NULL);
+	res |= __ast_codec_register(&slin192, NULL);
+	res |= __ast_codec_register(&lpc10, NULL);
+	res |= __ast_codec_register(&g729a, NULL);
+	res |= __ast_codec_register(&speex8, NULL);
+	res |= __ast_codec_register(&speex16, NULL);
+	res |= __ast_codec_register(&speex32, NULL);
+	res |= __ast_codec_register(&ilbc, NULL);
+	res |= __ast_codec_register(&g722, NULL);
+	res |= __ast_codec_register(&siren7, NULL);
+	res |= __ast_codec_register(&siren14, NULL);
+	res |= __ast_codec_register(&testlaw, NULL);
+	res |= __ast_codec_register(&g719, NULL);
+	res |= __ast_codec_register(&opus, NULL);
+	res |= __ast_codec_register(&jpeg, NULL);
+	res |= __ast_codec_register(&png, NULL);
+	res |= __ast_codec_register(&h261, NULL);
+	res |= __ast_codec_register(&h263, NULL);
+	res |= __ast_codec_register(&h263p, NULL);
+	res |= __ast_codec_register(&h264, NULL);
+	res |= __ast_codec_register(&mpeg4, NULL);
+	res |= __ast_codec_register(&vp8, NULL);
+	res |= __ast_codec_register(&t140red, NULL);
+	res |= __ast_codec_register(&t140, NULL);
+
+	return res;
+}

Propchange: team/group/media_formats/main/codec_builtin.c
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: team/group/media_formats/main/codec_builtin.c
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: team/group/media_formats/main/codec_builtin.c
------------------------------------------------------------------------------
    svn:mime-type = text/plain




More information about the asterisk-commits mailing list