Mercurial > hg > svcore
comparison transform/TransformFactory.cpp @ 687:06f13a3b9e9e debug-output
Convert many cerrs to DEBUGs
author | Chris Cannam |
---|---|
date | Mon, 16 May 2011 17:19:09 +0100 |
parents | b4a8d8221eaf |
children | 1424aa29ae95 |
comparison
equal
deleted
inserted
replaced
686:b4a8d8221eaf | 687:06f13a3b9e9e |
---|---|
50 } | 50 } |
51 | 51 |
52 void | 52 void |
53 TransformFactory::deleteInstance() | 53 TransformFactory::deleteInstance() |
54 { | 54 { |
55 std::cerr << "TransformFactory::deleteInstance called" << std::endl; | 55 DEBUG << "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 std::cerr << "TransformFactory::~TransformFactory: waiting on thread" << std::endl; | 73 DEBUG << "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 std::cerr << "TransformFactory::~TransformFactory: waited and done" << std::endl; | 78 DEBUG << "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 cerr << "inserting transform into set: id = " << i->second.identifier << endl; | 116 DEBUG << "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 cerr << "inserting transform into list: id = " << i->identifier << endl; | 125 DEBUG << "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 cerr << "inserting transform into set: id = " << i->second.identifier << endl; | 162 DEBUG << "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 cerr << "inserting transform into uninstalled list: id = " << i->identifier << endl; | 171 DEBUG << "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 std::cerr << "TransformFactory::populateUninstalledTransforms: " | 662 DEBUG << "TransformFactory::populateUninstalledTransforms: " |
663 << "No name available for plugin " << i->toStdString() | 663 << "No name available for plugin " << i- << ", skipping" << endl; |
664 << ", skipping" << std::endl; | |
665 continue; | 664 continue; |
666 } | 665 } |
667 #endif | 666 #endif |
668 | 667 |
669 QString description = desc.getPluginDescription(); | 668 QString description = desc.getPluginDescription(); |
676 | 675 |
677 TransformId tid = Transform::getIdentifierForPluginOutput(*i, *j); | 676 TransformId tid = Transform::getIdentifierForPluginOutput(*i, *j); |
678 | 677 |
679 if (m_transforms.find(tid) != m_transforms.end()) { | 678 if (m_transforms.find(tid) != m_transforms.end()) { |
680 #ifdef DEBUG_TRANSFORM_FACTORY | 679 #ifdef DEBUG_TRANSFORM_FACTORY |
681 std::cerr << "TransformFactory::populateUninstalledTransforms: " | 680 DEBUG << "TransformFactory::populateUninstalledTransforms: " |
682 << tid << " is installed; adding info url if appropriate, skipping rest" << std::endl; | 681 << tid << " is installed; adding info url if appropriate, skipping rest" << endl; |
683 #endif | 682 #endif |
684 if (infoUrl != "") { | 683 if (infoUrl != "") { |
685 if (m_transforms[tid].infoUrl == "") { | 684 if (m_transforms[tid].infoUrl == "") { |
686 m_transforms[tid].infoUrl = infoUrl; | 685 m_transforms[tid].infoUrl = infoUrl; |
687 } | 686 } |
688 } | 687 } |
689 continue; | 688 continue; |
690 } | 689 } |
691 | 690 |
692 #ifdef DEBUG_TRANSFORM_FACTORY | 691 #ifdef DEBUG_TRANSFORM_FACTORY |
693 std::cerr << "TransformFactory::populateUninstalledTransforms: " | 692 DEBUG << "TransformFactory::populateUninstalledTransforms: " |
694 << "adding " << tid << std::endl; | 693 << "adding " << tid << endl; |
695 #endif | 694 #endif |
696 | 695 |
697 QString oname = desc.getOutputName(*j); | 696 QString oname = desc.getOutputName(*j); |
698 if (oname == "") oname = *j; | 697 if (oname == "") oname = *j; |
699 | 698 |
951 plugin->getParameterDescriptors(); | 950 plugin->getParameterDescriptors(); |
952 | 951 |
953 for (Vamp::PluginBase::ParameterList::const_iterator i = parameters.begin(); | 952 for (Vamp::PluginBase::ParameterList::const_iterator i = parameters.begin(); |
954 i != parameters.end(); ++i) { | 953 i != parameters.end(); ++i) { |
955 pmap[i->identifier.c_str()] = plugin->getParameter(i->identifier); | 954 pmap[i->identifier.c_str()] = plugin->getParameter(i->identifier); |
956 // std::cerr << "TransformFactory::setParametersFromPlugin: parameter " | 955 // DEBUG << "TransformFactory::setParametersFromPlugin: parameter " |
957 // << i->identifier << " -> value " << | 956 // << i->identifier << " -> value " << |
958 // pmap[i->identifier.c_str()] << std::endl; | 957 // pmap[i->identifier.c_str()] << endl; |
959 } | 958 } |
960 | 959 |
961 transform.setParameters(pmap); | 960 transform.setParameters(pmap); |
962 | 961 |
963 if (plugin->getPrograms().empty()) { | 962 if (plugin->getPrograms().empty()) { |
1066 QString xml; | 1065 QString xml; |
1067 | 1066 |
1068 Vamp::PluginBase *plugin = instantiateDefaultPluginFor | 1067 Vamp::PluginBase *plugin = instantiateDefaultPluginFor |
1069 (t.getIdentifier(), 0); | 1068 (t.getIdentifier(), 0); |
1070 if (!plugin) { | 1069 if (!plugin) { |
1071 cerr << "TransformFactory::getPluginConfigurationXml: " | 1070 DEBUG << "TransformFactory::getPluginConfigurationXml: " |
1072 << "Unable to instantiate plugin for transform \"" | 1071 << "Unable to instantiate plugin for transform \"" |
1073 << t.getIdentifier() << "\"" << endl; | 1072 << t.getIdentifier() << "\"" << endl; |
1074 return xml; | 1073 return xml; |
1075 } | 1074 } |
1076 | 1075 |
1088 QString xml) | 1087 QString xml) |
1089 { | 1088 { |
1090 Vamp::PluginBase *plugin = instantiateDefaultPluginFor | 1089 Vamp::PluginBase *plugin = instantiateDefaultPluginFor |
1091 (t.getIdentifier(), 0); | 1090 (t.getIdentifier(), 0); |
1092 if (!plugin) { | 1091 if (!plugin) { |
1093 cerr << "TransformFactory::setParametersFromPluginConfigurationXml: " | 1092 DEBUG << "TransformFactory::setParametersFromPluginConfigurationXml: " |
1094 << "Unable to instantiate plugin for transform \"" | 1093 << "Unable to instantiate plugin for transform \"" |
1095 << t.getIdentifier() << "\"" << endl; | 1094 << t.getIdentifier() << "\"" << endl; |
1096 return; | 1095 return; |
1097 } | 1096 } |
1098 | 1097 |
1144 } | 1143 } |
1145 | 1144 |
1146 if (!m_uninstalledTransformsMutex.tryLock()) { | 1145 if (!m_uninstalledTransformsMutex.tryLock()) { |
1147 // uninstalled transforms are being populated; this may take some time, | 1146 // uninstalled transforms are being populated; this may take some time, |
1148 // 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 |
1149 std::cerr << "TransformFactory::search: Uninstalled transforms mutex is held, skipping" << std::endl; | 1148 DEBUG << "TransformFactory::search: Uninstalled transforms mutex is held, skipping" << endl; |
1150 m_populatingSlowly = false; | 1149 m_populatingSlowly = false; |
1151 return results; | 1150 return results; |
1152 } | 1151 } |
1153 | 1152 |
1154 if (!m_uninstalledTransformsPopulated) { | 1153 if (!m_uninstalledTransformsPopulated) { |