[FFmpeg-devel] FFmpeg for Mac
Vitor Sessak
vitor1001
Wed May 20 20:20:53 CEST 2009
Neal Krawetz wrote:
> Hi folks,
>
> I managed to port FFMpeg to Macs as a Universal Binary (runs on both ppc
> and x86 architectures). There were a couple of changes that I needed
> to make in order for this work.
>
> I've tested this on the x86 architecture. It compiles for a PPC, but I
> have not tested it yet. I suspect that it will fail because the ENDIAN
> is hard-coded in config.h.
>
> Anyway, here is my notes of things I needed to change for porting to the Mac:
>
> * Install ffmpeg.
> Unforutnately, ffmpeg does not support universal binaries and configure
> does not set all of the configuration variables correctly. So we will
> force it.
> Edit libavformat/framehook.c and comment out the header check:
> // #if HAVE_DLFCN_H
> #include <dlfcn.h>
> // #endif
> This header DOES exist when Xcode for MacOSX 10.5 is installed.
Interesting. Is the configure check for this header failing (note that
our configure script is hand-made, not autotools-generated mess, so it
should be very easy to debug)?
> Edit libavformat/rtpproto.c and comment out the header check:
> // #if HAVE_SYS_SELECT_H
> #include <sys/select.h>
> // #endif
> Edit ffserver.c and comment out the header check:
> // #if HAVE_DLFCN_H
> #include <dlfcn.h>
> // #endif
Same thing.
> Now compile:
> CFLAGS='-arch ppc -arch i386' ./configure --arch=x86
> CFLAGS='-arch ppc -arch i386' ./configure --arch=x86
> # Yes: Run configure twice! There is a permissions problem for config.h.
> make
> sudo make install
> This will install into /usr/local/.
>
>
> As far as the endian issue goes, have you considered using a global
> variable that sets the endian? This would simplify portability.
> Here's what my code (Piana) does since I have this same issue:
This is not possible for speed reasons. FFmpeg is full of very speed
critical code like
for (i=0; i < frame_size; i++)
out[i] = table[bytestream_read_le32(&in)];
where the implementation of bytestream_read_le32 is endianness dependent
(and we cannot afford an extra if()). There is much more code like this
(all bytestream readers, bitstream readers, scalers, etc).
-Vitor
More information about the ffmpeg-devel
mailing list