[vlc-devel] [PATCH 05/31] video_output: split vout_Request into vout_HoldDevice and vout_RequestDisplay
Steve Lhomme
robux4 at ycbcr.xyz
Mon Sep 23 17:01:10 CEST 2019
This will be used by the HW decoder to get the "decoder device". Then when the VA
is created (or not) based on this "decoder device", the display will be created.
Don't create a new display in vout_RequestDisplay() if there's already one.
Maybe we need to check if the format changed to know if a new display is needed.
---
src/video_output/video_output.c | 25 ++++++++++++++++++++++++-
src/video_output/vout_internal.h | 26 ++++++++++++++++++++++++++
2 files changed, 50 insertions(+), 1 deletion(-)
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 3e0c6fb0843..f543189c012 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -1862,6 +1862,16 @@ vout_thread_t *vout_Hold(vout_thread_t *vout)
int vout_Request(const vout_configuration_t *cfg, vlc_decoder_device **pp_dec_dev,
input_thread_t *input)
+{
+ int res = vout_HoldDevice(cfg, pp_dec_dev);
+ if (res == 0)
+ {
+ res = vout_RequestDisplay(cfg, input);
+ }
+ return res;
+}
+
+int vout_HoldDevice(const vout_configuration_t *cfg, vlc_decoder_device **pp_dec_dev)
{
vout_thread_t *vout = cfg->vout;
vout_thread_sys_t *sys = vout->p;
@@ -1917,7 +1927,9 @@ int vout_Request(const vout_configuration_t *cfg, vlc_decoder_device **pp_dec_de
if (vout_window_Enable(sys->display_cfg.window, &wcfg)) {
vlc_mutex_unlock(&sys->window_lock);
- goto error;
+ msg_Err(vout, "window enabling failed");
+ video_format_Clean(&sys->original);
+ return -1;
}
sys->window_enabled = true;
} else
@@ -1938,6 +1950,17 @@ int vout_Request(const vout_configuration_t *cfg, vlc_decoder_device **pp_dec_de
vlc_mutex_unlock(&sys->window_lock);
+ return 0;
+}
+
+int vout_RequestDisplay(const vout_configuration_t *cfg, input_thread_t *input)
+{
+ vout_thread_t *vout = cfg->vout;
+ vout_thread_sys_t *sys = vout->p;
+
+ if (sys->display != NULL)
+ return VLC_SUCCESS;
+
if (vout_Start(vout, cfg))
{
vlc_mutex_lock(&sys->window_lock);
diff --git a/src/video_output/vout_internal.h b/src/video_output/vout_internal.h
index 1f88997779c..65824a59761 100644
--- a/src/video_output/vout_internal.h
+++ b/src/video_output/vout_internal.h
@@ -197,6 +197,32 @@ vout_thread_t *vout_Create(vlc_object_t *obj) VLC_USED;
vout_thread_t *vout_CreateDummy(vlc_object_t *obj) VLC_USED;
+/**
+ * Setup the vout and optionally get an associated decoder device.
+ *
+ * \param cfg the video configuration requested.
+ * \param dec_dev pointer to receive the decoder device reference to use with the vout or NULL
+ * \retval 0 on success
+ * \retval -1 on error
+ */
+int vout_HoldDevice(const vout_configuration_t *cfg, vlc_decoder_device **dec_dev);
+
+/**
+ * Returns a suitable vout or release the given one.
+ *
+ * If cfg->fmt is non NULL and valid, a vout will be returned, reusing cfg->vout
+ * is possible, otherwise it returns NULL.
+ * If cfg->vout is not used, it will be closed and released.
+ *
+ * You can release the returned value either by vout_RequestDisplay() or vout_Close().
+ *
+ * \param cfg the video configuration requested.
+ * \param input used to get attachments for spu filters
+ * \retval 0 on success
+ * \retval -1 on error
+ */
+int vout_RequestDisplay(const vout_configuration_t *cfg, input_thread_t *input);
+
/**
* Returns a suitable vout or release the given one.
*
--
2.17.1
More information about the vlc-devel
mailing list