summaryrefslogtreecommitdiff
path: root/apps/codecs/libspeex/jitter.c
diff options
context:
space:
mode:
authorDan Everton <dan@iocaine.org>2007-02-10 11:44:26 +0000
committerDan Everton <dan@iocaine.org>2007-02-10 11:44:26 +0000
commit7bf62e8da66ca8ff0acc2702f92ea4fe06eb94b1 (patch)
treec9db4558a73ae3094839c4655fa0b8ebc2231c56 /apps/codecs/libspeex/jitter.c
parent51587512635a8b19e6a5f19a20074d0d4d1f17da (diff)
* Sync Speex codec with Speex SVN revision 12449 (roughly Speex 1.2beta1).
* Redo the changes required to make Speex compile in Rockbox. Should be a bit easier to keep in sync with Speex SVN now. * Fix name of Speex library in codecs Makefile. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12254 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/codecs/libspeex/jitter.c')
-rw-r--r--apps/codecs/libspeex/jitter.c27
1 files changed, 23 insertions, 4 deletions
diff --git a/apps/codecs/libspeex/jitter.c b/apps/codecs/libspeex/jitter.c
index 79d1f9ddce..dc31c06407 100644
--- a/apps/codecs/libspeex/jitter.c
+++ b/apps/codecs/libspeex/jitter.c
@@ -41,7 +41,10 @@
#include <speex/speex.h>
#include <speex/speex_bits.h>
#include <speex/speex_jitter.h>
-#include <stdio.h>
+
+#ifndef NULL
+#define NULL 0
+#endif
#define LATE_BINS 10
#define MAX_MARGIN 30 /**< Number of bins in margin histogram */
@@ -181,7 +184,7 @@ void jitter_buffer_put(JitterBuffer *jitter, const JitterBufferPacket *packet)
/* Copy packet in buffer */
jitter->buf[i]=(char*)speex_alloc(packet->len);
- for (j=0;j<(signed int)packet->len;j++)
+ for (j=0;((unsigned)j)<packet->len;j++)
jitter->buf[i][j]=packet->data[j];
jitter->timestamp[i]=packet->timestamp;
jitter->span[i]=packet->span;
@@ -378,7 +381,7 @@ int jitter_buffer_get(JitterBuffer *jitter, JitterBufferPacket *packet, spx_uint
/* Check for potential overflow */
packet->len = jitter->len[i];
/* Copy packet */
- for (j=0;j<(signed int)packet->len;j++)
+ for (j=0;((unsigned)j)<packet->len;j++)
packet->data[j] = jitter->buf[i][j];
/* Remove packet */
speex_free(jitter->buf[i]);
@@ -424,7 +427,23 @@ void jitter_buffer_tick(JitterBuffer *jitter)
jitter->current_timestamp += jitter->tick_size;
}
-
+/* Used like the ioctl function to control the jitter buffer parameters */
+int jitter_buffer_ctl(JitterBuffer *jitter, int request, void *ptr)
+{
+ switch(request)
+ {
+ case JITTER_BUFFER_SET_MARGIN:
+ jitter->buffer_margin = *(spx_int32_t*)ptr;
+ break;
+ case JITTER_BUFFER_GET_MARGIN:
+ *(spx_int32_t*)ptr = jitter->buffer_margin;
+ break;
+ default:
+ speex_warning_int("Unknown jitter_buffer_ctl request: ", request);
+ return -1;
+ }
+ return 0;
+}