playlist/Registry: add FindPlaylistPluginBySuffix()

This commit is contained in:
Max Kellermann 2019-09-02 20:28:14 +02:00
parent 4d11745156
commit 0fd6235a66
2 changed files with 13 additions and 6 deletions

View File

@ -274,15 +274,15 @@ playlist_list_open_stream(InputStreamPtr &&is, const char *uri)
return nullptr; return nullptr;
} }
bool const PlaylistPlugin *
playlist_suffix_supported(const char *suffix) noexcept FindPlaylistPluginBySuffix(const char *suffix) noexcept
{ {
assert(suffix != nullptr); assert(suffix != nullptr);
playlist_plugins_for_each_enabled(plugin) { playlist_plugins_for_each_enabled(plugin) {
if (plugin->SupportsSuffix(suffix)) if (plugin->SupportsSuffix(suffix))
return true; return plugin;
} }
return false; return nullptr;
} }

View File

@ -78,12 +78,19 @@ playlist_list_open_stream_suffix(InputStreamPtr &&is, const char *suffix);
std::unique_ptr<SongEnumerator> std::unique_ptr<SongEnumerator>
playlist_list_open_stream(InputStreamPtr &&is, const char *uri); playlist_list_open_stream(InputStreamPtr &&is, const char *uri);
gcc_pure
const PlaylistPlugin *
FindPlaylistPluginBySuffix(const char *suffix) noexcept;
/** /**
* Determines if there is a playlist plugin which can handle the * Determines if there is a playlist plugin which can handle the
* specified file name suffix. * specified file name suffix.
*/ */
gcc_pure gcc_pure
bool inline bool
playlist_suffix_supported(const char *suffix) noexcept; playlist_suffix_supported(const char *suffix) noexcept
{
return FindPlaylistPluginBySuffix(suffix) != nullptr;
}
#endif #endif