mp_image: refuse to convert frames of unknown format to AVFrame

This could happen with some "special" hwaccel formats, that exist in
mpv, but not libavutil.
This commit is contained in:
wm4 2017-06-08 21:17:12 +02:00
parent 0754cbc83e
commit 5521d48b4b
1 changed files with 2 additions and 0 deletions

View File

@ -817,6 +817,8 @@ struct AVFrame *mp_image_to_av_frame(struct mp_image *img)
frame->hw_frames_ctx = new_ref->hwctx; frame->hw_frames_ctx = new_ref->hwctx;
*new_ref = (struct mp_image){0}; *new_ref = (struct mp_image){0};
talloc_free(new_ref); talloc_free(new_ref);
if (frame->format == AV_PIX_FMT_NONE)
av_frame_free(&frame);
return frame; return frame;
} }