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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jan 14 10:27:11 CST 2011


Author: dvossel
Date: Fri Jan 14 10:27:03 2011
New Revision: 301788

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=301788
Log:
conversion of the translator and format modules

Modified:
    team/dvossel/fixtheworld_phase1_step3/codecs/codec_a_mu.c
    team/dvossel/fixtheworld_phase1_step3/codecs/codec_adpcm.c
    team/dvossel/fixtheworld_phase1_step3/codecs/codec_g722.c
    team/dvossel/fixtheworld_phase1_step3/codecs/codec_g726.c
    team/dvossel/fixtheworld_phase1_step3/codecs/codec_ilbc.c
    team/dvossel/fixtheworld_phase1_step3/codecs/codec_lpc10.c
    team/dvossel/fixtheworld_phase1_step3/codecs/codec_resample.c
    team/dvossel/fixtheworld_phase1_step3/codecs/codec_speex.c
    team/dvossel/fixtheworld_phase1_step3/codecs/ex_adpcm.h
    team/dvossel/fixtheworld_phase1_step3/codecs/ex_g722.h
    team/dvossel/fixtheworld_phase1_step3/codecs/ex_g726.h
    team/dvossel/fixtheworld_phase1_step3/codecs/ex_lpc10.h
    team/dvossel/fixtheworld_phase1_step3/codecs/ex_speex.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_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_jpeg.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/main/translate.c

Modified: team/dvossel/fixtheworld_phase1_step3/codecs/codec_a_mu.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/codecs/codec_a_mu.c?view=diff&rev=301788&r1=301787&r2=301788
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/codecs/codec_a_mu.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/codecs/codec_a_mu.c Fri Jan 14 10:27:03 2011
@@ -76,8 +76,6 @@
 
 static struct ast_translator alawtoulaw = {
 	.name = "alawtoulaw",
-	.srcfmt = AST_FORMAT_ALAW,
-	.dstfmt = AST_FORMAT_ULAW,
 	.framein = alawtoulaw_framein,
 	.sample = alaw_sample,
 	.buffer_samples = BUFFER_SAMPLES,
@@ -86,8 +84,6 @@
 
 static struct ast_translator ulawtoalaw = {
 	.name = "ulawtoalaw",
-	.srcfmt = AST_FORMAT_ULAW,
-	.dstfmt = AST_FORMAT_ALAW,
 	.framein = ulawtoalaw_framein,
 	.sample = ulaw_sample,
 	.buffer_samples = BUFFER_SAMPLES,
@@ -111,6 +107,12 @@
 	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));

Modified: team/dvossel/fixtheworld_phase1_step3/codecs/codec_adpcm.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/codecs/codec_adpcm.c?view=diff&rev=301788&r1=301787&r2=301788
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/codecs/codec_adpcm.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/codecs/codec_adpcm.c Fri Jan 14 10:27:03 2011
@@ -286,8 +286,6 @@
 
 static struct ast_translator adpcmtolin = {
 	.name = "adpcmtolin",
-	.srcfmt = AST_FORMAT_ADPCM,
-	.dstfmt = AST_FORMAT_SLINEAR,
 	.framein = adpcmtolin_framein,
 	.sample = adpcm_sample,
 	.desc_size = sizeof(struct adpcm_decoder_pvt),
@@ -297,8 +295,6 @@
 
 static struct ast_translator lintoadpcm = {
 	.name = "lintoadpcm",
-	.srcfmt = AST_FORMAT_SLINEAR,
-	.dstfmt = AST_FORMAT_ADPCM,
 	.framein = lintoadpcm_framein,
 	.frameout = lintoadpcm_frameout,
 	.sample = slin8_sample,
@@ -326,6 +322,12 @@
 static int load_module(void)
 {
 	int res;
+
+	ast_format_set(&adpcmtolin.src_format, AST_FORMAT_ADPCM, 0);
+	ast_format_set(&adpcmtolin.dst_format, AST_FORMAT_SLINEAR, 0);
+
+	ast_format_set(&lintoadpcm.src_format, AST_FORMAT_SLINEAR, 0);
+	ast_format_set(&lintoadpcm.dst_format, AST_FORMAT_ADPCM, 0);
 
 	res = ast_register_translator(&adpcmtolin);
 	if (!res)

Modified: team/dvossel/fixtheworld_phase1_step3/codecs/codec_g722.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/codecs/codec_g722.c?view=diff&rev=301788&r1=301787&r2=301788
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/codecs/codec_g722.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/codecs/codec_g722.c Fri Jan 14 10:27:03 2011
@@ -134,8 +134,6 @@
 
 static struct ast_translator g722tolin = {
 	.name = "g722tolin",
-	.srcfmt = AST_FORMAT_G722,
-	.dstfmt = AST_FORMAT_SLINEAR,
 	.newpvt = g722tolin_new,	/* same for both directions */
 	.framein = g722tolin_framein,
 	.sample = g722_sample,
@@ -146,8 +144,6 @@
 
 static struct ast_translator lintog722 = {
 	.name = "lintog722",
-	.srcfmt = AST_FORMAT_SLINEAR,
-	.dstfmt = AST_FORMAT_G722,
 	.newpvt = lintog722_new,	/* same for both directions */
 	.framein = lintog722_framein,
 	.sample = slin8_sample,
@@ -158,8 +154,6 @@
 
 static struct ast_translator g722tolin16 = {
 	.name = "g722tolin16",
-	.srcfmt = AST_FORMAT_G722,
-	.dstfmt = AST_FORMAT_SLINEAR16,
 	.newpvt = g722tolin16_new,	/* same for both directions */
 	.framein = g722tolin_framein,
 	.sample = g722_sample,
@@ -170,8 +164,6 @@
 
 static struct ast_translator lin16tog722 = {
 	.name = "lin16tog722",
-	.srcfmt = AST_FORMAT_SLINEAR16,
-	.dstfmt = AST_FORMAT_G722,
 	.newpvt = lin16tog722_new,	/* same for both directions */
 	.framein = lintog722_framein,
 	.sample = slin16_sample,
@@ -201,6 +193,18 @@
 {
 	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);

Modified: team/dvossel/fixtheworld_phase1_step3/codecs/codec_g726.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/codecs/codec_g726.c?view=diff&rev=301788&r1=301787&r2=301788
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/codecs/codec_g726.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/codecs/codec_g726.c Fri Jan 14 10:27:03 2011
@@ -771,8 +771,6 @@
 
 static struct ast_translator g726tolin = {
 	.name = "g726tolin",
-	.srcfmt = AST_FORMAT_G726,
-	.dstfmt = AST_FORMAT_SLINEAR,
 	.newpvt = lintog726_new,	/* same for both directions */
 	.framein = g726tolin_framein,
 	.sample = g726_sample,
@@ -783,8 +781,6 @@
 
 static struct ast_translator lintog726 = {
 	.name = "lintog726",
-	.srcfmt = AST_FORMAT_SLINEAR,
-	.dstfmt = AST_FORMAT_G726,
 	.newpvt = lintog726_new,	/* same for both directions */
 	.framein = lintog726_framein,
 	.sample = slin8_sample,
@@ -795,8 +791,6 @@
 
 static struct ast_translator g726aal2tolin = {
 	.name = "g726aal2tolin",
-	.srcfmt = AST_FORMAT_G726_AAL2,
-	.dstfmt = AST_FORMAT_SLINEAR,
 	.newpvt = lintog726_new,	/* same for both directions */
 	.framein = g726aal2tolin_framein,
 	.sample = g726_sample,
@@ -807,8 +801,6 @@
 
 static struct ast_translator lintog726aal2 = {
 	.name = "lintog726aal2",
-	.srcfmt = AST_FORMAT_SLINEAR,
-	.dstfmt = AST_FORMAT_G726_AAL2,
 	.newpvt = lintog726_new,	/* same for both directions */
 	.framein = lintog726aal2_framein,
 	.sample = slin8_sample,
@@ -839,6 +831,18 @@
 {
 	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);
 

Modified: team/dvossel/fixtheworld_phase1_step3/codecs/codec_ilbc.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/codecs/codec_ilbc.c?view=diff&rev=301788&r1=301787&r2=301788
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/codecs/codec_ilbc.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/codecs/codec_ilbc.c Fri Jan 14 10:27:03 2011
@@ -166,8 +166,6 @@
 
 static struct ast_translator ilbctolin = {
 	.name = "ilbctolin", 
-	.srcfmt = AST_FORMAT_ILBC,
-	.dstfmt = AST_FORMAT_SLINEAR,
 	.newpvt = ilbctolin_new,
 	.framein = ilbctolin_framein,
 	.sample = ilbc_sample,
@@ -178,8 +176,6 @@
 
 static struct ast_translator lintoilbc = {
 	.name = "lintoilbc", 
-	.srcfmt = AST_FORMAT_SLINEAR,
-	.dstfmt = AST_FORMAT_ILBC,
 	.newpvt = lintoilbc_new,
 	.framein = lintoilbc_framein,
 	.frameout = lintoilbc_frameout,
@@ -201,6 +197,13 @@
 static int load_module(void)
 {
 	int res;
+
+	ast_format_set(&ilibctolin.src_format, AST_FORMAT_ILBC, 0);
+	ast_format_set(&ilibctolin.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) 

Modified: team/dvossel/fixtheworld_phase1_step3/codecs/codec_lpc10.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/codecs/codec_lpc10.c?view=diff&rev=301788&r1=301787&r2=301788
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/codecs/codec_lpc10.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/codecs/codec_lpc10.c Fri Jan 14 10:27:03 2011
@@ -193,8 +193,6 @@
 
 static struct ast_translator lpc10tolin = {
 	.name = "lpc10tolin", 
-	.srcfmt = AST_FORMAT_LPC10,
-	.dstfmt = AST_FORMAT_SLINEAR,
 	.newpvt = lpc10_dec_new,
 	.framein = lpc10tolin_framein,
 	.destroy = lpc10_destroy,
@@ -206,8 +204,6 @@
 
 static struct ast_translator lintolpc10 = {
 	.name = "lintolpc10", 
-	.srcfmt = AST_FORMAT_SLINEAR,
-	.dstfmt = AST_FORMAT_LPC10,
 	.newpvt = lpc10_enc_new,
 	.framein = lintolpc10_framein,
 	.frameout = lintolpc10_frameout,
@@ -238,6 +234,12 @@
 {
 	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);

Modified: team/dvossel/fixtheworld_phase1_step3/codecs/codec_resample.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/codecs/codec_resample.c?view=diff&rev=301788&r1=301787&r2=301788
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/codecs/codec_resample.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/codecs/codec_resample.c Fri Jan 14 10:27:03 2011
@@ -170,8 +170,6 @@
 
 static struct ast_translator slin16_to_slin8 = {
 	.name = "slin16_to_slin8",
-	.srcfmt = AST_FORMAT_SLINEAR16,
-	.dstfmt = AST_FORMAT_SLINEAR,
 	.newpvt = slin16_to_slin8_new,
 	.destroy = slin16_to_slin8_destroy,
 	.framein = slin16_to_slin8_framein,
@@ -183,8 +181,6 @@
 
 static struct ast_translator slin8_to_slin16 = {
 	.name = "slin8_to_slin16",
-	.srcfmt = AST_FORMAT_SLINEAR,
-	.dstfmt = AST_FORMAT_SLINEAR16,
 	.newpvt = slin8_to_slin16_new,
 	.destroy = slin8_to_slin16_destroy,
 	.framein = slin8_to_slin16_framein,
@@ -208,6 +204,12 @@
 {
 	int res = 0;
 
+	ast_format_set(&slin16_to_slin8.src_format, AST_FORMAT_SLINEAR16, 0);
+	ast_format_set(&slin16_to_slin8.dst_format, AST_FORMAT_SLINEAR, 0);
+
+	ast_format_set(&slin8_to_slin16.src_format, AST_FORMAT_SLINEAR, 0);
+	ast_format_set(&slin8_to_slin16.dst_format, AST_FORMAT_SLINEAR16, 0);
+
 	res |= ast_register_translator(&slin16_to_slin8);
 	res |= ast_register_translator(&slin8_to_slin16);
 

Modified: team/dvossel/fixtheworld_phase1_step3/codecs/codec_speex.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/codecs/codec_speex.c?view=diff&rev=301788&r1=301787&r2=301788
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/codecs/codec_speex.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/codecs/codec_speex.c Fri Jan 14 10:27:03 2011
@@ -330,8 +330,6 @@
 
 static struct ast_translator speextolin = {
 	.name = "speextolin", 
-	.srcfmt = AST_FORMAT_SPEEX,
-	.dstfmt =  AST_FORMAT_SLINEAR,
 	.newpvt = speextolin_new,
 	.framein = speextolin_framein,
 	.destroy = speextolin_destroy,
@@ -344,8 +342,6 @@
 
 static struct ast_translator lintospeex = {
 	.name = "lintospeex", 
-	.srcfmt = AST_FORMAT_SLINEAR,
-	.dstfmt = AST_FORMAT_SPEEX,
 	.newpvt = lintospeex_new,
 	.framein = lintospeex_framein,
 	.frameout = lintospeex_frameout,
@@ -358,8 +354,6 @@
 
 static struct ast_translator speexwbtolin16 = {
 	.name = "speexwbtolin16", 
-	.srcfmt = AST_FORMAT_SPEEX16,
-	.dstfmt =  AST_FORMAT_SLINEAR16,
 	.newpvt = speexwbtolin16_new,
 	.framein = speextolin_framein,
 	.destroy = speextolin_destroy,
@@ -372,8 +366,6 @@
 
 static struct ast_translator lin16tospeexwb = {
 	.name = "lin16tospeexwb", 
-	.srcfmt = AST_FORMAT_SLINEAR16,
-	.dstfmt = AST_FORMAT_SPEEX16,
 	.newpvt = lin16tospeexwb_new,
 	.framein = lintospeex_framein,
 	.frameout = lintospeex_frameout,
@@ -505,6 +497,19 @@
 	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);
+
 	res |= ast_register_translator(&speextolin);
 	res |= ast_register_translator(&lintospeex);
 	res |= ast_register_translator(&speexwbtolin16);

Modified: team/dvossel/fixtheworld_phase1_step3/codecs/ex_adpcm.h
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/codecs/ex_adpcm.h?view=diff&rev=301788&r1=301787&r2=301788
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/codecs/ex_adpcm.h (original)
+++ team/dvossel/fixtheworld_phase1_step3/codecs/ex_adpcm.h Fri Jan 14 10:27:03 2011
@@ -19,7 +19,6 @@
 {
 	static struct ast_frame f = {
 		.frametype = AST_FRAME_VOICE,
-		.subclass.codec = AST_FORMAT_ADPCM,
 		.datalen = sizeof(ex_adpcm),
 		.samples = ARRAY_LEN(ex_adpcm) * 2,
 		.mallocd = 0,
@@ -27,6 +26,7 @@
 		.src = __PRETTY_FUNCTION__,
 		.data.ptr = ex_adpcm,
 	};
+	ast_format_set(&f.subclass.format, AST_FORMAT_ADPCM, 0);
 
 	return &f;
 }

Modified: team/dvossel/fixtheworld_phase1_step3/codecs/ex_g722.h
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/codecs/ex_g722.h?view=diff&rev=301788&r1=301787&r2=301788
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/codecs/ex_g722.h (original)
+++ team/dvossel/fixtheworld_phase1_step3/codecs/ex_g722.h Fri Jan 14 10:27:03 2011
@@ -34,7 +34,6 @@
 {
 	static struct ast_frame f = {
 		.frametype = AST_FRAME_VOICE,
-		.subclass.codec = AST_FORMAT_G722,
 		.datalen = sizeof(ex_g722),
 		.samples = ARRAY_LEN(ex_g722),
 		.mallocd = 0,
@@ -43,5 +42,7 @@
 		.data.ptr = ex_g722,
 	};
 
+	ast_format_set(&f.subclass.format, AST_FORMAT_G722, 0);
+
 	return &f;
 }

Modified: team/dvossel/fixtheworld_phase1_step3/codecs/ex_g726.h
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/codecs/ex_g726.h?view=diff&rev=301788&r1=301787&r2=301788
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/codecs/ex_g726.h (original)
+++ team/dvossel/fixtheworld_phase1_step3/codecs/ex_g726.h Fri Jan 14 10:27:03 2011
@@ -19,7 +19,6 @@
 {
 	static struct ast_frame f = {
 		.frametype = AST_FRAME_VOICE,
-		.subclass.codec = AST_FORMAT_G726,
 		.datalen = sizeof(ex_g726),
 		.samples = ARRAY_LEN(ex_g726) * 2, /* 2 samples per byte */
 		.mallocd = 0,
@@ -28,5 +27,7 @@
 		.data.ptr = ex_g726,
 	};
 
+	ast_format_set(&f.subclass.format, AST_FORMAT_G726, 0);
+
 	return &f;
 }

Modified: team/dvossel/fixtheworld_phase1_step3/codecs/ex_lpc10.h
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/codecs/ex_lpc10.h?view=diff&rev=301788&r1=301787&r2=301788
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/codecs/ex_lpc10.h (original)
+++ team/dvossel/fixtheworld_phase1_step3/codecs/ex_lpc10.h Fri Jan 14 10:27:03 2011
@@ -15,7 +15,6 @@
 {
 	static struct ast_frame f = {
 		.frametype = AST_FRAME_VOICE,
-		.subclass.codec = AST_FORMAT_LPC10,
 		.datalen = sizeof(ex_lpc10),
 		/* All frames are 22 ms long (maybe a little more -- why did he choose
 		   LPC10_SAMPLES_PER_FRAME sample frames anyway?? */
@@ -26,5 +25,7 @@
 		.data.ptr = ex_lpc10,
 	};
 
+	ast_format_set(&f.subclass.format, AST_FORMAT_LPC10, 0);
+
 	return &f;
 }

Modified: team/dvossel/fixtheworld_phase1_step3/codecs/ex_speex.h
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/codecs/ex_speex.h?view=diff&rev=301788&r1=301787&r2=301788
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/codecs/ex_speex.h (original)
+++ team/dvossel/fixtheworld_phase1_step3/codecs/ex_speex.h Fri Jan 14 10:27:03 2011
@@ -18,7 +18,6 @@
 {
 	static struct ast_frame f = {
 		.frametype = AST_FRAME_VOICE,
-		.subclass.codec = AST_FORMAT_SPEEX,
 		.datalen = sizeof(ex_speex),
 		/* All frames are 20 ms long */
 		.samples = SPEEX_SAMPLES,
@@ -27,6 +26,8 @@
 		.src = __PRETTY_FUNCTION__,
 		.data.ptr = ex_speex,
 	};
+
+	ast_format_set(&f.subclass.format, AST_FORMAT_SPEEX, 0);
 
 	return &f;
 }
@@ -49,7 +50,6 @@
 {
 	static struct ast_frame f = {
 		.frametype = AST_FRAME_VOICE,
-		.subclass.codec = AST_FORMAT_SPEEX16,
 		.datalen = sizeof(ex_speex16),
 		/* All frames are 20 ms long */
 		.samples = SPEEX_SAMPLES,
@@ -58,6 +58,7 @@
 		.src = __PRETTY_FUNCTION__,
 		.data.ptr = ex_speex16,
 	};
+	ast_format_set(&f.subclass.format, AST_FORMAT_SPEEX16, 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=301788&r1=301787&r2=301788
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/formats/format_g719.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/formats/format_g719.c Fri Jan 14 10:27:03 2011
@@ -41,7 +41,7 @@
 	/* Send a frame from the file to the appropriate channel */
 
 	s->fr.frametype = AST_FRAME_VOICE;
-	s->fr.subclass.codec = AST_FORMAT_G719;
+	ast_format_set(&s->fr.subclass.format, AST_FORMAT_G719, 0);
 	s->fr.mallocd = 0;
 	AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, BUF_SIZE);
 	if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) != s->fr.datalen) {
@@ -61,8 +61,8 @@
 		ast_log(LOG_WARNING, "Asked to write non-voice frame!\n");
 		return -1;
 	}
-	if (f->subclass.codec != AST_FORMAT_G719) {
-		ast_log(LOG_WARNING, "Asked to write non-G.719 frame (%s)!\n", ast_getformatname(f->subclass.codec));
+	if (f->subclass.format.id != AST_FORMAT_G719) {
+		ast_log(LOG_WARNING, "Asked to write non-G.719 frame (%s)!\n", ast_getformatname(&f->subclass.format));
 		return -1;
 	}
 	if ((res = fwrite(f->data.ptr, 1, f->datalen, fs->f)) != f->datalen) {
@@ -110,10 +110,9 @@
 	return BYTES_TO_SAMPLES(ftello(fs->f));
 }
 
-static const struct ast_format_def g719_f = {
+static struct ast_format_def g719_f = {
 	.name = "g719",
 	.exts = "g719",
-	.format = AST_FORMAT_G719,
 	.write = g719write,
 	.seek = g719seek,
 	.trunc = g719trunc,
@@ -124,9 +123,9 @@
 
 static int load_module(void)
 {
+	ast_format_set(&g719_f.format, AST_FORMAT_G719, 0);
 	if (ast_format_def_register(&g719_f))
 		return AST_MODULE_LOAD_DECLINE;
-
 	return AST_MODULE_LOAD_SUCCESS;
 }
 

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=301788&r1=301787&r2=301788
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/formats/format_g723.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/formats/format_g723.c Fri Jan 14 10:27:03 2011
@@ -61,7 +61,7 @@
 	}
 	/* Read the data into the buffer */
 	s->fr.frametype = AST_FRAME_VOICE;
-	s->fr.subclass.codec = AST_FORMAT_G723_1;
+	ast_format_set(&s->fr.subclass.format, AST_FORMAT_G723_1, 0);
 	s->fr.mallocd = 0;
 	AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, size);
 	if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) != size) {
@@ -82,7 +82,7 @@
 		ast_log(LOG_WARNING, "Asked to write non-voice frame!\n");
 		return -1;
 	}
-	if (f->subclass.codec != AST_FORMAT_G723_1) {
+	if (f->subclass.format.id != AST_FORMAT_G723_1) {
 		ast_log(LOG_WARNING, "Asked to write non-g723 frame!\n");
 		return -1;
 	}
@@ -125,10 +125,9 @@
 	return -1;
 }
 
-static const struct ast_format_def g723_1_f = {
+static struct ast_format_def g723_1_f = {
 	.name = "g723sf",
 	.exts = "g723|g723sf",
-	.format = AST_FORMAT_G723_1,
 	.write = g723_write,
 	.seek =	g723_seek,
 	.trunc = g723_trunc,
@@ -139,6 +138,8 @@
 
 static int load_module(void)
 {
+	ast_format_set(&g723_1_f.format, AST_FORMAT_G723_1, 0);
+
 	if (ast_format_def_register(&g723_1_f))
 		return AST_MODULE_LOAD_FAILURE;
 	return AST_MODULE_LOAD_SUCCESS;

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=301788&r1=301787&r2=301788
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/formats/format_g726.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/formats/format_g726.c Fri Jan 14 10:27:03 2011
@@ -119,7 +119,7 @@
 
 	/* Send a frame from the file to the appropriate channel */
 	s->fr.frametype = AST_FRAME_VOICE;
-	s->fr.subclass.codec = AST_FORMAT_G726;
+	ast_format_set(&s->fr.subclass.format, AST_FORMAT_G726, 0);
 	s->fr.mallocd = 0;
 	AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, frame_size[fs->rate]);
 	s->fr.samples = 8 * FRAME_TIME;
@@ -141,9 +141,9 @@
 		ast_log(LOG_WARNING, "Asked to write non-voice frame!\n");
 		return -1;
 	}
-	if (f->subclass.codec != AST_FORMAT_G726) {
+	if (f->subclass.format.id != AST_FORMAT_G726) {
 		ast_log(LOG_WARNING, "Asked to write non-G726 frame (%s)!\n", 
-						ast_getformatname(f->subclass.codec));
+						ast_getformatname(&f->subclass.format));
 		return -1;
 	}
 	if (f->datalen % frame_size[fs->rate]) {
@@ -174,11 +174,10 @@
 	return -1;
 }
 
-static const struct ast_format_def f[] = {
+static struct ast_format_def f[] = {
 	{
 		.name = "g726-40",
 		.exts = "g726-40",
-		.format = AST_FORMAT_G726,
 		.open = g726_40_open,
 		.rewrite = g726_40_rewrite,
 		.write = g726_write,
@@ -192,7 +191,6 @@
 	{
 		.name = "g726-32",
 		.exts = "g726-32",
-		.format = AST_FORMAT_G726,
 		.open = g726_32_open,
 		.rewrite = g726_32_rewrite,
 		.write = g726_write,
@@ -206,7 +204,6 @@
 	{
 		.name = "g726-24",
 		.exts = "g726-24",
-		.format = AST_FORMAT_G726,
 		.open = g726_24_open,
 		.rewrite = g726_24_rewrite,
 		.write = g726_write,
@@ -220,7 +217,6 @@
 	{
 		.name = "g726-16",
 		.exts = "g726-16",
-		.format = AST_FORMAT_G726,
 		.open = g726_16_open,
 		.rewrite = g726_16_rewrite,
 		.write = g726_write,
@@ -231,14 +227,15 @@
 		.buf_size = BUF_SIZE + AST_FRIENDLY_OFFSET,
 		.desc_size = sizeof(struct g726_desc),
 	},
-	{	.format = 0 }	/* terminator */
+	{	.desc_size = 0 }	/* terminator */
 };
 
 static int load_module(void)
 {
 	int i;
 
-	for (i = 0; f[i].format ; i++) {
+	for (i = 0; f[i].desc_size ; i++) {
+		ast_format_set(&f[i].format, AST_FORMAT_G726, 0);
 		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;
@@ -251,7 +248,7 @@
 {
 	int i;
 
-	for (i = 0; f[i].format ; i++) {
+	for (i = 0; f[i].desc_size ; i++) {
 		if (ast_format_def_unregister(f[i].name))
 			ast_log(LOG_WARNING, "Failed to unregister format %s.\n", f[i].name);
 	}

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=301788&r1=301787&r2=301788
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/formats/format_g729.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/formats/format_g729.c Fri Jan 14 10:27:03 2011
@@ -46,7 +46,7 @@
 	int res;
 	/* Send a frame from the file to the appropriate channel */
 	s->fr.frametype = AST_FRAME_VOICE;
-	s->fr.subclass.codec = AST_FORMAT_G729A;
+	ast_format_set(&s->fr.subclass.format, AST_FORMAT_G729A, 0);
 	s->fr.mallocd = 0;
 	s->fr.samples = G729A_SAMPLES;
 	AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, BUF_SIZE);
@@ -66,8 +66,8 @@
 		ast_log(LOG_WARNING, "Asked to write non-voice frame!\n");
 		return -1;
 	}
-	if (f->subclass.codec != AST_FORMAT_G729A) {
-		ast_log(LOG_WARNING, "Asked to write non-G729 frame (%s)!\n", ast_getformatname(f->subclass.codec));
+	if (f->subclass.format.id != AST_FORMAT_G729A) {
+		ast_log(LOG_WARNING, "Asked to write non-G729 frame (%s)!\n", ast_getformatname(&f->subclass.format));
 		return -1;
 	}
 	if (f->datalen % 10) {
@@ -121,10 +121,9 @@
 	return (offset/BUF_SIZE)*G729A_SAMPLES;
 }
 
-static const struct ast_format_def g729_f = {
+static struct ast_format_def g729_f = {
 	.name = "g729",
 	.exts = "g729",
-	.format = AST_FORMAT_G729A,
 	.write = g729_write,
 	.seek = g729_seek,
 	.trunc = g729_trunc,
@@ -135,6 +134,7 @@
 
 static int load_module(void)
 {
+	ast_format_set(&g729_f.format, AST_FORMAT_G729A, 0);
 	if (ast_format_def_register(&g729_f))
 		return AST_MODULE_LOAD_FAILURE;
 	return AST_MODULE_LOAD_SUCCESS;

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=301788&r1=301787&r2=301788
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/formats/format_h263.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/formats/format_h263.c Fri Jan 14 10:27:03 2011
@@ -64,7 +64,7 @@
 static struct ast_frame *h263_read(struct ast_filestream *s, int *whennext)
 {
 	int res;
-	format_t mark;
+	uint32_t mark;
 	unsigned short len;
 	unsigned int ts;
 	struct h263_desc *fs = (struct h263_desc *)s->_private;
@@ -80,7 +80,7 @@
 		return NULL;
 	}
 	s->fr.frametype = AST_FRAME_VIDEO;
-	s->fr.subclass.codec = AST_FORMAT_H263;
+	ast_format_set(&s->fr.subclass.format, AST_FORMAT_H263, 0);
 	s->fr.mallocd = 0;
 	AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, len);
 	if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) != s->fr.datalen) {
@@ -90,7 +90,9 @@
 	}
 	s->fr.samples = fs->lastts;	/* XXX what ? */
 	s->fr.datalen = len;
-	s->fr.subclass.codec |= mark;
+	if (mark) {
+		ast_format_set_rtp_mark(&s->fr.subclass.format);
+	}
 	s->fr.delivery.tv_sec = 0;
 	s->fr.delivery.tv_usec = 0;
 	if ((res = fread(&ts, 1, sizeof(ts), s->f)) == sizeof(ts)) {
@@ -106,18 +108,14 @@
 	int res;
 	unsigned int ts;
 	unsigned short len;
-	format_t subclass;
-	format_t mark=0;
+	uint32_t mark = 0;
 	if (f->frametype != AST_FRAME_VIDEO) {
 		ast_log(LOG_WARNING, "Asked to write non-video frame!\n");
 		return -1;
 	}
-	subclass = f->subclass.codec;
-	if (subclass & 0x1)
-		mark=0x8000;
-	subclass &= ~0x1;
-	if (subclass != AST_FORMAT_H263) {
-		ast_log(LOG_WARNING, "Asked to write non-h263 frame (%s)!\n", ast_getformatname(f->subclass.codec));
+	mark = ast_format_get_rtp_mark(&f->subclass.format) ? 0x8000 : 0;
+	if (f->subclass.format.id != AST_FORMAT_H263) {
+		ast_log(LOG_WARNING, "Asked to write non-h263 frame (%s)!\n", ast_getformatname(&f->subclass.format));
 		return -1;
 	}
 	ts = htonl(f->samples);
@@ -157,10 +155,9 @@
 	return offset;	/* XXX totally bogus, needs fixing */
 }
 
-static const struct ast_format_def h263_f = {
+static struct ast_format_def h263_f = {
 	.name = "h263",
 	.exts = "h263",
-	.format = AST_FORMAT_H263,
 	.open = h263_open,
 	.write = h263_write,
 	.seek = h263_seek,
@@ -173,6 +170,7 @@
 
 static int load_module(void)
 {
+	ast_format_set(&h263_f.format, AST_FORMAT_H263, 0);
 	if (ast_format_def_register(&h263_f))
 		return AST_MODULE_LOAD_FAILURE;
 	return AST_MODULE_LOAD_SUCCESS;

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=301788&r1=301787&r2=301788
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/formats/format_h264.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/formats/format_h264.c Fri Jan 14 10:27:03 2011
@@ -56,7 +56,7 @@
 static struct ast_frame *h264_read(struct ast_filestream *s, int *whennext)
 {
 	int res;
-	int mark=0;
+	int mark = 0;
 	unsigned short len;
 	unsigned int ts;
 	struct h264_desc *fs = (struct h264_desc *)s->_private;
@@ -72,7 +72,7 @@
 		len = BUF_SIZE;	/* XXX truncate */
 	}
 	s->fr.frametype = AST_FRAME_VIDEO;
-	s->fr.subclass.codec = AST_FORMAT_H264;
+	ast_format_set(&s->fr.subclass.format, AST_FORMAT_H264, 0);
 	s->fr.mallocd = 0;
 	AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, len);
 	if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) != s->fr.datalen) {
@@ -82,7 +82,9 @@
 	}
 	s->fr.samples = fs->lastts;
 	s->fr.datalen = len;
-	s->fr.subclass.codec |= mark;
+	if (mark) {
+		ast_format_set_rtp_mark(&s->fr.subclass.format);
+	}
 	s->fr.delivery.tv_sec = 0;
 	s->fr.delivery.tv_usec = 0;
 	if ((res = fread(&ts, 1, sizeof(ts), s->f)) == sizeof(ts)) {
@@ -104,9 +106,9 @@
 		ast_log(LOG_WARNING, "Asked to write non-video frame!\n");
 		return -1;
 	}
-	mark = (f->subclass.codec & 0x1) ? 0x8000 : 0;
-	if ((f->subclass.codec & ~0x1) != AST_FORMAT_H264) {
-		ast_log(LOG_WARNING, "Asked to write non-h264 frame (%s)!\n", ast_getformatname(f->subclass.codec));
+	mark = ast_format_get_rtp_mark(&f->subclass.format) ? 0x8000 : 0;
+	if (f->subclass.format.id != AST_FORMAT_H264) {
+		ast_log(LOG_WARNING, "Asked to write non-h264 frame (%s)!\n", ast_getformatname(&f->subclass.format));
 		return -1;
 	}
 	ts = htonl(f->samples);
@@ -146,10 +148,9 @@
 	return offset; /* XXX totally bogus, needs fixing */
 }
 
-static const struct ast_format_def h264_f = {
+static struct ast_format_def h264_f = {
 	.name = "h264",
 	.exts = "h264",
-	.format = AST_FORMAT_H264,
 	.open = h264_open,
 	.write = h264_write,
 	.seek = h264_seek,
@@ -162,6 +163,7 @@
 
 static int load_module(void)
 {
+	ast_format_set(&h264_f.format, AST_FORMAT_H264, 0);
 	if (ast_format_def_register(&h264_f))
 		return AST_MODULE_LOAD_FAILURE;
 	return AST_MODULE_LOAD_SUCCESS;

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=301788&r1=301787&r2=301788
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/formats/format_ilbc.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/formats/format_ilbc.c Fri Jan 14 10:27:03 2011
@@ -45,7 +45,7 @@
 	int res;
 	/* Send a frame from the file to the appropriate channel */
 	s->fr.frametype = AST_FRAME_VOICE;
-	s->fr.subclass.codec = AST_FORMAT_ILBC;
+	ast_format_set(&s->fr.subclass.format, AST_FORMAT_ILBC, 0);
 	s->fr.mallocd = 0;
 	AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, ILBC_BUF_SIZE);
 	if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) != s->fr.datalen) {
@@ -64,8 +64,8 @@
 		ast_log(LOG_WARNING, "Asked to write non-voice frame!\n");
 		return -1;
 	}
-	if (f->subclass.codec != AST_FORMAT_ILBC) {
-		ast_log(LOG_WARNING, "Asked to write non-iLBC frame (%s)!\n", ast_getformatname(f->subclass.codec));
+	if (f->subclass.format.id != AST_FORMAT_ILBC) {
+		ast_log(LOG_WARNING, "Asked to write non-iLBC frame (%s)!\n", ast_getformatname(&f->subclass.format));
 		return -1;
 	}
 	if (f->datalen % 50) {
@@ -119,10 +119,9 @@
 	return (offset/ILBC_BUF_SIZE)*ILBC_SAMPLES;
 }
 
-static const struct ast_format_def ilbc_f = {
+static struct ast_format_def ilbc_f = {
 	.name = "iLBC",
 	.exts = "ilbc",
-	.format = AST_FORMAT_ILBC,
 	.write = ilbc_write,
 	.seek = ilbc_seek,
 	.trunc = ilbc_trunc,
@@ -133,6 +132,7 @@
 
 static int load_module(void)
 {
+	ast_format_set(&ilbc_f.format, AST_FORMAT_ILBC, 0);
 	if (ast_format_def_register(&ilbc_f))
 		return AST_MODULE_LOAD_FAILURE;
 	return AST_MODULE_LOAD_SUCCESS;

Modified: team/dvossel/fixtheworld_phase1_step3/formats/format_jpeg.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/formats/format_jpeg.c?view=diff&rev=301788&r1=301787&r2=301788
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/formats/format_jpeg.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/formats/format_jpeg.c Fri Jan 14 10:27:03 2011
@@ -48,7 +48,7 @@
 	}
 	memset(&fr, 0, sizeof(fr));
 	fr.frametype = AST_FRAME_IMAGE;
-	fr.subclass.codec = AST_FORMAT_JPEG;
+	ast_format_set(&fr.subclass.format, AST_FORMAT_JPEG, 0);
 	fr.data.ptr = buf;
 	fr.src = "JPEG Read";
 	fr.datalen = len;
@@ -74,7 +74,7 @@
 		ast_log(LOG_WARNING, "Not an image\n");
 		return -1;
 	}
-	if (fr->subclass.codec != AST_FORMAT_JPEG) {
+	if (fr->subclass.format.id != AST_FORMAT_JPEG) {
 		ast_log(LOG_WARNING, "Not a jpeg image\n");
 		return -1;
 	}
@@ -92,7 +92,6 @@
 	.name = "jpg",
 	.desc = "JPEG (Joint Picture Experts Group)",
 	.exts = "jpg|jpeg",
-	.format = AST_FORMAT_JPEG,
 	.read_image = jpeg_read_image,
 	.identify = jpeg_identify,
 	.write_image = jpeg_write_image,
@@ -100,6 +99,7 @@
 
 static int load_module(void)
 {
+	ast_format_set(&jpeg_format.format, AST_FORMAT_JPEG, 0);
 	if (ast_image_register(&jpeg_format))
 		return AST_MODULE_LOAD_FAILURE;
 	return AST_MODULE_LOAD_SUCCESS;

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=301788&r1=301787&r2=301788
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/formats/format_ogg_vorbis.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/formats/format_ogg_vorbis.c Fri Jan 14 10:27:03 2011
@@ -291,9 +291,9 @@
 		ast_log(LOG_WARNING, "Asked to write non-voice frame!\n");
 		return -1;
 	}
-	if (f->subclass.codec != AST_FORMAT_SLINEAR) {
+	if (f->subclass.format.id != AST_FORMAT_SLINEAR) {
 		ast_log(LOG_WARNING, "Asked to write non-SLINEAR frame (%s)!\n",
-			ast_getformatname(f->subclass.codec));
+			ast_getformatname(&f->subclass.format));
 		return -1;
 	}
 	if (!f->datalen)
@@ -438,7 +438,7 @@
 	short *buf;	/* SLIN data buffer */
 
 	fs->fr.frametype = AST_FRAME_VOICE;
-	fs->fr.subclass.codec = AST_FORMAT_SLINEAR;
+	ast_format_set(&fs->fr.subclass.format, AST_FORMAT_SLINEAR, 0);
 	fs->fr.mallocd = 0;
 	AST_FRAME_SET_BUFFER(&fs->fr, fs->buf, AST_FRIENDLY_OFFSET, BUF_SIZE);
 	buf = (short *)(fs->fr.data.ptr);	/* SLIN data buffer */
@@ -528,10 +528,9 @@
 	return -1;
 }
 
-static const struct ast_format_def vorbis_f = {
+static struct ast_format_def vorbis_f = {
 	.name = "ogg_vorbis",
 	.exts = "ogg",
-	.format = AST_FORMAT_SLINEAR,
 	.open = ogg_vorbis_open,
 	.rewrite = ogg_vorbis_rewrite,
 	.write = ogg_vorbis_write,
@@ -546,6 +545,7 @@
 
 static int load_module(void)
 {
+	ast_format_set(&vorbis_f.format, AST_FORMAT_SLINEAR, 0);
 	if (ast_format_def_register(&vorbis_f))
 		return AST_MODULE_LOAD_FAILURE;
 	return AST_MODULE_LOAD_SUCCESS;

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=301788&r1=301787&r2=301788
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/formats/format_pcm.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/formats/format_pcm.c Fri Jan 14 10:27:03 2011
@@ -80,7 +80,7 @@
 	/* Send a frame from the file to the appropriate channel */
 
 	s->fr.frametype = AST_FRAME_VOICE;
-	s->fr.subclass.codec = s->fmt->format;
+	ast_format_copy(&s->fr.subclass.format, &s->fmt->format);
 	s->fr.mallocd = 0;
 	AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, BUF_SIZE);
 	if ((res = fread(s->fr.data.ptr, 1, s->fr.datalen, s->f)) < 1) {
@@ -89,7 +89,7 @@
 		return NULL;
 	}
 	s->fr.datalen = res;
-	if (s->fmt->format == AST_FORMAT_G722)
+	if (s->fmt->format.id == AST_FORMAT_G722)
 		*whennext = s->fr.samples = res * 2;
 	else
 		*whennext = s->fr.samples = res;
@@ -126,7 +126,7 @@
 	}
 	if (whence == SEEK_FORCECUR && offset > max) { /* extend the file */
 		size_t left = offset - max;
-		const char *src = (fs->fmt->format == AST_FORMAT_ALAW) ? alaw_silence : ulaw_silence;
+		const char *src = (fs->fmt->format.id == AST_FORMAT_ALAW) ? alaw_silence : ulaw_silence;
 
 		while (left) {
 			size_t written = fwrite(src, 1, (left > BUF_SIZE) ? BUF_SIZE : left, fs->f);
@@ -163,8 +163,8 @@
 		ast_log(LOG_WARNING, "Asked to write non-voice frame!\n");
 		return -1;
 	}
-	if (f->subclass.codec != fs->fmt->format) {
-		ast_log(LOG_WARNING, "Asked to write incompatible format frame (%s)!\n", ast_getformatname(f->subclass.codec));

[... 451 lines stripped ...]



More information about the asterisk-commits mailing list