[vlc-devel] [PATCH] libvlc: add a function to release a viewpoint
Steve Lhomme
robux4 at ycbcr.xyz
Mon Jun 3 15:00:53 CEST 2019
Allocated by libvlc_video_new_viewpoint()
And deprecate the one that said free() could be used.
---
include/vlc/deprecated.h | 13 +++++++++++++
include/vlc/libvlc_media.h | 4 ++--
include/vlc/libvlc_media_player.h | 16 ++++++++++++----
lib/libvlc.sym | 2 ++
lib/video.c | 7 ++++++-
5 files changed, 35 insertions(+), 7 deletions(-)
diff --git a/include/vlc/deprecated.h b/include/vlc/deprecated.h
index 82ac660f94..71b11d97ef 100644
--- a/include/vlc/deprecated.h
+++ b/include/vlc/deprecated.h
@@ -110,6 +110,19 @@ LIBVLC_DEPRECATED LIBVLC_API bool
LIBVLC_DEPRECATED LIBVLC_API
void libvlc_playlist_play( libvlc_instance_t *p_instance );
+/**
+ * Create a video viewpoint structure.
+ *
+ * \deprecated Use libvlc_video_create_viewpoint() instead
+ *
+ * \version LibVLC 3.0.0 and later
+ *
+ * \return video viewpoint or NULL
+ * (it result must be released with free()).
+ */
+LIBVLC_DEPRECATED LIBVLC_API
+libvlc_video_viewpoint_t *libvlc_video_new_viewpoint(void);
+
/** @}*/
# ifdef __cplusplus
diff --git a/include/vlc/libvlc_media.h b/include/vlc/libvlc_media.h
index cd335a6e08..c705125233 100644
--- a/include/vlc/libvlc_media.h
+++ b/include/vlc/libvlc_media.h
@@ -169,7 +169,7 @@ typedef enum libvlc_video_projection_t
/**
* Viewpoint
*
- * \warning allocate using libvlc_video_new_viewpoint()
+ * \warning allocate using libvlc_video_create_viewpoint()
*/
typedef struct libvlc_video_viewpoint_t
{
@@ -737,7 +737,7 @@ LIBVLC_API void
* Get media descriptor's user_data. user_data is specialized data
* accessed by the host application, VLC.framework uses it as a pointer to
* an native object that references a libvlc_media_t pointer
- *
+ *
* \see libvlc_media_set_user_data
*
* \param p_md media descriptor object
diff --git a/include/vlc/libvlc_media_player.h b/include/vlc/libvlc_media_player.h
index 8b8941c2de..e9b31ab29e 100644
--- a/include/vlc/libvlc_media_player.h
+++ b/include/vlc/libvlc_media_player.h
@@ -1501,12 +1501,20 @@ LIBVLC_API void libvlc_video_set_sample_aspect_ratio( libvlc_media_player_t *p_m
/**
* Create a video viewpoint structure.
*
- * \version LibVLC 3.0.0 and later
+ * \version LibVLC 4.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_create_viewpoint(void);
+
+/**
+ * Release a viewpoint returned by libvlc_video_create_viewpoint()
+ *
+ * \param p_viewpoint viewpoint to release
+ * \version LibVLC 4.0.0 and later
*/
-LIBVLC_API libvlc_video_viewpoint_t *libvlc_video_new_viewpoint(void);
+LIBVLC_API void libvlc_video_release_viewpoint(libvlc_video_viewpoint_t *p_viewpoint);
/**
* Update the video viewpoint information.
@@ -1516,7 +1524,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 allocated via libvlc_video_create_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
diff --git a/lib/libvlc.sym b/lib/libvlc.sym
index 58c5221a47..547d8010f8 100644
--- a/lib/libvlc.sym
+++ b/lib/libvlc.sym
@@ -255,6 +255,8 @@ libvlc_video_set_teletext
libvlc_video_set_track
libvlc_video_take_snapshot
libvlc_video_new_viewpoint
+libvlc_video_create_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 fa6985c012..427987cb13 100644
--- a/lib/video.c
+++ b/lib/video.c
@@ -256,7 +256,7 @@ void libvlc_video_set_sample_aspect_ratio( libvlc_media_player_t *p_mi,
free(psz_aspect);
}
-libvlc_video_viewpoint_t *libvlc_video_new_viewpoint(void)
+libvlc_video_viewpoint_t *libvlc_video_create_viewpoint(void)
{
libvlc_video_viewpoint_t *p_vp = malloc(sizeof *p_vp);
if (unlikely(p_vp == NULL))
@@ -265,6 +265,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