[asterisk-commits] dvossel: branch dvossel/fixtheworld_phase2 r306214 - in /team/dvossel/fixthew...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Feb 3 16:57:44 CST 2011


Author: dvossel
Date: Thu Feb  3 16:57:40 2011
New Revision: 306214

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=306214
Log:
Beginnings of the custom format config parser

Modified:
    team/dvossel/fixtheworld_phase2/include/asterisk/format.h
    team/dvossel/fixtheworld_phase2/main/format.c

Modified: team/dvossel/fixtheworld_phase2/include/asterisk/format.h
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase2/include/asterisk/format.h?view=diff&rev=306214&r1=306213&r2=306214
==============================================================================
--- team/dvossel/fixtheworld_phase2/include/asterisk/format.h (original)
+++ team/dvossel/fixtheworld_phase2/include/asterisk/format.h Thu Feb  3 16:57:40 2011
@@ -150,9 +150,9 @@
 /*! \brief Definition of supported media formats (codecs) */
 struct ast_format_list {
 	struct ast_format format; /*!< The unique format. */
-	const char *name;	/*!< short name */
+	char name[16];	/*!< short name */
 	int samplespersecond; /*!< Number of samples per second (8000/16000) */
-	const char *desc;	/*!< Description */
+	char desc[128];	/*!< Description */
 	int fr_len;	/*!< Single frame length in bytes */
 	int min_ms;	/*!< Min value */
 	int max_ms;	/*!< Max value */

Modified: team/dvossel/fixtheworld_phase2/main/format.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase2/main/format.c?view=diff&rev=306214&r1=306213&r2=306214
==============================================================================
--- team/dvossel/fixtheworld_phase2/main/format.c (original)
+++ team/dvossel/fixtheworld_phase2/main/format.c Thu Feb  3 16:57:40 2011
@@ -761,8 +761,8 @@
 		return -1;
 	}
 	ast_format_copy(&entry->format, format);
-	entry->name = name;
-	entry->desc = description;
+	ast_copy_string(entry->name, name, sizeof(entry->name));
+	ast_copy_string(entry->desc, description, sizeof(entry->desc));
 	entry->samplespersecond = samplespersecond;
 	entry->fr_len = fr_len;
 	entry->min_ms = min_ms;
@@ -916,7 +916,41 @@
 	}
 	return -1;
 }
-
+/*
+static int load_format_config(int reload)
+{
+	struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
+	struct ast_config *cfg = ast_config_load("codecs.conf", config_flags);
+	struct ast_variable *var;
+	char *cat = NULL;
+	int res;
+
+	if (cfg == CONFIG_STATUS_FILEMISSING || cfg == CONFIG_STATUS_FILEUNCHANGED || cfg == CONFIG_STATUS_FILEINVALID)
+		return 0;
+
+	while ((cat = ast_category_browse(cfg, cat))) {
+		const char *type;
+		struct ast_variable *var;
+		type = ast_variable_retrieve(cfg, cat, "type");
+		if (!type) {
+			continue;
+		}
+
+
+		var = ast_variable_browse(cfg, cat);
+
+		for (var = ast_variable_browse(cfg, cat); var; var = var->next) {
+			if (!strcasecmp(var->name, "type")) {
+				if (!strcasecmp(v->value, "silk")) {
+
+				}
+			}
+		}
+	}
+	ast_config_destroy(cfg);
+	return 0;
+}
+*/
 int ast_format_attr_reg_interface(const struct ast_format_attr_interface *interface)
 {
 	struct interface_ao2_wrapper *wrapper;




More information about the asterisk-commits mailing list