[vlc-devel] [PATCH 21/31] vout: request the display using a video context
Steve Lhomme
robux4 at ycbcr.xyz
Fri Jul 5 16:20:00 CEST 2019
This video context should be created by the decoder/filter using the decoder
device
---
src/audio_output/filters.c | 4 +++-
src/input/decoder.c | 4 +++-
src/input/resource.c | 3 ++-
src/input/resource.h | 2 +-
src/video_output/video_output.c | 12 ++++++------
src/video_output/vout_internal.h | 8 ++++----
src/video_output/vout_wrapper.c | 5 +++--
7 files changed, 22 insertions(+), 16 deletions(-)
diff --git a/src/audio_output/filters.c b/src/audio_output/filters.c
index 679651d67f..44cb1ca371 100644
--- a/src/audio_output/filters.c
+++ b/src/audio_output/filters.c
@@ -399,7 +399,9 @@ vout_thread_t *aout_filter_GetVout(filter_t *filter, const video_format_t *fmt)
vlc_decoder_device *dec_dev = NULL;
if (vout_RequestDevice(&cfg, &dec_dev) == 0)
{
- if (vout_RequestDisplay(&cfg, NULL) == 0)
+ vlc_video_context vctx;
+ vctx.device = dec_dev;
+ if (vout_RequestDisplay(&cfg, &vctx, NULL) == 0)
{
/* FIXME unused for now */
vlc_decoder_device_Release(dec_dev);
diff --git a/src/input/decoder.c b/src/input/decoder.c
index 996deb58df..43fa380da4 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -617,7 +617,9 @@ static int vout_update_format( decoder_t *p_dec )
.dpb_size = dpb_size + p_dec->i_extra_picture_buffers + 1,
.mouse_event = MouseEvent, .mouse_opaque = p_dec,
};
- int res = input_resource_GetDisplay( p_owner->p_resource, &cfg);
+ vlc_video_context vctx;
+ vctx.device = p_dec->init_device;
+ int res = input_resource_GetDisplay( p_owner->p_resource, &vctx, &cfg);
vlc_mutex_lock( &p_owner->lock );
p_owner->fmt.video.i_chroma = p_dec->fmt_out.i_codec;
diff --git a/src/input/resource.c b/src/input/resource.c
index 19b5928bc3..c18ee414d0 100644
--- a/src/input/resource.c
+++ b/src/input/resource.c
@@ -440,10 +440,11 @@ out:
}
int input_resource_GetDisplay(input_resource_t *p_resource,
+ vlc_video_context *vctx,
const vout_configuration_t *cfg)
{
vlc_mutex_lock( &p_resource->lock );
- int res = vout_RequestDisplay(cfg, p_resource->p_input);
+ int res = vout_RequestDisplay(cfg, vctx, p_resource->p_input);
if (res != 0) {
input_resource_PutVoutLocked(p_resource, cfg->vout, false);
vlc_mutex_unlock(&p_resource->lock);
diff --git a/src/input/resource.h b/src/input/resource.h
index f4031dd6dc..0a43d316ad 100644
--- a/src/input/resource.h
+++ b/src/input/resource.h
@@ -41,7 +41,7 @@ vout_thread_t *input_resource_GetVout(input_resource_t *,
const vout_configuration_t *,
enum vlc_vout_order *order,
vlc_decoder_device **);
-int input_resource_GetDisplay(input_resource_t *, const vout_configuration_t *);
+int input_resource_GetDisplay(input_resource_t *, vlc_video_context *, const vout_configuration_t *);
void input_resource_PutVout(input_resource_t *, vout_thread_t *);
/**
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 5e4915e0b0..d02303066f 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -1438,7 +1438,8 @@ static void ThreadProcessMouseState(vout_thread_t *vout,
vout->p->mouse_event(m, vout->p->mouse_opaque);
}
-static int vout_Start(vout_thread_t *vout, const vout_configuration_t *cfg)
+static int vout_Start(vout_thread_t *vout, const vout_configuration_t *cfg,
+ vlc_video_context *vctx)
{
vout_thread_sys_t *sys = vout->p;
assert(!sys->dummy);
@@ -1504,7 +1505,7 @@ static int vout_Start(vout_thread_t *vout, const vout_configuration_t *cfg)
vlc_mutex_lock(&sys->display_lock);
vlc_mutex_unlock(&sys->window_lock);
- sys->display = vout_OpenWrapper(vout, sys->splitter_name, &dcfg);
+ sys->display = vout_OpenWrapper(vout, sys->splitter_name, &dcfg, vctx);
if (sys->display == NULL) {
vlc_mutex_unlock(&sys->display_lock);
goto error;
@@ -1921,8 +1922,6 @@ int vout_RequestDevice(const vout_configuration_t *cfg, vlc_decoder_device **dec
assert(sys->dec_device == NULL);
sys->dec_device = vlc_decoder_device_Create(sys->display_cfg.window);
- /* temporary until it comes from the decoder/filters */
- sys->video_context.device = sys->dec_device;
} else
vout_UpdateWindowSizeLocked(vout);
@@ -1938,7 +1937,8 @@ int vout_RequestDevice(const vout_configuration_t *cfg, vlc_decoder_device **dec
return 0;
}
-int vout_RequestDisplay(const vout_configuration_t *cfg, input_thread_t *input)
+int vout_RequestDisplay(const vout_configuration_t *cfg, vlc_video_context *vctx,
+ input_thread_t *input)
{
vout_thread_t *vout = cfg->vout;
vout_thread_sys_t *sys = vout->p;
@@ -1946,7 +1946,7 @@ int vout_RequestDisplay(const vout_configuration_t *cfg, input_thread_t *input)
if (sys->display != NULL)
return VLC_SUCCESS;
- if (vout_Start(vout, cfg))
+ if (vout_Start(vout, cfg, vctx))
{
vlc_mutex_lock(&sys->window_lock);
vout_window_Disable(sys->display_cfg.window);
diff --git a/src/video_output/vout_internal.h b/src/video_output/vout_internal.h
index e7ad86139c..584c192aa3 100644
--- a/src/video_output/vout_internal.h
+++ b/src/video_output/vout_internal.h
@@ -181,8 +181,6 @@ struct vout_thread_sys_t
vlc_mutex_t display_lock;
vlc_decoder_device *dec_device;
- /* temporary: must come from decoder module */
- vlc_video_context video_context;
picture_pool_t *private_pool;
picture_pool_t *display_pool;
@@ -220,11 +218,13 @@ int vout_RequestDevice(const vout_configuration_t *cfg, vlc_decoder_device **dec
* You can release the returned value either by vout_RequestDisplay() or vout_Close().
*
* \param cfg the video configuration requested.
+ * \param video context to setup the display
* \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);
+int vout_RequestDisplay(const vout_configuration_t *cfg, vlc_video_context *vctx,
+ input_thread_t *input);
/**
* Disables a vout.
@@ -272,7 +272,7 @@ void vout_IntfDeinit(vlc_object_t *);
/* */
vout_display_t *vout_OpenWrapper(vout_thread_t *, const char *,
- const vout_display_cfg_t *);
+ const vout_display_cfg_t *, vlc_video_context *);
void vout_CloseWrapper(vout_thread_t *, vout_display_t *vd);
/* */
diff --git a/src/video_output/vout_wrapper.c b/src/video_output/vout_wrapper.c
index e24f6ec793..8404fab15f 100644
--- a/src/video_output/vout_wrapper.c
+++ b/src/video_output/vout_wrapper.c
@@ -65,7 +65,8 @@ static void VoutDisplayEvent(vout_display_t *vd, int event, va_list args)
*
*****************************************************************************/
vout_display_t *vout_OpenWrapper(vout_thread_t *vout,
- const char *splitter_name, const vout_display_cfg_t *cfg)
+ const char *splitter_name, const vout_display_cfg_t *cfg,
+ vlc_video_context *vctx)
{
vout_thread_sys_t *sys = vout->p;
vout_display_t *vd;
@@ -83,7 +84,7 @@ vout_display_t *vout_OpenWrapper(vout_thread_t *vout,
modlist = "splitter,none";
vd = vout_display_New(VLC_OBJECT(vout), &sys->original, cfg,
- &sys->video_context, modlist, &owner);
+ vctx, modlist, &owner);
free(modlistbuf);
if (vd == NULL)
--
2.17.1
More information about the vlc-devel
mailing list