[vlc-devel] [RFC PATCH] libvlc: don't preclude use a libvlc_video_viewpoint_t on stack

Zhao Zhili quinkblack at foxmail.com
Thu Aug 30 08:03:49 CEST 2018


---
I find libvlc_video_new_viewpoint() kind of misleading. The following
code comes from libvlc/jni/libvlcjni-mediaplayer.c

    if (p_obj->p_sys->p_vp == NULL)
    {
        p_obj->p_sys->p_vp = libvlc_video_new_viewpoint();
        if (p_obj->p_sys->p_vp == NULL)
            return false;
    }
    p_obj->p_sys->p_vp->f_yaw = yaw;
    p_obj->p_sys->p_vp->f_pitch = pitch;
    p_obj->p_sys->p_vp->f_roll = roll;
    p_obj->p_sys->p_vp->f_field_of_view = fov;

    return libvlc_video_update_viewpoint(p_obj->u.p_mp, p_obj->p_sys->p_vp,
                                         absolute) == 0 ? true : false;

It would be more simple to use a variable on stack.

 include/vlc/libvlc_media_player.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/vlc/libvlc_media_player.h b/include/vlc/libvlc_media_player.h
index 73dadda..c9b2104 100644
--- a/include/vlc/libvlc_media_player.h
+++ b/include/vlc/libvlc_media_player.h
@@ -1285,7 +1285,7 @@ LIBVLC_API libvlc_video_viewpoint_t *libvlc_video_new_viewpoint(void);
  * \version LibVLC 3.0.0 and later
  *
  * \param p_mi the media player
- * \param p_viewpoint video viewpoint allocated via libvlc_video_new_viewpoint()
+ * \param p_viewpoint video viewpoint
  * \param b_absolute if true replace the old viewpoint with the new one. If
  * false, increase/decrease it.
  * \return -1 in case of error, 0 otherwise
-- 
2.9.5



More information about the vlc-devel mailing list