| OLD | NEW |
| 1 /* | 1 /* |
| 2 * qt-faststart.c, v0.2 | 2 * qt-faststart.c, v0.2 |
| 3 * by Mike Melanson (melanson@pcisys.net) | 3 * by Mike Melanson (melanson@pcisys.net) |
| 4 * patch by Frank Barchard, to remove last FREE atom. | 4 * patch by Frank Barchard, to remove last FREE atom. |
| 5 * This file is placed in the public domain. Use the program however you | 5 * This file is placed in the public domain. Use the program however you |
| 6 * see fit. | 6 * see fit. |
| 7 * | 7 * |
| 8 * This utility rearranges a Quicktime file such that the moov atom | 8 * This utility rearranges a Quicktime file such that the moov atom |
| 9 * is in front of the data, thus facilitating network streaming. | 9 * is in front of the data, thus facilitating network streaming. |
| 10 * | 10 * |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 #define ATOM_PREAMBLE_SIZE 8 | 84 #define ATOM_PREAMBLE_SIZE 8 |
| 85 #define COPY_BUFFER_SIZE 1024 | 85 #define COPY_BUFFER_SIZE 1024 |
| 86 | 86 |
| 87 int main(int argc, char *argv[]) | 87 int main(int argc, char *argv[]) |
| 88 { | 88 { |
| 89 FILE *infile = 0; | 89 FILE *infile = 0; |
| 90 FILE *outfile = 0; | 90 FILE *outfile = 0; |
| 91 unsigned char atom_bytes[ATOM_PREAMBLE_SIZE]; | 91 unsigned char atom_bytes[ATOM_PREAMBLE_SIZE]; |
| 92 uint32_t atom_type = 0; | 92 uint32_t atom_type = 0; |
| 93 uint64_t atom_size = 0; | 93 uint64_t atom_size = 0; |
| 94 uint64_t last_offset; | 94 uint64_t last_offset = 0; // warning: 'last_offset' may be used uninitializ
ed in this function |
| 95 unsigned char *moov_atom = 0; | 95 unsigned char *moov_atom = 0; |
| 96 unsigned char *ftyp_atom = 0; | 96 unsigned char *ftyp_atom = 0; |
| 97 uint64_t moov_atom_size; | 97 uint64_t moov_atom_size = 0; // warning: 'moov_atom_size' may be used unini
tialized in this function |
| 98 uint64_t ftyp_atom_size = 0; | 98 uint64_t ftyp_atom_size = 0; |
| 99 uint64_t i, j; | 99 uint64_t i, j; |
| 100 uint32_t offset_count; | 100 uint32_t offset_count; |
| 101 uint64_t current_offset; | 101 uint64_t current_offset; |
| 102 uint64_t start_offset = 0; | 102 uint64_t start_offset = 0; |
| 103 unsigned char copy_buffer[COPY_BUFFER_SIZE]; | 103 unsigned char copy_buffer[COPY_BUFFER_SIZE]; |
| 104 int bytes_to_copy; | 104 int bytes_to_copy; |
| 105 uint32_t last_atom_type = 0; | 105 uint32_t last_atom_type = 0; |
| 106 uint64_t last_atom_size = 0; | 106 uint64_t last_atom_size = 0; |
| 107 uint64_t last_atom_offset = 0; | 107 uint64_t last_atom_offset = 0; |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 if (infile) | 317 if (infile) |
| 318 fclose(infile); | 318 fclose(infile); |
| 319 if (outfile) | 319 if (outfile) |
| 320 fclose(outfile); | 320 fclose(outfile); |
| 321 if (moov_atom) | 321 if (moov_atom) |
| 322 free(moov_atom); | 322 free(moov_atom); |
| 323 if (ftyp_atom) | 323 if (ftyp_atom) |
| 324 free(ftyp_atom); | 324 free(ftyp_atom); |
| 325 return return_code; | 325 return return_code; |
| 326 } | 326 } |
| OLD | NEW |