diff options
author | Bill <waywardgeek@gmail.com> | 2013-09-10 14:18:47 -0700 |
---|---|---|
committer | Bill <waywardgeek@gmail.com> | 2013-09-10 14:18:47 -0700 |
commit | 55e0289b675212a472b3fae9e8d0208ab0b52acb (patch) | |
tree | 5b771980e3696d4f656de8093266ee06583fc1ea | |
parent | 524a0ac35590a0cd552e77e91e84f3c3fb0dd3fc (diff) | |
parent | 72ae545d51c561613f57cf87e05016179042e87a (diff) | |
download | sonic-55e0289b675212a472b3fae9e8d0208ab0b52acb.tar.gz |
Merge pull request #1 from mattalbright/master
Fixes for ffmpeg and Mac OSX
-rw-r--r-- | Makefile | 7 | ||||
-rw-r--r-- | wave.c | 7 |
2 files changed, 11 insertions, 3 deletions
@@ -2,6 +2,11 @@ # safe. We call malloc, and older Linux versions only linked in the thread-safe # malloc if -pthread is specified. +SONAME=soname +UNAME := $(shell uname) +ifeq ($(UNAME), Darwin) + SONAME=install_name +endif CFLAGS=-Wall -g -ansi -fPIC -pthread #CFLAGS=-Wall -O2 -ansi -fPIC -pthread LIB_TAG=0.1.18 @@ -24,7 +29,7 @@ main.o: main.c sonic.h wave.h $(CC) $(CFLAGS) -c main.c libsonic.so.$(LIB_TAG): sonic.o - $(CC) $(CFLAGS) -shared -Wl,-soname,libsonic.so.0 sonic.o -o libsonic.so.$(LIB_TAG) + $(CC) $(CFLAGS) -shared -Wl,-$(SONAME),libsonic.so.0 sonic.o -o libsonic.so.$(LIB_TAG) ln -sf libsonic.so.$(LIB_TAG) libsonic.so ln -sf libsonic.so.$(LIB_TAG) libsonic.so.0 @@ -208,8 +208,8 @@ static int readHeader( data = readInt(file); /* 04 - how big is the rest of this file? */ expectString(file, "WAVE"); /* 08 - WAVE */ expectString(file, "fmt "); /* 12 - fmt */ - data = readInt(file); /* 16 - size of this chunk */ - if(data != 16) { + int chunkSize = readInt(file); /* 16 or 18 - size of this chunk */ + if(chunkSize != 16 && chunkSize != 18) { fprintf(stderr, "Only basic wave files are supported\n"); return 0; } @@ -227,6 +227,9 @@ static int readHeader( fprintf(stderr, "Only 16 bit PCM wave files are supported\n"); return 0; } + if (chunkSize == 18) { /* ffmpeg writes 18, and so has 2 extra bytes here */ + data = readShort(file); + } expectString(file, "data"); /* 36 - data */ readInt(file); /* 40 - how big is this data chunk */ return 1; |