I am trying to take frame from camera and copy it to framebuffer to show it to the screen. But, my output seems to mix R and B color... Here is code for setting output format:
format = video_port->format;
format->encoding = MMAL_ENCODING_RGBA; // or BGRA = same output
format->es->video.width = VCOS_ALIGN_UP(CAMERA_RESOLUTION_X, 32);
format->es->video.height = VCOS_ALIGN_UP(CAMERA_RESOLUTION_Y, 16);
format->es->video.crop.x = 0;
format->es->video.crop.y = 0;
format->es->video.crop.width = CAMERA_RESOLUTION_X;
format->es->video.crop.height = CAMERA_RESOLUTION_Y;
status = mmal_port_format_commit(video_port);
Note that when I put some other format like ARGB or ABGR I create nonsense output which is expected. I think framebuffer should be BGRA but I am not sure.
Here is how I copy to framebuffer (fbp):
memcpy(fbp, buffer->data, size);
Does anyone have experience with this behavior when working with MMAL on raspberry pi and know what causes it?
