mirror of
https://gitlab.freedesktop.org/pipewire/helvum
synced 2026-03-15 19:46:10 +08:00
Color links and ports according to their formats
Format params for links and ports are now being watched for in the pipewire connection code. The parsed media type is then set on the port widget / link object and they are colored accordingly. For ports, which were already colored before, this new method of determining the media type should be more reliable and accurate as this uses the real Format/EnumFormat params instead of parsing optional properties.
This commit is contained in:
19
src/main.rs
19
src/main.rs
@@ -20,7 +20,7 @@ mod pipewire_connection;
|
||||
mod ui;
|
||||
|
||||
use gtk::prelude::*;
|
||||
use pipewire::spa::Direction;
|
||||
use pipewire::spa::{format::MediaType, Direction};
|
||||
|
||||
/// Messages sent by the GTK thread to notify the pipewire thread.
|
||||
#[derive(Debug, Clone)]
|
||||
@@ -44,18 +44,26 @@ pub enum PipewireMessage {
|
||||
node_id: u32,
|
||||
name: String,
|
||||
direction: Direction,
|
||||
media_type: Option<MediaType>,
|
||||
},
|
||||
PortFormatChanged {
|
||||
id: u32,
|
||||
media_type: MediaType,
|
||||
},
|
||||
LinkAdded {
|
||||
id: u32,
|
||||
port_from: u32,
|
||||
port_to: u32,
|
||||
active: bool,
|
||||
media_type: MediaType,
|
||||
},
|
||||
LinkStateChanged {
|
||||
id: u32,
|
||||
active: bool,
|
||||
},
|
||||
LinkFormatChanged {
|
||||
id: u32,
|
||||
media_type: MediaType,
|
||||
},
|
||||
NodeRemoved {
|
||||
id: u32,
|
||||
},
|
||||
@@ -74,13 +82,6 @@ pub enum NodeType {
|
||||
Output,
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub enum MediaType {
|
||||
Audio,
|
||||
Video,
|
||||
Midi,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct PipewireLink {
|
||||
pub node_from: u32,
|
||||
|
||||
Reference in New Issue
Block a user