support ffmpeg on osx, fix osx makefile to avoid always enabling resampling
Adrian Smith
10 years ago
0 | 0 | # 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) | |
2 | 2 | LDFLAGS = -arch x86_64 -arch i386 -lpthread libportaudio.a -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework Carbon |
3 | 3 | |
4 | 4 | EXECUTABLE ?= squeezelite-osx |
23 | 23 | |
24 | 24 | #include <libavformat/avformat.h> |
25 | 25 | #include <libavcodec/avcodec.h> |
26 | ||
27 | #define LIBAVUTIL "libavutil.so" | |
28 | #define LIBAVCODEC "libavcodec.so" | |
29 | #define LIBAVFORMAT "libavformat.so" | |
30 | ||
31 | 26 | |
32 | 27 | #define READ_SIZE 4096 * 4 // this is large enough to ensure ffmpeg always gets new data when decode is called |
33 | 28 | #define WRITE_SIZE 256 * 1024 // FIXME - make smaller, but still to absorb max wma output |
564 | 559 | |
565 | 560 | // we try to load the ffmpeg library version which matches the header file we are compiled with as structs differ between versions |
566 | 561 | |
567 | sprintf(name, "%s.%d", LIBAVCODEC, LIBAVCODEC_VERSION_MAJOR); | |
562 | sprintf(name, LIBAVCODEC, LIBAVCODEC_VERSION_MAJOR); | |
568 | 563 | handle_codec = dlopen(name, RTLD_NOW); |
569 | 564 | if (!handle_codec) { |
570 | 565 | LOG_INFO("dlerror: %s", dlerror()); |
571 | 566 | return false; |
572 | 567 | } |
573 | 568 | |
574 | sprintf(name, "%s.%d", LIBAVFORMAT, LIBAVFORMAT_VERSION_MAJOR); | |
569 | sprintf(name, LIBAVFORMAT, LIBAVFORMAT_VERSION_MAJOR); | |
575 | 570 | handle_format = dlopen(name, RTLD_NOW); |
576 | 571 | if (!handle_format) { |
577 | 572 | LOG_INFO("dlerror: %s", dlerror()); |
578 | 573 | return false; |
579 | 574 | } |
580 | 575 | |
581 | sprintf(name, "%s.%d", LIBAVUTIL, LIBAVUTIL_VERSION_MAJOR); | |
576 | sprintf(name, LIBAVUTIL, LIBAVUTIL_VERSION_MAJOR); | |
582 | 577 | handle_util = dlopen(name, RTLD_NOW); |
583 | 578 | if (!handle_util) { |
584 | 579 | LOG_INFO("dlerror: %s", dlerror()); |
71 | 71 | #define PROCESS 0 |
72 | 72 | #endif |
73 | 73 | |
74 | #if LINUX && defined(FFMPEG) | |
74 | #if defined(FFMPEG) && !WIN | |
75 | 75 | #undef FFMPEG |
76 | #define FFMPEG 1 // ffmpeg only supported on linux at present | |
76 | #define FFMPEG 1 | |
77 | 77 | #else |
78 | 78 | #undef FFMPEG |
79 | 79 | #define FFMPEG 0 |
87 | 87 | #define LIBVORBIS "libvorbisfile.so.3" |
88 | 88 | #define LIBTREMOR "libvorbisidec.so.1" |
89 | 89 | #define LIBFAAD "libfaad.so.2" |
90 | #define LIBAVUTIL "libavutil.so.%d" | |
91 | #define LIBAVCODEC "libavcodec.so.%d" | |
92 | #define LIBAVFORMAT "libavformat.so.%d" | |
90 | 93 | #endif |
91 | 94 | |
92 | 95 | #if OSX |
96 | 99 | #define LIBVORBIS "libvorbisfile.3.dylib" |
97 | 100 | #define LIBTREMOR "libvorbisidec.1.dylib" |
98 | 101 | #define LIBFAAD "libfaad.2.dylib" |
102 | #define LIBAVUTIL "libavutil.%d.dylib" | |
103 | #define LIBAVCODEC "libavcodec.%d.dylib" | |
104 | #define LIBAVFORMAT "libavformat.%d.dylib" | |
99 | 105 | #endif |
100 | 106 | |
101 | 107 | #if WIN |