mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-07-19 19:55:16 -04:00
linux-capture: Add fallback for PipeWire < 0.3.40
Proper DMA-BUF format and modifier negotiation is possible with PipeWire 0.3.40. This commit adds checks for older versions and allows to build against them. These are classified as follows: * PipeWire server older than 0.3.24: Restrict to SHM only * PipeWire server between 0.3.24 (incl.) and 0.3.40: Announce modifiers along with the old method. On failed import drop all modifiers. * PipeWire server 0.3.40 and newer: Announce modifiers along with the old method. On failed import drop only a single modifier.
This commit is contained in:
committed by
Georges Basile Stavracas Neto
parent
abbec90e7e
commit
13693bd199
@@ -446,9 +446,11 @@ static bool build_format_params(obs_pipewire_data *obs_pw,
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!check_pw_version(&obs_pw->server_version, 0, 3, 33))
|
||||
goto build_shm;
|
||||
|
||||
for (size_t i = 0; i < obs_pw->format_info.num; i++) {
|
||||
if (obs_pw->format_info.array[i].modifiers.num == 0 ||
|
||||
!check_pw_version(&obs_pw->server_version, 0, 3, 33)) {
|
||||
if (obs_pw->format_info.array[i].modifiers.num == 0) {
|
||||
continue;
|
||||
}
|
||||
params[params_count++] = build_format(
|
||||
@@ -457,6 +459,8 @@ static bool build_format_params(obs_pipewire_data *obs_pw,
|
||||
obs_pw->format_info.array[i].modifiers.array,
|
||||
obs_pw->format_info.array[i].modifiers.num);
|
||||
}
|
||||
|
||||
build_shm:
|
||||
for (size_t i = 0; i < obs_pw->format_info.num; i++) {
|
||||
params[params_count++] = build_format(
|
||||
pod_builder, &obs_pw->video_info,
|
||||
@@ -554,6 +558,13 @@ static void remove_modifier_from_format(obs_pipewire_data *obs_pw,
|
||||
if (obs_pw->format_info.array[i].spa_format != spa_format)
|
||||
continue;
|
||||
|
||||
if (!check_pw_version(&obs_pw->server_version, 0, 3, 40)) {
|
||||
da_erase_range(
|
||||
obs_pw->format_info.array[i].modifiers, 0,
|
||||
obs_pw->format_info.array[i].modifiers.num - 1);
|
||||
continue;
|
||||
}
|
||||
|
||||
int idx = da_find(obs_pw->format_info.array[i].modifiers,
|
||||
&modifier, 0);
|
||||
while (idx != -1) {
|
||||
|
||||
Reference in New Issue
Block a user