fix plugin preset listing

This commit is contained in:
Robin Gareus 2016-03-19 16:36:44 +01:00
parent e41d4e8248
commit fc988428bc

View File

@ -260,6 +260,12 @@ Plugin::input_streams () const
const Plugin::PresetRecord *
Plugin::preset_by_label (const string& label)
{
#ifndef NO_PLUGIN_STATE
if (!_have_presets) {
find_presets ();
_have_presets = true;
}
#endif
// FIXME: O(n)
for (map<string, PresetRecord>::const_iterator i = _presets.begin(); i != _presets.end(); ++i) {
if (i->second.label == label) {
@ -273,6 +279,12 @@ Plugin::preset_by_label (const string& label)
const Plugin::PresetRecord *
Plugin::preset_by_uri (const string& uri)
{
#ifndef NO_PLUGIN_STATE
if (!_have_presets) {
find_presets ();
_have_presets = true;
}
#endif
map<string, PresetRecord>::const_iterator pr = _presets.find (uri);
if (pr != _presets.end()) {
return &pr->second;