Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

lib: Add libtremor support

For faster decoding on integer-only machines.
  • Loading branch information...
commit a315b126f1b97679c21a4940202214d93710ca1e 1 parent 1c8b1eb
@SimonKagstrom authored
View
9 src/Makefile
@@ -6,7 +6,7 @@
export
CFLAGS = -Wall -Wextra -ggdb -std=gnu99
-LDFLAGS = -lz -lvorbisfile
+LDFLAGS = -lz
LD = $(CC)
@@ -26,6 +26,13 @@ ifeq ($(DEBUG), 1)
CFLAGS += -DDEBUG
endif
+ifeq ($(USE_TREMOR), 1)
+ CFLAGS += -DUSE_TREMOR=1
+ LDFLAGS += -lvorbisidec
+else
+ LDFLAGS += -lvorbisfile
+endif
+
# Mac OS X specifics
ifeq ($(shell uname -s),Darwin)
LT = glibtool --tag=CC
View
4 src/Makefile.local.mk.dist
@@ -9,6 +9,10 @@ CLIENT_DESPOTIFY = 1
CLIENT_GATEWAY = 1
# CLIENT_MAEMIFY = 1
+## Enable libtremor, the integer-only OGG Vorbis decoder
+# USE_TREMOR = 1
+
+
## Enable Nokia Maemo4 specific code in maemify client.
## At least LINUX_BACKEND = gstreamer seems to work with this.
# MAEMO4 = 1
View
30 src/lib/sndqueue.c
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: sndqueue.c 485 2010-01-14 08:33:24Z jorgenpt $
*
*/
@@ -442,6 +442,15 @@ size_t snd_ov_read_callback(void *ptr, size_t size, size_t nmemb, void* session)
return totlength;
}
+int seek_func (void *session, ogg_int64_t offset, int whence)
+{
+ (void)session;
+ (void)offset;
+ (void)whence;
+
+ return -1;
+}
+
int snd_get_pcm(struct despotify_session* ds, struct pcm_data* pcm)
{
if (!ds || !ds->fifo || !ds->fifo->start) {
@@ -464,7 +473,7 @@ int snd_get_pcm(struct despotify_session* ds, struct pcm_data* pcm)
/* Initialize Vorbis struct with the appropriate callbacks */
ov_callbacks callbacks;
callbacks.read_func = snd_ov_read_callback;
- callbacks.seek_func = NULL;
+ callbacks.seek_func = seek_func;
callbacks.close_func = NULL;
callbacks.tell_func = NULL;
@@ -490,8 +499,15 @@ int snd_get_pcm(struct despotify_session* ds, struct pcm_data* pcm)
while (1) {
/* decode to pcm */
- ssize_t r = ov_read(ds->vf, pcm->buf, sizeof(pcm->buf),
- SYSTEM_ENDIAN, 2, 1, NULL);
+ ssize_t r;
+
+#if defined(USE_TREMOR)
+ r = ov_read(ds->vf, pcm->buf, sizeof(pcm->buf),
+ NULL);
+#else
+ r = ov_read(ds->vf, pcm->buf, sizeof(pcm->buf),
+ SYSTEM_ENDIAN, 2, 1, NULL);
+#endif
/* assume no valid data read. */
pcm->len = 0;
@@ -518,7 +534,13 @@ int snd_get_pcm(struct despotify_session* ds, struct pcm_data* pcm)
pcm->len = r;
if (ds->client_callback) {
+#if defined(USE_TREMOR)
+ ogg_int64_t int_point = ov_time_tell(ds->vf);
+ double point = ((double)int_point) / 1000.0;
+#else
double point = ov_time_tell(ds->vf);
+#endif
+
ds->client_callback(ds, DESPOTIFY_TIME_TELL, &point,
ds->client_callback_data);
}
View
8 src/lib/sndqueue.h
@@ -1,5 +1,5 @@
/*
- * $Id$
+ * $Id: sndqueue.h 476 2009-12-01 13:54:42Z zagor $
*
*/
@@ -7,7 +7,11 @@
#define DESPOTIFY_SNDQUEUE_H
#include <pthread.h>
-#include <vorbis/vorbisfile.h>
+#if defined(USE_TREMOR)
+# include <tremor/ivorbisfile.h>
+#else
+# include <vorbis/vorbisfile.h>
+#endif
#include "despotify.h"
Please sign in to comment.
Something went wrong with that request. Please try again.