1
0
mirror of https://github.com/mpv-player/mpv synced 2025-02-18 05:37:04 +00:00

screenshots: set AVFrame parameters

Currently, libavcodec is rather lenient, but it might get stricter in
the future.

Fixes #1398.
This commit is contained in:
wm4 2014-12-28 14:05:28 +01:00 committed by Diogo Franco (Kovensky)
parent 2c20c6f892
commit e0231926df

View File

@ -128,6 +128,9 @@ static int write_lavc(struct image_writer_ctx *ctx, mp_image_t *image, FILE *fp)
pic->data[n] = image->planes[n];
pic->linesize[n] = image->stride[n];
}
pic->format = avctx->pix_fmt;
pic->width = avctx->width;
pic->height = avctx->height;
int ret = avcodec_encode_video2(avctx, &pkt, pic, &got_output);
if (ret < 0)
goto error_exit;