diff --git a/video/mp_image.c b/video/mp_image.c index 238f591858..4b34944ec9 100644 --- a/video/mp_image.c +++ b/video/mp_image.c @@ -430,6 +430,17 @@ void mp_image_params_from_image(struct mp_image_params *params, }; } +void mp_image_set_params(struct mp_image *image, + const struct mp_image_params *params) +{ + mp_image_setfmt(image, params->imgfmt); + mp_image_set_size(image, params->w, params->h); + mp_image_set_display_size(image, params->d_w, params->d_h); + image->colorspace = params->colorspace; + image->levels = params->colorlevels; + image->chroma_location = params->chroma_location; +} + void mp_image_set_colorspace_details(struct mp_image *image, struct mp_csp_details *csp) { diff --git a/video/mp_image.h b/video/mp_image.h index 7324423967..141483eedd 100644 --- a/video/mp_image.h +++ b/video/mp_image.h @@ -143,6 +143,9 @@ bool mp_image_params_equals(const struct mp_image_params *p1, void mp_image_params_from_image(struct mp_image_params *params, const struct mp_image *image); +void mp_image_set_params(struct mp_image *image, + const struct mp_image_params *params); + struct AVFrame; void mp_image_copy_fields_from_av_frame(struct mp_image *dst, struct AVFrame *src);