I want to access camera and get both encoded and not-encoded video from it in my C++ application. As I'm targetting Raspberry Pi Zero, I want it to be as efficient as possible, so I decided to use OpenMAX, since this seems like the most low-lever layer I can actually use.
What I am aiming at is an application that will:
- get not-encoded YUV video data from the camera and analyze it every few dozens of frames
- get encoded H264 video and send it through TCP socket
- do some other things in the background (not really important right now)
So it looks like to achieve that using OpenMAX, I need a camera module tunneled to splitter module, which would tunnel video data to video encoder and allow getting raw video from one of the unused ports. But for some reason I can't get it to work. My workflow looks in general like this (I can't share exact code right now, will try to do it later when I have the opportunity):
- create components
- tunnel camera to splitter
- tunnel splitter to encoder
- set all components to state idle
- set all components to state exectuing
- start getting video data
The problem is that I can't even set my splitter component to exectuing state like this - the error I get is "not sufficent resources". I thought that maybe it's because I didn't enable second output port on splitter and didn't allocate a buffer for it, but it doesn't fix it, either.
I tried various combinations of things: enabling ports and allocating buffers, disabling propertiary communication, changing the order in which components are moved to state exectuing, moving them to state loaded between idle and running... I simply ran out of ideas, and the information on how to use splitter component are quite limited on the net. What's funny: above workflow works if I just have camera and encoder and tunnel them directly. I just can't seem to find an option to mix in splitter in between.