Skip to content

Commit

Permalink
csri: stop advertising support for unimplemented formats
Browse files Browse the repository at this point in the history
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 50d3b3b 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)
  • Loading branch information
TheOneric committed Jan 5, 2023
1 parent 883518e commit a7f11ed
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/filters/transform/vsfilter/csriapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;
Expand Down

0 comments on commit a7f11ed

Please sign in to comment.