From b7f3e19e008ce62d234d7b54bb7452cf51275562 Mon Sep 17 00:00:00 2001 From: arch1t3cht Date: Tue, 1 Nov 2022 20:25:05 +0100 Subject: [PATCH] vapoursynth: Don't update script colorspace if colorspace unknown Aegisub will automatically override the YCbCr Matrix field of the current file's Script Properties with the video's reported color space. The FFMS2 provider guesses a color space for all videos, but we don't do this for Vapoursynth. Thus, we now disable this overriding whenever the colorspace isn't known. --- src/video_provider_vs.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/video_provider_vs.cpp b/src/video_provider_vs.cpp index 724df2cb2..8e110eb3f 100644 --- a/src/video_provider_vs.cpp +++ b/src/video_provider_vs.cpp @@ -63,11 +63,12 @@ public: int GetHeight() const override { return vi->height; } double GetDAR() const override { return dar; } std::vector GetKeyFrames() const override { return keyframes; } - std::string GetColorSpace() const override { return colorspace; } - std::string GetRealColorSpace() const override { return colorspace; } + std::string GetColorSpace() const override { return GetRealColorSpace(); } + std::string GetRealColorSpace() const override { return colorspace == "Unknown" ? "None" : colorspace; } bool HasAudio() const override { return false; } - virtual bool WantsCaching() const override { return true; } - virtual std::string GetDecoderName() const override { return "VapourSynth"; } + bool WantsCaching() const override { return true; } + std::string GetDecoderName() const override { return "VapourSynth"; } + bool ShouldSetVideoProperties() const override { return colorspace != "Unknown"; } }; std::string colormatrix_description(int colorFamily, int colorRange, int matrix) { @@ -90,7 +91,7 @@ std::string colormatrix_description(int colorFamily, int colorRange, int matrix) case VSC_MATRIX_ST240_M: return str + ".240M"; default: - return "None"; + return "Unknown"; // Will return "None" in GetColorSpace } }