summaryrefslogtreecommitdiffstats
path: root/apps/codecs/libspeex/bits.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/codecs/libspeex/bits.c')
-rw-r--r--apps/codecs/libspeex/bits.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/apps/codecs/libspeex/bits.c b/apps/codecs/libspeex/bits.c
index 6173246380..379fe748d4 100644
--- a/apps/codecs/libspeex/bits.c
+++ b/apps/codecs/libspeex/bits.c
@@ -67,6 +67,20 @@ void speex_bits_init_buffer(SpeexBits *bits, void *buff, int buf_size)
speex_bits_reset(bits);
}
+void speex_bits_set_bit_buffer(SpeexBits *bits, void *buff, int buf_size)
+{
+ bits->chars = (char*)buff;
+ bits->buf_size = buf_size;
+
+ bits->owner=0;
+
+ bits->nbBits=buf_size<<LOG2_BITS_PER_CHAR;
+ bits->charPtr=0;
+ bits->bitPtr=0;
+ bits->overflow=0;
+
+}
+
void speex_bits_destroy(SpeexBits *bits)
{
if (bits->owner)
@@ -97,7 +111,7 @@ void speex_bits_read_from(SpeexBits *bits, char *chars, int len)
int nchars = len / BYTES_PER_CHAR;
if (nchars > bits->buf_size)
{
- speex_warning_int("Packet is larger than allocated buffer: ", len);
+ speex_notify("Packet is larger than allocated buffer");
if (bits->owner)
{
char *tmp = (char*)speex_realloc(bits->chars, nchars);
@@ -110,7 +124,7 @@ void speex_bits_read_from(SpeexBits *bits, char *chars, int len)
speex_warning("Could not resize input buffer: truncating input");
}
} else {
- speex_warning("Do not own input buffer: truncating input");
+ speex_warning("Do not own input buffer: truncating oversize input");
nchars=bits->buf_size;
}
}
@@ -159,10 +173,10 @@ void speex_bits_read_whole_bytes(SpeexBits *bits, char *chars, int nbytes)
bits->chars=tmp;
} else {
nchars=bits->buf_size-(bits->nbBits>>LOG2_BITS_PER_CHAR)-1;
- speex_warning("Could not resize input buffer: truncating input");
+ speex_warning("Could not resize input buffer: truncating oversize input");
}
} else {
- speex_warning("Do not own input buffer: truncating input");
+ speex_warning("Do not own input buffer: truncating oversize input");
nchars=bits->buf_size;
}
}
@@ -223,7 +237,7 @@ void speex_bits_pack(SpeexBits *bits, int data, int nbBits)
if (bits->charPtr+((nbBits+bits->bitPtr)>>LOG2_BITS_PER_CHAR) >= bits->buf_size)
{
- speex_warning("Buffer too small to pack bits");
+ speex_notify("Buffer too small to pack bits");
if (bits->owner)
{
int new_nchars = ((bits->buf_size+5)*3)>>1;