Skip to content

Commit 83dcb87

Browse files
committed
chore: remove useless code
we do not need object_id and node_id in this place and no need for functions channels, node_name and direction
1 parent 3318f7d commit 83dcb87

1 file changed

Lines changed: 1 addition & 26 deletions

File tree

src/host/pipewire/device.rs

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ pub enum Role {
4545

4646
#[derive(Clone, Debug, Default)]
4747
pub struct Device {
48-
#[allow(dead_code)]
49-
id: u32,
5048
node_name: String,
5149
nick_name: String,
5250
description: String,
@@ -58,8 +56,6 @@ pub struct Device {
5856
min_quantum: FrameCount,
5957
max_quantum: FrameCount,
6058
class: Class,
61-
#[allow(dead_code)]
62-
object_id: String,
6359
role: Role,
6460
icon_name: String,
6561
object_serial: u32,
@@ -74,7 +70,6 @@ impl Device {
7470
}
7571
fn sink_default() -> Self {
7672
Self {
77-
id: 0,
7873
node_name: "sink_default".to_owned(),
7974
nick_name: "sink_default".to_owned(),
8075
description: "default_sink".to_owned(),
@@ -87,7 +82,6 @@ impl Device {
8782
}
8883
fn input_default() -> Self {
8984
Self {
90-
id: 0,
9185
node_name: "input_default".to_owned(),
9286
nick_name: "input_default".to_owned(),
9387
description: "default_input".to_owned(),
@@ -100,7 +94,6 @@ impl Device {
10094
}
10195
fn output_default() -> Self {
10296
Self {
103-
id: 0,
10497
node_name: "output_default".to_owned(),
10598
nick_name: "output_default".to_owned(),
10699
description: "default_output".to_owned(),
@@ -164,7 +157,7 @@ impl DeviceTrait for Device {
164157

165158
fn description(&self) -> Result<crate::DeviceDescription, crate::DeviceNameError> {
166159
let mut builder = crate::DeviceDescriptionBuilder::new(&self.nick_name)
167-
.direction(self.direction())
160+
.direction(self.direction)
168161
.device_type(self.device_type())
169162
.interface_type(self.interface_type);
170163
if let Some(address) = self.address.as_ref() {
@@ -437,22 +430,10 @@ impl DeviceTrait for Device {
437430
}
438431

439432
impl Device {
440-
pub fn channels(&self) -> ChannelCount {
441-
self.channels
442-
}
443-
pub fn direction(&self) -> DeviceDirection {
444-
self.direction
445-
}
446433
pub fn node_name(&self) -> &str {
447434
&self.node_name
448435
}
449436

450-
pub fn min_quantum(&self) -> FrameCount {
451-
self.min_quantum
452-
}
453-
pub fn max_quantum(&self) -> FrameCount {
454-
self.max_quantum
455-
}
456437
pub fn quantum(&self) -> FrameCount {
457438
self.quantum
458439
}
@@ -662,16 +643,12 @@ pub fn init_devices() -> Option<Vec<Device>> {
662643
(_, Role::StreamOutput) => DeviceDirection::Output,
663644
(_, Role::StreamInput) => DeviceDirection::Input,
664645
};
665-
let Some(object_id) = props.get(*pw::keys::OBJECT_ID) else {
666-
return;
667-
};
668646
let Some(object_serial) = props
669647
.get(*pw::keys::OBJECT_SERIAL)
670648
.and_then(|serial| serial.parse().ok())
671649
else {
672650
return;
673651
};
674-
let id = info.id();
675652
let node_name = props
676653
.get(*pw::keys::NODE_NAME)
677654
.unwrap_or("unknown")
@@ -711,15 +688,13 @@ pub fn init_devices() -> Option<Vec<Device>> {
711688
let driver = props.get(*pw::keys::FACTORY_NAME).map(|s| s.to_owned());
712689

713690
let device = Device {
714-
id,
715691
node_name,
716692
nick_name,
717693
description,
718694
direction,
719695
role,
720696
channels,
721697
icon_name,
722-
object_id: object_id.to_owned(),
723698
object_serial,
724699
interface_type,
725700
address,

0 commit comments

Comments
 (0)