mirror of https://github.com/odrling/Aegisub
Remove the prohibition against seeking while video is playing and just do Stop; Seek; Play as the slider already did in some cases
Originally committed to SVN as r5964.
This commit is contained in:
parent
f95f1f13cf
commit
8ab9ba77ae
|
@ -74,7 +74,6 @@ VideoContext::VideoContext()
|
|||
: playback(this)
|
||||
, startMS(0)
|
||||
, endFrame(0)
|
||||
, playNextFrame(-1)
|
||||
, nextFrame(-1)
|
||||
, keepAudioSync(true)
|
||||
, frame_n(0)
|
||||
|
@ -271,13 +270,17 @@ void VideoContext::OnSubtitlesSave() {
|
|||
void VideoContext::JumpToFrame(int n) {
|
||||
if (!IsLoaded()) return;
|
||||
|
||||
// Prevent intervention during playback
|
||||
if (IsPlaying() && n != playNextFrame) return;
|
||||
bool was_playing = IsPlaying();
|
||||
if (was_playing)
|
||||
Stop();
|
||||
|
||||
frame_n = mid(0, n, GetLength() - 1);
|
||||
|
||||
GetFrameAsync(frame_n);
|
||||
Seek(frame_n);
|
||||
|
||||
if (was_playing)
|
||||
Play();
|
||||
}
|
||||
|
||||
void VideoContext::JumpToTime(int ms, agi::vfr::Time end) {
|
||||
|
@ -402,7 +405,6 @@ void VideoContext::PlayLine() {
|
|||
endFrame = FrameAtTime(context->selectionController->GetActiveLine()->End.GetMS(),agi::vfr::END) + 1;
|
||||
|
||||
// Jump to start
|
||||
playNextFrame = startFrame;
|
||||
JumpToFrame(startFrame);
|
||||
|
||||
// Start timer
|
||||
|
@ -436,9 +438,9 @@ void VideoContext::OnPlayTimer(wxTimerEvent &) {
|
|||
}
|
||||
|
||||
// Jump to next frame
|
||||
playNextFrame = nextFrame;
|
||||
frame_n = nextFrame;
|
||||
JumpToFrame(nextFrame);
|
||||
GetFrameAsync(frame_n);
|
||||
Seek(frame_n);
|
||||
|
||||
// Sync audio
|
||||
if (keepAudioSync && nextFrame % 10 == 0 && context->audioController->IsPlaying()) {
|
||||
|
|
|
@ -104,9 +104,6 @@ class VideoContext : public wxEvtHandler {
|
|||
/// DOCME
|
||||
int endFrame;
|
||||
|
||||
/// DOCME
|
||||
int playNextFrame;
|
||||
|
||||
/// DOCME
|
||||
int nextFrame;
|
||||
|
||||
|
|
|
@ -113,9 +113,9 @@ BEGIN_EVENT_TABLE(VideoSlider, wxWindow)
|
|||
END_EVENT_TABLE()
|
||||
|
||||
void VideoSlider::OnMouse(wxMouseEvent &event) {
|
||||
int x = event.GetX();
|
||||
if (event.LeftIsDown()) {
|
||||
int x = event.GetX();
|
||||
|
||||
if (event.ButtonIsDown(wxMOUSE_BTN_LEFT)) {
|
||||
// If the slider didn't already have focus, don't seek if the user
|
||||
// clicked very close to the current location as they were probably
|
||||
// just trying to focus the slider
|
||||
|
@ -125,7 +125,7 @@ void VideoSlider::OnMouse(wxMouseEvent &event) {
|
|||
}
|
||||
|
||||
// Shift click to snap to keyframe
|
||||
if (event.m_shiftDown) {
|
||||
if (event.ShiftDown()) {
|
||||
int clickedFrame = GetValueAtX(x);
|
||||
std::vector<int>::const_iterator pos = lower_bound(keyframes.begin(), keyframes.end(), clickedFrame);
|
||||
if (pos == keyframes.end())
|
||||
|
@ -144,23 +144,11 @@ void VideoSlider::OnMouse(wxMouseEvent &event) {
|
|||
SetValue(go);
|
||||
}
|
||||
|
||||
if (c->videoController->IsPlaying()) {
|
||||
c->videoController->Stop();
|
||||
c->videoController->JumpToFrame(val);
|
||||
c->videoController->Play();
|
||||
}
|
||||
else
|
||||
c->videoController->JumpToFrame(val);
|
||||
SetFocus();
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.ButtonDown(wxMOUSE_BTN_RIGHT) || event.ButtonDown(wxMOUSE_BTN_MIDDLE)) {
|
||||
c->videoController->JumpToFrame(val);
|
||||
SetFocus();
|
||||
}
|
||||
|
||||
else if (!c->videoController->IsPlaying())
|
||||
event.Skip();
|
||||
else if (event.ButtonDown())
|
||||
SetFocus();
|
||||
}
|
||||
|
||||
void VideoSlider::OnKeyDown(wxKeyEvent &event) {
|
||||
|
|
Loading…
Reference in New Issue