]> git.sesse.net Git - ffmpeg/blobdiff - qt-faststart.c
remove unused constant definition
[ffmpeg] / qt-faststart.c
index 535dde36550f677f43f16e818630a0cd6f5f00a0..2cbf12b1d97be755b2a44df8144c86c205ded4d1 100644 (file)
@@ -8,7 +8,7 @@
  * is in front of the data, thus facilitating network streaming.
  *
  * Compile this program using:
- *  cc qt-faststart.c -o qt-faststart
+ *  make qt-faststart
  * Invoke the program with:
  *  qt-faststart <infile.mov> <outfile.mov>
  *
 #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) | \
@@ -238,8 +243,11 @@ int main(int argc, char *argv[])
         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) {
@@ -288,6 +296,8 @@ int main(int argc, char *argv[])
     fclose(infile);
     fclose(outfile);
     free(moov_atom);
+    if (ftyp_atom_size > 0)
+        free(ftyp_atom);
 
     return 0;
 
@@ -295,5 +305,7 @@ error_out:
     fclose(infile);
     fclose(outfile);
     free(moov_atom);
+    if (ftyp_atom_size > 0)
+        free(ftyp_atom);
     return 1;
 }