|
|
|
@ -108,8 +108,7 @@ static int parse_atoms( |
|
|
|
|
unsigned char *buf, |
|
|
|
|
uint64_t size, |
|
|
|
|
parse_atoms_callback_t callback, |
|
|
|
|
void *context) |
|
|
|
|
{ |
|
|
|
|
void *context) { |
|
|
|
|
unsigned char *pos = buf; |
|
|
|
|
unsigned char *end = pos + size; |
|
|
|
|
atom_t atom; |
|
|
|
@ -164,8 +163,7 @@ static int parse_atoms( |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static int update_stco_offsets(update_chunk_offsets_context_t *context, atom_t *atom) |
|
|
|
|
{ |
|
|
|
|
static int update_stco_offsets(update_chunk_offsets_context_t *context, atom_t *atom) { |
|
|
|
|
uint32_t current_offset; |
|
|
|
|
uint32_t offset_count; |
|
|
|
|
unsigned char *pos; |
|
|
|
@ -200,8 +198,7 @@ static int update_stco_offsets(update_chunk_offsets_context_t *context, atom_t * |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static int update_co64_offsets(update_chunk_offsets_context_t *context, atom_t *atom) |
|
|
|
|
{ |
|
|
|
|
static int update_co64_offsets(update_chunk_offsets_context_t *context, atom_t *atom) { |
|
|
|
|
uint64_t current_offset; |
|
|
|
|
uint32_t offset_count; |
|
|
|
|
unsigned char *pos; |
|
|
|
@ -230,8 +227,7 @@ static int update_co64_offsets(update_chunk_offsets_context_t *context, atom_t * |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static int update_chunk_offsets_callback(void *ctx, atom_t *atom) |
|
|
|
|
{ |
|
|
|
|
static int update_chunk_offsets_callback(void *ctx, atom_t *atom) { |
|
|
|
|
update_chunk_offsets_context_t *context = ctx; |
|
|
|
|
int ret; |
|
|
|
|
|
|
|
|
@ -267,23 +263,19 @@ static int update_chunk_offsets_callback(void *ctx, atom_t *atom) |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void set_atom_size(unsigned char *header, uint32_t header_size, uint64_t size) |
|
|
|
|
{ |
|
|
|
|
static void set_atom_size(unsigned char *header, uint32_t header_size, uint64_t size) { |
|
|
|
|
switch (header_size) { |
|
|
|
|
case 8: |
|
|
|
|
AV_WB32(header, size); |
|
|
|
|
case 8: AV_WB32(header, size); |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case 16: |
|
|
|
|
AV_WB64(header + 8, size); |
|
|
|
|
case 16: AV_WB64(header + 8, size); |
|
|
|
|
break; |
|
|
|
|
default: |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void upgrade_stco_atom(upgrade_stco_context_t *context, atom_t *atom) |
|
|
|
|
{ |
|
|
|
|
static void upgrade_stco_atom(upgrade_stco_context_t *context, atom_t *atom) { |
|
|
|
|
unsigned char *pos; |
|
|
|
|
unsigned char *end; |
|
|
|
|
uint64_t new_offset; |
|
|
|
@ -311,8 +303,7 @@ static void upgrade_stco_atom(upgrade_stco_context_t *context, atom_t *atom) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static int upgrade_stco_callback(void *ctx, atom_t *atom) |
|
|
|
|
{ |
|
|
|
|
static int upgrade_stco_callback(void *ctx, atom_t *atom) { |
|
|
|
|
upgrade_stco_context_t *context = ctx; |
|
|
|
|
unsigned char *start_pos; |
|
|
|
|
uint64_t copy_size; |
|
|
|
@ -357,8 +348,7 @@ static int upgrade_stco_callback(void *ctx, atom_t *atom) |
|
|
|
|
|
|
|
|
|
static int update_moov_atom( |
|
|
|
|
unsigned char **moov_atom, |
|
|
|
|
uint64_t *moov_atom_size) |
|
|
|
|
{ |
|
|
|
|
uint64_t *moov_atom_size) { |
|
|
|
|
update_chunk_offsets_context_t update_context = {0}; |
|
|
|
|
upgrade_stco_context_t upgrade_context; |
|
|
|
|
unsigned char *new_moov_atom; |
|
|
|
|