Commit 606e8baf authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit '7c020e1a'

* commit '7c020e1a':
  movenc: Grow the frag_info array in chunks
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 28ce9c0b 7c020e1a
...@@ -3085,9 +3085,14 @@ static int mov_flush_fragment(AVFormatContext *s) ...@@ -3085,9 +3085,14 @@ static int mov_flush_fragment(AVFormatContext *s)
MOVFragmentInfo *info; MOVFragmentInfo *info;
avio_flush(s->pb); avio_flush(s->pb);
track->nb_frag_info++; track->nb_frag_info++;
track->frag_info = av_realloc(track->frag_info, if (track->nb_frag_info >= track->frag_info_capacity) {
sizeof(*track->frag_info) * unsigned new_capacity = track->nb_frag_info + MOV_FRAG_INFO_ALLOC_INCREMENT;
track->nb_frag_info); if (av_reallocp_array(&track->frag_info,
new_capacity,
sizeof(*track->frag_info)))
return AVERROR(ENOMEM);
track->frag_info_capacity = new_capacity;
}
info = &track->frag_info[track->nb_frag_info - 1]; info = &track->frag_info[track->nb_frag_info - 1];
info->offset = avio_tell(s->pb); info->offset = avio_tell(s->pb);
info->time = mov->tracks[i].frag_start; info->time = mov->tracks[i].frag_start;
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include "avformat.h" #include "avformat.h"
#define MOV_FRAG_INFO_ALLOC_INCREMENT 64
#define MOV_INDEX_CLUSTER_SIZE 1024 #define MOV_INDEX_CLUSTER_SIZE 1024
#define MOV_TIMESCALE 1000 #define MOV_TIMESCALE 1000
...@@ -130,6 +131,7 @@ typedef struct MOVTrack { ...@@ -130,6 +131,7 @@ typedef struct MOVTrack {
int nb_frag_info; int nb_frag_info;
MOVFragmentInfo *frag_info; MOVFragmentInfo *frag_info;
unsigned frag_info_capacity;
struct { struct {
int64_t struct_offset; int64_t struct_offset;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment