[FFmpeg-devel] [PATCH 3/3] lavf/matroskadec: add read_flush function
rcombs
rcombs at rcombs.me
Wed Feb 19 02:21:50 EET 2020
---
libavformat/matroskadec.c | 23 +++++++++++++++++------
1 file changed, 17 insertions(+), 6 deletions(-)
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 4d7fdab99f..68e424992a 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -3703,6 +3703,21 @@ static int matroska_read_packet(AVFormatContext *s, AVPacket *pkt)
return 0;
}
+static void matroska_read_flush(AVFormatContext *s)
+{
+ MatroskaDemuxContext *matroska = s->priv_data;
+ int i;
+
+ matroska_reset_status(matroska, 0, -1);
+ matroska->resync_pos = -1;
+ matroska_clear_queue(matroska);
+ matroska->skip_to_keyframe = 0;
+ matroska->done = 0;
+
+ for (i = 0; i < s->nb_streams; i++)
+ s->streams[i]->skip_to_keyframe = 0;
+}
+
static int matroska_read_seek(AVFormatContext *s, int stream_index,
int64_t timestamp, int flags)
{
@@ -3758,12 +3773,7 @@ static int matroska_read_seek(AVFormatContext *s, int stream_index,
err:
// slightly hackish but allows proper fallback to
// the generic seeking code.
- matroska_reset_status(matroska, 0, -1);
- matroska->resync_pos = -1;
- matroska_clear_queue(matroska);
- st->skip_to_keyframe =
- matroska->skip_to_keyframe = 0;
- matroska->done = 0;
+ matroska_read_flush(s);
return -1;
}
@@ -4200,6 +4210,7 @@ AVInputFormat ff_matroska_demuxer = {
.read_packet = matroska_read_packet,
.read_close = matroska_read_close,
.read_seek = matroska_read_seek,
+ .read_flush = matroska_read_flush,
.mime_type = "audio/webm,audio/x-matroska,video/webm,video/x-matroska"
};
--
2.24.1
More information about the ffmpeg-devel
mailing list