Merge branch 'update_format-source' into 'master'

vout: make vd->source the new input format on update_format

See merge request videolan/vlc!4075
This commit is contained in:
Steve Lhomme 2024-04-28 07:10:46 +00:00
commit 9046795437
3 changed files with 20 additions and 16 deletions

View File

@ -313,16 +313,13 @@ struct vlc_display_operations
void (*set_icc_profile)(vout_display_t *, const vlc_icc_profile_t *prof);
/**
* Notifies a change in the input format.
* Notifies a change of vd->source.
*
* The format size is not expected to change.
*
* \param fmt the requested input format
* \param ctx the video context
* \param vctx the video context of the input
* \return VLC_SUCCESS on success, another value on error
*/
int (*update_format)(vout_display_t *, const video_format_t *fmt,
vlc_video_context *ctx);
int (*update_format)(vout_display_t *,
vlc_video_context *vctx);
};
struct vout_display_t {

View File

@ -102,8 +102,7 @@ static int SetViewpoint(vout_display_t *vd, const vlc_viewpoint_t *vp)
}
static int
UpdateFormat(vout_display_t *vd, const video_format_t *fmt,
vlc_video_context *vctx)
UpdateFormat(vout_display_t *vd, vlc_video_context *vctx)
{
vout_display_sys_t *sys = vd->sys;
@ -111,7 +110,7 @@ UpdateFormat(vout_display_t *vd, const video_format_t *fmt,
if (ret != VLC_SUCCESS)
return ret;
ret = vout_display_opengl_UpdateFormat(sys->vgl, fmt, vctx);
ret = vout_display_opengl_UpdateFormat(sys->vgl, vd->source, vctx);
/* Force to recompute the viewport on next picture */
sys->place_changed = true;

View File

@ -724,16 +724,24 @@ int vout_SetDisplayFormat(vout_display_t *vd, const video_format_t *fmt,
if (!vd->ops->update_format)
return VLC_EGENERIC;
int ret = vd->ops->update_format(vd, fmt, vctx);
if (ret != VLC_SUCCESS)
return ret;
vout_display_priv_t *osys = container_of(vd, vout_display_priv_t, display);
video_format_t source_backup;
video_format_Copy(&source_backup, vd->source);
/* Update source format */
assert(!fmt->p_palette);
video_format_Clean(&osys->source);
osys->source = *fmt;
video_format_Copy(&osys->source, fmt);
int ret = vd->ops->update_format(vd, vctx);
if (ret != VLC_SUCCESS)
{
video_format_Copy(&osys->source, &source_backup);
video_format_Clean(&source_backup);
return ret;
}
video_format_Clean(&source_backup);
if (vctx)
vlc_video_context_Hold(vctx);
if (osys->src_vctx)