aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2015-07-22 20:37:58 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2015-07-22 20:37:58 +0200
commit146795d6862680b7cb5e57fc72e9e18e1d47d2d3 (patch)
tree16501a28a956c5c628617ac5a45819b523337fa0
parent747dd3237e3a1051978022d275132aca951734a4 (diff)
downloadtoolame-dab-146795d6862680b7cb5e57fc72e9e18e1d47d2d3.tar.gz
toolame-dab-146795d6862680b7cb5e57fc72e9e18e1d47d2d3.tar.bz2
toolame-dab-146795d6862680b7cb5e57fc72e9e18e1d47d2d3.zip
Add compile-time option for libvlc input
-rw-r--r--Makefile14
-rw-r--r--audio_read.c4
-rw-r--r--toolame.c11
-rw-r--r--vlc_input.c4
-rw-r--r--vlc_input.h5
5 files changed, 35 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 575e60a..cdaaebd 100644
--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,5 @@
+# Set this to 0 to disable compiling the libvlc input
+ENABLE_INPUT_VLC=1
CC = gcc
@@ -75,8 +77,16 @@ PG = -g -fomit-frame-pointer
# Optimize flag.
OPTIM = -O2
+ifeq (${ENABLE_INPUT_VLC},1)
+ VLC_CFLAGS=-DVLC_INPUT
+ VLC_LDFLAGS=-lvlc
+else
+ VLC_CFLAGS=
+ VLC_LDFLAGS=
+endif
+
# These flags are pretty much mandatory
-REQUIRED = -DINLINE= ${GIT_VER}
+REQUIRED = -DINLINE= ${GIT_VER} ${VLC_CFLAGS}
#pick your architecture
ARCH = -march=native
@@ -102,7 +112,7 @@ CC_SWITCHES = $(OPTIM) $(REQUIRED) $(ARCH) $(PG) $(TWEAKS) $(WARNINGS) $(NEW_02L
PGM = toolame
-LIBS = -lm -lzmq -ljack -lpthread -lvlc
+LIBS = -lm -lzmq -ljack -lpthread ${VLC_LDFLAGS}
#nick burch's OS/2 fix gagravarr@SoftHome.net
UNAME = $(shell uname)
diff --git a/audio_read.c b/audio_read.c
index 0556f13..ca1e603 100644
--- a/audio_read.c
+++ b/audio_read.c
@@ -237,6 +237,7 @@ unsigned long read_samples (music_in_t* musicin, short sample_buffer[2304],
fprintf (stderr, "Hit end of WAV audio data\n");
}
else if (glopts.input_select == INPUT_SELECT_VLC) {
+#if defined(VLC_INPUT)
ssize_t bytes_read = vlc_in_read(sample_buffer, sizeof(short) * (int)samples_read);
if (bytes_read == -1) {
fprintf (stderr, "VLC input error\n");
@@ -245,6 +246,9 @@ unsigned long read_samples (music_in_t* musicin, short sample_buffer[2304],
else {
samples_read = bytes_read / sizeof(short);
}
+#else
+ samples_read = 0;
+#endif
}
/*
diff --git a/toolame.c b/toolame.c
index 18335e3..d94d7fd 100644
--- a/toolame.c
+++ b/toolame.c
@@ -513,9 +513,11 @@ int main (int argc, char **argv)
putbits (&bs, 0, 16); // FPAD is all-zero
}
+#if defined(VLC_INPUT)
if (glopts.input_select == INPUT_SELECT_VLC) {
vlc_in_write_icy();
}
+#endif
frameBits = sstell (&bs) - sentBits;
@@ -665,7 +667,11 @@ void usage (void)
fprintf (stdout, "\t-x force byte-swapping of input\n");
fprintf (stdout, "\t-g swap channels of input file\n");
fprintf (stdout, "\t-j use jack input\n");
+#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");
@@ -1064,10 +1070,15 @@ void parse_args (int argc, char **argv, frame_info * frame, int *psy,
}
*num_samples = MAX_U_32_NUM;
int channels = (header->mode == MPG_MD_MONO) ? 1 : 2;
+#if defined(VLC_INPUT)
if (vlc_in_prepare(glopts.verbosity, samplerate, inPath, channels, *icy_file) != 0) {
fprintf(stderr, "VLC initialisation failed\n");
exit(1);
}
+#else
+ fprintf(stderr, "VLC input not compiled in\n");
+ exit(1);
+#endif
}
else {
fprintf(stderr, "INVALID INPUT\n");
diff --git a/vlc_input.c b/vlc_input.c
index 20467ef..c669d6a 100644
--- a/vlc_input.c
+++ b/vlc_input.c
@@ -8,6 +8,8 @@
#include <stdio.h>
#include "vlc_input.h"
+#if defined(VLC_INPUT)
+
int check_vlc_uses_size_t();
struct vlc_buffer* vlc_buffer_new();
void vlc_buffer_free(struct vlc_buffer* node);
@@ -423,3 +425,5 @@ int check_vlc_uses_size_t()
return retval;
}
+#endif // defined(VLC_INPUT)
+
diff --git a/vlc_input.h b/vlc_input.h
index fa5d82b..f2b78c6 100644
--- a/vlc_input.h
+++ b/vlc_input.h
@@ -1,6 +1,8 @@
#ifndef __VLC_INPUT_H_
#define __VLC_INPUT_H_
+# if defined(VLC_INPUT)
+
#include <stdint.h>
#include <vlc/vlc.h>
@@ -25,5 +27,6 @@ ssize_t vlc_in_read(void *buf, size_t len);
void vlc_in_write_icy(void);
-#endif
+# endif // VLC_INPUT
+#endif // __VLC_INPUT_H_