#include <stdlib.h>
#include <inttypes.h>
+#ifdef __MINGW32__
+#define fseeko(x,y,z) fseeko64(x,y,z)
+#define ftello(x) ftello64(x)
+#endif
+
#define BE_16(x) ((((uint8_t*)(x))[0] << 8) | ((uint8_t*)(x))[1])
#define BE_32(x) ((((uint8_t*)(x))[0] << 24) | \
(((uint8_t*)(x))[1] << 16) | \
free(moov_atom);
return 1;
}
- /* seek after ftyp atom if needed */
- fseeko(infile, start_offset, SEEK_SET);
+
+ if (start_offset > 0) { /* seek after ftyp atom */
+ fseeko(infile, start_offset, SEEK_SET);
+ last_offset -= start_offset;
+ }
outfile = fopen(argv[2], "wb");
if (!outfile) {
fclose(infile);
fclose(outfile);
free(moov_atom);
+ if (ftyp_atom_size > 0)
+ free(ftyp_atom);
return 0;
fclose(infile);
fclose(outfile);
free(moov_atom);
+ if (ftyp_atom_size > 0)
+ free(ftyp_atom);
return 1;
}