You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
lavc/avcodec: split flushing into decode- and encode-specific functions
Will allow making some state private to encoding/decoding in the future.
This commit is contained in:
@@ -383,23 +383,12 @@ void avcodec_flush_buffers(AVCodecContext *avctx)
|
|||||||
"that doesn't support it\n");
|
"that doesn't support it\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (avci->in_frame)
|
ff_encode_flush_buffers(avctx);
|
||||||
av_frame_unref(avci->in_frame);
|
} else
|
||||||
if (avci->recon_frame)
|
ff_decode_flush_buffers(avctx);
|
||||||
av_frame_unref(avci->recon_frame);
|
|
||||||
} else {
|
|
||||||
av_packet_unref(avci->last_pkt_props);
|
|
||||||
av_packet_unref(avci->in_pkt);
|
|
||||||
|
|
||||||
avctx->pts_correction_last_pts =
|
|
||||||
avctx->pts_correction_last_dts = INT64_MIN;
|
|
||||||
|
|
||||||
av_bsf_flush(avci->bsf);
|
|
||||||
}
|
|
||||||
|
|
||||||
avci->draining = 0;
|
avci->draining = 0;
|
||||||
avci->draining_done = 0;
|
avci->draining_done = 0;
|
||||||
avci->nb_draining_errors = 0;
|
|
||||||
av_frame_unref(avci->buffer_frame);
|
av_frame_unref(avci->buffer_frame);
|
||||||
av_packet_unref(avci->buffer_pkt);
|
av_packet_unref(avci->buffer_pkt);
|
||||||
|
|
||||||
|
@@ -50,4 +50,7 @@ int ff_encode_preinit(struct AVCodecContext *avctx);
|
|||||||
*/
|
*/
|
||||||
int ff_decode_preinit(struct AVCodecContext *avctx);
|
int ff_decode_preinit(struct AVCodecContext *avctx);
|
||||||
|
|
||||||
|
void ff_decode_flush_buffers(struct AVCodecContext *avctx);
|
||||||
|
void ff_encode_flush_buffers(struct AVCodecContext *avctx);
|
||||||
|
|
||||||
#endif // AVCODEC_AVCODEC_INTERNAL_H
|
#endif // AVCODEC_AVCODEC_INTERNAL_H
|
||||||
|
@@ -1740,3 +1740,18 @@ AVBufferRef *ff_hwaccel_frame_priv_alloc(AVCodecContext *avctx,
|
|||||||
|
|
||||||
return ref;
|
return ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ff_decode_flush_buffers(AVCodecContext *avctx)
|
||||||
|
{
|
||||||
|
AVCodecInternal *avci = avctx->internal;
|
||||||
|
|
||||||
|
av_packet_unref(avci->last_pkt_props);
|
||||||
|
av_packet_unref(avci->in_pkt);
|
||||||
|
|
||||||
|
avctx->pts_correction_last_pts =
|
||||||
|
avctx->pts_correction_last_dts = INT64_MIN;
|
||||||
|
|
||||||
|
av_bsf_flush(avci->bsf);
|
||||||
|
|
||||||
|
avci->nb_draining_errors = 0;
|
||||||
|
}
|
||||||
|
@@ -785,3 +785,13 @@ int ff_encode_receive_frame(AVCodecContext *avctx, AVFrame *frame)
|
|||||||
av_frame_move_ref(frame, avci->recon_frame);
|
av_frame_move_ref(frame, avci->recon_frame);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ff_encode_flush_buffers(AVCodecContext *avctx)
|
||||||
|
{
|
||||||
|
AVCodecInternal *avci = avctx->internal;
|
||||||
|
|
||||||
|
if (avci->in_frame)
|
||||||
|
av_frame_unref(avci->in_frame);
|
||||||
|
if (avci->recon_frame)
|
||||||
|
av_frame_unref(avci->recon_frame);
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user