-
Notifications
You must be signed in to change notification settings - Fork 24
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
Port away from deprecated/removed APIs in mpv 2.0 #19
Conversation
Register observers as MPV_EVENT_IDLE is deprecated and MPV_EVENT_PAUSE/MPV_EVENT_UNPAUSE have been removed. See also: mpv-player/mpv#9541
Thanks for reporting this, but unfortunately this won't work for many reasons. As I will show: Lines 375 to 378 in d3d58fb
At least on my PC, when mpvpaper first runs it thinks it's in a idle state at start. So it immediately quits because of this. (This behavior was not there before) Even if try to get around that obstacle by clearing the event buffers it won't quit on idle. Even MPV_EVENT_SHUTDOWN is acting a little weird now. Lines 391 to 392 in d3d58fb
This is also not where it should be, as this is how the other pthreads unpause mpv after pausing them for either a watch list or automatically. It should be just before pthread_usleep(10000); .
Line 380 in d3d58fb
Did you mean "pause" not "paused"? if (mpv_get_property(mpv, "pause", MPV_FORMAT_FLAG, &mpv_paused) < 0) {
Lastly a small nit pick, using a switch case for 2 cases is unneeded a "if" and "else if" is fine here. The code so far:
I threw MPV_OBSERVE_IDLE and MPV_OBSERVE_PAUSE in there as well, because they won't be used outside of this function. Sorry for the long comment, thanks again for bring this to my attention. I appreciate the attempt. |
Thank you for testing, because I always got core dumped when running mpvpaper on my laptop so I can't test if it still works. Hope to see your fix soon :D |
This is the backtrace:
|
This commit mainly fixes how mpv events are processed. See: #19 - Since some mpv event are deprecated, "mpv_observe_property" is being used instead of MPV_EVENT_PAUSE and MPV_EVENT_UNPAUSE - mpv's default "idle" option for libmpv is now always set to off/no as it provided no use and can't be loaded before user options, sorry. - Pausing functions should now behave a little better with less race conditions. - Cleaning up mpvpaper has been improved by also fixing some race conditions. - Turned some mpv_command_async calls into mpv_command as it was not necessary. - Some error messages have been modified/created - Stopped creating a pthread for a watch list if the file is empty - Add signal handlers for SIGQUIT and SIGTERM to exit mpvpaper
Could you tell me if this helped: |
It works, thanks! |
Register observers as
MPV_EVENT_IDLE
is deprecated andMPV_EVENT_PAUSE
/MPV_EVENT_UNPAUSE
have been removed.See also: mpv-player/mpv#9541