summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYu-Hsuan Hsu <yuhsuan@chromium.org>2021-01-25 12:01:43 +0800
committerCommit Bot <commit-bot@chromium.org>2021-02-22 13:21:57 +0000
commit2e6ec22b09e3ded15cf150354b89ffcdd3a438fd (patch)
tree56592fc8b492f6de520ff6d696e53a09482b4b0e
parentc24efcecac71ae7daac1729c7a1091766574aba3 (diff)
downloadadhd-2e6ec22b09e3ded15cf150354b89ffcdd3a438fd.tar.gz
CRAS: Library ABI for server state
Make the server state query support version skew. BUG=b:176570789 TEST=Verified the audio work fine Change-Id: I5cbdf9ac6d75932174e0d37757f02e040e3eef4d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/adhd/+/2646765 Commit-Queue: Yu-Hsuan Hsu <yuhsuan@chromium.org> Tested-by: Yu-Hsuan Hsu <yuhsuan@chromium.org> Reviewed-by: Cheng-Yi Chiang <cychiang@chromium.org>
-rw-r--r--cras/src/libcras/cras_client.c46
-rw-r--r--cras/src/libcras/cras_client.h44
2 files changed, 90 insertions, 0 deletions
diff --git a/cras/src/libcras/cras_client.c b/cras/src/libcras/cras_client.c
index 7817ba72..2be2f2c7 100644
--- a/cras/src/libcras/cras_client.c
+++ b/cras/src/libcras/cras_client.c
@@ -3978,6 +3978,46 @@ clean:
return rc;
}
+int get_default_output_buffer_size(struct cras_client *client, int *size)
+{
+ int rc = cras_client_get_default_output_buffer_size(client);
+ if (rc < 0)
+ return rc;
+ *size = rc;
+ return 0;
+}
+
+int get_aec_group_id(struct cras_client *client, int *id)
+{
+ int rc = cras_client_get_aec_group_id(client);
+ if (rc < 0)
+ return rc;
+ *id = rc;
+ return 0;
+}
+
+int get_aec_supported(struct cras_client *client, int *supported)
+{
+ *supported = cras_client_get_aec_supported(client);
+ return 0;
+}
+
+int get_system_muted(struct cras_client *client, int *muted)
+{
+ *muted = cras_client_get_system_muted(client);
+ return 0;
+}
+
+int get_loopback_dev_idx(struct cras_client *client, int *idx)
+{
+ int rc = cras_client_get_first_dev_type_idx(
+ client, CRAS_NODE_TYPE_POST_MIX_PRE_DSP, CRAS_STREAM_INPUT);
+ if (rc < 0)
+ return rc;
+ *idx = rc;
+ return 0;
+}
+
struct libcras_client *libcras_client_create()
{
struct libcras_client *client = (struct libcras_client *)calloc(
@@ -4000,6 +4040,12 @@ struct libcras_client *libcras_client_create()
client->rm_stream = cras_client_rm_stream;
client->set_stream_volume = cras_client_set_stream_volume;
client->get_nodes = get_nodes;
+ client->get_default_output_buffer_size = get_default_output_buffer_size;
+ client->get_aec_group_id = get_aec_group_id;
+ client->get_aec_supported = get_aec_supported;
+ client->get_system_muted = get_system_muted;
+ client->set_system_mute = cras_client_set_system_mute;
+ client->get_loopback_dev_idx = get_loopback_dev_idx;
return client;
}
diff --git a/cras/src/libcras/cras_client.h b/cras/src/libcras/cras_client.h
index 069929be..cab59e4e 100644
--- a/cras/src/libcras/cras_client.h
+++ b/cras/src/libcras/cras_client.h
@@ -1365,6 +1365,13 @@ struct libcras_client {
int (*get_nodes)(struct cras_client *client,
enum CRAS_STREAM_DIRECTION direction,
struct libcras_node_info ***nodes, size_t *num);
+ int (*get_default_output_buffer_size)(struct cras_client *client,
+ int *size);
+ int (*get_aec_group_id)(struct cras_client *client, int *id);
+ int (*get_aec_supported)(struct cras_client *client, int *supported);
+ int (*get_system_muted)(struct cras_client *client, int *muted);
+ int (*set_system_mute)(struct cras_client *client, int mute);
+ int (*get_loopback_dev_idx)(struct cras_client *client, int *idx);
};
struct cras_stream_cb_data;
@@ -1558,6 +1565,43 @@ inline int libcras_client_get_nodes(struct libcras_client *client,
return client->get_nodes(client->client_, direction, nodes, num);
}
+inline int
+libcras_client_get_default_output_buffer_size(struct libcras_client *client,
+ int *size)
+{
+ return client->get_default_output_buffer_size(client->client_, size);
+}
+
+inline int libcras_client_get_aec_group_id(struct libcras_client *client,
+ int *id)
+{
+ return client->get_aec_group_id(client->client_, id);
+}
+
+inline int libcras_client_get_aec_supported(struct libcras_client *client,
+ int *supported)
+{
+ return client->get_aec_supported(client->client_, supported);
+}
+
+inline int libcras_client_get_system_muted(struct libcras_client *client,
+ int *muted)
+{
+ return client->get_aec_group_id(client->client_, muted);
+}
+
+inline int libcras_client_set_system_mute(struct libcras_client *client,
+ int mute)
+{
+ return client->set_system_mute(client->client_, mute);
+}
+
+inline int libcras_client_get_loopback_dev_idx(struct libcras_client *client,
+ int *idx)
+{
+ return client->get_loopback_dev_idx(client->client_, idx);
+}
+
/*
* Creates a new struct to save stream params.
* Returns: