[asterisk-commits] branch kpfleming/vldtmf r8955 - in
/team/kpfleming/vldtmf: ./ apps/ channels/...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Tue Jan 31 14:21:05 MST 2006
Author: kpfleming
Date: Mon Jan 30 19:08:11 2006
New Revision: 8955
URL: http://svn.digium.com/view/asterisk?rev=8955&view=rev
Log:
first round of changes to use linked list macros for lists of frames
use frame list for channel's deferred DTMF instead of string buffer
Modified:
team/kpfleming/vldtmf/apps/app_milliwatt.c
team/kpfleming/vldtmf/channel.c
team/kpfleming/vldtmf/channels/chan_zap.c
team/kpfleming/vldtmf/frame.c
team/kpfleming/vldtmf/include/asterisk/channel.h
team/kpfleming/vldtmf/include/asterisk/chanspy.h
team/kpfleming/vldtmf/include/asterisk/frame.h
team/kpfleming/vldtmf/udptl.c
Modified: team/kpfleming/vldtmf/apps/app_milliwatt.c
URL: http://svn.digium.com/view/asterisk/team/kpfleming/vldtmf/apps/app_milliwatt.c?rev=8955&r1=8954&r2=8955&view=diff
==============================================================================
--- team/kpfleming/vldtmf/apps/app_milliwatt.c (original)
+++ team/kpfleming/vldtmf/apps/app_milliwatt.c Mon Jan 30 19:08:11 2006
@@ -90,7 +90,7 @@
wf.src = "app_milliwatt";
wf.delivery.tv_sec = 0;
wf.delivery.tv_usec = 0;
- wf.prev = wf.next = NULL;
+ wf.next = NULL;
/* create a buffer containing the digital milliwatt pattern */
for(i = 0; i < len; i++)
{
Modified: team/kpfleming/vldtmf/channel.c
URL: http://svn.digium.com/view/asterisk/team/kpfleming/vldtmf/channel.c?rev=8955&r1=8954&r2=8955&view=diff
==============================================================================
--- team/kpfleming/vldtmf/channel.c (original)
+++ team/kpfleming/vldtmf/channel.c Mon Jan 30 19:08:11 2006
@@ -675,28 +675,27 @@
int ast_queue_frame(struct ast_channel *chan, struct ast_frame *fin)
{
struct ast_frame *f;
- struct ast_frame *prev, *cur;
+ struct ast_frame *cur;
int blah = 1;
int qlen = 0;
- /* Build us a copy and free the original one */
- f = ast_frdup(fin);
- if (!f) {
+ if (!(f = ast_frdup(fin))) {
ast_log(LOG_WARNING, "Unable to duplicate frame\n");
return -1;
}
+
ast_mutex_lock(&chan->lock);
- prev = NULL;
- for (cur = chan->readq; cur; cur = cur->next) {
+
+ AST_LIST_TRAVERSE(chan->readq, cur, next) {
if ((cur->frametype == AST_FRAME_CONTROL) && (cur->subclass == AST_CONTROL_HANGUP)) {
/* Don't bother actually queueing anything after a hangup */
ast_frfree(f);
ast_mutex_unlock(&chan->lock);
return 0;
}
- prev = cur;
qlen++;
}
+
/* Allow up to 96 voice frames outstanding, and up to 128 total frames */
if (((fin->frametype == AST_FRAME_VOICE) && (qlen > 96)) || (qlen > 128)) {
if (fin->frametype != AST_FRAME_VOICE) {
@@ -709,10 +708,9 @@
return 0;
}
}
- if (prev)
- prev->next = f;
- else
- chan->readq = f;
+
+ AST_LIST_INSERT_TAIL(chan->readq, f, next);
+
if (chan->alertpipe[1] > -1) {
if (write(chan->alertpipe[1], &blah, sizeof(blah)) != sizeof(blah))
ast_log(LOG_WARNING, "Unable to write to alert pipe on %s, frametype/subclass %d/%d (qlen = %d): %s!\n",
@@ -724,7 +722,9 @@
} else if (ast_test_flag(chan, AST_FLAG_BLOCKING)) {
pthread_kill(chan->blocker, SIGURG);
}
+
ast_mutex_unlock(&chan->lock);
+
return 0;
}
@@ -930,7 +930,7 @@
{
int fd;
struct ast_var_t *vardata;
- struct ast_frame *f, *fp;
+ struct ast_frame *f;
struct varshead *headp;
char name[AST_CHANNEL_NAME];
@@ -977,13 +977,9 @@
close(fd);
if ((fd = chan->timingfd) > -1)
close(fd);
- f = chan->readq;
- chan->readq = NULL;
- while(f) {
- fp = f;
- f = f->next;
- ast_frfree(fp);
- }
+
+ while ((f = AST_LIST_REMOVE_HEAD(chan->readq, next)))
+ ast_frfree(f);
/* loop over the variables list, freeing all data and deleting list items */
/* no need to lock the list, as the channel is already locked */
@@ -1083,14 +1079,11 @@
ast_mutex_lock(&spy->lock);
- for (f = spy->read_queue.head; f; f = spy->read_queue.head) {
- spy->read_queue.head = f->next;
+ while ((f = AST_LIST_REMOVE_HEAD(spy->read_queue.list, next)))
ast_frfree(f);
- }
- for (f = spy->write_queue.head; f; f = spy->write_queue.head) {
- spy->write_queue.head = f->next;
+
+ while ((f = AST_LIST_REMOVE_HEAD(spy->write_queue.list, next)))
ast_frfree(f);
- }
if (ast_test_flag(spy, CHANSPY_TRIGGER_MODE) != CHANSPY_TRIGGER_NONE)
ast_cond_destroy(&spy->trigger);
@@ -1172,7 +1165,6 @@
struct ast_channel_spy_queue *queue;
struct ast_channel_spy_queue *other_queue;
struct channel_spy_trans *trans;
- struct ast_frame *last;
trans = (dir == SPY_READ) ? &chan->spies->read_translator : &chan->spies->write_translator;
@@ -1202,11 +1194,7 @@
translated_frame = ast_translate(trans->path, f, 0);
}
- for (last = queue->head; last && last->next; last = last->next);
- if (last)
- last->next = ast_frdup(translated_frame);
- else
- queue->head = ast_frdup(translated_frame);
+ AST_LIST_INSERT_TAIL(queue->list, ast_frdup(translated_frame), next);
} else {
if (f->subclass != queue->format) {
ast_log(LOG_WARNING, "Spy '%s' on channel '%s' wants format '%s', but frame is '%s', dropping\n",
@@ -1216,11 +1204,7 @@
continue;
}
- for (last = queue->head; last && last->next; last = last->next);
- if (last)
- last->next = ast_frdup(f);
- else
- queue->head = ast_frdup(f);
+ AST_LIST_INSERT_TAIL(queue->list, ast_frdup(f), next);
}
queue->samples += f->samples;
@@ -1264,10 +1248,9 @@
ast_log(LOG_DEBUG, "Spy '%s' on channel '%s' %s queue too long, dropping frames\n",
spy->type, chan->name, (dir == SPY_READ) ? "read" : "write");
while (queue->samples > SPY_QUEUE_SAMPLE_LIMIT) {
- struct ast_frame *drop = queue->head;
+ struct ast_frame *drop = AST_LIST_REMOVE_HEAD(queue->list, next);
queue->samples -= drop->samples;
- queue->head = drop->next;
ast_frfree(drop);
}
} else {
@@ -1784,14 +1767,11 @@
}
prestate = chan->_state;
- if (!ast_test_flag(chan, AST_FLAG_DEFER_DTMF) && !ast_strlen_zero(chan->dtmfq)) {
+ if (!ast_test_flag(chan, AST_FLAG_DEFER_DTMF) && AST_LIST_FIRST(chan->dtmfq)) {
/* We have DTMF that has been deferred. Return it now */
- chan->dtmff.frametype = AST_FRAME_DTMF;
- chan->dtmff.subclass = chan->dtmfq[0];
- /* Drop first digit */
- memmove(chan->dtmfq, chan->dtmfq + 1, sizeof(chan->dtmfq) - 1);
+ f = AST_LIST_REMOVE_HEAD(chan->dtmfq, next);
ast_mutex_unlock(&chan->lock);
- return &chan->dtmff;
+ return f;
}
/* Read and ignore anything on the alertpipe, but read only
@@ -1799,6 +1779,7 @@
if (chan->alertpipe[0] > -1) {
read(chan->alertpipe[0], &blah, sizeof(blah));
}
+
#ifdef ZAPTEL_OPTIMIZATIONS
if (chan->timingfd > -1 && chan->fdno == AST_TIMING_FD && ast_test_flag(chan, AST_FLAG_EXCEPTION)) {
ast_clear_flag(chan, AST_FLAG_EXCEPTION);
@@ -1812,7 +1793,7 @@
#if 0
ast_log(LOG_NOTICE, "Oooh, there's a PING!\n");
#endif
- if (!chan->readq || !chan->readq->next) {
+ if (AST_LIST_FIRST(chan->readq) && AST_LIST_NEXT(AST_LIST_FIRST(chan->readq), next)) {
/* Acknowledge PONG unless we need it again */
#if 0
ast_log(LOG_NOTICE, "Sending a PONG!\n");
@@ -1856,10 +1837,8 @@
}
/* Check for pending read queue */
- if (chan->readq) {
- f = chan->readq;
- chan->readq = f->next;
- f->next = NULL;
+ if (AST_LIST_FIRST(chan->readq)) {
+ f = AST_LIST_REMOVE_HEAD(chan->readq, next);
/* Interpret hangup and return NULL */
if ((f->frametype == AST_FRAME_CONTROL) && (f->subclass == AST_CONTROL_HANGUP)) {
ast_frfree(f);
@@ -1886,11 +1865,13 @@
if (f) {
/* if the channel driver returned more than one frame, stuff the excess
- into the readq for the next ast_read call
+ into the readq for the next ast_read call (note that we can safely assume
+ that the readq is empty, because otherwise we would not have called into
+ the channel driver and f would be only a single frame)
*/
- if (f->next) {
- chan->readq = f->next;
- f->next = NULL;
+ if (AST_LIST_NEXT(f, next)) {
+ AST_LIST_HEAD_SET_NOLOCK(chan->readq, AST_LIST_NEXT(f, next));
+ AST_LIST_NEXT(f, next) = NULL;
}
switch (f->frametype) {
@@ -1905,21 +1886,45 @@
ast_cdr_answer(chan->cdr);
}
break;
- case AST_FRAME_DTMF:
- ast_log(LOG_DTMF, "DTMF '%c' received on %s\n", f->subclass, chan->name);
+ case AST_FRAME_DTMF_BEGIN:
if (ast_test_flag(chan, AST_FLAG_DEFER_DTMF)) {
- if (strlen(chan->dtmfq) < sizeof(chan->dtmfq) - 2)
- chan->dtmfq[strlen(chan->dtmfq)] = f->subclass;
- else
- ast_log(LOG_WARNING, "Dropping deferred DTMF digits on %s\n", chan->name);
+ AST_LIST_INSERT_TAIL(chan->dtmfq, ast_frdup(f), next);
f = &null_frame;
+ } else {
+ ast_log(LOG_DTMF, "DTMF begin '%c' received on %s\n", f->subclass, chan->name);
}
break;
- case AST_FRAME_DTMF_BEGIN:
- ast_log(LOG_DTMF, "DTMF begin '%c' received on %s\n", f->subclass, chan->name);
- break;
- case AST_FRAME_DTMF_END:
+ case AST_FRAME_DTMF_END: {
+ struct ast_frame *dtmf;
+
+ if (!(dtmf = ast_frdup(&null_frame))) {
+ ast_log(LOG_WARNING, "Unable to allocate frame!\n");
+ f = &null_frame;
+ break;
+ }
+
+ dtmf->frametype = AST_FRAME_DTMF;
+ dtmf->subclass = f->subclass;
+
+ if (ast_test_flag(chan, AST_FLAG_DEFER_DTMF)) {
+ AST_LIST_INSERT_TAIL(chan->dtmfq, dtmf, next);
+ AST_LIST_INSERT_TAIL(chan->dtmfq, ast_frdup(f), next);
+ f = &null_frame;
+ break;
+ }
+
ast_log(LOG_DTMF, "DTMF end '%c' received on %s\n", f->subclass, chan->name);
+ AST_LIST_INSERT_HEAD(chan->readq, f, next);
+ f = dtmf;
+ }
+ /* fallthrough */
+ case AST_FRAME_DTMF:
+ if (ast_test_flag(chan, AST_FLAG_DEFER_DTMF)) {
+ AST_LIST_INSERT_TAIL(chan->dtmfq, ast_frdup(f), next);
+ f = &null_frame;
+ } else {
+ ast_log(LOG_DTMF, "DTMF '%c' received on %s\n", f->subclass, chan->name);
+ }
break;
case AST_FRAME_VOICE:
if (dropaudio) {
@@ -2903,7 +2908,7 @@
int x,i;
int res=0;
int origstate;
- struct ast_frame *cur, *prev;
+ struct ast_frame *cur;
const struct ast_channel_tech *t;
void *t_pvt;
struct ast_callerid tmpcid;
@@ -2966,9 +2971,9 @@
clone->tech_pvt = t_pvt;
/* Swap the readq's */
- cur = original->readq;
- original->readq = clone->readq;
- clone->readq = cur;
+ cur = AST_LIST_FIRST(original->readq);
+ AST_LIST_HEAD_SET_NOLOCK(original->readq, AST_LIST_FIRST(clone->readq));
+ AST_LIST_HEAD_SET_NOLOCK(clone->readq, cur);
/* Swap the alertpipes */
for (i = 0; i < 2; i++) {
@@ -2987,23 +2992,22 @@
/* Save any pending frames on both sides. Start by counting
* how many we're going to need... */
- prev = NULL;
x = 0;
- for (cur = clone->readq; cur; cur = cur->next) {
- x++;
- prev = cur;
- }
+ if (original->alertpipe[1] > -1) {
+ AST_LIST_TRAVERSE(clone->readq, cur, next)
+ x++;
+ }
+
/* If we had any, prepend them to the ones already in the queue, and
* load up the alertpipe */
- if (prev) {
- prev->next = original->readq;
- original->readq = clone->readq;
- clone->readq = NULL;
- if (original->alertpipe[1] > -1) {
- for (i = 0; i < x; i++)
- write(original->alertpipe[1], &x, sizeof(x));
- }
- }
+ if (AST_LIST_FIRST(clone->readq)) {
+ AST_LIST_INSERT_TAIL(clone->readq, AST_LIST_FIRST(original->readq), next);
+ AST_LIST_HEAD_SET_NOLOCK(original->readq, AST_LIST_FIRST(clone->readq));
+ AST_LIST_HEAD_SET_NOLOCK(clone->readq, NULL);
+ for (i = 0; i < x; i++)
+ write(original->alertpipe[1], &x, sizeof(x));
+ }
+
clone->_softhangup = AST_SOFTHANGUP_DEV;
@@ -3876,9 +3880,7 @@
int bytestocopy;
while (samples) {
- f = queue->head;
-
- if (!f) {
+ if (!(f = AST_LIST_FIRST(queue->list))) {
ast_log(LOG_ERROR, "Ran out of frames before buffer filled!\n");
break;
}
@@ -3893,10 +3895,9 @@
f->datalen -= bytestocopy;
f->offset += bytestocopy;
queue->samples -= tocopy;
- if (!f->samples) {
- queue->head = f->next;
- ast_frfree(f);
- }
+
+ if (!f->samples)
+ ast_frfree(AST_LIST_REMOVE_HEAD(queue->list, next));
}
}
@@ -3926,21 +3927,21 @@
if (ast_test_flag(spy, CHANSPY_TRIGGER_FLUSH)) {
if (spy->read_queue.samples > spy->write_queue.samples) {
if (ast_test_flag(spy, CHANSPY_READ_VOLADJUST)) {
- for (result = spy->read_queue.head; result; result = result->next)
+ AST_LIST_TRAVERSE(spy->read_queue.list, result, next)
ast_frame_adjust_volume(result, spy->read_vol_adjustment);
}
- result = spy->read_queue.head;
- spy->read_queue.head = NULL;
+ result = AST_LIST_FIRST(spy->read_queue.list);
+ AST_LIST_HEAD_SET_NOLOCK(spy->read_queue.list, NULL);
spy->read_queue.samples = 0;
ast_clear_flag(spy, CHANSPY_TRIGGER_FLUSH);
return result;
} else {
if (ast_test_flag(spy, CHANSPY_WRITE_VOLADJUST)) {
- for (result = spy->write_queue.head; result; result = result->next)
+ AST_LIST_TRAVERSE(spy->write_queue.list, result, next)
ast_frame_adjust_volume(result, spy->write_vol_adjustment);
}
- result = spy->write_queue.head;
- spy->write_queue.head = NULL;
+ result = AST_LIST_FIRST(spy->write_queue.list);
+ AST_LIST_HEAD_SET_NOLOCK(spy->write_queue.list, NULL);
spy->write_queue.samples = 0;
ast_clear_flag(spy, CHANSPY_TRIGGER_FLUSH);
return result;
@@ -3951,15 +3952,10 @@
return NULL;
/* short-circuit if both head frames have exactly what we want */
- if ((spy->read_queue.head->samples == samples) &&
- (spy->write_queue.head->samples == samples)) {
- read_frame = spy->read_queue.head;
- spy->read_queue.head = read_frame->next;
- read_frame->next = NULL;
-
- write_frame = spy->write_queue.head;
- spy->write_queue.head = write_frame->next;
- write_frame->next = NULL;
+ if ((AST_LIST_FIRST(spy->read_queue.list)->samples == samples) &&
+ (AST_LIST_FIRST(spy->write_queue.list)->samples == samples)) {
+ read_frame = AST_LIST_REMOVE_HEAD(spy->read_queue.list, next);
+ write_frame = AST_LIST_REMOVE_HEAD(spy->write_queue.list, next);
spy->read_queue.samples -= samples;
spy->write_queue.samples -= samples;
@@ -3992,10 +3988,10 @@
} else {
if (need_dup) {
result = ast_frdup(read_frame);
- result->next = ast_frdup(write_frame);
+ AST_LIST_NEXT(result, next) = ast_frdup(write_frame);
} else {
result = read_frame;
- result->next = write_frame;
+ AST_LIST_NEXT(result, next) = write_frame;
}
}
Modified: team/kpfleming/vldtmf/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/team/kpfleming/vldtmf/channels/chan_zap.c?rev=8955&r1=8954&r2=8955&view=diff
==============================================================================
--- team/kpfleming/vldtmf/channels/chan_zap.c (original)
+++ team/kpfleming/vldtmf/channels/chan_zap.c Mon Jan 30 19:08:11 2006
@@ -3579,7 +3579,6 @@
pthread_t threadid;
pthread_attr_t attr;
struct ast_channel *chan;
- struct ast_frame dtmf_frame = { .frametype = AST_FRAME_DTMF };
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
@@ -3620,8 +3619,6 @@
*/
p->subs[index].f.frametype = AST_FRAME_DTMF_BEGIN;
p->subs[index].f.subclass = res & 0xff;
- dtmf_frame.subclass = res & 0xff;
- p->subs[index].f.next = ast_frdup(&dtmf_frame);
#ifdef ZAPATA_PRI
}
#endif
Modified: team/kpfleming/vldtmf/frame.c
URL: http://svn.digium.com/view/asterisk/team/kpfleming/vldtmf/frame.c?rev=8955&r1=8954&r2=8955&view=diff
==============================================================================
--- team/kpfleming/vldtmf/frame.c (original)
+++ team/kpfleming/vldtmf/frame.c Mon Jan 30 19:08:11 2006
@@ -379,8 +379,7 @@
strcpy((char *)out->src, f->src);
} else
out->src = NULL;
- out->prev = NULL;
- out->next = NULL;
+ AST_LIST_NEXT(out, next) = NULL;
memcpy(out->data, f->data, out->datalen);
return out;
}
@@ -1301,27 +1300,28 @@
return 0;
}
-struct ast_frame *ast_frame_enqueue(struct ast_frame *head, struct ast_frame *f, int maxlen, int dupe)
-{
- struct ast_frame *cur, *oldhead;
- int len=0;
+struct ast_frame_list *ast_frame_enqueue(struct ast_frame_list *list, struct ast_frame *f, int maxlen, int dupe)
+{
+ struct ast_frame *cur;
+ int len = 0;
+
+ if (!list)
+ return NULL;
+
if (f && dupe)
f = ast_frdup(f);
if (!f)
- return head;
-
- f->next = NULL;
- if (!head)
- return f;
- cur = head;
- while(cur->next) {
- cur = cur->next;
+ return list;
+
+ AST_LIST_TRAVERSE(list, cur, next)
len++;
- if (len >= maxlen) {
- oldhead = head;
- head = head->next;
- ast_frfree(oldhead);
- }
- }
- return head;
-}
+
+ while (len >= maxlen) {
+ ast_frfree(AST_LIST_REMOVE_HEAD(list, next));
+ len--;
+ }
+
+ AST_LIST_INSERT_TAIL(list, f, next);
+
+ return list;
+}
Modified: team/kpfleming/vldtmf/include/asterisk/channel.h
URL: http://svn.digium.com/view/asterisk/team/kpfleming/vldtmf/include/asterisk/channel.h?rev=8955&r1=8954&r2=8955&view=diff
==============================================================================
--- team/kpfleming/vldtmf/include/asterisk/channel.h (original)
+++ team/kpfleming/vldtmf/include/asterisk/channel.h Mon Jan 30 19:08:11 2006
@@ -363,8 +363,9 @@
char exten[AST_MAX_EXTENSION];
/* Current extension priority */
int priority;
- /*! Any/all queued DTMF characters */
- char dtmfq[AST_MAX_EXTENSION];
+ /*! Deferred DTMF frames */
+ struct ast_frame_list *dtmfq;
+
/*! DTMF frame */
struct ast_frame dtmff;
@@ -413,7 +414,8 @@
/*! ISDN Transfer Capbility - AST_FLAG_DIGITAL is not enough */
unsigned short transfercapability;
- struct ast_frame *readq;
+ struct ast_frame_list *readq;
+
int alertpipe[2];
/*! Write translation path */
struct ast_trans_pvt *writetrans;
Modified: team/kpfleming/vldtmf/include/asterisk/chanspy.h
URL: http://svn.digium.com/view/asterisk/team/kpfleming/vldtmf/include/asterisk/chanspy.h?rev=8955&r1=8954&r2=8955&view=diff
==============================================================================
--- team/kpfleming/vldtmf/include/asterisk/chanspy.h (original)
+++ team/kpfleming/vldtmf/include/asterisk/chanspy.h Mon Jan 30 19:08:11 2006
@@ -49,7 +49,7 @@
};
struct ast_channel_spy_queue {
- struct ast_frame *head;
+ struct ast_frame_list *list;
unsigned int samples;
unsigned int format;
};
Modified: team/kpfleming/vldtmf/include/asterisk/frame.h
URL: http://svn.digium.com/view/asterisk/team/kpfleming/vldtmf/include/asterisk/frame.h?rev=8955&r1=8954&r2=8955&view=diff
==============================================================================
--- team/kpfleming/vldtmf/include/asterisk/frame.h (original)
+++ team/kpfleming/vldtmf/include/asterisk/frame.h Mon Jan 30 19:08:11 2006
@@ -31,7 +31,9 @@
#include <sys/types.h>
#include <sys/time.h>
+
#include "asterisk/endian.h"
+#include "asterisk/linkedlists.h"
struct ast_codec_pref {
char order[32];
@@ -105,11 +107,10 @@
void *data;
/*! Global delivery time */
struct timeval delivery;
- /*! Next/Prev for linking stand alone frames */
- struct ast_frame *prev;
- /*! Next/Prev for linking stand alone frames */
- struct ast_frame *next;
+ AST_LIST_ENTRY(ast_frame) next;
};
+
+AST_LIST_HEAD_NOLOCK(ast_frame_list, ast_frame);
#define AST_FRIENDLY_OFFSET 64 /*! It's polite for a a new frame to
have this number of bytes for additional
@@ -391,7 +392,7 @@
* \param format id of format
* \return A static string containing the name of the format or "UNKN" if unknown.
*/
-extern char* ast_getformatname(int format);
+char* ast_getformatname(int format);
/*! \brief Get the names of a set of formats
* \param buf a buffer for the output string
@@ -401,33 +402,33 @@
* ex: for format=AST_FORMAT_GSM|AST_FORMAT_SPEEX|AST_FORMAT_ILBC it will return "0x602 (GSM|SPEEX|ILBC)"
* \return The return value is buf.
*/
-extern char* ast_getformatname_multiple(char *buf, size_t size, int format);
+char* ast_getformatname_multiple(char *buf, size_t size, int format);
/*!
* \brief Gets a format from a name.
* \param name string of format
* \return This returns the form of the format in binary on success, 0 on error.
*/
-extern int ast_getformatbyname(const char *name);
+int ast_getformatbyname(const char *name);
/*! \brief Get a name from a format
* Gets a name from a format
* \param codec codec number (1,2,4,8,16,etc.)
* \return This returns a static string identifying the format on success, 0 on error.
*/
-extern char *ast_codec2str(int codec);
+char *ast_codec2str(int codec);
struct ast_smoother;
-extern struct ast_format_list *ast_get_format_list_index(int index);
-extern struct ast_format_list *ast_get_format_list(size_t *size);
-extern struct ast_smoother *ast_smoother_new(int bytes);
-extern void ast_smoother_set_flags(struct ast_smoother *smoother, int flags);
-extern int ast_smoother_get_flags(struct ast_smoother *smoother);
-extern void ast_smoother_free(struct ast_smoother *s);
-extern void ast_smoother_reset(struct ast_smoother *s, int bytes);
-extern int __ast_smoother_feed(struct ast_smoother *s, struct ast_frame *f, int swap);
-extern struct ast_frame *ast_smoother_read(struct ast_smoother *s);
+struct ast_format_list *ast_get_format_list_index(int index);
+struct ast_format_list *ast_get_format_list(size_t *size);
+struct ast_smoother *ast_smoother_new(int bytes);
+void ast_smoother_set_flags(struct ast_smoother *smoother, int flags);
+int ast_smoother_get_flags(struct ast_smoother *smoother);
+void ast_smoother_free(struct ast_smoother *s);
+void ast_smoother_reset(struct ast_smoother *s, int bytes);
+int __ast_smoother_feed(struct ast_smoother *s, struct ast_frame *f, int swap);
+struct ast_frame *ast_smoother_read(struct ast_smoother *s);
#define ast_smoother_feed(s,f) __ast_smoother_feed(s, f, 0)
#if __BYTE_ORDER == __LITTLE_ENDIAN
#define ast_smoother_feed_be(s,f) __ast_smoother_feed(s, f, 1)
@@ -437,42 +438,42 @@
#define ast_smoother_feed_le(s,f) __ast_smoother_feed(s, f, 1)
#endif
-extern void ast_frame_dump(char *name, struct ast_frame *f, char *prefix);
+void ast_frame_dump(char *name, struct ast_frame *f, char *prefix);
/*! \brief Initialize a codec preference to "no preference" */
-extern void ast_codec_pref_init(struct ast_codec_pref *pref);
+void ast_codec_pref_init(struct ast_codec_pref *pref);
/*! \brief Codec located at a particular place in the preference index */
-extern int ast_codec_pref_index(struct ast_codec_pref *pref, int index);
+int ast_codec_pref_index(struct ast_codec_pref *pref, int index);
/*! \brief Remove a codec from a preference list */
-extern void ast_codec_pref_remove(struct ast_codec_pref *pref, int format);
+void ast_codec_pref_remove(struct ast_codec_pref *pref, int format);
/*! \brief Append a codec to a preference list, removing it first if it was already there */
-extern int ast_codec_pref_append(struct ast_codec_pref *pref, int format);
+int ast_codec_pref_append(struct ast_codec_pref *pref, int format);
/*! \brief Select the best format according to preference list from supplied options.
If "find_best" is non-zero then if nothing is found, the "Best" format of
the format list is selected, otherwise 0 is returned. */
-extern int ast_codec_choose(struct ast_codec_pref *pref, int formats, int find_best);
+int ast_codec_choose(struct ast_codec_pref *pref, int formats, int find_best);
/*! \brief Parse an "allow" or "deny" line and update the mask and pref if provided */
-extern void ast_parse_allow_disallow(struct ast_codec_pref *pref, int *mask, const char *list, int allowing);
+void ast_parse_allow_disallow(struct ast_codec_pref *pref, int *mask, const char *list, int allowing);
/*! \brief Dump codec preference list into a string */
-extern int ast_codec_pref_string(struct ast_codec_pref *pref, char *buf, size_t size);
+int ast_codec_pref_string(struct ast_codec_pref *pref, char *buf, size_t size);
/*! \brief Shift a codec preference list up or down 65 bytes so that it becomes an ASCII string */
-extern void ast_codec_pref_convert(struct ast_codec_pref *pref, char *buf, size_t size, int right);
+void ast_codec_pref_convert(struct ast_codec_pref *pref, char *buf, size_t size, int right);
/*! \brief Returns the number of samples contained in the frame */
-extern int ast_codec_get_samples(struct ast_frame *f);
+int ast_codec_get_samples(struct ast_frame *f);
/*! \brief Returns the number of bytes for the number of samples of the given format */
-extern int ast_codec_get_len(int format, int samples);
+int ast_codec_get_len(int format, int samples);
/*! \brief Appends a frame to the end of a list of frames, truncating the maximum length of the list */
-extern struct ast_frame *ast_frame_enqueue(struct ast_frame *head, struct ast_frame *f, int maxlen, int dupe);
+struct ast_frame_list *ast_frame_enqueue(struct ast_frame_list *list, struct ast_frame *f, int maxlen, int dupe);
/*! \brief Gets duration in ms of interpolation frame for a format */
Modified: team/kpfleming/vldtmf/udptl.c
URL: http://svn.digium.com/view/asterisk/team/kpfleming/vldtmf/udptl.c?rev=8955&r1=8954&r2=8955&view=diff
==============================================================================
--- team/kpfleming/vldtmf/udptl.c (original)
+++ team/kpfleming/vldtmf/udptl.c Mon Jan 30 19:08:11 2006
@@ -295,7 +295,6 @@
ptr = 0;
ifp_no = 0;
- s->f[0].prev = NULL;
s->f[0].next = NULL;
/* Decode seq_number */
@@ -342,7 +341,6 @@
s->f[ifp_no].offset = 0;
s->f[ifp_no].src = "UDPTL";
if (ifp_no > 0) {
- s->f[ifp_no].prev = &s->f[ifp_no - 1];
s->f[ifp_no - 1].next = &s->f[ifp_no];
}
s->f[ifp_no].next = NULL;
@@ -364,7 +362,6 @@
s->f[ifp_no].offset = 0;
s->f[ifp_no].src = "UDPTL";
if (ifp_no > 0) {
- s->f[ifp_no].prev = &s->f[ifp_no - 1];
s->f[ifp_no - 1].next = &s->f[ifp_no];
}
s->f[ifp_no].next = NULL;
@@ -465,7 +462,6 @@
s->f[ifp_no].offset = 0;
s->f[ifp_no].src = "UDPTL";
if (ifp_no > 0) {
- s->f[ifp_no].prev = &s->f[ifp_no - 1];
s->f[ifp_no - 1].next = &s->f[ifp_no];
}
s->f[ifp_no].next = NULL;
@@ -483,7 +479,6 @@
s->f[ifp_no].offset = 0;
s->f[ifp_no].src = "UDPTL";
if (ifp_no > 0) {
- s->f[ifp_no].prev = &s->f[ifp_no - 1];
s->f[ifp_no - 1].next = &s->f[ifp_no];
}
s->f[ifp_no].next = NULL;
More information about the asterisk-commits
mailing list