Codebase list squeezelite / 4afbecb
support ffmpeg on osx, fix osx makefile to avoid always enabling resampling Adrian Smith 10 years ago
3 changed file(s) with 12 addition(s) and 11 deletion(s). Raw diff Collapse all Expand all
00 # OSX build - adjust -I to point to header files for codecs and portaudio
1 CFLAGS = -arch x86_64 -arch i386 -Wall -fPIC -O2 -I./include -DRESAMPLE
1 CFLAGS = -arch x86_64 -arch i386 -Wall -fPIC -O2 -I./include $(OPTS)
22 LDFLAGS = -arch x86_64 -arch i386 -lpthread libportaudio.a -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework Carbon
33
44 EXECUTABLE ?= squeezelite-osx
2323
2424 #include <libavformat/avformat.h>
2525 #include <libavcodec/avcodec.h>
26
27 #define LIBAVUTIL "libavutil.so"
28 #define LIBAVCODEC "libavcodec.so"
29 #define LIBAVFORMAT "libavformat.so"
30
3126
3227 #define READ_SIZE 4096 * 4 // this is large enough to ensure ffmpeg always gets new data when decode is called
3328 #define WRITE_SIZE 256 * 1024 // FIXME - make smaller, but still to absorb max wma output
564559
565560 // we try to load the ffmpeg library version which matches the header file we are compiled with as structs differ between versions
566561
567 sprintf(name, "%s.%d", LIBAVCODEC, LIBAVCODEC_VERSION_MAJOR);
562 sprintf(name, LIBAVCODEC, LIBAVCODEC_VERSION_MAJOR);
568563 handle_codec = dlopen(name, RTLD_NOW);
569564 if (!handle_codec) {
570565 LOG_INFO("dlerror: %s", dlerror());
571566 return false;
572567 }
573568
574 sprintf(name, "%s.%d", LIBAVFORMAT, LIBAVFORMAT_VERSION_MAJOR);
569 sprintf(name, LIBAVFORMAT, LIBAVFORMAT_VERSION_MAJOR);
575570 handle_format = dlopen(name, RTLD_NOW);
576571 if (!handle_format) {
577572 LOG_INFO("dlerror: %s", dlerror());
578573 return false;
579574 }
580575
581 sprintf(name, "%s.%d", LIBAVUTIL, LIBAVUTIL_VERSION_MAJOR);
576 sprintf(name, LIBAVUTIL, LIBAVUTIL_VERSION_MAJOR);
582577 handle_util = dlopen(name, RTLD_NOW);
583578 if (!handle_util) {
584579 LOG_INFO("dlerror: %s", dlerror());
7171 #define PROCESS 0
7272 #endif
7373
74 #if LINUX && defined(FFMPEG)
74 #if defined(FFMPEG) && !WIN
7575 #undef FFMPEG
76 #define FFMPEG 1 // ffmpeg only supported on linux at present
76 #define FFMPEG 1
7777 #else
7878 #undef FFMPEG
7979 #define FFMPEG 0
8787 #define LIBVORBIS "libvorbisfile.so.3"
8888 #define LIBTREMOR "libvorbisidec.so.1"
8989 #define LIBFAAD "libfaad.so.2"
90 #define LIBAVUTIL "libavutil.so.%d"
91 #define LIBAVCODEC "libavcodec.so.%d"
92 #define LIBAVFORMAT "libavformat.so.%d"
9093 #endif
9194
9295 #if OSX
9699 #define LIBVORBIS "libvorbisfile.3.dylib"
97100 #define LIBTREMOR "libvorbisidec.1.dylib"
98101 #define LIBFAAD "libfaad.2.dylib"
102 #define LIBAVUTIL "libavutil.%d.dylib"
103 #define LIBAVCODEC "libavcodec.%d.dylib"
104 #define LIBAVFORMAT "libavformat.%d.dylib"
99105 #endif
100106
101107 #if WIN