1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-23 15:22:09 +00:00

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.
This commit is contained in:
wm4 2016-04-15 15:43:46 +02:00
parent d04aa5ef4e
commit 798188cb33

View File

@ -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;