aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorCarl Eugen Hoyos <ceffmpeg@gmail.com>2018-07-12 01:24:39 +0200
committerCarl Eugen Hoyos <ceffmpeg@gmail.com>2018-08-01 00:49:54 +0200
commit1ffd63a4457bbd09574de5cb8bc100734a7b8843 (patch)
tree6a13f46dde0e3689490a7fb2928bb10775ddb377 /tools
parentd36b8394f4fa95403afd194ca9b7edbd8f470076 (diff)
downloadffmpeg-1ffd63a4457bbd09574de5cb8bc100734a7b8843.tar.gz
tools/qt-faststart: Allow free atoms after moov atom.
Diffstat (limited to 'tools')
-rw-r--r--tools/qt-faststart.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/tools/qt-faststart.c b/tools/qt-faststart.c
index 5e88c38e6b..46950a5cf4 100644
--- a/tools/qt-faststart.c
+++ b/tools/qt-faststart.c
@@ -443,6 +443,8 @@ int main(int argc, char *argv[])
int64_t start_offset = 0;
unsigned char *copy_buffer = NULL;
int bytes_to_copy;
+ uint64_t free_size = 0;
+ uint64_t moov_size = 0;
if (argc != 3) {
printf("Usage: qt-faststart <infile.mov> <outfile.mov>\n"
@@ -535,6 +537,15 @@ int main(int argc, char *argv[])
* able to continue scanning sensibly after this atom, so break. */
if (atom_size < 8)
break;
+
+ if (atom_type == MOOV_ATOM)
+ moov_size = atom_size;
+
+ if (moov_size && atom_type == FREE_ATOM) {
+ free_size += atom_size;
+ atom_type = MOOV_ATOM;
+ atom_size = moov_size;
+ }
}
if (atom_type != MOOV_ATOM) {
@@ -551,7 +562,7 @@ int main(int argc, char *argv[])
/* moov atom was, in fact, the last atom in the chunk; load the whole
* moov atom */
- if (fseeko(infile, -atom_size, SEEK_END)) {
+ if (fseeko(infile, -(atom_size + free_size), SEEK_END)) {
perror(argv[1]);
goto error_out;
}