diff vamp-sdk/PluginHostAdapter.cpp @ 12:a3d35e11c3fe

* Avoid repeated malloc/free for returned feature lists -- reuse static feature lists where possible. Need to document the host behaviour that permits this (i.e. a returned feature list is only valid until the next call to process, getRemainingFeatures or releaseFeatureSet)
author cannam
date Thu, 06 Apr 2006 15:12:25 +0000
parents 44113b1e296b
children 6c5466fbea90
line wrap: on
line diff
--- a/vamp-sdk/PluginHostAdapter.cpp	Thu Apr 06 12:26:44 2006 +0000
+++ b/vamp-sdk/PluginHostAdapter.cpp	Thu Apr 06 15:12:25 2006 +0000
@@ -267,7 +267,7 @@
     int sec = timestamp.sec;
     int nsec = timestamp.nsec;
     
-    VampFeatureList **features = m_descriptor->process(m_handle,
+    VampFeatureList *features = m_descriptor->process(m_handle,
                                                       inputBuffers,
                                                       sec, nsec);
     
@@ -282,7 +282,7 @@
     FeatureSet fs;
     if (!m_handle) return fs;
     
-    VampFeatureList **features = m_descriptor->getRemainingFeatures(m_handle); 
+    VampFeatureList *features = m_descriptor->getRemainingFeatures(m_handle); 
 
     convertFeatures(features, fs);
     m_descriptor->releaseFeatureSet(features);
@@ -290,14 +290,16 @@
 }
 
 void
-PluginHostAdapter::convertFeatures(VampFeatureList **features,
+PluginHostAdapter::convertFeatures(VampFeatureList *features,
                                    FeatureSet &fs)
 {
     if (!features) return;
 
-    for (unsigned int i = 0; features[i]; ++i) {
+    unsigned int outputs = m_descriptor->getOutputCount(m_handle);
+
+    for (unsigned int i = 0; i < outputs; ++i) {
         
-        VampFeatureList &list = *features[i];
+        VampFeatureList &list = features[i];
 
         if (list.featureCount > 0) {