Mercurial > hg > svcore
comparison transform/TransformFactory.cpp @ 690:1424aa29ae95
Seems to be a bad idea to use plain DEBUG symbol on OS/X (system wants it)
author | Chris Cannam |
---|---|
date | Tue, 14 Jun 2011 15:26:52 +0100 |
parents | 06f13a3b9e9e |
children | b18f8c5fb4f5 |
comparison
equal
deleted
inserted
replaced
689:573d45e9487b | 690:1424aa29ae95 |
---|---|
50 } | 50 } |
51 | 51 |
52 void | 52 void |
53 TransformFactory::deleteInstance() | 53 TransformFactory::deleteInstance() |
54 { | 54 { |
55 DEBUG << "TransformFactory::deleteInstance called" << endl; | 55 SVDEBUG << "TransformFactory::deleteInstance called" << endl; |
56 delete m_instance; | 56 delete m_instance; |
57 m_instance = 0; | 57 m_instance = 0; |
58 } | 58 } |
59 | 59 |
60 TransformFactory::TransformFactory() : | 60 TransformFactory::TransformFactory() : |
68 TransformFactory::~TransformFactory() | 68 TransformFactory::~TransformFactory() |
69 { | 69 { |
70 m_exiting = true; | 70 m_exiting = true; |
71 if (m_thread) { | 71 if (m_thread) { |
72 #ifdef DEBUG_TRANSFORM_FACTORY | 72 #ifdef DEBUG_TRANSFORM_FACTORY |
73 DEBUG << "TransformFactory::~TransformFactory: waiting on thread" << endl; | 73 SVDEBUG << "TransformFactory::~TransformFactory: waiting on thread" << endl; |
74 #endif | 74 #endif |
75 m_thread->wait(); | 75 m_thread->wait(); |
76 delete m_thread; | 76 delete m_thread; |
77 #ifdef DEBUG_TRANSFORM_FACTORY | 77 #ifdef DEBUG_TRANSFORM_FACTORY |
78 DEBUG << "TransformFactory::~TransformFactory: waited and done" << endl; | 78 SVDEBUG << "TransformFactory::~TransformFactory: waited and done" << endl; |
79 #endif | 79 #endif |
80 } | 80 } |
81 } | 81 } |
82 | 82 |
83 void | 83 void |
111 | 111 |
112 std::set<TransformDescription> dset; | 112 std::set<TransformDescription> dset; |
113 for (TransformDescriptionMap::const_iterator i = m_transforms.begin(); | 113 for (TransformDescriptionMap::const_iterator i = m_transforms.begin(); |
114 i != m_transforms.end(); ++i) { | 114 i != m_transforms.end(); ++i) { |
115 #ifdef DEBUG_TRANSFORM_FACTORY | 115 #ifdef DEBUG_TRANSFORM_FACTORY |
116 DEBUG << "inserting transform into set: id = " << i->second.identifier << endl; | 116 SVDEBUG << "inserting transform into set: id = " << i->second.identifier << endl; |
117 #endif | 117 #endif |
118 dset.insert(i->second); | 118 dset.insert(i->second); |
119 } | 119 } |
120 | 120 |
121 TransformList list; | 121 TransformList list; |
122 for (std::set<TransformDescription>::const_iterator i = dset.begin(); | 122 for (std::set<TransformDescription>::const_iterator i = dset.begin(); |
123 i != dset.end(); ++i) { | 123 i != dset.end(); ++i) { |
124 #ifdef DEBUG_TRANSFORM_FACTORY | 124 #ifdef DEBUG_TRANSFORM_FACTORY |
125 DEBUG << "inserting transform into list: id = " << i->identifier << endl; | 125 SVDEBUG << "inserting transform into list: id = " << i->identifier << endl; |
126 #endif | 126 #endif |
127 list.push_back(*i); | 127 list.push_back(*i); |
128 } | 128 } |
129 | 129 |
130 return list; | 130 return list; |
157 | 157 |
158 std::set<TransformDescription> dset; | 158 std::set<TransformDescription> dset; |
159 for (TransformDescriptionMap::const_iterator i = m_uninstalledTransforms.begin(); | 159 for (TransformDescriptionMap::const_iterator i = m_uninstalledTransforms.begin(); |
160 i != m_uninstalledTransforms.end(); ++i) { | 160 i != m_uninstalledTransforms.end(); ++i) { |
161 #ifdef DEBUG_TRANSFORM_FACTORY | 161 #ifdef DEBUG_TRANSFORM_FACTORY |
162 DEBUG << "inserting transform into set: id = " << i->second.identifier << endl; | 162 SVDEBUG << "inserting transform into set: id = " << i->second.identifier << endl; |
163 #endif | 163 #endif |
164 dset.insert(i->second); | 164 dset.insert(i->second); |
165 } | 165 } |
166 | 166 |
167 TransformList list; | 167 TransformList list; |
168 for (std::set<TransformDescription>::const_iterator i = dset.begin(); | 168 for (std::set<TransformDescription>::const_iterator i = dset.begin(); |
169 i != dset.end(); ++i) { | 169 i != dset.end(); ++i) { |
170 #ifdef DEBUG_TRANSFORM_FACTORY | 170 #ifdef DEBUG_TRANSFORM_FACTORY |
171 DEBUG << "inserting transform into uninstalled list: id = " << i->identifier << endl; | 171 SVDEBUG << "inserting transform into uninstalled list: id = " << i->identifier << endl; |
172 #endif | 172 #endif |
173 list.push_back(*i); | 173 list.push_back(*i); |
174 } | 174 } |
175 | 175 |
176 return list; | 176 return list; |
657 PluginRDFDescription desc(*i); | 657 PluginRDFDescription desc(*i); |
658 | 658 |
659 QString name = desc.getPluginName(); | 659 QString name = desc.getPluginName(); |
660 #ifdef DEBUG_TRANSFORM_FACTORY | 660 #ifdef DEBUG_TRANSFORM_FACTORY |
661 if (name == "") { | 661 if (name == "") { |
662 DEBUG << "TransformFactory::populateUninstalledTransforms: " | 662 SVDEBUG << "TransformFactory::populateUninstalledTransforms: " |
663 << "No name available for plugin " << i- << ", skipping" << endl; | 663 << "No name available for plugin " << i- << ", skipping" << endl; |
664 continue; | 664 continue; |
665 } | 665 } |
666 #endif | 666 #endif |
667 | 667 |
675 | 675 |
676 TransformId tid = Transform::getIdentifierForPluginOutput(*i, *j); | 676 TransformId tid = Transform::getIdentifierForPluginOutput(*i, *j); |
677 | 677 |
678 if (m_transforms.find(tid) != m_transforms.end()) { | 678 if (m_transforms.find(tid) != m_transforms.end()) { |
679 #ifdef DEBUG_TRANSFORM_FACTORY | 679 #ifdef DEBUG_TRANSFORM_FACTORY |
680 DEBUG << "TransformFactory::populateUninstalledTransforms: " | 680 SVDEBUG << "TransformFactory::populateUninstalledTransforms: " |
681 << tid << " is installed; adding info url if appropriate, skipping rest" << endl; | 681 << tid << " is installed; adding info url if appropriate, skipping rest" << endl; |
682 #endif | 682 #endif |
683 if (infoUrl != "") { | 683 if (infoUrl != "") { |
684 if (m_transforms[tid].infoUrl == "") { | 684 if (m_transforms[tid].infoUrl == "") { |
685 m_transforms[tid].infoUrl = infoUrl; | 685 m_transforms[tid].infoUrl = infoUrl; |
687 } | 687 } |
688 continue; | 688 continue; |
689 } | 689 } |
690 | 690 |
691 #ifdef DEBUG_TRANSFORM_FACTORY | 691 #ifdef DEBUG_TRANSFORM_FACTORY |
692 DEBUG << "TransformFactory::populateUninstalledTransforms: " | 692 SVDEBUG << "TransformFactory::populateUninstalledTransforms: " |
693 << "adding " << tid << endl; | 693 << "adding " << tid << endl; |
694 #endif | 694 #endif |
695 | 695 |
696 QString oname = desc.getOutputName(*j); | 696 QString oname = desc.getOutputName(*j); |
697 if (oname == "") oname = *j; | 697 if (oname == "") oname = *j; |
950 plugin->getParameterDescriptors(); | 950 plugin->getParameterDescriptors(); |
951 | 951 |
952 for (Vamp::PluginBase::ParameterList::const_iterator i = parameters.begin(); | 952 for (Vamp::PluginBase::ParameterList::const_iterator i = parameters.begin(); |
953 i != parameters.end(); ++i) { | 953 i != parameters.end(); ++i) { |
954 pmap[i->identifier.c_str()] = plugin->getParameter(i->identifier); | 954 pmap[i->identifier.c_str()] = plugin->getParameter(i->identifier); |
955 // DEBUG << "TransformFactory::setParametersFromPlugin: parameter " | 955 // SVDEBUG << "TransformFactory::setParametersFromPlugin: parameter " |
956 // << i->identifier << " -> value " << | 956 // << i->identifier << " -> value " << |
957 // pmap[i->identifier.c_str()] << endl; | 957 // pmap[i->identifier.c_str()] << endl; |
958 } | 958 } |
959 | 959 |
960 transform.setParameters(pmap); | 960 transform.setParameters(pmap); |
1065 QString xml; | 1065 QString xml; |
1066 | 1066 |
1067 Vamp::PluginBase *plugin = instantiateDefaultPluginFor | 1067 Vamp::PluginBase *plugin = instantiateDefaultPluginFor |
1068 (t.getIdentifier(), 0); | 1068 (t.getIdentifier(), 0); |
1069 if (!plugin) { | 1069 if (!plugin) { |
1070 DEBUG << "TransformFactory::getPluginConfigurationXml: " | 1070 SVDEBUG << "TransformFactory::getPluginConfigurationXml: " |
1071 << "Unable to instantiate plugin for transform \"" | 1071 << "Unable to instantiate plugin for transform \"" |
1072 << t.getIdentifier() << "\"" << endl; | 1072 << t.getIdentifier() << "\"" << endl; |
1073 return xml; | 1073 return xml; |
1074 } | 1074 } |
1075 | 1075 |
1087 QString xml) | 1087 QString xml) |
1088 { | 1088 { |
1089 Vamp::PluginBase *plugin = instantiateDefaultPluginFor | 1089 Vamp::PluginBase *plugin = instantiateDefaultPluginFor |
1090 (t.getIdentifier(), 0); | 1090 (t.getIdentifier(), 0); |
1091 if (!plugin) { | 1091 if (!plugin) { |
1092 DEBUG << "TransformFactory::setParametersFromPluginConfigurationXml: " | 1092 SVDEBUG << "TransformFactory::setParametersFromPluginConfigurationXml: " |
1093 << "Unable to instantiate plugin for transform \"" | 1093 << "Unable to instantiate plugin for transform \"" |
1094 << t.getIdentifier() << "\"" << endl; | 1094 << t.getIdentifier() << "\"" << endl; |
1095 return; | 1095 return; |
1096 } | 1096 } |
1097 | 1097 |
1143 } | 1143 } |
1144 | 1144 |
1145 if (!m_uninstalledTransformsMutex.tryLock()) { | 1145 if (!m_uninstalledTransformsMutex.tryLock()) { |
1146 // uninstalled transforms are being populated; this may take some time, | 1146 // uninstalled transforms are being populated; this may take some time, |
1147 // and they aren't critical, but we will speed them up if necessary | 1147 // and they aren't critical, but we will speed them up if necessary |
1148 DEBUG << "TransformFactory::search: Uninstalled transforms mutex is held, skipping" << endl; | 1148 SVDEBUG << "TransformFactory::search: Uninstalled transforms mutex is held, skipping" << endl; |
1149 m_populatingSlowly = false; | 1149 m_populatingSlowly = false; |
1150 return results; | 1150 return results; |
1151 } | 1151 } |
1152 | 1152 |
1153 if (!m_uninstalledTransformsPopulated) { | 1153 if (!m_uninstalledTransformsPopulated) { |