Posts: 7
Joined: Wed Jan 08, 2020 7:09 pm

MMAL C++ Library

Tue Feb 11, 2020 10:46 pm


I've written a simple header only library in C++ to simplify the management of MMAL objects. It's just a "wrapper" build over MMAL that handle some objects as: Component, Ports, Buffers, Connections, Pool and Queue. I've tryed to make it similar to the Python MMAL library.
Since I'm not a super C++ programmer (right now ;) ) the library is not perfect, probably there are errors and bugs, so be patient.
I don't even know how to test it. I've uploaded a little program as example that take a photo, but other than that I don't know what to try. If you think this can be useful, use it.

Here ->https://github.com/s4mu313/MMALPP

Thank youu

User avatar
Posts: 162
Joined: Sat Jan 09, 2016 4:16 pm

Re: MMAL C++ Library

Sat Feb 22, 2020 1:51 pm

Wow ! You have done really a good job.
Can you provide an example that decodes a jpeg image and gives RGB raw data output?

Posts: 7
Joined: Wed Jan 08, 2020 7:09 pm

Re: MMAL C++ Library

Mon Mar 02, 2020 9:39 pm

Oh, sorry for being late, I'm a bit busy right now.
I'm glad you like it and thanks for the star.

For your problem, I have no idea how to do it. But.....searching on userland repo, it seems that 6by9 has uploaded something that maybe can help you. I mean, if you can understand his code in C than translate in C++ using the library shouldn't be that hard.

https://github.com/6by9/userland/blob/h ... peg/jpeg.c

I'm not an expert with MMAL, but, broadly speaking, I think the main steps are:
define a decoder and its format -> setting a dummy input callback (, and maybe a control callback ?) -> set an output callback to read decoded data from the buffers that will be sent to the output port -> set a pool of buffers in the input port in which you shall load the jpeg frame -> set a pool of buffers on output port -> enable decoder hence.

Return to “C/C++”