Cleaned up compile of airplay, use 'make HAS_EXPAT=1' to

enable metadata interface of airplayStream (Shairport-sync).
This commit is contained in:
Frafall 2017-12-05 07:38:43 +01:00
parent 4583c90be4
commit fdcdf8e350
2 changed files with 16 additions and 5 deletions

View file

@ -38,7 +38,6 @@ CXXFLAGS += $(ADD_CFLAGS) -std=c++0x -Wall -Wno-unused-function $(DEBUG) -DASIO_
LDFLAGS = -lvorbis -lvorbisenc -logg -lFLAC
OBJ = snapServer.o config.o controlServer.o controlSession.o streamServer.o streamSession.o streamreader/streamUri.o streamreader/streamManager.o streamreader/pcmStream.o streamreader/pipeStream.o streamreader/fileStream.o streamreader/processStream.o streamreader/airplayStream.o streamreader/spotifyStream.o streamreader/watchdog.o encoder/encoderFactory.o encoder/flacEncoder.o encoder/pcmEncoder.o encoder/oggEncoder.o ../common/sampleFormat.o ../message/pcmChunk.o ../externals/jsonrpcpp/lib/jsonrp.o ../common/base64.o
ifneq (,$(TARGET))
CXXFLAGS += -D$(TARGET)
endif
@ -81,12 +80,17 @@ else
CXX = g++
STRIP = strip
CXXFLAGS += -DHAS_AVAHI -DHAS_DAEMON -DHAS_EXPAT -pthread
LDFLAGS = -lrt -lexpat -lvorbis -lvorbisenc -logg -lFLAC -lavahi-client -lavahi-common -static-libgcc -static-libstdc++
CXXFLAGS += -DHAS_AVAHI -DHAS_DAEMON -pthread
LDFLAGS = -lrt -lvorbis -lvorbisenc -logg -lFLAC -lavahi-client -lavahi-common -static-libgcc -static-libstdc++
OBJ += ../common/daemon.o publishZeroConf/publishAvahi.o
endif
ifdef HAS_EXPAT
CXXFLAGS += -DHAS_EXPAT
LDFLAGS += -lexpat
endif
all: $(BIN)

View file

@ -46,7 +46,7 @@ AirplayStream::AirplayStream(PcmListener* pcmListener, const StreamUri& uri) : P
logStderr_ = true;
pipePath_ = "/tmp/shairmeta." + to_string(getpid());
cout << "Pipe [" << pipePath_ << "]\n";
//cout << "Pipe [" << pipePath_ << "]\n";
// XXX: Check if pipe exists, delete or throw error
@ -67,10 +67,13 @@ AirplayStream::AirplayStream(PcmListener* pcmListener, const StreamUri& uri) : P
AirplayStream::~AirplayStream()
{
#ifdef HAS_EXPAT
parse(string("</metatags>"));
XML_ParserFree(parser_);
#endif
}
#ifdef HAS_EXPAT
int AirplayStream::parse(string line)
{
enum XML_Status result;
@ -112,11 +115,13 @@ void AirplayStream::push()
setMeta(jtag_);
}
}
#endif
void AirplayStream::pipeReader()
{
#ifdef HAS_EXPAT
createParser();
#endif
while(true)
{
@ -126,7 +131,9 @@ void AirplayStream::pipeReader()
string line;
while(getline(pipe, line)){
#ifdef HAS_EXPAT
parse(line);
#endif
}
}