@@ -15,6 +15,9 @@ struct _AstalWpEndpoint {
15
15
gboolean mute ;
16
16
gchar * description ;
17
17
gchar * name ;
18
+ guint serial ;
19
+ gchar * path ;
20
+
18
21
AstalWpMediaClass type ;
19
22
gboolean is_default ;
20
23
gboolean lock_channels ;
@@ -59,6 +62,8 @@ typedef enum {
59
62
ASTAL_WP_ENDPOINT_PROP_ICON ,
60
63
ASTAL_WP_ENDPOINT_PROP_VOLUME_ICON ,
61
64
ASTAL_WP_ENDPOINT_PROP_LOCK_CHANNELS ,
65
+ ASTAL_WP_ENDPOINT_PROP_SERIAL ,
66
+ ASTAL_WP_ENDPOINT_PROP_PATH ,
62
67
ASTAL_WP_ENDPOINT_N_PROPERTIES ,
63
68
} AstalWpEndpointProperties ;
64
69
@@ -276,6 +281,23 @@ const gchar *astal_wp_endpoint_get_volume_icon(AstalWpEndpoint *self) {
276
281
}
277
282
}
278
283
284
+ /**
285
+ * astal_wp_endpoint_get_serial:
286
+ * @self: the AstalWpEndpoint instance.
287
+ *
288
+ * gets the serial number of this endpoint
289
+ */
290
+ guint astal_wp_endpoint_get_serial (AstalWpEndpoint * self ) { return self -> serial ; }
291
+
292
+ /**
293
+ * astal_wp_endpoint_get_path:
294
+ * @self: the AstalWpEndpoint instance.
295
+ *
296
+ * gets the object path of this endpoint
297
+ */
298
+ const gchar * astal_wp_endpoint_get_path (AstalWpEndpoint * self ) { return self -> path ; }
299
+
300
+
279
301
static void astal_wp_endpoint_get_property (GObject * object , guint property_id , GValue * value ,
280
302
GParamSpec * pspec ) {
281
303
AstalWpEndpoint * self = ASTAL_WP_ENDPOINT (object );
@@ -311,6 +333,12 @@ static void astal_wp_endpoint_get_property(GObject *object, guint property_id, G
311
333
case ASTAL_WP_ENDPOINT_PROP_LOCK_CHANNELS :
312
334
g_value_set_boolean (value , self -> lock_channels );
313
335
break ;
336
+ case ASTAL_WP_ENDPOINT_PROP_SERIAL :
337
+ g_value_set_uint (value , self -> serial );
338
+ break ;
339
+ case ASTAL_WP_ENDPOINT_PROP_PATH :
340
+ g_value_set_string (value , self -> path );
341
+ break ;
314
342
default :
315
343
G_OBJECT_WARN_INVALID_PROPERTY_ID (object , property_id , pspec );
316
344
break ;
@@ -405,14 +433,26 @@ static void astal_wp_endpoint_update_properties(AstalWpEndpoint *self) {
405
433
default :
406
434
icon = "audio-card-symbolic" ;
407
435
}
436
+
408
437
g_free (self -> icon );
409
438
self -> icon = g_strdup (icon );
410
439
440
+ const gchar * serial = wp_pipewire_object_get_property (WP_PIPEWIRE_OBJECT (priv -> node ), "object.serial" );
441
+ if (serial != NULL ) {
442
+ self -> serial = g_ascii_strtoull (serial , NULL , 10 );
443
+ }
444
+
445
+ const gchar * path = wp_pipewire_object_get_property (WP_PIPEWIRE_OBJECT (priv -> node ), "object.path" );
446
+ g_free (self -> path );
447
+ self -> path = g_strdup (path );
448
+
411
449
g_object_notify (G_OBJECT (self ), "id" );
412
450
g_object_notify (G_OBJECT (self ), "description" );
413
451
g_object_notify (G_OBJECT (self ), "name" );
414
452
g_object_notify (G_OBJECT (self ), "icon" );
415
453
g_object_notify (G_OBJECT (self ), "media-class" );
454
+ g_object_notify (G_OBJECT (self ), "serial" );
455
+ g_object_notify (G_OBJECT (self ), "path" );
416
456
}
417
457
418
458
static void astal_wp_endpoint_default_changed_as_default (AstalWpEndpoint * self ) {
@@ -514,6 +554,7 @@ static void astal_wp_endpoint_init(AstalWpEndpoint *self) {
514
554
self -> mute = TRUE;
515
555
self -> description = NULL ;
516
556
self -> name = NULL ;
557
+ self -> path = NULL ;
517
558
}
518
559
519
560
static void astal_wp_endpoint_dispose (GObject * object ) {
@@ -533,6 +574,7 @@ static void astal_wp_endpoint_finalize(GObject *object) {
533
574
AstalWpEndpoint * self = ASTAL_WP_ENDPOINT (object );
534
575
g_free (self -> description );
535
576
g_free (self -> name );
577
+ g_free (self -> path );
536
578
}
537
579
538
580
static void astal_wp_endpoint_class_init (AstalWpEndpointClass * class ) {
@@ -615,6 +657,22 @@ static void astal_wp_endpoint_class_init(AstalWpEndpointClass *class) {
615
657
astal_wp_endpoint_properties [ASTAL_WP_ENDPOINT_PROP_LOCK_CHANNELS ] = g_param_spec_boolean (
616
658
"lock-channels" , "lock-channels" , "lock channels" , FALSE, G_PARAM_READWRITE );
617
659
660
+ /**
661
+ * AstalWpEndpoint:serial:
662
+ *
663
+ * The object serial of this endpoint.
664
+ */
665
+ astal_wp_endpoint_properties [ASTAL_WP_ENDPOINT_PROP_SERIAL ] =
666
+ g_param_spec_uint ("serial" , "serial" , "serial" , 0 , UINT_MAX , 0 , G_PARAM_READABLE );
667
+
668
+ /**
669
+ * AstalWpEndpoint:path:
670
+ *
671
+ * The object path of this endpoint
672
+ */
673
+ astal_wp_endpoint_properties [ASTAL_WP_ENDPOINT_PROP_PATH ] = g_param_spec_string (
674
+ "path" , "path" , "path" , NULL , G_PARAM_READABLE );
675
+
618
676
g_object_class_install_properties (object_class , ASTAL_WP_ENDPOINT_N_PROPERTIES ,
619
677
astal_wp_endpoint_properties );
620
678
}
0 commit comments