Browse Source

Merge commit '7c020e1ad37d27c9d5db4d714401f09c80e3cc44'

* commit '7c020e1ad37d27c9d5db4d714401f09c80e3cc44':
  movenc: Grow the frag_info array in chunks

Merged-by: Michael Niedermayer <michaelni@gmx.at>
tags/n2.0
Michael Niedermayer 12 years ago
parent
commit
606e8baf0f
2 changed files with 10 additions and 3 deletions
  1. +8
    -3
      libavformat/movenc.c
  2. +2
    -0
      libavformat/movenc.h

+ 8
- 3
libavformat/movenc.c View File

@@ -3085,9 +3085,14 @@ static int mov_flush_fragment(AVFormatContext *s)
MOVFragmentInfo *info;
avio_flush(s->pb);
track->nb_frag_info++;
track->frag_info = av_realloc(track->frag_info,
sizeof(*track->frag_info) *
track->nb_frag_info);
if (track->nb_frag_info >= track->frag_info_capacity) {
unsigned new_capacity = track->nb_frag_info + MOV_FRAG_INFO_ALLOC_INCREMENT;
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->offset = avio_tell(s->pb);
info->time = mov->tracks[i].frag_start;


+ 2
- 0
libavformat/movenc.h View File

@@ -26,6 +26,7 @@

#include "avformat.h"

#define MOV_FRAG_INFO_ALLOC_INCREMENT 64
#define MOV_INDEX_CLUSTER_SIZE 1024
#define MOV_TIMESCALE 1000

@@ -130,6 +131,7 @@ typedef struct MOVTrack {

int nb_frag_info;
MOVFragmentInfo *frag_info;
unsigned frag_info_capacity;

struct {
int64_t struct_offset;


Loading…
Cancel
Save