mp4_close(f);
return 0;
}
- /* copy moov atom to end of the file */
if (f->last_atom != ATOM_MOOV) {
- char *free_data = "free";
-
- /* rename old moov to free */
set_position(f, f->moov_offset + 4);
- write_data(f, free_data, 4);
-
- set_position(f, f->file_size);
- write_int32(f, new_moov_size + 8);
- write_data(f, "moov", 4);
- write_data(f, new_moov_data, new_moov_size);
- } else {
+ write_data(f, "free", 4); /* rename old moov to free */
+ set_position(f, f->file_size); /* write new moov atom at EOF */
+ } else /* overwrite old moov atom */
set_position(f, f->moov_offset);
- write_int32(f, new_moov_size + 8);
- write_data(f, "moov", 4);
- write_data(f, new_moov_data, new_moov_size);
- }
+ write_int32(f, new_moov_size + 8);
+ write_data(f, "moov", 4);
+ write_data(f, new_moov_data, new_moov_size);
free(new_moov_data);
f->cb->truncate(f->cb->user_data);
return 1;