On 2015-10-19 15:56, Tanu Kaskinen wrote:
On Tue, 2015-05-05 at 17:01 +0200, David Henningsson wrote:
It can be useful for routing modules to know if a profile consists
of an output and input part, in order to e g change output profile
while keeping the input profile unchanged.

n_sinks and n_sources already tell if a profile consists of an output
and input part.

It's not only *if* but also *what* the input and output parts are.

For now filling in these fields is optional and a routing module
must be able to handle NULL in these fields.

Signed-off-by: David Henningsson <[email protected]>
---
  src/pulsecore/card.c | 2 ++
  src/pulsecore/card.h | 6 ++++++
  2 files changed, 8 insertions(+)

diff --git a/src/pulsecore/card.c b/src/pulsecore/card.c
index f9a5ddc..dd33847 100644
--- a/src/pulsecore/card.c
+++ b/src/pulsecore/card.c
@@ -52,6 +52,8 @@ pa_card_profile *pa_card_profile_new(const char *name, const 
char *description,
  void pa_card_profile_free(pa_card_profile *c) {
      pa_assert(c);

+    pa_xfree(c->input_name);
+    pa_xfree(c->output_name);
      pa_xfree(c->name);
      pa_xfree(c->description);
      pa_xfree(c);
diff --git a/src/pulsecore/card.h b/src/pulsecore/card.h
index 3e2c004..8f85000 100644
--- a/src/pulsecore/card.h
+++ b/src/pulsecore/card.h
@@ -40,6 +40,12 @@ typedef struct pa_card_profile {
      char *name;
      char *description;

+    /* Indication in case the profile is built from an output and an input 
part.
+       Can be NULL (and in case of an input- or output- only profile, the 
other direction
+       will be NULL). */
+    char *input_name;
+    char *output_name;

The comment doesn't explain what the names are used for, other than
figuring out whether the profile has inputs and outputs, which is
already available in the n_sinks and n_sources fields. What's the
relation to the name field?

Ok, this could perhaps be explained better; if name is "output:digital-stereo+input:analog-stereo" then input_name is supposed to be "analog-stereo" and output_name is supposed to be "digital-stereo". But the combination of profiles like that is ALSA specific and this could potentially be used for other backends too, so I tried to write it in a more generic way.

--
David Henningsson, Canonical Ltd.
https://launchpad.net/~diwic
_______________________________________________
pulseaudio-discuss mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss

Reply via email to