aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2015-07-22 20:47:24 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2015-07-22 20:47:40 +0200
commitc22a202a672b93fbc7faee4d4c3c5c1e5c145485 (patch)
tree5a4ca63a343ce41918f8a81ce58638c42ae94518
parent146795d6862680b7cb5e57fc72e9e18e1d47d2d3 (diff)
downloadtoolame-dab-c22a202a672b93fbc7faee4d4c3c5c1e5c145485.tar.gz
toolame-dab-c22a202a672b93fbc7faee4d4c3c5c1e5c145485.tar.bz2
toolame-dab-c22a202a672b93fbc7faee4d4c3c5c1e5c145485.zip
Add compile-time option for JACK input
-rw-r--r--Makefile17
-rw-r--r--audio_read.c7
-rw-r--r--toolame.c13
3 files changed, 32 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index cdaaebd..96b1ccf 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,9 @@
# Set this to 0 to disable compiling the libvlc input
ENABLE_INPUT_VLC=1
+# Set this to 0 to disable compiling the JACK input
+ENABLE_INPUT_JACK=1
+
CC = gcc
HEADERS = \
@@ -79,14 +82,22 @@ OPTIM = -O2
ifeq (${ENABLE_INPUT_VLC},1)
VLC_CFLAGS=-DVLC_INPUT
- VLC_LDFLAGS=-lvlc
+ VLC_LDFLAGS=-lvlc -lpthread
else
VLC_CFLAGS=
VLC_LDFLAGS=
endif
+ifeq (${ENABLE_INPUT_JACK},1)
+ JACK_CFLAGS=-DJACK_INPUT
+ JACK_LDFLAGS=-ljack -lpthread
+else
+ JACK_CFLAGS=
+ JACK_LDFLAGS=
+endif
+
# These flags are pretty much mandatory
-REQUIRED = -DINLINE= ${GIT_VER} ${VLC_CFLAGS}
+REQUIRED = -DINLINE= ${GIT_VER} ${VLC_CFLAGS} ${JACK_CFLAGS}
#pick your architecture
ARCH = -march=native
@@ -112,7 +123,7 @@ CC_SWITCHES = $(OPTIM) $(REQUIRED) $(ARCH) $(PG) $(TWEAKS) $(WARNINGS) $(NEW_02L
PGM = toolame
-LIBS = -lm -lzmq -ljack -lpthread ${VLC_LDFLAGS}
+LIBS = -lm -lzmq ${VLC_LDFLAGS} ${JACK_LDFLAGS}
#nick burch's OS/2 fix gagravarr@SoftHome.net
UNAME = $(shell uname)
diff --git a/audio_read.c b/audio_read.c
index ca1e603..e7a901c 100644
--- a/audio_read.c
+++ b/audio_read.c
@@ -11,6 +11,7 @@
#include "audio_read.h"
#include "vlc_input.h"
+#if defined(JACK_INPUT)
jack_port_t *input_port_left;
jack_port_t *input_port_right;
jack_client_t *client;
@@ -170,6 +171,7 @@ void jack_shutdown(void *arg)
pthread_cond_signal(&data_ready);
}
+#endif // defined(JACK_INPUT)
/************************************************************************
*
@@ -201,7 +203,9 @@ unsigned long read_samples (music_in_t* musicin, short sample_buffer[2304],
else
samples_read = samples_to_read;
- if (glopts.input_select == INPUT_SELECT_JACK) {
+ if (0) { }
+#if defined(JACK_INPUT)
+ else if (glopts.input_select == INPUT_SELECT_JACK) {
int f = 2;
while (jack_ringbuffer_read_space(rb) < f * samples_read) {
/* wait until process() signals more data */
@@ -230,6 +234,7 @@ unsigned long read_samples (music_in_t* musicin, short sample_buffer[2304],
free(jack_sample_buffer);
}
+#endif // defined(JACK_INPUT)
else if (glopts.input_select == INPUT_SELECT_WAV) {
if ((samples_read =
fread (sample_buffer, sizeof (short), (int) samples_read,
diff --git a/toolame.c b/toolame.c
index d94d7fd..03d4d95 100644
--- a/toolame.c
+++ b/toolame.c
@@ -1,7 +1,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <pthread.h>
#include <jack/jack.h>
#include <jack/ringbuffer.h>
#include "common.h"
@@ -666,12 +665,19 @@ void usage (void)
fprintf (stdout, "\t-a downmix from stereo to mono\n");
fprintf (stdout, "\t-x force byte-swapping of input\n");
fprintf (stdout, "\t-g swap channels of input file\n");
+
+#if defined(JACK_INPUT)
fprintf (stdout, "\t-j use jack input\n");
+#else
+ fprintf (stdout, "\t-j DISABLED: JACK input not compiled in\n");
+#endif
+
#if defined(VLC_INPUT)
fprintf (stdout, "\t-V use libvlc input\n");
#else
fprintf (stdout, "\t-V DISABLED: libvlc input not compiled in\n");
#endif
+
fprintf (stdout, "\t-W file when using libvlc input, write the ICY-Text to file\n");
fprintf (stdout, "\t-L enable audio level display\n");
fprintf (stdout, "Output\n");
@@ -1049,7 +1055,12 @@ void parse_args (int argc, char **argv, frame_info * frame, int *psy,
musicin.jack_name = inPath;
*num_samples = MAX_U_32_NUM;
+#if defined(JACK_INPUT)
setup_jack(header, musicin.jack_name);
+#else
+ fprintf(stderr, "JACK input not compiled in\n");
+ exit(1);
+#endif
}
else if (glopts.input_select == INPUT_SELECT_WAV) {
if (!strcmp (inPath, "-")) {