src/player/mpvadapter: fix compatibility with mpv 0.38.0 #225
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Since version 0.38.0, mpv requires an additional integer argument ("index") for the
loadfile
command that comes before the options, but is ignored in most cases (see documentation). I guess when you tried adjusting for mpv 0.38.0 before in 02ce0bd, the error you mention probably is because it was expecting an integer argument for the position where the options used to be, and passing NULL removes the argument all together, but this should still break all cases where there actually are options that are passed toloadfile
, including the very much important start and end times fortempAudioClip()
, so I'm confused how this seems to have gone unnoticed.Anyway, since the order of arguments now depends on the mpv version the user has installed on the system (at least when it is dynamically linked like on Linux), we need to implement a runtime version check that conditionally stuffs an argument before the options string. This value can be arbitrary since it is ignored in our cases.
Another potential option would be using
mpv_set_option_string()
to set thestart,end,aid
options (and maybe even the input file?) to avoid having to pass these arguments withloadfile
all together, which worked with both mpv 0.37.0 and 0.38.0.Here is the commit that brings the breaking change, the comments might be worth reading: mpv-player/mpv@c678033