annotate runner/AudioDBFeatureWriter.h @ 366:9f7297c47850

Update plugin handling to follow the smart pointers used in the svcore library. This is awkward in our context, and the outcome isn't a very nice one - but it does look as if we had the potential for use-after-free in cases where a plugin was both used "bare" and wrapped in an auto-deleting adapter; those should be fixed now
author Chris Cannam
date Thu, 23 Apr 2020 15:51:55 +0100
parents b3d73c08b6ce
children
rev   line source
Chris@0 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@0 2
Chris@0 3 /*
Chris@0 4 Sonic Annotator
Chris@0 5 A utility for batch feature extraction from audio files.
Chris@0 6 Mark Levy, Chris Sutton and Chris Cannam, Queen Mary, University of London.
Chris@0 7 Copyright 2007-2008 QMUL.
Chris@0 8
Chris@0 9 This program is free software; you can redistribute it and/or
Chris@0 10 modify it under the terms of the GNU General Public License as
Chris@0 11 published by the Free Software Foundation; either version 2 of the
Chris@0 12 License, or (at your option) any later version. See the file
Chris@0 13 COPYING included with this distribution for more information.
Chris@0 14 */
Chris@0 15
Chris@0 16 #ifndef _AUDIO_DB_FEATURE_WRITER_H_
Chris@0 17 #define _AUDIO_DB_FEATURE_WRITER_H_
Chris@0 18
Chris@0 19 #include <string>
Chris@0 20 #include <map>
Chris@0 21
Chris@0 22 using std::string;
Chris@0 23 using std::map;
Chris@0 24
Chris@0 25 #include "transform/FeatureWriter.h"
Chris@0 26
Chris@0 27 class AudioDBFeatureWriter : public FeatureWriter
Chris@0 28 {
Chris@0 29 public:
Chris@0 30 AudioDBFeatureWriter();
Chris@0 31 virtual ~AudioDBFeatureWriter();
Chris@0 32
Chris@144 33 virtual string getDescription() const;
Chris@144 34
Chris@0 35 virtual ParameterList getSupportedParameters() const;
Chris@0 36 virtual void setParameters(map<string, string> &params);
Chris@0 37
Chris@0 38 virtual void setCatalogueId(const string &);
Chris@0 39 virtual void setBaseDirectory(const string &);
Chris@0 40
Chris@0 41 virtual void write(QString trackid,
Chris@0 42 const Transform &transform,
Chris@0 43 const Vamp::Plugin::OutputDescriptor &output,
Chris@0 44 const Vamp::Plugin::FeatureList &features,
Chris@0 45 std::string summaryType = "");
Chris@0 46
Chris@0 47 virtual void finish() { }
Chris@0 48
Chris@24 49 virtual QString getWriterTag() const { return "audiodb"; }
Chris@24 50
Chris@0 51 private:
Chris@0 52 string catalogueId;
Chris@0 53 string baseDir;
Chris@0 54
Chris@0 55 static string catalogueIdParam;
Chris@0 56 static string baseDirParam;
Chris@0 57
Chris@0 58 struct TrackStream;
Chris@0 59 map<string, TrackStream> dbfiles;
Chris@0 60
Chris@0 61 bool openDBFile(QString trackid, const string& identifier);
Chris@0 62 bool replaceDBFile(QString trackid, const string& identifier);
Chris@0 63 };
Chris@0 64
Chris@0 65 #endif