mirror of
https://github.com/pikvm/ustreamer.git
synced 2026-07-20 10:41:58 +00:00
Userspace workaround for the wrong TC358743 RGB bytes ordering
- https://github.com/raspberrypi/linux/issues/6068
This commit is contained in:
@@ -747,6 +747,21 @@ static int _capture_open_format(us_capture_s *cap, bool first) {
|
||||
run->format = FMT(pixelformat);
|
||||
_D_LOG_INFO("Using format: %s", _format_to_string_supported(run->format));
|
||||
|
||||
if (cap->format_swap_rgb) {
|
||||
// Userspace workaround for TC358743 RGB/BGR bug:
|
||||
// - https://github.com/raspberrypi/linux/issues/6068
|
||||
uint swapped = 0;
|
||||
switch (run->format) {
|
||||
case V4L2_PIX_FMT_RGB24: swapped = V4L2_PIX_FMT_BGR24; break;
|
||||
case V4L2_PIX_FMT_BGR24: swapped = V4L2_PIX_FMT_RGB24; break;
|
||||
}
|
||||
if (swapped > 0) {
|
||||
_D_LOG_INFO("Using format swap: %s -> %s",
|
||||
_format_to_string_supported(run->format),
|
||||
_format_to_string_supported(swapped));
|
||||
run->format = swapped;
|
||||
}
|
||||
}
|
||||
|
||||
run->stride = FMTS(bytesperline);
|
||||
run->raw_size = FMTS(sizeimage); // Only for userptr
|
||||
|
||||
@@ -104,6 +104,8 @@ typedef struct {
|
||||
uint width;
|
||||
uint height;
|
||||
uint format;
|
||||
|
||||
bool format_swap_rgb;
|
||||
uint jpeg_quality;
|
||||
v4l2_std_id standard;
|
||||
enum v4l2_memory io_method;
|
||||
|
||||
Reference in New Issue
Block a user