Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 5543

Camera board • Re: Failing to get a YUV preview stream from libcamera (previously worked)

$
0
0
I downloaded the "libcamera" source code and examined "src/libcamera/pipeline/rpi/common/pipeline_base.cpp", hoping to patch the bug. Unfortunately, I found it beyond my skills (at least for today) to alter the "configure" function in any meaningful way, so I looked at where the configuration originates from...

...and found that in "generateConfiguration", while the stream role ViewFinder now defaults to RGB, the stream role VideoRecording defaults to YUV420. Even if a bug prevents modifying the configuration of a stream, I can still choose a stream role that defaults to the pixel format I need, without altering libcamera.

So, in my application, I chose the stream role "VideoRecording" and things work again - I can leave closer study of the issue to people more familiar with libcamera. :)

P.S. Closer study of the code finally allowed understanding: adding a "config->validate()" before a "camera->configure()" call would have saved me from all the trouble. :D :D :D

The code should have looked like:

Code:

streamConfig.size.width = 640;streamConfig.size.height = 480;streamConfig.pixelFormat = formats::YUV420;config->validate();int conf_ret = camera->configure(config.get());if (conf_ret) {std::cout << "CONFIGURATION FAILED!" << std::endl;return EXIT_FAILURE;}

Statistics: Posted by diastrikos — Sun May 05, 2024 2:18 pm



Viewing all articles
Browse latest Browse all 5543

Trending Articles