vo_{drm,wlshm,x11}: add support for video-target-params

This commit is contained in:
sfan5 2024-03-11 20:40:24 +01:00
parent 2893b7d0f5
commit bc8038cffd
3 changed files with 12 additions and 0 deletions

View File

@ -215,6 +215,9 @@ static int reconfig(struct vo *vo, struct mp_image_params *params)
if (mp_sws_reinit(p->sws) < 0) if (mp_sws_reinit(p->sws) < 0)
return -1; return -1;
mp_mutex_lock(&vo->params_mutex);
vo->target_params = &p->sws->dst; // essentially constant, so this is okay
mp_mutex_unlock(&vo->params_mutex);
vo->want_redraw = true; vo->want_redraw = true;
return 0; return 0;
} }

View File

@ -195,6 +195,7 @@ static int resize(struct vo *vo)
vo->dwidth = width; vo->dwidth = width;
vo->dheight = height; vo->dheight = height;
vo_get_src_dst_rects(vo, &p->src, &p->dst, &p->osd); vo_get_src_dst_rects(vo, &p->src, &p->dst, &p->osd);
p->sws->dst = (struct mp_image_params) { p->sws->dst = (struct mp_image_params) {
.imgfmt = MP_SELECT_LE_BE(IMGFMT_BGR0, IMGFMT_0RGB), .imgfmt = MP_SELECT_LE_BE(IMGFMT_BGR0, IMGFMT_0RGB),
.w = width, .w = width,
@ -203,6 +204,10 @@ static int resize(struct vo *vo)
.p_h = 1, .p_h = 1,
}; };
mp_image_params_guess_csp(&p->sws->dst); mp_image_params_guess_csp(&p->sws->dst);
mp_mutex_lock(&vo->params_mutex);
vo->target_params = &p->sws->dst;
mp_mutex_unlock(&vo->params_mutex);
while (p->free_buffers) { while (p->free_buffers) {
buf = p->free_buffers; buf = p->free_buffers;
p->free_buffers = buf->next; p->free_buffers = buf->next;

View File

@ -266,6 +266,10 @@ static bool resize(struct vo *vo)
if (mp_sws_reinit(p->sws) < 0) if (mp_sws_reinit(p->sws) < 0)
return false; return false;
mp_mutex_lock(&vo->params_mutex);
vo->target_params = &p->sws->dst;
mp_mutex_unlock(&vo->params_mutex);
} }
vo->want_redraw = true; vo->want_redraw = true;