[vlc-commits] video_output: add vout_ChangeSource to set a new source for the display
Steve Lhomme
git at videolan.org
Fri Oct 18 09:46:59 CEST 2019
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Thu Oct 10 14:33:40 2019 +0200| [c8ee613d0ca046af27892765a9f256763142152b] | committer: Steve Lhomme
video_output: add vout_ChangeSource to set a new source for the display
It may not work, in which case a new display/thread should be created to handle
the new format.
No functional changes.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c8ee613d0ca046af27892765a9f256763142152b
---
src/video_output/video_output.c | 31 ++++++++++++++++++++++---------
src/video_output/vout_internal.h | 8 ++++++++
2 files changed, 30 insertions(+), 9 deletions(-)
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 3258629145..48b416043c 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -1944,6 +1944,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;
+}
+
static int vout_EnableWindow(const vout_configuration_t *cfg, const video_format_t *original,
vlc_decoder_device **pp_dec_device)
{
@@ -2002,15 +2020,10 @@ int vout_Request(const vout_configuration_t *cfg, vlc_decoder_device *dec_dev, i
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);
- 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 (vout_EnableWindow(cfg, &original, NULL) != 0)
diff --git a/src/video_output/vout_internal.h b/src/video_output/vout_internal.h
index 713751c26d..747f8934f7 100644
--- a/src/video_output/vout_internal.h
+++ b/src/video_output/vout_internal.h
@@ -242,6 +242,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 *);
More information about the vlc-commits
mailing list