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:20 +0300
committerJames Almer <jamrial@gmail.com>2019-07-16 22:18:10 +0300
commit730ac1ae803925777702eeaef4d1b8b796126e8f (patch)
treeac46a0a2ed0e21a400fab7d8c826736bd73ac75a /libavformat/matroskadec.c
parent6854127a76988e3aa3fafce3c01cb098f80f4bef (diff)
avformat/matroskadec: Use file offsets for level 1 elements
This commit converts the MatroskaLevel1Element struct to use file-based offsets, as opposed to the current practice of using offsets relative to the beginning of the segment in it. This also includes a change from uint64_t to int64_t. This is in preparation to another patch that improves the check for duplicate level 1 elements. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavformat/matroskadec.c')
-rw-r--r--libavformat/matroskadec.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index e78fd0016f..3abdf01374 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -330,7 +330,7 @@ typedef struct MatroskaCluster {
} MatroskaCluster;
typedef struct MatroskaLevel1Element {
- uint64_t pos;
+ int64_t pos;
uint32_t id;
int parsed;
} MatroskaLevel1Element;
@@ -1795,16 +1795,14 @@ static void matroska_convert_tags(AVFormatContext *s)
}
static int matroska_parse_seekhead_entry(MatroskaDemuxContext *matroska,
- uint64_t pos)
+ int64_t pos)
{
uint32_t saved_id = matroska->current_id;
int64_t before_pos = avio_tell(matroska->ctx->pb);
- int64_t offset;
int ret = 0;
/* seek */
- offset = pos + matroska->segment_start;
- if (avio_seek(matroska->ctx->pb, offset, SEEK_SET) == offset) {
+ if (avio_seek(matroska->ctx->pb, pos, SEEK_SET) == pos) {
/* We don't want to lose our seekhead level, so we add
* a dummy. This is a crude hack. */
if (matroska->num_levels == EBML_MAX_DEPTH) {
@@ -1842,8 +1840,8 @@ static void matroska_execute_seekhead(MatroskaDemuxContext *matroska)
for (i = 0; i < seekhead_list->nb_elem; i++) {
MatroskaSeekhead *seekheads = seekhead_list->elem;
- uint32_t id = seekheads[i].id;
- uint64_t pos = seekheads[i].pos;
+ uint32_t id = seekheads[i].id;
+ int64_t pos = seekheads[i].pos + matroska->segment_start;
MatroskaLevel1Element *elem = matroska_find_level1_elem(matroska, id);
if (!elem || elem->parsed)