Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GUI/navigation] fast forward #453

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion avidemux/common/ADM_commonUI/myOwnMenu.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,8 @@ static const MenuEntry _myMenuGo[] = {
{MENU_ACTION,QT_TRANSLATE_NOOP("adm","Backward 4 seconds"), NULL,ACT_Back4Seconds, MKICON(backward4s), "Ctrl+Shift+Left",0},
{MENU_ACTION,QT_TRANSLATE_NOOP("adm","Forward 4 seconds"), NULL,ACT_Forward4Seconds, MKICON(forward4s), "Ctrl+Shift+Right",0},
{MENU_ACTION,QT_TRANSLATE_NOOP("adm","Backward one minute"), NULL,ACT_Back1Mn, MKICON(backward1mn), NULL,0},
{MENU_ACTION,QT_TRANSLATE_NOOP("adm","Forward one minute"), NULL,ACT_Forward1Mn, MKICON(forward1mn), NULL,0}
{MENU_ACTION,QT_TRANSLATE_NOOP("adm","Forward one minute"), NULL,ACT_Forward1Mn, MKICON(forward1mn), NULL,0},
{MENU_ACTION,QT_TRANSLATE_NOOP("adm","Fast Forward"), NULL,ACT_FastForward, MKICON(fastforward), "Alt+Right",0}
};

std::vector<MenuEntry> myMenuGo(_myMenuGo, _myMenuGo + sizeof(_myMenuGo) / sizeof(_myMenuGo[0]));
Expand Down
1 change: 1 addition & 0 deletions avidemux/common/gtkgui.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ bool GUI_NextFrame(void);
bool GUI_PrevFrame(void);
bool GUI_NextKeyFrame(void);
bool GUI_PreviousKeyFrame(void);
bool GUI_FastForward(void);

bool GUI_GoToTime(uint64_t time);
uint8_t GUI_close(void);
Expand Down
1 change: 1 addition & 0 deletions avidemux/common/gui_action.names
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ ACT(FineScale)
ACT(Refresh)
ACT(SeekBackward)
ACT(SeekForward)
ACT(FastForward)
ACT(NAVIGATE_END)
//ACT(JumpToTime)

Expand Down
37 changes: 37 additions & 0 deletions avidemux/common/gui_navigate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,9 @@ static int ignore_change=0;
case ACT_NextKFrame:
GUI_NextKeyFrame();
break;
case ACT_FastForward:
GUI_FastForward();
break;
case ACT_PrevCutPoint:
GUI_PrevCutPoint();
break;
Expand Down Expand Up @@ -387,6 +390,40 @@ bool GUI_NextKeyFrame(void)
return true;
}

/**
\fn GUI_FastForward
\brief next N frame
*/
bool GUI_FastForward(void)
{
if (playing)
return false;
if (!avifileinfo)
return false;

uint64_t pts=admPreview::getCurrentPts();
admPreview::deferDisplay(true);
bool nextError=false;
for (int i=0; i<999; i++)
{
if(!admPreview::nextPicture())
{
nextError = (i==0);
break;
}
if (admPreview::getCurrentPts() < pts) break;
if (admPreview::getCurrentPts() >= (pts+200000LL)) break;

}
admPreview::deferDisplay(false);
if (nextError)
return false;
admPreview::samePicture();
GUI_setCurrentFrameAndTime();
UI_purge();
return true;
}

/**
\fn GUI_GoToKFrameTime
\brief Go to keyframe at given exact time
Expand Down
10 changes: 10 additions & 0 deletions avidemux/qt4/ADM_userInterfaces/ADM_gui/Q_gui2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,12 @@ void MainWindow::sendAction(Action a)
if (((a==ACT_NextFrame)||(a==ACT_NextKFrame)) && (playing || (navigateWhilePlayingState != 0)))
navigateWhilePlaying(ACT_SeekForward);
else
if (a==ACT_FastForward)
{
if (actionLock==0)
emit actionSignal(a);
}
else
if(a>ACT_NAVIGATE_BEGIN && a<ACT_NAVIGATE_END && a!=ACT_Scale)
{
if (actionLock<=NAVIGATION_ACTION_LOCK_THRESHOLD)
Expand Down Expand Up @@ -2063,6 +2069,8 @@ bool MainWindow::eventFilter(QObject* watched, QEvent* event)
sendAction(ACT_Back1Second);
else if (keyEvent->modifiers() & Qt::ControlModifier)
sendAction(ACT_Back2Seconds);
else if (keyEvent->modifiers() & Qt::AltModifier)
sendAction(ACT_Back1Second);
else
sendAction(ACT_PreviousFrame);

Expand All @@ -2074,6 +2082,8 @@ bool MainWindow::eventFilter(QObject* watched, QEvent* event)
sendAction(ACT_Forward1Second);
else if (keyEvent->modifiers() & Qt::ControlModifier)
sendAction(ACT_Forward2Seconds);
else if (keyEvent->modifiers() & Qt::AltModifier)
sendAction(ACT_FastForward);
else
sendAction(ACT_NextFrame);

Expand Down
2 changes: 2 additions & 0 deletions avidemux/qt4/ADM_userInterfaces/ADM_gui/avidemux.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@
<file>pics/[email protected]</file>
<file>pics/hdr.png</file>
<file>pics/[email protected]</file>
<file>pics/fastforward.png</file>
<file>pics/[email protected]</file>
<file>fonts/ADM7SEG.ttf</file>
<file>sounds/notify.wav</file>
</qresource>
Expand Down
2 changes: 2 additions & 0 deletions avidemux/qt4/ADM_userInterfaces/ADM_gui/avidemux_osx.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@
<file>pics/[email protected]</file>
<file>pics/hdr.png</file>
<file>pics/[email protected]</file>
<file>pics/fastforward.png</file>
<file>pics/[email protected]</file>
<file>fonts/ADM7SEG.ttf</file>
<file>sounds/notify.wav</file>
</qresource>
Expand Down
2 changes: 2 additions & 0 deletions avidemux/qt4/ADM_userInterfaces/ADM_gui/avidemux_win32.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@
<file>pics/[email protected]</file>
<file>pics/hdr.png</file>
<file>pics/[email protected]</file>
<file>pics/fastforward.png</file>
<file>pics/[email protected]</file>
<file>sounds/notify.wav</file>
</qresource>
</RCC>
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@
<file>pics/[email protected]</file>
<file>pics/hdr.png</file>
<file>pics/[email protected]</file>
<file>pics/fastforward.png</file>
<file>pics/[email protected]</file>
<file>fonts/ADM7SEG.ttf</file>
<file>sounds/notify.wav</file>
</qresource>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading