[[PATCH v0] 1/5] device-port: Allow setting the card name while creating a port.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Since we want to be able to set/restore port properties while creating a
port and the port properties are saved with the card name as a key we
need to know the card name before the port is connected to a card.

This patch enables assigning a card name to the port_new_data struct.
---
 src/pulsecore/device-port.c | 8 ++++++++
 src/pulsecore/device-port.h | 2 ++
 2 files changed, 10 insertions(+)

diff --git a/src/pulsecore/device-port.c b/src/pulsecore/device-port.c
index 9660702..e170841 100644
--- a/src/pulsecore/device-port.c
+++ b/src/pulsecore/device-port.c
@@ -48,6 +48,13 @@ void pa_device_port_new_data_set_description(pa_device_port_new_data *data, cons
     data->description = pa_xstrdup(description);
 }
 
+void pa_device_port_new_data_set_card_name(pa_device_port_new_data *data, const char *card_name) {
+    pa_assert(data);
+
+    pa_xfree(data->card_name);
+    data->card_name = pa_xstrdup(card_name);
+}
+
 void pa_device_port_new_data_set_available(pa_device_port_new_data *data, pa_available_t available) {
     pa_assert(data);
 
@@ -65,6 +72,7 @@ void pa_device_port_new_data_done(pa_device_port_new_data *data) {
 
     pa_xfree(data->name);
     pa_xfree(data->description);
+    pa_xfree(data->card_name);
 }
 
 void pa_device_port_set_available(pa_device_port *p, pa_available_t status)
diff --git a/src/pulsecore/device-port.h b/src/pulsecore/device-port.h
index b10d554..213a6f7 100644
--- a/src/pulsecore/device-port.h
+++ b/src/pulsecore/device-port.h
@@ -65,6 +65,7 @@ PA_DECLARE_PUBLIC_CLASS(pa_device_port);
 typedef struct pa_device_port_new_data {
     char *name;
     char *description;
+    char *card_name;
     pa_available_t available;
     pa_direction_t direction;
 } pa_device_port_new_data;
@@ -72,6 +73,7 @@ typedef struct pa_device_port_new_data {
 pa_device_port_new_data *pa_device_port_new_data_init(pa_device_port_new_data *data);
 void pa_device_port_new_data_set_name(pa_device_port_new_data *data, const char *name);
 void pa_device_port_new_data_set_description(pa_device_port_new_data *data, const char *description);
+void pa_device_port_new_data_set_card_name(pa_device_port_new_data *data, const char *card_name);
 void pa_device_port_new_data_set_available(pa_device_port_new_data *data, pa_available_t available);
 void pa_device_port_new_data_set_direction(pa_device_port_new_data *data, pa_direction_t direction);
 void pa_device_port_new_data_done(pa_device_port_new_data *data);
-- 
1.8.2.1



[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux