mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-11 18:34:58 +01:00
Fixed mediaplayer loop on EOS for both rate directions.
This commit is contained in:
@@ -439,6 +439,9 @@ void MediaPlayer::seekNextFrame()
|
|||||||
if (!enabled_ || isPlaying())
|
if (!enabled_ || isPlaying())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if ( position_ == ( rate_ < 0.0 ? start_position_ : duration() ) )
|
||||||
|
rewind();
|
||||||
|
|
||||||
// step
|
// step
|
||||||
gst_element_send_event (pipeline_, gst_event_new_step (GST_FORMAT_BUFFERS, 1, ABS(rate_), TRUE, FALSE));
|
gst_element_send_event (pipeline_, gst_event_new_step (GST_FORMAT_BUFFERS, 1, ABS(rate_), TRUE, FALSE));
|
||||||
}
|
}
|
||||||
@@ -840,7 +843,7 @@ bool MediaPlayer::fill_frame(GstBuffer *buf, MediaPlayer::FrameStatus status)
|
|||||||
}
|
}
|
||||||
// give a position to EOS
|
// give a position to EOS
|
||||||
else {
|
else {
|
||||||
frame_[write_index_].position = duration();
|
frame_[write_index_].position = rate_ > 0.0 ? duration() : start_position_;
|
||||||
}
|
}
|
||||||
|
|
||||||
// unlock access to frame
|
// unlock access to frame
|
||||||
|
|||||||
@@ -398,20 +398,19 @@ void UserInterface::handleMouse()
|
|||||||
//
|
//
|
||||||
// RIGHT Mouse button
|
// RIGHT Mouse button
|
||||||
//
|
//
|
||||||
|
|
||||||
if ( ImGui::IsMouseDragging(ImGuiMouseButton_Right, 10.0f) )
|
if ( ImGui::IsMouseDragging(ImGuiMouseButton_Right, 10.0f) )
|
||||||
{
|
{
|
||||||
// right mouse drag => drag current view
|
// right mouse drag => drag current view
|
||||||
View::Cursor c = Mixer::manager().view()->drag( mouseclic[ImGuiMouseButton_Right], mousepos);
|
View::Cursor c = Mixer::manager().view()->drag( mouseclic[ImGuiMouseButton_Right], mousepos);
|
||||||
setMouseCursor(io.MousePos, c);
|
setMouseCursor(io.MousePos, c);
|
||||||
}
|
}
|
||||||
else if ( ImGui::IsMouseDown(ImGuiMouseButton_Right)) {
|
else if ( ImGui::IsMouseDown(ImGuiMouseButton_Right))
|
||||||
|
{
|
||||||
Mixer::manager().unsetCurrentSource();
|
Mixer::manager().unsetCurrentSource();
|
||||||
navigator.hidePannel();
|
navigator.hidePannel();
|
||||||
// glm::vec3 point = Rendering::manager().unProject(mousepos, Mixer::manager().currentView()->scene.root()->transform_ );
|
// glm::vec3 point = Rendering::manager().unProject(mousepos, Mixer::manager().currentView()->scene.root()->transform_ );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Right) )
|
if ( ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Right) )
|
||||||
{
|
{
|
||||||
Mixer::manager().view()->recenter();
|
Mixer::manager().view()->recenter();
|
||||||
@@ -504,7 +503,6 @@ void UserInterface::handleMouse()
|
|||||||
// only operate if the view didn't change
|
// only operate if the view didn't change
|
||||||
if (view_drag == Mixer::manager().view()) {
|
if (view_drag == Mixer::manager().view()) {
|
||||||
|
|
||||||
|
|
||||||
// action on current source
|
// action on current source
|
||||||
Source *current = Mixer::manager().currentSource();
|
Source *current = Mixer::manager().currentSource();
|
||||||
if (current)
|
if (current)
|
||||||
@@ -1147,7 +1145,7 @@ void MediaController::Render()
|
|||||||
|
|
||||||
float spacing = ImGui::GetStyle().ItemInnerSpacing.x;
|
float spacing = ImGui::GetStyle().ItemInnerSpacing.x;
|
||||||
|
|
||||||
if (ImGui::Button(ICON_FA_FAST_BACKWARD))
|
if (ImGui::Button(mp_->playSpeed() > 0 ? ICON_FA_FAST_BACKWARD :ICON_FA_FAST_FORWARD))
|
||||||
mp_->rewind();
|
mp_->rewind();
|
||||||
ImGui::SameLine(0, spacing);
|
ImGui::SameLine(0, spacing);
|
||||||
|
|
||||||
@@ -1157,8 +1155,7 @@ void MediaController::Render()
|
|||||||
|
|
||||||
// display buttons Play/Stop depending on current playing mode
|
// display buttons Play/Stop depending on current playing mode
|
||||||
if (media_playing_mode_) {
|
if (media_playing_mode_) {
|
||||||
|
if (ImGui::Button(ICON_FA_PAUSE " Pause", ImVec2(100, 0)))
|
||||||
if (ImGui::Button(ICON_FA_PAUSE " Pause"))
|
|
||||||
media_playing_mode_ = false;
|
media_playing_mode_ = false;
|
||||||
ImGui::SameLine(0, spacing);
|
ImGui::SameLine(0, spacing);
|
||||||
|
|
||||||
@@ -1168,8 +1165,7 @@ void MediaController::Render()
|
|||||||
ImGui::PopButtonRepeat();
|
ImGui::PopButtonRepeat();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
if (ImGui::Button(mp_->playSpeed() < 0 ? ICON_FA_LESS_THAN " Play": ICON_FA_GREATER_THAN " Play", ImVec2(100, 0)))
|
||||||
if (ImGui::Button(ICON_FA_PLAY " Play "))
|
|
||||||
media_playing_mode_ = true;
|
media_playing_mode_ = true;
|
||||||
ImGui::SameLine(0, spacing);
|
ImGui::SameLine(0, spacing);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user