[asterisk-commits] dvossel: branch dvossel/fixtheworld_phase1_step3 r301741 - in /team/dvossel/f...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jan 13 11:19:14 CST 2011


Author: dvossel
Date: Thu Jan 13 11:19:09 2011
New Revision: 301741

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

Modified:
    team/dvossel/fixtheworld_phase1_step3/codecs/codec_gsm.c
    team/dvossel/fixtheworld_phase1_step3/codecs/ex_gsm.h
    team/dvossel/fixtheworld_phase1_step3/formats/format_g719.c
    team/dvossel/fixtheworld_phase1_step3/formats/format_g723.c
    team/dvossel/fixtheworld_phase1_step3/formats/format_g726.c
    team/dvossel/fixtheworld_phase1_step3/formats/format_g729.c
    team/dvossel/fixtheworld_phase1_step3/formats/format_gsm.c
    team/dvossel/fixtheworld_phase1_step3/formats/format_h263.c
    team/dvossel/fixtheworld_phase1_step3/formats/format_h264.c
    team/dvossel/fixtheworld_phase1_step3/formats/format_ilbc.c
    team/dvossel/fixtheworld_phase1_step3/formats/format_ogg_vorbis.c
    team/dvossel/fixtheworld_phase1_step3/formats/format_pcm.c
    team/dvossel/fixtheworld_phase1_step3/formats/format_siren14.c
    team/dvossel/fixtheworld_phase1_step3/formats/format_siren7.c
    team/dvossel/fixtheworld_phase1_step3/formats/format_sln.c
    team/dvossel/fixtheworld_phase1_step3/formats/format_sln16.c
    team/dvossel/fixtheworld_phase1_step3/formats/format_vox.c
    team/dvossel/fixtheworld_phase1_step3/formats/format_wav.c
    team/dvossel/fixtheworld_phase1_step3/formats/format_wav_gsm.c
    team/dvossel/fixtheworld_phase1_step3/funcs/func_channel.c
    team/dvossel/fixtheworld_phase1_step3/include/asterisk/mod_format.h
    team/dvossel/fixtheworld_phase1_step3/main/file.c

Modified: team/dvossel/fixtheworld_phase1_step3/codecs/codec_gsm.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/codecs/codec_gsm.c?view=diff&rev=301741&r1=301740&r2=301741
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/codecs/codec_gsm.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/codecs/codec_gsm.c Thu Jan 13 11:19:09 2011
@@ -168,8 +168,6 @@
 
 static struct ast_translator gsmtolin = {
 	.name = "gsmtolin", 
-	.srcfmt = AST_FORMAT_GSM,
-	.dstfmt = AST_FORMAT_SLINEAR,
 	.newpvt = gsm_new,
 	.framein = gsmtolin_framein,
 	.destroy = gsm_destroy_stuff,
@@ -181,8 +179,6 @@
 
 static struct ast_translator lintogsm = {
 	.name = "lintogsm", 
-	.srcfmt = AST_FORMAT_SLINEAR,
-	.dstfmt = AST_FORMAT_GSM,
 	.newpvt = gsm_new,
 	.framein = lintogsm_framein,
 	.frameout = lintogsm_frameout,
@@ -213,6 +209,12 @@
 {
 	int res;
 
+	ast_format_set(&gsmtolin.src_format, AST_FORMAT_GSM, 0);
+	ast_format_set(&gsmtolin.dst_format, AST_FORMAT_SLINEAR, 0);
+
+	ast_format_set(&lintogsm.src_format, AST_FORMAT_SLINEAR, 0);
+	ast_format_set(&lintogsm.dst_format, AST_FORMAT_GSM, 0);
+
 	res = ast_register_translator(&gsmtolin);
 	if (!res) 
 		res=ast_register_translator(&lintogsm);

Modified: team/dvossel/fixtheworld_phase1_step3/codecs/ex_gsm.h
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/codecs/ex_gsm.h?view=diff&rev=301741&r1=301740&r2=301741
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/codecs/ex_gsm.h (original)
+++ team/dvossel/fixtheworld_phase1_step3/codecs/ex_gsm.h Thu Jan 13 11:19:09 2011
@@ -18,7 +18,6 @@
 {
 	static struct ast_frame f = {
 		.frametype = AST_FRAME_VOICE,
-		.subclass.codec = AST_FORMAT_GSM,
 		.datalen = sizeof(ex_gsm),
 		/* All frames are 20 ms long */
 		.samples = GSM_SAMPLES,
@@ -28,5 +27,6 @@
 		.data.ptr = ex_gsm,
 	};
 
+	ast_format_set(&f.subclass.format, AST_FORMAT_GSM, 0);
 	return &f;
 }

Modified: team/dvossel/fixtheworld_phase1_step3/formats/format_g719.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/formats/format_g719.c?view=diff&rev=301741&r1=301740&r2=301741
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/formats/format_g719.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/formats/format_g719.c Thu Jan 13 11:19:09 2011
@@ -110,7 +110,7 @@
 	return BYTES_TO_SAMPLES(ftello(fs->f));
 }
 
-static const struct ast_format g719_f = {
+static const struct ast_format_def g719_f = {
 	.name = "g719",
 	.exts = "g719",
 	.format = AST_FORMAT_G719,
@@ -124,7 +124,7 @@
 
 static int load_module(void)
 {
-	if (ast_format_register(&g719_f))
+	if (ast_format_def_register(&g719_f))
 		return AST_MODULE_LOAD_DECLINE;
 
 	return AST_MODULE_LOAD_SUCCESS;
@@ -132,7 +132,7 @@
 
 static int unload_module(void)
 {
-	return ast_format_unregister(g719_f.name);
+	return ast_format_def_unregister(g719_f.name);
 }
 
 AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "ITU G.719",

Modified: team/dvossel/fixtheworld_phase1_step3/formats/format_g723.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/formats/format_g723.c?view=diff&rev=301741&r1=301740&r2=301741
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/formats/format_g723.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/formats/format_g723.c Thu Jan 13 11:19:09 2011
@@ -125,7 +125,7 @@
 	return -1;
 }
 
-static const struct ast_format g723_1_f = {
+static const struct ast_format_def g723_1_f = {
 	.name = "g723sf",
 	.exts = "g723|g723sf",
 	.format = AST_FORMAT_G723_1,
@@ -139,14 +139,14 @@
 
 static int load_module(void)
 {
-	if (ast_format_register(&g723_1_f))
+	if (ast_format_def_register(&g723_1_f))
 		return AST_MODULE_LOAD_FAILURE;
 	return AST_MODULE_LOAD_SUCCESS;
 }
 
 static int unload_module(void)
 {
-	return ast_format_unregister(g723_1_f.name);
+	return ast_format_def_unregister(g723_1_f.name);
 }
 
 AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "G.723.1 Simple Timestamp File Format",

Modified: team/dvossel/fixtheworld_phase1_step3/formats/format_g726.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/formats/format_g726.c?view=diff&rev=301741&r1=301740&r2=301741
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/formats/format_g726.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/formats/format_g726.c Thu Jan 13 11:19:09 2011
@@ -174,7 +174,7 @@
 	return -1;
 }
 
-static const struct ast_format f[] = {
+static const struct ast_format_def f[] = {
 	{
 		.name = "g726-40",
 		.exts = "g726-40",
@@ -239,7 +239,7 @@
 	int i;
 
 	for (i = 0; f[i].format ; i++) {
-		if (ast_format_register(&f[i])) {	/* errors are fatal */
+		if (ast_format_def_register(&f[i])) {	/* errors are fatal */
 			ast_log(LOG_WARNING, "Failed to register format %s.\n", f[i].name);
 			return AST_MODULE_LOAD_FAILURE;
 		}
@@ -252,7 +252,7 @@
 	int i;
 
 	for (i = 0; f[i].format ; i++) {
-		if (ast_format_unregister(f[i].name))
+		if (ast_format_def_unregister(f[i].name))
 			ast_log(LOG_WARNING, "Failed to unregister format %s.\n", f[i].name);
 	}
 	return(0);

Modified: team/dvossel/fixtheworld_phase1_step3/formats/format_g729.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/formats/format_g729.c?view=diff&rev=301741&r1=301740&r2=301741
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/formats/format_g729.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/formats/format_g729.c Thu Jan 13 11:19:09 2011
@@ -121,7 +121,7 @@
 	return (offset/BUF_SIZE)*G729A_SAMPLES;
 }
 
-static const struct ast_format g729_f = {
+static const struct ast_format_def g729_f = {
 	.name = "g729",
 	.exts = "g729",
 	.format = AST_FORMAT_G729A,
@@ -135,14 +135,14 @@
 
 static int load_module(void)
 {
-	if (ast_format_register(&g729_f))
+	if (ast_format_def_register(&g729_f))
 		return AST_MODULE_LOAD_FAILURE;
 	return AST_MODULE_LOAD_SUCCESS;
 }
 
 static int unload_module(void)
 {
-	return ast_format_unregister(g729_f.name);
+	return ast_format_def_unregister(g729_f.name);
 }
 
 AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "Raw G.729 data",

Modified: team/dvossel/fixtheworld_phase1_step3/formats/format_gsm.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/formats/format_gsm.c?view=diff&rev=301741&r1=301740&r2=301741
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/formats/format_gsm.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/formats/format_gsm.c Thu Jan 13 11:19:09 2011
@@ -53,7 +53,7 @@
 	int res;
 
 	s->fr.frametype = AST_FRAME_VOICE;
-	s->fr.subclass.codec = AST_FORMAT_GSM;
+	ast_format_set(&s->fr.subclass.format, AST_FORMAT_GSM, 0);
 	AST_FRAME_SET_BUFFER(&(s->fr), s->buf, AST_FRIENDLY_OFFSET, GSM_FRAME_SIZE)
 	s->fr.mallocd = 0;
 	if ((res = fread(s->fr.data.ptr, 1, GSM_FRAME_SIZE, s->f)) != GSM_FRAME_SIZE) {
@@ -74,8 +74,8 @@
 		ast_log(LOG_WARNING, "Asked to write non-voice frame!\n");
 		return -1;
 	}
-	if (f->subclass.codec != AST_FORMAT_GSM) {
-		ast_log(LOG_WARNING, "Asked to write non-GSM frame (%s)!\n", ast_getformatname(f->subclass.codec));
+	if (f->subclass.format.id != AST_FORMAT_GSM) {
+		ast_log(LOG_WARNING, "Asked to write non-GSM frame (%s)!\n", ast_getformatname(&f->subclass.format));
 		return -1;
 	}
 	if (!(f->datalen % 65)) {
@@ -145,10 +145,9 @@
 	return (offset/GSM_FRAME_SIZE)*GSM_SAMPLES;
 }
 
-static const struct ast_format gsm_f = {
+static struct ast_format_def gsm_f = {
 	.name = "gsm",
 	.exts = "gsm",
-	.format = AST_FORMAT_GSM,
 	.write = gsm_write,
 	.seek =	gsm_seek,
 	.trunc = gsm_trunc,
@@ -159,14 +158,15 @@
 
 static int load_module(void)
 {
-	if (ast_format_register(&gsm_f))
+	ast_format_set(&gsm_f.format, AST_FORMAT_GSM, 0);
+	if (ast_format_def_register(&gsm_f))
 		return AST_MODULE_LOAD_FAILURE;
 	return AST_MODULE_LOAD_SUCCESS;
 }
 
 static int unload_module(void)
 {
-	return ast_format_unregister(gsm_f.name);
+	return ast_format_def_unregister(gsm_f.name);
 }
 
 AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "Raw GSM data",

Modified: team/dvossel/fixtheworld_phase1_step3/formats/format_h263.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/formats/format_h263.c?view=diff&rev=301741&r1=301740&r2=301741
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/formats/format_h263.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/formats/format_h263.c Thu Jan 13 11:19:09 2011
@@ -157,7 +157,7 @@
 	return offset;	/* XXX totally bogus, needs fixing */
 }
 
-static const struct ast_format h263_f = {
+static const struct ast_format_def h263_f = {
 	.name = "h263",
 	.exts = "h263",
 	.format = AST_FORMAT_H263,
@@ -173,14 +173,14 @@
 
 static int load_module(void)
 {
-	if (ast_format_register(&h263_f))
+	if (ast_format_def_register(&h263_f))
 		return AST_MODULE_LOAD_FAILURE;
 	return AST_MODULE_LOAD_SUCCESS;
 }
 
 static int unload_module(void)
 {
-	return ast_format_unregister(h263_f.name);
+	return ast_format_def_unregister(h263_f.name);
 }
 
 AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "Raw H.263 data",

Modified: team/dvossel/fixtheworld_phase1_step3/formats/format_h264.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/formats/format_h264.c?view=diff&rev=301741&r1=301740&r2=301741
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/formats/format_h264.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/formats/format_h264.c Thu Jan 13 11:19:09 2011
@@ -146,7 +146,7 @@
 	return offset; /* XXX totally bogus, needs fixing */
 }
 
-static const struct ast_format h264_f = {
+static const struct ast_format_def h264_f = {
 	.name = "h264",
 	.exts = "h264",
 	.format = AST_FORMAT_H264,
@@ -162,14 +162,14 @@
 
 static int load_module(void)
 {
-	if (ast_format_register(&h264_f))
+	if (ast_format_def_register(&h264_f))
 		return AST_MODULE_LOAD_FAILURE;
 	return AST_MODULE_LOAD_SUCCESS;
 }
 
 static int unload_module(void)
 {
-	return ast_format_unregister(h264_f.name);
+	return ast_format_def_unregister(h264_f.name);
 }
 
 AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "Raw H.264 data",

Modified: team/dvossel/fixtheworld_phase1_step3/formats/format_ilbc.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/formats/format_ilbc.c?view=diff&rev=301741&r1=301740&r2=301741
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/formats/format_ilbc.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/formats/format_ilbc.c Thu Jan 13 11:19:09 2011
@@ -119,7 +119,7 @@
 	return (offset/ILBC_BUF_SIZE)*ILBC_SAMPLES;
 }
 
-static const struct ast_format ilbc_f = {
+static const struct ast_format_def ilbc_f = {
 	.name = "iLBC",
 	.exts = "ilbc",
 	.format = AST_FORMAT_ILBC,
@@ -133,14 +133,14 @@
 
 static int load_module(void)
 {
-	if (ast_format_register(&ilbc_f))
+	if (ast_format_def_register(&ilbc_f))
 		return AST_MODULE_LOAD_FAILURE;
 	return AST_MODULE_LOAD_SUCCESS;
 }
 
 static int unload_module(void)
 {
-	return ast_format_unregister(ilbc_f.name);
+	return ast_format_def_unregister(ilbc_f.name);
 }
 
 AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "Raw iLBC data",

Modified: team/dvossel/fixtheworld_phase1_step3/formats/format_ogg_vorbis.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/formats/format_ogg_vorbis.c?view=diff&rev=301741&r1=301740&r2=301741
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/formats/format_ogg_vorbis.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/formats/format_ogg_vorbis.c Thu Jan 13 11:19:09 2011
@@ -528,7 +528,7 @@
 	return -1;
 }
 
-static const struct ast_format vorbis_f = {
+static const struct ast_format_def vorbis_f = {
 	.name = "ogg_vorbis",
 	.exts = "ogg",
 	.format = AST_FORMAT_SLINEAR,
@@ -546,14 +546,14 @@
 
 static int load_module(void)
 {
-	if (ast_format_register(&vorbis_f))
+	if (ast_format_def_register(&vorbis_f))
 		return AST_MODULE_LOAD_FAILURE;
 	return AST_MODULE_LOAD_SUCCESS;
 }
 
 static int unload_module(void)
 {
-	return ast_format_unregister(vorbis_f.name);
+	return ast_format_def_unregister(vorbis_f.name);
 }
 
 AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "OGG/Vorbis audio",

Modified: team/dvossel/fixtheworld_phase1_step3/formats/format_pcm.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/formats/format_pcm.c?view=diff&rev=301741&r1=301740&r2=301741
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/formats/format_pcm.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/formats/format_pcm.c Thu Jan 13 11:19:09 2011
@@ -413,7 +413,7 @@
 	return offset - AU_HEADER_SIZE;
 }
 
-static const struct ast_format alaw_f = {
+static const struct ast_format_def alaw_f = {
 	.name = "alaw",
 	.exts = "alaw|al|alw",
 	.format = AST_FORMAT_ALAW,
@@ -430,7 +430,7 @@
 #endif
 };
 
-static const struct ast_format pcm_f = {
+static const struct ast_format_def pcm_f = {
 	.name = "pcm",
 	.exts = "pcm|ulaw|ul|mu|ulw",
 	.format = AST_FORMAT_ULAW,
@@ -442,7 +442,7 @@
 	.buf_size = BUF_SIZE + AST_FRIENDLY_OFFSET,
 };
 
-static const struct ast_format g722_f = {
+static const struct ast_format_def g722_f = {
 	.name = "g722",
 	.exts = "g722",
 	.format = AST_FORMAT_G722,
@@ -454,7 +454,7 @@
 	.buf_size = (BUF_SIZE * 2) + AST_FRIENDLY_OFFSET,
 };
 
-static const struct ast_format au_f = {
+static const struct ast_format_def au_f = {
 	.name = "au",
 	.exts = "au",
 	.format = AST_FORMAT_ULAW,
@@ -478,20 +478,20 @@
 	for (i = 0; i < ARRAY_LEN(alaw_silence); i++)
 		alaw_silence[i] = AST_LIN2A(0);
 
-	if ( ast_format_register(&pcm_f)
-		|| ast_format_register(&alaw_f)
-		|| ast_format_register(&au_f)
-		|| ast_format_register(&g722_f) )
+	if ( ast_format_def_register(&pcm_f)
+		|| ast_format_def_register(&alaw_f)
+		|| ast_format_def_register(&au_f)
+		|| ast_format_def_register(&g722_f) )
 		return AST_MODULE_LOAD_FAILURE;
 	return AST_MODULE_LOAD_SUCCESS;
 }
 
 static int unload_module(void)
 {
-	return ast_format_unregister(pcm_f.name)
-		|| ast_format_unregister(alaw_f.name)
-		|| ast_format_unregister(au_f.name)
-		|| ast_format_unregister(g722_f.name);
+	return ast_format_def_unregister(pcm_f.name)
+		|| ast_format_def_unregister(alaw_f.name)
+		|| ast_format_def_unregister(au_f.name)
+		|| ast_format_def_unregister(g722_f.name);
 }
 
 AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "Raw/Sun uLaw/ALaw 8KHz (PCM,PCMA,AU), G.722 16Khz",

Modified: team/dvossel/fixtheworld_phase1_step3/formats/format_siren14.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/formats/format_siren14.c?view=diff&rev=301741&r1=301740&r2=301741
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/formats/format_siren14.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/formats/format_siren14.c Thu Jan 13 11:19:09 2011
@@ -110,7 +110,7 @@
 	return BYTES_TO_SAMPLES(ftello(fs->f));
 }
 
-static const struct ast_format siren14_f = {
+static const struct ast_format_def siren14_f = {
 	.name = "siren14",
 	.exts = "siren14",
 	.format = AST_FORMAT_SIREN14,
@@ -124,7 +124,7 @@
 
 static int load_module(void)
 {
-	if (ast_format_register(&siren14_f))
+	if (ast_format_def_register(&siren14_f))
 		return AST_MODULE_LOAD_DECLINE;
 
 	return AST_MODULE_LOAD_SUCCESS;
@@ -132,7 +132,7 @@
 
 static int unload_module(void)
 {
-	return ast_format_unregister(siren14_f.name);
+	return ast_format_def_unregister(siren14_f.name);
 }
 
 AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "ITU G.722.1 Annex C (Siren14, licensed from Polycom)",

Modified: team/dvossel/fixtheworld_phase1_step3/formats/format_siren7.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/formats/format_siren7.c?view=diff&rev=301741&r1=301740&r2=301741
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/formats/format_siren7.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/formats/format_siren7.c Thu Jan 13 11:19:09 2011
@@ -110,7 +110,7 @@
 	return BYTES_TO_SAMPLES(ftello(fs->f));
 }
 
-static const struct ast_format siren7_f = {
+static const struct ast_format_def siren7_f = {
 	.name = "siren7",
 	.exts = "siren7",
 	.format = AST_FORMAT_SIREN7,
@@ -124,7 +124,7 @@
 
 static int load_module(void)
 {
-	if (ast_format_register(&siren7_f))
+	if (ast_format_def_register(&siren7_f))
 		return AST_MODULE_LOAD_DECLINE;
 
 	return AST_MODULE_LOAD_SUCCESS;
@@ -132,7 +132,7 @@
 
 static int unload_module(void)
 {
-	return ast_format_unregister(siren7_f.name);
+	return ast_format_def_unregister(siren7_f.name);
 }
 
 AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "ITU G.722.1 (Siren7, licensed from Polycom)",

Modified: team/dvossel/fixtheworld_phase1_step3/formats/format_sln.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/formats/format_sln.c?view=diff&rev=301741&r1=301740&r2=301741
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/formats/format_sln.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/formats/format_sln.c Thu Jan 13 11:19:09 2011
@@ -103,7 +103,7 @@
 	return ftello(fs->f) / 2;
 }
 
-static const struct ast_format slin_f = {
+static const struct ast_format_def slin_f = {
 	.name = "sln",
 	.exts = "sln|raw",
 	.format = AST_FORMAT_SLINEAR,
@@ -117,14 +117,14 @@
 
 static int load_module(void)
 {
-	if (ast_format_register(&slin_f))
+	if (ast_format_def_register(&slin_f))
 		return AST_MODULE_LOAD_FAILURE;
 	return AST_MODULE_LOAD_SUCCESS;
 }
 
 static int unload_module(void)
 {
-	return ast_format_unregister(slin_f.name);
+	return ast_format_def_unregister(slin_f.name);
 }
 
 AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "Raw Signed Linear Audio support (SLN)",

Modified: team/dvossel/fixtheworld_phase1_step3/formats/format_sln16.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/formats/format_sln16.c?view=diff&rev=301741&r1=301740&r2=301741
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/formats/format_sln16.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/formats/format_sln16.c Thu Jan 13 11:19:09 2011
@@ -110,7 +110,7 @@
 	return ftello(fs->f) / 2;
 }
 
-static const struct ast_format slin_f = {
+static const struct ast_format_def slin_f = {
 	.name = "sln16",
 	.exts = "sln16",
 	.format = AST_FORMAT_SLINEAR16,
@@ -124,7 +124,7 @@
 
 static int load_module(void)
 {
-	if (ast_format_register(&slin_f))
+	if (ast_format_def_register(&slin_f))
 		return AST_MODULE_LOAD_FAILURE;
 
 	return AST_MODULE_LOAD_SUCCESS;
@@ -132,7 +132,7 @@
 
 static int unload_module(void)
 {
-	return ast_format_unregister(slin_f.name);
+	return ast_format_def_unregister(slin_f.name);
 }
 
 AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "Raw Signed Linear 16KHz Audio support (SLN16)",

Modified: team/dvossel/fixtheworld_phase1_step3/formats/format_vox.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/formats/format_vox.c?view=diff&rev=301741&r1=301740&r2=301741
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/formats/format_vox.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/formats/format_vox.c Thu Jan 13 11:19:09 2011
@@ -108,7 +108,7 @@
      return offset; 
 }
 
-static const struct ast_format vox_f = {
+static const struct ast_format_def vox_f = {
 	.name = "vox",
 	.exts = "vox",
 	.format = AST_FORMAT_ADPCM,
@@ -122,14 +122,14 @@
 
 static int load_module(void)
 {
-	if (ast_format_register(&vox_f))
+	if (ast_format_def_register(&vox_f))
 		return AST_MODULE_LOAD_FAILURE;
 	return AST_MODULE_LOAD_SUCCESS;
 }
 
 static int unload_module(void)
 {
-	return ast_format_unregister(vox_f.name);
+	return ast_format_def_unregister(vox_f.name);
 }
 
 AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "Dialogic VOX (ADPCM) File Format",

Modified: team/dvossel/fixtheworld_phase1_step3/formats/format_wav.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/formats/format_wav.c?view=diff&rev=301741&r1=301740&r2=301741
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/formats/format_wav.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/formats/format_wav.c Thu Jan 13 11:19:09 2011
@@ -486,7 +486,7 @@
 	return (offset - 44)/2;
 }
 
-static const struct ast_format wav16_f = {
+static const struct ast_format_def wav16_f = {
 	.name = "wav16",
 	.exts = "wav16",
 	.format = AST_FORMAT_SLINEAR16,
@@ -502,7 +502,7 @@
 	.desc_size = sizeof(struct wav_desc),
 };
 
-static const struct ast_format wav_f = {
+static const struct ast_format_def wav_f = {
 	.name = "wav",
 	.exts = "wav",
 	.format = AST_FORMAT_SLINEAR,
@@ -520,16 +520,16 @@
 
 static int load_module(void)
 {
-	if (ast_format_register(&wav_f)
-		|| ast_format_register(&wav16_f))
+	if (ast_format_def_register(&wav_f)
+		|| ast_format_def_register(&wav16_f))
 		return AST_MODULE_LOAD_FAILURE;
 	return AST_MODULE_LOAD_SUCCESS;
 }
 
 static int unload_module(void)
 {
-	return ast_format_unregister(wav_f.name)
-		|| ast_format_unregister(wav16_f.name);
+	return ast_format_def_unregister(wav_f.name)
+		|| ast_format_def_unregister(wav16_f.name);
 }
 
 AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "Microsoft WAV/WAV16 format (8kHz/16kHz Signed Linear)",

Modified: team/dvossel/fixtheworld_phase1_step3/formats/format_wav_gsm.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/formats/format_wav_gsm.c?view=diff&rev=301741&r1=301740&r2=301741
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/formats/format_wav_gsm.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/formats/format_wav_gsm.c Thu Jan 13 11:19:09 2011
@@ -521,7 +521,7 @@
 	return (offset - MSGSM_DATA_OFFSET)/MSGSM_FRAME_SIZE*MSGSM_SAMPLES;
 }
 
-static const struct ast_format wav49_f = {
+static const struct ast_format_def wav49_f = {
 	.name = "wav49",
 	.exts = "WAV|wav49",
 	.format = AST_FORMAT_GSM,
@@ -538,14 +538,14 @@
 
 static int load_module(void)
 {
-	if (ast_format_register(&wav49_f))
+	if (ast_format_def_register(&wav49_f))
 		return AST_MODULE_LOAD_FAILURE;
 	return AST_MODULE_LOAD_SUCCESS;
 }
 
 static int unload_module(void)
 {
-	return ast_format_unregister(wav49_f.name);
+	return ast_format_def_unregister(wav49_f.name);
 }
 
 AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "Microsoft WAV format (Proprietary GSM)",

Modified: team/dvossel/fixtheworld_phase1_step3/funcs/func_channel.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/funcs/func_channel.c?view=diff&rev=301741&r1=301740&r2=301741
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/funcs/func_channel.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/funcs/func_channel.c Thu Jan 13 11:19:09 2011
@@ -265,27 +265,30 @@
 			     char *data, char *buf, size_t len)
 {
 	int ret = 0;
-
-	if (!strcasecmp(data, "audionativeformat"))
-		/* use the _multiple version when chan->nativeformats holds multiple formats */
-		/* ast_getformatname_multiple(buf, len, chan->nativeformats & AST_FORMAT_AUDIO_MASK); */
-		ast_copy_string(buf, ast_getformatname(chan->nativeformats & AST_FORMAT_AUDIO_MASK), len);
-	else if (!strcasecmp(data, "videonativeformat"))
-		/* use the _multiple version when chan->nativeformats holds multiple formats */
-		/* ast_getformatname_multiple(buf, len, chan->nativeformats & AST_FORMAT_VIDEO_MASK); */
-		ast_copy_string(buf, ast_getformatname(chan->nativeformats & AST_FORMAT_VIDEO_MASK), len);
-	else if (!strcasecmp(data, "audioreadformat"))
-		ast_copy_string(buf, ast_getformatname(chan->readformat), len);
-	else if (!strcasecmp(data, "audiowriteformat"))
-		ast_copy_string(buf, ast_getformatname(chan->writeformat), len);
+	char tmp[512];
+	struct ast_cap *tmpcap;
+
+	if (!strcasecmp(data, "audionativeformat")) {
+		if ((tmpcap = ast_cap_get_type(chan->nativeformats, AST_FORMAT_TYPE_AUDIO))) {
+			ast_copy_string(buf, ast_getformatname_multiple(tmp, sizeof(tmp), tmpcap), len);
+			tmpcap = ast_cap_destroy(tmpcap);
+		}
+	} else if (!strcasecmp(data, "videonativeformat")) {
+		if ((tmpcap = ast_cap_get_type(chan->nativeformats, AST_FORMAT_TYPE_VIDEO))) {
+			ast_copy_string(buf, ast_getformatname_multiple(tmp, sizeof(tmp), tmpcap), len);
+			tmpcap = ast_cap_destroy(tmpcap);
+		}
+	} else if (!strcasecmp(data, "audioreadformat")) {
+		ast_copy_string(buf, ast_getformatname(&chan->readformat), len);
+	} else if (!strcasecmp(data, "audiowriteformat")) {
+		ast_copy_string(buf, ast_getformatname(&chan->writeformat), len);
 #ifdef CHANNEL_TRACE
-	else if (!strcasecmp(data, "trace")) {
+	} else if (!strcasecmp(data, "trace")) {
 		ast_channel_lock(chan);
 		ast_copy_string(buf, ast_channel_trace_is_enabled(chan) ? "1" : "0", len);
 		ast_channel_unlock(chan);
-	}
 #endif
-	else if (!strcasecmp(data, "tonezone") && chan->zone)
+	} else if (!strcasecmp(data, "tonezone") && chan->zone)
 		locked_copy_string(chan, buf, chan->zone->country, len);
 	else if (!strcasecmp(data, "language"))
 		locked_copy_string(chan, buf, chan->language, len);
@@ -349,9 +352,9 @@
 		ast_channel_unlock(chan);
 	} else if (!strcasecmp(data, "uniqueid")) {
 		locked_copy_string(chan, buf, chan->uniqueid, len);
-	} else if (!strcasecmp(data, "transfercapability"))
+	} else if (!strcasecmp(data, "transfercapability")) {
 		locked_copy_string(chan, buf, transfercapability_table[chan->transfercapability & 0x1f], len);
-	else if (!strcasecmp(data, "callgroup")) {
+	} else if (!strcasecmp(data, "callgroup")) {
 		char groupbuf[256];
 		locked_copy_string(chan, buf,  ast_print_group(groupbuf, sizeof(groupbuf), chan->callgroup), len);
 	} else if (!strcasecmp(data, "amaflags")) {

Modified: team/dvossel/fixtheworld_phase1_step3/include/asterisk/mod_format.h
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/include/asterisk/mod_format.h?view=diff&rev=301741&r1=301740&r2=301741
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/include/asterisk/mod_format.h (original)
+++ team/dvossel/fixtheworld_phase1_step3/include/asterisk/mod_format.h Thu Jan 13 11:19:09 2011
@@ -37,7 +37,7 @@
  * Not all are necessary, the support routine implement default
  * values for some of them.
  * A handler typically fills a structure initializing the desired
- * fields, and then calls ast_format_register() with the (readonly)
+ * fields, and then calls ast_format_def_register() with the (readonly)
  * structure as an argument.
  */
 struct ast_format_def {
@@ -128,7 +128,7 @@
  * \retval -1 on failure
  */
 int __ast_format_def_register(const struct ast_format_def *f, struct ast_module *mod);
-#define ast_format_register(f) __ast_format_register(f, ast_module_info->self)
+#define ast_format_def_register(f) __ast_format_def_register(f, ast_module_info->self)
 
 /*! 
  * \brief Unregisters a file format 

Modified: team/dvossel/fixtheworld_phase1_step3/main/file.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/main/file.c?view=diff&rev=301741&r1=301740&r2=301741
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/main/file.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/main/file.c Thu Jan 13 11:19:09 2011
@@ -669,7 +669,7 @@
 		return NULL;
 	}
 	if (!fileexists_core(filename, NULL, preflang, buf, buflen, file_fmt_cap) ||
-		ast_cap_has_type(file_fmt_cap, AST_FORMAT_TYPE_AUDIO)) {
+		!ast_cap_has_type(file_fmt_cap, AST_FORMAT_TYPE_AUDIO)) {
 
 		ast_log(LOG_WARNING, "File %s does not exist in any format\n", filename);
 		file_fmt_cap = ast_cap_destroy(file_fmt_cap);
@@ -713,14 +713,11 @@
 
 	/* is the channel capable of video without translation ?*/
 	if (!ast_cap_has_type(chan->nativeformats, AST_FORMAT_TYPE_VIDEO)) {
-		ast_log(LOG_WARNING, "Channel %s unable to play video file %s.  Video not supported.\n", chan->name, filename);
 		return NULL;
 	}
-
 	if (!(tmp_cap = ast_cap_alloc())) {
 		return NULL;
 	}
-
 	/* Video is supported, so see what video formats exist for this file */
 	if (!fileexists_core(filename, NULL, preflang, buf, buflen, tmp_cap)) {
 		tmp_cap = ast_cap_destroy(tmp_cap);




More information about the asterisk-commits mailing list