mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-13 11:19:58 +01:00
Implemented Timers in Metrics toolkit
This commit is contained in:
@@ -798,8 +798,11 @@ void ImGuiToolkit::PushFont(ImGuiToolkit::font_style style)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ImGuiToolkit::ShowStats(bool *p_open, int* p_corner)
|
void ImGuiToolkit::ShowStats(bool *p_open, int* p_corner, bool *p_timer)
|
||||||
{
|
{
|
||||||
|
static guint64 start_time_1_ = gst_util_get_timestamp ();
|
||||||
|
static guint64 start_time_2_ = gst_util_get_timestamp ();
|
||||||
|
|
||||||
if (!p_corner || !p_open)
|
if (!p_corner || !p_open)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -817,18 +820,42 @@ void ImGuiToolkit::ShowStats(bool *p_open, int* p_corner)
|
|||||||
|
|
||||||
if (ImGui::Begin("Metrics", NULL, (corner != -1 ? ImGuiWindowFlags_NoMove : 0) | ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoNav))
|
if (ImGui::Begin("Metrics", NULL, (corner != -1 ? ImGuiWindowFlags_NoMove : 0) | ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoNav))
|
||||||
{
|
{
|
||||||
|
int mode = (*p_timer) ? 1 : 0;
|
||||||
|
ImGui::SetNextItemWidth(250);
|
||||||
|
if (ImGui::Combo("##mode", &mode, ICON_FA_TACHOMETER_ALT " Performance\0" ICON_FA_HOURGLASS_HALF " Timers\0") ) {
|
||||||
|
(*p_timer) = mode > 0;
|
||||||
|
}
|
||||||
|
|
||||||
ImGuiToolkit::PushFont(ImGuiToolkit::FONT_MONO);
|
bool dumm = true;
|
||||||
|
if (*p_timer) {
|
||||||
|
guint64 time_ = gst_util_get_timestamp ();
|
||||||
|
|
||||||
ImGui::Text("Window %.0f x %.0f", io.DisplaySize.x, io.DisplaySize.y);
|
ImGuiToolkit::PushFont(ImGuiToolkit::FONT_LARGE);
|
||||||
// ImGui::Text("HiDPI (retina) %s", io.DisplayFramebufferScale.x > 1.f ? "on" : "off");
|
ImGui::Text("%s", GstToolkit::time_to_string(time_-start_time_1_, GstToolkit::TIME_STRING_FIXED).c_str());
|
||||||
ImGui::Text("Refresh %.1f FPS", io.Framerate);
|
ImGui::PopFont();
|
||||||
ImGui::Text("Memory %s", SystemToolkit::byte_to_string( SystemToolkit::memory_usage()).c_str() );
|
ImGui::SameLine(0, 10);
|
||||||
ImGui::PopFont();
|
if (ImGuiToolkit::IconToggle(11, 14, 12, 14, &dumm))
|
||||||
|
start_time_1_ = time_; // reset timer 1
|
||||||
|
ImGuiToolkit::PushFont(ImGuiToolkit::FONT_LARGE);
|
||||||
|
ImGui::Text("%s", GstToolkit::time_to_string(time_-start_time_2_, GstToolkit::TIME_STRING_FIXED).c_str());
|
||||||
|
ImGui::PopFont();
|
||||||
|
ImGui::SameLine(0, 10); dumm = true;
|
||||||
|
if (ImGuiToolkit::IconToggle(11, 14, 12, 14, &dumm))
|
||||||
|
start_time_1_ = time_; // reset timer 2
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ImGuiToolkit::PushFont(ImGuiToolkit::FONT_MONO);
|
||||||
|
ImGui::Text("Window %.0f x %.0f", io.DisplaySize.x, io.DisplaySize.y);
|
||||||
|
// ImGui::Text("HiDPI (retina) %s", io.DisplayFramebufferScale.x > 1.f ? "on" : "off");
|
||||||
|
ImGui::Text("Refresh %.1f FPS", io.Framerate);
|
||||||
|
ImGui::Text("Memory %s", SystemToolkit::byte_to_string( SystemToolkit::memory_usage()).c_str() );
|
||||||
|
ImGui::PopFont();
|
||||||
|
}
|
||||||
|
|
||||||
if (ImGui::BeginPopupContextWindow())
|
if (ImGui::BeginPopupContextWindow())
|
||||||
{
|
{
|
||||||
if (ImGui::MenuItem("Custom", NULL, corner == -1)) *p_corner = -1;
|
if (ImGui::MenuItem("Free position", NULL, corner == -1)) *p_corner = -1;
|
||||||
if (ImGui::MenuItem("Top", NULL, corner == 1)) *p_corner = 1;
|
if (ImGui::MenuItem("Top", NULL, corner == 1)) *p_corner = 1;
|
||||||
if (ImGui::MenuItem("Bottom", NULL, corner == 3)) *p_corner = 3;
|
if (ImGui::MenuItem("Bottom", NULL, corner == 3)) *p_corner = 3;
|
||||||
if (p_open && ImGui::MenuItem("Close")) *p_open = false;
|
if (p_open && ImGui::MenuItem("Close")) *p_open = false;
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ namespace ImGuiToolkit
|
|||||||
void SetAccentColor (accent_color color);
|
void SetAccentColor (accent_color color);
|
||||||
struct ImVec4 GetHighlightColor ();
|
struct ImVec4 GetHighlightColor ();
|
||||||
|
|
||||||
void ShowStats (bool* p_open, int* p_corner);
|
void ShowStats (bool* p_open, int* p_corner, bool* p_timer);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ void Settings::Save()
|
|||||||
widgetsNode->SetAttribute("media_player", application.widget.media_player);
|
widgetsNode->SetAttribute("media_player", application.widget.media_player);
|
||||||
widgetsNode->SetAttribute("shader_editor", application.widget.shader_editor);
|
widgetsNode->SetAttribute("shader_editor", application.widget.shader_editor);
|
||||||
widgetsNode->SetAttribute("stats", application.widget.stats);
|
widgetsNode->SetAttribute("stats", application.widget.stats);
|
||||||
|
widgetsNode->SetAttribute("stats_timer", application.widget.stats_timer);
|
||||||
widgetsNode->SetAttribute("stats_corner", application.widget.stats_corner);
|
widgetsNode->SetAttribute("stats_corner", application.widget.stats_corner);
|
||||||
widgetsNode->SetAttribute("logs", application.widget.logs);
|
widgetsNode->SetAttribute("logs", application.widget.logs);
|
||||||
widgetsNode->SetAttribute("toolbox", application.widget.toolbox);
|
widgetsNode->SetAttribute("toolbox", application.widget.toolbox);
|
||||||
@@ -243,6 +244,7 @@ void Settings::Load()
|
|||||||
widgetsNode->QueryBoolAttribute("media_player", &application.widget.media_player);
|
widgetsNode->QueryBoolAttribute("media_player", &application.widget.media_player);
|
||||||
widgetsNode->QueryBoolAttribute("shader_editor", &application.widget.shader_editor);
|
widgetsNode->QueryBoolAttribute("shader_editor", &application.widget.shader_editor);
|
||||||
widgetsNode->QueryBoolAttribute("stats", &application.widget.stats);
|
widgetsNode->QueryBoolAttribute("stats", &application.widget.stats);
|
||||||
|
widgetsNode->QueryBoolAttribute("stats_timer", &application.widget.stats_timer);
|
||||||
widgetsNode->QueryIntAttribute("stats_corner", &application.widget.stats_corner);
|
widgetsNode->QueryIntAttribute("stats_corner", &application.widget.stats_corner);
|
||||||
widgetsNode->QueryBoolAttribute("logs", &application.widget.logs);
|
widgetsNode->QueryBoolAttribute("logs", &application.widget.logs);
|
||||||
widgetsNode->QueryBoolAttribute("toolbox", &application.widget.toolbox);
|
widgetsNode->QueryBoolAttribute("toolbox", &application.widget.toolbox);
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ struct WidgetsConfig
|
|||||||
{
|
{
|
||||||
bool stats;
|
bool stats;
|
||||||
int stats_corner;
|
int stats_corner;
|
||||||
|
bool stats_timer;
|
||||||
bool logs;
|
bool logs;
|
||||||
bool preview;
|
bool preview;
|
||||||
bool history;
|
bool history;
|
||||||
@@ -25,6 +26,7 @@ struct WidgetsConfig
|
|||||||
|
|
||||||
WidgetsConfig() {
|
WidgetsConfig() {
|
||||||
stats = false;
|
stats = false;
|
||||||
|
stats_timer = false;
|
||||||
stats_corner = 1;
|
stats_corner = 1;
|
||||||
logs = false;
|
logs = false;
|
||||||
preview = false;
|
preview = false;
|
||||||
@@ -208,7 +210,7 @@ struct Application
|
|||||||
History recentFolders;
|
History recentFolders;
|
||||||
History recentImport;
|
History recentImport;
|
||||||
|
|
||||||
Application() : fresh_start(false), name(APP_NAME), executable(APP_NAME) {
|
Application() : fresh_start(false), instance_id(0), name(APP_NAME), executable(APP_NAME) {
|
||||||
scale = 1.f;
|
scale = 1.f;
|
||||||
accent_color = 0;
|
accent_color = 0;
|
||||||
pannel_stick = false;
|
pannel_stick = false;
|
||||||
|
|||||||
@@ -786,7 +786,9 @@ void UserInterface::Render()
|
|||||||
|
|
||||||
// stats in the corner
|
// stats in the corner
|
||||||
if (Settings::application.widget.stats)
|
if (Settings::application.widget.stats)
|
||||||
ImGuiToolkit::ShowStats(&Settings::application.widget.stats, &Settings::application.widget.stats_corner);
|
ImGuiToolkit::ShowStats(&Settings::application.widget.stats,
|
||||||
|
&Settings::application.widget.stats_corner,
|
||||||
|
&Settings::application.widget.stats_timer);
|
||||||
|
|
||||||
// management of video_recorder
|
// management of video_recorder
|
||||||
FrameGrabber *rec = Mixer::manager().session()->getFrameGrabber(video_recorder_);
|
FrameGrabber *rec = Mixer::manager().session()->getFrameGrabber(video_recorder_);
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
#define APP_TITLE " -- Video Live Mixer"
|
#define APP_TITLE " -- Video Live Mixer"
|
||||||
#define APP_SETTINGS "vimix.xml"
|
#define APP_SETTINGS "vimix.xml"
|
||||||
#define APP_VERSION_MAJOR 0
|
#define APP_VERSION_MAJOR 0
|
||||||
#define APP_VERSION_MINOR 3
|
#define APP_VERSION_MINOR 4
|
||||||
#define XML_VERSION_MAJOR 0
|
#define XML_VERSION_MAJOR 0
|
||||||
#define XML_VERSION_MINOR 1
|
#define XML_VERSION_MINOR 1
|
||||||
#define MAX_RECENT_HISTORY 20
|
#define MAX_RECENT_HISTORY 20
|
||||||
|
|||||||
Reference in New Issue
Block a user