-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Unable to unset demuxer-lavf-format #15840
Comments
Line 641 in e4b64fb
|
I think we should just check if string is not empty. Like na-na-hi said, NULL isn't really useful to be set to string options. I know it is internally NULL by default, but neither js, lua or cli allows us to set NULL value. And it was working only in C by sheer accident how strings were copied. Now indeed, the string is left in empty state, which is incidentally what you would get anyway on clean mpv instance if you do Also as you noticed our logging asserts out on NULL values when it tries to format it. So really, that's not a valid usage of this API. |
Thank you both for the replies, indeed, I missed the comment in client.h. I'm still a little unclear on whether there's a method to unset |
Yes, I will make it possible. |
mpv internally treats all string options/properties with NULL or an empty string the same way. client.h explicitly forbids MPV_FORMAT_STRING from being NULL, but in the C API, it has been working accidentally due to how strings are copied. Nevertheless, none of the APIs allow this; JavaScript, Lua, IPC, and CLI all require strings to be at least empty. We cannot pass NULL. Furthermore, currently passing NULL causes an assertion failure in the JSON formatter, so it is clearly not intended to be used that way. Internally, all string options default to NULL, but in this case, they should behave exactly the same as an empty string. Hence, this change is applied to the `demuxer-lavf-format` option. Note that get_property will never return a NULL value, regardless of the internal value. Fixes: mpv-player#15840
mpv Information
Other Information
Reproduction Steps
Start mpv with:
mpv-sb.so
is a work in progress c-plugin that setsdemuxer-lavf-format
based on header data sent by a media server. For files that the media server doesn't natively support, I need to unsetdemuxer-lavf-format
and let mpv probe for the format to use. The below c-plugin code worked with mpv 0.38.0, allowing me to play a list of tracks and setting or unsettingdemuxer-lavf-format
as required for the track.After playing a track that explicitly sets the format and then changing to a track that doesn't, which sets fmt = NULL, I now get:
It seems that format is always set here now, even after trying to unset it. I tested with this patch and setting fmt = "none" above instead of NULL and that does restore the old behavior:
I did a git bisect between 0.38.0 and 0.39.0 and this is the commit that broke it for me:
I reverted the change to
options/m_option.c
and that fixes it for me.Is there something I should do differently to unset "demuxer-lavf-format" rather than setting it to NULL?
Expected Behavior
Set and unset
demuxer-lavf-format
successfully.Actual Behavior
Unable to unset
demuxer-lavf-format
after setting it.Log File
mpv.log
I know that's not a proper log file. When I run with --log-file I get:
Sample Files
No response
I carefully read all instruction and confirm that I did the following:
--log-file=output.txt
.The text was updated successfully, but these errors were encountered: