13
0

add backend support for port properties (jack)

This commit is contained in:
Robin Gareus 2015-03-08 17:26:46 +01:00
parent f89123b28b
commit 20cd14cf36
2 changed files with 24 additions and 0 deletions

View File

@ -129,6 +129,7 @@ class JACKAudioBackend : public AudioBackend {
int set_port_name (PortHandle, const std::string&);
std::string get_port_name (PortHandle) const;
PortHandle get_port_by_name (const std::string&) const;
int get_port_property (PortHandle, const std::string& key, std::string& value, std::string& type) const;
int get_ports (const std::string& port_name_pattern, DataType type, PortFlags flags, std::vector<std::string>&) const;

View File

@ -115,6 +115,29 @@ JACKAudioBackend::get_port_name (PortHandle port) const
return jack_port_name ((jack_port_t*) port);
}
int
JACKAudioBackend::get_port_property (PortHandle port, const std::string& key, std::string& value, std::string& type) const
{
#ifndef NO_JACK_METADATA // really everyone ought to have this by now.
int rv = -1;
char *cvalue = NULL;
char *ctype = NULL;
jack_uuid_t uuid = jack_port_uuid((jack_port_t*) port);
rv = jack_get_property(uuid, key.c_str(), &cvalue, &ctype);
if (0 == rv) {
value = cvalue;
type = ctype;
jack_free(cvalue);
jack_free(ctype);
}
return rv;
#else
return -1;
#endif
}
PortEngine::PortHandle
JACKAudioBackend:: get_port_by_name (const std::string& name) const
{