changeset 7:9b8599d10aa2 ofa-vamp-plugin

* Add puid_and_fingerprint (i.e. expose Both plugin as well as other two)
author cannam
date Fri, 19 Mar 2010 11:28:27 +0000
parents e537b3b8b2b9
children 7cdcd807fced
files OfaVampPlugin.cpp OfaVampPlugin.h ofa-vamp-plugin.n3 protocol.cpp
diffstat 4 files changed, 21 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/OfaVampPlugin.cpp	Mon Dec 01 20:55:28 2008 +0000
+++ b/OfaVampPlugin.cpp	Fri Mar 19 11:28:27 2010 +0000
@@ -186,7 +186,7 @@
     if (m_bufidx + m_blockSize * effectiveChannels > m_bufsiz) {
         m_bufsiz *= 2;
         m_buffer = (int16_t *)realloc(m_buffer, m_bufsiz * sizeof(int16_t));
-        std::cerr << "realloc " << m_bufsiz/2 << " -> " << m_bufsiz << std::endl;
+//        std::cerr << "realloc " << m_bufsiz/2 << " -> " << m_bufsiz << std::endl;
     }
 
     for (size_t i = 0; i < m_blockSize; ++i) {
@@ -279,7 +279,7 @@
     if (!info) {
         std::cerr << "OfaVampPlugin: ERROR from ofa/protocol, unable to retrieve PUID for fingerprint" << std::endl;
         std::cerr << "Fingerprint was: " << m_print << std::endl;
-    } else {
+    } else if (info->getPUID() != "") {
         feature.label = info->getPUID();
         fset[m_puidResultIndex].push_back(feature);
     }
@@ -289,6 +289,7 @@
 
 static Vamp::PluginAdapter<OfaFingerprintPlugin> ofaFingerprintAdapter;
 static Vamp::PluginAdapter<OfaPUIDPlugin> ofaPUIDAdapter;
+static Vamp::PluginAdapter<OfaBothPlugin> ofaBothAdapter;
 
 const VampPluginDescriptor *vampGetPluginDescriptor(unsigned int version,
                                                     unsigned int index)
@@ -298,6 +299,7 @@
     switch (index) {
     case  0: return ofaFingerprintAdapter.getDescriptor();
     case  1: return ofaPUIDAdapter.getDescriptor();
+    case  2: return ofaBothAdapter.getDescriptor();
     default: return 0;
     }
 }
--- a/OfaVampPlugin.h	Mon Dec 01 20:55:28 2008 +0000
+++ b/OfaVampPlugin.h	Fri Mar 19 11:28:27 2010 +0000
@@ -10,6 +10,7 @@
 #define _OFA_VAMP_PLUGIN_H_
 
 #include <vamp-sdk/Plugin.h>
+#include <inttypes.h>
 
 class OfaVampPlugin : public Vamp::Plugin
 {
@@ -111,7 +112,7 @@
     }
 
     std::string getIdentifier() const {
-        return "ofa_both";
+        return "ofa_puid_and_fingerprint";
     }
 };
 
--- a/ofa-vamp-plugin.n3	Mon Dec 01 20:55:28 2008 +0000
+++ b/ofa-vamp-plugin.n3	Fri Mar 19 11:28:27 2010 +0000
@@ -18,6 +18,7 @@
     vamp:identifier "ofa-vamp-plugin" ; 
     vamp:available_plugin plugbase:ofa_fingerprint; 
     vamp:available_plugin plugbase:ofa_puid .
+    vamp:available_plugin plugbase:ofa_both .
 
 plugbase:ofa_fingerprint a   vamp:Plugin ;
     dc:title              "MusicIP Audio Fingerprinter" ;
@@ -72,4 +73,17 @@
 #   vamp:computes_feature      <Place feature attribute URI here and uncomment> ;
 #   vamp:computes_signal_type  <Place signal type URI here and uncomment> ;
     .
+plugbase:ofa_both a   vamp:Plugin ;
+    dc:title              "MusicIP Fingerprint and PUID Lookup" ;
+    vamp:name             "MusicIP Fingerprint and PUID Lookup" ;
+    dc:description        "Calculates an audio fingerprint using the MusicIP OFA fingerprinting library and uses it to look up a MusicDNS PUID" ;
+    foaf:maker            [ foaf:name "Chris Cannam, using MusicIP OFA library" ] ; # FIXME could give plugin author's URI here
+    cc:license            <http://creativecommons.org/licenses/BSD/> ; # I have no idea whether this is a proper uri for this thing
+    vamp:identifier       "ofa_both" ;
+    vamp:vamp_API_version vamp:api_version_2 ;
+    owl:versionInfo       "1" ;
+    vamp:input_domain     vamp:TimeDomain ;
 
+    vamp:output      plugbase:ofa_fingerprint_output_fingerprint ;
+    vamp:output      plugbase:ofa_puid_output_puid 
+    .
--- a/protocol.cpp	Mon Dec 01 20:55:28 2008 +0000
+++ b/protocol.cpp	Fri Mar 19 11:28:27 2010 +0000
@@ -14,6 +14,7 @@
 #include <curl/curl.h>
 #include <curl/types.h>
 #include <curl/easy.h>
+#include <cstring>
 
 using namespace std;