Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2019-05-17 01:30:02 +0300
committerJames Almer <jamrial@gmail.com>2019-07-16 22:16:57 +0300
commit310f326b4354d7353850e00393aeecada3c3c2c0 (patch)
treebcbee043be8dfb23ccb0b84e5294eb79961523fb /libavformat/matroskadec.c
parent27f40b1dcdff426ed25e7c690ec907d18239ff49 (diff)
avformat/matroskadec: Add function to reset status
This function will be useful later to reset the status (e.g. current level and the already parsed id). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavformat/matroskadec.c')
-rw-r--r--libavformat/matroskadec.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 2b0112f213..0525a65dbd 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -739,6 +739,25 @@ static const char *const matroska_doctypes[] = { "matroska", "webm" };
static int matroska_read_close(AVFormatContext *s);
+/*
+ * This function prepares the status for parsing of level 1 elements.
+ */
+static int matroska_reset_status(MatroskaDemuxContext *matroska,
+ uint32_t id, int64_t position)
+{
+ if (position >= 0) {
+ int err = avio_seek(matroska->ctx->pb, position, SEEK_SET);
+ if (err < 0)
+ return err;
+ }
+
+ matroska->current_id = id;
+ matroska->num_levels = 1;
+ matroska->current_cluster.pos = 0;
+
+ return 0;
+}
+
static int matroska_resync(MatroskaDemuxContext *matroska, int64_t last_pos)
{
AVIOContext *pb = matroska->ctx->pb;