1
0
Fork 0
forked from wry/wry

portal: ignore formats not supported by pipewire

This commit is contained in:
Julian Orth 2024-04-10 18:56:26 +02:00
parent e9ba7782a0
commit 3f39fa1f6f
5 changed files with 19 additions and 3 deletions

View file

@ -71,11 +71,19 @@ static FORMATS_MAP: Lazy<AHashMap<u32, &'static Format>> = Lazy::new(|| {
static PW_FORMATS_MAP: Lazy<AHashMap<SpaVideoFormat, &'static Format>> = Lazy::new(|| {
let mut map = AHashMap::new();
for format in FORMATS {
assert!(map.insert(format.pipewire, format).is_none());
if format.pipewire != SPA_VIDEO_FORMAT_UNKNOWN {
assert!(map.insert(format.pipewire, format).is_none());
}
}
map
});
#[test]
fn formats_dont_panic() {
formats();
pw_formats();
}
pub fn formats() -> &'static AHashMap<u32, &'static Format> {
&FORMATS_MAP
}