[FFmpeg-cvslog] avcodec/mlpdec: add flush support

Paul B Mahol git at videolan.org
Sun Aug 29 01:13:04 EEST 2021


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Sat Aug 28 17:07:31 2021 +0200| [5673a4842556b79a92a1ede6e9696506fd4161ad] | committer: Paul B Mahol

avcodec/mlpdec: add flush support

Fixes spurious lossless check failures when seeking.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5673a4842556b79a92a1ede6e9696506fd4161ad
---

 libavcodec/mlpdec.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c
index e4992550ee..0fac5ad754 100644
--- a/libavcodec/mlpdec.c
+++ b/libavcodec/mlpdec.c
@@ -1330,6 +1330,18 @@ error:
     return AVERROR_INVALIDDATA;
 }
 
+static void mlp_decode_flush(AVCodecContext *avctx)
+{
+    MLPDecodeContext *m = avctx->priv_data;
+
+    m->params_valid = 0;
+    for (int substr = 0; substr <= m->max_decoded_substream; substr++){
+        SubStream *s = &m->substream[substr];
+
+        s->lossless_check_data = 0xffffffff;
+    }
+}
+
 #if CONFIG_MLP_DECODER
 const AVCodec ff_mlp_decoder = {
     .name           = "mlp",
@@ -1339,6 +1351,7 @@ const AVCodec ff_mlp_decoder = {
     .priv_data_size = sizeof(MLPDecodeContext),
     .init           = mlp_decode_init,
     .decode         = read_access_unit,
+    .flush          = mlp_decode_flush,
     .capabilities   = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_CHANNEL_CONF,
     .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE,
 };
@@ -1352,6 +1365,7 @@ const AVCodec ff_truehd_decoder = {
     .priv_data_size = sizeof(MLPDecodeContext),
     .init           = mlp_decode_init,
     .decode         = read_access_unit,
+    .flush          = mlp_decode_flush,
     .capabilities   = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_CHANNEL_CONF,
     .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE,
 };



More information about the ffmpeg-cvslog mailing list