video: Add extra field indicating if modifier value is valid

The drm format modifier value `0` is actually `DRM_FORMAT_MOD_LINEAR`,
a commonly used modifier. Unfortunately there appears to be no value
that can savely used as placeholder for "no value", as e.g.
`DRM_FORMAT_MOD_INVALID` is often used to indicate an implicit modifier.

Thus add an extra field that clearly indicates whether the modifier
value is set or not, add it to the util fuctions and use it for the
current only user, the libcamera backend.

Fixes 5a6da7d5e1

Closes https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/2943
This commit is contained in:
Robert Mader 2023-01-10 21:53:55 +01:00
parent cab3e3c1ce
commit 1e6920c33b
3 changed files with 25 additions and 7 deletions

View file

@ -676,7 +676,10 @@ static int port_set_format(struct impl *impl, struct port *port,
info.media_subtype == port->current_format->media_subtype &&
info.info.raw.format == port->current_format->info.raw.format &&
info.info.raw.size.width == port->current_format->info.raw.size.width &&
info.info.raw.size.height == port->current_format->info.raw.size.height)
info.info.raw.size.height == port->current_format->info.raw.size.height &&
info.info.raw.use_modifier == port->current_format->info.raw.use_modifier &&
(!info.info.raw.use_modifier ||
info.info.raw.modifier == port->current_format->info.raw.modifier))
return 0;
break;
case SPA_MEDIA_SUBTYPE_mjpg: