[asterisk-commits] trunk r18639 - in /trunk: formats/ include/asterisk/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Sun Apr 9 15:31:44 MST 2006


Author: rizzo
Date: Sun Apr  9 17:31:38 2006
New Revision: 18639

URL: http://svn.digium.com/view/asterisk?rev=18639&view=rev
Log:
rename FR_SET_BUF to AST_FRAME_SET_BUFFER


Modified:
    trunk/formats/format_g723.c
    trunk/formats/format_g726.c
    trunk/formats/format_g729.c
    trunk/formats/format_gsm.c
    trunk/formats/format_h263.c
    trunk/formats/format_h264.c
    trunk/formats/format_ilbc.c
    trunk/formats/format_ogg_vorbis.c
    trunk/formats/format_pcm.c
    trunk/formats/format_sln.c
    trunk/formats/format_vox.c
    trunk/formats/format_wav.c
    trunk/formats/format_wav_gsm.c
    trunk/include/asterisk/frame.h

Modified: trunk/formats/format_g723.c
URL: http://svn.digium.com/view/asterisk/trunk/formats/format_g723.c?rev=18639&r1=18638&r2=18639&view=diff
==============================================================================
--- trunk/formats/format_g723.c (original)
+++ trunk/formats/format_g723.c Sun Apr  9 17:31:38 2006
@@ -76,7 +76,7 @@
 	s->fr.frametype = AST_FRAME_VOICE;
 	s->fr.subclass = AST_FORMAT_G723_1;
 	s->fr.mallocd = 0;
-	FR_SET_BUF(&s->fr, s->buf, AST_FRIENDLY_OFFSET, size);
+	AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, size);
 	if ((res = fread(s->fr.data, 1, s->fr.datalen, s->f)) != size) {
 		ast_log(LOG_WARNING, "Short read (%d of %d bytes) (%s)!\n", res, size, strerror(errno));
 		return NULL;

Modified: trunk/formats/format_g726.c
URL: http://svn.digium.com/view/asterisk/trunk/formats/format_g726.c?rev=18639&r1=18638&r2=18639&view=diff
==============================================================================
--- trunk/formats/format_g726.c (original)
+++ trunk/formats/format_g726.c Sun Apr  9 17:31:38 2006
@@ -137,7 +137,7 @@
 	s->fr.frametype = AST_FRAME_VOICE;
 	s->fr.subclass = AST_FORMAT_G726;
 	s->fr.mallocd = 0;
-	FR_SET_BUF(&s->fr, s->buf, AST_FRIENDLY_OFFSET, frame_size[fs->rate]);
+	AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, frame_size[fs->rate]);
 	s->fr.samples = 8 * FRAME_TIME;
 	if ((res = fread(s->fr.data, 1, s->fr.datalen, s->f)) != s->fr.datalen) {
 		if (res)

Modified: trunk/formats/format_g729.c
URL: http://svn.digium.com/view/asterisk/trunk/formats/format_g729.c?rev=18639&r1=18638&r2=18639&view=diff
==============================================================================
--- trunk/formats/format_g729.c (original)
+++ trunk/formats/format_g729.c Sun Apr  9 17:31:38 2006
@@ -62,7 +62,7 @@
 	s->fr.subclass = AST_FORMAT_G729A;
 	s->fr.mallocd = 0;
 	s->fr.samples = G729A_SAMPLES;
-	FR_SET_BUF(&s->fr, s->buf, AST_FRIENDLY_OFFSET, BUF_SIZE);
+	AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, BUF_SIZE);
 	if ((res = fread(s->fr.data, 1, s->fr.datalen, s->f)) != s->fr.datalen) {
 		if (res && (res != 10))	/* XXX what for ? */
 			ast_log(LOG_WARNING, "Short read (%d) (%s)!\n", res, strerror(errno));

Modified: trunk/formats/format_gsm.c
URL: http://svn.digium.com/view/asterisk/trunk/formats/format_gsm.c?rev=18639&r1=18638&r2=18639&view=diff
==============================================================================
--- trunk/formats/format_gsm.c (original)
+++ trunk/formats/format_gsm.c Sun Apr  9 17:31:38 2006
@@ -67,7 +67,7 @@
 
 	s->fr.frametype = AST_FRAME_VOICE;
 	s->fr.subclass = AST_FORMAT_GSM;
-	FR_SET_BUF(&(s->fr), s->buf, AST_FRIENDLY_OFFSET, GSM_FRAME_SIZE)
+	AST_FRAME_SET_BUFFER(&(s->fr), s->buf, AST_FRIENDLY_OFFSET, GSM_FRAME_SIZE)
 	s->fr.mallocd = 0;
 	if ((res = fread(s->fr.data, 1, GSM_FRAME_SIZE, s->f)) != GSM_FRAME_SIZE) {
 		if (res)

Modified: trunk/formats/format_h263.c
URL: http://svn.digium.com/view/asterisk/trunk/formats/format_h263.c?rev=18639&r1=18638&r2=18639&view=diff
==============================================================================
--- trunk/formats/format_h263.c (original)
+++ trunk/formats/format_h263.c Sun Apr  9 17:31:38 2006
@@ -88,7 +88,7 @@
 	s->fr.frametype = AST_FRAME_VIDEO;
 	s->fr.subclass = AST_FORMAT_H263;
 	s->fr.mallocd = 0;
-	FR_SET_BUF(&s->fr, s->buf, AST_FRIENDLY_OFFSET, len);
+	AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, len);
 	if ((res = fread(s->fr.data, 1, s->fr.datalen, s->f)) != s->fr.datalen) {
 		if (res)
 			ast_log(LOG_WARNING, "Short read (%d) (%s)!\n", res, strerror(errno));

Modified: trunk/formats/format_h264.c
URL: http://svn.digium.com/view/asterisk/trunk/formats/format_h264.c?rev=18639&r1=18638&r2=18639&view=diff
==============================================================================
--- trunk/formats/format_h264.c (original)
+++ trunk/formats/format_h264.c Sun Apr  9 17:31:38 2006
@@ -84,7 +84,7 @@
 	s->fr.frametype = AST_FRAME_VIDEO;
 	s->fr.subclass = AST_FORMAT_H264;
 	s->fr.mallocd = 0;
-	FR_SET_BUF(&s->fr, s->buf, AST_FRIENDLY_OFFSET, len);
+	AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, len);
 	if ((res = fread(s->fr.data, 1, s->fr.datalen, s->f)) != s->fr.datalen) {
 		if (res)
 			ast_log(LOG_WARNING, "Short read (%d of %d) (%s)!\n", res, len, strerror(errno));

Modified: trunk/formats/format_ilbc.c
URL: http://svn.digium.com/view/asterisk/trunk/formats/format_ilbc.c?rev=18639&r1=18638&r2=18639&view=diff
==============================================================================
--- trunk/formats/format_ilbc.c (original)
+++ trunk/formats/format_ilbc.c Sun Apr  9 17:31:38 2006
@@ -60,7 +60,7 @@
 	s->fr.frametype = AST_FRAME_VOICE;
 	s->fr.subclass = AST_FORMAT_ILBC;
 	s->fr.mallocd = 0;
-	FR_SET_BUF(&s->fr, s->buf, AST_FRIENDLY_OFFSET, ILBC_BUF_SIZE);
+	AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, ILBC_BUF_SIZE);
 	if ((res = fread(s->fr.data, 1, s->fr.datalen, s->f)) != s->fr.datalen) {
 		if (res)
 			ast_log(LOG_WARNING, "Short read (%d) (%s)!\n", res, strerror(errno));

Modified: trunk/formats/format_ogg_vorbis.c
URL: http://svn.digium.com/view/asterisk/trunk/formats/format_ogg_vorbis.c?rev=18639&r1=18638&r2=18639&view=diff
==============================================================================
--- trunk/formats/format_ogg_vorbis.c (original)
+++ trunk/formats/format_ogg_vorbis.c Sun Apr  9 17:31:38 2006
@@ -436,7 +436,7 @@
 	fs->fr.frametype = AST_FRAME_VOICE;
 	fs->fr.subclass = AST_FORMAT_SLINEAR;
 	fs->fr.mallocd = 0;
-	FR_SET_BUF(&fs->fr, fs->buf, AST_FRIENDLY_OFFSET, BUF_SIZE);
+	AST_FRAME_SET_BUFFER(&fs->fr, fs->buf, AST_FRIENDLY_OFFSET, BUF_SIZE);
 
 	while (samples_out != SAMPLES_MAX) {
 		float **pcm;

Modified: trunk/formats/format_pcm.c
URL: http://svn.digium.com/view/asterisk/trunk/formats/format_pcm.c?rev=18639&r1=18638&r2=18639&view=diff
==============================================================================
--- trunk/formats/format_pcm.c (original)
+++ trunk/formats/format_pcm.c Sun Apr  9 17:31:38 2006
@@ -95,7 +95,7 @@
 	s->fr.frametype = AST_FRAME_VOICE;
 	s->fr.subclass = s->fmt->format;
 	s->fr.mallocd = 0;
-	FR_SET_BUF(&s->fr, s->buf, AST_FRIENDLY_OFFSET, BUF_SIZE);
+	AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, BUF_SIZE);
 	if ((res = fread(s->fr.data, 1, s->fr.datalen, s->f)) < 1) {
 		if (res)
 			ast_log(LOG_WARNING, "Short read (%d) (%s)!\n", res, strerror(errno));

Modified: trunk/formats/format_sln.c
URL: http://svn.digium.com/view/asterisk/trunk/formats/format_sln.c?rev=18639&r1=18638&r2=18639&view=diff
==============================================================================
--- trunk/formats/format_sln.c (original)
+++ trunk/formats/format_sln.c Sun Apr  9 17:31:38 2006
@@ -54,7 +54,7 @@
 	s->fr.frametype = AST_FRAME_VOICE;
 	s->fr.subclass = AST_FORMAT_SLINEAR;
 	s->fr.mallocd = 0;
-	FR_SET_BUF(&s->fr, s->buf, AST_FRIENDLY_OFFSET, BUF_SIZE);
+	AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, BUF_SIZE);
 	if ((res = fread(s->fr.data, 1, s->fr.datalen, s->f)) < 1) {
 		if (res)
 			ast_log(LOG_WARNING, "Short read (%d) (%s)!\n", res, strerror(errno));

Modified: trunk/formats/format_vox.c
URL: http://svn.digium.com/view/asterisk/trunk/formats/format_vox.c?rev=18639&r1=18638&r2=18639&view=diff
==============================================================================
--- trunk/formats/format_vox.c (original)
+++ trunk/formats/format_vox.c Sun Apr  9 17:31:38 2006
@@ -56,7 +56,7 @@
 	s->fr.frametype = AST_FRAME_VOICE;
 	s->fr.subclass = AST_FORMAT_ADPCM;
 	s->fr.mallocd = 0;
-	FR_SET_BUF(&s->fr, s->buf, AST_FRIENDLY_OFFSET, BUF_SIZE);
+	AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, BUF_SIZE);
 	if ((res = fread(s->fr.data, 1, s->fr.datalen, s->f)) < 1) {
 		if (res)
 			ast_log(LOG_WARNING, "Short read (%d) (%s)!\n", res, strerror(errno));

Modified: trunk/formats/format_wav.c
URL: http://svn.digium.com/view/asterisk/trunk/formats/format_wav.c?rev=18639&r1=18638&r2=18639&view=diff
==============================================================================
--- trunk/formats/format_wav.c (original)
+++ trunk/formats/format_wav.c Sun Apr  9 17:31:38 2006
@@ -369,7 +369,7 @@
 	s->fr.frametype = AST_FRAME_VOICE;
 	s->fr.subclass = AST_FORMAT_SLINEAR;
 	s->fr.mallocd = 0;
-	FR_SET_BUF(&s->fr, s->buf, AST_FRIENDLY_OFFSET, bytes);
+	AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, bytes);
 	
 	if ( (res = fread(s->fr.data, 1, s->fr.datalen, s->f)) <= 0 ) {
 		if (res)

Modified: trunk/formats/format_wav_gsm.c
URL: http://svn.digium.com/view/asterisk/trunk/formats/format_wav_gsm.c?rev=18639&r1=18638&r2=18639&view=diff
==============================================================================
--- trunk/formats/format_wav_gsm.c (original)
+++ trunk/formats/format_wav_gsm.c Sun Apr  9 17:31:38 2006
@@ -379,7 +379,7 @@
 	s->fr.offset = AST_FRIENDLY_OFFSET;
 	s->fr.samples = GSM_SAMPLES;
 	s->fr.mallocd = 0;
-	FR_SET_BUF(&s->fr, s->buf, AST_FRIENDLY_OFFSET, GSM_FRAME_SIZE);
+	AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, GSM_FRAME_SIZE);
 	if (fs->secondhalf) {
 		/* Just return a frame based on the second GSM frame */
 		s->fr.data = (char *)s->fr.data + GSM_FRAME_SIZE;

Modified: trunk/include/asterisk/frame.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/frame.h?rev=18639&r1=18638&r2=18639&view=diff
==============================================================================
--- trunk/include/asterisk/frame.h (original)
+++ trunk/include/asterisk/frame.h Sun Apr  9 17:31:38 2006
@@ -111,7 +111,15 @@
 	struct ast_frame *next;			
 };
 
-#define	FR_SET_BUF(fr, _base, _ofs, _datalen)	\
+/*!
+ * Set the various field of a frame to point to a buffer.
+ * Typically you set the base address of the buffer, the offset as
+ * AST_FRIENDLY_OFFSET, and the datalen as the amount of bytes queued.
+ * The remaining things (to be done manually) is set the number of
+ * samples, which cannot be derived from the datalen unless you know
+ * the number of bits per sample.
+ */
+#define	AST_FRAME_SET_BUFFER(fr, _base, _ofs, _datalen)	\
 	{					\
 	(fr)->data = (char *)_base + (_ofs);	\
 	(fr)->offset = (_ofs);			\



More information about the asterisk-commits mailing list