Add an option to play audio when stepping through video, like some other video players do. Also, add .mov as a file format to load, as it is widely used on Mac and seems to work fine for me with ffmpeg.

Originally committed to SVN as r4120.
This commit is contained in:
Kevin Ollivier 2010-02-17 06:24:29 +00:00
parent 65b09da334
commit 3082838aa1
3 changed files with 17 additions and 1 deletions

View file

@ -449,6 +449,7 @@ DialogOptions::DialogOptions(wxWindow *parent)
AddCheckBox(audioPage,audioSizer3,_("Snap to keyframes"),_T("Audio snap to keyframes")); AddCheckBox(audioPage,audioSizer3,_("Snap to keyframes"),_T("Audio snap to keyframes"));
AddCheckBox(audioPage,audioSizer3,_("Snap to adjacent lines"),_T("Audio snap to other lines")); AddCheckBox(audioPage,audioSizer3,_("Snap to adjacent lines"),_T("Audio snap to other lines"));
AddCheckBox(audioPage,audioSizer3,_("Auto-focus on mouse over"),_T("Audio Autofocus")); AddCheckBox(audioPage,audioSizer3,_("Auto-focus on mouse over"),_T("Audio Autofocus"));
AddCheckBox(audioPage,audioSizer3,_("Play audio when stepping in video"),_T("Audio Plays When Stepping Video"));
audioSizer3->AddGrowableCol(1,1); audioSizer3->AddGrowableCol(1,1);
// Second sizer // Second sizer

View file

@ -692,7 +692,7 @@ void FrameMain::OnVideoPlay(wxCommandEvent &event) {
/// ///
void FrameMain::OnOpenVideo(wxCommandEvent& WXUNUSED(event)) { void FrameMain::OnOpenVideo(wxCommandEvent& WXUNUSED(event)) {
wxString path = Options.AsText(_T("Last open video path")); wxString path = Options.AsText(_T("Last open video path"));
wxString str = wxString(_("Video Formats")) + _T(" (*.avi,*.mkv,*.mp4,*.avs,*.d2v,*.ogm,*.mpeg,*.mpg,*.vob)|*.avi;*.avs;*.d2v;*.mkv;*.ogm;*.mp4;*.mpeg;*.mpg;*.vob|") wxString str = wxString(_("Video Formats")) + _T(" (*.avi,*.mkv,*.mp4,*.avs,*.d2v,*.ogm,*.mpeg,*.mpg,*.vob,*.mov)|*.avi;*.avs;*.d2v;*.mkv;*.ogm;*.mp4;*.mpeg;*.mpg;*.vob;*.mov|")
+ _("All Files") + _T(" (*.*)|*.*"); + _("All Files") + _T(" (*.*)|*.*");
wxString filename = wxFileSelector(_("Open video file"),path,_T(""),_T(""),str,wxFD_OPEN | wxFD_FILE_MUST_EXIST); wxString filename = wxFileSelector(_("Open video file"),path,_T(""),_T(""),str,wxFD_OPEN | wxFD_FILE_MUST_EXIST);
if (!filename.empty()) { if (!filename.empty()) {
@ -1779,6 +1779,13 @@ void FrameMain::OnStatusClear(wxTimerEvent &event) {
/// ///
void FrameMain::OnNextFrame(wxCommandEvent &event) { void FrameMain::OnNextFrame(wxCommandEvent &event) {
videoBox->videoSlider->NextFrame(); videoBox->videoSlider->NextFrame();
// FIXME: This is probably not the best place to put this, but I was told
// this code is all undergoing a rewrite, so I consider this a temporary solution.
if (audioBox && Options.AsBool(_T("Audio Plays When Stepping Video"))) {
int start = VFR_Output.GetTimeAtFrame(videoBox->videoDisplay->GetFrame());
int end = VFR_Output.GetTimeAtFrame(videoBox->videoDisplay->GetFrame() + 1);
audioBox->audioDisplay->Play(start,end);
}
} }
@ -1788,6 +1795,13 @@ void FrameMain::OnNextFrame(wxCommandEvent &event) {
/// ///
void FrameMain::OnPrevFrame(wxCommandEvent &event) { void FrameMain::OnPrevFrame(wxCommandEvent &event) {
videoBox->videoSlider->PrevFrame(); videoBox->videoSlider->PrevFrame();
// FIXME: This is probably not the best place to put this, but I was told
// this code is all undergoing a rewrite, so I consider this a temporary solution.
if (audioBox && Options.AsBool(_T("Audio Plays When Stepping Video"))) {
int start = VFR_Output.GetTimeAtFrame(videoBox->videoDisplay->GetFrame() - 1);
int end = VFR_Output.GetTimeAtFrame(videoBox->videoDisplay->GetFrame());
audioBox->audioDisplay->Play(start,end);
}
} }

View file

@ -199,6 +199,7 @@ void OptionsManager::LoadDefaults(bool onlyDefaults,bool doOverride) {
SetModificationType(MOD_AUTOMATIC); SetModificationType(MOD_AUTOMATIC);
SetBool(_T("Audio grab times on select"),true); SetBool(_T("Audio grab times on select"),true);
SetBool(_T("Audio Autofocus"),false); SetBool(_T("Audio Autofocus"),false);
SetBool(_T("Audio Plays When Stepping Video"),false);
SetBool(_T("Audio Wheel Default To Zoom"),false); SetBool(_T("Audio Wheel Default To Zoom"),false);
SetBool(_T("Audio lock scroll on cursor"),false); SetBool(_T("Audio lock scroll on cursor"),false);
SetBool(_T("Audio snap to keyframes"),false); SetBool(_T("Audio snap to keyframes"),false);