1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avcodec/dpcm: add .flush

Otherwise after seek, DC offset for audio samples might be big.
This commit is contained in:
Paul B Mahol 2023-01-21 14:07:48 +01:00
parent b8640bfc99
commit 3110e28456

View File

@ -448,6 +448,13 @@ static int dpcm_decode_frame(AVCodecContext *avctx, AVFrame *frame,
return avpkt->size;
}
static void dpcm_flush(AVCodecContext *avctx)
{
DPCMContext *s = avctx->priv_data;
s->sample[0] = s->sample[1] = 0;
}
#define DPCM_DECODER(id_, name_, long_name_) \
const FFCodec ff_ ## name_ ## _decoder = { \
.p.name = #name_, \
@ -457,6 +464,7 @@ const FFCodec ff_ ## name_ ## _decoder = { \
.p.capabilities = AV_CODEC_CAP_DR1, \
.priv_data_size = sizeof(DPCMContext), \
.init = dpcm_decode_init, \
.flush = dpcm_flush, \
FF_CODEC_DECODE_CB(dpcm_decode_frame), \
}