How add the PiCamera module MMAL code to an OF project?

I’m trying to add code from a non OF c++ project to an OF project and I’m trying to use the MMAL interface to control the Pi Camera.

I’ve created a blank project which compiles fine on it’s own, then copied the interface folder in the OF project’s src folder.The problem is I’m getting quite a lot of errors:

In file included from /usr/include/stdlib.h:43:0,
                 from ./src/interface/vcos/pthreads/vcos_platform.h:59,
                 from /opt/vc/include/interface/vcos/vcos.h:116,
                 from /opt/vc/include/interface/vmcs_host/vc_dispmanx.h:33,
                 from /opt/vc/include/bcm_host.h:46,
                 from ../../../libs/openFrameworks/utils/ofConstants.h:160,
                 from ../../../libs/openFrameworks/ofMain.h:5,
                 from src/testApp.h:3,
                 from src/testApp.cpp:1:
/usr/include/arm-linux-gnueabihf/bits/waitstatus.h:80:27: error: declaration of \u2018unsigned int wait::<anonymous struct>::__w_retcode\u2019
/usr/include/arm-linux-gnueabihf/bits/waitstatus.h:75:27: error: conflicts with previous declaration \u2018unsigned int wait::<anonymous struct>::__w_retcode\u2019
/usr/include/arm-linux-gnueabihf/bits/waitstatus.h:81:28: error: declaration of \u2018unsigned int wait::<anonymous struct>::__w_coredump\u2019
/usr/include/arm-linux-gnueabihf/bits/waitstatus.h:74:28: error: conflicts with previous declaration \u2018unsigned int wait::<anonymous struct>::__w_coredump\u2019
/usr/include/arm-linux-gnueabihf/bits/waitstatus.h:82:27: error: declaration of \u2018unsigned int wait::<anonymous struct>::__w_termsig\u2019
/usr/include/arm-linux-gnueabihf/bits/waitstatus.h:73:27: error: conflicts with previous declaration \u2018unsigned int wait::<anonymous struct>::__w_termsig\u2019
/usr/include/arm-linux-gnueabihf/bits/waitstatus.h:94:27: error: declaration of \u2018unsigned int wait::<anonymous struct>::__w_stopsig\u2019
/usr/include/arm-linux-gnueabihf/bits/waitstatus.h:89:27: error: conflicts with previous declaration \u2018unsigned int wait::<anonymous struct>::__w_stopsig\u2019
/usr/include/arm-linux-gnueabihf/bits/waitstatus.h:95:27: error: declaration of \u2018unsigned int wait::<anonymous struct>::__w_stopval\u2019
/usr/include/arm-linux-gnueabihf/bits/waitstatus.h:88:27: error: conflicts with previous declaration \u2018unsigned int wait::<anonymous struct>::__w_stopval\u2019

I would like to include the headers from the userland repository to an OF project. What’s the best way to do that ?

You don’t need that entire directory - just the MMAL headers

checkout the config.make and structure of this project - it’s older so may not compile with the latest OF (was pre-programmable renderer)

Awesome! I’ve managed to compile your app, then add the cv::Mat code in. It works like a charm and I’ve managed to successfully filter images using cv:: functions and display them using @kylemcdonald’s ofxCv with drawMat().

Code’s very messy now, I get some warnings from ofxCv:

In file included from ../../../addons/ofxCv/src/ofxCv.h:26:0,
                 from src/testApp.h:4,
                 from src/testApp.cpp:1:
../../../addons/ofxCv/libs/ofxCv/include/ofxCv/Flow.h:5:0: warning: ignoring #pragma mark FLOW [-Wunknown-pragmas]
../../../addons/ofxCv/libs/ofxCv/include/ofxCv/Flow.h:54:0: warning: ignoring #pragma mark FLOW [-Wunknown-pragmas]
../../../addons/ofxCv/libs/ofxCv/include/ofxCv/Flow.h:113:0: warning: ignoring #pragma mark FLOW [-Wunknown-pragmas]
In file included from ../../../addons/ofxCv/src/ofxCv.h:23:0,
                 from src/testApp.h:4,
                 from src/testApp.cpp:1:
../../../addons/ofxCv/libs/ofxCv/include/ofxCv/Tracker.h: In member function \u2018virtual const std::vector<unsigned int>& ofxCv::RectTracker::track(const std::vector<cv::Rect_<int> >&)\u2019:
../../../addons/ofxCv/libs/ofxCv/include/ofxCv/Tracker.h:321:35: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]

and have to wait a bit after pressing Ctrl+C to exit the app:

^C[verbose] ofAppRunner: sighandler caught: 2
[ error ] Thread 2: unable to end/join thread 

[verbose] ~ofxRaspicam

But first I need to do some cleanup.

Thanks again for your projects, immensely helpful!

yeah - ofThread has a 10 second timeout in the destructor - I just set it to 0

Awesome! Thank you!

Can you share again this config.make?? im trying to integrate meal core in my app and im getting the same compiler errors as @georgeprofenza

thanks!

Looks like I deleted it while cleaning out dropbox. This should be similar

This should be the original attachment

Thanks @jvcleave !!!

I was trying to implement raspivid in my app and found your mmal repo

I forked it and made some small changes, previously i was working with your ofxRPiCameraVideoGrabber with and auvidea capture card which worked well but sometimes on init i get an error and don’t get signal. And raspivid always works…

ofxMMAL seems to work better, i think that it gives more time for the EDID signal to be recognized, it possible? i did not fully understand all the mmal stuff, just an impression.