Mercurial > hg > vamp-plugin-sdk
comparison 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 |
comparison
equal
deleted
inserted
replaced
11:6616075ec7b6 | 12:a3d35e11c3fe |
---|---|
265 if (!m_handle) return fs; | 265 if (!m_handle) return fs; |
266 | 266 |
267 int sec = timestamp.sec; | 267 int sec = timestamp.sec; |
268 int nsec = timestamp.nsec; | 268 int nsec = timestamp.nsec; |
269 | 269 |
270 VampFeatureList **features = m_descriptor->process(m_handle, | 270 VampFeatureList *features = m_descriptor->process(m_handle, |
271 inputBuffers, | 271 inputBuffers, |
272 sec, nsec); | 272 sec, nsec); |
273 | 273 |
274 convertFeatures(features, fs); | 274 convertFeatures(features, fs); |
275 m_descriptor->releaseFeatureSet(features); | 275 m_descriptor->releaseFeatureSet(features); |
280 PluginHostAdapter::getRemainingFeatures() | 280 PluginHostAdapter::getRemainingFeatures() |
281 { | 281 { |
282 FeatureSet fs; | 282 FeatureSet fs; |
283 if (!m_handle) return fs; | 283 if (!m_handle) return fs; |
284 | 284 |
285 VampFeatureList **features = m_descriptor->getRemainingFeatures(m_handle); | 285 VampFeatureList *features = m_descriptor->getRemainingFeatures(m_handle); |
286 | 286 |
287 convertFeatures(features, fs); | 287 convertFeatures(features, fs); |
288 m_descriptor->releaseFeatureSet(features); | 288 m_descriptor->releaseFeatureSet(features); |
289 return fs; | 289 return fs; |
290 } | 290 } |
291 | 291 |
292 void | 292 void |
293 PluginHostAdapter::convertFeatures(VampFeatureList **features, | 293 PluginHostAdapter::convertFeatures(VampFeatureList *features, |
294 FeatureSet &fs) | 294 FeatureSet &fs) |
295 { | 295 { |
296 if (!features) return; | 296 if (!features) return; |
297 | 297 |
298 for (unsigned int i = 0; features[i]; ++i) { | 298 unsigned int outputs = m_descriptor->getOutputCount(m_handle); |
299 | |
300 for (unsigned int i = 0; i < outputs; ++i) { | |
299 | 301 |
300 VampFeatureList &list = *features[i]; | 302 VampFeatureList &list = features[i]; |
301 | 303 |
302 if (list.featureCount > 0) { | 304 if (list.featureCount > 0) { |
303 | 305 |
304 for (unsigned int j = 0; j < list.featureCount; ++j) { | 306 for (unsigned int j = 0; j < list.featureCount; ++j) { |
305 | 307 |