mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-11 10:19:59 +01:00
Recording timeout with timing slider
Changed timout recording in uint milisecond.
This commit is contained in:
@@ -249,9 +249,9 @@ bool FrameGrabber::busy() const
|
||||
return false;
|
||||
}
|
||||
|
||||
double FrameGrabber::duration() const
|
||||
uint64_t FrameGrabber::duration() const
|
||||
{
|
||||
return gst_guint64_to_gdouble( GST_TIME_AS_MSECONDS(timestamp_) ) / 1000.0;
|
||||
return GST_TIME_AS_MSECONDS(timestamp_);
|
||||
}
|
||||
|
||||
void FrameGrabber::stop ()
|
||||
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
|
||||
virtual void stop();
|
||||
virtual std::string info() const;
|
||||
virtual double duration() const;
|
||||
virtual uint64_t duration() const;
|
||||
virtual bool finished() const;
|
||||
virtual bool busy() const;
|
||||
|
||||
|
||||
@@ -520,20 +520,20 @@ void ImGuiToolkit::HelpIcon(const char* desc, int i, int j, const char* shortcut
|
||||
}
|
||||
|
||||
|
||||
bool ImGuiToolkit::SliderTiming (const char* label, int* ms, int v_min, int v_max, const char* text_max)
|
||||
bool ImGuiToolkit::SliderTiming (const char* label, uint* ms, uint v_min, uint v_max, uint v_step, const char* text_max)
|
||||
{
|
||||
char text_buf[256];
|
||||
if ( *ms < v_min || text_max == nullptr) {
|
||||
|
||||
if ( *ms < v_max || text_max == nullptr)
|
||||
{
|
||||
int milisec = (*ms)%1000;
|
||||
int sec = (*ms)/1000;
|
||||
int min = sec/60;
|
||||
|
||||
if (min > 0) {
|
||||
if (milisec>0)
|
||||
ImFormatString(text_buf, IM_ARRAYSIZE(text_buf), "%d min %d s %03d ms", min, sec%60, milisec);
|
||||
ImFormatString(text_buf, IM_ARRAYSIZE(text_buf), "%d min %02d s %03d ms", min, sec%60, milisec);
|
||||
else
|
||||
ImFormatString(text_buf, IM_ARRAYSIZE(text_buf), "%d min %d s", min, sec%60);
|
||||
ImFormatString(text_buf, IM_ARRAYSIZE(text_buf), "%d min %02d s", min, sec%60);
|
||||
}
|
||||
else if (sec > 0) {
|
||||
if (milisec>0)
|
||||
@@ -549,10 +549,10 @@ bool ImGuiToolkit::SliderTiming (const char* label, int* ms, int v_min, int v_ma
|
||||
}
|
||||
|
||||
// precision 50 ms
|
||||
int val = *ms / 50;
|
||||
bool ret = ImGui::SliderInt(label, &val, v_min / 50, v_max / 50, text_buf);
|
||||
int val = *ms / v_step;
|
||||
bool ret = ImGui::SliderInt(label, &val, v_min / v_step, v_max / v_step, text_buf);
|
||||
|
||||
*ms = val * 50;
|
||||
*ms = val * v_step;
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -700,11 +700,11 @@ void ImGuiToolkit::RenderTimeline (ImGuiWindow* window, ImRect timeline_bbox, gu
|
||||
pos = ImLerp(timeline_bbox.GetTL(), timeline_bbox.GetTR(), tick_percent);
|
||||
|
||||
}
|
||||
ImGui::PopStyleColor(1);
|
||||
|
||||
ImGui::PopStyleColor(1);
|
||||
}
|
||||
|
||||
bool ImGuiToolkit::TimelineSlider(const char* label, guint64 *time, guint64 begin, guint64 first, guint64 end, guint64 step, const float width)
|
||||
bool ImGuiToolkit::TimelineSlider (const char* label, guint64 *time, guint64 begin, guint64 first, guint64 end, guint64 step, const float width)
|
||||
{
|
||||
// get window
|
||||
ImGuiWindow* window = ImGui::GetCurrentWindow();
|
||||
@@ -856,7 +856,7 @@ void ImGuiToolkit::Timeline (const char* label, guint64 time, guint64 begin, gui
|
||||
}
|
||||
}
|
||||
|
||||
bool ImGuiToolkit::InvisibleSliderInt(const char* label, uint *index, uint min, uint max, ImVec2 size)
|
||||
bool ImGuiToolkit::InvisibleSliderInt (const char* label, uint *index, uint min, uint max, ImVec2 size)
|
||||
{
|
||||
// get window
|
||||
ImGuiWindow* window = ImGui::GetCurrentWindow();
|
||||
@@ -898,13 +898,12 @@ bool ImGuiToolkit::InvisibleSliderInt(const char* label, uint *index, uint min,
|
||||
uint _end = max;
|
||||
value_changed = ImGui::SliderBehavior(bbox, id, ImGuiDataType_U32, index, &_zero,
|
||||
&_end, "%ld", 1.f, ImGuiSliderFlags_None, &grab_slider_bb);
|
||||
|
||||
}
|
||||
|
||||
return value_changed;
|
||||
}
|
||||
|
||||
bool ImGuiToolkit::EditPlotLines(const char* label, float *array, int values_count, float values_min, float values_max, const ImVec2 size)
|
||||
bool ImGuiToolkit::EditPlotLines (const char* label, float *array, int values_count, float values_min, float values_max, const ImVec2 size)
|
||||
{
|
||||
bool array_changed = false;
|
||||
|
||||
@@ -997,7 +996,7 @@ bool ImGuiToolkit::EditPlotLines(const char* label, float *array, int values_cou
|
||||
}
|
||||
|
||||
|
||||
bool ImGuiToolkit::EditPlotHistoLines(const char* label, float *histogram_array, float *lines_array,
|
||||
bool ImGuiToolkit::EditPlotHistoLines (const char* label, float *histogram_array, float *lines_array,
|
||||
int values_count, float values_min, float values_max, guint64 begin, guint64 end,
|
||||
bool edit_histogram, bool *released, const ImVec2 size)
|
||||
{
|
||||
@@ -1158,7 +1157,7 @@ bool ImGuiToolkit::EditPlotHistoLines(const char* label, float *histogram_array,
|
||||
return array_changed;
|
||||
}
|
||||
|
||||
void ImGuiToolkit::ShowPlotHistoLines(const char* label, float *histogram_array, float *lines_array, int values_count, float values_min, float values_max, const ImVec2 size)
|
||||
void ImGuiToolkit::ShowPlotHistoLines (const char* label, float *histogram_array, float *lines_array, int values_count, float values_min, float values_max, const ImVec2 size)
|
||||
{
|
||||
// get window
|
||||
ImGuiWindow* window = ImGui::GetCurrentWindow();
|
||||
@@ -1204,7 +1203,7 @@ void ImGuiToolkit::ShowPlotHistoLines(const char* label, float *histogram_array,
|
||||
}
|
||||
|
||||
|
||||
void ImGuiToolkit::SetFont(ImGuiToolkit::font_style style, const std::string &ttf_font_name, int pointsize, int oversample)
|
||||
void ImGuiToolkit::SetFont (ImGuiToolkit::font_style style, const std::string &ttf_font_name, int pointsize, int oversample)
|
||||
{
|
||||
// Font Atlas ImGui Management
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
@@ -1257,7 +1256,7 @@ void ImGuiToolkit::SetFont(ImGuiToolkit::font_style style, const std::string &tt
|
||||
|
||||
}
|
||||
|
||||
void ImGuiToolkit::PushFont(ImGuiToolkit::font_style style)
|
||||
void ImGuiToolkit::PushFont (ImGuiToolkit::font_style style)
|
||||
{
|
||||
if (fontmap.count(style) > 0)
|
||||
ImGui::PushFont( fontmap[style] );
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace ImGuiToolkit
|
||||
void HelpIcon (const char* desc, int i = 19, int j = 5, const char* shortcut = nullptr);
|
||||
|
||||
// sliders
|
||||
bool SliderTiming (const char* label, int *ms, int v_min, int v_max, const char* text_max = nullptr);
|
||||
bool SliderTiming (const char* label, uint *ms, uint v_min, uint v_max, uint v_step, const char* text_max = nullptr);
|
||||
bool TimelineSlider (const char* label, guint64 *time, guint64 begin, guint64 first, guint64 end, guint64 step, const float width);
|
||||
void RenderTimeline (struct ImGuiWindow* window, struct ImRect timeline_bbox, guint64 begin, guint64 end, guint64 step, bool verticalflip = false);
|
||||
void Timeline (const char* label, guint64 time, guint64 begin, guint64 end, guint64 step, const float width);
|
||||
|
||||
@@ -299,7 +299,7 @@ void Settings::Load()
|
||||
XMLElement * recordnode = pRoot->FirstChildElement("Record");
|
||||
if (recordnode != nullptr) {
|
||||
recordnode->QueryIntAttribute("profile", &application.record.profile);
|
||||
recordnode->QueryFloatAttribute("timeout", &application.record.timeout);
|
||||
recordnode->QueryUnsignedAttribute("timeout", &application.record.timeout);
|
||||
recordnode->QueryIntAttribute("delay", &application.record.delay);
|
||||
|
||||
const char *path_ = recordnode->Attribute("path");
|
||||
|
||||
@@ -66,13 +66,13 @@ struct ViewConfig
|
||||
|
||||
};
|
||||
|
||||
#define RECORD_MAX_TIMEOUT 1800.f
|
||||
#define RECORD_MAX_TIMEOUT 301000
|
||||
|
||||
struct RecordConfig
|
||||
{
|
||||
std::string path;
|
||||
int profile;
|
||||
float timeout;
|
||||
uint timeout;
|
||||
int delay;
|
||||
|
||||
RecordConfig() : path("") {
|
||||
|
||||
@@ -1161,8 +1161,9 @@ void UserInterface::RenderPreview()
|
||||
Settings::application.record.path = SystemToolkit::home_path();
|
||||
|
||||
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
|
||||
ImGui::SliderFloat("Duration", &Settings::application.record.timeout, 1.f, RECORD_MAX_TIMEOUT,
|
||||
Settings::application.record.timeout < (RECORD_MAX_TIMEOUT - 1.f) ? "%.0f s" : "Until stopped", 3.f);
|
||||
ImGuiToolkit::SliderTiming ("Duration", &Settings::application.record.timeout, 1000, RECORD_MAX_TIMEOUT, 1000, "Until stopped");
|
||||
// ImGui::SliderFloat("Duration", &Settings::application.record.timeout, 1.f, RECORD_MAX_TIMEOUT,
|
||||
// Settings::application.record.timeout < (RECORD_MAX_TIMEOUT - 1.f) ? "%.0f s" : "Until stopped", 3.f);
|
||||
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
|
||||
ImGui::SliderInt("Trigger", &Settings::application.record.delay, 0, 5,
|
||||
Settings::application.record.delay < 1 ? "Immediate" : "After %d s");
|
||||
@@ -2814,7 +2815,7 @@ void SourceController::RenderSingleSource(Source *s)
|
||||
// fill info string
|
||||
s->accept(info_);
|
||||
|
||||
float tooltip_height = 2.f * ImGui::GetTextLineHeightWithSpacing();
|
||||
float tooltip_height = 3.f * ImGui::GetTextLineHeightWithSpacing();
|
||||
ImDrawList* draw_list = ImGui::GetWindowDrawList();
|
||||
draw_list->AddRectFilled(top, top + ImVec2(framesize.x, tooltip_height), IMGUI_COLOR_OVERLAY);
|
||||
ImGui::SetCursorScreenPos(top + ImVec2(h_space_, v_space_));
|
||||
@@ -2877,7 +2878,6 @@ void SourceController::RenderMediaPlayer(MediaPlayer *mp)
|
||||
ImGui::SetCursorScreenPos(top_image);
|
||||
ImGui::Image((void*)(uintptr_t) mediaplayer_active_->texture(), framesize);
|
||||
|
||||
|
||||
///
|
||||
/// Info overlays
|
||||
///
|
||||
@@ -3146,9 +3146,9 @@ void SourceController::RenderMediaPlayer(MediaPlayer *mp)
|
||||
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
|
||||
ImGuiToolkit::ComboIcon("Curve", icons_curve, labels_curve, &c);
|
||||
|
||||
static int d = 1000;
|
||||
static uint d = 1000;
|
||||
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
|
||||
ImGuiToolkit::SliderTiming ("Duration", &d, 200, 5000);
|
||||
ImGuiToolkit::SliderTiming ("Duration", &d, 200, 5000, 50);
|
||||
|
||||
bool close = false;
|
||||
ImGui::SetCursorPos(pos + ImVec2(0.f, area.y - buttons_height_));
|
||||
|
||||
Reference in New Issue
Block a user