Chris@498: /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ Chris@498: Chris@498: /* Chris@498: Sonic Visualiser Chris@498: An audio file viewer and annotation editor. Chris@498: Chris@498: Sonic Annotator Chris@498: A utility for batch feature extraction from audio files. Chris@498: Chris@498: Mark Levy, Chris Sutton and Chris Cannam, Queen Mary, University of London. Chris@498: Copyright 2007-2008 QMUL. Chris@498: Chris@498: This program is free software; you can redistribute it and/or Chris@498: modify it under the terms of the GNU General Public License as Chris@498: published by the Free Software Foundation; either version 2 of the Chris@498: License, or (at your option) any later version. See the file Chris@498: COPYING included with this distribution for more information. Chris@498: */ Chris@498: Chris@498: #ifndef _RDF_FEATURE_WRITER_H_ Chris@498: #define _RDF_FEATURE_WRITER_H_ Chris@498: Chris@498: #include Chris@498: #include Chris@498: #include Chris@498: Chris@498: #include Chris@498: Chris@498: #include "transform/FileFeatureWriter.h" Chris@498: Chris@498: #include "PluginRDFDescription.h" Chris@498: Chris@498: using std::string; Chris@498: using std::map; Chris@498: using std::set; Chris@498: using std::pair; Chris@498: Chris@498: class QTextStream; Chris@498: class QFile; Chris@498: Chris@498: class RDFFeatureWriter : public FileFeatureWriter Chris@498: { Chris@498: public: Chris@498: RDFFeatureWriter(); Chris@498: virtual ~RDFFeatureWriter(); Chris@498: Chris@498: virtual ParameterList getSupportedParameters() const; Chris@498: virtual void setParameters(map ¶ms); Chris@498: Chris@504: virtual void setTrackMetadata(QString trackid, TrackMetadata metadata); Chris@504: Chris@498: virtual void write(QString trackid, Chris@498: const Transform &transform, Chris@498: const Vamp::Plugin::OutputDescriptor &output, Chris@498: const Vamp::Plugin::FeatureList &features, Chris@498: std::string summaryType = ""); Chris@498: Chris@510: virtual void setFixedEventTypeURI(QString uri); // something of a hack Chris@510: Chris@498: virtual void finish(); Chris@498: Chris@498: private: Chris@498: typedef map RDFDescriptionMap; // by plugin id Chris@498: RDFDescriptionMap m_rdfDescriptions; Chris@498: Chris@504: typedef map TrackMetadataMap; Chris@504: TrackMetadataMap m_metadata; Chris@504: Chris@510: QString m_fixedEventTypeURI; Chris@510: Chris@590: virtual void reviewFileForAppending(QString filename); Chris@590: Chris@498: void writePrefixes(QTextStream *); Chris@498: void writeSignalDescription(QTextStream *, QString); Chris@498: void writeLocalFeatureTypes(QTextStream *, Chris@498: const Transform &, Chris@498: const Vamp::Plugin::OutputDescriptor &, Chris@498: PluginRDFDescription &); Chris@498: Chris@498: void writeSparseRDF(QTextStream *stream, Chris@498: const Transform &transform, Chris@498: const Vamp::Plugin::OutputDescriptor &output, Chris@498: const Vamp::Plugin::FeatureList &features, Chris@498: PluginRDFDescription &desc, Chris@498: QString timelineURI); Chris@498: Chris@507: void writeTrackLevelRDF(QTextStream *stream, Chris@507: const Transform &transform, Chris@507: const Vamp::Plugin::OutputDescriptor &output, Chris@507: const Vamp::Plugin::FeatureList &features, Chris@507: PluginRDFDescription &desc, Chris@507: QString signalURI); Chris@507: Chris@498: void writeDenseRDF(QTextStream *stream, Chris@498: const Transform &transform, Chris@498: const Vamp::Plugin::OutputDescriptor &output, Chris@498: const Vamp::Plugin::FeatureList &features, Chris@498: PluginRDFDescription &desc, Chris@498: QString signalURI, Chris@498: QString timelineURI); Chris@498: Chris@498: set m_startedTrackIds; Chris@498: Chris@498: map > m_startedStreamTransforms; Chris@498: Chris@585: map m_trackTrackURIs; Chris@498: map m_trackTimelineURIs; Chris@498: map m_trackSignalURIs; Chris@498: Chris@498: map m_transformURIs; Chris@498: map m_syntheticEventTypeURIs; Chris@498: map m_syntheticSignalTypeURIs; Chris@498: Chris@498: typedef pair StringTransformPair; Chris@498: typedef pair StreamBuffer; Chris@498: map m_openDenseFeatures; // signal URI + transform -> stream + text Chris@594: QString m_userAudioFileUri; Chris@594: QString m_userTrackUri; Chris@594: QString m_userMakerUri; Chris@498: Chris@498: bool m_plain; Chris@498: Chris@498: uint64_t m_count; Chris@498: }; Chris@498: Chris@498: #endif