[vlc-devel] [PATCH v2 5/9] libvlc: player: deprecate will_play()

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


This function cannot fail, because it has no provisions for returning an error. So you have two options: remove it or keep it working.

But returning a potentially incorrect result is just wrong.

Le 15 mai 2019 12:53:13 GMT+03:00, Romain Vimont <rom1v at videolabs.io> a écrit :
>This function is meaningless on the new player.
>---
> include/vlc/deprecated.h          | 11 +++++++++++
> include/vlc/libvlc_media_player.h | 10 ----------
> lib/media_player.c                | 11 ++---------
> 3 files changed, 13 insertions(+), 19 deletions(-)
>
>diff --git a/include/vlc/deprecated.h b/include/vlc/deprecated.h
>index 6f433654b4..420ac354cf 100644
>--- a/include/vlc/deprecated.h
>+++ b/include/vlc/deprecated.h
>@@ -111,6 +111,17 @@ LIBVLC_DEPRECATED LIBVLC_API int
> LIBVLC_DEPRECATED LIBVLC_API
> void libvlc_playlist_play( libvlc_instance_t *p_instance );
> 
>+/**
>+ * Is the player able to play
>+ *
>+ * \param p_mi the Media Player
>+ * \return boolean
>+ *
>+ * \libvlc_return_bool
>+ */
>+LIBVLC_DEPRECATED
>+LIBVLC_API int libvlc_media_player_will_play( libvlc_media_player_t
>*p_mi );
>+
> /** @}*/
> 
> # ifdef __cplusplus
>diff --git a/include/vlc/libvlc_media_player.h
>b/include/vlc/libvlc_media_player.h
>index f10fcf7a96..3fc0b6a644 100644
>--- a/include/vlc/libvlc_media_player.h
>+++ b/include/vlc/libvlc_media_player.h
>@@ -1173,16 +1173,6 @@ LIBVLC_API int libvlc_media_player_get_chapter(
>libvlc_media_player_t *p_mi );
>  */
>LIBVLC_API int libvlc_media_player_get_chapter_count(
>libvlc_media_player_t *p_mi );
> 
>-/**
>- * Is the player able to play
>- *
>- * \param p_mi the Media Player
>- * \return boolean
>- *
>- * \libvlc_return_bool
>- */
>-LIBVLC_API int libvlc_media_player_will_play( libvlc_media_player_t
>*p_mi );
>-
> /**
>  * Get title chapter count
>  *
>diff --git a/lib/media_player.c b/lib/media_player.c
>index 72095b502e..7c7aa3cc50 100644
>--- a/lib/media_player.c
>+++ b/lib/media_player.c
>@@ -1778,15 +1778,8 @@ void libvlc_media_player_previous_chapter(
>libvlc_media_player_t *p_mi )
> 
> int libvlc_media_player_will_play( libvlc_media_player_t *p_mi )
> {
>-    input_thread_t *p_input_thread =
>-                            libvlc_get_input_thread ( p_mi );
>-    if ( !p_input_thread )
>-        return false;
>-
>-    int state = var_GetInteger( p_input_thread, "state" );
>-    input_Release(p_input_thread);
>-
>-    return state != END_S && state != ERROR_S;
>+    (void) p_mi;
>+    return true;
> }
> 
>int libvlc_media_player_set_rate( libvlc_media_player_t *p_mi, float
>rate )
>-- 
>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/2a29445e/attachment.html>


More information about the vlc-devel mailing list