@@ -103,6 +103,7 @@ const FFCodec ff_flv_encoder = {
FF_CODEC_ENCODE_CB(ff_mpv_encode_picture),
.close = ff_mpv_encode_end,
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
+ .p.capabilities = AV_CODEC_CAP_ENCODER_RECON_FRAME,
.p.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P,
AV_PIX_FMT_NONE},
};
@@ -411,6 +411,7 @@ const FFCodec ff_h261_encoder = {
FF_CODEC_ENCODE_CB(ff_mpv_encode_picture),
.close = ff_mpv_encode_end,
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
+ .p.capabilities = AV_CODEC_CAP_ENCODER_RECON_FRAME,
.p.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P,
AV_PIX_FMT_NONE },
};
@@ -903,6 +903,7 @@ const FFCodec ff_h263_encoder = {
.p.id = AV_CODEC_ID_H263,
.p.pix_fmts = (const enum AVPixelFormat[]){AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE},
.p.priv_class = &h263_class,
+ .p.capabilities = AV_CODEC_CAP_ENCODER_RECON_FRAME,
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
.priv_data_size = sizeof(MpegEncContext),
.init = ff_mpv_encode_init,
@@ -933,7 +934,7 @@ const FFCodec ff_h263p_encoder = {
.p.id = AV_CODEC_ID_H263P,
.p.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE },
.p.priv_class = &h263p_class,
- .p.capabilities = AV_CODEC_CAP_SLICE_THREADS,
+ .p.capabilities = AV_CODEC_CAP_SLICE_THREADS | AV_CODEC_CAP_ENCODER_RECON_FRAME,
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
.priv_data_size = sizeof(MpegEncContext),
.init = ff_mpv_encode_init,
@@ -651,7 +651,8 @@ const FFCodec ff_mjpeg_encoder = {
.init = ff_mpv_encode_init,
FF_CODEC_ENCODE_CB(ff_mpv_encode_picture),
.close = mjpeg_encode_close,
- .p.capabilities = AV_CODEC_CAP_SLICE_THREADS | AV_CODEC_CAP_FRAME_THREADS,
+ .p.capabilities = AV_CODEC_CAP_SLICE_THREADS | AV_CODEC_CAP_FRAME_THREADS |
+ AV_CODEC_CAP_ENCODER_RECON_FRAME,
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
.p.pix_fmts = (const enum AVPixelFormat[]) {
AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUVJ444P,
@@ -681,6 +682,7 @@ const FFCodec ff_amv_encoder = {
FF_CODEC_ENCODE_CB(amv_encode_picture),
.close = mjpeg_encode_close,
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
+ .p.capabilities = AV_CODEC_CAP_ENCODER_RECON_FRAME,
.p.pix_fmts = (const enum AVPixelFormat[]) {
AV_PIX_FMT_YUVJ420P, AV_PIX_FMT_NONE
},
@@ -1230,7 +1230,8 @@ const FFCodec ff_mpeg1video_encoder = {
.p.supported_framerates = ff_mpeg12_frame_rate_tab + 1,
.p.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P,
AV_PIX_FMT_NONE },
- .p.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_SLICE_THREADS,
+ .p.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_SLICE_THREADS |
+ AV_CODEC_CAP_ENCODER_RECON_FRAME,
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
.p.priv_class = &mpeg1_class,
};
@@ -1248,7 +1249,8 @@ const FFCodec ff_mpeg2video_encoder = {
.p.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P,
AV_PIX_FMT_YUV422P,
AV_PIX_FMT_NONE },
- .p.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_SLICE_THREADS,
+ .p.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_SLICE_THREADS |
+ AV_CODEC_CAP_ENCODER_RECON_FRAME,
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
.p.priv_class = &mpeg2_class,
};
@@ -1401,7 +1401,8 @@ const FFCodec ff_mpeg4_encoder = {
FF_CODEC_ENCODE_CB(ff_mpv_encode_picture),
.close = ff_mpv_encode_end,
.p.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE },
- .p.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_SLICE_THREADS,
+ .p.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_SLICE_THREADS |
+ AV_CODEC_CAP_ENCODER_RECON_FRAME,
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
.p.priv_class = &mpeg4enc_class,
};
@@ -1781,6 +1781,14 @@ vbv_retry:
(avctx->flags&AV_CODEC_FLAG_PSNR) ? MPEGVIDEO_MAX_PLANES : 0,
s->pict_type);
+ if (avctx->flags & AV_CODEC_FLAG_RECON_FRAME) {
+ AVCodecInternal *avci = avctx->internal;
+ av_frame_unref(avci->recon_frame);
+ ret = av_frame_ref(avci->recon_frame, s->current_picture.f);
+ if (ret < 0)
+ return ret;
+ }
+
if (avctx->flags & AV_CODEC_FLAG_PASS1)
assert(put_bits_count(&s->pb) == s->header_bits + s->mv_bits +
s->misc_bits + s->i_tex_bits +
@@ -683,6 +683,7 @@ const FFCodec ff_msmpeg4v2_encoder = {
.p.id = AV_CODEC_ID_MSMPEG4V2,
.p.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE },
.p.priv_class = &ff_mpv_enc_class,
+ .p.capabilities = AV_CODEC_CAP_ENCODER_RECON_FRAME,
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
.priv_data_size = sizeof(MSMPEG4EncContext),
.init = ff_mpv_encode_init,
@@ -697,6 +698,7 @@ const FFCodec ff_msmpeg4v3_encoder = {
.p.id = AV_CODEC_ID_MSMPEG4V3,
.p.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE },
.p.priv_class = &ff_mpv_enc_class,
+ .p.capabilities = AV_CODEC_CAP_ENCODER_RECON_FRAME,
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
.priv_data_size = sizeof(MSMPEG4EncContext),
.init = ff_mpv_encode_init,
@@ -711,6 +713,7 @@ const FFCodec ff_wmv1_encoder = {
.p.id = AV_CODEC_ID_WMV1,
.p.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE },
.p.priv_class = &ff_mpv_enc_class,
+ .p.capabilities = AV_CODEC_CAP_ENCODER_RECON_FRAME,
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
.priv_data_size = sizeof(MSMPEG4EncContext),
.init = ff_mpv_encode_init,
@@ -76,5 +76,6 @@ const FFCodec ff_rv10_encoder = {
FF_CODEC_ENCODE_CB(ff_mpv_encode_picture),
.close = ff_mpv_encode_end,
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
+ .p.capabilities = AV_CODEC_CAP_ENCODER_RECON_FRAME,
.p.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE },
};
@@ -73,5 +73,6 @@ const FFCodec ff_rv20_encoder = {
FF_CODEC_ENCODE_CB(ff_mpv_encode_picture),
.close = ff_mpv_encode_end,
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
+ .p.capabilities = AV_CODEC_CAP_ENCODER_RECON_FRAME,
.p.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE },
};
@@ -288,6 +288,7 @@ const FFCodec ff_speedhq_encoder = {
FF_CODEC_ENCODE_CB(ff_mpv_encode_picture),
.close = ff_mpv_encode_end,
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
+ .p.capabilities = AV_CODEC_CAP_ENCODER_RECON_FRAME,
.p.pix_fmts = (const enum AVPixelFormat[]) {
AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV444P,
AV_PIX_FMT_NONE
@@ -244,6 +244,7 @@ const FFCodec ff_wmv2_encoder = {
FF_CODEC_ENCODE_CB(ff_mpv_encode_picture),
.close = ff_mpv_encode_end,
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP,
+ .p.capabilities = AV_CODEC_CAP_ENCODER_RECON_FRAME,
.p.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P,
AV_PIX_FMT_NONE },
};