| @@ -15,10 +15,11 @@ · 14 unmodified lines |
| 15 | * License along with mpv. If not, see <http://www.gnu.org/licenses/>. | 15 | * License along with mpv. If not, see <http://www.gnu.org/licenses/>. |
| 16 | */ | 16 | */ |
| 17 | | 17 | |
| 18 | #include <stddef.h> | | |
| 19 | #include <stdbool.h> | | |
| 20 | #include <errno.h> | | |
| 21 | #include <assert.h> | 18 | #include <assert.h> |
| | 19 | #include <errno.h> |
| | 20 | #include <math.h> |
| | 21 | #include <stdbool.h> |
| | 22 | #include <stddef.h> |
| 22 | | 23 | |
| 23 | #include "mpv_talloc.h" | 24 | #include "mpv_talloc.h" |
| 24 | | 25 | |
| @@ -191,17 +192,18 @@ void update_vo_playback_state(struct MPContext *mpctx) · 166 unmodified lines |
| 191 | { | 192 | { |
| 192 | if (mpctx->video_out && mpctx->video_out->config_ok) { | 193 | if (mpctx->video_out && mpctx->video_out->config_ok) { |
| 193 | struct voctrl_playback_state oldstate = mpctx->vo_playback_state; | 194 | struct voctrl_playback_state oldstate = mpctx->vo_playback_state; |
| | 195 | double pos = get_current_pos_ratio(mpctx, false); |
| 194 | struct voctrl_playback_state newstate = { | 196 | struct voctrl_playback_state newstate = { |
| 195 | .taskbar_progress = mpctx->opts->vo->taskbar_progress, | 197 | .taskbar_progress = mpctx->opts->vo->taskbar_progress && pos >= 0, |
| 196 | .playing = mpctx->playing, | 198 | .playing = mpctx->playing, |
| 197 | .paused = mpctx->paused, | 199 | .paused = mpctx->paused, |
| 198 | .percent_pos = get_percent_pos(mpctx), | 200 | .position = pos > 0 ? lrint(pos * UINT8_MAX) : 0, |
| 199 | }; | 201 | }; |
| 200 | | 202 | |
| 201 | if (oldstate.taskbar_progress != newstate.taskbar_progress || | 203 | if (oldstate.taskbar_progress != newstate.taskbar_progress || |
| 202 | oldstate.playing != newstate.playing || | 204 | oldstate.playing != newstate.playing || |
| 203 | oldstate.paused != newstate.paused || | 205 | oldstate.paused != newstate.paused || |
| 204 | oldstate.percent_pos != newstate.percent_pos) | 206 | oldstate.position != newstate.position) |
| 205 | { | 207 | { |
| 206 | // Don't update progress bar if it was and still is hidden | 208 | // Don't update progress bar if it was and still is hidden |
| 207 | if ((oldstate.playing && oldstate.taskbar_progress) || | 209 | if ((oldstate.playing && oldstate.taskbar_progress) || |