[vlc-devel] [PATCH 4/5] libvlc: add a function to release a viewpoint

Steve Lhomme robux4 at ycbcr.xyz
Fri May 24 11:47:30 CEST 2019


Allocated by libvlc_video_new_viewpoint()
---
 include/vlc/libvlc_media_player.h | 10 +++++++++-
 lib/libvlc.sym                    |  1 +
 lib/video.c                       |  5 +++++
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/include/vlc/libvlc_media_player.h b/include/vlc/libvlc_media_player.h
index 6f3af1b731..f4981cecbc 100644
--- a/include/vlc/libvlc_media_player.h
+++ b/include/vlc/libvlc_media_player.h
@@ -1510,10 +1510,18 @@ LIBVLC_API void libvlc_video_set_aspect_ratio( libvlc_media_player_t *p_mi, cons
  * \version LibVLC 3.0.0 and later
  *
  * \return video viewpoint or NULL
- *         (the result must be released with free()).
+ *         (it result must be released with libvlc_video_release_viewpoint()).
  */
 LIBVLC_API libvlc_video_viewpoint_t *libvlc_video_new_viewpoint(void);
 
+/**
+ * Release a viewpoint returned by libvlc_video_new_viewpoint()
+ * 
+ * \param p_viewpoint viewpoint to release
+ * \version LibVLC 4.0.0 and later
+ */
+LIBVLC_API void libvlc_video_release_viewpoint(libvlc_video_viewpoint_t *p_viewpoint);
+
 /**
  * Update the video viewpoint information.
  *
diff --git a/lib/libvlc.sym b/lib/libvlc.sym
index 99600d1f63..436681a4c3 100644
--- a/lib/libvlc.sym
+++ b/lib/libvlc.sym
@@ -256,6 +256,7 @@ libvlc_video_set_teletext
 libvlc_video_set_track
 libvlc_video_take_snapshot
 libvlc_video_new_viewpoint
+libvlc_video_release_viewpoint
 libvlc_video_update_viewpoint
 libvlc_set_exit_handler
 libvlc_audio_filter_list_get
diff --git a/lib/video.c b/lib/video.c
index a318df0098..e3e81f6eed 100644
--- a/lib/video.c
+++ b/lib/video.c
@@ -262,6 +262,11 @@ libvlc_video_viewpoint_t *libvlc_video_new_viewpoint(void)
     return p_vp;
 }
 
+void libvlc_video_release_viewpoint(libvlc_video_viewpoint_t *p_viewpoint)
+{
+    free(p_viewpoint);
+}
+
 int libvlc_video_update_viewpoint( libvlc_media_player_t *p_mi,
                                    const libvlc_video_viewpoint_t *p_viewpoint,
                                    bool b_absolute )
-- 
2.17.1



More information about the vlc-devel mailing list