From dd4d711becbf9b80699337da8ebff3c377617b99 Mon Sep 17 00:00:00 2001 From: Oleksiy Yakovenko Date: Sat, 2 Nov 2024 21:07:46 +0100 Subject: [PATCH] Expose plt_autosort API to plugins --- include/deadbeef/deadbeef.h | 7 +++++++ src/plugins.c | 1 + 2 files changed, 8 insertions(+) diff --git a/include/deadbeef/deadbeef.h b/include/deadbeef/deadbeef.h index 22e25fed35..28d03b06fb 100644 --- a/include/deadbeef/deadbeef.h +++ b/include/deadbeef/deadbeef.h @@ -1783,6 +1783,13 @@ typedef struct { /// The deinit func will be called before unloading a plugin, /// and the caller will wait until completion block is performed. void (*plug_register_for_async_deinit) (DB_plugin_t *plugin, void (*deinit_func)(void (*completion_callback)(DB_plugin_t *plugin))); + + /// Apply autosort to specified playlist, if it's enabled. + /// Every time a playlist is sorted via plt_sort or similar, + /// the chosen sort settings are saved in the playlist's metadata. + /// When plt_autosort is called, the playlist is re-sorted with those saved settings. + /// Usually it should be called by UI code, when appropriate. + void (*plt_autosort)(ddb_playlist_t *plt); #endif } DB_functions_t; diff --git a/src/plugins.c b/src/plugins.c index 917f947764..7624a73f88 100644 --- a/src/plugins.c +++ b/src/plugins.c @@ -613,6 +613,7 @@ static DB_functions_t deadbeef_api = { .plt_load_from_buffer = (int (*) (ddb_playlist_t *plt, const uint8_t *buffer, size_t size))plt_load_from_buffer, .plt_save_to_buffer = (ssize_t (*) (ddb_playlist_t *plt, uint8_t **out_buffer))plt_save_to_buffer, .plug_register_for_async_deinit = _plug_register_for_async_deinit, + .plt_autosort = (void (*)(ddb_playlist_t *plt))plt_autosort, }; DB_functions_t *deadbeef = &deadbeef_api;