[asterisk-commits] branch group/new_loader_completion r23559 - in /team/group/new_loader_complet...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Sun Apr 30 02:48:32 MST 2006


Author: kpfleming
Date: Sun Apr 30 04:48:31 2006
New Revision: 23559

URL: http://svn.digium.com/view/asterisk?rev=23559&view=rev
Log:
update format modules

Modified:
    team/group/new_loader_completion/file.c
    team/group/new_loader_completion/formats/format_g723.c
    team/group/new_loader_completion/formats/format_g726.c
    team/group/new_loader_completion/formats/format_g729.c
    team/group/new_loader_completion/formats/format_gsm.c
    team/group/new_loader_completion/formats/format_h263.c
    team/group/new_loader_completion/formats/format_h264.c
    team/group/new_loader_completion/formats/format_ilbc.c
    team/group/new_loader_completion/formats/format_jpeg.c
    team/group/new_loader_completion/formats/format_pcm.c
    team/group/new_loader_completion/formats/format_sln.c
    team/group/new_loader_completion/formats/format_vox.c
    team/group/new_loader_completion/formats/format_wav.c
    team/group/new_loader_completion/formats/format_wav_gsm.c
    team/group/new_loader_completion/include/asterisk.h
    team/group/new_loader_completion/include/asterisk/file.h

Modified: team/group/new_loader_completion/file.c
URL: http://svn.digium.com/view/asterisk/team/group/new_loader_completion/file.c?rev=23559&r1=23558&r2=23559&view=diff
==============================================================================
--- team/group/new_loader_completion/file.c (original)
+++ team/group/new_loader_completion/file.c Sun Apr 30 04:48:31 2006
@@ -65,14 +65,10 @@
 
 static AST_LIST_HEAD_STATIC(formats, ast_format);
 
-int ast_format_register(const struct ast_format *f)
+int __ast_format_register(const struct ast_format *f, struct ast_module *mod)
 {
 	struct ast_format *tmp;
 
-	if (f->module == NULL) {
-		ast_log(LOG_WARNING, "Missing module pointer, you need to supply one\n");
-		return -1;
-	}
 	if (AST_LIST_LOCK(&formats)) {
 		ast_log(LOG_WARNING, "Unable to lock format list\n");
 		return -1;
@@ -84,12 +80,12 @@
 			return -1;
 		}
 	}
-	tmp = ast_calloc(1, sizeof(struct ast_format));
-	if (!tmp) {
+	if (!(tmp = ast_calloc(1, sizeof(*tmp)))) {
 		AST_LIST_UNLOCK(&formats);
 		return -1;
 	}
 	*tmp = *f;
+	tmp->module = mod;
 	if (tmp->buf_size) {
 		/*
 		 * Align buf_size properly, rounding up to the machine-specific
@@ -106,6 +102,7 @@
 	AST_LIST_UNLOCK(&formats);
 	if (option_verbose > 1)
 		ast_verbose( VERBOSE_PREFIX_2 "Registered file format %s, extension(s) %s\n", f->name, f->exts);
+
 	return 0;
 }
 

Modified: team/group/new_loader_completion/formats/format_g723.c
URL: http://svn.digium.com/view/asterisk/team/group/new_loader_completion/formats/format_g723.c?rev=23559&r1=23558&r2=23559&view=diff
==============================================================================
--- team/group/new_loader_completion/formats/format_g723.c (original)
+++ team/group/new_loader_completion/formats/format_g723.c Sun Apr 30 04:48:31 2006
@@ -148,27 +148,16 @@
 	.tell =	g723_tell,
 	.read =	g723_read,
 	.buf_size = G723_MAX_SIZE + AST_FRIENDLY_OFFSET,
-	.module = &mod_data, /* XXX */
 };
 
-static int load_module(void *mod)
+static int load_module(void)
 {
 	return ast_format_register(&g723_1_f);
 }
 
-static int unload_module(void *mod)
+static int unload_module(void)
 {
 	return ast_format_unregister(g723_1_f.name);
 }	
 
-static const char *description(void)
-{
-	return "G.723.1 Simple Timestamp File Format";
-}
-
-static const char *key(void)
-{
-	return ASTERISK_GPL_KEY;
-}
-
-STD_MOD1;
+AST_MODULE_INFO_STANDARD("G.723.1 Simple Timestamp File Format", ASTERISK_GPL_KEY);

Modified: team/group/new_loader_completion/formats/format_g726.c
URL: http://svn.digium.com/view/asterisk/team/group/new_loader_completion/formats/format_g726.c?rev=23559&r1=23558&r2=23559&view=diff
==============================================================================
--- team/group/new_loader_completion/formats/format_g726.c (original)
+++ team/group/new_loader_completion/formats/format_g726.c Sun Apr 30 04:48:31 2006
@@ -204,7 +204,6 @@
 		.read = g726_read,
 		.buf_size = BUF_SIZE + AST_FRIENDLY_OFFSET,
 		.desc_size = sizeof(struct g726_desc),
-		.module = &mod_data, /* XXX */
 	},
 	{
 		.name = "g726-32",
@@ -219,7 +218,6 @@
 		.read = g726_read,
 		.buf_size = BUF_SIZE + AST_FRIENDLY_OFFSET,
 		.desc_size = sizeof(struct g726_desc),
-		.module = &mod_data, /* XXX */
 	},
 	{
 		.name = "g726-24",
@@ -234,7 +232,6 @@
 		.read = g726_read,
 		.buf_size = BUF_SIZE + AST_FRIENDLY_OFFSET,
 		.desc_size = sizeof(struct g726_desc),
-		.module = &mod_data, /* XXX */
 	},
 	{
 		.name = "g726-16",
@@ -249,15 +246,11 @@
 		.read = g726_read,
 		.buf_size = BUF_SIZE + AST_FRIENDLY_OFFSET,
 		.desc_size = sizeof(struct g726_desc),
-		.module = &mod_data, /* XXX */
 	},
 	{	.format = 0 }	/* terminator */
 };
 
-/*
- * Module interface (load_module, unload_module, usecount, description, key)
- */
-static int load_module(void *mod)
+static int load_module(void)
 {
 	int i;
 
@@ -270,7 +263,7 @@
 	return 0;
 }
 
-static int unload_module(void *mod)
+static int unload_module(void)
 {
 	int i;
 
@@ -281,14 +274,4 @@
 	return(0);
 }	
 
-static const char *description(void)
-{
-	return "Raw G.726 (16/24/32/40kbps) data";
-}
-
-static const char *key(void)
-{
-	return ASTERISK_GPL_KEY;
-}
-
-STD_MOD1;
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Raw G.726 (16/24/32/40kbps) data");

Modified: team/group/new_loader_completion/formats/format_g729.c
URL: http://svn.digium.com/view/asterisk/team/group/new_loader_completion/formats/format_g729.c?rev=23559&r1=23558&r2=23559&view=diff
==============================================================================
--- team/group/new_loader_completion/formats/format_g729.c (original)
+++ team/group/new_loader_completion/formats/format_g729.c Sun Apr 30 04:48:31 2006
@@ -144,27 +144,16 @@
 	.tell = g729_tell,
 	.read = g729_read,
 	.buf_size = BUF_SIZE + AST_FRIENDLY_OFFSET,
-	.module = &mod_data, /* XXX */
 };
 
-static int load_module(void *mod)
+static int load_module(void)
 {
 	return ast_format_register(&g729_f);
 }
 
-static int unload_module(void *mod)
+static int unload_module(void)
 {
 	return ast_format_unregister(g729_f.name);
 }	
 
-static const char *description(void)
-{
-	return "Raw G729 data";
-}
-
-static const char *key(void)
-{
-	return ASTERISK_GPL_KEY;
-}
-
-STD_MOD1;
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Raw G729 data");

Modified: team/group/new_loader_completion/formats/format_gsm.c
URL: http://svn.digium.com/view/asterisk/team/group/new_loader_completion/formats/format_gsm.c?rev=23559&r1=23558&r2=23559&view=diff
==============================================================================
--- team/group/new_loader_completion/formats/format_gsm.c (original)
+++ team/group/new_loader_completion/formats/format_gsm.c Sun Apr 30 04:48:31 2006
@@ -166,27 +166,16 @@
 	.tell =	gsm_tell,
 	.read =	gsm_read,
 	.buf_size = 2*GSM_FRAME_SIZE + AST_FRIENDLY_OFFSET,	/* 2 gsm frames */
-	.module = &mod_data,	/* XXX */
 };
 
-static int load_module(void *mod)
+static int load_module(void)
 {
 	return ast_format_register(&gsm_f);
 }
 
-static int unload_module(void *mod)
+static int unload_module(void)
 {
 	return ast_format_unregister(gsm_f.name);
 }	
 
-static const char *description(void)
-{
-	return "Raw GSM data";
-}
-
-static const char *key(void)
-{
-	return ASTERISK_GPL_KEY;
-}
-
-STD_MOD1;
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Raw GSM data");

Modified: team/group/new_loader_completion/formats/format_h263.c
URL: http://svn.digium.com/view/asterisk/team/group/new_loader_completion/formats/format_h263.c?rev=23559&r1=23558&r2=23559&view=diff
==============================================================================
--- team/group/new_loader_completion/formats/format_h263.c (original)
+++ team/group/new_loader_completion/formats/format_h263.c Sun Apr 30 04:48:31 2006
@@ -175,27 +175,16 @@
 	.read = h263_read,
 	.buf_size = BUF_SIZE + AST_FRIENDLY_OFFSET,
 	.desc_size = sizeof(struct h263_desc),
-	.module = &mod_data,	/* XXX */
 };
 
-static int load_module(void *mod)
+static int load_module(void)
 {
 	return ast_format_register(&h263_f);
 }
 
-static int unload_module(void *mod)
+static int unload_module(void)
 {
 	return ast_format_unregister(h263_f.name);
 }	
 
-static const char *description(void)
-{
-	return "Raw h263 data";
-}
-
-static const char *key(void)
-{
-	return ASTERISK_GPL_KEY;
-}
-
-STD_MOD1;
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Raw H.263 data");

Modified: team/group/new_loader_completion/formats/format_h264.c
URL: http://svn.digium.com/view/asterisk/team/group/new_loader_completion/formats/format_h264.c?rev=23559&r1=23558&r2=23559&view=diff
==============================================================================
--- team/group/new_loader_completion/formats/format_h264.c (original)
+++ team/group/new_loader_completion/formats/format_h264.c Sun Apr 30 04:48:31 2006
@@ -168,27 +168,16 @@
 	.read = h264_read,
 	.buf_size = BUF_SIZE + AST_FRIENDLY_OFFSET,
 	.desc_size = sizeof(struct h264_desc),
-	.module = &mod_data,	/* XXX */
 };
 
-static int load_module(void *mod)
+static int load_module(void)
 {
 	return ast_format_register(&h264_f);
 }
 
-static int unload_module(void *mod)
+static int unload_module(void)
 {
 	return ast_format_unregister(h264_f.name);
 }	
 
-static const char *description(void)
-{
-	return "Raw h264 data";
-}
-
-static const char *key(void)
-{
-	return ASTERISK_GPL_KEY;
-}
-
-STD_MOD1;
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Raw H.264 data");

Modified: team/group/new_loader_completion/formats/format_ilbc.c
URL: http://svn.digium.com/view/asterisk/team/group/new_loader_completion/formats/format_ilbc.c?rev=23559&r1=23558&r2=23559&view=diff
==============================================================================
--- team/group/new_loader_completion/formats/format_ilbc.c (original)
+++ team/group/new_loader_completion/formats/format_ilbc.c Sun Apr 30 04:48:31 2006
@@ -142,27 +142,16 @@
 	.tell = ilbc_tell,
 	.read = ilbc_read,
 	.buf_size = ILBC_BUF_SIZE + AST_FRIENDLY_OFFSET,
-	.module = &mod_data, /* XXX */
 };
 
-static int load_module(void *mod)
+static int load_module(void)
 {
 	return ast_format_register(&ilbc_f);
 }
 
-static int unload_module(void *mod)
+static int unload_module(void)
 {
 	return ast_format_unregister(ilbc_f.name);
 }	
 
-static const char *description(void)
-{
-	return "Raw iLBC data";
-}
-
-static const char *key(void)
-{
-	return ASTERISK_GPL_KEY;
-}
-
-STD_MOD1;
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Raw iLBC data");

Modified: team/group/new_loader_completion/formats/format_jpeg.c
URL: http://svn.digium.com/view/asterisk/team/group/new_loader_completion/formats/format_jpeg.c?rev=23559&r1=23558&r2=23559&view=diff
==============================================================================
--- team/group/new_loader_completion/formats/format_jpeg.c (original)
+++ team/group/new_loader_completion/formats/format_jpeg.c Sun Apr 30 04:48:31 2006
@@ -46,9 +46,6 @@
 #include "asterisk/image.h"
 #include "asterisk/lock.h"
 #include "asterisk/endian.h"
-
-static char *desc = "JPEG (Joint Picture Experts Group) Image Format";
-
 
 static struct ast_frame *jpeg_read_image(int fd, int len)
 {
@@ -115,25 +112,16 @@
 	jpeg_write_image,
 };
 
-static int load_module(void *mod)
+static int load_module(void)
 {
 	return ast_image_register(&jpeg_format);
 }
 
-static int unload_module(void *mod)
+static int unload_module(void)
 {
 	ast_image_unregister(&jpeg_format);
+
 	return 0;
 }	
 
-static const char *description(void)
-{
-	return desc;
-}
-
-static const char *key(void)
-{
-	return ASTERISK_GPL_KEY;
-}
-
-STD_MOD(MOD_1 | NO_USECOUNT, NULL, NULL, NULL);
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "JPEG (Joint Picture Experts Group) Image Format");

Modified: team/group/new_loader_completion/formats/format_pcm.c
URL: http://svn.digium.com/view/asterisk/team/group/new_loader_completion/formats/format_pcm.c?rev=23559&r1=23558&r2=23559&view=diff
==============================================================================
--- team/group/new_loader_completion/formats/format_pcm.c (original)
+++ team/group/new_loader_completion/formats/format_pcm.c Sun Apr 30 04:48:31 2006
@@ -424,7 +424,6 @@
 	.tell = pcm_tell,
 	.read = pcm_read,
 	.buf_size = BUF_SIZE + AST_FRIENDLY_OFFSET,
-	.module = &mod_data, /* XXX */
 #ifdef REALTIME_WRITE
 	.open = pcma_open,
 	.rewrite = pcma_rewrite,
@@ -442,7 +441,6 @@
 	.tell = pcm_tell,
 	.read = pcm_read,
 	.buf_size = BUF_SIZE + AST_FRIENDLY_OFFSET,
-	.module = &mod_data, /* XXX */
 };
 
 static const struct ast_format au_f = {
@@ -457,10 +455,9 @@
 	.tell = au_tell,
 	.read = pcm_read,
 	.buf_size = BUF_SIZE + AST_FRIENDLY_OFFSET,	/* this many shorts */
-	.module = &mod_data, /* XXX */
 };
 
-static int load_module(void *mod)
+static int load_module(void)
 {
 	int index;
 
@@ -474,20 +471,10 @@
 		|| ast_format_register(&au_f);
 }
 
-static int unload_module(void *mod)
+static int unload_module(void)
 {
 	return ast_format_unregister(pcm_f.name) || ast_format_unregister(alaw_f.name)
 		|| ast_format_unregister(au_f.name);
 }	
 
-static const char *description(void)
-{
-	return "Raw/Sun uLaw/ALaw 8khz Audio support (PCM,PCMA,AU)";
-}
-
-static const char *key(void)
-{
-	return ASTERISK_GPL_KEY;
-}
-
-STD_MOD1;
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Raw/Sun uLaw/ALaw 8khz Audio support (PCM,PCMA,AU)");

Modified: team/group/new_loader_completion/formats/format_sln.c
URL: http://svn.digium.com/view/asterisk/team/group/new_loader_completion/formats/format_sln.c?rev=23559&r1=23558&r2=23559&view=diff
==============================================================================
--- team/group/new_loader_completion/formats/format_sln.c (original)
+++ team/group/new_loader_completion/formats/format_sln.c Sun Apr 30 04:48:31 2006
@@ -126,27 +126,16 @@
 	.tell = slinear_tell,
 	.read = slinear_read,
 	.buf_size = BUF_SIZE + AST_FRIENDLY_OFFSET,
-	.module = &mod_data, /* XXX */
 };
 
-static int load_module(void *mod)
+static int load_module(void)
 {
 	return ast_format_register(&slin_f);
 }
 
-static int unload_module(void *mod)
+static int unload_module(void)
 {
 	return ast_format_unregister(slin_f.name);
 }	
 
-static const char *description(void)
-{
-	return "Raw Signed Linear Audio support (SLN)";
-}
-
-static const char *key(void)
-{
-	return ASTERISK_GPL_KEY;
-}
-
-STD_MOD1;
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Raw Signed Linear Audio support (SLN)");

Modified: team/group/new_loader_completion/formats/format_vox.c
URL: http://svn.digium.com/view/asterisk/team/group/new_loader_completion/formats/format_vox.c?rev=23559&r1=23558&r2=23559&view=diff
==============================================================================
--- team/group/new_loader_completion/formats/format_vox.c (original)
+++ team/group/new_loader_completion/formats/format_vox.c Sun Apr 30 04:48:31 2006
@@ -131,27 +131,16 @@
 	.tell = vox_tell,
 	.read = vox_read,
 	.buf_size = BUF_SIZE + AST_FRIENDLY_OFFSET,
-	.module = &mod_data, /* XXX */
 };
 
-static int load_module(void *mod)
+static int load_module(void)
 {
 	return ast_format_register(&vox_f);
 }
 
-static int unload_module(void *mod)
+static int unload_module(void)
 {
 	return ast_format_unregister(vox_f.name);
 }	
 
-static const char *description(void)
-{
-	return "Dialogic VOX (ADPCM) File Format";
-}
-
-static const char *key(void)
-{
-	return ASTERISK_GPL_KEY;
-}
-
-STD_MOD1;
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Dialogic VOX (ADPCM) File Format");

Modified: team/group/new_loader_completion/formats/format_wav.c
URL: http://svn.digium.com/view/asterisk/team/group/new_loader_completion/formats/format_wav.c?rev=23559&r1=23558&r2=23559&view=diff
==============================================================================
--- team/group/new_loader_completion/formats/format_wav.c (original)
+++ team/group/new_loader_completion/formats/format_wav.c Sun Apr 30 04:48:31 2006
@@ -512,27 +512,16 @@
 	.close = wav_close,
 	.buf_size = WAV_BUF_SIZE + AST_FRIENDLY_OFFSET,
 	.desc_size = sizeof(struct wav_desc),
-	.module = &mod_data, /* XXX */
 };
 
-static int load_module(void *mod)
+static int load_module(void)
 {
 	return ast_format_register(&wav_f);
 }
 
-static int unload_module(void *mod)
+static int unload_module(void)
 {
 	return ast_format_unregister(wav_f.name);
 }	
 
-static const char *description(void)
-{
-	return "Microsoft WAV format (8000hz Signed Linear)";
-}
-
-static const char *key(void)
-{
-	return ASTERISK_GPL_KEY;
-}
-
-STD_MOD1;
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Microsoft WAV format (8000Hz Signed Linear)");

Modified: team/group/new_loader_completion/formats/format_wav_gsm.c
URL: http://svn.digium.com/view/asterisk/team/group/new_loader_completion/formats/format_wav_gsm.c?rev=23559&r1=23558&r2=23559&view=diff
==============================================================================
--- team/group/new_loader_completion/formats/format_wav_gsm.c (original)
+++ team/group/new_loader_completion/formats/format_wav_gsm.c Sun Apr 30 04:48:31 2006
@@ -555,27 +555,16 @@
 	.close = wav_close,
 	.buf_size = 2*GSM_FRAME_SIZE + AST_FRIENDLY_OFFSET,
 	.desc_size = sizeof(struct wavg_desc),
-	.module = &mod_data, /* XXX */
 };
 
-static int load_module(void *mod)
+static int load_module(void)
 {
 	return ast_format_register(&wav49_f);
 }
 
-static int unload_module(void *mod)
+static int unload_module(void)
 {
 	return ast_format_unregister(wav49_f.name);
 }	
 
-static const char *description(void)
-{
-	return "Microsoft WAV format (Proprietary GSM)";
-}
-
-static const char *key(void)
-{
-	return ASTERISK_GPL_KEY;
-}
-
-STD_MOD1;
+AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Microsoft WAV format (Proprietary GSM)");

Modified: team/group/new_loader_completion/include/asterisk.h
URL: http://svn.digium.com/view/asterisk/team/group/new_loader_completion/include/asterisk.h?rev=23559&r1=23558&r2=23559&view=diff
==============================================================================
--- team/group/new_loader_completion/include/asterisk.h (original)
+++ team/group/new_loader_completion/include/asterisk.h Sun Apr 30 04:48:31 2006
@@ -77,6 +77,9 @@
 /* Many headers need 'ast_channel' to be defined */
 struct ast_channel;
 
+/* Many headers need 'ast_module' to be defined */
+struct ast_module;
+
 /*!
  * \brief Reload asterisk modules.
  * \param name the name of the module to reload

Modified: team/group/new_loader_completion/include/asterisk/file.h
URL: http://svn.digium.com/view/asterisk/team/group/new_loader_completion/include/asterisk/file.h?rev=23559&r1=23558&r2=23559&view=diff
==============================================================================
--- team/group/new_loader_completion/include/asterisk/file.h (original)
+++ team/group/new_loader_completion/include/asterisk/file.h Sun Apr 30 04:48:31 2006
@@ -138,10 +138,11 @@
 #define SEEK_FORCECUR	10
 	
 /*! Register a new file format capability
- * Adds a format to asterisk's format abilities.
+ * Adds a format to Asterisk's format abilities.
  * returns 0 on success, -1 on failure
  */
-int ast_format_register(const struct ast_format *f);
+int __ast_format_register(const struct ast_format *f, struct ast_module *mod);
+#define ast_format_register(f) __ast_format_register(f, ast_module_info.self)
 
 /*! Unregisters a file format */
 /*!



More information about the asterisk-commits mailing list