From a7f11ed35236f465ec32a25e6ad7d3b288494e0f Mon Sep 17 00:00:00 2001 From: Oneric Date: Fri, 18 Nov 2022 23:40:20 +0100 Subject: [PATCH] csri: stop advertising support for unimplemented formats MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit An application is supposed to first configure a supported format via csri_request_fmt(..) for an instance and then pass frames in the previously requested format to csri_render(..). This setup logic was broken, when support for non BGR_ formats was dropped in 50d3b3b7ab712ee2419f48de14db1b01a8406e43 and applications can no longer detect whether a format is supported ahead of time and will instead crash when trying to render using any non BGR_ frame. Since I’m not sure what issue was fixed with those formats being dropped, whether they ever worked correctly or if anyone is even using them, just properly signal them being unsupported. (Aegisub exclusively uses BGR_ since 2010, predating the removal in xy-VSFilter. See Aegisub SVN r5079 or 824294078f23cb77e4a46d9b927421f7888002e2) --- src/filters/transform/vsfilter/csriapi.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/filters/transform/vsfilter/csriapi.cpp b/src/filters/transform/vsfilter/csriapi.cpp index b032db02..e7b5a086 100644 --- a/src/filters/transform/vsfilter/csriapi.cpp +++ b/src/filters/transform/vsfilter/csriapi.cpp @@ -114,12 +114,12 @@ CSRIAPI int csri_request_fmt(csri_inst *inst, const struct csri_fmt *fmt) // Check if pixel format is supported switch (fmt->pixfmt) { case CSRI_F_BGR_: - case CSRI_F_BGR: - case CSRI_F_YUY2: - case CSRI_F_YV12: inst->pixfmt = fmt->pixfmt; break; + case CSRI_F_BGR: // guliverkli2-VSFilter and old xy-VSFilter used to + case CSRI_F_YUY2: // support those formats, but they were dropped in + case CSRI_F_YV12: // 50d3b3b7ab712ee2419f48de14db1b01a8406e43 default: return -1; } @@ -144,11 +144,11 @@ CSRIAPI void csri_render(csri_inst *inst, struct csri_frame *frame, double time) break; default: - ASSERT(0); - CString msg; - msg.Format(_T("Anything other then RGB32 is NOT supported!")); - MessageBox(NULL, msg, _T("Warning"), MB_OKCANCEL|MB_ICONWARNING); - int o = 0; o=o/o; + ASSERT(0); + CString msg; + msg.Format(_T("Anything other then RGB32 is NOT supported!")); + MessageBox(NULL, msg, _T("Warning"), MB_OKCANCEL|MB_ICONWARNING); + int o = 0; o=o/o; return; } spd.vidrect = inst->video_rect;