[asterisk-commits] file: branch file/media r168577 - in /team/file/media: include/asterisk/ main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jan 13 15:25:00 CST 2009


Author: file
Date: Tue Jan 13 15:24:59 2009
New Revision: 168577

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=168577
Log:
Add support for media codec registration and unregistration. While you can not yet set up translation paths the code will find all possible paths between formats when a codec is registered. It does this by following the source codec and seeing what it can translate to, and so on until it can go no further. It then jumps back and sees if it can go to another format and if so continues. If not it jumps back. This continues until all possible paths are exhausted. As a path is discovered it is compared against the "active" path to see if it beats it on total cost. If they are equal the one that takes the least amount of steps to get to the destination media format is chosen. Once all this is done any paths which are not active are then discarded.

Added:
    team/file/media/include/asterisk/media_codec.h   (with props)
Modified:
    team/file/media/include/asterisk/media.h
    team/file/media/main/media.c

Modified: team/file/media/include/asterisk/media.h
URL: http://svn.digium.com/svn-view/asterisk/team/file/media/include/asterisk/media.h?view=diff&rev=168577&r1=168576&r2=168577
==============================================================================
--- team/file/media/include/asterisk/media.h (original)
+++ team/file/media/include/asterisk/media.h Tue Jan 13 15:24:59 2009
@@ -78,6 +78,8 @@
 	enum ast_media_format_type type;                 /*!< Type of media format */
 	unsigned int channels;                           /*!< Number of channels this media format has */
 	struct ast_variable *format_specific_attributes; /*!< Format specific attributes */
+	struct ao2_container *codecs;                    /*!< Registered codecs on the media format */
+	struct ao2_container *paths;                     /*!< Translation paths to other formats */
 	union {
 		struct ast_media_format_audio audio;                     /*!< Audio specific information */
 		struct ast_media_format_video video;                     /*!< Video specific information */

Added: team/file/media/include/asterisk/media_codec.h
URL: http://svn.digium.com/svn-view/asterisk/team/file/media/include/asterisk/media_codec.h?view=auto&rev=168577
==============================================================================
--- team/file/media/include/asterisk/media_codec.h (added)
+++ team/file/media/include/asterisk/media_codec.h Tue Jan 13 15:24:59 2009
@@ -1,0 +1,121 @@
+/*
+ * Asterisk -- An open source telephony toolkit.
+ *
+ * Copyright (C) 2009, 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 Media Codec
+ * \author Joshua Colp <jcolp at digium.com>
+ * \ref AstMediaCodecss
+ */
+
+/*!
+ * \page AstMediaCodecs Media Codec API
+ *
+ */
+
+#ifndef _ASTERISK_MEDIA_CODEC_H
+#define _ASTERISK_MEDIA_CODEC_H
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
+
+/*!
+ * \brief Structure that represents a media codec
+ */
+struct ast_media_codec {
+	char name[32];                              /*!< Name of this codec */
+	struct ast_media_format source_format;      /*!< Format that this codec translates from */
+	struct ast_media_format destination_format; /*!< Format that this codec translates to */
+	unsigned int cost;                          /*!< Cost of this codec translation */
+};
+
+/*!
+ * \brief Structure that represents a registered media codec
+ */
+struct ast_media_codec_direct_path {
+	struct ast_media_format format;           /*!< Format this direct path is to */
+	struct ast_media_codec *codec;            /*!< Codec this direct path is for */
+	struct ast_media_codec_direct_path *next; /*!< Variable used during the translation recalculation process */
+};
+
+/*!
+ * \brief Structure that represents a translation path
+ */
+struct ast_media_codec_translation_path {
+};		
+	
+/*!
+ * \brief Structure that represents a step in the codec translation process
+ */
+struct ast_media_codec_step {
+	struct ast_media_codec *codec;              /*!< Codec used for this step of the process */
+	AST_LIST_ENTRY(ast_media_codec_step) entry; /*!< Linked list information */
+};
+	
+/*!
+ * \brief Structure that represents a quick path to another format
+ */
+struct ast_media_codec_quick_path {
+	struct ast_media_format format;                     /*!< Format that this path ends at */
+	AST_LIST_HEAD_NOLOCK(, ast_media_codec_step) steps; /*!< Codec steps to get to the above format */
+	unsigned int total_cost;                            /*!< Total cost of this quick path */
+	unsigned int length;                                /*!< Length of this quick path */
+	unsigned int active:1;                              /*!< Path is the active one */
+	unsigned int new:1;                                 /*!< Path is new */
+};
+	
+/*! \brief Register a media codec
+ *
+ * \param media_codec The media codec to register
+ *
+ * \retval 0 on success
+ * \retval -1 on failure
+ *
+ * Example usage:
+ *
+ * \code
+ * int res = ast_media_codec_register(&codec_ulaw);
+ * \endcode
+ *
+ * This registers the media codec codec_ulaw with the media core.
+ */
+int ast_media_codec_register(struct ast_media_codec *media_codec);
+
+/*! \brief Unregister a media codec
+ *
+ * \param media_codec The media codec to unregister
+ *
+ * \retval 0 on success
+ * \retval -1 on failure
+ *
+ * Example usage:
+ *
+ * \code
+ * int res = ast_media_codec_unregister(&codec_ulaw);
+ * \endcode
+ *
+ * This unregisters the media codec codec_ulaw from the media core.
+ * It will no longer be used for translations.
+ */
+int ast_media_codec_unregister(struct ast_media_codec *media_codec);
+	
+#if defined(__cplusplus) || defined(c_plusplus)
+}
+#endif
+
+#endif /* _ASTERISK_MEDIA_CODEC_H */

Propchange: team/file/media/include/asterisk/media_codec.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: team/file/media/include/asterisk/media_codec.h
------------------------------------------------------------------------------
    svn:keywords = 'Author Date Id Revision'

Propchange: team/file/media/include/asterisk/media_codec.h
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: team/file/media/main/media.c
URL: http://svn.digium.com/svn-view/asterisk/team/file/media/main/media.c?view=diff&rev=168577&r1=168576&r2=168577
==============================================================================
--- team/file/media/main/media.c (original)
+++ team/file/media/main/media.c Tue Jan 13 15:24:59 2009
@@ -27,10 +27,12 @@
 
 ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
-#include "asterisk/media.h"
 #include "asterisk/astobj2.h"
 #include "asterisk/cli.h"
 #include "asterisk/config.h"
+#include "asterisk/linkedlists.h"
+#include "asterisk/media.h"
+#include "asterisk/media_codec.h"
 
 /* We have to provide a module name for configuration parser reasons */
 #define AST_MODULE "media"
@@ -54,6 +56,20 @@
 	return ast_str_hash(media_format->name);
 }
 
+/*! \brief Hashing function used for media direct paths */
+static int media_codec_hash_cb(const void *obj, const int flags)
+{
+	const struct ast_media_codec_direct_path *direct_path = obj;
+	return direct_path->format.type + direct_path->format.channels;
+}
+
+/*! \brief Hashing function used for media quick paths */
+static int media_path_hash_cb(const void *obj, const int flags)
+{
+	const struct ast_media_codec_quick_path *quick_path = obj;
+	return quick_path->format.type + quick_path->format.channels;
+}
+
 /*! \brief Comparison function used for media format finding by name */
 static int media_format_cmp_cb(void *obj, void *arg, int flags)
 {
@@ -65,7 +81,7 @@
 static int media_format_parameters_cmp_cb(void *obj, void *arg, int flags)
 {
 	const struct ast_media_format *format0 = obj, *format1 = arg;
-
+	
 	if (format0->type != format1->type) {
 		return 0;
 	}
@@ -91,6 +107,21 @@
 	return CMP_MATCH | CMP_STOP;
 }
 
+/*! \brief Comparison function used for media direct paths */
+static int media_codec_cmp_cb(void *obj, void *arg, int flags)
+{
+	struct ast_media_codec_direct_path *path0 = obj, *path1 = arg;
+	return media_format_parameters_cmp_cb(&path0->format, &path1->format, flags);
+}
+
+/*! \brief Comparison function used for media quick paths */
+static int media_path_cmp_cb(void *obj, void *arg, int flags)
+{
+	struct ast_media_codec_quick_path *path0 = obj, *path1 = arg;
+	
+	return media_format_parameters_cmp_cb(&path0->format, &path1->format, flags) && path0->active == path1->active ? CMP_MATCH | CMP_STOP : 0;
+}
+
 /*! \brief Destroy function used for media formats */
 static void media_format_destroy_cb(void *obj)
 {
@@ -101,6 +132,27 @@
 		media_format->format_specific_attributes = NULL;
 	}
 
+	if (media_format->codecs) {
+		ao2_ref(media_format->codecs, -1);
+	}
+
+	if (media_format->paths) {
+		ao2_ref(media_format->paths, -1);
+	}
+	
+	return;
+}
+
+/*! \brief Destroy function used for media quick paths */
+static attribute_unused void media_path_destroy_cb(void *obj)
+{
+	struct ast_media_codec_quick_path *path = obj;
+	struct ast_media_codec_step *step;
+
+	while ((step = AST_LIST_REMOVE_HEAD(&path->steps, entry))) {
+		ast_free(step);
+	}
+	
 	return;
 }
 
@@ -223,6 +275,280 @@
 {
 	ao2_ref(media_format_list, -1);
 	return NULL;
+}
+
+/*! \brief Callback function which returns a codec step matching a path */
+static int media_codec_find_duplicate_path(void *obj, void *arg, int flags)
+{
+	struct ast_media_codec_quick_path *quick_path = obj;
+	struct ast_media_codec_direct_path *paths = arg, *path = paths;
+	struct ast_media_codec_step *step;
+
+	if (!quick_path->new) {
+		return 0;
+	}
+	
+	AST_LIST_TRAVERSE(&quick_path->steps, step, entry) {
+		/* If the path exceeds the steps OR if we encounter a codec not part of this step... then this is not the same path
+		 * that we are trying to take. */
+		if (!path || (step->codec != path->codec)) {
+			return 0;
+		}
+		path = path->next;
+	}
+
+	return CMP_MATCH | CMP_STOP;
+}
+
+/*! \brief Callback function which returns a path we have not yet taken and can take */
+static int media_codec_next_follow_cb(void *obj, void *arg, void *data, int flags)
+{
+	struct ast_media_codec_direct_path *path = obj, tmp = { .codec = path->codec, .next = data, }, *duplicate_path = data;
+	struct ast_media_format *actual_media_format = arg;
+	struct ast_media_codec_quick_path *quick_path;
+	
+	/* Stop us from trying to go back to the format we actually came from */
+	if (media_format_parameters_cmp_cb(actual_media_format, &path->codec->destination_format, 0)) {
+		return 0;
+	}
+	
+	if ((quick_path = ao2_callback(actual_media_format->paths, 0, media_codec_find_duplicate_path, &tmp))) {
+		ao2_ref(quick_path, -1);
+		return 0;
+	}
+
+	while ((duplicate_path = duplicate_path->next)) {
+		if (duplicate_path == path) {
+			return 0;
+		}
+	}
+	
+	return CMP_MATCH | CMP_STOP;
+}
+
+/*! \brief Helper function to create duplicate a set of media codec steps */
+static void media_codec_populate_codec_steps(struct ast_media_format *source_format, struct ast_media_format *destination_format, struct ast_media_codec_direct_path *paths)
+{
+	struct ast_media_codec_quick_path *quick_path, *existing_path, tmp = { .format = *destination_format, .active = 1 };
+
+	if (!(quick_path = ao2_alloc(sizeof(*quick_path), media_path_destroy_cb))) {
+		return;
+	}
+
+	quick_path->format = *destination_format;
+	quick_path->new = 1;
+	
+	while ((paths = paths->next)) {
+		struct ast_media_codec_step *step;
+
+		if (!(step = ast_calloc(1, sizeof(*step)))) {
+			continue;
+		}
+
+		step->codec = paths->codec;
+		
+		AST_LIST_INSERT_TAIL(&quick_path->steps, step, entry);
+
+		quick_path->total_cost += paths->codec->cost;
+		quick_path->length += 1;
+	}
+
+	if ((existing_path = ao2_find(source_format->paths, &tmp, OBJ_POINTER))) {
+		/* If this path trumps the current active one for the destination format on cost
+		 * then we take their place. */
+		if (((existing_path->total_cost == quick_path->total_cost && quick_path->length < existing_path->length)) ||
+		    (existing_path->total_cost > quick_path->total_cost)) {
+			ast_verb(2, "Dropping active quick path from '%s' to '%s' because new one "
+				 "has total cost '%d' while old one has '%d'\n", source_format->name,
+				 destination_format->name, quick_path->total_cost, existing_path->total_cost);
+			existing_path->active = 0;
+			quick_path->active = 1;
+		}
+		ao2_ref(existing_path, -1);
+	} else {
+		quick_path->active = 1;
+	}
+	
+	ao2_link(source_format->paths, quick_path);
+
+	if (quick_path->active) {
+		ast_verb(2, "Discovered quick path from '%s' to '%s' with total cost '%d'\n",
+			 source_format->name, destination_format->name, quick_path->total_cost);
+	}
+	
+	ao2_ref(quick_path, -1);
+
+	return;
+}
+
+/*! \brief Callback function which determines what path each codec can take */
+static int media_codec_follow_cb(void *obj, void *arg, int flags)
+{
+	struct ast_media_codec_direct_path *start_path = obj, paths = { .next = start_path, };
+	struct ast_media_format *actual_media_format = arg;
+
+	start_path->next = NULL;
+	
+	while (paths.next) {
+		struct ast_media_codec_direct_path *current_path = paths.next, *next_path;
+		struct ast_media_format *media_format = ast_media_format_find_by_parameters(&current_path->codec->destination_format);
+		
+		if (!media_format->codecs || !ao2_container_count(media_format->codecs) ||
+		    (!(next_path = ao2_callback_data(media_format->codecs, 0, media_codec_next_follow_cb, actual_media_format, paths.next)))) {
+			media_codec_populate_codec_steps(actual_media_format, media_format, &paths);
+			if (current_path != start_path) {
+				ao2_ref(current_path, -1);
+			}
+			paths.next = current_path->next;
+		} else {
+			next_path->next = paths.next;
+			paths.next = next_path;
+		}
+		ast_media_format_unref(media_format);
+	}		
+	
+	return 0;
+}
+
+/*! \brief Callback function which finalizes quick paths on a media format */
+static int media_path_finalization_cb(void *obj, void *arg, int flags)
+{
+	struct ast_media_codec_quick_path *quick_path = obj;
+
+	if ((!quick_path->new && !quick_path->active) || (quick_path->new && !quick_path->active)) {
+		return CMP_MATCH | CMP_STOP;
+	}
+	
+	return 0;
+}
+
+/*! \brief Callback function which determines if a quick path contains a given media codec */
+static int media_codec_drop_paths_cb(void *obj, void *arg, int flags)
+{
+	struct ast_media_codec_quick_path *quick_path = obj;
+	struct ast_media_codec *media_codec = arg;
+	struct ast_media_codec_step *step;
+
+	AST_LIST_TRAVERSE(&quick_path->steps, step, entry) {
+		if (step->codec == media_codec) {
+			return CMP_MATCH;
+		}
+	}
+
+	return 0;
+}
+
+/*! \brief Callback function which recalculates quick paths on ALL media formats */
+static int media_codec_recalc_paths_cb(void *obj, void *arg, int flags)
+{
+	struct ast_media_format *media_format = obj;
+	struct ast_media_codec *media_codec = arg;
+	
+	if (!media_format->paths) {
+		return 0;
+	}
+
+	if (media_codec) {
+		ao2_callback(media_format->paths, OBJ_UNLINK | OBJ_NODATA | OBJ_MULTIPLE, media_codec_drop_paths_cb, media_codec);
+	}
+	
+	ao2_callback(media_format->codecs, 0, media_codec_follow_cb, media_format);
+
+	ao2_callback(media_format->paths, OBJ_UNLINK | OBJ_NODATA | OBJ_MULTIPLE, media_path_finalization_cb, NULL);
+	
+	return 0;
+}
+
+int ast_media_codec_register(struct ast_media_codec *media_codec)
+{
+	struct ast_media_format *media_format = ast_media_format_find_by_parameters(&media_codec->source_format);
+	struct ast_media_codec_direct_path tmp = { .format = media_codec->destination_format, }, *path;
+	
+	if (!media_format) {
+		ast_log(LOG_ERROR, "Failed to find a media format matching that of the source format of '%s'. Do you have one configured?\n", media_codec->name);
+		return -1;
+	}
+
+	if (!media_format->codecs) {
+		if (!(media_format->codecs = ao2_container_alloc(MAX_MEDIA_FORMATS_BUCKETS, media_codec_hash_cb, media_codec_cmp_cb))) {
+			ast_log(LOG_ERROR, "Failed to create a codecs container on media format '%s'\n", media_format->name);
+			ast_media_format_unref(media_format);
+			return -1;
+		}
+	} else if ((path = ao2_find(media_format->codecs, &tmp, OBJ_POINTER))) {
+		if (path->codec->cost < media_codec->cost) {
+			ast_log(LOG_ERROR, "A direct path step already exists on media format '%s' that trumps codec '%s'\n",
+				media_format->name, media_codec->name);
+			ao2_ref(path, -1);
+			ast_media_format_unref(media_format);
+			return -1;
+		}
+		ao2_unlink(media_format->codecs, path);
+		ao2_ref(path, -1);
+	}
+
+	if ((path = ao2_alloc(sizeof(*path), NULL))) {
+		path->format = media_codec->destination_format;
+		path->codec = media_codec;
+		ao2_link(media_format->codecs, path);
+		ao2_ref(path, -1);
+	}
+
+	if (!media_format->paths) {
+		if (!(media_format->paths = ao2_container_alloc(MAX_MEDIA_FORMATS_BUCKETS, media_path_hash_cb, media_path_cmp_cb))) {
+			ast_log(LOG_ERROR, "Failed to create a quick paths container on media format '%s'\n", media_format->name);
+		}
+	}
+	
+	ao2_callback(media_formats, 0, media_codec_recalc_paths_cb, NULL);
+
+	if (path) {
+		ast_verb(2, "Registered media codec '%s' on media format '%s' with cost '%d'\n",
+			 media_codec->name, media_format->name, media_codec->cost);
+	}
+	
+	ast_media_format_unref(media_format);
+	
+	return path ? 0 : -1;
+}
+
+int ast_media_codec_unregister(struct ast_media_codec *media_codec)
+{
+	struct ast_media_format *media_format = ast_media_format_find_by_parameters(&media_codec->source_format);
+	struct ast_media_codec_direct_path tmp = { .format = media_codec->destination_format, }, *path;
+
+	if (!media_format) {
+		ast_log(LOG_ERROR, "Failed to unregister media codec '%s' because no media format exists that it could be on...\n", media_codec->name);
+		return -1;
+	}
+
+	if (!(path = ao2_find(media_format->codecs, &tmp, OBJ_POINTER))) {
+		ast_log(LOG_ERROR, "Failed to unregister media codec '%s' because it does not seem to be registered on media format '%s'\n",
+			media_codec->name, media_format->name);
+		ast_media_format_unref(media_format);
+		return -1;
+	}
+
+	if (path->codec != media_codec) {
+		ast_log(LOG_ERROR, "Failed to unregister media codec '%s' from '%s' because something else has apparently taken its place\n",
+			media_codec->name, media_format->name);
+		ao2_ref(path, -1);
+		ast_media_format_unref(media_format);
+		return -1;
+	}
+	
+	ao2_unlink(media_format->codecs, path);
+
+	ao2_callback(media_formats, 0, media_codec_recalc_paths_cb, media_codec);
+	
+	ao2_ref(path, -1);
+
+	ast_verb(2, "Unregistered media codec '%s' from media format '%s'\n",
+		 media_codec->name, media_format->name);
+	
+	ast_media_format_unref(media_format);
+	
+	return 0;
 }
 
 /*! \brief Conversion function which takes a media format enum and turns it into a string */
@@ -270,11 +596,9 @@
 	if (!media_format->parameters.audio.minimum_frame_size) {
 		media_format->parameters.audio.minimum_frame_size = media_format->parameters.audio.frame_size;
 	}
-
-	if (VERBOSITY_ATLEAST(2)) {
-		ast_verbose(VERBOSE_PREFIX_3 "Configured audio media format '%s' with codec '%s', sample rate '%d', and frame size '%d'\n", 
-			    media_format->name, media_format->codec, media_format->parameters.audio.sample_rate, media_format->parameters.audio.frame_size);
-	}
+	
+	ast_verb(3, "Configured audio media format '%s' with codec '%s', sample rate '%d', and frame size '%d'\n", 
+		 media_format->name, media_format->codec, media_format->parameters.audio.sample_rate, media_format->parameters.audio.frame_size);
 
 	return 0;
 }
@@ -289,9 +613,7 @@
 		CV_END;
 	}
 
-	if (VERBOSITY_ATLEAST(2)) {
-		ast_verbose(VERBOSE_PREFIX_3 "Configured video media format '%s'\n", media_format->name);
-	}
+	ast_verb(3, "Configured video media format '%s'\n", media_format->name);
 
 	return 0;
 }
@@ -299,30 +621,21 @@
 /*! \brief Function which populates a media format with image specific information */
 static int media_format_populate_image(struct ast_media_format *media_format, struct ast_variable *v)
 {
-	if (VERBOSITY_ATLEAST(2)) {
-		ast_verbose(VERBOSE_PREFIX_3 "Configured image media format '%s'\n", media_format->name);
-	}
-
+	ast_verb(3, "Configured image media format '%s'\n", media_format->name);
 	return 0;
 }
 
 /*! \brief Function which populates a media format with image stream specific information */
 static int media_format_populate_image_stream(struct ast_media_format *media_format, struct ast_variable *v)
 {
-	if (VERBOSITY_ATLEAST(2)) {
-		ast_verbose(VERBOSE_PREFIX_3 "Configured image stream media format '%s'\n", media_format->name);
-	}
-
+	ast_verb(3, "Configured image stream media format '%s'\n", media_format->name);
 	return 0;
 }
 
 /*! \brief Function which populates a media format with text specific information */
 static int media_format_populate_text(struct ast_media_format *media_format, struct ast_variable *v)
 {
-	if (VERBOSITY_ATLEAST(2)) {
-		ast_verbose(VERBOSE_PREFIX_3 "Configured text media format '%s'\n", media_format->name);
-	}
-
+	ast_verb(3, "Configured text media format '%s'\n", media_format->name);
 	return 0;
 }
 
@@ -341,10 +654,8 @@
 		return -1;
 	}
 
-	if (VERBOSITY_ATLEAST(2)) {
-		ast_verbose(VERBOSE_PREFIX_3 "Configured telephone event media format '%s' with sample rate '%d'\n",
-			    media_format->name, media_format->parameters.telephone_event.sample_rate);
-	}
+	ast_verb(3, "Configured telephone event media format '%s' with sample rate '%d'\n",
+		 media_format->name, media_format->parameters.telephone_event.sample_rate);
 
 	return 0;
 }
@@ -359,7 +670,7 @@
 	if (!(media_format = ao2_alloc(sizeof(*media_format), media_format_destroy_cb))) {
 		return;
 	}
-
+	
 	media_format->type = type;
 	ast_copy_string(media_format->name, name, sizeof(media_format->name));
 
@@ -392,7 +703,7 @@
 		res = media_format_populate_telephone_event(media_format, v);
 		break;
 	}
-	
+
 	if (!res) {
 		ao2_link(media_formats, media_format);
 	}
@@ -421,9 +732,7 @@
 		struct ast_media_format *media_format = ast_media_format_find_by_name(name);
 
 		if (media_format) {
-			if (VERBOSITY_ATLEAST(1)) {
-				ast_verbose(VERBOSE_PREFIX_2 "Skipped media format '%s' since it is already configured\n", name);
-			}
+			ast_verb(2, "Skipped media format '%s' since it is already configured\n", name);
 			ast_media_format_unref(media_format);
 			continue;
 		}
@@ -445,9 +754,7 @@
 		}
 	}
 
-	if (VERBOSITY_ATLEAST(1)) {
-		ast_verbose(VERBOSE_PREFIX_2 "%d media formats configured\n", ao2_container_count(media_formats));
-	}
+	ast_verb(2, "%d media formats configured\n", ao2_container_count(media_formats));
 
 	ast_config_destroy(cfg);
 
@@ -495,7 +802,7 @@
 static char *media_show_format(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
 	struct ast_media_format *media_format, tmp_media_format;
-
+	
 	switch (cmd) {
 	case CLI_INIT:
 		e->command = "media show format";
@@ -559,12 +866,12 @@
 	if (!(media_formats = ao2_container_alloc(MAX_MEDIA_FORMATS_BUCKETS, media_format_hash_cb, media_format_cmp_cb))) {
 		return;
 	}
-
+	
 	/* Load all defined media formats */
 	load_config(0);
 
 	/* Finally register the CLI commands that display them and allow the user to reload the user defined ones */
 	ast_cli_register_multiple(cli_media_formats, sizeof(cli_media_formats) / sizeof(struct ast_cli_entry));
-
+	
 	return;
 }




More information about the asterisk-commits mailing list