[vlc-devel] [PATCH v2 9/9] libvlc: player: add stop_async()

Rémi Denis-Courmont remi at remlab.net
Wed May 15 12:31:41 CEST 2019


Nit: zero is plural in English.

Le 15 mai 2019 12:53:17 GMT+03:00, Romain Vimont <rom1v at videolabs.io> a écrit :
>libvlc_media_player_stop() was the only blocking function, the others
>(play, pause…) were asynchronous.
>
>Add a function which stop asynchronously.
>---
> include/vlc/libvlc_media_player.h | 12 +++++++++++-
> lib/media_player.c                | 10 ++++++++++
> 2 files changed, 21 insertions(+), 1 deletion(-)
>
>diff --git a/include/vlc/libvlc_media_player.h
>b/include/vlc/libvlc_media_player.h
>index 3fc0b6a644..363d3f21f4 100644
>--- a/include/vlc/libvlc_media_player.h
>+++ b/include/vlc/libvlc_media_player.h
>@@ -267,12 +267,22 @@ LIBVLC_API void libvlc_media_player_set_pause (
>libvlc_media_player_t *mp,
>LIBVLC_API void libvlc_media_player_pause ( libvlc_media_player_t *p_mi
>);
> 
> /**
>- * Stop (no effect if there is no media)
>+ * Stop synchronously (no effect if there is no media)
>+ *
>+ * This function blocks until the input thread is actually stopped.
>+ * Prefer libvlc_media_player_stop_async().
>  *
>  * \param p_mi the Media Player
>  */
>LIBVLC_API void libvlc_media_player_stop ( libvlc_media_player_t *p_mi
>);
> 
>+/**
>+ * Stop (no effect if there is no media)
>+ *
>+ * \param p_mi the Media Player
>+ */
>+LIBVLC_API void libvlc_media_player_stop_async ( libvlc_media_player_t
>*p_mi );
>+
> /**
>  * Set a renderer to the media player
>  *
>diff --git a/lib/media_player.c b/lib/media_player.c
>index e5f6fc32a7..33d863f48d 100644
>--- a/lib/media_player.c
>+++ b/lib/media_player.c
>@@ -974,6 +974,16 @@ int libvlc_media_player_is_playing(
>libvlc_media_player_t *p_mi )
>/**************************************************************************
>  * Stop playing.
>**************************************************************************/
>+void libvlc_media_player_stop_async( libvlc_media_player_t *p_mi )
>+{
>+    vlc_player_t *player = p_mi->player;
>+    vlc_player_Lock(player);
>+
>+    vlc_player_Stop(player);
>+
>+    vlc_player_Unlock(player);
>+}
>+
> void libvlc_media_player_stop( libvlc_media_player_t *p_mi )
> {
>     vlc_player_t *player = p_mi->player;
>-- 
>2.20.1
>
>_______________________________________________
>vlc-devel mailing list
>To unsubscribe or modify your subscription options:
>https://mailman.videolan.org/listinfo/vlc-devel

-- 
Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20190515/23d4caf0/attachment.html>


More information about the vlc-devel mailing list