-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
vf_vapoursynth: add user-data parameter to allow user to pass arbitrary data to script #14312
Conversation
Download the artifacts for this pull request: |
Note that currently the build script on Windows does not turn on the "vapoursynth" feature, thus the CI and build artifact does not actually test the change. Shall I flip the option in the build script? |
Can't really comment on VS stuff, idea to pass user data is fine. Probably can do it already with something like environment variable and read it in the VS script, but we can pass string from options too.
Probably need more than just a flip to build it correctly, but if you want, feel free to do it. Note that vapoursynth is built in MSYS2 builds, so it gets build coverage there. |
The only environment variable can be read from VapourSynth side must be set before the mpv process is created (i.e. system ev), as I mentioned in #14214. You can't pass video-specific data. |
How about I add |
9833f0f
to
b196473
Compare
Nah, either it is build fully or not mentioned at all, we would need to do it for all options.
Indeed, mpv reads env only once at the beginning, this could be changed, but probably setting user_data directly is better. |
Gotcha.
Thanks. I prefer user_data because the env var route 1) requires at least Lua script, meaning we can't use it in a mpv profile; 2) even in Lua, we need either 3rd party Lua dependency since vanilla Lua can't change env var just for current process, or need to subprocess to a 3rd party app to change. Both are not ideal. |
Currently the vapoursynth video filter does not accept any argument for passing arbitrary user data. This limits what the VS script can do. Ideally, the vapoursynth filter has an user-data parameter that contain string value. mpv passes that value to the VS script just like container_fps and others. Once the VS script gets the data, it can do all sorts of data extraction and transformation. Another benefit is that instead of mpv always have to catch up to user needs for this filter, with this users can just pass whatever needed themselves, thus becomes more future-proof. Fixes mpv-player#14214
Currently the vapoursynth video filter does not accept any argument for passing arbitrary user data. This limits what the VS script can do.
Ideally, the vapoursynth filter has an user-data parameter that contains string value. mpv passes that value to the VS script just like container_fps and others. Once the VS script gets the data, it can do all sorts of data extraction and transformation.
Another benefit is that instead of mpv always have to catch up to user needs for this filter, with this users can just pass whatever needed themselves, thus becomes more future-proof.
Fixes #14214
Discussion: I did not put any restriction on how big the user data can be. Could there be any security vulnerability without such restriction?