Here's a bit of code for implementing %datetime%.
First you need this...
#include <pfc/filetimetools.h>
class TitleFormatHook : public titleformat_hook
{
public:
bool process_field(titleformat_text_out* out, const char* field, size_t, bool& found_flag) final
{
if (stricmp_utf8(field, "datetime") == 0)
{
const auto ts = pfc::fileTimeNow();
const auto str = pfc::format_filetimestamp(ts);
out->write(titleformat_inputtypes::unknown, str);
found_flag = true;
return true;
}
found_flag = false;
return false;
}
bool process_function(titleformat_text_out*, const char*, size_t, titleformat_hook_function_params*, bool& found_flag) final
{
found_flag = false;
return false;
}
};
Then to use it. existing code might look like this.
playback_control::get()->playback_format_title(nullptr, str, obj, nullptr, playback_control::display_level_all);
The first nullptr is the title format hook arg so it can be updated like this...
TitleFormatHook hook;
playback_control::get()->playback_format_title(&hook, str, obj, nullptr, playback_control::display_level_all);