From 89d7e0a321959ab277fbef28c277b5a41144f9d1 Mon Sep 17 00:00:00 2001
From: Thomas Goyne <plorkyeran@aegisub.org>
Date: Tue, 9 Oct 2012 08:04:38 -0700
Subject: [PATCH] Allow framerate transform to/from variable without external
 timecodes loaded

This is a potentially sensible operation (to convert from VFR to/from
the video's average FPS), so there's no reason to require that the input
and output timecodes be from different places.

Closes #1530.
---
 aegisub/src/export_framerate.cpp | 6 +++---
 aegisub/src/video_context.cpp    | 2 --
 aegisub/src/video_context.h      | 4 +---
 3 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/aegisub/src/export_framerate.cpp b/aegisub/src/export_framerate.cpp
index 72a5018dc..520d548e8 100644
--- a/aegisub/src/export_framerate.cpp
+++ b/aegisub/src/export_framerate.cpp
@@ -139,8 +139,8 @@ void AssTransformFramerateFilter::LoadSettings(bool is_default, agi::Context *c)
 	this->c = c;
 
 	if (is_default) {
-		Input = &c->videoController->VFR_Input;
-		Output = &c->videoController->VFR_Output;
+		Input = &c->videoController->VideoFPS();
+		Output = &c->videoController->FPS();
 	}
 	else {
 		double temp;
@@ -152,7 +152,7 @@ void AssTransformFramerateFilter::LoadSettings(bool is_default, agi::Context *c)
 			t2 = temp;
 			Output = &t2;
 		}
-		else Output = &c->videoController->VFR_Output;
+		else Output = &c->videoController->FPS();
 
 		if (Reverse->IsChecked()) {
 			std::swap(Input, Output);
diff --git a/aegisub/src/video_context.cpp b/aegisub/src/video_context.cpp
index 571ac7c90..bdc0d829d 100644
--- a/aegisub/src/video_context.cpp
+++ b/aegisub/src/video_context.cpp
@@ -78,8 +78,6 @@ VideoContext::VideoContext()
 , arType(0)
 , hasSubtitles(false)
 , playAudioOnStep(OPT_GET("Audio/Plays When Stepping Video"))
-, VFR_Input(videoFPS)
-, VFR_Output(ovrFPS)
 {
 	Bind(EVT_VIDEO_ERROR, &VideoContext::OnVideoError, this);
 	Bind(EVT_SUBTITLES_ERROR, &VideoContext::OnSubtitlesError, this);
diff --git a/aegisub/src/video_context.h b/aegisub/src/video_context.h
index 656b5ac83..fc749db59 100644
--- a/aegisub/src/video_context.h
+++ b/aegisub/src/video_context.h
@@ -150,9 +150,6 @@ class VideoContext : public wxEvtHandler {
 	void Reset();
 
 public:
-	const agi::vfr::Framerate &VFR_Input;
-	const agi::vfr::Framerate &VFR_Output;
-
 	VideoContext();
 	~VideoContext();
 
@@ -261,6 +258,7 @@ public:
 	bool TimecodesLoaded() const { return videoFPS.IsLoaded() || ovrFPS.IsLoaded(); };
 
 	const agi::vfr::Framerate& FPS() const { return ovrFPS.IsLoaded() ? ovrFPS : videoFPS; }
+	const agi::vfr::Framerate& VideoFPS() const { return videoFPS; }
 
 	int TimeAtFrame(int frame, agi::vfr::Time type = agi::vfr::EXACT) const;
 	int FrameAtTime(int time, agi::vfr::Time type = agi::vfr::EXACT) const;
-- 
GitLab