From 86a1f2931b21431d2d94f2f99610cdade6663093 Mon Sep 17 00:00:00 2001 From: Karl Blomster Date: Wed, 24 Jun 2009 18:16:03 +0000 Subject: [PATCH] Adjust the way VFR is handled in VideoContext::SetVideo; should be cleaner and less prone to odd bugs now (hopefully). Doesn't try to set CFR framerates on VFR videos anymore, for one thing. Fixes #864. Originally committed to SVN as r3084. --- aegisub/src/video_context.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/aegisub/src/video_context.cpp b/aegisub/src/video_context.cpp index 03234ddbf..a0f999dcb 100644 --- a/aegisub/src/video_context.cpp +++ b/aegisub/src/video_context.cpp @@ -288,14 +288,17 @@ void VideoContext::SetVideo(const wxString &filename) { // Set frame rate fps = provider->GetFPS(); - if (!isVfr || provider->IsNativelyByFrames()) { - VFR_Input.SetCFR(fps); - if (VFR_Output.GetFrameRateType() != VFR) VFR_Output.SetCFR(fps); - } - else { + // if the source is vfr and the provider isn't frame-based (i.e. is dshow), + // we need to jump through some hoops to make VFR work properly. + if (!provider->IsNativelyByFrames() && isVfr) { FrameRate temp = provider->GetTrueFrameRate(); provider->OverrideFrameTimeList(temp.GetFrameTimeList()); } + // source not VFR? set as CFR + else if (!isVfr) { + VFR_Input.SetCFR(fps); + if (VFR_Output.GetFrameRateType() != VFR) VFR_Output.SetCFR(fps); + } // Gather video parameters length = provider->GetFrameCount();