player/javascript: disable stream error logging

Failure to open a file here should not be treated as an error
if the exception is handled by the script.
This commit is contained in:
nanahi 2024-10-21 15:57:38 -04:00 committed by Avi Halachmi
parent bd5e3c0261
commit 25ccae9216
1 changed files with 4 additions and 1 deletions

View File

@ -354,7 +354,10 @@ static void af_push_file(js_State *J, const char *fname, int limit, void *af)
// mp.utils.read_file allows partial read up to limit which results in // mp.utils.read_file allows partial read up to limit which results in
// error for stream_read_file if the file is larger than limit, so use // error for stream_read_file if the file is larger than limit, so use
// STREAM_ALLOW_PARTIAL_READ to allow reading returning partial results. // STREAM_ALLOW_PARTIAL_READ to allow reading returning partial results.
int flags = STREAM_READ_FILE_FLAGS_DEFAULT | STREAM_ALLOW_PARTIAL_READ; // Additionally, disable error logging by stream since the exception
// can be caught and handled by a JS script.
int flags = STREAM_READ_FILE_FLAGS_DEFAULT | STREAM_ALLOW_PARTIAL_READ |
STREAM_SILENT;
bstr data = stream_read_file2(filename, af, flags, bstr data = stream_read_file2(filename, af, flags,
jctx(J)->mpctx->global, limit); jctx(J)->mpctx->global, limit);
if (data.start) { if (data.start) {