aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>1999-12-11 20:09:45 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>1999-12-11 20:09:45 +0000
commit201849f9224ef840d3701ae6e92f3b71ab63f47b (patch)
treebb6f591206d4f084be79aa7a13122fde495ccbed
parent721ff08a5ddc15f8b7605a34005aabaf9034155e (diff)
Version 0.1.1 from FTP
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@134 f38db490-d61c-443f-a65b-d21fe96a405b
-rwxr-xr-xREADME2
-rwxr-xr-xapps/Makefile2
-rwxr-xr-xapps/app_directory.c2
-rwxr-xr-xapps/app_intercom.c2
-rwxr-xr-xapps/app_mp3.c2
-rwxr-xr-xapps/app_playback.c2
-rwxr-xr-xapps/app_skel.c2
-rwxr-xr-xasterisk.h2
-rwxr-xr-xchannels/DialTone.h2
-rwxr-xr-xchannels/adtranvofr.h2
-rwxr-xr-xcodecs/codec_mp3_d.c323
-rwxr-xr-xcodecs/g723_slin_ex.h2
-rwxr-xr-xcodecs/gsm_slin_ex.h2
-rwxr-xr-xcodecs/mp3_slin_ex.h70
-rwxr-xr-xcodecs/mp3anal.h83
-rwxr-xr-xcodecs/slin_g723_ex.h2
-rwxr-xr-xcodecs/slin_gsm_ex.h2
-rwxr-xr-xconfig.c26
-rwxr-xr-xfile.c6
-rwxr-xr-xframe.c2
-rwxr-xr-xinclude/asterisk/config.h2
-rwxr-xr-xinclude/asterisk/file.h2
-rwxr-xr-xinclude/asterisk/frame.h2
-rwxr-xr-xinclude/asterisk/logger.h2
-rwxr-xr-xinclude/asterisk/module.h2
-rwxr-xr-xinclude/asterisk/options.h2
-rwxr-xr-xinclude/asterisk/pbx.h2
-rwxr-xr-xinclude/asterisk/say.h2
-rwxr-xr-xinclude/asterisk/sched.h2
-rwxr-xr-xinclude/asterisk/translate.h2
-rwxr-xr-xpbx/Makefile4
-rwxr-xr-xpbx/pbx_config.c4
-rwxr-xr-xpbx/pbx_gtkconsole.c2
-rwxr-xr-xpbx/pbx_kdeconsole.cc2
-rwxr-xr-xpbx/pbx_kdeconsole.h2
-rwxr-xr-xpbx/pbx_kdeconsole_main.cc2
-rwxr-xr-xsay.c2
-rwxr-xr-xsched.c2
38 files changed, 532 insertions, 46 deletions
diff --git a/README b/README
index c50c462a7..18b850e34 100755
--- a/README
+++ b/README
@@ -1,6 +1,6 @@
The Asterisk Open Source PBX
by Mark Spencer <markster@linux-support.net>
-Copyright (C) 1999, Linux Support Services, LLC and Adtran, Inc.
+Copyright (C) 1999, Mark Spencer
================================================================
* WHAT IS ASTERISK
Asterisk is an Open Source PBX and telephony toolkit. It is, in a
diff --git a/apps/Makefile b/apps/Makefile
index 06ab4efdc..773eb535f 100755
--- a/apps/Makefile
+++ b/apps/Makefile
@@ -3,7 +3,7 @@
#
# Makefile for PBX frontends (dynamically loaded)
#
-# Copyright (C) 1999, Adtran Inc. and Linux Support Services, LLC
+# Copyright (C) 1999, Mark Spencer
#
# Mark Spencer <markster@linux-support.net>
#
diff --git a/apps/app_directory.c b/apps/app_directory.c
index f7ec41487..285f1514b 100755
--- a/apps/app_directory.c
+++ b/apps/app_directory.c
@@ -3,7 +3,7 @@
*
* Provide a directory of extensions
*
- * Copyright (C) 1999, Adtran Inc. and Linux Support Services, LLC
+ * Copyright (C) 1999, Mark Spencer
*
* Mark Spencer <markster@linux-support.net>
*
diff --git a/apps/app_intercom.c b/apps/app_intercom.c
index cf078b70a..d7f253c80 100755
--- a/apps/app_intercom.c
+++ b/apps/app_intercom.c
@@ -3,7 +3,7 @@
*
* Use /dev/dsp as an intercom.
*
- * Copyright (C) 1999, Adtran Inc. and Linux Support Services, LLC
+ * Copyright (C) 1999, Mark Spencer
*
* Mark Spencer <markster@linux-support.net>
*
diff --git a/apps/app_mp3.c b/apps/app_mp3.c
index eb1a5d684..a7e53cff2 100755
--- a/apps/app_mp3.c
+++ b/apps/app_mp3.c
@@ -3,7 +3,7 @@
*
* Silly application to play an MP3 file -- uses mpg123
*
- * Copyright (C) 1999, Adtran Inc. and Linux Support Services, LLC
+ * Copyright (C) 1999, Mark Spencer
*
* Mark Spencer <markster@linux-support.net>
*
diff --git a/apps/app_playback.c b/apps/app_playback.c
index ef1b85c33..31ee06949 100755
--- a/apps/app_playback.c
+++ b/apps/app_playback.c
@@ -3,7 +3,7 @@
*
* Trivial application to playback a sound file
*
- * Copyright (C) 1999, Adtran Inc. and Linux Support Services, LLC
+ * Copyright (C) 1999, Mark Spencer
*
* Mark Spencer <markster@linux-support.net>
*
diff --git a/apps/app_skel.c b/apps/app_skel.c
index fd7594037..e766d1142 100755
--- a/apps/app_skel.c
+++ b/apps/app_skel.c
@@ -3,7 +3,7 @@
*
* Skeleton application
*
- * Copyright (C) 1999, Adtran Inc. and Linux Support Services, LLC
+ * Copyright (C) 1999, Mark Spencer
*
* Mark Spencer <markster@linux-support.net>
*
diff --git a/asterisk.h b/asterisk.h
index 8595827b2..f1c9fccda 100755
--- a/asterisk.h
+++ b/asterisk.h
@@ -3,7 +3,7 @@
*
* General Definitions for Asterisk top level program
*
- * Copyright (C) 1999, Adtran Inc. and Linux Support Services, LLC
+ * Copyright (C) 1999, Mark Spencer
*
* Mark Spencer <markster@linux-support.net>
*
diff --git a/channels/DialTone.h b/channels/DialTone.h
index 29ccf38db..098ed44d7 100755
--- a/channels/DialTone.h
+++ b/channels/DialTone.h
@@ -3,7 +3,7 @@
*
* Source: DialTone.ulaw
*
- * Copyright (C) 1999, Mark Spencer and Linux Support Services
+ * Copyright (C) 1999, Mark Spencer
*
* Distributed under the terms of the GNU General Public License
*
diff --git a/channels/adtranvofr.h b/channels/adtranvofr.h
index 090e08930..9a45402b8 100755
--- a/channels/adtranvofr.h
+++ b/channels/adtranvofr.h
@@ -3,7 +3,7 @@
*
* Implementation of Voice over Frame Relay, Adtran Style
*
- * Copyright (C) 1999, Adtran Inc. and Linux Support Services, LLC
+ * Copyright (C) 1999, Mark Spencer
*
* Mark Spencer <markster@linux-support.net>
*
diff --git a/codecs/codec_mp3_d.c b/codecs/codec_mp3_d.c
new file mode 100755
index 000000000..95e1fb51f
--- /dev/null
+++ b/codecs/codec_mp3_d.c
@@ -0,0 +1,323 @@
+/*
+ * Asterisk -- A telephony toolkit for Linux.
+ *
+ * MP3 Decoder
+ *
+ * The MP3 code is from freeamp, which in turn is from xingmp3's release
+ * which I can't seem to find anywhere
+ *
+ * Copyright (C) 1999, Mark Spencer
+ *
+ * Mark Spencer <markster@linux-support.net>
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License
+ */
+
+#include <asterisk/translate.h>
+#include <asterisk/module.h>
+#include <asterisk/logger.h>
+#include <pthread.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <netinet/in.h>
+#include <string.h>
+#include <stdio.h>
+
+#include "mp3/include/L3.h"
+#include "mp3/include/mhead.h"
+
+#include "mp3anal.h"
+
+/* Sample frame data */
+#include "mp3_slin_ex.h"
+
+#define MAX_OUT_FRAME 320
+
+#define MAX_FRAME_SIZE 1441
+#define MAX_OUTPUT_LEN 2304
+
+static pthread_mutex_t localuser_lock = PTHREAD_MUTEX_INITIALIZER;
+static int localusecnt=0;
+
+static char *tdesc = "MP3/PCM16 (signed linear) Translator (Decoder only)";
+
+struct ast_translator_pvt {
+ MPEG m;
+ MPEG_HEAD head;
+ DEC_INFO info;
+ struct ast_frame f;
+ /* Space to build offset */
+ char offset[AST_FRIENDLY_OFFSET];
+ /* Mini buffer */
+ char outbuf[MAX_OUT_FRAME];
+ /* Enough to store a full second */
+ short buf[32000];
+ /* Tail of signed linear stuff */
+ int tail;
+ /* Current bitrate */
+ int bitrate;
+ /* XXX What's forward? XXX */
+ int forward;
+ /* Have we called head info yet? */
+ int init;
+ int copy;
+};
+
+#define mp3_coder_pvt ast_translator_pvt
+
+static struct ast_translator_pvt *mp3_new()
+{
+ struct mp3_coder_pvt *tmp;
+ tmp = malloc(sizeof(struct mp3_coder_pvt));
+ if (tmp) {
+ tmp->init = 0;
+ tmp->tail = 0;
+ tmp->copy = -1;
+ mpeg_init(&tmp->m);
+ }
+ return tmp;
+}
+
+static struct ast_frame *mp3tolin_sample()
+{
+ static struct ast_frame f;
+ int size;
+ if (mp3_badheader(mp3_slin_ex)) {
+ ast_log(LOG_WARNING, "Bad MP3 sample??\n");
+ return NULL;
+ }
+ size = mp3_framelen(mp3_slin_ex);
+ if (size < 1) {
+ ast_log(LOG_WARNING, "Failed to size??\n");
+ return NULL;
+ }
+ f.frametype = AST_FRAME_VOICE;
+ f.subclass = AST_FORMAT_MP3;
+ f.data = mp3_slin_ex;
+ f.datalen = sizeof(mp3_slin_ex);
+ /* Dunno how long an mp3 frame is -- kinda irrelevant anyway */
+ f.timelen = 30;
+ f.mallocd = 0;
+ f.offset = 0;
+ f.src = __PRETTY_FUNCTION__;
+ return &f;
+}
+
+static struct ast_frame *mp3tolin_frameout(struct ast_translator_pvt *tmp)
+{
+ int sent;
+ if (!tmp->tail)
+ return NULL;
+ sent = tmp->tail;
+ if (sent > MAX_OUT_FRAME/2)
+ sent = MAX_OUT_FRAME/2;
+ /* Signed linear is no particular frame size, so just send whatever
+ we have in the buffer in one lump sum */
+ tmp->f.frametype = AST_FRAME_VOICE;
+ tmp->f.subclass = AST_FORMAT_SLINEAR;
+ tmp->f.datalen = sent * 2;
+ /* Assume 8000 Hz */
+ tmp->f.timelen = sent / 8;
+ tmp->f.mallocd = 0;
+ tmp->f.offset = AST_FRIENDLY_OFFSET;
+ tmp->f.src = __PRETTY_FUNCTION__;
+ memcpy(tmp->outbuf, tmp->buf, tmp->tail * 2);
+ tmp->f.data = tmp->outbuf;
+ /* Reset tail pointer */
+ tmp->tail -= sent;
+ if (tmp->tail)
+ memmove(tmp->buf, tmp->buf + sent, tmp->tail * 2);
+
+#if 0
+ /* Save a sample frame */
+ { static int samplefr = 0;
+ if (samplefr == 80) {
+ int fd;
+ fd = open("mp3.example", O_WRONLY | O_CREAT, 0644);
+ write(fd, tmp->f.data, tmp->f.datalen);
+ close(fd);
+ }
+ samplefr++;
+ }
+#endif
+ return &tmp->f;
+}
+
+static int mp3_init(struct ast_translator_pvt *tmp, int len)
+{
+ if (!audio_decode_init(&tmp->m, &tmp->head, len,0,0,1 /* Convert to mono */,24000)) {
+ ast_log(LOG_WARNING, "audio_decode_init() failed\n");
+ return -1;
+ }
+ audio_decode_info(&tmp->m, &tmp->info);
+#if 0
+ ast_verbose(
+"Channels: %d\nOutValues: %d\nSample Rate: %d\nBits: %d\nFramebytes: %d\nType: %d\n",
+ tmp->info.channels, tmp->info.outvalues, tmp->info.samprate, tmp->info.bits,tmp->info.framebytes,tmp->info.type);
+#endif
+ return 0;
+}
+
+#ifndef MIN
+#define MIN(a,b) (((a) < (b)) ? (a) : (b))
+#endif
+
+#if 1
+static int add_to_buf(short *dst, int maxdst, short *src, int srclen, int samprate)
+{
+ float inc, cur, sum=0;
+ int cnt=0, pos, ptr, lastpos = -1;
+ /* Resample source to destination converting from its sampling rate to 8000 Hz */
+ if (samprate == 8000) {
+ /* Quickly, all we have to do is copy */
+ memcpy(dst, src, 2 * MIN(maxdst, srclen));
+ return MIN(maxdst, srclen);
+ }
+ if (samprate < 8000) {
+ ast_log(LOG_WARNING, "Don't know how to resample a source less than 8000 Hz!\n");
+ /* XXX Wrong thing to do XXX */
+ memcpy(dst, src, 2 * MIN(maxdst, srclen));
+ return MIN(maxdst, srclen);
+ }
+ /* Ugh, we actually *have* to resample */
+ inc = 8000.0 / (float)samprate;
+ cur = 0;
+ ptr = 0;
+ pos = 0;
+#if 0
+ ast_verbose("Incrementing by %f, in = %d bytes, out = %d bytes\n", inc, srclen, maxdst);
+#endif
+ while((pos < maxdst) && (ptr < srclen)) {
+ if (pos != lastpos) {
+ if (lastpos > -1) {
+ sum = sum / (float)cnt;
+ dst[pos - 1] = (int) sum;
+#if 0
+ ast_verbose("dst[%d] = %d\n", pos - 1, dst[pos - 1]);
+#endif
+ }
+ /* Each time we have a first pass */
+ sum = 0;
+ cnt = 0;
+ } else {
+ sum += src[ptr];
+ }
+ ptr++;
+ cur += inc;
+ cnt++;
+ lastpos = pos;
+ pos = (int)cur;
+ }
+ return pos;
+}
+#endif
+
+static int mp3tolin_framein(struct ast_translator_pvt *tmp, struct ast_frame *f)
+{
+ /* Assuming there's space left, decode into the current buffer at
+ the tail location */
+ int framelen;
+ short tmpbuf[8000];
+ IN_OUT x;
+#if 0
+ if (tmp->copy < 0) {
+ tmp->copy = open("sample.out", O_WRONLY | O_CREAT | O_TRUNC, 0700);
+ }
+ if (tmp->copy > -1)
+ write(tmp->copy, f->data, f->datalen);
+#endif
+ /* Check if it's a valid frame */
+ if (mp3_badheader((unsigned char *)f->data)) {
+ ast_log(LOG_WARNING, "Invalid MP3 header\n");
+ return -1;
+ }
+ if ((framelen = mp3_framelen((unsigned char *)f->data) != f->datalen)) {
+ ast_log(LOG_WARNING, "Calculated length %d does not match real length %d\n", framelen, f->datalen);
+ return -1;
+ }
+ /* Start by putting this in the mp3 buffer */
+ if((framelen = head_info3(f->data,
+ f->datalen, &tmp->head, &tmp->bitrate, &tmp->forward)) > 0) {
+ if (!tmp->init) {
+ if (mp3_init(tmp, framelen))
+ return -1;
+ else
+ tmp->init++;
+ }
+ if (tmp->tail + MAX_OUTPUT_LEN/2 < sizeof(tmp->buf)/2) {
+ x = audio_decode(&tmp->m, f->data, tmpbuf);
+ audio_decode_info(&tmp->m, &tmp->info);
+ if (!x.in_bytes) {
+ ast_log(LOG_WARNING, "Invalid MP3 data\n");
+ } else {
+#if 1
+ /* Resample to 8000 Hz */
+ tmp->tail += add_to_buf(tmp->buf + tmp->tail,
+ sizeof(tmp->buf) / 2 - tmp->tail,
+ tmpbuf,
+ x.out_bytes/2,
+ tmp->info.samprate);
+#else
+ memcpy(tmp->buf + tmp->tail, tmpbuf, x.out_bytes);
+ /* Signed linear output */
+ tmp->tail+=x.out_bytes/2;
+#endif
+ }
+ } else {
+ ast_log(LOG_WARNING, "Out of buffer space\n");
+ return -1;
+ }
+ } else {
+ ast_log(LOG_WARNING, "Not a valid MP3 frame\n");
+ }
+ return 0;
+}
+
+static void mp3_destroy_stuff(struct ast_translator_pvt *pvt)
+{
+ close(pvt->copy);
+ free(pvt);
+}
+
+static struct ast_translator mp3tolin =
+ { "mp3tolin",
+ AST_FORMAT_MP3, AST_FORMAT_SLINEAR,
+ mp3_new,
+ mp3tolin_framein,
+ mp3tolin_frameout,
+ mp3_destroy_stuff,
+ mp3tolin_sample
+ };
+
+int unload_module(void)
+{
+ int res;
+ pthread_mutex_lock(&localuser_lock);
+ res = ast_unregister_translator(&mp3tolin);
+ if (localusecnt)
+ res = -1;
+ pthread_mutex_unlock(&localuser_lock);
+ return res;
+}
+
+int load_module(void)
+{
+ int res;
+ res=ast_register_translator(&mp3tolin);
+ return res;
+}
+
+char *description(void)
+{
+ return tdesc;
+}
+
+int usecount(void)
+{
+ int res;
+ STANDARD_USECOUNT(res);
+ return res;
+}
diff --git a/codecs/g723_slin_ex.h b/codecs/g723_slin_ex.h
index df88b7b33..61eab6523 100755
--- a/codecs/g723_slin_ex.h
+++ b/codecs/g723_slin_ex.h
@@ -3,7 +3,7 @@
*
* Source: g723.example
*
- * Copyright (C) 1999, Mark Spencer and Linux Support Services
+ * Copyright (C) 1999, Mark Spencer
*
* Distributed under the terms of the GNU General Public License
*
diff --git a/codecs/gsm_slin_ex.h b/codecs/gsm_slin_ex.h
index e609cbb61..f22a633bf 100755
--- a/codecs/gsm_slin_ex.h
+++ b/codecs/gsm_slin_ex.h
@@ -3,7 +3,7 @@
*
* Source: gsm.example
*
- * Copyright (C) 1999, Mark Spencer and Linux Support Services
+ * Copyright (C) 1999, Mark Spencer
*
* Distributed under the terms of the GNU General Public License
*
diff --git a/codecs/mp3_slin_ex.h b/codecs/mp3_slin_ex.h
new file mode 100755
index 000000000..d47b445ee
--- /dev/null
+++ b/codecs/mp3_slin_ex.h
@@ -0,0 +1,70 @@
+/*
+ * 8-bit raw data
+ *
+ * Source: ../sample.out
+ *
+ * Copyright (C) 1999, Mark Spencer
+ *
+ * Distributed under the terms of the GNU General Public License
+ *
+ */
+
+static unsigned char mp3_slin_ex[] = {
+0xff, 0xfb, 0x98, 0x4, 0x3, 000, 0x4, 0x1, 0x6f, 0x48,
+0x83, 0x46, 0x1a, 0xf0, 0x8a, 0xb, 0x19, 0x10, 0x75, 0x26,
+0x5c, 0x50, 0xc9, 0xc1, 0x20, 0xa, 0x18, 0xcb, 0xc2, 0xa,
+0xac, 0xe4, 0x81, 0x63, 0x2d, 0x71, 0x6d, 0xdf, 0xcb, 0xf1,
+0xb7, 0x89, 0x69, 0xcd, 0x86, 0x40, 0xd7, 0x2e, 0x6c, 0xc7,
+0x93, 0xa5, 0xf7, 0x1b, 0x19, 0xa, 0x28, 0xf9, 0xa1, 0xab,
+0x93, 0x67, 0xdc, 0xc3, 0x5e, 0x54, 0x75, 0xb1, 0xf8, 0x7e,
+0x3a, 0x80, 0xd1, 0xc3, 0x96, 0x18, 0x81, 0x11, 0x1d, 0x27,
+0x91, 0xdc, 0x5d, 0xb1, 0x94, 0x52, 0xae, 0x6e, 0x2c, 0x43,
+0xb, 0x47, 0x1a, 0xea, 0x45, 0x8, 0x23, 0x13, 0xc5, 0x39,
+0x61, 0xbb, 0xa8, 0x59, 0x8b, 0x84, 0xa4, 0x55, 0x1f, 0x56,
+0xa1, 0x3, 0x2a, 0xad, 0x86, 0xf, 0x27, 0xdc, 0xa1, 0x3a,
+0xa1, 0xb8, 0x47, 0xb, 0xc9, 0xe8, 0xa4, 0xc, 0xc7, 0x45,
+0x21, 0x4f, 0x30, 0xac, 0xf8, 0xb7, 0x23, 0x16, 0x81, 0x13,
+0x29, 0xe3, 0x77, 0x61, 0x68, 0xae, 0x85, 0x2d, 0x32, 0x77,
+0x63, 0x4a, 0x37, 0x34, 0xb3, 0x37, 0xe9, 0xb3, 0x9c, 0xde,
+000, 0x3e, 0xb4, 0x52, 0x99, 0xfc, 0xe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x88, 0xb7, 0xd7, 0xb2, 0x5d, 0xe, 0x65, 0xf2, 0xa0,
+0x14, 0xec, 0x2d, 0x9b, 0x98, 0x67, 0x20, 0x63, 0x7c, 0x52,
+0x95, 0x8d, 0x62, 0xd9, 0x54, 0xa7, 0xe9, 0x8d, 0x7f, 0xdb,
+0xcf, 0x11, 0x24, 0xe2, 0x81, 0xc1, 0x3e, 0xab, 0xf4, 0x86,
+0xc8, 0x4c, 0xc5, 0x8d, 0xf0, 0x58 };
diff --git a/codecs/mp3anal.h b/codecs/mp3anal.h
new file mode 100755
index 000000000..263e8520c
--- /dev/null
+++ b/codecs/mp3anal.h
@@ -0,0 +1,83 @@
+/*
+ * Asterisk -- A telephony toolkit for Linux.
+ *
+ * MP3 Header Analysis Routines. Thanks to Robert Kaye for the logic!
+ *
+ * Copyright (C) 1999, Mark Spencer
+ *
+ * Mark Spencer <markster@linux-support.net>
+ *
+ * This program is free software, distributed under the terms of
+ * the GNU General Public License
+ */
+
+static int bitrates1[] = { 0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320 };
+static int bitrates2[] = { 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160 };
+
+static int samplerates1[] = { 44100, 48000, 32000 };
+static int samplerates2[] = { 22050, 24000, 16000 };
+
+static int outputsamples[] = { 576, 1152 };
+
+static int mp3_samples(unsigned char *header)
+{
+ int ver = (header[1] & 0x8) >> 3;
+ return outputsamples[ver];
+}
+
+static int mp3_bitrate(unsigned char *header)
+{
+ int ver = (header[1] & 0x8) >> 3;
+ int br = (header[2] >> 4);
+
+ if (ver > 14) {
+ ast_log(LOG_WARNING, "Invalid bit rate\n");
+ return -1;
+ }
+ if (ver)
+ return bitrates1[br];
+ else {
+ return bitrates2[br];
+ }
+}
+
+static int mp3_samplerate(unsigned char *header)
+{
+ int ver = (header[1] & 0x8) >> 3;
+ int sr = (header[2] >> 2) & 0x3;
+
+ if (ver > 2) {
+ ast_log(LOG_WARNING, "Invalid sample rate\n");
+ return -1;
+ }
+
+ if (ver)
+ return samplerates1[sr];
+ else
+ return samplerates2[sr];
+}
+
+static int mp3_padding(unsigned char *header)
+{
+ return (header[2] >> 1) & 0x1;
+}
+
+static int mp3_badheader(unsigned char *header)
+{
+ if ((header[0] != 0xFF) || ((header[1] & 0xF0) != 0xF0))
+ return -1;
+ return 0;
+}
+
+static int mp3_framelen(unsigned char *header)
+{
+ int br = mp3_bitrate(header);
+ int sr = mp3_samplerate(header);
+ int size;
+
+ if ((br < 0) || (sr < 0))
+ return -1;
+ size = 144000 * br / sr + mp3_padding(header);
+ return size;
+}
+
diff --git a/codecs/slin_g723_ex.h b/codecs/slin_g723_ex.h
index dc3c087e4..fedadd409 100755
--- a/codecs/slin_g723_ex.h
+++ b/codecs/slin_g723_ex.h
@@ -3,7 +3,7 @@
*
* Source: g723.example
*
- * Copyright (C) 1999, Mark Spencer and Linux Support Services
+ * Copyright (C) 1999, Mark Spencer
*
* Distributed under the terms of the GNU General Public License
*
diff --git a/codecs/slin_gsm_ex.h b/codecs/slin_gsm_ex.h
index cb46dc71d..26dd6d7e6 100755
--- a/codecs/slin_gsm_ex.h
+++ b/codecs/slin_gsm_ex.h
@@ -3,7 +3,7 @@
*
* Source: gsm.example
*
- * Copyright (C) 1999, Mark Spencer and Linux Support Services
+ * Copyright (C) 1999, Mark Spencer
*
* Distributed under the terms of the GNU General Public License
*
diff --git a/config.c b/config.c
index 58a2741f4..3d81ebda7 100755
--- a/config.c
+++ b/config.c
@@ -3,7 +3,7 @@
*
* Configuration File Parser
*
- * Copyright (C) 1999, Adtran Inc. and Linux Support Services, LLC
+ * Copyright (C) 1999, Mark Spencer
*
* Mark Spencer <markster@linux-support.net>
*
@@ -95,11 +95,25 @@ struct ast_variable *ast_variable_browse(struct ast_config *config, char *catego
char *ast_variable_retrieve(struct ast_config *config, char *category, char *value)
{
struct ast_variable *v;
- v = ast_variable_browse(config, category);
- while (v) {
- if (!strcasecmp(value, v->name))
- return v->value;
- v=v->next;
+ if (category) {
+ v = ast_variable_browse(config, category);
+ while (v) {
+ if (!strcasecmp(value, v->name))
+ return v->value;
+ v=v->next;
+ }
+ } else {
+ struct ast_category *cat;
+ cat = config->root;
+ while(cat) {
+ v = cat->root;
+ while (v) {
+ if (!strcasecmp(value, v->name))
+ return v->value;
+ v=v->next;
+ }
+ cat = cat->next;
+ }
}
return NULL;
}
diff --git a/file.c b/file.c
index 9ee50c560..be82f9152 100755
--- a/file.c
+++ b/file.c
@@ -3,7 +3,7 @@
*
* Generic File Format Support.
*
- * Copyright (C) 1999, Adtran Inc. and Linux Support Services, LLC
+ * Copyright (C) 1999, Mark Spencer
*
* Mark Spencer <markster@linux-support.net>
*
@@ -168,7 +168,6 @@ int ast_writestream(struct ast_filestream *fs, struct ast_frame *f)
{
struct ast_frame_chain *fc, *f2;
int res = -1;
- int count=0;
if (f->frametype != AST_FRAME_VOICE) {
ast_log(LOG_WARNING, "Tried to write non-voice frame\n");
return -1;
@@ -193,9 +192,6 @@ int ast_writestream(struct ast_filestream *fs, struct ast_frame *f)
break;
}
f2 = f2->next;
- count++;
- if (count > 1)
- ast_log(LOG_DEBUG, "Count is %d\n", count);
}
if (fc)
ast_frchain(fc);
diff --git a/frame.c b/frame.c
index ba0e48e92..856e7fd89 100755
--- a/frame.c
+++ b/frame.c
@@ -3,7 +3,7 @@
*
* Frame manipulation routines
*
- * Copyright (C) 1999, Adtran Inc. and Linux Support Services, LLC
+ * Copyright (C) 1999, Mark Spencer
*
* Mark Spencer <markster@linux-support.net>
*
diff --git a/include/asterisk/config.h b/include/asterisk/config.h
index 79dd8cc26..a1e876ecb 100755
--- a/include/asterisk/config.h
+++ b/include/asterisk/config.h
@@ -3,7 +3,7 @@
*
* Configuration File Parser
*
- * Copyright (C) 1999, Adtran Inc. and Linux Support Services, LLC
+ * Copyright (C) 1999, Mark Spencer
*
* Mark Spencer <markster@linux-support.net>
*
diff --git a/include/asterisk/file.h b/include/asterisk/file.h
index da4ffaa42..fe0678f67 100755
--- a/include/asterisk/file.h
+++ b/include/asterisk/file.h
@@ -3,7 +3,7 @@
*
* Generic File Format Support.
*
- * Copyright (C) 1999, Adtran Inc. and Linux Support Services, LLC
+ * Copyright (C) 1999, Mark Spencer
*
* Mark Spencer <markster@linux-support.net>
*
diff --git a/include/asterisk/frame.h b/include/asterisk/frame.h
index d9fb440f0..b126bd352 100755
--- a/include/asterisk/frame.h
+++ b/include/asterisk/frame.h
@@ -3,7 +3,7 @@
*
* Asterisk internal frame definitions.
*
- * Copyright (C) 1999, Adtran Inc. and Linux Support Services, LLC
+ * Copyright (C) 1999, Mark Spencer
*
* Mark Spencer <markster@linux-support.net>
*
diff --git a/include/asterisk/logger.h b/include/asterisk/logger.h
index f7ffc5014..8ca5af75e 100755
--- a/include/asterisk/logger.h
+++ b/include/asterisk/logger.h
@@ -3,7 +3,7 @@
*
* Mark Spencer <markster@marko.net>
*
- * Copyright(C) 1999, Adtran, Inc.
+ * Copyright(C) Mark Spencer
*
* Distributed under the terms of the GNU General Public License (GPL) Version
*
diff --git a/include/asterisk/module.h b/include/asterisk/module.h
index 94a4f82b2..e7bda62d6 100755
--- a/include/asterisk/module.h
+++ b/include/asterisk/module.h
@@ -3,7 +3,7 @@
*
* Module definitions
*
- * Copyright (C) 1999, Adtran Inc. and Linux Support Services, LLC
+ * Copyright (C) 1999, Mark Spencer
*
* Mark Spencer <markster@linux-support.net>
*
diff --git a/include/asterisk/options.h b/include/asterisk/options.h
index 04c355e11..aca01a969 100755
--- a/include/asterisk/options.h
+++ b/include/asterisk/options.h
@@ -3,7 +3,7 @@
*
* Options provided by main asterisk program
*
- * Copyright (C) 1999, Adtran Inc. and Linux Support Services, LLC
+ * Copyright (C) 1999, Mark Spencer
*
* Mark Spencer <markster@linux-support.net>
*
diff --git a/include/asterisk/pbx.h b/include/asterisk/pbx.h
index 0474936c1..37d65a16d 100755
--- a/include/asterisk/pbx.h
+++ b/include/asterisk/pbx.h
@@ -3,7 +3,7 @@
*
* Core PBX routines and definitions.
*
- * Copyright (C) 1999, Adtran Inc. and Linux Support Services, LLC
+ * Copyright (C) 1999, Mark Spencer
*
* Mark Spencer <markster@linux-support.net>
*
diff --git a/include/asterisk/say.h b/include/asterisk/say.h
index 357d44f9f..2d78d2c7d 100755
--- a/include/asterisk/say.h
+++ b/include/asterisk/say.h
@@ -3,7 +3,7 @@
*
* Say numbers and dates (maybe words one day too)
*
- * Copyright (C) 1999, Adtran Inc. and Linux Support Services, LLC
+ * Copyright (C) 1999, Mark Spencer
*
* Mark Spencer <markster@linux-support.net>
*
diff --git a/include/asterisk/sched.h b/include/asterisk/sched.h
index b6e13462e..9ccdda195 100755
--- a/include/asterisk/sched.h
+++ b/include/asterisk/sched.h
@@ -3,7 +3,7 @@
*
* Mark Spencer <markster@marko.net>
*
- * Copyright(C) 1999, Adtran, Inc.
+ * Copyright(C) Mark Spencer
*
* Distributed under the terms of the GNU General Public License (GPL) Version 2
*
diff --git a/include/asterisk/translate.h b/include/asterisk/translate.h
index 68edc046d..a2bcfff19 100755
--- a/include/asterisk/translate.h
+++ b/include/asterisk/translate.h
@@ -3,7 +3,7 @@
*
* Translate via the use of pseudo channels
*
- * Copyright (C) 1999, Adtran Inc. and Linux Support Services, LLC
+ * Copyright (C) 1999, Mark Spencer
*
* Mark Spencer <markster@linux-support.net>
*
diff --git a/pbx/Makefile b/pbx/Makefile
index dc3ed708c..c32e8e686 100755
--- a/pbx/Makefile
+++ b/pbx/Makefile
@@ -3,7 +3,7 @@
#
# Makefile for PBX frontends (dynamically loaded)
#
-# Copyright (C) 1999, Adtran Inc. and Linux Support Services, LLC
+# Copyright (C) 1999, Mark Spencer
#
# Mark Spencer <markster@linux-support.net>
#
@@ -16,7 +16,7 @@
PBX_LIBS=pbx_config.so # pbx_gtkconsole.so pbx_kdeconsole.so
# Add GTK console if appropriate
-PBX_LIBS+=$(shell gtk-config --cflags >&/dev/null && echo "pbx_gtkconsole.so")
+PBX_LIBS+=$(shell gtk-config --cflags >/dev/null 2>/dev/null && echo "pbx_gtkconsole.so")
# Add KDE Console if appropriate
PBX_LIBS+=$(shell [ "$$QTDIR" != "" ] && echo "pbx_kdeconsole.so")
diff --git a/pbx/pbx_config.c b/pbx/pbx_config.c
index 359cec911..1468d8331 100755
--- a/pbx/pbx_config.c
+++ b/pbx/pbx_config.c
@@ -3,7 +3,7 @@
*
* Populate and remember extensions from static config file
*
- * Copyright (C) 1999, Adtran Inc. and Linux Support Services, LLC
+ * Copyright (C) 1999, Mark Spencer
*
* Mark Spencer <markster@linux-support.net>
*
@@ -75,8 +75,8 @@ int load_module(void)
}
cxt = ast_category_browse(cfg, cxt);
}
+ ast_destroy(cfg);
}
- ast_destroy(cfg);
return 0;
}
diff --git a/pbx/pbx_gtkconsole.c b/pbx/pbx_gtkconsole.c
index 04f72eeb3..1aefa4ca8 100755
--- a/pbx/pbx_gtkconsole.c
+++ b/pbx/pbx_gtkconsole.c
@@ -3,7 +3,7 @@
*
* GTK Console monitor -- very kludgy right now
*
- * Copyright (C) 1999, Adtran Inc. and Linux Support Services, LLC
+ * Copyright (C) 1999, Mark Spencer
*
* Mark Spencer <markster@linux-support.net>
*
diff --git a/pbx/pbx_kdeconsole.cc b/pbx/pbx_kdeconsole.cc
index e1d724178..6c2817366 100755
--- a/pbx/pbx_kdeconsole.cc
+++ b/pbx/pbx_kdeconsole.cc
@@ -3,7 +3,7 @@
*
* KDE Console monitor -- Class implmementation
*
- * Copyright (C) 1999, Adtran Inc. and Linux Support Services, LLC
+ * Copyright (C) 1999, Mark Spencer
*
* Mark Spencer <markster@linux-support.net>
*
diff --git a/pbx/pbx_kdeconsole.h b/pbx/pbx_kdeconsole.h
index e003e48f1..df73ab38e 100755
--- a/pbx/pbx_kdeconsole.h
+++ b/pbx/pbx_kdeconsole.h
@@ -3,7 +3,7 @@
*
* KDE Console monitor -- Header file
*
- * Copyright (C) 1999, Adtran Inc. and Linux Support Services, LLC
+ * Copyright (C) 1999, Mark Spencer
*
* Mark Spencer <markster@linux-support.net>
*
diff --git a/pbx/pbx_kdeconsole_main.cc b/pbx/pbx_kdeconsole_main.cc
index 7ddc74234..4ca3da5dd 100755
--- a/pbx/pbx_kdeconsole_main.cc
+++ b/pbx/pbx_kdeconsole_main.cc
@@ -3,7 +3,7 @@
*
* KDE Console monitor -- Mostly glue code
*
- * Copyright (C) 1999, Adtran Inc. and Linux Support Services, LLC
+ * Copyright (C) 1999, Mark Spencer
*
* Mark Spencer <markster@linux-support.net>
*
diff --git a/say.c b/say.c
index 9ec87e7e7..c3f5fba5b 100755
--- a/say.c
+++ b/say.c
@@ -3,7 +3,7 @@
*
* Say numbers and dates (maybe words one day too)
*
- * Copyright (C) 1999, Adtran Inc. and Linux Support Services, LLC
+ * Copyright (C) 1999, Mark Spencer
*
* Mark Spencer <markster@linux-support.net>
*
diff --git a/sched.c b/sched.c
index a6a2ca5d3..42afea5be 100755
--- a/sched.c
+++ b/sched.c
@@ -3,7 +3,7 @@
*
* Mark Spencer <markster@marko.net>
*
- * Copyright(C) 1999, Adtran, Inc.
+ * Copyright(C) Mark Spencer
*
* Distributed under the terms of the GNU General Public License (GPL) Version 2
*