[vlc-devel] [RFC 8/8] libvlc: return an false if setting the callback fails

Thomas Guillem thomas at gllm.fr
Tue Nov 20 16:54:00 CET 2018


typo: "return an false"

On Tue, Nov 20, 2018, at 16:42, Steve Lhomme wrote:
> The engine provide may have a wrong value or may not be supported on the
> given platform/build.
> ---
>  include/vlc/libvlc_media_player.h | 6 ++++--
>  lib/media_player.c                | 7 +++++--
>  2 files changed, 9 insertions(+), 4 deletions(-)
> 
> diff --git a/include/vlc/libvlc_media_player.h b/include/vlc/
> libvlc_media_player.h
> index dca339315a..d44d31d7cd 100644
> --- a/include/vlc/libvlc_media_player.h
> +++ b/include/vlc/libvlc_media_player.h
> @@ -569,11 +569,13 @@ void 
> libvlc_video_engine_callbacks_release( libvlc_video_engine_callbacks_t 
> *cb
>   *
>   * \param mp the media player
>   * \param callbacks the callbacks to use for the given engine.
> + * \return 1 if the callbacks were set, 0 otherwise.
> + * \libvlc_return_bool
>   * \version LibVLC 4.0.0 or later
>   */
>  LIBVLC_API
> -void libvlc_video_set_output_callbacks( libvlc_media_player_t *mp,
> -                                        libvlc_video_engine_callbacks_t 
> *callbacks );
> +int libvlc_video_set_output_callbacks( libvlc_media_player_t *mp,
> +                                       libvlc_video_engine_callbacks_t 
> *callbacks );
>  
>  /**
>   * Set decoded video chroma and dimensions.
> diff --git a/lib/media_player.c b/lib/media_player.c
> index 6da4887941..55c94bc1d1 100644
> --- a/lib/media_player.c
> +++ b/lib/media_player.c
> @@ -1164,7 +1164,7 @@ void 
> libvlc_video_set_format( libvlc_media_player_t *mp, const char *chroma,
>      var_SetInteger( mp, "vmem-pitch", pitch );
>  }
>  
> -void libvlc_video_set_output_callbacks( libvlc_media_player_t *mp,
> +int libvlc_video_set_output_callbacks( libvlc_media_player_t *mp,
>                                          libvlc_video_engine_callbacks_t 
> *callbacks )
>  {
>  #ifdef __ANDROID__
> @@ -1179,11 +1179,13 @@ void 
> libvlc_video_set_output_callbacks( libvlc_media_player_t *mp,
>          var_SetString ( mp, "vout", "gles2" );
>          var_SetString ( mp, "gles2", "vgl" );
>      }
> -    else
> +    else if( callbacks->engine == libvlc_video_engine_opengl )
>      {
>          var_SetString ( mp, "vout", "gl" );
>          var_SetString ( mp, "gl", "vgl");
>      }
> +    else
> +        return 0;
>  
>      var_SetAddress( mp, "vout-cb-opaque", callbacks->opaque );
>      var_SetAddress( mp, "vout-cb-setup", callbacks->setup_cb );
> @@ -1196,6 +1198,7 @@ void 
> libvlc_video_set_output_callbacks( libvlc_media_player_t *mp,
>      var_SetAddress( mp, "vout-cb-end-render", callbacks-
> >endRender_cb );
>  
>      var_SetAddress( mp, "vout-engine-ctx", callbacks->engine_context );
> +    return 1;
>  }
>  
>  libvlc_video_engine_callbacks_t 
> *libvlc_video_engine_callbacks_get( libvlc_video_engine_t engine )
> -- 
> 2.17.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