Setting MMAL_ENCODER to RGBA or BGRA gives same color output

30 views Asked by At

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);

Result on my screen for both RGBA and BGRA

Does anyone have experience with this behavior when working with MMAL on raspberry pi and know what causes it?

0

There are 0 answers