- /* Check that the selected screen supports this depth */
- xcb_depth_iterator_t it = xcb_screen_allowed_depths_iterator (scr);
- while (it.rem > 0 && it.data->depth != fmt->depth)
- xcb_depth_next (&it);
- if (!it.rem)
- continue; /* Depth not supported on this screen */
-
- /* Find a visual type for the selected depth */
- const xcb_visualtype_t *vt = xcb_depth_visuals (it.data);
- for (int i = xcb_depth_visuals_length (it.data); i > 0; i--)
- {
- if (vt->_class == XCB_VISUAL_CLASS_TRUE_COLOR)
- {
- gray = false;
- goto found_vt;
- }
- if (fmt->depth == 8 && vt->_class == XCB_VISUAL_CLASS_STATIC_GRAY)
- {
- if (!gray)
- continue; /* Prefer color over gray scale */
- chroma = VLC_CODEC_GREY;
- goto found_vt;
- }
- }
- continue; /* The screen does not *really* support this depth */
-
- found_vt:
- fmt_pic.i_chroma = chroma;
- vid = vt->visual_id;
- if (!gray)
- {
- fmt_pic.i_rmask = vt->red_mask;
- fmt_pic.i_gmask = vt->green_mask;
- fmt_pic.i_bmask = vt->blue_mask;
- }