mirror of
https://github.com/mpv-player/mpv
synced 2024-12-24 07:42:17 +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:
parent
d04aa5ef4e
commit
798188cb33
@ -421,15 +421,15 @@ static void draw_image_unlocked(struct vo *vo, mp_image_t *mpi)
|
|||||||
skipframes = 0;
|
skipframes = 0;
|
||||||
|
|
||||||
if (thisduration > skipframes) {
|
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
|
// this is a nop, unless the worst time base is the STREAM time base
|
||||||
frame->pts = av_rescale_q(vc->lastipts + skipframes,
|
frame->pts = av_rescale_q(vc->lastipts + skipframes,
|
||||||
vc->worst_time_base, avc->time_base);
|
vc->worst_time_base, avc->time_base);
|
||||||
|
|
||||||
enum AVPictureType savetype = frame->pict_type;
|
frame->pict_type = AV_PICTURE_TYPE_NONE;
|
||||||
mp_image_copy_fields_to_av_frame(frame, vc->lastimg);
|
|
||||||
frame->pict_type = savetype;
|
|
||||||
// keep this at avcodec_get_frame_defaults default
|
// keep this at avcodec_get_frame_defaults default
|
||||||
|
|
||||||
frame->quality = avc->global_quality;
|
frame->quality = avc->global_quality;
|
||||||
|
Loading…
Reference in New Issue
Block a user