[vlc-commits] player: Increase the media playcount when stopping
Hugo Beauzée-Luyssen
git at videolan.org
Tue Sep 24 14:34:29 CEST 2019
vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Tue Jul 30 17:16:49 2019 +0200| [a8b29867ec0b9844063da981527e42ebf8f83e25] | committer: Hugo Beauzée-Luyssen
player: Increase the media playcount when stopping
refs #22524
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a8b29867ec0b9844063da981527e42ebf8f83e25
---
src/player/medialib.c | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/src/player/medialib.c b/src/player/medialib.c
index 5c06f1ec22..c079870ab1 100644
--- a/src/player/medialib.c
+++ b/src/player/medialib.c
@@ -134,7 +134,23 @@ vlc_player_UpdateMLStates(vlc_player_t *player, struct vlc_player_input* input)
return;
}
- input->ml.states.progress = input->position;
+ /* If we reached 95% of the media or have less than 10s remaining, bump the
+ * play count & the media in the history */
+ if (input->position >= .95f ||
+ input->length - input->time < VLC_TICK_FROM_SEC(10))
+ {
+ vlc_ml_media_increase_playcount(ml, media->i_id);
+ /* Ensure we remove any previously saved position to allow the playback
+ * of this media to restart from the begining */
+ if (input->ml.states.progress >= .0f )
+ {
+ vlc_ml_media_set_playback_state(ml, media->i_id,
+ VLC_ML_PLAYBACK_STATE_PROGRESS, NULL );
+ input->ml.states.progress = -1.f;
+ }
+ }
+ else
+ input->ml.states.progress = input->position;
/* If the value changed during the playback, update it in the medialibrary.
* If not, set each state to their "unset" values, so that they aren't saved
More information about the vlc-commits
mailing list