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.
This commit is contained in:
Thomas Goyne 2012-10-09 08:04:38 -07:00
parent a56bf25d00
commit 89d7e0a321
3 changed files with 4 additions and 8 deletions

View File

@ -139,8 +139,8 @@ void AssTransformFramerateFilter::LoadSettings(bool is_default, agi::Context *c)
this->c = c; this->c = c;
if (is_default) { if (is_default) {
Input = &c->videoController->VFR_Input; Input = &c->videoController->VideoFPS();
Output = &c->videoController->VFR_Output; Output = &c->videoController->FPS();
} }
else { else {
double temp; double temp;
@ -152,7 +152,7 @@ void AssTransformFramerateFilter::LoadSettings(bool is_default, agi::Context *c)
t2 = temp; t2 = temp;
Output = &t2; Output = &t2;
} }
else Output = &c->videoController->VFR_Output; else Output = &c->videoController->FPS();
if (Reverse->IsChecked()) { if (Reverse->IsChecked()) {
std::swap(Input, Output); std::swap(Input, Output);

View File

@ -78,8 +78,6 @@ VideoContext::VideoContext()
, arType(0) , arType(0)
, hasSubtitles(false) , hasSubtitles(false)
, playAudioOnStep(OPT_GET("Audio/Plays When Stepping Video")) , playAudioOnStep(OPT_GET("Audio/Plays When Stepping Video"))
, VFR_Input(videoFPS)
, VFR_Output(ovrFPS)
{ {
Bind(EVT_VIDEO_ERROR, &VideoContext::OnVideoError, this); Bind(EVT_VIDEO_ERROR, &VideoContext::OnVideoError, this);
Bind(EVT_SUBTITLES_ERROR, &VideoContext::OnSubtitlesError, this); Bind(EVT_SUBTITLES_ERROR, &VideoContext::OnSubtitlesError, this);

View File

@ -150,9 +150,6 @@ class VideoContext : public wxEvtHandler {
void Reset(); void Reset();
public: public:
const agi::vfr::Framerate &VFR_Input;
const agi::vfr::Framerate &VFR_Output;
VideoContext(); VideoContext();
~VideoContext(); ~VideoContext();
@ -261,6 +258,7 @@ public:
bool TimecodesLoaded() const { return videoFPS.IsLoaded() || ovrFPS.IsLoaded(); }; bool TimecodesLoaded() const { return videoFPS.IsLoaded() || ovrFPS.IsLoaded(); };
const agi::vfr::Framerate& FPS() const { return ovrFPS.IsLoaded() ? ovrFPS : videoFPS; } 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 TimeAtFrame(int frame, agi::vfr::Time type = agi::vfr::EXACT) const;
int FrameAtTime(int time, agi::vfr::Time type = agi::vfr::EXACT) const; int FrameAtTime(int time, agi::vfr::Time type = agi::vfr::EXACT) const;