]> git.sesse.net Git - ffmpeg/blobdiff - qt-faststart.c
Add support for options
[ffmpeg] / qt-faststart.c
index 2fc5a161ccd3a20ef38a00d9f1a623af161a8c47..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) {