[vlc-devel] [PATCH v3 7/8] libvlc: player: rename stop() to stop_async()

Thomas Guillem thomas at gllm.fr
Tue May 21 09:53:18 CEST 2019



On Mon, May 20, 2019, at 17:36, Romain Vimont wrote:
> The new player stops asynchronously. This is a breaking change, so use a
> different function name.
> ---
>  doc/libvlc/QtPlayer/player.cpp         | 2 +-
>  doc/libvlc/d3d11_player.cpp            | 2 +-
>  doc/libvlc/d3d9_player.c               | 2 +-
>  doc/libvlc/gtk_player.c                | 2 +-
>  doc/libvlc/vlc-thumb.c                 | 2 +-
>  doc/libvlc/wx_player.cpp               | 2 +-
>  include/vlc/libvlc_media.h             | 2 --
>  include/vlc/libvlc_media_list_player.h | 2 +-
>  include/vlc/libvlc_media_player.h      | 2 +-
>  lib/libvlc.sym                         | 4 ++--
>  lib/media_list_player.c                | 4 ++--
>  lib/media_player.c                     | 2 +-
>  test/libvlc/media_list_player.c        | 4 ++--
>  test/libvlc/media_player.c             | 6 +++---
>  14 files changed, 18 insertions(+), 20 deletions(-)
> 
> diff --git a/doc/libvlc/QtPlayer/player.cpp 
> b/doc/libvlc/QtPlayer/player.cpp
> index 6a25564c62..b1316026ba 100644
> --- a/doc/libvlc/QtPlayer/player.cpp
> +++ b/doc/libvlc/QtPlayer/player.cpp
> @@ -201,7 +201,7 @@ void Mwindow::updateInterface() { //Update 
> interface and check if song is finish
>  void Mwindow::stop() {
>      if(vlcPlayer) {
>          /* stop the media player */
> -        libvlc_media_player_stop(vlcPlayer);
> +        libvlc_media_player_stop_async(vlcPlayer);
>  
>          /* release the media player */
>          libvlc_media_player_release(vlcPlayer);
> diff --git a/doc/libvlc/d3d11_player.cpp b/doc/libvlc/d3d11_player.cpp
> index a739730455..a287afbb4e 100644
> --- a/doc/libvlc/d3d11_player.cpp
> +++ b/doc/libvlc/d3d11_player.cpp
> @@ -470,7 +470,7 @@ int WINAPI WinMain(HINSTANCE hInstance,
>          }
>      }
>  
> -    libvlc_media_player_stop( p_mp );
> +    libvlc_media_player_stop_async( p_mp );
>  
>      libvlc_media_player_release( p_mp );
>      libvlc_media_release( p_media );
> diff --git a/doc/libvlc/d3d9_player.c b/doc/libvlc/d3d9_player.c
> index 043fca777f..980bd1dff9 100644
> --- a/doc/libvlc/d3d9_player.c
> +++ b/doc/libvlc/d3d9_player.c
> @@ -368,7 +368,7 @@ int WINAPI WinMain(HINSTANCE hInstance,
>              break;
>      }
>  
> -    libvlc_media_player_stop( p_mp );
> +    libvlc_media_player_stop_async( p_mp );
>  
>      libvlc_media_player_release( p_mp );
>      libvlc_media_release( p_media );
> diff --git a/doc/libvlc/gtk_player.c b/doc/libvlc/gtk_player.c
> index 8196476249..9369b940ff 100644
> --- a/doc/libvlc/gtk_player.c
> +++ b/doc/libvlc/gtk_player.c
> @@ -62,7 +62,7 @@ void on_playpause(GtkWidget *widget, gpointer data) {
>  
>  void on_stop(GtkWidget *widget, gpointer data) {
>      pause_player();
> -    libvlc_media_player_stop(media_player);
> +    libvlc_media_player_stop_async(media_player);
>  }
>  
>  void play(void) {
> diff --git a/doc/libvlc/vlc-thumb.c b/doc/libvlc/vlc-thumb.c
> index 7cb5aaafcc..a63307379c 100644
> --- a/doc/libvlc/vlc-thumb.c
> +++ b/doc/libvlc/vlc-thumb.c
> @@ -217,7 +217,7 @@ int main(int argc, const char **argv)
>      set_position(mp);
>      snapshot(mp, width, out_with_ext);
>  
> -    libvlc_media_player_stop(mp);
> +    libvlc_media_player_stop_async(mp);
>  
>      /* clean up */
>      if (out != out_with_ext) {
> diff --git a/doc/libvlc/wx_player.cpp b/doc/libvlc/wx_player.cpp
> index a1690ce3ca..c2e6d8bfa8 100644
> --- a/doc/libvlc/wx_player.cpp
> +++ b/doc/libvlc/wx_player.cpp
> @@ -222,7 +222,7 @@ void MainWindow::pause() {
>  
>  void MainWindow::stop() {
>      pause();
> -    libvlc_media_player_stop(media_player);
> +    libvlc_media_player_stop_async(media_player);
>      stop_button->Enable(false);
>      setTimeline(0.0);
>      timeline->Enable(false);
> diff --git a/include/vlc/libvlc_media.h b/include/vlc/libvlc_media.h
> index 4bc6f924ef..7b5acc0b24 100644
> --- a/include/vlc/libvlc_media.h
> +++ b/include/vlc/libvlc_media.h
> @@ -348,8 +348,6 @@ typedef int (*libvlc_media_open_cb)(void *opaque, 
> void **datap,
>   *
>   * \note If no data is immediately available, then the callback should 
> sleep.
>   * \warning The application is responsible for avoiding deadlock 
> situations.
> - * In particular, the callback should return an error if playback is 
> stopped;
> - * if it does not return, then libvlc_media_player_stop() will never 
> return.
>   */
>  typedef ssize_t (*libvlc_media_read_cb)(void *opaque, unsigned char 
> *buf,
>                                          size_t len);
> diff --git a/include/vlc/libvlc_media_list_player.h 
> b/include/vlc/libvlc_media_list_player.h
> index 8dcdcb961a..4fb7f31f50 100644
> --- a/include/vlc/libvlc_media_list_player.h
> +++ b/include/vlc/libvlc_media_list_player.h
> @@ -197,7 +197,7 @@ int 
> libvlc_media_list_player_play_item(libvlc_media_list_player_t * p_mlp,
>   * \param p_mlp media list player instance
>   */
>  LIBVLC_API void
> -    libvlc_media_list_player_stop( libvlc_media_list_player_t * p_mlp);
> +    libvlc_media_list_player_stop_async( libvlc_media_list_player_t * 
> p_mlp);
>  
>  /**
>   * Play next item from media list
> diff --git a/include/vlc/libvlc_media_player.h 
> b/include/vlc/libvlc_media_player.h
> index 27f34ab239..7706765beb 100644
> --- a/include/vlc/libvlc_media_player.h
> +++ b/include/vlc/libvlc_media_player.h
> @@ -270,7 +270,7 @@ LIBVLC_API void libvlc_media_player_pause ( 
> libvlc_media_player_t *p_mi );
>   *
>   * \param p_mi the Media Player
>   */
> -LIBVLC_API void libvlc_media_player_stop ( libvlc_media_player_t *p_mi 
> );
> +LIBVLC_API void libvlc_media_player_stop_async ( libvlc_media_player_t 
> *p_mi );

What about the static_assert like Steve suggested ?


>  
>  /**
>   * Set a renderer to the media player
> diff --git a/lib/libvlc.sym b/lib/libvlc.sym
> index ca115fb7b1..99600d1f63 100644
> --- a/lib/libvlc.sym
> +++ b/lib/libvlc.sym
> @@ -115,7 +115,7 @@ libvlc_media_list_player_set_media_list
>  libvlc_media_list_player_set_media_player
>  libvlc_media_list_player_set_pause
>  libvlc_media_list_player_set_playback_mode
> -libvlc_media_list_player_stop
> +libvlc_media_list_player_stop_async
>  libvlc_media_list_release
>  libvlc_media_list_remove_index
>  libvlc_media_list_retain
> @@ -177,7 +177,7 @@ libvlc_media_player_set_role
>  libvlc_media_player_set_time
>  libvlc_media_player_set_title
>  libvlc_media_player_set_xwindow
> -libvlc_media_player_stop
> +libvlc_media_player_stop_async
>  libvlc_media_player_navigate
>  libvlc_media_player_set_video_title_display
>  libvlc_media_release
> diff --git a/lib/media_list_player.c b/lib/media_list_player.c
> index c4ae8c4043..0188863e7a 100644
> --- a/lib/media_list_player.c
> +++ b/lib/media_list_player.c
> @@ -730,7 +730,7 @@ static void stop(libvlc_media_list_player_t * p_mlp)
>  
>      /* We are not interested in getting media stop event now */
>      uninstall_media_player_observer(p_mlp);
> -    libvlc_media_player_stop(p_mlp->p_mi);
> +    libvlc_media_player_stop_async(p_mlp->p_mi);
>      install_media_player_observer(p_mlp);
>  
>      free(p_mlp->current_playing_item_path);
> @@ -745,7 +745,7 @@ static void stop(libvlc_media_list_player_t * p_mlp)
>  
> /**************************************************************************
>   *       Stop (Public)
>   
> **************************************************************************/
> -void libvlc_media_list_player_stop(libvlc_media_list_player_t * p_mlp)
> +void libvlc_media_list_player_stop_async(libvlc_media_list_player_t * 
> p_mlp)
>  {
>      lock(p_mlp);
>      stop(p_mlp);
> diff --git a/lib/media_player.c b/lib/media_player.c
> index 057add2afe..fd085c3793 100644
> --- a/lib/media_player.c
> +++ b/lib/media_player.c
> @@ -967,7 +967,7 @@ bool 
> libvlc_media_player_is_playing(libvlc_media_player_t *p_mi)
>  
> /**************************************************************************
>   * Stop playing.
>   
> **************************************************************************/
> -void libvlc_media_player_stop( libvlc_media_player_t *p_mi )
> +void libvlc_media_player_stop_async( libvlc_media_player_t *p_mi )
>  {
>      vlc_player_t *player = p_mi->player;
>      vlc_player_Lock(player);
> diff --git a/test/libvlc/media_list_player.c 
> b/test/libvlc/media_list_player.c
> index e68399facb..27cf3e1fbc 100644
> --- a/test/libvlc/media_list_player.c
> +++ b/test/libvlc/media_list_player.c
> @@ -78,7 +78,7 @@ static inline void 
> wait_stopped(libvlc_media_list_player_t *mlp)
>  
>  static inline void stop_and_wait(libvlc_media_list_player_t *mlp)
>  {
> -    libvlc_media_list_player_stop (mlp);
> +    libvlc_media_list_player_stop_async (mlp);
>      wait_stopped (mlp);
>  }
>  
> @@ -484,7 +484,7 @@ static void test_media_list_player_playback_options 
> (const char** argv, int argc
>      libvlc_media_release (md4);
>      libvlc_media_release (md5);
>  
> -    libvlc_media_list_player_stop (mlp);
> +    libvlc_media_list_player_stop_async (mlp);
>  
>      while (libvlc_media_list_player_is_playing (mlp))
>          sched_yield();
> diff --git a/test/libvlc/media_player.c b/test/libvlc/media_player.c
> index 2489e6f5fa..56f847e05a 100644
> --- a/test/libvlc/media_player.c
> +++ b/test/libvlc/media_player.c
> @@ -144,7 +144,7 @@ static void test_media_player_set_media(const 
> char** argv, int argc)
>  
>      play_and_wait(mp);
>  
> -    libvlc_media_player_stop (mp);
> +    libvlc_media_player_stop_async (mp);
>      libvlc_media_player_release (mp);
>      libvlc_release (vlc);
>  }
> @@ -171,7 +171,7 @@ static void test_media_player_play_stop(const 
> char** argv, int argc)
>  
>      play_and_wait(mi);
>  
> -    libvlc_media_player_stop (mi);
> +    libvlc_media_player_stop_async (mi);
>      libvlc_media_player_release (mi);
>      libvlc_release (vlc);
>  }
> @@ -205,7 +205,7 @@ static void test_media_player_pause_stop(const 
> char** argv, int argc)
>      pause_and_wait(mi);
>      test_audio_video(mi);
>  
> -    libvlc_media_player_stop (mi);
> +    libvlc_media_player_stop_async (mi);
>      test_audio_video(mi);
>  
>      libvlc_media_player_release (mi);
> -- 
> 2.20.1
> 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list