wiki:GstreamerMac

 Visit forum
 Forum search "GstreamerMac"
 Discuss "GstreamerMac"

How to build GStreamer on Mac OS/X PPC

Goals:

  1. Get GStreamer to stream a video on native OS/X GUI (i.e., no XWindows). (This page, well in the future)
  1. Do this using the Python bindings. (GstreamerMacPython page)
  1. Do this in combination with wxPython. (GstreamerMacwxPython? page)
  1. Use the Dirac video codec. (SchrodingerMac? page)

The native OS/X audio/video plugins are in the CVS version of gst-plugins-good. Due to depedencies, this means we have to build the rest from CVS as well. I checked out on 2006/11/02. The patches may not work on other versions.

  1. Install libogg, libogg-shlibs, libvorbis0, libvorbis0-shlibs, glib2 2.12.0 and bison >= 1.35 using fink
    • I installed esound too; future will tell if it will be used
  1. Download, build and install liboil ( http://liboil.freedesktop.org/download/liboil-0.3.8.tar.gz)
    • To use liboil > 0.3.8, you need this patch:
      --- liboil-0.3.9/liboil/liboilcpu.c	2006-05-22 20:07:56.000000000 -0400
      +++ liboil-0.3.9-new/liboil/liboilcpu.c	2006-07-02 22:23:35.000000000 -0400
      @@ -42,7 +42,7 @@
       #include <sys/time.h>
       #include <time.h>
       
      -#if defined(__FreeBSD__)
      +#if defined(__FreeBSD__) || defined(__APPLE__)
       #include <sys/types.h>
       #include <sys/sysctl.h>
       #endif
      @@ -587,25 +587,17 @@
       }
       
       static void
      -test_altivec (void * ignored)
      -{
      -  char x[16] = { 0, };
      -
      -  asm volatile (
      -      "  lvx %%v0, %0, %%r0  
      "
      -      :: "r" (x));
      -}
      -
      -static void
       oil_cpu_detect_powerpc(void)
       {
      +  int sels[2] = { CTL_HW, HW_VECTORUNIT };
      +  int vType = 0; //0 == scalar only
      +  size_t length = sizeof(vType);
      +  int error = sysctl(sels, 2, &vType, &length, NULL, 0);
       
      -  oil_cpu_fault_check_enable ();
      -  if (oil_cpu_fault_check_try(test_altivec, NULL)) {
      +  if ( 0 == error ) {
           OIL_DEBUG ("cpu flag altivec");
           oil_cpu_flags |= OIL_IMPL_FLAG_ALTIVEC;
         }
      -  oil_cpu_fault_check_disable ();
       
         _oil_profile_stamp = oil_profile_stamp_tb;
       }
      
  1. Download, build and install gstreamer from CVS:
    cvs -d:pserver:anoncvs@anoncvs.freedesktop.org:/cvs/gstreamer co gstreamer
    cd gstreamer
    PKG_CONFIG_PATH=/usr/local/lib/pkgconfig ./autogen.sh
    make
    make install
    
  1. Download, build and install gst-plugins-base from CVS:
    cvs -d:pserver:anoncvs@anoncvs.freedesktop.org:/cvs/gstreamer co gst-plugins-base
    cd gst-plugins-base
    PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/sw/lib/pkgconfig ./autogen.sh
    make
    make install
    
  1. Download, build and install gst-plugins-good from CVS:
    cvs -d:pserver:anoncvs@anoncvs.freedesktop.org:/cvs/gstreamer co gst-plugins-good
    cd gst-plugins-good
    echo '
    Index: sys/Makefile.am
    ===================================================================
    RCS file: /cvs/gstreamer/gst-plugins-good/sys/Makefile.am,v
    retrieving revision 1.35
    diff -r1.35 Makefile.am
    67c67
    < SUBDIRS=$(OSS_DIR) $(SUNAUDIO_DIR) $(V4L2_DIR) $(XIMAGE_DIR)
    ---
    > SUBDIRS=$(OSS_DIR) $(SUNAUDIO_DIR) $(V4L2_DIR) $(XIMAGE_DIR) osxaudio osxvideo
    69c69
    < DIST_SUBDIRS=oss sunaudio v4l2 ximage
    ---
    > DIST_SUBDIRS=oss sunaudio v4l2 ximage osxaudio osxvideo
    Index: sys/osxaudio/gstosxringbuffer.c
    ===================================================================
    RCS file: /cvs/gstreamer/gst-plugins-good/sys/osxaudio/gstosxringbuffer.c,v
    retrieving revision 1.1
    diff -r1.1 gstosxringbuffer.c
    158c158
    <   GST_DEBUG ("AudioHardwareGetProperty: device_id is %d
    ",
    ---
    >   GST_DEBUG ("AudioHardwareGetProperty: device_id is %ld
    ",
    241c241
    <   GST_DEBUG ("osx ring buffer start ioproc: 0x%x device_id %d
    ",
    ---
    >   GST_DEBUG ("osx ring buffer start ioproc: 0x%p device_id %ld
    ",
    Index: sys/osxaudio/gstosxaudiosink.c
    ===================================================================
    RCS file: /cvs/gstreamer/gst-plugins-good/sys/osxaudio/gstosxaudiosink.c,v
    retrieving revision 1.11
    diff -r1.11 gstosxaudiosink.c
    189c189
    <   gst_osx_audio_sink_create_ringbuffer (sink);
    ---
    >   gst_osx_audio_sink_create_ringbuffer ((GstBaseAudioSink *)sink);
    254c254
    <       ("Getting available sample rates: Status: %d number of ranges: %d
    ",
    ---
    >       ("Getting available sample rates: Status: %ld number of ranges: %ld
    ",
    274c274
    <     GST_DEBUG ("osx sink 0x%x element 0x%x  ioproc 0x%x
    ", osxsink,
    ---
    >     GST_DEBUG ("osx sink 0x%p element 0x%p  ioproc 0x%p
    ", osxsink,
    Index: sys/osxaudio/gstosxaudiosrc.c
    ===================================================================
    RCS file: /cvs/gstreamer/gst-plugins-good/sys/osxaudio/gstosxaudiosrc.c,v
    retrieving revision 1.9
    diff -r1.9 gstosxaudiosrc.c
    238c238
    <     GST_DEBUG ("osx src 0x%x element 0x%x  ioproc 0x%x
    ", osxsrc,
    ---
    >     GST_DEBUG ("osx src 0x%p element 0x%p  ioproc 0x%p
    ", osxsrc,
    
    ' | patch -p0
    PKG_CONFIG_PATH=/usr/local/lib/pkgconfig ./autogen.sh
    cd sys/osxaudio
    make
    make install
    

Now, audio works! To test, run:

gst-launch audiotestsrc ! audioconvert ! audioresample ! osxaudiosink
  1. Download, build and install gst-ffmpeg from CVS:
    cvs -d:pserver:anoncvs@anoncvs.freedesktop.org:/cvs/gstreamer co gst-ffmpeg
    cd gst-ffmpeg
    PKG_CONFIG_PATH=/usr/local/lib/pkgconfig ./autogen.sh
    cd gst-libs/ext/ffmpeg
    ./configure --prefix=/usr/local --enable-maintainer-mode --enable-gtk-doc --disable-v4l --disable-audio-oss --disable-dv1394 --disable-vhook --disable-ffmpeg --disable-ffserver --disable-ffplay --disable-sdltest --enable-pp --cache-file=/dev/null --srcdir=. --disable-altivec
    cd ../../..
    make
    make install
    

The manual ./configure is needed to disable AltiVec, because ffmpeg refuses to compile with it enabled.