[vlc-devel] [PATCH 2/8] libvlc: add a control to notify the host when the rendering starts/ends
Steve Lhomme
robux4 at ycbcr.xyz
Mon Jan 21 17:38:45 CET 2019
---
doc/libvlc/sdl_opengl_player.cpp | 4 ++++
include/vlc/libvlc_media_player.h | 13 +++++++++++++
include/vlc_vout_display.h | 12 ++++++++++++
lib/media_player.c | 2 ++
4 files changed, 31 insertions(+)
diff --git a/doc/libvlc/sdl_opengl_player.cpp b/doc/libvlc/sdl_opengl_player.cpp
index bf06f61429..96c4771ecc 100644
--- a/doc/libvlc/sdl_opengl_player.cpp
+++ b/doc/libvlc/sdl_opengl_player.cpp
@@ -143,6 +143,10 @@ public:
// This control is called by VLC to get OpenGL functions.
*output = SDL_GL_GetProcAddress(static_cast<const char*>(intput));
break;
+ case LIBVLC_VIDEO_START_RENDER:
+ case LIBVLC_VIDEO_FINISHED_RENDERING:
+ // DO NOTHING
+ break;
}
return 0;
}
diff --git a/include/vlc/libvlc_media_player.h b/include/vlc/libvlc_media_player.h
index 858b0a061d..6abba498b0 100644
--- a/include/vlc/libvlc_media_player.h
+++ b/include/vlc/libvlc_media_player.h
@@ -523,6 +523,19 @@ typedef enum libvlc_video_callback_control_t {
*/
LIBVLC_VIDEO_GET_PROCADDRESS,
+ /** Tell the host the rendering is about to start.
+ *
+ * \ref input ignored
+ * \ref output ignored
+ */
+ LIBVLC_VIDEO_START_RENDER,
+
+ /** Tell the host the rendering has ended.
+ *
+ * \ref input ignored
+ * \ref output ignored
+ */
+ LIBVLC_VIDEO_FINISHED_RENDERING,
} libvlc_video_callback_control_t;
/**
diff --git a/include/vlc_vout_display.h b/include/vlc_vout_display.h
index bb2d60d7cc..f2a0ca69c0 100644
--- a/include/vlc_vout_display.h
+++ b/include/vlc_vout_display.h
@@ -475,6 +475,8 @@ typedef enum
VLC_VIDEO_SURFACE_SWAP,
VLC_VIDEO_SURFACE_MAKE_CURRENT,
VLC_VIDEO_SURFACE_GET_PROCADDRESS,
+ VLC_VIDEO_SURFACE_START_RENDER,
+ VLC_VIDEO_SURFACE_FINISHED_RENDERING,
} vlc_video_surface_control_t; /* must match libvlc_video_callback_control_t */
typedef int (*vlc_video_surface_control)(void* opaque,
@@ -519,5 +521,15 @@ static inline void *vlc_video_surface_get_proc(void *opaque, vlc_video_surface_c
return result;
}
+static inline bool vlc_video_surface_start_rendering(void *opaque, vlc_video_surface_control ctrl)
+{
+ return ctrl(opaque, VLC_VIDEO_SURFACE_START_RENDER, 0, NULL) == 0;
+}
+
+static inline void vlc_video_surface_finished_rendering(void *opaque, vlc_video_surface_control ctrl)
+{
+ ctrl(opaque, VLC_VIDEO_SURFACE_FINISHED_RENDERING, 0, NULL);
+}
+
/** @} */
#endif /* VLC_VOUT_DISPLAY_H */
diff --git a/lib/media_player.c b/lib/media_player.c
index 11dae47448..81872f81d6 100644
--- a/lib/media_player.c
+++ b/lib/media_player.c
@@ -2042,6 +2042,8 @@ static_assert(VLC_VIDEO_SURFACE_SETUP == LIBVLC_VIDEO_SETUP &&
VLC_VIDEO_SURFACE_SWAP == LIBVLC_VIDEO_SWAP &&
VLC_VIDEO_SURFACE_MAKE_CURRENT == LIBVLC_VIDEO_MAKE_CURRENT &&
VLC_VIDEO_SURFACE_GET_PROCADDRESS == LIBVLC_VIDEO_GET_PROCADDRESS &&
+ VLC_VIDEO_SURFACE_START_RENDER == LIBVLC_VIDEO_START_RENDER &&
+ VLC_VIDEO_SURFACE_FINISHED_RENDERING == LIBVLC_VIDEO_FINISHED_RENDERING &&
sizeof(vlc_video_surface_cfg_t) == sizeof(libvlc_video_callback_cfg_t) &&
offsetof(vlc_video_surface_cfg_t, width) == offsetof(libvlc_video_callback_cfg_t, width) &&
offsetof(vlc_video_surface_cfg_t, height) == offsetof(libvlc_video_callback_cfg_t, height)
--
2.17.1
More information about the vlc-devel
mailing list