[asterisk-commits] file: branch group/media_formats r407951 - in /team/group/media_formats: code...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Feb 11 06:53:10 CST 2014


Author: file
Date: Tue Feb 11 06:52:59 2014
New Revision: 407951

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=407951
Log:
Move most of the translators over to defining source and destination codecs.

Modified:
    team/group/media_formats/codecs/codec_a_mu.c
    team/group/media_formats/codecs/codec_adpcm.c
    team/group/media_formats/codecs/codec_alaw.c
    team/group/media_formats/codecs/codec_g722.c
    team/group/media_formats/codecs/codec_g726.c
    team/group/media_formats/codecs/codec_gsm.c
    team/group/media_formats/codecs/codec_ilbc.c
    team/group/media_formats/codecs/codec_lpc10.c
    team/group/media_formats/codecs/codec_resample.c
    team/group/media_formats/codecs/codec_speex.c
    team/group/media_formats/codecs/codec_ulaw.c
    team/group/media_formats/codecs/ex_adpcm.h
    team/group/media_formats/codecs/ex_alaw.h
    team/group/media_formats/codecs/ex_g722.h
    team/group/media_formats/codecs/ex_g726.h
    team/group/media_formats/codecs/ex_gsm.h
    team/group/media_formats/codecs/ex_ilbc.h
    team/group/media_formats/codecs/ex_lpc10.h
    team/group/media_formats/codecs/ex_speex.h
    team/group/media_formats/codecs/ex_ulaw.h
    team/group/media_formats/include/asterisk/format_cache.h
    team/group/media_formats/include/asterisk/translate.h

Modified: team/group/media_formats/codecs/codec_a_mu.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats/codecs/codec_a_mu.c?view=diff&rev=407951&r1=407950&r2=407951
==============================================================================
--- team/group/media_formats/codecs/codec_a_mu.c (original)
+++ team/group/media_formats/codecs/codec_a_mu.c Tue Feb 11 06:52:59 2014
@@ -80,6 +80,16 @@
 
 static struct ast_translator alawtoulaw = {
 	.name = "alawtoulaw",
+	.src_codec = {
+		.name = "alaw",
+		.type = AST_MEDIA_TYPE_AUDIO,
+		.sample_rate = 8000,
+	},
+	.dst_codec = {
+		.name = "ulaw",
+		.type = AST_MEDIA_TYPE_AUDIO,
+		.sample_rate = 8000,
+	},
 	.framein = alawtoulaw_framein,
 	.sample = alaw_sample,
 	.buffer_samples = BUFFER_SAMPLES,
@@ -88,6 +98,16 @@
 
 static struct ast_translator ulawtoalaw = {
 	.name = "ulawtoalaw",
+	.src_codec = {
+		.name = "ulaw",
+		.type = AST_MEDIA_TYPE_AUDIO,
+		.sample_rate = 8000,
+	},
+	.dst_codec = {
+		.name = "alaw",
+		.type = AST_MEDIA_TYPE_AUDIO,
+		.sample_rate = 8000,
+	},
 	.framein = ulawtoalaw_framein,
 	.sample = ulaw_sample,
 	.buffer_samples = BUFFER_SAMPLES,
@@ -111,23 +131,19 @@
 	int res;
 	int x;
 
-	ast_format_set(&alawtoulaw.src_format, AST_FORMAT_ALAW, 0);
-	ast_format_set(&alawtoulaw.dst_format, AST_FORMAT_ULAW, 0);
-
-	ast_format_set(&ulawtoalaw.src_format, AST_FORMAT_ULAW, 0);
-	ast_format_set(&ulawtoalaw.dst_format, AST_FORMAT_ALAW, 0);
-
 	for (x=0;x<256;x++) {
 		mu2a[x] = AST_LIN2A(AST_MULAW(x));
 		a2mu[x] = AST_LIN2MU(AST_ALAW(x));
 	}
+
 	res = ast_register_translator(&alawtoulaw);
-	if (!res)
-		res = ast_register_translator(&ulawtoalaw);
-	else
-		ast_unregister_translator(&alawtoulaw);
-	if (res)
+	res |= ast_register_translator(&ulawtoalaw);
+
+	if (res) {
+		unload_module();
 		return AST_MODULE_LOAD_FAILURE;
+	}
+
 	return AST_MODULE_LOAD_SUCCESS;
 }
 

Modified: team/group/media_formats/codecs/codec_adpcm.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats/codecs/codec_adpcm.c?view=diff&rev=407951&r1=407950&r2=407951
==============================================================================
--- team/group/media_formats/codecs/codec_adpcm.c (original)
+++ team/group/media_formats/codecs/codec_adpcm.c Tue Feb 11 06:52:59 2014
@@ -290,6 +290,16 @@
 
 static struct ast_translator adpcmtolin = {
 	.name = "adpcmtolin",
+	.src_codec = {
+		.name = "adpcm",
+		.type = AST_MEDIA_TYPE_AUDIO,
+		.sample_rate = 8000,
+	},
+	.dst_codec = {
+		.name = "slin",
+		.type = AST_MEDIA_TYPE_AUDIO,
+		.sample_rate = 8000,
+	},
 	.framein = adpcmtolin_framein,
 	.sample = adpcm_sample,
 	.desc_size = sizeof(struct adpcm_decoder_pvt),
@@ -299,6 +309,16 @@
 
 static struct ast_translator lintoadpcm = {
 	.name = "lintoadpcm",
+	.src_codec = {
+		.name = "slin",
+		.type = AST_MEDIA_TYPE_AUDIO,
+		.sample_rate = 8000,
+	},
+	.dst_codec = {
+		.name = "adpcm",
+		.type = AST_MEDIA_TYPE_AUDIO,
+		.sample_rate = 8000,
+	},
 	.framein = lintoadpcm_framein,
 	.frameout = lintoadpcm_frameout,
 	.sample = slin8_sample,
@@ -307,12 +327,6 @@
 	.buf_size = BUFFER_SAMPLES/ 2,	/* 2 samples per byte */
 };
 
-/*! \brief standard module glue */
-static int reload(void)
-{
-	return AST_MODULE_LOAD_SUCCESS;
-}
-
 static int unload_module(void)
 {
 	int res;
@@ -320,23 +334,12 @@
 	res = ast_unregister_translator(&lintoadpcm);
 	res |= ast_unregister_translator(&adpcmtolin);
 
-	ao2_cleanup(adpcmtolin.src_codec);
-	ao2_cleanup(adpcmtolin.dst_codec);
-	ao2_cleanup(lintoadpcm.src_codec);
-	ao2_cleanup(lintoadpcm.dst_codec);
-
 	return res;
 }
 
 static int load_module(void)
 {
 	int res = 0;
-
-	adpcmtolin.src_codec = ast_codec_get("adpcm", AST_MEDIA_TYPE_AUDIO, 8000);
-	adpcmtolin.dst_codec = ast_codec_get("slin", AST_MEDIA_TYPE_AUDIO, 8000);
-
-	lintoadpcm.src_codec = ast_codec_get("slin", AST_MEDIA_TYPE_AUDIO, 8000);
-	lintoadpcm.dst_codec = ast_codec_get("adpcm", AST_MEDIA_TYPE_AUDIO, 8000);
 
 	res = ast_register_translator(&adpcmtolin);
 	res |= ast_register_translator(&lintoadpcm);
@@ -352,5 +355,4 @@
 AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Adaptive Differential PCM Coder/Decoder",
 		.load = load_module,
 		.unload = unload_module,
-		.reload = reload,
 	       );

Modified: team/group/media_formats/codecs/codec_alaw.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats/codecs/codec_alaw.c?view=diff&rev=407951&r1=407950&r2=407951
==============================================================================
--- team/group/media_formats/codecs/codec_alaw.c (original)
+++ team/group/media_formats/codecs/codec_alaw.c Tue Feb 11 06:52:59 2014
@@ -77,6 +77,16 @@
 
 static struct ast_translator alawtolin = {
 	.name = "alawtolin",
+	.src_codec = {
+		.name = "alaw",
+		.type = AST_MEDIA_TYPE_AUDIO,
+		.sample_rate = 8000,
+	},
+	.dst_codec = {
+		.name = "slin",
+		.type = AST_MEDIA_TYPE_AUDIO,
+		.sample_rate = 8000,
+	},
 	.framein = alawtolin_framein,
 	.sample = alaw_sample,
 	.buffer_samples = BUFFER_SAMPLES,
@@ -84,19 +94,22 @@
 };
 
 static struct ast_translator lintoalaw = {
-	"lintoalaw",
+	.name = "lintoalaw",
+	.src_codec = {
+		.name = "slin",
+		.type = AST_MEDIA_TYPE_AUDIO,
+		.sample_rate = 8000,
+	},
+	.dst_codec = {
+		.name = "alaw",
+		.type = AST_MEDIA_TYPE_AUDIO,
+		.sample_rate = 8000,
+	},
 	.framein = lintoalaw_framein,
 	.sample = slin8_sample,
 	.buffer_samples = BUFFER_SAMPLES,
 	.buf_size = BUFFER_SAMPLES,
 };
-
-/*! \brief standard module stuff */
-
-static int reload(void)
-{
-	return AST_MODULE_LOAD_SUCCESS;
-}
 
 static int unload_module(void)
 {
@@ -112,24 +125,18 @@
 {
 	int res;
 
-	ast_format_set(&lintoalaw.src_format, AST_FORMAT_SLINEAR, 0);
-	ast_format_set(&lintoalaw.dst_format, AST_FORMAT_ALAW, 0);
+	res = ast_register_translator(&alawtolin);
+	res |= ast_register_translator(&lintoalaw);
 
-	ast_format_set(&alawtolin.src_format, AST_FORMAT_ALAW, 0);
-	ast_format_set(&alawtolin.dst_format, AST_FORMAT_SLINEAR, 0);
+	if (res) {
+		unload_module();
+		return AST_MODULE_LOAD_FAILURE;
+	}
 
-	res = ast_register_translator(&alawtolin);
-	if (!res)
-		res = ast_register_translator(&lintoalaw);
-	else
-		ast_unregister_translator(&alawtolin);
-	if (res)
-		return AST_MODULE_LOAD_FAILURE;
 	return AST_MODULE_LOAD_SUCCESS;
 }
 
 AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "A-law Coder/Decoder",
 		.load = load_module,
 		.unload = unload_module,
-		.reload = reload,
 	       );

Modified: team/group/media_formats/codecs/codec_g722.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats/codecs/codec_g722.c?view=diff&rev=407951&r1=407950&r2=407951
==============================================================================
--- team/group/media_formats/codecs/codec_g722.c (original)
+++ team/group/media_formats/codecs/codec_g722.c Tue Feb 11 06:52:59 2014
@@ -138,6 +138,16 @@
 
 static struct ast_translator g722tolin = {
 	.name = "g722tolin",
+	.src_codec = {
+		.name = "g722",
+		.type = AST_MEDIA_TYPE_AUDIO,
+		.sample_rate = 16000,
+	},
+	.dst_codec = {
+		.name = "slin",
+		.type = AST_MEDIA_TYPE_AUDIO,
+		.sample_rate = 8000,
+	},
 	.newpvt = g722tolin_new,	/* same for both directions */
 	.framein = g722tolin_framein,
 	.sample = g722_sample,
@@ -148,6 +158,16 @@
 
 static struct ast_translator lintog722 = {
 	.name = "lintog722",
+	.src_codec = {
+		.name = "slin",
+		.type = AST_MEDIA_TYPE_AUDIO,
+		.sample_rate = 8000,
+	},
+	.dst_codec = {
+		.name = "g722",
+		.type = AST_MEDIA_TYPE_AUDIO,
+		.sample_rate = 16000,
+	},
 	.newpvt = lintog722_new,	/* same for both directions */
 	.framein = lintog722_framein,
 	.sample = slin8_sample,
@@ -158,6 +178,16 @@
 
 static struct ast_translator g722tolin16 = {
 	.name = "g722tolin16",
+	.src_codec = {
+		.name = "g722",
+		.type = AST_MEDIA_TYPE_AUDIO,
+		.sample_rate = 16000,
+	},
+	.dst_codec = {
+		.name = "slin",
+		.type = AST_MEDIA_TYPE_AUDIO,
+		.sample_rate = 16000,
+	},
 	.newpvt = g722tolin16_new,	/* same for both directions */
 	.framein = g722tolin_framein,
 	.sample = g722_sample,
@@ -168,6 +198,16 @@
 
 static struct ast_translator lin16tog722 = {
 	.name = "lin16tog722",
+	.src_codec = {
+		.name = "slin",
+		.type = AST_MEDIA_TYPE_AUDIO,
+		.sample_rate = 16000,
+	},
+	.dst_codec = {
+		.name = "g722",
+		.type = AST_MEDIA_TYPE_AUDIO,
+		.sample_rate = 16000,
+	},
 	.newpvt = lin16tog722_new,	/* same for both directions */
 	.framein = lintog722_framein,
 	.sample = slin16_sample,
@@ -176,11 +216,6 @@
 	.buf_size = BUFFER_SAMPLES,
 };
 
-static int reload(void)
-{
-	return AST_MODULE_LOAD_SUCCESS;
-}
-
 static int unload_module(void)
 {
 	int res = 0;
@@ -197,18 +232,6 @@
 {
 	int res = 0;
 
-	ast_format_set(&g722tolin.src_format, AST_FORMAT_G722, 0);
-	ast_format_set(&g722tolin.dst_format, AST_FORMAT_SLINEAR, 0);
-
-	ast_format_set(&lintog722.src_format, AST_FORMAT_SLINEAR, 0);
-	ast_format_set(&lintog722.dst_format, AST_FORMAT_G722, 0);
-
-	ast_format_set(&g722tolin16.src_format, AST_FORMAT_G722, 0);
-	ast_format_set(&g722tolin16.dst_format, AST_FORMAT_SLINEAR16, 0);
-
-	ast_format_set(&lin16tog722.src_format, AST_FORMAT_SLINEAR16, 0);
-	ast_format_set(&lin16tog722.dst_format, AST_FORMAT_G722, 0);
-
 	res |= ast_register_translator(&g722tolin);
 	res |= ast_register_translator(&lintog722);
 	res |= ast_register_translator(&g722tolin16);
@@ -225,5 +248,4 @@
 AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "ITU G.722-64kbps G722 Transcoder",
 		.load = load_module,
 		.unload = unload_module,
-		.reload = reload,
 	       );

Modified: team/group/media_formats/codecs/codec_g726.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats/codecs/codec_g726.c?view=diff&rev=407951&r1=407950&r2=407951
==============================================================================
--- team/group/media_formats/codecs/codec_g726.c (original)
+++ team/group/media_formats/codecs/codec_g726.c Tue Feb 11 06:52:59 2014
@@ -785,6 +785,16 @@
 
 static struct ast_translator g726tolin = {
 	.name = "g726tolin",
+	.src_codec = {
+		.name = "g726",
+		.type = AST_MEDIA_TYPE_AUDIO,
+		.sample_rate = 8000,
+	},
+	.dst_codec = {
+		.name = "slin",
+		.type = AST_MEDIA_TYPE_AUDIO,
+		.sample_rate = 8000,
+	},
 	.newpvt = lintog726_new,	/* same for both directions */
 	.framein = g726tolin_framein,
 	.sample = g726_sample,
@@ -795,6 +805,16 @@
 
 static struct ast_translator lintog726 = {
 	.name = "lintog726",
+	.src_codec = {
+		.name = "slin",
+		.type = AST_MEDIA_TYPE_AUDIO,
+		.sample_rate = 8000,
+	},
+	.dst_codec = {
+		.name = "g726",
+		.type = AST_MEDIA_TYPE_AUDIO,
+		.sample_rate = 8000,
+	},
 	.newpvt = lintog726_new,	/* same for both directions */
 	.framein = lintog726_framein,
 	.sample = slin8_sample,
@@ -805,6 +825,16 @@
 
 static struct ast_translator g726aal2tolin = {
 	.name = "g726aal2tolin",
+	.src_codec = {
+		.name = "g726aal2",
+		.type = AST_MEDIA_TYPE_AUDIO,
+		.sample_rate = 8000,
+	},
+	.dst_codec = {
+		.name = "slin",
+		.type = AST_MEDIA_TYPE_AUDIO,
+		.sample_rate = 8000,
+	},
 	.newpvt = lintog726_new,	/* same for both directions */
 	.framein = g726aal2tolin_framein,
 	.sample = g726_sample,
@@ -815,6 +845,16 @@
 
 static struct ast_translator lintog726aal2 = {
 	.name = "lintog726aal2",
+	.src_codec = {
+		.name = "slin",
+		.type = AST_MEDIA_TYPE_AUDIO,
+		.sample_rate = 8000,
+	},
+	.dst_codec = {
+		.name = "g726aal2",
+		.type = AST_MEDIA_TYPE_AUDIO,
+		.sample_rate = 8000,
+	},
 	.newpvt = lintog726_new,	/* same for both directions */
 	.framein = lintog726aal2_framein,
 	.sample = slin8_sample,
@@ -823,11 +863,6 @@
 	.buf_size = BUFFER_SAMPLES / 2,
 };
 
-static int reload(void)
-{
-	return AST_MODULE_LOAD_SUCCESS;
-}
-
 static int unload_module(void)
 {
 	int res = 0;
@@ -844,18 +879,6 @@
 static int load_module(void)
 {
 	int res = 0;
-
-	ast_format_set(&g726tolin.src_format, AST_FORMAT_G726, 0);
-	ast_format_set(&g726tolin.dst_format, AST_FORMAT_SLINEAR, 0);
-
-	ast_format_set(&lintog726.src_format, AST_FORMAT_SLINEAR, 0);
-	ast_format_set(&lintog726.dst_format, AST_FORMAT_G726, 0);
-
-	ast_format_set(&g726aal2tolin.src_format, AST_FORMAT_G726_AAL2, 0);
-	ast_format_set(&g726aal2tolin.dst_format, AST_FORMAT_SLINEAR, 0);
-
-	ast_format_set(&lintog726aal2.src_format, AST_FORMAT_SLINEAR, 0);
-	ast_format_set(&lintog726aal2.dst_format, AST_FORMAT_G726_AAL2, 0);
 
 	res |= ast_register_translator(&g726tolin);
 	res |= ast_register_translator(&lintog726);
@@ -874,5 +897,4 @@
 AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "ITU G.726-32kbps G726 Transcoder",
 		.load = load_module,
 		.unload = unload_module,
-		.reload = reload,
 	       );

Modified: team/group/media_formats/codecs/codec_gsm.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats/codecs/codec_gsm.c?view=diff&rev=407951&r1=407950&r2=407951
==============================================================================
--- team/group/media_formats/codecs/codec_gsm.c (original)
+++ team/group/media_formats/codecs/codec_gsm.c Tue Feb 11 06:52:59 2014
@@ -168,7 +168,17 @@
 }
 
 static struct ast_translator gsmtolin = {
-	.name = "gsmtolin", 
+	.name = "gsmtolin",
+	.src_codec = {
+		.name = "gsm",
+		.type = AST_MEDIA_TYPE_AUDIO,
+		.sample_rate = 8000,
+	},
+	.dst_codec = {
+		.name = "slin",
+		.type = AST_MEDIA_TYPE_AUDIO,
+		.sample_rate = 8000,
+	},
 	.newpvt = gsm_new,
 	.framein = gsmtolin_framein,
 	.destroy = gsm_destroy_stuff,
@@ -179,7 +189,17 @@
 };
 
 static struct ast_translator lintogsm = {
-	.name = "lintogsm", 
+	.name = "lintogsm",
+	.src_codec = {
+		.name = "slin",
+		.type = AST_MEDIA_TYPE_AUDIO,
+		.sample_rate = 8000,
+	},
+	.dst_codec = {
+		.name = "gsm",
+		.type = AST_MEDIA_TYPE_AUDIO,
+		.sample_rate = 8000,
+	},
 	.newpvt = gsm_new,
 	.framein = lintogsm_framein,
 	.frameout = lintogsm_frameout,
@@ -189,19 +209,12 @@
 	.buf_size = (BUFFER_SAMPLES * GSM_FRAME_LEN + GSM_SAMPLES - 1)/GSM_SAMPLES,
 };
 
-/*! \brief standard module glue */
-static int reload(void)
-{
-	return AST_MODULE_LOAD_SUCCESS;
-}
-
 static int unload_module(void)
 {
 	int res;
 
 	res = ast_unregister_translator(&lintogsm);
-	if (!res)
-		res = ast_unregister_translator(&gsmtolin);
+	res |= ast_unregister_translator(&gsmtolin);
 
 	return res;
 }
@@ -210,24 +223,18 @@
 {
 	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);
-	else
-		ast_unregister_translator(&gsmtolin);
-	if (res) 
+	res |= ast_register_translator(&lintogsm);
+
+	if (res) {
+		unload_module();
 		return AST_MODULE_LOAD_FAILURE;
+	}
+
 	return AST_MODULE_LOAD_SUCCESS;
 }
 
 AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "GSM Coder/Decoder",
 		.load = load_module,
 		.unload = unload_module,
-		.reload = reload,
 	       );

Modified: team/group/media_formats/codecs/codec_ilbc.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats/codecs/codec_ilbc.c?view=diff&rev=407951&r1=407950&r2=407951
==============================================================================
--- team/group/media_formats/codecs/codec_ilbc.c (original)
+++ team/group/media_formats/codecs/codec_ilbc.c Tue Feb 11 06:52:59 2014
@@ -178,7 +178,17 @@
 }
 
 static struct ast_translator ilbctolin = {
-	.name = "ilbctolin", 
+	.name = "ilbctolin",
+	.src_codec = {
+		.name = "ilbc",
+		.type = AST_MEDIA_TYPE_AUDIO,
+		.sample_rate = 8000,
+	},
+	.dst_codec = {
+		.name = "slin",
+		.type = AST_MEDIA_TYPE_AUDIO,
+		.sample_rate = 8000,
+	},
 	.newpvt = ilbctolin_new,
 	.framein = ilbctolin_framein,
 	.sample = ilbc_sample,
@@ -188,7 +198,17 @@
 };
 
 static struct ast_translator lintoilbc = {
-	.name = "lintoilbc", 
+	.name = "lintoilbc",
+	.src_codec = {
+		.name = "slin",
+		.type = AST_MEDIA_TYPE_AUDIO,
+		.sample_rate = 8000,
+	},
+	.dst_codec = {
+		.name = "ilbc",
+		.type = AST_MEDIA_TYPE_AUDIO,
+		.sample_rate = 8000,
+	},
 	.newpvt = lintoilbc_new,
 	.framein = lintoilbc_framein,
 	.frameout = lintoilbc_frameout,
@@ -211,20 +231,14 @@
 {
 	int res;
 
-	ast_format_set(&ilbctolin.src_format, AST_FORMAT_ILBC, 0);
-	ast_format_set(&ilbctolin.dst_format, AST_FORMAT_SLINEAR, 0);
-
-	ast_format_set(&lintoilbc.src_format, AST_FORMAT_SLINEAR, 0);
-	ast_format_set(&lintoilbc.dst_format, AST_FORMAT_ILBC, 0);
-
-
 	res = ast_register_translator(&ilbctolin);
-	if (!res) 
-		res=ast_register_translator(&lintoilbc);
-	else
-		ast_unregister_translator(&ilbctolin);
-	if (res)
+	res |= ast_register_translator(&lintoilbc);
+
+	if (res) {
+		unload_module();
 		return AST_MODULE_LOAD_FAILURE;
+	}
+
 	return AST_MODULE_LOAD_SUCCESS;
 }
 

Modified: team/group/media_formats/codecs/codec_lpc10.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats/codecs/codec_lpc10.c?view=diff&rev=407951&r1=407950&r2=407951
==============================================================================
--- team/group/media_formats/codecs/codec_lpc10.c (original)
+++ team/group/media_formats/codecs/codec_lpc10.c Tue Feb 11 06:52:59 2014
@@ -196,7 +196,17 @@
 }
 
 static struct ast_translator lpc10tolin = {
-	.name = "lpc10tolin", 
+	.name = "lpc10tolin",
+	.src_codec = {
+		.name = "lpc10",
+		.type = AST_MEDIA_TYPE_AUDIO,
+		.sample_rate = 8000,
+	},
+	.dst_codec = {
+		.name = "slin",
+		.type = AST_MEDIA_TYPE_AUDIO,
+		.sample_rate = 8000,
+	},
 	.newpvt = lpc10_dec_new,
 	.framein = lpc10tolin_framein,
 	.destroy = lpc10_destroy,
@@ -207,7 +217,17 @@
 };
 
 static struct ast_translator lintolpc10 = {
-	.name = "lintolpc10", 
+	.name = "lintolpc10",
+	.src_codec = {
+		.name = "slin",
+		.type = AST_MEDIA_TYPE_AUDIO,
+		.sample_rate = 8000,
+	},
+	.dst_codec = {
+		.name = "lpc10",
+		.type = AST_MEDIA_TYPE_AUDIO,
+		.sample_rate = 8000,
+	}, 
 	.newpvt = lpc10_enc_new,
 	.framein = lintolpc10_framein,
 	.frameout = lintolpc10_frameout,
@@ -218,12 +238,6 @@
 	.buf_size = LPC10_BYTES_IN_COMPRESSED_FRAME * (1 + BUFFER_SAMPLES / LPC10_SAMPLES_PER_FRAME),
 };
 
-static int reload(void)
-{
-	return AST_MODULE_LOAD_SUCCESS;
-}
-
-
 static int unload_module(void)
 {
 	int res;
@@ -238,24 +252,18 @@
 {
 	int res;
 
-	ast_format_set(&lpc10tolin.src_format, AST_FORMAT_LPC10, 0);
-	ast_format_set(&lpc10tolin.dst_format, AST_FORMAT_SLINEAR, 0);
-
-	ast_format_set(&lintolpc10.src_format, AST_FORMAT_SLINEAR, 0);
-	ast_format_set(&lintolpc10.dst_format, AST_FORMAT_LPC10, 0);
-
 	res = ast_register_translator(&lpc10tolin);
-	if (!res) 
-		res = ast_register_translator(&lintolpc10);
-	else
-		ast_unregister_translator(&lpc10tolin);
-	if (res)
+	res |= ast_register_translator(&lintolpc10);
+
+	if (res) {
+		unload_module();
 		return AST_MODULE_LOAD_FAILURE;
+	}
+
 	return AST_MODULE_LOAD_SUCCESS;
 }
 
 AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "LPC10 2.4kbps Coder/Decoder",
 		.load = load_module,
 		.unload = unload_module,
-		.reload = reload,
 	       );

Modified: team/group/media_formats/codecs/codec_resample.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats/codecs/codec_resample.c?view=diff&rev=407951&r1=407950&r2=407951
==============================================================================
--- team/group/media_formats/codecs/codec_resample.c (original)
+++ team/group/media_formats/codecs/codec_resample.c Tue Feb 11 06:52:59 2014
@@ -42,23 +42,59 @@
 
 static struct ast_translator *translators;
 static int trans_size;
-static int id_list[] = {
-	AST_FORMAT_SLINEAR,
-	AST_FORMAT_SLINEAR12,
-	AST_FORMAT_SLINEAR16,
-	AST_FORMAT_SLINEAR24,
-	AST_FORMAT_SLINEAR32,
-	AST_FORMAT_SLINEAR44,
-	AST_FORMAT_SLINEAR48,
-	AST_FORMAT_SLINEAR96,
-	AST_FORMAT_SLINEAR192,
+static struct ast_codec codec_list[] = {
+	{
+		.name = "slin",
+		.type = AST_MEDIA_TYPE_AUDIO,
+		.sample_rate = 8000,
+	},
+	{
+		.name = "slin",
+		.type = AST_MEDIA_TYPE_AUDIO,
+		.sample_rate = 12000,
+	},
+	{
+		.name = "slin",
+		.type = AST_MEDIA_TYPE_AUDIO,
+		.sample_rate = 16000,
+	},
+	{
+		.name = "slin",
+		.type = AST_MEDIA_TYPE_AUDIO,
+		.sample_rate = 24000,
+	},
+	{
+		.name = "slin",
+		.type = AST_MEDIA_TYPE_AUDIO,
+		.sample_rate = 32000,
+	},
+	{
+		.name = "slin",
+		.type = AST_MEDIA_TYPE_AUDIO,
+		.sample_rate = 44000,
+	},
+	{
+		.name = "slin",
+		.type = AST_MEDIA_TYPE_AUDIO,
+		.sample_rate = 48000,
+	},
+	{
+		.name = "slin",
+		.type = AST_MEDIA_TYPE_AUDIO,
+		.sample_rate = 96000,
+	},
+	{
+		.name = "slin",
+		.type = AST_MEDIA_TYPE_AUDIO,
+		.sample_rate = 192000,
+	},
 };
 
 static int resamp_new(struct ast_trans_pvt *pvt)
 {
 	int err;
 
-	if (!(pvt->pvt = speex_resampler_init(1, ast_format_rate(&pvt->t->src_format), ast_format_rate(&pvt->t->dst_format), 5, &err))) {
+	if (!(pvt->pvt = speex_resampler_init(1, pvt->t->src_codec.sample_rate, pvt->t->dst_codec.sample_rate, 5, &err))) {
 		return -1;
 	}
 
@@ -113,13 +149,13 @@
 	int res = 0;
 	int x, y, idx = 0;
 
-	trans_size = ARRAY_LEN(id_list) * (ARRAY_LEN(id_list) - 1);
+	trans_size = ARRAY_LEN(codec_list) * (ARRAY_LEN(codec_list) - 1);
 	if (!(translators = ast_calloc(1, sizeof(struct ast_translator) * trans_size))) {
 		return AST_MODULE_LOAD_FAILURE;
 	}
 
-	for (x = 0; x < ARRAY_LEN(id_list); x++) {
-		for (y = 0; y < ARRAY_LEN(id_list); y++) {
+	for (x = 0; x < ARRAY_LEN(codec_list); x++) {
+		for (y = 0; y < ARRAY_LEN(codec_list); y++) {
 			if (x == y) {
 				continue;
 			}
@@ -129,10 +165,10 @@
 			translators[idx].desc_size = 0;
 			translators[idx].buffer_samples = (OUTBUF_SIZE / sizeof(int16_t));
 			translators[idx].buf_size = OUTBUF_SIZE;
-			ast_format_set(&translators[idx].src_format, id_list[x], 0);
-			ast_format_set(&translators[idx].dst_format, id_list[y], 0);
+			memcpy(&translators[idx].src_codec, &codec_list[x], sizeof(struct ast_codec));
+			memcpy(&translators[idx].dst_codec, &codec_list[y], sizeof(struct ast_codec));
 			snprintf(translators[idx].name, sizeof(translators[idx].name), "slin %dkhz -> %dkhz",
-				ast_format_rate(&translators[idx].src_format), ast_format_rate(&translators[idx].dst_format));
+				translators[idx].src_codec.sample_rate, translators[idx].dst_codec.sample_rate);
 			res |= ast_register_translator(&translators[idx]);
 			idx++;
 		}

Modified: team/group/media_formats/codecs/codec_speex.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats/codecs/codec_speex.c?view=diff&rev=407951&r1=407950&r2=407951
==============================================================================
--- team/group/media_formats/codecs/codec_speex.c (original)
+++ team/group/media_formats/codecs/codec_speex.c Tue Feb 11 06:52:59 2014
@@ -341,7 +341,17 @@
 }
 
 static struct ast_translator speextolin = {
-	.name = "speextolin", 
+	.name = "speextolin",
+	.src_codec = {
+		.name = "speex",
+		.type = AST_MEDIA_TYPE_AUDIO,
+		.sample_rate = 8000,
+	},
+	.dst_codec = {
+		.name = "slin",
+		.type = AST_MEDIA_TYPE_AUDIO,
+		.sample_rate = 8000,
+	},
 	.newpvt = speextolin_new,
 	.framein = speextolin_framein,
 	.destroy = speextolin_destroy,
@@ -354,6 +364,16 @@
 
 static struct ast_translator lintospeex = {
 	.name = "lintospeex", 
+	.src_codec = {
+		.name = "slin",
+		.type = AST_MEDIA_TYPE_AUDIO,
+		.sample_rate = 8000,
+	},
+	.dst_codec = {
+		.name = "speex",
+		.type = AST_MEDIA_TYPE_AUDIO,
+		.sample_rate = 8000,
+	},
 	.newpvt = lintospeex_new,
 	.framein = lintospeex_framein,
 	.frameout = lintospeex_frameout,
@@ -365,7 +385,17 @@
 };
 
 static struct ast_translator speexwbtolin16 = {
-	.name = "speexwbtolin16", 
+	.name = "speexwbtolin16",
+	.src_codec = {
+		.name = "speex",
+		.type = AST_MEDIA_TYPE_AUDIO,
+		.sample_rate = 16000,
+	},
+	.dst_codec = {
+		.name = "slin",
+		.type = AST_MEDIA_TYPE_AUDIO,
+		.sample_rate = 16000,
+	}, 
 	.newpvt = speexwbtolin16_new,
 	.framein = speextolin_framein,
 	.destroy = speextolin_destroy,
@@ -377,7 +407,17 @@
 };
 
 static struct ast_translator lin16tospeexwb = {
-	.name = "lin16tospeexwb", 
+	.name = "lin16tospeexwb",
+	.src_codec = {
+		.name = "slin",
+		.type = AST_MEDIA_TYPE_AUDIO,
+		.sample_rate = 16000,
+	},
+	.dst_codec = {
+		.name = "speex",
+		.type = AST_MEDIA_TYPE_AUDIO,
+		.sample_rate = 16000,
+	},
 	.newpvt = lin16tospeexwb_new,
 	.framein = lintospeex_framein,
 	.frameout = lintospeex_frameout,
@@ -389,7 +429,17 @@
 };
 
 static struct ast_translator speexuwbtolin32 = {
-	.name = "speexuwbtolin32", 
+	.name = "speexuwbtolin32",
+	.src_codec = {
+		.name = "speex",
+		.type = AST_MEDIA_TYPE_AUDIO,
+		.sample_rate = 32000,
+	},
+	.dst_codec = {
+		.name = "slin",
+		.type = AST_MEDIA_TYPE_AUDIO,
+		.sample_rate = 32000,
+	},
 	.newpvt = speexuwbtolin32_new,
 	.framein = speextolin_framein,
 	.destroy = speextolin_destroy,
@@ -400,7 +450,17 @@
 };
 
 static struct ast_translator lin32tospeexuwb = {
-	.name = "lin32tospeexuwb", 
+	.name = "lin32tospeexuwb",
+	.src_codec = {
+		.name = "slin",
+		.type = AST_MEDIA_TYPE_AUDIO,
+		.sample_rate = 32000,
+	},
+	.dst_codec = {
+		.name = "speex",
+		.type = AST_MEDIA_TYPE_AUDIO,
+		.sample_rate = 32000,
+	},
 	.newpvt = lin32tospeexuwb_new,
 	.framein = lintospeex_framein,
 	.frameout = lintospeex_frameout,
@@ -534,25 +594,6 @@
 	if (parse_config(0))
 		return AST_MODULE_LOAD_DECLINE;
 
-
-	ast_format_set(&speextolin.src_format, AST_FORMAT_SPEEX, 0);
-	ast_format_set(&speextolin.dst_format, AST_FORMAT_SLINEAR, 0);
-
-	ast_format_set(&lintospeex.src_format, AST_FORMAT_SLINEAR, 0);
-	ast_format_set(&lintospeex.dst_format, AST_FORMAT_SPEEX, 0);
-
-	ast_format_set(&speexwbtolin16.src_format, AST_FORMAT_SPEEX16, 0);
-	ast_format_set(&speexwbtolin16.dst_format, AST_FORMAT_SLINEAR16, 0);
-
-	ast_format_set(&lin16tospeexwb.src_format, AST_FORMAT_SLINEAR16, 0);
-	ast_format_set(&lin16tospeexwb.dst_format, AST_FORMAT_SPEEX16, 0);
-
-	ast_format_set(&speexuwbtolin32.src_format, AST_FORMAT_SPEEX32, 0);
-	ast_format_set(&speexuwbtolin32.dst_format, AST_FORMAT_SLINEAR32, 0);
-
-	ast_format_set(&lin32tospeexuwb.src_format, AST_FORMAT_SLINEAR32, 0);
-	ast_format_set(&lin32tospeexuwb.dst_format, AST_FORMAT_SPEEX32, 0);
-
 	res |= ast_register_translator(&speextolin);
 	res |= ast_register_translator(&lintospeex);
 	res |= ast_register_translator(&speexwbtolin16);
@@ -560,6 +601,10 @@
 	res |= ast_register_translator(&speexuwbtolin32);
 	res |= ast_register_translator(&lin32tospeexuwb);
 
+	if (res) {
+		unload_module();
+		return res;
+	}
 
 	return res;
 }

Modified: team/group/media_formats/codecs/codec_ulaw.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats/codecs/codec_ulaw.c?view=diff&rev=407951&r1=407950&r2=407951
==============================================================================
--- team/group/media_formats/codecs/codec_ulaw.c (original)
+++ team/group/media_formats/codecs/codec_ulaw.c Tue Feb 11 06:52:59 2014
@@ -82,6 +82,16 @@
 
 static struct ast_translator ulawtolin = {
 	.name = "ulawtolin",
+	.src_codec = {
+		.name = "ulaw",
+		.type = AST_MEDIA_TYPE_AUDIO,
+		.sample_rate = 8000,
+	},
+	.dst_codec = {
+		.name = "slin",
+		.type = AST_MEDIA_TYPE_AUDIO,
+		.sample_rate = 8000,
+	},
 	.framein = ulawtolin_framein,
 	.sample = ulaw_sample,
 	.buffer_samples = BUFFER_SAMPLES,
@@ -90,6 +100,16 @@
 
 static struct ast_translator testlawtolin = {
 	.name = "testlawtolin",
+	.src_codec = {
+		.name = "testlaw",
+		.type = AST_MEDIA_TYPE_AUDIO,
+		.sample_rate = 8000,
+	},
+	.dst_codec = {
+		.name = "slin",
+		.type = AST_MEDIA_TYPE_AUDIO,
+		.sample_rate = 8000,
+	},
 	.framein = ulawtolin_framein,
 	.sample = ulaw_sample,
 	.buffer_samples = BUFFER_SAMPLES,
@@ -102,6 +122,16 @@
 
 static struct ast_translator lintoulaw = {
 	.name = "lintoulaw",
+	.src_codec = {
+		.name = "slin",
+		.type = AST_MEDIA_TYPE_AUDIO,
+		.sample_rate = 8000,
+	},
+	.dst_codec = {
+		.name = "ulaw",
+		.type = AST_MEDIA_TYPE_AUDIO,
+		.sample_rate = 8000,
+	},
 	.framein = lintoulaw_framein,
 	.sample = slin8_sample,
 	.buf_size = BUFFER_SAMPLES,
@@ -110,16 +140,21 @@
 
 static struct ast_translator lintotestlaw = {
 	.name = "lintotestlaw",
+	.src_codec = {
+		.name = "slin",
+		.type = AST_MEDIA_TYPE_AUDIO,
+		.sample_rate = 8000,
+	},
+	.dst_codec = {
+		.name = "testlaw",
+		.type = AST_MEDIA_TYPE_AUDIO,
+		.sample_rate = 8000,
+	},
 	.framein = lintoulaw_framein,
 	.sample = slin8_sample,
 	.buf_size = BUFFER_SAMPLES,
 	.buffer_samples = BUFFER_SAMPLES,
 };
-
-static int reload(void)
-{
-	return AST_MODULE_LOAD_SUCCESS;
-}
 
 static int unload_module(void)
 {
@@ -137,32 +172,20 @@
 {
 	int res;
 
-	ast_format_set(&lintoulaw.src_format, AST_FORMAT_SLINEAR, 0);
-	ast_format_set(&lintoulaw.dst_format, AST_FORMAT_ULAW, 0);
+	res = ast_register_translator(&ulawtolin);
+	res |= ast_register_translator(&lintoulaw);
+	res |= ast_register_translator(&lintotestlaw);
+	res |= ast_register_translator(&testlawtolin);
 
-	ast_format_set(&lintotestlaw.src_format, AST_FORMAT_SLINEAR, 0);
-	ast_format_set(&lintotestlaw.dst_format, AST_FORMAT_TESTLAW, 0);
+	if (res) {
+		unload_module();
+		return AST_MODULE_LOAD_FAILURE;
+	}
 
-	ast_format_set(&ulawtolin.src_format, AST_FORMAT_ULAW, 0);
-	ast_format_set(&ulawtolin.dst_format, AST_FORMAT_SLINEAR, 0);
-
-	ast_format_set(&testlawtolin.src_format, AST_FORMAT_TESTLAW, 0);
-	ast_format_set(&testlawtolin.dst_format, AST_FORMAT_SLINEAR, 0);
-
-	res = ast_register_translator(&ulawtolin);
-	if (!res) {
-		res = ast_register_translator(&lintoulaw);
-		res |= ast_register_translator(&lintotestlaw);
-		res |= ast_register_translator(&testlawtolin);
-	} else
-		ast_unregister_translator(&ulawtolin);
-	if (res)
-		return AST_MODULE_LOAD_FAILURE;
 	return AST_MODULE_LOAD_SUCCESS;
 }
 
 AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "mu-Law Coder/Decoder",
 		.load = load_module,
 		.unload = unload_module,
-		.reload = reload,
 	       );

Modified: team/group/media_formats/codecs/ex_adpcm.h
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats/codecs/ex_adpcm.h?view=diff&rev=407951&r1=407950&r2=407951
==============================================================================
--- team/group/media_formats/codecs/ex_adpcm.h (original)
+++ team/group/media_formats/codecs/ex_adpcm.h Tue Feb 11 06:52:59 2014
@@ -27,7 +27,7 @@
 		.data.ptr = ex_adpcm,
 	};
 
-	f.subclass.format = ast_format_adpcm;
+	f.subclass.format = ast_format_copy(ast_format_adpcm);
 
 	return &f;
 }

Modified: team/group/media_formats/codecs/ex_alaw.h
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats/codecs/ex_alaw.h?view=diff&rev=407951&r1=407950&r2=407951
==============================================================================
--- team/group/media_formats/codecs/ex_alaw.h (original)
+++ team/group/media_formats/codecs/ex_alaw.h Tue Feb 11 06:52:59 2014
@@ -31,6 +31,8 @@
 		.src = __PRETTY_FUNCTION__,
 		.data.ptr = ex_alaw,
 	};
-	f.subclass.format = ast_format_ulaw;
+
+	f.subclass.format = ast_format_copy(ast_format_ulaw);
+
 	return &f;
 }

Modified: team/group/media_formats/codecs/ex_g722.h
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats/codecs/ex_g722.h?view=diff&rev=407951&r1=407950&r2=407951
==============================================================================
--- team/group/media_formats/codecs/ex_g722.h (original)
+++ team/group/media_formats/codecs/ex_g722.h Tue Feb 11 06:52:59 2014
@@ -42,7 +42,7 @@
 		.data.ptr = ex_g722,
 	};
 
-	ast_format_set(&f.subclass.format, AST_FORMAT_G722, 0);
+	f.subclass.format = ast_format_copy(ast_format_slin);
 
 	return &f;
 }

Modified: team/group/media_formats/codecs/ex_g726.h
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats/codecs/ex_g726.h?view=diff&rev=407951&r1=407950&r2=407951
==============================================================================
--- team/group/media_formats/codecs/ex_g726.h (original)
+++ team/group/media_formats/codecs/ex_g726.h Tue Feb 11 06:52:59 2014
@@ -27,7 +27,7 @@
 		.data.ptr = ex_g726,
 	};
 
-	ast_format_set(&f.subclass.format, AST_FORMAT_G726, 0);
+	f.subclass.format = ast_format_copy(ast_format_g726);
 
 	return &f;
 }

Modified: team/group/media_formats/codecs/ex_gsm.h
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats/codecs/ex_gsm.h?view=diff&rev=407951&r1=407950&r2=407951
==============================================================================
--- team/group/media_formats/codecs/ex_gsm.h (original)
+++ team/group/media_formats/codecs/ex_gsm.h Tue Feb 11 06:52:59 2014
@@ -27,6 +27,7 @@
 		.data.ptr = ex_gsm,
 	};
 
-	ast_format_set(&f.subclass.format, AST_FORMAT_GSM, 0);
+	f.subclass.format = ast_format_copy(ast_format_gsm);
+
 	return &f;
 }

Modified: team/group/media_formats/codecs/ex_ilbc.h
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats/codecs/ex_ilbc.h?view=diff&rev=407951&r1=407950&r2=407951
==============================================================================
--- team/group/media_formats/codecs/ex_ilbc.h (original)
+++ team/group/media_formats/codecs/ex_ilbc.h Tue Feb 11 06:52:59 2014
@@ -28,6 +28,7 @@
 		.data.ptr = ex_ilbc,
 	};
 
-	ast_format_set(&f.subclass.format, AST_FORMAT_ILBC, 0);
+	f.subclass.format = ast_format_copy(ast_format_ilbc);
+
 	return &f;
 }

Modified: team/group/media_formats/codecs/ex_lpc10.h
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats/codecs/ex_lpc10.h?view=diff&rev=407951&r1=407950&r2=407951
==============================================================================
--- team/group/media_formats/codecs/ex_lpc10.h (original)
+++ team/group/media_formats/codecs/ex_lpc10.h Tue Feb 11 06:52:59 2014
@@ -25,7 +25,7 @@
 		.data.ptr = ex_lpc10,
 	};
 
-	ast_format_set(&f.subclass.format, AST_FORMAT_LPC10, 0);
+	f.subclass.format = ast_format_copy(ast_format_lpc10);
 
 	return &f;
 }

Modified: team/group/media_formats/codecs/ex_speex.h
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats/codecs/ex_speex.h?view=diff&rev=407951&r1=407950&r2=407951
==============================================================================
--- team/group/media_formats/codecs/ex_speex.h (original)
+++ team/group/media_formats/codecs/ex_speex.h Tue Feb 11 06:52:59 2014
@@ -27,7 +27,7 @@
 		.data.ptr = ex_speex,
 	};
 
-	ast_format_set(&f.subclass.format, AST_FORMAT_SPEEX, 0);
+	f.subclass.format = ast_format_copy(ast_format_speex);
 
 	return &f;
 }
@@ -58,7 +58,8 @@
 		.src = __PRETTY_FUNCTION__,
 		.data.ptr = ex_speex16,
 	};
-	ast_format_set(&f.subclass.format, AST_FORMAT_SPEEX16, 0);
+
+	f.subclass.format = ast_format_copy(ast_format_speex16);
 
 	return &f;
 }

Modified: team/group/media_formats/codecs/ex_ulaw.h
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats/codecs/ex_ulaw.h?view=diff&rev=407951&r1=407950&r2=407951
==============================================================================
--- team/group/media_formats/codecs/ex_ulaw.h (original)
+++ team/group/media_formats/codecs/ex_ulaw.h Tue Feb 11 06:52:59 2014
@@ -32,6 +32,7 @@
 		.data.ptr = ex_ulaw,
 	};
 
-	ast_format_set(&f.subclass.format, AST_FORMAT_ULAW, 0);
+	f.subclass.format = ast_format_copy(ast_format_ulaw);
+
 	return &f;
 }

Modified: team/group/media_formats/include/asterisk/format_cache.h
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats/include/asterisk/format_cache.h?view=diff&rev=407951&r1=407950&r2=407951
==============================================================================
--- team/group/media_formats/include/asterisk/format_cache.h (original)
+++ team/group/media_formats/include/asterisk/format_cache.h Tue Feb 11 06:52:59 2014
@@ -94,6 +94,36 @@
 extern struct ast_format *ast_format_adpcm;
 
 /*!
+ * \brief Built-in cached g722 format.
+ */
+extern struct ast_format *ast_format_g722;
+
+/*!
+ * \brief Built-in cached g726 format.
+ */
+extern struct ast_format *ast_format_g726;
+
+/*!
+ * \brief Built-in cached ilbc format.
+ */
+extern struct ast_format *ast_format_ilbc;
+
+/*!
+ * \brief Built-in cached ilbc format.
+ */
+extern struct ast_format *ast_format_lpc10;
+
+/*!
+ * \brief Built-in cached speex format.
+ */
+extern struct ast_format *ast_format_speex;
+
+/*!
+ * \brief Built-in cached speex at 16kHz format.
+ */
+extern struct ast_format *ast_format_speex16;
+
+/*!
  * \brief Initialize format cache support within the core.
  *
  * \retval 0 success

Modified: team/group/media_formats/include/asterisk/translate.h
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats/include/asterisk/translate.h?view=diff&rev=407951&r1=407950&r2=407951
==============================================================================
--- team/group/media_formats/include/asterisk/translate.h (original)
+++ team/group/media_formats/include/asterisk/translate.h Tue Feb 11 06:52:59 2014
@@ -136,8 +136,10 @@
  */
 struct ast_translator {
 	char name[80];                         /*!< Name of translator */
-	struct ast_codec *src_codec;		   /*!< Source codec */
-	struct ast_codec *dst_codec;		   /*!< Destination codec */
+	struct ast_codec src_codec;		       /*!< Source codec */
+	struct ast_codec dst_codec;		   	   /*!< Destination codec */
+	struct ast_codec *core_src_codec;	   /*!< Core registered source codec */
+	struct ast_codec *core_dst_codec;      /*!< Core registered destination codec */
 
 	int table_cost;                        /*!< Cost value associated with this translator based
 	                                        *   on translation cost table. */




More information about the asterisk-commits mailing list