Skip to content

Commit db5f566

Browse files
committed
samples: video: capture: Fix video to display XRGB format conversion
The VIDEO_PIX_FMT_XRGB32 corresponds to the PIXEL_FORMAT_XRGB_8888 display format. A fallback to PIXEL_FORMAT_ARGB_8888 could also be considered if supported. Signed-off-by: Phi Bang Nguyen <[email protected]>
1 parent 00e2d29 commit db5f566

File tree

1 file changed

+6
-2
lines changed
  • samples/drivers/video/capture/src

1 file changed

+6
-2
lines changed

samples/drivers/video/capture/src/main.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,12 @@ static inline int app_setup_display(const struct device *const display_dev, cons
4848
}
4949
break;
5050
case VIDEO_PIX_FMT_XRGB32:
51-
if (capabilities.current_pixel_format != PIXEL_FORMAT_ARGB_8888) {
52-
ret = display_set_pixel_format(display_dev, PIXEL_FORMAT_ARGB_8888);
51+
if (capabilities.current_pixel_format != PIXEL_FORMAT_XRGB_8888) {
52+
if (display_set_pixel_format(display_dev, PIXEL_FORMAT_XRGB_8888)) {
53+
/* If failed with PIXEL_FORMAT_XRGB_8888, PIXEL_FORMAT_ARGB_8888 is
54+
* still applicable */
55+
ret = display_set_pixel_format(display_dev, PIXEL_FORMAT_ARGB_8888);
56+
}
5357
}
5458
break;
5559
default:

0 commit comments

Comments
 (0)