# HG changeset patch # User cannam # Date 1221754108 0 # Node ID d4fbd4e6fdbf4bc3c60836a03003e901d00c9d5e # Parent d1bdcd4a226f13a7aa94d86c3cbd38808f50ebf0 * Add hasDuration to output descriptor as well as the features themselves diff -r d1bdcd4a226f -r d4fbd4e6fdbf vamp-sdk/Plugin.h --- a/vamp-sdk/Plugin.h Thu Sep 18 11:47:05 2008 +0000 +++ b/vamp-sdk/Plugin.h Thu Sep 18 16:08:28 2008 +0000 @@ -305,9 +305,15 @@ */ float sampleRate; + /** + * True if the returned results for this output are known to + * have a duration field. + */ + bool hasDuration; + OutputDescriptor() : // defaults for mandatory non-class-type members hasFixedBinCount(false), hasKnownExtents(false), isQuantized(false), - sampleType(OneSamplePerStep) { } + sampleType(OneSamplePerStep), hasDuration(false) { } }; typedef std::vector OutputList; diff -r d1bdcd4a226f -r d4fbd4e6fdbf vamp-sdk/PluginAdapter.cpp --- a/vamp-sdk/PluginAdapter.cpp Thu Sep 18 11:47:05 2008 +0000 +++ b/vamp-sdk/PluginAdapter.cpp Thu Sep 18 16:08:28 2008 +0000 @@ -166,6 +166,8 @@ << plugin->getVampApiVersion() << " does not match actual API version " << VAMP_API_VERSION << std::endl; + std::cerr << "(Plugin identifier is: " + << plugin->getIdentifier() << ")" << std::endl; delete plugin; return 0; } @@ -682,6 +684,7 @@ } desc->sampleRate = od.sampleRate; + desc->hasDuration = od.hasDuration; return desc; } diff -r d1bdcd4a226f -r d4fbd4e6fdbf vamp-sdk/PluginHostAdapter.cpp --- a/vamp-sdk/PluginHostAdapter.cpp Thu Sep 18 11:47:05 2008 +0000 +++ b/vamp-sdk/PluginHostAdapter.cpp Thu Sep 18 16:08:28 2008 +0000 @@ -341,6 +341,12 @@ d.sampleRate = sd->sampleRate; + if (m_descriptor->vampApiVersion >= 2) { + d.hasDuration = sd->hasDuration; + } else { + d.hasDuration = false; + } + list.push_back(d); m_descriptor->releaseOutputDescriptor(sd); diff -r d1bdcd4a226f -r d4fbd4e6fdbf vamp/vamp.h --- a/vamp/vamp.h Thu Sep 18 11:47:05 2008 +0000 +++ b/vamp/vamp.h Thu Sep 18 16:08:28 2008 +0000 @@ -160,6 +160,15 @@ "Resolution" of result, if sampleType is vampVariableSampleRate. */ float sampleRate; + /** 1 if the returned results for this output are known to have a + duration field. + + This field is new in Vamp API version 2; it must not be tested + for plugins that report an older API version in their plugin + descriptor. + */ + int hasDuration; + } VampOutputDescriptor; typedef struct _VampFeature @@ -214,14 +223,14 @@ zero. If present, this array must contain featureCount feature - structures for a Vamp 1.0 plugin, or 2*featureCount feature - unions for a Vamp 2.0 plugin. + structures for a Vamp API version 1 plugin, or 2*featureCount + feature unions for a Vamp API version 2 plugin. - The features returned by a Vamp 2.0 plugin must consist of the - same feature structures as in 1.0 for the first featureCount - array elements, followed by featureCount unions that contain - pointers to V2 feature structures (or NULL pointers if no V2 - feature structures are present). + The features returned by an API version 2 plugin must consist + of the same feature structures as in API version 1 for the + first featureCount array elements, followed by featureCount + unions that contain VampFeatureV2 structures (or NULL pointers + if no V2 feature structures are present). */ VampFeatureUnion *features; @@ -322,7 +331,7 @@ handle, or releaseOutputDescriptor for this descriptor. Host must call releaseOutputDescriptor after use. */ VampOutputDescriptor *(*getOutputDescriptor)(VampPluginHandle, - unsigned int); + unsigned int); /** Destroy a descriptor for a feature output. */ void (*releaseOutputDescriptor)(VampOutputDescriptor *);