add backend support for port properties (jack)
authorRobin Gareus <robin@gareus.org>
Sun, 8 Mar 2015 16:26:46 +0000 (17:26 +0100)
committerRobin Gareus <robin@gareus.org>
Sun, 8 Mar 2015 18:02:31 +0000 (19:02 +0100)
libs/backends/jack/jack_audiobackend.h
libs/backends/jack/jack_portengine.cc

index db00842e4a00cdab0eea5fd57d8160ed7cb552ed..5319c52587a429cb0a1a3bed6affda5ef28f5dd8 100644 (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;
 
index 368f64bae7907fd156b7ae56556810a558d57db3..caa962600b764f9686dcfcdc304bcc86d83bab98 100644 (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
 {