Never ask to change the script resolution when opening dummy video
This commit is contained in:
parent
4dd76012cd
commit
ab44e51edc
3 changed files with 15 additions and 7 deletions
|
@ -71,6 +71,9 @@ public:
|
||||||
/// @brief Does this provider want Aegisub to cache video frames?
|
/// @brief Does this provider want Aegisub to cache video frames?
|
||||||
/// @return Returns true if caching is desired, false otherwise.
|
/// @return Returns true if caching is desired, false otherwise.
|
||||||
virtual bool WantsCaching() const { return false; }
|
virtual bool WantsCaching() const { return false; }
|
||||||
|
|
||||||
|
/// Should the video properties in the script be set to this video's property if they already have values?
|
||||||
|
virtual bool ShouldSetVideoProperties() const { return true; }
|
||||||
};
|
};
|
||||||
|
|
||||||
DEFINE_BASE_EXCEPTION_NOINNER(VideoProviderError, agi::Exception)
|
DEFINE_BASE_EXCEPTION_NOINNER(VideoProviderError, agi::Exception)
|
||||||
|
|
|
@ -122,14 +122,17 @@ void VideoContext::SetVideo(const agi::fs::path &filename) {
|
||||||
|
|
||||||
bool commit_subs = false;
|
bool commit_subs = false;
|
||||||
try {
|
try {
|
||||||
provider.reset(new ThreadedFrameSource(filename, context->ass->GetScriptInfo("YCbCr Matrix"), this));
|
auto old_matrix = context->ass->GetScriptInfo("YCbCr Matrix");
|
||||||
|
provider.reset(new ThreadedFrameSource(filename, old_matrix, this));
|
||||||
video_provider = provider->GetVideoProvider();
|
video_provider = provider->GetVideoProvider();
|
||||||
video_filename = filename;
|
video_filename = filename;
|
||||||
|
|
||||||
// Video provider handles the case where matrix is different but
|
// When opening dummy video only want to set the script properties if
|
||||||
// compatible, so no need to handle it here
|
// they were previously unset
|
||||||
|
bool set_properties = video_provider->ShouldSetVideoProperties();
|
||||||
|
|
||||||
auto matrix = video_provider->GetColorSpace();
|
auto matrix = video_provider->GetColorSpace();
|
||||||
if (!matrix.empty() && matrix != context->ass->GetScriptInfo("YCbCr Matrix")) {
|
if (set_properties && matrix != old_matrix) {
|
||||||
context->ass->SetScriptInfo("YCbCr Matrix", matrix);
|
context->ass->SetScriptInfo("YCbCr Matrix", matrix);
|
||||||
commit_subs = true;
|
commit_subs = true;
|
||||||
}
|
}
|
||||||
|
@ -149,7 +152,7 @@ void VideoContext::SetVideo(const agi::fs::path &filename) {
|
||||||
}
|
}
|
||||||
// If it has been set to something other than a multiple of the video
|
// If it has been set to something other than a multiple of the video
|
||||||
// resolution, ask the user if they want it to be fixed
|
// resolution, ask the user if they want it to be fixed
|
||||||
else if (sx % vx != 0 || sy % vy != 0) {
|
else if (set_properties && (sx % vx != 0 || sy % vy != 0)) {
|
||||||
switch (OPT_GET("Video/Check Script Res")->GetInt()) {
|
switch (OPT_GET("Video/Check Script Res")->GetInt()) {
|
||||||
case 1: // Ask to change on mismatch
|
case 1: // Ask to change on mismatch
|
||||||
if (wxYES != wxMessageBox(
|
if (wxYES != wxMessageBox(
|
||||||
|
@ -175,7 +178,8 @@ void VideoContext::SetVideo(const agi::fs::path &filename) {
|
||||||
// Set frame rate
|
// Set frame rate
|
||||||
video_fps = video_provider->GetFPS();
|
video_fps = video_provider->GetFPS();
|
||||||
if (ovr_fps.IsLoaded()) {
|
if (ovr_fps.IsLoaded()) {
|
||||||
int ovr = wxMessageBox(_("You already have timecodes loaded. Would you like to replace them with timecodes from the video file?"), _("Replace timecodes?"), wxYES_NO | wxICON_QUESTION);
|
int ovr = wxMessageBox(_("You already have timecodes loaded. Would you like to replace them with timecodes from the video file?"),
|
||||||
|
_("Replace timecodes?"), wxYES_NO | wxICON_QUESTION);
|
||||||
if (ovr == wxYES) {
|
if (ovr == wxYES) {
|
||||||
ovr_fps = agi::vfr::Framerate();
|
ovr_fps = agi::vfr::Framerate();
|
||||||
timecodes_filename.clear();
|
timecodes_filename.clear();
|
||||||
|
|
|
@ -86,6 +86,7 @@ public:
|
||||||
double GetDAR() const override { return 0; }
|
double GetDAR() const override { return 0; }
|
||||||
agi::vfr::Framerate GetFPS() const override { return fps; }
|
agi::vfr::Framerate GetFPS() const override { return fps; }
|
||||||
std::vector<int> GetKeyFrames() const override { return {}; }
|
std::vector<int> GetKeyFrames() const override { return {}; }
|
||||||
std::string GetColorSpace() const override { return ""; }
|
std::string GetColorSpace() const override { return "None"; }
|
||||||
std::string GetDecoderName() const override { return "Dummy Video Provider"; }
|
std::string GetDecoderName() const override { return "Dummy Video Provider"; }
|
||||||
|
bool ShouldSetVideoProperties() const override { return false; }
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue