gstreamer under OS X

I’ve been enjoying oF (007) greatly for the last few weeks! In the last 24 hours however, I’ve hit a brick wall attempting to get gstreamer to work under OS X. Any and all advice would be most appreciated. I’ve managed to get all of the needed libs and includes installed and have referenced them my project’s header / library search paths. For anyone interested in getting streamer installed, as mentioned elsewhere I suggest David Liu’s gstreamer binary installer:

http://itee.uq.edu.au/~davel/gstreamer/

When I compile currently, I’m getting undefined symbol errors:

  
Undefined symbols for architecture i386:  
  "_g_main_loop_new", referenced from:  
      ofGstVideoPlayer::loadMovie(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)in openFrameworksDebug.a(ofGstVideoPlayer.o)  
  "_gst_app_sink_get_type", referenced from:  
      ofGstVideoPlayer::loadMovie(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)in openFrameworksDebug.a(ofGstVideoPlayer.o)  
      on_new_buffer_from_source(_GstAppSink*, void*) in openFrameworksDebug.a(ofGstUtils.o)  
      on_new_preroll_from_source(_GstAppSink*, void*) in openFrameworksDebug.a(ofGstUtils.o)  
      ofGstVideoUtils::update()      in openFrameworksDebug.a(ofGstUtils.o)  
      ofGstUtils::getIsMovieDone()       in openFrameworksDebug.a(ofGstUtils.o)  
      ofGstUtils::startPipeline()       in openFrameworksDebug.a(ofGstUtils.o)  
      appsink_plugin_init(_GstPlugin*)       in openFrameworksDebug.a(ofGstUtils.o)  
      ...  

I’m at a loss as to where to turn next. Do any OS X gstreamer or oF veterans have some sage advice? I have no problem creating my own projects or compiling examples.

Thanks much!

make sure that you are linking against the 32bits versions of the libraries since OF is compiled for 32bits

Thanks very much for the reply arturo! It looks to me that the linker is in fact linking against the 32 bit libs, which is why I’m confused:

Ld bin/moviePlayerExampleDebug.app/Contents/MacOS/moviePlayerExampleDebug normal i386
cd /Users/mike/Projects/of_preRelease_v007_osx/apps/examples/_moviePlayerExample
setenv MACOSX_DEPLOYMENT_TARGET 10.6
/Developer/usr/bin/llvm-g+±4.2 -arch i386 -isysroot /Developer/SDKs/MacOSX10.6.sdk -L/Users/mike/Projects/of_preRelease_v007_osx/apps/examples/_moviePlayerExample/bin -L/System/Library/Frameworks/GStreamer.framework/Versions/0.10-i386/lib/gstreamer-0.10 -L/System/Library/Frameworks/GStreamer.framework/Versions/0.10-i386/lib -F/Users/mike/Projects/of_preRelease_v007_osx/apps/examples/_moviePlayerExample/bin -F/Users/mike/Projects/of_preRelease_v007_osx/apps/examples/_moviePlayerExample/…/…/…/libs/glut/lib/osx -filelist /Users/mike/Library/Developer/Xcode/DerivedData/moviePlayerExample-cholgxvodtdzsldunacyyquhzvdg/Build/Intermediates/moviePlayerExample.build/Debug/moviePlayerExample.build/Objects-normal/i386/moviePlayerExampleDebug.LinkFileList -mmacosx-version-min=10.6 -dead_strip …/…/…/libs/poco/lib/osx/PocoFoundation.a …/…/…/libs/poco/lib/osx/PocoNet.a …/…/…/libs/poco/lib/osx/PocoXML.a …/…/…/libs/poco/lib/osx/PocoUtil.a …/…/…/libs/tess2/lib/osx/tess2.a …/…/…/libs/glew/lib/osx/glew.a …/…/…/libs/cairo/lib/osx/cairo-script-interpreter.a …/…/…/libs/cairo/lib/osx/cairo.a …/…/…/libs/cairo/lib/osx/pixman-1.a …/…/…/libs/fmodex/lib/osx/libfmodex.dylib …/…/…/libs/rtAudio/lib/osx/rtAudio.a -framework GLUT /Users/mike/Projects/of_preRelease_v007_osx/libs/openFrameworksCompiled/lib/osx/openFrameworksDebug.a -framework AGL -framework ApplicationServices -framework AudioToolbox -framework Carbon -framework CoreAudio -framework CoreFoundation -framework CoreServices -framework OpenGL -framework QuickTime -framework AppKit -framework Cocoa -framework IOKit -o /Users/mike/Projects/of_preRelease_v007_osx/apps/examples/_moviePlayerExample/bin/moviePlayerExampleDebug.app/Contents/MacOS/moviePlayerExampleDebug

I thought perhaps the gstreamer libs and includes needed to exist in the oF libs folder specifically for some reason, but that didn’t make any difference. Any other ideas would be most appreciated!

As soon as I get this working, I’ll do a short writeup for everyone on getting gstreamer working under OS X.

mmh, from that command it seems like it’s adding the directory to the library search path for ld but not actually linking against the libraries, its missing -lgstreamer-0.10 …

have you added the libraries to the project?

Hi,

I’ve also been trying for weeks to use gstreamer with OF007 and Xcode 3.2.4, with no luck.

I’ve linked to all the library successfully, well apparently, no gst.h not found error.

I add to the project the four header search path :

/opt/local/lib/gstreamer-0.10
/opt/local/include/libxml2/
/opt/local/include/glib-2.0/
/opt/local/lib/glib-2.0/include/
/opt/local/include/gstreamer-0.10/

To use it I call in testApp.h

  
#include "ofGstUtils.h"  

and then in class testApp : public ofBaseApp

  
ofGstVideoUtils gst3;  
void  gst_plugin_list_free (GList *list);  
string pipeurl, pipeParam;  

Then in my testApp.cpp

In the setup()

  
ofGstVideoUtils *gst3 = new ofGstVideoUtils();  
  
height  = (int)(gst3->getHeight());  
width   = (int)(gst3->getWidth());  
  
bool allocated = (bool)(gst3->setPipeline(pipeParam,bppurl,isStreamurl));  
  
  

In the update()

  
  
bNewFrame = (bool)(gst3->isFrameNew());  
liveImg.setFromPixels(gst3->getPixels(),width,height);  

Well I get this error :

Undefined symbols:
“ofGstVideoUtils::getPixels()”, referenced from:
testApp::update() in testApp.o
“ofGstVideoUtils::getHeight()”, referenced from:
testApp::setup() in testApp.o
“ofGstVideoUtils::isFrameNew()”, referenced from:
testApp::update() in testApp.o
“ofGstVideoUtils::setPipeline(std::basic_string<char, std::char_traits, std::allocator >, int, bool, int, int)”, referenced from:
testApp::setup() in testApp.o
“ofGstVideoUtils::ofGstVideoUtils()”, referenced from:
testApp::testApp()in main.o
testApp::setup() in testApp.o
“ofGstVideoUtils::~ofGstVideoUtils()”, referenced from:
testApp::testApp()in main.o
testApp::~testApp()in testApp.o
testApp::~testApp()in testApp.o
testApp::~testApp()in testApp.o
testApp::~testApp()in testApp.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

I also try in my testApp.cpp :

In the setup()

  
 /* ofGstVideoUtils *gst3 = new ofGstVideoUtils(); */  
  
height  = (int)(gst3.getHeight());  
width   = (int)(gst3.getWidth());  
  
bool allocated = (bool)(gst3.setPipeline(pipeParam,bppurl,isStreamurl));  
  
  

In the update()

  
  
bNewFrame = (bool)(gst3.isFrameNew());  
liveImg.setFromPixels(gst3.getPixels(),width,height);  

And got exactly the same error.

Apparently I don’t call ofGstVideoUtils() properly

Any help is welcome, thanks in advance.

I’m trying to link to the 0.10.29 binaries posted here: http://itee.uq.edu.au/~davel/gstreamer/

I got to the same point you did, and realized that you need to build the openframework libs from source - so that ofGstUtils.h and cpp get compiled in the project. OF 0070 has the framework as lib that you include, but this does not include the one for linux I guess.

Now I’m not finding symbols such as:

  
    
"_gst_element_query_duration", referenced from:  
      ofGstUtils::gstHandleMessage()       in ofGstUtils.o  
  "_gst_message_parse_state_changed", referenced from:  
      ofGstUtils::gstHandleMessage()       in ofGstUtils.o  
  "_gst_message_parse_error", referenced from  
      ofGstUtils::gstHandleMessage()       in ofGstUtils.o  
  "_g_type_check_instance_cast", referenced from:  
      on_new_preroll_from_source(_GstAppSink*, void*) in ofGstUtils.o  
      on_new_buffer_from_source(_GstAppSink*, void*) in ofGstUtils.o  
  

So now I’m having problems linking to the libraries, which I don’t understand because I include the search path in Library Search Path: “/System/Library/Frameworks/GStreamer.framework/Versions/0.10.29-i386/lib”

If I link to the .a files directly the number of errors increases and decreases - but all the methods are private methods - so there is some mismatch between the headers and their corresponding libs that I’m missing.

hope it helps - Arturo, any thoughts?