diff options
author | Mole Shang | 2023-05-05 20:48:41 +0800 |
---|---|---|
committer | Mole Shang | 2023-05-05 22:41:27 +0800 |
commit | 3bd2dc9a30f51dab6fd99f6f1a67e411996ca477 (patch) | |
tree | 1513250ce55e23529067402d951d8faf8eb879b4 | |
parent | ff506f28e50125026292124953c6380aa2315c62 (diff) | |
download | aur-3bd2dc9a30f51dab6fd99f6f1a67e411996ca477.tar.gz |
1.4.0-3
- Regenerate patches
- Add a new patch to fix build on newer gcc
-rw-r--r-- | .SRCINFO | 6 | ||||
-rw-r--r-- | 0001-disable-unneeded-imgui-demo-window.patch | 10 | ||||
-rw-r--r-- | 0002-explicitly-declare-format-function-signature.patch | 669 | ||||
-rw-r--r-- | PKGBUILD | 7 |
4 files changed, 683 insertions, 9 deletions
@@ -1,7 +1,7 @@ pkgbase = implay pkgdesc = Desktop media player built on top of mpv and imgui pkgver = 1.4.0 - pkgrel = 2 + pkgrel = 3 url = https://github.com/tsl0922/ImPlay arch = x86_64 license = GPL3 @@ -13,7 +13,9 @@ pkgbase = implay depends = xdg-desktop-portal source = implay::git+https://github.com/tsl0922/ImPlay.git?tag=${pkgver} source = 0001-disable-unneeded-imgui-demo-window.patch + source = 0002-explicitly-declare-format-function-signature.patch sha256sums = SKIP - sha256sums = 3fc9762c0b634ed72df8197bd4d618a4bc3a8f85b94d3155cb42f870e1d00616 + sha256sums = ee4836cdde04b7e9a1fe6e27b2d9fc0751aea66066836b61dc0968cae402ca60 + sha256sums = f57d3ea1b4d7b6457f49d3e5ffa6a201dff5a42be337d30fb92f53f6abeac7a9 pkgname = implay diff --git a/0001-disable-unneeded-imgui-demo-window.patch b/0001-disable-unneeded-imgui-demo-window.patch index c66bb3aa6852..f2e6244a364a 100644 --- a/0001-disable-unneeded-imgui-demo-window.patch +++ b/0001-disable-unneeded-imgui-demo-window.patch @@ -1,7 +1,7 @@ -From 92789d8a0848af83cec0fc286ea94cb0c2446dd5 Mon Sep 17 00:00:00 2001 +From 3d655e22ea72125fc9faef38c6baeb81df3cae2b Mon Sep 17 00:00:00 2001 From: Mole Shang <135e2@135e2.dev> -Date: Sat, 25 Feb 2023 23:25:10 +0800 -Subject: [PATCH] disable unneeded imgui demo window +Date: Fri, 5 May 2023 20:42:59 +0800 +Subject: [PATCH 1/2] disable unneeded imgui demo window This commit disables the demo window in ImPlay to eliminate a warning produced by makepkg on Arch Linux: @@ -20,7 +20,7 @@ macro to suppress demo calls, which are mostly not needed by end users like us o 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third_party/imgui/include/imconfig.h b/third_party/imgui/include/imconfig.h -index 11ce672..b769eda 100644 +index c59227e..de9221b 100644 --- a/third_party/imgui/include/imconfig.h +++ b/third_party/imgui/include/imconfig.h @@ -33,7 +33,7 @@ @@ -33,5 +33,5 @@ index 11ce672..b769eda 100644 //---- Don't implement some functions to reduce linkage requirements. -- -2.39.2 +2.40.1 diff --git a/0002-explicitly-declare-format-function-signature.patch b/0002-explicitly-declare-format-function-signature.patch new file mode 100644 index 000000000000..384e7284e13c --- /dev/null +++ b/0002-explicitly-declare-format-function-signature.patch @@ -0,0 +1,669 @@ +From 26c5f944d21802971f408dd1b6308b580d88a809 Mon Sep 17 00:00:00 2001 +From: Mole Shang <135e2@135e2.dev> +Date: Fri, 5 May 2023 20:32:17 +0800 +Subject: [PATCH 2/2] explicitly declare `format()` function signature +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +With the newly arrived implementation of the experimental C++20 support for std::format in upstream `gcc (GCC) 13.1.1 20230429`, a naming conflict emerged in `source/helpers/utils.cpp`, resulting in the following error: + +> implay/source/helpers/utils.cpp:77:23: error: call of overloaded ‘format(const char [14], std::string&)’ is ambiguous +> implay/src/implay/include/helpers/utils.h:71:20: note: candidate: ‘std::string ImPlay::format(std::string_view, T ...) [with T = {std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >}; std::string = std::__cxx11::basic_string<char>; std::string_view = std::basic_string_view<char>]’ +> 71 | inline std::string format(std::string_view format, T... args) { +> | ^~~~~~ +> /usr/include/c++/13.1.1/format:3713:5: note: candidate: ‘std::string std::format(format_string<_Args ...>, _Args&& ...) [with _Args = {__cxx11::basic_string<char, char_traits<char>, allocator<char> >&, __cxx11::basic_string<char, char_traits<char>, allocator<char> >&}; string = __cxx11::basic_string<char>; format_string<_Args ...> = basic_format_string<char, __cxx11::basic_string<char, char_traits<char>, allocator<char> >&, __cxx11::basic_string<char, char_traits<char>, allocator<char> >&>]’ +> 3713 | format(format_string<_Args...> __fmt, _Args&&... __args) +> | ^~~~~~ + +Specify the `format()` function signature explicitly to fix the +ambiguous naming problem. + +Ref: https://www.gnu.org/software/gcc/gcc-13/changes.html => Runtime Library (libstdc++) +--- + include/player.h | 10 ++++---- + source/config.cpp | 26 +++++++++---------- + source/helpers/utils.cpp | 14 +++++----- + source/player.cpp | 10 ++++---- + source/views/command_palette.cpp | 12 ++++----- + source/views/context_menu.cpp | 22 ++++++++-------- + source/views/debug.cpp | 36 +++++++++++++------------- + source/views/quickview.cpp | 44 ++++++++++++++++---------------- + source/window.cpp | 6 ++--- + 9 files changed, 90 insertions(+), 90 deletions(-) + +diff --git a/include/player.h b/include/player.h +index 9fa2c4e..ba8bcd4 100644 +--- a/include/player.h ++++ b/include/player.h +@@ -141,12 +141,12 @@ class Player { + "ttxt", "txt", "ssa", "smi", "mks"}; + + const std::vector<std::pair<std::string, std::string>> mediaFilters = { +- {"Videos Files", format("{}", join(videoTypes, ","))}, +- {"Audio Files", format("{}", join(audioTypes, ","))}, +- {"Image Files", format("{}", join(imageTypes, ","))}, ++ {"Videos Files", ImPlay::format("{}", join(videoTypes, ","))}, ++ {"Audio Files", ImPlay::format("{}", join(audioTypes, ","))}, ++ {"Image Files", ImPlay::format("{}", join(imageTypes, ","))}, + }; + const std::vector<std::pair<std::string, std::string>> subtitleFilters = { +- {"Subtitle Files", format("{}", join(subtitleTypes, ","))}, ++ {"Subtitle Files", ImPlay::format("{}", join(subtitleTypes, ","))}, + }; + const std::vector<std::pair<std::string, std::string>> isoFilters = { + {"ISO Image Files", "iso"}, +@@ -171,4 +171,4 @@ class Player { + Player *p; + }; + }; +-} // namespace ImPlay +\ No newline at end of file ++} // namespace ImPlay +diff --git a/source/config.cpp b/source/config.cpp +index 10578fe..95c1c02 100644 +--- a/source/config.cpp ++++ b/source/config.cpp +@@ -61,19 +61,19 @@ void Config::save() { + + ini.sections["interface"]["lang"] = Data.Interface.Lang; + ini.sections["interface"]["theme"] = Data.Interface.Theme; +- ini.sections["interface"]["scale"] = format("{}", Data.Interface.Scale); +- ini.sections["interface"]["fps"] = format("{}", Data.Interface.Fps); +- ini.sections["interface"]["docking"] = format("{}", Data.Interface.Docking); +- ini.sections["interface"]["viewports"] = format("{}", Data.Interface.Viewports); ++ ini.sections["interface"]["scale"] = ImPlay::format("{}", Data.Interface.Scale); ++ ini.sections["interface"]["fps"] = ImPlay::format("{}", Data.Interface.Fps); ++ ini.sections["interface"]["docking"] = ImPlay::format("{}", Data.Interface.Docking); ++ ini.sections["interface"]["viewports"] = ImPlay::format("{}", Data.Interface.Viewports); + ini.sections["font"]["path"] = Data.Font.Path; + ini.sections["font"]["size"] = std::to_string(Data.Font.Size); + ini.sections["font"]["glyph-range"] = std::to_string(Data.Font.GlyphRange); +- ini.sections["mpv"]["config"] = format("{}", Data.Mpv.UseConfig); +- ini.sections["mpv"]["wid"] = format("{}", Data.Mpv.UseWid); +- ini.sections["mpv"]["watch-later"] = format("{}", Data.Mpv.WatchLater); ++ ini.sections["mpv"]["config"] = ImPlay::format("{}", Data.Mpv.UseConfig); ++ ini.sections["mpv"]["wid"] = ImPlay::format("{}", Data.Mpv.UseWid); ++ ini.sections["mpv"]["watch-later"] = ImPlay::format("{}", Data.Mpv.WatchLater); + ini.sections["mpv"]["volume"] = std::to_string(Data.Mpv.Volume); +- ini.sections["window"]["save"] = format("{}", Data.Window.Save); +- ini.sections["window"]["single"] = format("{}", Data.Window.Single); ++ ini.sections["window"]["save"] = ImPlay::format("{}", Data.Window.Save); ++ ini.sections["window"]["single"] = ImPlay::format("{}", Data.Window.Single); + ini.sections["window"]["x"] = std::to_string(Data.Window.X); + ini.sections["window"]["y"] = std::to_string(Data.Window.Y); + ini.sections["window"]["w"] = std::to_string(Data.Window.W); +@@ -81,12 +81,12 @@ void Config::save() { + ini.sections["debug"]["log-level"] = Data.Debug.LogLevel; + ini.sections["debug"]["log-limit"] = std::to_string(Data.Debug.LogLimit); + ini.sections["recent"]["limit"] = std::to_string(Data.Recent.Limit); +- ini.sections["recent"]["space-to-play-last"] = format("{}", Data.Recent.SpaceToPlayLast); ++ ini.sections["recent"]["space-to-play-last"] = ImPlay::format("{}", Data.Recent.SpaceToPlayLast); + + int index = 0; + for (auto& file : recentFiles) { +- ini.sections["recent"][format("file-{}", index++)] = +- file.path == file.title ? file.path : format("{}|{}", file.path, file.title); ++ ini.sections["recent"][ImPlay::format("file-{}", index++)] = ++ file.path == file.title ? file.path : ImPlay::format("{}|{}", file.path, file.title); + } + + std::ofstream file(configFile); +@@ -132,4 +132,4 @@ std::string Config::ipcSocket() { + return configDir + "/mpv-ipc-socket"; + #endif + } +-} // namespace ImPlay +\ No newline at end of file ++} // namespace ImPlay +diff --git a/source/helpers/utils.cpp b/source/helpers/utils.cpp +index 2c00f3f..a29e8d0 100644 +--- a/source/helpers/utils.cpp ++++ b/source/helpers/utils.cpp +@@ -69,12 +69,12 @@ bool fileExists(std::string path) { + + int openUrl(std::string url) { + #ifdef __APPLE__ +- return system(format("open '{}'", url).c_str()); ++ return system(ImPlay::format("open '{}'", url).c_str()); + #elif defined(_WIN32) || defined(__CYGWIN__) + return ShellExecuteW(0, 0, UTF8ToWide(url).c_str(), 0, 0, SW_SHOW) > (HINSTANCE)32 ? 0 : 1; + #else + char command[256]; +- return system(format("xdg-open '{}'", url).c_str()); ++ return system(ImPlay::format("xdg-open '{}'", url).c_str()); + #endif + } + +@@ -82,14 +82,14 @@ void revealInFolder(std::string path) { + auto fp = std::filesystem::path(reinterpret_cast<char8_t*>(path.data())); + if (!std::filesystem::exists(fp)) return; + #ifdef __APPLE__ +- system(format("open -R '{}'", path).c_str()); ++ system(ImPlay::format("open -R '{}'", path).c_str()); + #elif defined(_WIN32) || defined(__CYGWIN__) +- std::string arg = format("/select,\"{}\"", path); ++ std::string arg = ImPlay::format("/select,\"{}\"", path); + ShellExecuteW(0, 0, L"explorer", UTF8ToWide(arg).c_str(), 0, SW_SHOW); + #else + auto status = std::filesystem::status(fp); + auto target = std::filesystem::is_directory(status) ? path : fp.parent_path().string(); +- system(format("xdg-open '{}'", target).c_str()); ++ system(ImPlay::format("xdg-open '{}'", target).c_str()); + #endif + } + +@@ -123,7 +123,7 @@ std::filesystem::path dataPath() { + if (xdg_dir != nullptr) + dataDir = xdg_dir; + else if (home != nullptr) +- dataDir = format("{}/.config", home); ++ dataDir = ImPlay::format("{}/.config", home); + #endif + return std::filesystem::path(dataDir) / "implay"; + } +@@ -138,4 +138,4 @@ std::vector<std::string> split(const std::string& str, const std::string& sep) { + if (pos1 != str.length()) v.push_back(str.substr(pos1)); + return v; + } +-} // namespace ImPlay +\ No newline at end of file ++} // namespace ImPlay +diff --git a/source/player.cpp b/source/player.cpp +index 5776a73..9f7b09c 100644 +--- a/source/player.cpp ++++ b/source/player.cpp +@@ -486,7 +486,7 @@ void Player::execute(int n_args, const char **args_) { + try { + if (it != commands.end()) it->second(n_args - 1, args_ + 1); + } catch (const std::exception &e) { +- messageBox("Error", format("{}: {}", cmd, e.what())); ++ messageBox("Error", ImPlay::format("{}: {}", cmd, e.what())); + } + } + +@@ -549,13 +549,13 @@ void Player::playlistSort(bool reverse) { + } + std::vector<std::string> playlist = {"#EXTM3U"}; + for (auto &item : items) { +- if (item.title != "") playlist.push_back(format("#EXTINF:-1,{}", item.title)); ++ if (item.title != "") playlist.push_back(ImPlay::format("#EXTINF:-1,{}", item.title)); + playlist.push_back(item.path.string()); + } + mpv->property<int64_t, MPV_FORMAT_INT64>("playlist-start", pos); +- mpv->property("start", format("+{}", timePos).c_str()); ++ mpv->property("start", ImPlay::format("+{}", timePos).c_str()); + if (!mpv->playing()) mpv->command("playlist-clear"); +- mpv->commandv("loadlist", format("memory://{}", join(playlist, "\n")).c_str(), mpv->playing() ? "replace" : "append", ++ mpv->commandv("loadlist", ImPlay::format("memory://{}", join(playlist, "\n")).c_str(), mpv->playing() ? "replace" : "append", + nullptr); + } + +@@ -670,4 +670,4 @@ bool Player::isSubtitleFile(std::string file) { + if (std::find(subtitleTypes.begin(), subtitleTypes.end(), ext) != subtitleTypes.end()) return true; + return false; + } +-} // namespace ImPlay +\ No newline at end of file ++} // namespace ImPlay +diff --git a/source/views/command_palette.cpp b/source/views/command_palette.cpp +index 124efea..83becef 100644 +--- a/source/views/command_palette.cpp ++++ b/source/views/command_palette.cpp +@@ -20,8 +20,8 @@ CommandPalette::CommandPalette(Config* config, Mpv* mpv) : View(config, mpv) { + }; + providers["chapters"] = [=, this](const char*) { + for (auto& item : mpv->chapters) { +- auto title = item.title.empty() ? format("Chapter {}", item.id + 1) : item.title; +- auto time = format("{:%H:%M:%S}", std::chrono::duration<int>((int)item.time)); ++ auto title = item.title.empty() ? ImPlay::format("Chapter {}", item.id + 1) : item.title; ++ auto time = ImPlay::format("{:%H:%M:%S}", std::chrono::duration<int>((int)item.time)); + items.push_back({ + title, + "", +@@ -34,7 +34,7 @@ CommandPalette::CommandPalette(Config* config, Mpv* mpv) : View(config, mpv) { + for (auto& item : mpv->playlist) { + std::string title = item.title; + if (title.empty() && !item.filename().empty()) title = item.filename(); +- if (title.empty()) title = format("Item {}", item.id + 1); ++ if (title.empty()) title = ImPlay::format("Item {}", item.id + 1); + items.push_back({ + title, + item.path.string(), +@@ -46,8 +46,8 @@ CommandPalette::CommandPalette(Config* config, Mpv* mpv) : View(config, mpv) { + providers["tracks"] = [=, this](const char* type) { + for (auto& item : mpv->tracks) { + if (type != nullptr && item.type != type) continue; +- auto title = item.title.empty() ? format("Track {}", item.id) : item.title; +- if (!item.lang.empty()) title += format(" [{}]", item.lang); ++ auto title = item.title.empty() ? ImPlay::format("Track {}", item.id) : item.title; ++ if (!item.lang.empty()) title += ImPlay::format(" [{}]", item.lang); + items.push_back({ + title, + "", +@@ -216,4 +216,4 @@ void CommandPalette::match(const std::string& input) { + matches.clear(); + for (const auto& [item, _] : result) matches.push_back(item); + } +-} // namespace ImPlay::Views +\ No newline at end of file ++} // namespace ImPlay::Views +diff --git a/source/views/context_menu.cpp b/source/views/context_menu.cpp +index be0d587..32e5197 100644 +--- a/source/views/context_menu.cpp ++++ b/source/views/context_menu.cpp +@@ -268,13 +268,13 @@ void ContextMenu::drawPlaylist(std::vector<Mpv::PlayItem> items) { + if (i == 10) break; + std::string title = item.title; + if (title.empty() && !item.filename().empty()) title = item.filename(); +- if (title.empty()) title = format("menu.playlist.item"_i18n, item.id + 1); ++ if (title.empty()) title = ImPlay::format("menu.playlist.item"_i18n, item.id + 1); + if (ImGui::MenuItemEx(title.c_str(), nullptr, nullptr, item.id == pos)) + mpv->commandv("playlist-play-index", std::to_string(item.id).c_str(), nullptr); + i++; + } + if (items.size() > 10) { +- if (ImGui::MenuItem(format("{} ({})", "menu.playlist.all"_i18n, items.size()).c_str())) ++ if (ImGui::MenuItem(ImPlay::format("{} ({})", "menu.playlist.all"_i18n, items.size()).c_str())) + mpv->command("script-message-to implay command-palette playlist"); + } + } +@@ -288,15 +288,15 @@ void ContextMenu::drawChapterlist(std::vector<Mpv::ChapterItem> items) { + ImGui::Separator(); + for (auto &chapter : items) { + if (i == 10) break; +- auto title = chapter.title.empty() ? format("Chapter {}", chapter.id + 1) : chapter.title; +- title = format("{} [{:%H:%M:%S}]", title, std::chrono::duration<int>((int)chapter.time)); ++ auto title = chapter.title.empty() ? ImPlay::format("Chapter {}", chapter.id + 1) : chapter.title; ++ title = ImPlay::format("{} [{:%H:%M:%S}]", title, std::chrono::duration<int>((int)chapter.time)); + if (ImGui::MenuItem(title.c_str(), nullptr, chapter.id == pos)) { + mpv->commandv("seek", std::to_string(chapter.time).c_str(), "absolute", nullptr); + } + i++; + } + if (items.size() > 10) { +- if (ImGui::MenuItem(format("{} ({})", "menu.chapters.all"_i18n, items.size()).c_str())) ++ if (ImGui::MenuItem(ImPlay::format("{} ({})", "menu.chapters.all"_i18n, items.size()).c_str())) + mpv->command("script-message-to implay command-palette chapters"); + } + } +@@ -307,8 +307,8 @@ void ContextMenu::drawTracklist(const char *type, const char *prop, std::string + mpv->commandv("cycle-values", prop, "no", "auto", nullptr); + for (auto &track : mpv->tracks) { + if (track.type != type) continue; +- auto title = track.title.empty() ? format("menu.tracks.item"_i18n, track.id) : track.title; +- if (!track.lang.empty()) title += format(" [{}]", track.lang); ++ auto title = track.title.empty() ? ImPlay::format("menu.tracks.item"_i18n, track.id) : track.title; ++ if (!track.lang.empty()) title += ImPlay::format(" [{}]", track.lang); + if (ImGui::MenuItem(title.c_str(), nullptr, track.selected)) + mpv->property<int64_t, MPV_FORMAT_INT64>(prop, track.id); + } +@@ -320,7 +320,7 @@ void ContextMenu::drawAudioDeviceList() { + auto devices = mpv->audioDevices; + if (ImGui::BeginMenuEx("menu.audio.devices"_i18n, ICON_FA_AUDIO_DESCRIPTION, !devices.empty())) { + for (auto &device : devices) { +- auto title = format("[{}] {}", device.description, device.name); ++ auto title = ImPlay::format("[{}] {}", device.description, device.name); + if (ImGui::MenuItem(title.c_str(), nullptr, device.name == mpv->audioDevice)) + mpv->property("audio-device", device.name.c_str()); + } +@@ -347,7 +347,7 @@ void ContextMenu::drawProfilelist() { + if (ImGui::BeginMenuEx("menu.tools.profiles"_i18n, ICON_FA_USER_COG)) { + for (auto &profile : mpv->profiles) { + if (ImGui::MenuItem(profile.c_str())) +- mpv->command(format("show-text {}; apply-profile {}", profile, profile).c_str()); ++ mpv->command(ImPlay::format("show-text {}; apply-profile {}", profile, profile).c_str()); + } + ImGui::EndMenu(); + } +@@ -366,11 +366,11 @@ void ContextMenu::drawRecentFiles() { + i++; + } + if (files.size() > 10) { +- if (ImGui::MenuItem(format("{} ({})", "menu.open.recent.all"_i18n, files.size()).c_str())) ++ if (ImGui::MenuItem(ImPlay::format("{} ({})", "menu.open.recent.all"_i18n, files.size()).c_str())) + mpv->command("script-message-to implay command-palette history"); + } + if (ImGui::MenuItem("menu.open.recent.clear"_i18n)) config->clearRecentFiles(); + ImGui::EndMenu(); + } + } +-} // namespace ImPlay::Views +\ No newline at end of file ++} // namespace ImPlay::Views +diff --git a/source/views/debug.cpp b/source/views/debug.cpp +index a338644..7ca2941 100644 +--- a/source/views/debug.cpp ++++ b/source/views/debug.cpp +@@ -42,8 +42,8 @@ void Debug::drawHeader() { + ImGuiIO& io = ImGui::GetIO(); + auto style = ImGuiStyle(); + ImGui::Text("%s", version.c_str()); +- auto vSize = ImGui::CalcTextSize(format("ImGui {}", ImGui::GetVersion()).c_str()); +- auto mSize = ImGui::CalcTextSize(format("FPS: %.2f", io.Framerate).c_str()); ++ auto vSize = ImGui::CalcTextSize(ImPlay::format("ImGui {}", ImGui::GetVersion()).c_str()); ++ auto mSize = ImGui::CalcTextSize(ImPlay::format("FPS: %.2f", io.Framerate).c_str()); + ImGui::SameLine(ImGui::GetContentRegionAvail().x - (vSize.x + mSize.x + 2 * style.FramePadding.x)); + ImGui::Text("ImGui %s", ImGui::GetVersion()); + if (ImGui::IsItemClicked(ImGuiMouseButton_Left)) m_demo = !m_demo; +@@ -67,7 +67,7 @@ void Debug::drawConsole() { + void Debug::drawBindings() { + auto bindings = mpv->bindings; + if (m_node != "Bindings") ImGui::SetNextItemOpen(false, ImGuiCond_Always); +- if (!ImGui::CollapsingHeader(format("views.debug.bindings"_i18n, bindings.size()).c_str())) return; ++ if (!ImGui::CollapsingHeader(ImPlay::format("views.debug.bindings"_i18n, bindings.size()).c_str())) return; + m_node = "Bindings"; + + if (ImGui::BeginListBox("input-bindings", ImVec2(-FLT_MIN, -FLT_MIN))) { +@@ -115,7 +115,7 @@ static void formatCommands(mpv_node& node, std::vector<std::pair<std::string, st + if (strcmp(k, "name") == 0) name_ = v.u.string; + if (strcmp(k, "optional") == 0) optional_ = v.u.flag; + } +- args.push_back(optional_ ? format("<{}>", name_) : name_); ++ args.push_back(optional_ ? ImPlay::format("<{}>", name_) : name_); + } + } + if (strcmp(key, "vararg") == 0) vararg = value.u.flag; +@@ -123,7 +123,7 @@ static void formatCommands(mpv_node& node, std::vector<std::pair<std::string, st + if (name == nullptr) continue; + std::string args_str; + if (!args.empty()) { +- args_str = format("{}", join(args, " ")); ++ args_str = ImPlay::format("{}", join(args, " ")); + if (vararg) args_str += " ..."; + } + commands.push_back({name, args_str}); +@@ -153,7 +153,7 @@ void Debug::initData() { + + void Debug::drawCommands() { + if (m_node != "Commands") ImGui::SetNextItemOpen(false, ImGuiCond_Always); +- if (!ImGui::CollapsingHeader(format("views.debug.commands"_i18n, commands.size()).c_str())) return; ++ if (!ImGui::CollapsingHeader(ImPlay::format("views.debug.commands"_i18n, commands.size()).c_str())) return; + m_node = "Commands"; + + static char buf[256] = ""; +@@ -181,7 +181,7 @@ void Debug::drawCommands() { + + void Debug::drawProperties(const char* title, std::vector<std::string>& props) { + if (m_node != title) ImGui::SetNextItemOpen(false, ImGuiCond_Always); +- if (!ImGui::CollapsingHeader(format("{} [{}]", title, props.size()).c_str())) { ++ if (!ImGui::CollapsingHeader(ImPlay::format("{} [{}]", title, props.size()).c_str())) { + return; + } + m_node = title; +@@ -252,22 +252,22 @@ void Debug::drawPropNode(const char* name, mpv_node& node, int depth) { + value = prop.u.flag ? "yes" : "no"; + break; + case MPV_FORMAT_INT64: +- value = format("{}", prop.u.int64); ++ value = ImPlay::format("{}", prop.u.int64); + break; + case MPV_FORMAT_DOUBLE: +- value = format("{}", prop.u.double_); ++ value = ImPlay::format("{}", prop.u.double_); + break; + default: +- value = format("Unknown format: {}", (int)prop.format); ++ value = ImPlay::format("Unknown format: {}", (int)prop.format); + color = style.Colors[ImGuiCol_TextDisabled]; + break; + } + ImGui::PushID(&prop); + ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, ImGui::GetStyle().ItemSpacing.y)); + ImGui::Selectable("", false); +- if (ImGui::BeginPopupContextItem(format("##menu_{}", title).c_str())) { ++ if (ImGui::BeginPopupContextItem(ImPlay::format("##menu_{}", title).c_str())) { + if (ImGui::MenuItem("views.debug.properties.menu.copy"_i18n)) +- ImGui::SetClipboardText(format("{}={}", title, value).c_str()); ++ ImGui::SetClipboardText(ImPlay::format("{}={}", title, value).c_str()); + if (ImGui::MenuItem("views.debug.properties.menu.copy_name"_i18n)) ImGui::SetClipboardText(title); + if (ImGui::MenuItem("views.debug.properties.menu.copy_value"_i18n)) ImGui::SetClipboardText(value.c_str()); + ImGui::EndPopup(); +@@ -291,15 +291,15 @@ void Debug::drawPropNode(const char* name, mpv_node& node, int depth) { + drawSimple(name, node); + break; + case MPV_FORMAT_NODE_ARRAY: +- if (ImGui::TreeNode(format("{} [{}]", name, node.u.list->num).c_str())) { ++ if (ImGui::TreeNode(ImPlay::format("{} [{}]", name, node.u.list->num).c_str())) { + for (int i = 0; i < node.u.list->num; i++) +- drawPropNode(format("#{}", i).c_str(), node.u.list->values[i], depth + 1); ++ drawPropNode(ImPlay::format("#{}", i).c_str(), node.u.list->values[i], depth + 1); + ImGui::TreePop(); + } + break; + case MPV_FORMAT_NODE_MAP: + if (depth > 0) ImGui::SetNextItemOpen(true, ImGuiCond_Once); +- if (ImGui::TreeNode(format("{} ({})", name, node.u.list->num).c_str())) { ++ if (ImGui::TreeNode(ImPlay::format("{} ({})", name, node.u.list->num).c_str())) { + for (int i = 0; i < node.u.list->num; i++) drawPropNode(node.u.list->keys[i], node.u.list->values[i]); + ImGui::TreePop(); + } +@@ -390,7 +390,7 @@ void Debug::Console::draw() { + ImGui::EndPopup(); + } + +- Filter.Draw(format("{}##log", "views.debug.console.log.filter"_i18n).c_str(), scaled(8)); ++ Filter.Draw(ImPlay::format("{}##log", "views.debug.console.log.filter"_i18n).c_str(), scaled(8)); + ImGui::SameLine(); + ImGui::SetNextItemWidth(scaled(3)); + ImGui::InputInt("views.debug.console.log.limit"_i18n, &LogLimit, 0); +@@ -577,7 +577,7 @@ int Debug::Console::TextEditCallback(ImGuiInputTextCallbackData* data) { + AddLog("info", "Possible matches:\n"); + std::string s; + for (int i = 0; i < candidates.Size; i++) { +- s += format("{:<32}", candidates[i]); ++ s += ImPlay::format("{:<32}", candidates[i]); + if (i != 0 && (i + 1) % 4 == 0) { + AddLog("info", "%s\n", s.c_str()); + s.clear(); +@@ -610,4 +610,4 @@ int Debug::Console::TextEditCallback(ImGuiInputTextCallbackData* data) { + } + return 0; + } +-} // namespace ImPlay::Views +\ No newline at end of file ++} // namespace ImPlay::Views +diff --git a/source/views/quickview.cpp b/source/views/quickview.cpp +index 083f3b3..e5a7cca 100644 +--- a/source/views/quickview.cpp ++++ b/source/views/quickview.cpp +@@ -71,7 +71,7 @@ void Quickview::alignRight(const char *label) { + + bool Quickview::iconButton(const char *icon, const char *cmd, const char *tooltip, bool sameline) { + if (sameline) ImGui::SameLine(); +- bool ret = ImGui::Button(format("{}##{}", icon, cmd).c_str()); ++ bool ret = ImGui::Button(ImPlay::format("{}##{}", icon, cmd).c_str()); + if (ret) mpv->command(cmd); + if (tooltip && ImGui::IsItemHovered(ImGuiHoveredFlags_DelayNormal)) ImGui::SetTooltip("%s", tooltip); + return ret; +@@ -79,7 +79,7 @@ bool Quickview::iconButton(const char *icon, const char *cmd, const char *toolti + + bool Quickview::toggleButton(const char *label, bool toggle, const char *tooltip, ImGuiCol col) { + ImGui::PushStyleColor(col, ImGui::GetStyleColorVec4(toggle ? ImGuiCol_CheckMark : col)); +- bool ret = ImGui::Button(format("{}##{}", label, tooltip ? tooltip : "").c_str()); ++ bool ret = ImGui::Button(ImPlay::format("{}##{}", label, tooltip ? tooltip : "").c_str()); + if (tooltip && ImGui::IsItemHovered(ImGuiHoveredFlags_DelayNormal)) ImGui::SetTooltip("%s", tooltip); + ImGui::PopStyleColor(); + return ret; +@@ -88,7 +88,7 @@ bool Quickview::toggleButton(const char *label, bool toggle, const char *tooltip + bool Quickview::toggleButton(bool toggle, const char *tooltip, const char *id) { + ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0)); + const char *label = toggle ? ICON_FA_TOGGLE_ON : ICON_FA_TOGGLE_OFF; +- bool ret = toggleButton(format("{}##{}", label, id ? id : "").c_str(), toggle, tooltip, ImGuiCol_Text); ++ bool ret = toggleButton(ImPlay::format("{}##{}", label, id ? id : "").c_str(), toggle, tooltip, ImGuiCol_Text); + ImGui::PopStyleColor(); + return ret; + } +@@ -108,12 +108,12 @@ void Quickview::drawTracks(const char *title, const char *type, const char *prop + if (toggleButton(toggle, "views.quickview.tracks.toggle"_i18n, prop)) { + if (strstr(prop, "sid") != nullptr) { + const char *prefix = strstr(prop, "secondary") != nullptr ? "secondary-" : ""; +- mpv->commandv("set", format("{}sub-visibility", prefix).c_str(), toggle ? "no" : "yes", nullptr); ++ mpv->commandv("set", ImPlay::format("{}sub-visibility", prefix).c_str(), toggle ? "no" : "yes", nullptr); + } else { + mpv->commandv("cycle-values", prop, "no", "auto", nullptr); + } + } +- if (ImGui::BeginListBox(format("##tracks-{}", prop).c_str(), ++ if (ImGui::BeginListBox(ImPlay::format("##tracks-{}", prop).c_str(), + ImVec2(-FLT_MIN, 3 * ImGui::GetFrameHeightWithSpacing()))) { + auto items = mpv->tracks; + if (items.empty()) +@@ -123,8 +123,8 @@ void Quickview::drawTracks(const char *title, const char *type, const char *prop + for (auto &item : items) { + if (item.type != type) continue; + bool selected = item.id == 0 ? pos == "no" : pos == std::to_string(item.id); +- auto title = item.title.empty() ? format("views.quickview.tracks.item"_i18n, item.id) : item.title; +- if (!item.lang.empty()) title += format(" [{}]", item.lang); ++ auto title = item.title.empty() ? ImPlay::format("views.quickview.tracks.item"_i18n, item.id) : item.title; ++ if (!item.lang.empty()) title += ImPlay::format(" [{}]", item.lang); + ImGui::PushID(item.id); + if (ImGui::Selectable("", selected)) mpv->property(prop, std::to_string(item.id).c_str()); + ImGui::SameLine(); +@@ -172,7 +172,7 @@ void Quickview::drawPlaylistTabContent() { + for (auto &item : items) { + std::string title = item.title; + if (title.empty() && !item.filename().empty()) title = item.filename(); +- if (title.empty()) title = format("views.quickview.playlist.item"_i18n, item.id + 1); ++ if (title.empty()) title = ImPlay::format("views.quickview.playlist.item"_i18n, item.id + 1); + ImGui::PushID(item.id); + if (ImGui::Selectable("", selected == item.id)) selected = item.id; + if (ImGui::IsItemHovered() && ImGui::IsMouseDoubleClicked(0)) +@@ -198,7 +198,7 @@ void Quickview::drawPlaylistTabContent() { + iconButton(ICON_FA_SYNC, "cycle-values loop-playlist inf no", "views.quickview.playlist.loop"_i18n); + iconButton(ICON_FA_RANDOM, "playlist-shuffle", "views.quickview.playlist.shuffle"_i18n); + if (iconButton(sort ? ICON_FA_SORT_ALPHA_DOWN : ICON_FA_SORT_ALPHA_UP, +- format("script-message-to implay playlist-sort {}", sort).c_str(), ++ ImPlay::format("script-message-to implay playlist-sort {}", sort).c_str(), + "views.quickview.playlist.sort"_i18n)) + sort = !sort; + ImGui::SameLine(ImGui::GetContentRegionAvail().x - +@@ -216,8 +216,8 @@ void Quickview::drawChaptersTabContent() { + if (ImGui::BeginListBox("##chapters", ImVec2(-FLT_MIN, -FLT_MIN))) { + if (items.empty()) emptyLabel(); + for (auto &item : items) { +- auto title = item.title.empty() ? format("Chapter {}", item.id + 1) : item.title; +- auto time = format("{:%H:%M:%S}", std::chrono::duration<int>((int)item.time)); ++ auto title = item.title.empty() ? ImPlay::format("Chapter {}", item.id + 1) : item.title; ++ auto time = ImPlay::format("{:%H:%M:%S}", std::chrono::duration<int>((int)item.time)); + auto color = ImGui::GetStyleColorVec4(item.id == pos ? ImGuiCol_CheckMark : ImGuiCol_Text); + ImGui::PushID(item.id); + if (ImGui::Selectable("", item.id == pos)) +@@ -239,7 +239,7 @@ void Quickview::drawVideoTabContent() { + ImGui::TextUnformatted("views.quickview.video.rotate"_i18n); + const char *rotates[] = {"0", "90", "180", "270"}; + for (auto rotate : rotates) { +- if (ImGui::Button(format("{}°", rotate).c_str())) mpv->commandv("set", "video-rotate", rotate, nullptr); ++ if (ImGui::Button(ImPlay::format("{}°", rotate).c_str())) mpv->commandv("set", "video-rotate", rotate, nullptr); + ImGui::SameLine(); + } + iconButton(ICON_FA_UNDO, "add video-rotate -1", "views.quickview.video.rotate_left"_i18n, false); +@@ -251,7 +251,7 @@ void Quickview::drawVideoTabContent() { + ImGui::HelpMarker("views.quickview.video.scale.help"_i18n); + const float scales[] = {0.25f, 0.5f, 0.75f, 1.0f, 1.5f, 2.0f}; + for (auto scale : scales) { +- if (ImGui::Button(format("{}%", (int)(scale * 100)).c_str())) ++ if (ImGui::Button(ImPlay::format("{}%", (int)(scale * 100)).c_str())) + mpv->commandv("set", "window-scale", std::to_string(scale).c_str(), nullptr); + ImGui::SameLine(); + } +@@ -317,7 +317,7 @@ void Quickview::drawVideoTabContent() { + ImGui::SetCursorPosX(ImGui::GetCursorPosX() + scaled(1)); + ImGui::BeginGroup(); + for (int i = 0; i < IM_ARRAYSIZE(equalizer); i++) { +- if (ImGui::Button(format("{}##{}", ICON_FA_UNDO, eq[i]).c_str())) { ++ if (ImGui::Button(ImPlay::format("{}##{}", ICON_FA_UNDO, eq[i]).c_str())) { + equalizer[i] = 0; + mpv->commandv("set", eq[i], "0", nullptr); + } +@@ -343,7 +343,7 @@ void Quickview::drawAudioTabContent() { + ImGui::TextUnformatted("views.quickview.audio.delay"_i18n); + static float delay = (float)mpv->property<double, MPV_FORMAT_DOUBLE>("audio-delay"); + if (ImGui::SliderFloat("##Delay", &delay, -10, 10, "%.1fs")) +- mpv->commandv("set", "audio-delay", format("{:.1f}", delay).c_str(), nullptr); ++ mpv->commandv("set", "audio-delay", ImPlay::format("{:.1f}", delay).c_str(), nullptr); + if (iconButton(ICON_FA_UNDO, "set audio-delay 0", "views.quickview.audio.delay.reset"_i18n)) delay = 0; + ImGui::NewLine(); + ImGui::Separator(); +@@ -369,14 +369,14 @@ void Quickview::drawSubtitleTabContent() { + ImGui::TextUnformatted("views.quickview.subtitle.scale"_i18n); + static float scale = (float)mpv->property<double, MPV_FORMAT_DOUBLE>("sub-scale"); + if (ImGui::SliderFloat("##Scale", &scale, 0, 4, "%.1f")) +- mpv->commandv("set", "sub-scale", format("{:.1f}", scale).c_str(), nullptr); ++ mpv->commandv("set", "sub-scale", ImPlay::format("{:.1f}", scale).c_str(), nullptr); + if (iconButton(ICON_FA_UNDO, "set sub-scale 1", "views.quickview.subtitle.scale.reset"_i18n)) scale = 1; + ImGui::NewLine(); + + ImGui::TextUnformatted("views.quickview.subtitle.delay"_i18n); + static float delay = (float)mpv->property<double, MPV_FORMAT_DOUBLE>("sub-delay"); + if (ImGui::SliderFloat("##Delay", &delay, -10, 10, "%.1fs")) +- mpv->commandv("set", "sub-delay", format("{:.1f}", delay).c_str(), nullptr); ++ mpv->commandv("set", "sub-delay", ImPlay::format("{:.1f}", delay).c_str(), nullptr); + if (iconButton(ICON_FA_UNDO, "set sub-delay 0", "views.quickview.subtitle.delay.reset"_i18n)) delay = 0; + } + +@@ -417,7 +417,7 @@ void Quickview::drawAudioEq() { + ImVec2 size = ImVec2(scaled(0.8f), scaled(10)); + float start = ImGui::GetCursorPosX(); + for (int i = 0; i < FREQ_COUNT; i++) { +- std::string label = format("##{}", audioEqFreqs[i]); ++ std::string label = ImPlay::format("##{}", audioEqFreqs[i]); + if (ImGui::VSliderFloat(label.c_str(), size, &gain[i], -12, 12, "")) setAudioEqValue(i, gain[i]); + if (ImGui::IsItemHovered()) ImGui::SetTooltip("%.1fdB", gain[i]); + if (i < FREQ_COUNT - 1) ImGui::SameLine(0, spacing); +@@ -439,7 +439,7 @@ void Quickview::applyAudioEq(bool osd) { + if (audioEqIndex < 0) return; + auto equalizer = audioEqPresets[audioEqIndex]; + mpv->commandv("af", "add", equalizer.toFilter("@aeq", audioEqChannels).c_str(), nullptr); +- message = format("views.quickview.audio.equalizer.msg"_i18n, equalizer.name); ++ message = ImPlay::format("views.quickview.audio.equalizer.msg"_i18n, equalizer.name); + } + if (osd) mpv->commandv("show-text", message.c_str(), nullptr); + } +@@ -481,10 +481,10 @@ std::string Quickview::AudioEqItem::toFilter(const char *name, int channels) { + for (int ch = 0; ch < channels; ch++) { + for (int f = 0; f < FREQ_COUNT; f++) { + double v = (double)values[f] / 12; +- s += format("c{} f={} w={} g={}|", ch, freq, 1000, v); ++ s += ImPlay::format("c{} f={} w={} g={}|", ch, freq, 1000, v); + freq *= 2; + } + } +- return format("{}:lavfi=[anequalizer={}]", name, s); ++ return ImPlay::format("{}:lavfi=[anequalizer={}]", name, s); + } +-} // namespace ImPlay::Views +\ No newline at end of file ++} // namespace ImPlay::Views +diff --git a/source/window.cpp b/source/window.cpp +index be57b20..9c08278 100644 +--- a/source/window.cpp ++++ b/source/window.cpp +@@ -237,7 +237,7 @@ void Window::handleKey(int key, int action, int mods) { + std::vector<std::string> keys; + translateMod(keys, mods); + keys.push_back(name); +- sendKeyEvent(format("{}", join(keys, "+")), action); ++ sendKeyEvent(ImPlay::format("{}", join(keys, "+")), action); + } + + void Window::handleMouse(int button, int action, int mods) { +@@ -246,7 +246,7 @@ void Window::handleMouse(int button, int action, int mods) { + auto s = mbtnMappings.find(button); + if (s == mbtnMappings.end()) return; + keys.push_back(s->second); +- sendKeyEvent(format("{}", join(keys, "+")), action); ++ sendKeyEvent(ImPlay::format("{}", join(keys, "+")), action); + } + + void Window::sendKeyEvent(std::string key, bool action) { +@@ -450,4 +450,4 @@ void Window::Waiter::notify() { + } + cond.notify_one(); + } +-} // namespace ImPlay +\ No newline at end of file ++} // namespace ImPlay +-- +2.40.1 + @@ -1,7 +1,7 @@ # Maintainer: Mole Shang <135e2@135e2.dev> pkgname=implay pkgver=1.4.0 -pkgrel=2 +pkgrel=3 pkgdesc="Desktop media player built on top of mpv and imgui" arch=('x86_64') url="https://github.com/tsl0922/ImPlay" @@ -20,14 +20,17 @@ optdepends=() source=( 'implay::git+https://github.com/tsl0922/ImPlay.git?tag=${pkgver}' '0001-disable-unneeded-imgui-demo-window.patch' + '0002-explicitly-declare-format-function-signature.patch' ) sha256sums=( 'SKIP' - '3fc9762c0b634ed72df8197bd4d618a4bc3a8f85b94d3155cb42f870e1d00616' + 'ee4836cdde04b7e9a1fe6e27b2d9fc0751aea66066836b61dc0968cae402ca60' + 'f57d3ea1b4d7b6457f49d3e5ffa6a201dff5a42be337d30fb92f53f6abeac7a9' ) prepare() { patch -d "${pkgname}" -Np1 -i "${srcdir}/0001-disable-unneeded-imgui-demo-window.patch" + patch -d "${pkgname}" -Np1 -i "${srcdir}/0002-explicitly-declare-format-function-signature.patch" } build() { |