[vlc-devel] [PATCH 3/9] video_output: add vout_ChangeSource to set a new source for the display
Steve Lhomme
robux4 at ycbcr.xyz
Thu Oct 10 16:26:58 CEST 2019
It may not work, in which case a new display/thread should be created to handle
the new format.
---
src/video_output/video_output.c | 32 ++++++++++++++++++++++----------
src/video_output/vout_internal.h | 8 ++++++++
2 files changed, 30 insertions(+), 10 deletions(-)
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 874d51f8e08..a16a8ec621c 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -1923,6 +1923,24 @@ vout_thread_t *vout_Hold(vout_thread_t *vout)
return vout;
}
+int vout_ChangeSource( vout_thread_t *vout, const video_format_t *original, unsigned dpb_size )
+{
+ vout_thread_sys_t *sys = vout->p;
+
+ /* TODO: If dimensions are equal or slightly smaller, update the aspect
+ * ratio and crop settings, instead of recreating a display.
+ */
+ if (video_format_IsSimilar(original, &sys->original)) {
+ if (dpb_size <= sys->dpb_size) {
+ /* It is assumed that the SPU input matches input already. */
+ return 0;
+ }
+ msg_Warn(vout, "DPB need to be increased");
+ }
+
+ return -1;
+}
+
int vout_Request(const vout_configuration_t *cfg, input_thread_t *input)
{
vout_thread_t *vout = cfg->vout;
@@ -1939,16 +1957,10 @@ int vout_Request(const vout_configuration_t *cfg, input_thread_t *input)
video_format_t original;
VoutFixFormat(&original, cfg->fmt);
- /* TODO: If dimensions are equal or slightly smaller, update the aspect
- * ratio and crop settings, instead of recreating a display.
- */
- if (video_format_IsSimilar(&original, &sys->original)) {
- if (cfg->dpb_size <= sys->dpb_size) {
- video_format_Clean(&original);
- /* It is assumed that the SPU input matches input already. */
- return 0;
- }
- msg_Warn(vout, "DPB need to be increased");
+ if (vout_ChangeSource(vout, &original, cfg->dpb_size) == 0)
+ {
+ video_format_Clean(&original);
+ return 0;
}
if (sys->display != NULL)
diff --git a/src/video_output/vout_internal.h b/src/video_output/vout_internal.h
index 799f4e72895..f585c8d46d2 100644
--- a/src/video_output/vout_internal.h
+++ b/src/video_output/vout_internal.h
@@ -235,6 +235,14 @@ void vout_StopDisplay(vout_thread_t *);
*/
void vout_Close( vout_thread_t *p_vout );
+/**
+ * Set the new source format for a started vout
+ *
+ * \retval 0 on success
+ * \retval -1 on error, the vout needs to be restarted to handle the format
+ */
+int vout_ChangeSource( vout_thread_t *p_vout, const video_format_t *fmt, unsigned dpb_size );
+
/* TODO to move them to vlc_vout.h */
void vout_ChangeFullscreen(vout_thread_t *, const char *id);
void vout_ChangeWindowed(vout_thread_t *);
--
2.17.1
More information about the vlc-devel
mailing list