Bug 44793 - Unique names for ports
Summary: Unique names for ports
Status: RESOLVED MOVED
Alias: None
Product: PulseAudio
Classification: Unclassified
Component: core (show other bugs)
Version: unspecified
Hardware: Other All
: medium enhancement
Assignee: pulseaudio-bugs
QA Contact: pulseaudio-bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-15 02:09 UTC by Tanu Kaskinen
Modified: 2018-07-30 10:03 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Tanu Kaskinen 2012-01-15 02:09:10 UTC
I have written a function:

static const char *get_port_name(pa_device_port *port) {
    if (port)
        return port->name;
    else
        return "(no port)"
}

The port name isn't guaranteed to be unique across different cards. I'd like the port name to be an unique identifier, because the result of get_port_name() is used in a log message. If the name is not unique, the log message may be ambiguous. I could change get_port_name() so that it would allocate a new string: pa_sprintf_malloc("%s on %s", port->name, port->card->name), but freeing the string would be inconvenient for the caller.

Now, logging being slightly inconvenient may not be the most convincing argument when the requested change would be relatively big. So, here's another argument: we will anyway have to make the name unique, because it would be awesome if pa_connect_playback() could take a port name in it's dev argument - if the requested port isn't active, it will be automatically made active. And we're going to merge the sink and port concepts anyway, aren't we, so all this makes just perfect sense, right?
Comment 1 Tanu Kaskinen 2013-06-03 17:24:41 UTC
(In reply to comment #0)
> Now, logging being slightly inconvenient may not be the most convincing
> argument when the requested change would be relatively big. So, here's
> another argument: we will anyway have to make the name unique, because it
> would be awesome if pa_connect_playback() could take a port name in it's dev
> argument - if the requested port isn't active, it will be automatically made
> active. And we're going to merge the sink and port concepts anyway, aren't
> we, so all this makes just perfect sense, right?

An update: we probably aren't going to merge the sink and port concepts. As for using a port name with pa_connect_playback(): while that would be nice, we should get even better capabilities with the upcoming nodes. pa_connect_playback() (or some alternative function) could take a node name as the routing target, making even more targets available (e.g. source outputs).

This doesn't mean that we couldn't or shouldn't make port names unique, but it does make my original argument somewhat weaker.
Comment 2 GitLab Migration User 2018-07-30 10:03:34 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/189.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.