[vlc-devel] [PATCH] [RFC] video_output: keep track of the vout modules that can switch stereo modes dynamically
Steve Lhomme
robux4 at ycbcr.xyz
Thu Aug 16 08:53:17 CEST 2018
The idea is to be able to use something like this to avoid recreating a
new vout when we know the current one can do the switch just fine:
diff --git a/src/input/decoder.c b/src/input/decoder.c
index 0c7ee686b4..dd11628b3a 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -445,7 +445,8 @@ static int vout_update_format( decoder_t *p_dec )
|| (int64_t)p_dec->fmt_out.video.i_sar_num *
p_owner->fmt.video.i_sar_den !=
(int64_t)p_dec->fmt_out.video.i_sar_den *
p_owner->fmt.video.i_sar_num ||
p_dec->fmt_out.video.orientation !=
p_owner->fmt.video.orientation ||
- p_dec->fmt_out.video.multiview_mode !=
p_owner->fmt.video.multiview_mode )
+ (p_dec->fmt_out.video.multiview_mode !=
p_owner->fmt.video.multiview_mode &&
+ !vout_CanHandleStereoMode(p_owner->p_vout,
p_dec->fmt_out.video.orientation)) )
{
vout_thread_t *p_vout;
@@ -572,7 +573,8 @@ static int vout_update_format( decoder_t *p_dec )
p_dec->fmt_out.video.lighting.MaxCLL !=
p_owner->fmt.video.lighting.MaxCLL ||
p_dec->fmt_out.video.lighting.MaxFALL !=
- p_owner->fmt.video.lighting.MaxFALL)
+ p_owner->fmt.video.lighting.MaxFALL ||
+ p_dec->fmt_out.video.multiview_mode !=
p_owner->fmt.video.multiview_mode )
{
/* the format has changed but we don't need a new vout */
vlc_mutex_lock( &p_owner->lock );
One of the problem here is that the p_owner->p_vout is not locked. But
it's already used unlocked in the same if(). And the values are
"constant" after the vout is created (like everything in display_info).
I'll probably rename this function to CanHandleStereoInput() to avoid
confusion with the display mode which is a different thing and unrelated
to the decoder. Although it could theoretically need a vout change which
is currently not possible with the design we have (the decoder would
need a restart just because the display changes).
On 14/08/2018 16:59, Steve Lhomme wrote:
> ---
> include/vlc_vout_display.h | 1 +
> src/video_output/display.c | 1 +
> src/video_output/video_output.c | 6 ++++++
> src/video_output/vout_internal.h | 5 +++++
> 4 files changed, 13 insertions(+)
>
> diff --git a/include/vlc_vout_display.h b/include/vlc_vout_display.h
> index 86eb1bced0..830cbf053f 100644
> --- a/include/vlc_vout_display.h
> +++ b/include/vlc_vout_display.h
> @@ -112,6 +112,7 @@ typedef struct {
> bool is_slow; /* The picture memory has slow read/write */
> bool has_double_click; /* Is double-click generated */
> bool has_pictures_invalid; /* Will VOUT_DISPLAY_EVENT_PICTURES_INVALID be used */
> + int stereo_modes; /* bitmask of multiview modes supported dynamically */
> const vlc_fourcc_t *subpicture_chromas; /* List of supported chromas for subpicture rendering. */
> } vout_display_info_t;
>
> diff --git a/src/video_output/display.c b/src/video_output/display.c
> index b0c0fdbb3e..a06b441d7f 100644
> --- a/src/video_output/display.c
> +++ b/src/video_output/display.c
> @@ -93,6 +93,7 @@ static vout_display_t *vout_display_New(vlc_object_t *obj,
> vd->info.has_double_click = false;
> vd->info.has_pictures_invalid = false;
> vd->info.subpicture_chromas = NULL;
> + vd->info.stereo_modes = (1 << MULTIVIEW_2D);
>
> vd->cfg = cfg;
> vd->pool = NULL;
> diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
> index da8022a8f3..c998f5e453 100644
> --- a/src/video_output/video_output.c
> +++ b/src/video_output/video_output.c
> @@ -498,6 +498,12 @@ int vout_GetSnapshot(vout_thread_t *vout,
> return VLC_SUCCESS;
> }
>
> +bool vout_CanHandleStereoMode(vout_thread_t *vout, video_multiview_mode_t mode)
> +{
> + vout_display_t *vd = vout->p->display.vd;
> + return vd && vd->info.stereo_modes & (1<<mode);
> +}
> +
> void vout_ChangeAspectRatio( vout_thread_t *p_vout,
> unsigned int i_num, unsigned int i_den )
> {
> diff --git a/src/video_output/vout_internal.h b/src/video_output/vout_internal.h
> index 8eaac0dee9..a3f472026a 100644
> --- a/src/video_output/vout_internal.h
> +++ b/src/video_output/vout_internal.h
> @@ -280,6 +280,11 @@ void vout_DisplayTitle( vout_thread_t *p_vout, const char *psz_title );
> */
> bool vout_IsEmpty( vout_thread_t *p_vout );
>
> +/**
> + * Returns true if the vout can switch to the multiview mode dynamically.
> + */
> +bool vout_CanHandleStereoMode(vout_thread_t *, video_multiview_mode_t);
> +
> void vout_SetSpuHighlight( vout_thread_t *p_vout, const vlc_spu_highlight_t * );
>
> #endif
> --
> 2.17.0
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
More information about the vlc-devel
mailing list