[[PATCH v0] 3/5] device-port: Allow setting the latency offset during port creation.

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

 



This should make latency setting during port creation consistent with
other port properties.
---
 src/pulsecore/device-port.c | 13 ++++++++++++-
 src/pulsecore/device-port.h |  3 +++
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/src/pulsecore/device-port.c b/src/pulsecore/device-port.c
index e170841..b771d23 100644
--- a/src/pulsecore/device-port.c
+++ b/src/pulsecore/device-port.c
@@ -67,6 +67,13 @@ void pa_device_port_new_data_set_direction(pa_device_port_new_data *data, pa_dir
     data->direction = direction;
 }
 
+void pa_device_port_new_data_set_latency_offset(pa_device_port_new_data *data, int64_t offset) {
+    pa_assert(data);
+
+    data->latency_offset_is_set = true;
+    data->latency_offset = offset;
+}
+
 void pa_device_port_new_data_done(pa_device_port_new_data *data) {
     pa_assert(data);
 
@@ -136,7 +143,11 @@ pa_device_port *pa_device_port_new(pa_core *c, pa_device_port_new_data *data, si
     p->profiles = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
     p->direction = data->direction;
 
-    p->latency_offset = 0;
+    if (!data->latency_offset_is_set)
+        p->latency_offset = 0;
+    else
+        p->latency_offset = data->latency_offset;
+
     p->proplist = pa_proplist_new();
 
     return p;
diff --git a/src/pulsecore/device-port.h b/src/pulsecore/device-port.h
index 213a6f7..f7d2989 100644
--- a/src/pulsecore/device-port.h
+++ b/src/pulsecore/device-port.h
@@ -68,6 +68,8 @@ typedef struct pa_device_port_new_data {
     char *card_name;
     pa_available_t available;
     pa_direction_t direction;
+    int64_t latency_offset;
+    bool latency_offset_is_set;
 } pa_device_port_new_data;
 
 pa_device_port_new_data *pa_device_port_new_data_init(pa_device_port_new_data *data);
@@ -76,6 +78,7 @@ void pa_device_port_new_data_set_description(pa_device_port_new_data *data, cons
 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_set_latency_offset(pa_device_port_new_data *data, int64_t offset);
 void pa_device_port_new_data_done(pa_device_port_new_data *data);
 
 pa_device_port *pa_device_port_new(pa_core *c, pa_device_port_new_data *data, size_t extra);
-- 
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