tiny bugfix timeline gaps

This commit is contained in:
brunoherbelin
2020-08-21 23:03:36 +02:00
parent 710514b478
commit 9f954d258f
2 changed files with 9 additions and 10 deletions

View File

@@ -470,7 +470,7 @@ void MediaPlayer::play(bool on)
else if (on)
Log::Info("MediaPlayer %s Start", gst_element_get_name(pipeline_));
else
Log::Info("MediaPlayer %s Stop", gst_element_get_name(pipeline_));
Log::Info("MediaPlayer %s Stop [%ld]", gst_element_get_name(pipeline_), position());
#endif
// reset time counter
@@ -541,7 +541,7 @@ void MediaPlayer::step()
void MediaPlayer::seek(GstClockTime pos)
{
if (!enabled_ || !media_.seekable)
if (!enabled_ || !media_.seekable || seeking_)
return;
// apply seek
@@ -750,19 +750,19 @@ void MediaPlayer::update()
seeking_ = false;
}
// manage timeline
// manage timeline: test if position falls into a gap
TimeInterval gap;
if (position_ != GST_CLOCK_TIME_NONE && media_.timeline.gapAt(position_, gap)) {
// if in a gap, seek to next section
if (gap.is_valid()) {
// jump in one or the other direction
GstClockTime jumpPts = (rate_>0.f) ? gap.end : gap.begin;
// seek to next valid time (if not beginnig or end of timeline)
if (jumpPts > media_.timeline.first() && jumpPts < media_.timeline.last())
seek( jumpPts);
// otherwise, we should loop
else
need_loop = true;
}
}
@@ -775,7 +775,6 @@ void MediaPlayer::update()
}
void MediaPlayer::execute_loop_command()
{
if (loop_==LOOP_REWIND) {

View File

@@ -1353,7 +1353,7 @@ void MediaController::Render()
uint press_index = array_size;
bool pressed = ImGuiToolkit::InvisibleSliderInt("##TimelinePicking", &press_index, 0, array_size-1, size);
bool pressed = ImGuiToolkit::InvisibleSliderInt("##TimelinePicking", &press_index, 0, array_size, size);
// behavior on action on array of segments
static bool active = false;
@@ -1379,7 +1379,7 @@ void MediaController::Render()
// back to drawing position to draw the segments data with historgram
ImGui::SetCursorPos(draw_pos);
{
ImGui::PlotHistogram("##TimelineHistogram", array, array_size-1.f, 0, NULL, 0.0f, 1.0f, size);
ImGui::PlotHistogram("##TimelineHistogram", array, array_size, 0, NULL, 0.0f, 1.0f, size);
}
// custom timeline slider