From 798188cb33adebf2a3c4ea44918f8afef1c8f17b Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 15 Apr 2016 15:43:46 +0200 Subject: [PATCH] vo_lavc: send refcounted AVFrame to encoder This potentially makes it more efficient, and actually makes it simpler. Yes, AV_PICTURE_TYPE_NONE is the default for pict_type. --- video/out/vo_lavc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/video/out/vo_lavc.c b/video/out/vo_lavc.c index d102fec869..6573e1d8a8 100644 --- a/video/out/vo_lavc.c +++ b/video/out/vo_lavc.c @@ -421,15 +421,15 @@ static void draw_image_unlocked(struct vo *vo, mp_image_t *mpi) skipframes = 0; if (thisduration > skipframes) { - AVFrame *frame = av_frame_alloc(); + AVFrame *frame = mp_image_to_av_frame(vc->lastimg); + if (!frame) + abort(); // this is a nop, unless the worst time base is the STREAM time base frame->pts = av_rescale_q(vc->lastipts + skipframes, vc->worst_time_base, avc->time_base); - enum AVPictureType savetype = frame->pict_type; - mp_image_copy_fields_to_av_frame(frame, vc->lastimg); - frame->pict_type = savetype; + frame->pict_type = AV_PICTURE_TYPE_NONE; // keep this at avcodec_get_frame_defaults default frame->quality = avc->global_quality;