[asterisk-commits] mvanbaak: branch mvanbaak/ast_frame_dataunion r117710 - in /team/mvanbaak/ast...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed May 21 18:16:40 CDT 2008


Author: mvanbaak
Date: Wed May 21 18:16:39 2008
New Revision: 117710

URL: http://svn.digium.com/view/asterisk?view=rev&rev=117710
Log:
00:48 <@      russellb> so ... even with the named union, you can't use initializers ?
00:48 <@      russellb> struct ast_frame f = { .data.ptr = NULL };
00:48 <@      russellb> ?
00:48 <       mvanbaak> russellb: hhmm, where is that
00:48 <       mvanbaak> I think I used that
00:49 <@      russellb> main/audiohook.c, for example
00:49 <@      russellb> -       .data = buf,
00:49 <@      russellb>         .datalen = sizeof(buf),
00:49 <@      russellb>         .samples = samples,
00:49 <@      russellb>     };
00:49 <@      russellb> +   frame.data.ptr = buf;
00:49 <       mvanbaak> ah
00:49 <@      russellb> aside from a few places where that was changed, it looks good
00:49 <       mvanbaak> that must be because of my earlier work on the anonymous union
00:50 <@      russellb> mvanbaak: yeah

Fixed that. Now I can use it in in an initializer.

Please have a look at this so I can commit it (or you can)
This looks better then current trunk anyways


Modified:
    team/mvanbaak/ast_frame_dataunion/codecs/codec_g722.c
    team/mvanbaak/ast_frame_dataunion/codecs/codec_g726.c
    team/mvanbaak/ast_frame_dataunion/codecs/codec_resample.c
    team/mvanbaak/ast_frame_dataunion/main/app.c
    team/mvanbaak/ast_frame_dataunion/main/audiohook.c
    team/mvanbaak/ast_frame_dataunion/main/channel.c

Modified: team/mvanbaak/ast_frame_dataunion/codecs/codec_g722.c
URL: http://svn.digium.com/view/asterisk/team/mvanbaak/ast_frame_dataunion/codecs/codec_g722.c?view=diff&rev=117710&r1=117709&r2=117710
==============================================================================
--- team/mvanbaak/ast_frame_dataunion/codecs/codec_g722.c (original)
+++ team/mvanbaak/ast_frame_dataunion/codecs/codec_g722.c Wed May 21 18:16:39 2008
@@ -140,8 +140,8 @@
 		.datalen = sizeof(g722_slin_ex),
 		.samples = sizeof(g722_slin_ex) * 2,
 		.src = __PRETTY_FUNCTION__,
+		.data.ptr = g722_slin_ex,
 	};
-	f.data.ptr = g722_slin_ex;
 
 	return &f;
 }
@@ -154,8 +154,8 @@
 		.datalen = sizeof(g722_slin_ex),
 		.samples = sizeof(g722_slin_ex) * 2,
 		.src = __PRETTY_FUNCTION__,
+		.data.ptr = g722_slin_ex,
 	};
-	f.data.ptr = g722_slin_ex;
 
 	return &f;
 }
@@ -168,8 +168,8 @@
 		.datalen = sizeof(slin_g722_ex),
 		.samples = sizeof(slin_g722_ex) / sizeof(slin_g722_ex[0]),
 		.src = __PRETTY_FUNCTION__,
+		.data.ptr = slin_g722_ex,
 	};
-	f.data.ptr = slin_g722_ex;
 
 	return &f;
 }
@@ -182,8 +182,8 @@
 		.datalen = sizeof(slin_g722_ex),
 		.samples = sizeof(slin_g722_ex) / sizeof(slin_g722_ex[0]),
 		.src = __PRETTY_FUNCTION__,
+		.data.ptr = slin_g722_ex,
 	};
-	f.data.ptr = slin_g722_ex;
 
 	return &f;
 }

Modified: team/mvanbaak/ast_frame_dataunion/codecs/codec_g726.c
URL: http://svn.digium.com/view/asterisk/team/mvanbaak/ast_frame_dataunion/codecs/codec_g726.c?view=diff&rev=117710&r1=117709&r2=117710
==============================================================================
--- team/mvanbaak/ast_frame_dataunion/codecs/codec_g726.c (original)
+++ team/mvanbaak/ast_frame_dataunion/codecs/codec_g726.c Wed May 21 18:16:39 2008
@@ -794,8 +794,8 @@
 		.datalen = sizeof(g726_slin_ex),
 		.samples = sizeof(g726_slin_ex) * 2,	/* 2 samples per byte */
 		.src = __PRETTY_FUNCTION__,
+		.data.ptr = g726_slin_ex,
 	};
-	f.data.ptr = g726_slin_ex;
 
 	return &f;
 }
@@ -808,8 +808,8 @@
 		.datalen = sizeof(slin_g726_ex),
 		.samples = sizeof(slin_g726_ex) / 2,	/* 1 sample per 2 bytes */
 		.src = __PRETTY_FUNCTION__,
+		.data.ptr = slin_g726_ex,
 	};
-	f.data.ptr = slin_g726_ex;
 
 	return &f;
 }

Modified: team/mvanbaak/ast_frame_dataunion/codecs/codec_resample.c
URL: http://svn.digium.com/view/asterisk/team/mvanbaak/ast_frame_dataunion/codecs/codec_resample.c?view=diff&rev=117710&r1=117709&r2=117710
==============================================================================
--- team/mvanbaak/ast_frame_dataunion/codecs/codec_resample.c (original)
+++ team/mvanbaak/ast_frame_dataunion/codecs/codec_resample.c Wed May 21 18:16:39 2008
@@ -168,8 +168,8 @@
 		.datalen = sizeof(slin16_slin8_ex),
 		.samples = sizeof(slin16_slin8_ex) / sizeof(slin16_slin8_ex[0]),
 		.src = __PRETTY_FUNCTION__,
+		.data.ptr = slin16_slin8_ex,
 	};
-	f.data.ptr = slin16_slin8_ex;
 
 	return &f;
 }
@@ -182,8 +182,8 @@
 		.datalen = sizeof(slin8_slin16_ex),
 		.samples = sizeof(slin8_slin16_ex) / sizeof(slin8_slin16_ex[0]),
 		.src = __PRETTY_FUNCTION__,
+		.data.ptr = slin8_slin16_ex,
 	};
-	f.data.ptr = slin8_slin16_ex;
 
 	return &f;
 }

Modified: team/mvanbaak/ast_frame_dataunion/main/app.c
URL: http://svn.digium.com/view/asterisk/team/mvanbaak/ast_frame_dataunion/main/app.c?view=diff&rev=117710&r1=117709&r2=117710
==============================================================================
--- team/mvanbaak/ast_frame_dataunion/main/app.c (original)
+++ team/mvanbaak/ast_frame_dataunion/main/app.c Wed May 21 18:16:39 2008
@@ -337,10 +337,10 @@
 	struct ast_frame f = {
 		.frametype = AST_FRAME_VOICE,
 		.subclass = AST_FORMAT_SLINEAR,
+		.data.ptr = buf + AST_FRIENDLY_OFFSET / 2,
 		.offset = AST_FRIENDLY_OFFSET,
 	};
 	int res;
-	f.data.ptr = buf + AST_FRIENDLY_OFFSET / 2;
 
 	len = samples * 2;
 	if (len > sizeof(buf) - AST_FRIENDLY_OFFSET) {

Modified: team/mvanbaak/ast_frame_dataunion/main/audiohook.c
URL: http://svn.digium.com/view/asterisk/team/mvanbaak/ast_frame_dataunion/main/audiohook.c?view=diff&rev=117710&r1=117709&r2=117710
==============================================================================
--- team/mvanbaak/ast_frame_dataunion/main/audiohook.c (original)
+++ team/mvanbaak/ast_frame_dataunion/main/audiohook.c Wed May 21 18:16:39 2008
@@ -158,10 +158,10 @@
 	struct ast_frame frame = {
 		.frametype = AST_FRAME_VOICE,
 		.subclass = AST_FORMAT_SLINEAR,
+		.data.ptr = buf,
 		.datalen = sizeof(buf),
 		.samples = samples,
 	};
-	frame.data.ptr = buf;
 
 	/* Ensure the factory is able to give us the samples we want */
 	if (samples > ast_slinfactory_available(factory))
@@ -185,10 +185,10 @@
 	struct ast_frame frame = {
 		.frametype = AST_FRAME_VOICE,
 		.subclass = AST_FORMAT_SLINEAR,
+		.data.ptr = NULL,
 		.datalen = sizeof(buf1),
 		.samples = samples,
 	};
-	frame.data.ptr = NULL;
 
 	/* Make sure both factories have the required samples */
 	usable_read = (ast_slinfactory_available(&audiohook->read_factory) >= samples ? 1 : 0);

Modified: team/mvanbaak/ast_frame_dataunion/main/channel.c
URL: http://svn.digium.com/view/asterisk/team/mvanbaak/ast_frame_dataunion/main/channel.c?view=diff&rev=117710&r1=117709&r2=117710
==============================================================================
--- team/mvanbaak/ast_frame_dataunion/main/channel.c (original)
+++ team/mvanbaak/ast_frame_dataunion/main/channel.c Wed May 21 18:16:39 2008
@@ -4885,10 +4885,10 @@
 	struct ast_frame frame = {
 		.frametype = AST_FRAME_VOICE,
 		.subclass = AST_FORMAT_SLINEAR,
+		.data.ptr = buf,
 		.samples = samples,
 		.datalen = sizeof(buf),
 	};
-	frame.data.ptr = buf;
 
 	memset(buf, 0, sizeof(buf));
 




More information about the asterisk-commits mailing list