aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/ffmpeg/tools
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/ffmpeg/tools')
-rwxr-xr-xsrc/plugins/ffmpeg/tools/build_avopt9
-rwxr-xr-xsrc/plugins/ffmpeg/tools/clean-diff11
-rw-r--r--src/plugins/ffmpeg/tools/cws2fws.c130
-rw-r--r--src/plugins/ffmpeg/tools/pktdumper.c119
-rw-r--r--src/plugins/ffmpeg/tools/qt-faststart.c316
-rw-r--r--src/plugins/ffmpeg/tools/trasher.c70
-rwxr-xr-xsrc/plugins/ffmpeg/tools/unwrap-diff2
7 files changed, 0 insertions, 657 deletions
diff --git a/src/plugins/ffmpeg/tools/build_avopt b/src/plugins/ffmpeg/tools/build_avopt
deleted file mode 100755
index fcf1657..0000000
--- a/src/plugins/ffmpeg/tools/build_avopt
+++ /dev/null
@@ -1,9 +0,0 @@
1#!/bin/sh
2sed 's/unsigned//g' |\
3 sed 's/enum//g' |\
4 egrep '^ *(int|float|double|AVRational|char *\*) *[a-zA-Z_0-9]* *;' |\
5 sed 's/^ *\([^ ]*\)[ *]*\([^;]*\);.*$/{"\2", NULL, OFFSET(\2), FF_OPT_TYPE_\U\1, DEFAULT, \1_MIN, \1_MAX},/' |\
6 sed 's/AVRATIONAL_M/INT_M/g'|\
7 sed 's/TYPE_AVRATIONAL/TYPE_RATIONAL/g'|\
8 sed 's/FLOAT_M/FLT_M/g'|\
9 sed 's/FF_OPT_TYPE_CHAR/FF_OPT_TYPE_STRING/g'
diff --git a/src/plugins/ffmpeg/tools/clean-diff b/src/plugins/ffmpeg/tools/clean-diff
deleted file mode 100755
index 98e26a7..0000000
--- a/src/plugins/ffmpeg/tools/clean-diff
+++ /dev/null
@@ -1,11 +0,0 @@
1#!/bin/sh
2sed '/^+[^+]/!s/ /TaBBaT/g' |\
3 expand -t `seq -s , 9 8 200` |\
4 sed 's/TaBBaT/ /g' |\
5 sed '/^+[^+]/s/ * $//' |\
6 tr -d '\015' |\
7 tr '\n' '°' |\
8 sed 's/\(@@[^@]*@@°[^@]*\)/\n\1/g' |\
9 egrep -v '@@[^@]*@@°(( [^°]*°)|([+-][[:space:]]*°)|(-[[:space:]]*([^°]*)°\+[[:space:]]*\5°))*$' |\
10 tr -d '\n' |\
11 tr '°' '\n'
diff --git a/src/plugins/ffmpeg/tools/cws2fws.c b/src/plugins/ffmpeg/tools/cws2fws.c
deleted file mode 100644
index aa7d690..0000000
--- a/src/plugins/ffmpeg/tools/cws2fws.c
+++ /dev/null
@@ -1,130 +0,0 @@
1/*
2 * cws2fws by Alex Beregszaszi
3 * This file is placed in the public domain.
4 * Use the program however you see fit.
5 *
6 * This utility converts compressed Macromedia Flash files to uncompressed ones.
7 */
8
9#include <sys/stat.h>
10#include <fcntl.h>
11#include <stdio.h>
12#include <stdlib.h>
13#include <unistd.h>
14#include <zlib.h>
15
16#ifdef DEBUG
17#define dbgprintf printf
18#else
19#define dbgprintf(...)
20#endif
21
22int main(int argc, char *argv[])
23{
24 int fd_in, fd_out, comp_len, uncomp_len, i, last_out;
25 char buf_in[1024], buf_out[65536];
26 z_stream zstream;
27 struct stat statbuf;
28
29 if (argc < 3)
30 {
31 printf("Usage: %s <infile.swf> <outfile.swf>\n", argv[0]);
32 exit(1);
33 }
34
35 fd_in = open(argv[1], O_RDONLY);
36 if (fd_in < 0)
37 {
38 perror("Error while opening: ");
39 exit(1);
40 }
41
42 fd_out = open(argv[2], O_WRONLY|O_CREAT, 00644);
43 if (fd_out < 0)
44 {
45 perror("Error while opening: ");
46 close(fd_in);
47 exit(1);
48 }
49
50 if (read(fd_in, &buf_in, 8) != 8)
51 {
52 printf("Header error\n");
53 close(fd_in);
54 close(fd_out);
55 exit(1);
56 }
57
58 if (buf_in[0] != 'C' || buf_in[1] != 'W' || buf_in[2] != 'S')
59 {
60 printf("Not a compressed flash file\n");
61 exit(1);
62 }
63
64 fstat(fd_in, &statbuf);
65 comp_len = statbuf.st_size;
66 uncomp_len = buf_in[4] | (buf_in[5] << 8) | (buf_in[6] << 16) | (buf_in[7] << 24);
67
68 printf("Compressed size: %d Uncompressed size: %d\n", comp_len-4, uncomp_len-4);
69
70 // write out modified header
71 buf_in[0] = 'F';
72 write(fd_out, &buf_in, 8);
73
74 zstream.zalloc = NULL;
75 zstream.zfree = NULL;
76 zstream.opaque = NULL;
77 inflateInit(&zstream);
78
79 for (i = 0; i < comp_len-8;)
80 {
81 int ret, len = read(fd_in, &buf_in, 1024);
82
83 dbgprintf("read %d bytes\n", len);
84
85 last_out = zstream.total_out;
86
87 zstream.next_in = &buf_in[0];
88 zstream.avail_in = len;
89 zstream.next_out = &buf_out[0];
90 zstream.avail_out = 65536;
91
92 ret = inflate(&zstream, Z_SYNC_FLUSH);
93 if (ret != Z_STREAM_END && ret != Z_OK)
94 {
95 printf("Error while decompressing: %d\n", ret);
96 inflateEnd(&zstream);
97 exit(1);
98 }
99
100 dbgprintf("a_in: %d t_in: %lu a_out: %d t_out: %lu -- %lu out\n",
101 zstream.avail_in, zstream.total_in, zstream.avail_out, zstream.total_out,
102 zstream.total_out-last_out);
103
104 write(fd_out, &buf_out, zstream.total_out-last_out);
105
106 i += len;
107
108 if (ret == Z_STREAM_END || ret == Z_BUF_ERROR)
109 break;
110 }
111
112 if (zstream.total_out != uncomp_len-8)
113 {
114 printf("Size mismatch (%lu != %d), updating header...\n",
115 zstream.total_out, uncomp_len-8);
116
117 buf_in[0] = (zstream.total_out+8) & 0xff;
118 buf_in[1] = ((zstream.total_out+8) >> 8) & 0xff;
119 buf_in[2] = ((zstream.total_out+8) >> 16) & 0xff;
120 buf_in[3] = ((zstream.total_out+8) >> 24) & 0xff;
121
122 lseek(fd_out, 4, SEEK_SET);
123 write(fd_out, &buf_in, 4);
124 }
125
126 inflateEnd(&zstream);
127 close(fd_in);
128 close(fd_out);
129 return 0;
130}
diff --git a/src/plugins/ffmpeg/tools/pktdumper.c b/src/plugins/ffmpeg/tools/pktdumper.c
deleted file mode 100644
index 2d5a3b7..0000000
--- a/src/plugins/ffmpeg/tools/pktdumper.c
+++ /dev/null
@@ -1,119 +0,0 @@
1/*
2 * Copyright (c) 2005 Francois Revol
3 *
4 * This file is part of FFmpeg.
5 *
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21#include <avformat.h>
22#include <limits.h>
23#include <fcntl.h>
24#include <stdio.h>
25#include <stdlib.h>
26#include <string.h>
27#include <unistd.h>
28
29#define PKTFILESUFF "_%08"PRId64"_%02d_%010"PRId64"_%06d_%c.bin"
30
31#undef strcat
32
33static int usage(int ret)
34{
35 fprintf(stderr, "dump (up to maxpkts) AVPackets as they are demuxed by libavformat.\n");
36 fprintf(stderr, "each packet is dumped in its own file named like `basename file.ext`_$PKTNUM_$STREAMINDEX_$STAMP_$SIZE_$FLAGS.bin\n");
37 fprintf(stderr, "pktdumper [-nw] file [maxpkts]\n");
38 fprintf(stderr, "-n\twrite No file at all, only demux.\n");
39 fprintf(stderr, "-w\tWait at end of processing instead of quitting.\n");
40 return ret;
41}
42
43int main(int argc, char **argv)
44{
45 char fntemplate[PATH_MAX];
46 char pktfilename[PATH_MAX];
47 AVFormatContext *fctx;
48 AVPacket pkt;
49 int64_t pktnum = 0;
50 int64_t maxpkts = 0;
51 int donotquit = 0;
52 int nowrite = 0;
53 int err;
54
55 if ((argc > 1) && !strncmp(argv[1], "-", 1)) {
56 if (strchr(argv[1], 'w'))
57 donotquit = 1;
58 if (strchr(argv[1], 'n'))
59 nowrite = 1;
60 argv++;
61 argc--;
62 }
63 if (argc < 2)
64 return usage(1);
65 if (argc > 2)
66 maxpkts = atoi(argv[2]);
67 strncpy(fntemplate, argv[1], PATH_MAX-1);
68 if (strrchr(argv[1], '/'))
69 strncpy(fntemplate, strrchr(argv[1], '/')+1, PATH_MAX-1);
70 if (strrchr(fntemplate, '.'))
71 *strrchr(fntemplate, '.') = '\0';
72 if (strchr(fntemplate, '%')) {
73 fprintf(stderr, "can't use filenames containing '%%'\n");
74 return usage(1);
75 }
76 if (strlen(fntemplate) + sizeof(PKTFILESUFF) >= PATH_MAX-1) {
77 fprintf(stderr, "filename too long\n");
78 return usage(1);
79 }
80 strcat(fntemplate, PKTFILESUFF);
81 printf("FNTEMPLATE: '%s'\n", fntemplate);
82
83 // register all file formats
84 av_register_all();
85
86 err = av_open_input_file(&fctx, argv[1], NULL, 0, NULL);
87 if (err < 0) {
88 fprintf(stderr, "av_open_input_file: error %d\n", err);
89 return 1;
90 }
91
92 err = av_find_stream_info(fctx);
93 if (err < 0) {
94 fprintf(stderr, "av_find_stream_info: error %d\n", err);
95 return 1;
96 }
97
98 av_init_packet(&pkt);
99
100 while ((err = av_read_frame(fctx, &pkt)) >= 0) {
101 int fd;
102 snprintf(pktfilename, PATH_MAX-1, fntemplate, pktnum, pkt.stream_index, pkt.pts, pkt.size, (pkt.flags & PKT_FLAG_KEY)?'K':'_');
103 printf(PKTFILESUFF"\n", pktnum, pkt.stream_index, pkt.pts, pkt.size, (pkt.flags & PKT_FLAG_KEY)?'K':'_');
104 //printf("open(\"%s\")\n", pktfilename);
105 if (!nowrite) {
106 fd = open(pktfilename, O_WRONLY|O_CREAT, 0644);
107 write(fd, pkt.data, pkt.size);
108 close(fd);
109 }
110 pktnum++;
111 if (maxpkts && (pktnum >= maxpkts))
112 break;
113 }
114
115 while (donotquit)
116 sleep(60);
117
118 return 0;
119}
diff --git a/src/plugins/ffmpeg/tools/qt-faststart.c b/src/plugins/ffmpeg/tools/qt-faststart.c
deleted file mode 100644
index acc9d7a..0000000
--- a/src/plugins/ffmpeg/tools/qt-faststart.c
+++ /dev/null
@@ -1,316 +0,0 @@
1/*
2 * qt-faststart.c, v0.1
3 * by Mike Melanson (melanson@pcisys.net)
4 * This file is placed in the public domain. Use the program however you
5 * see fit.
6 *
7 * This utility rearranges a Quicktime file such that the moov atom
8 * is in front of the data, thus facilitating network streaming.
9 *
10 * To compile this program, start from the base directory from which you
11 * are building FFmpeg and type:
12 * make tools/qt-faststart
13 * The qt-faststart program will be built in the tools/ directory. If you
14 * do not build the program in this manner, correct results are not
15 * guaranteed, particularly on 64-bit platforms.
16 * Invoke the program with:
17 * qt-faststart <infile.mov> <outfile.mov>
18 *
19 * Notes: Quicktime files can come in many configurations of top-level
20 * atoms. This utility stipulates that the very last atom in the file needs
21 * to be a moov atom. When given such a file, this utility will rearrange
22 * the top-level atoms by shifting the moov atom from the back of the file
23 * to the front, and patch the chunk offsets along the way. This utility
24 * presently only operates on uncompressed moov atoms.
25 */
26
27#include <stdio.h>
28#include <stdlib.h>
29#include <inttypes.h>
30
31#ifdef __MINGW32__
32#define fseeko(x,y,z) fseeko64(x,y,z)
33#define ftello(x) ftello64(x)
34#endif
35
36#define BE_16(x) ((((uint8_t*)(x))[0] << 8) | ((uint8_t*)(x))[1])
37#define BE_32(x) ((((uint8_t*)(x))[0] << 24) | \
38 (((uint8_t*)(x))[1] << 16) | \
39 (((uint8_t*)(x))[2] << 8) | \
40 ((uint8_t*)(x))[3])
41#define BE_64(x) (((uint64_t)(((uint8_t*)(x))[0]) << 56) | \
42 ((uint64_t)(((uint8_t*)(x))[1]) << 48) | \
43 ((uint64_t)(((uint8_t*)(x))[2]) << 40) | \
44 ((uint64_t)(((uint8_t*)(x))[3]) << 32) | \
45 ((uint64_t)(((uint8_t*)(x))[4]) << 24) | \
46 ((uint64_t)(((uint8_t*)(x))[5]) << 16) | \
47 ((uint64_t)(((uint8_t*)(x))[6]) << 8) | \
48 ((uint64_t)((uint8_t*)(x))[7]))
49
50#define BE_FOURCC( ch0, ch1, ch2, ch3 ) \
51 ( (uint32_t)(unsigned char)(ch3) | \
52 ( (uint32_t)(unsigned char)(ch2) << 8 ) | \
53 ( (uint32_t)(unsigned char)(ch1) << 16 ) | \
54 ( (uint32_t)(unsigned char)(ch0) << 24 ) )
55
56#define QT_ATOM BE_FOURCC
57/* top level atoms */
58#define FREE_ATOM QT_ATOM('f', 'r', 'e', 'e')
59#define JUNK_ATOM QT_ATOM('j', 'u', 'n', 'k')
60#define MDAT_ATOM QT_ATOM('m', 'd', 'a', 't')
61#define MOOV_ATOM QT_ATOM('m', 'o', 'o', 'v')
62#define PNOT_ATOM QT_ATOM('p', 'n', 'o', 't')
63#define SKIP_ATOM QT_ATOM('s', 'k', 'i', 'p')
64#define WIDE_ATOM QT_ATOM('w', 'i', 'd', 'e')
65#define PICT_ATOM QT_ATOM('P', 'I', 'C', 'T')
66#define FTYP_ATOM QT_ATOM('f', 't', 'y', 'p')
67
68#define CMOV_ATOM QT_ATOM('c', 'm', 'o', 'v')
69#define STCO_ATOM QT_ATOM('s', 't', 'c', 'o')
70#define CO64_ATOM QT_ATOM('c', 'o', '6', '4')
71
72#define ATOM_PREAMBLE_SIZE 8
73#define COPY_BUFFER_SIZE 1024
74
75int main(int argc, char *argv[])
76{
77 FILE *infile;
78 FILE *outfile;
79 unsigned char atom_bytes[ATOM_PREAMBLE_SIZE];
80 uint32_t atom_type = 0;
81 uint64_t atom_size = 0;
82 uint64_t last_offset;
83 unsigned char *moov_atom;
84 unsigned char *ftyp_atom = 0;
85 uint64_t moov_atom_size;
86 uint64_t ftyp_atom_size = 0;
87 uint64_t i, j;
88 uint32_t offset_count;
89 uint64_t current_offset;
90 uint64_t start_offset = 0;
91 unsigned char copy_buffer[COPY_BUFFER_SIZE];
92 int bytes_to_copy;
93
94 if (argc != 3) {
95 printf ("Usage: qt-faststart <infile.mov> <outfile.mov>\n");
96 return 0;
97 }
98
99 infile = fopen(argv[1], "rb");
100 if (!infile) {
101 perror(argv[1]);
102 return 1;
103 }
104
105 /* traverse through the atoms in the file to make sure that 'moov' is
106 * at the end */
107 while (!feof(infile)) {
108 if (fread(atom_bytes, ATOM_PREAMBLE_SIZE, 1, infile) != 1) {
109 break;
110 }
111 atom_size = (uint32_t)BE_32(&atom_bytes[0]);
112 atom_type = BE_32(&atom_bytes[4]);
113
114 if ((atom_type != FREE_ATOM) &&
115 (atom_type != JUNK_ATOM) &&
116 (atom_type != MDAT_ATOM) &&
117 (atom_type != MOOV_ATOM) &&
118 (atom_type != PNOT_ATOM) &&
119 (atom_type != SKIP_ATOM) &&
120 (atom_type != WIDE_ATOM) &&
121 (atom_type != PICT_ATOM) &&
122 (atom_type != FTYP_ATOM)) {
123 printf ("encountered non-QT top-level atom (is this a Quicktime file?)\n");
124 break;
125 }
126
127 /* keep ftyp atom */
128 if (atom_type == FTYP_ATOM) {
129 ftyp_atom_size = atom_size;
130 ftyp_atom = malloc(ftyp_atom_size);
131 if (!ftyp_atom) {
132 printf ("could not allocate 0x%llX byte for ftyp atom\n",
133 atom_size);
134 fclose(infile);
135 return 1;
136 }
137 fseeko(infile, -ATOM_PREAMBLE_SIZE, SEEK_CUR);
138 if (fread(ftyp_atom, atom_size, 1, infile) != 1) {
139 perror(argv[1]);
140 free(ftyp_atom);
141 fclose(infile);
142 return 1;
143 }
144 start_offset = ftello(infile);
145 continue;
146 }
147
148 /* 64-bit special case */
149 if (atom_size == 1) {
150 if (fread(atom_bytes, ATOM_PREAMBLE_SIZE, 1, infile) != 1) {
151 break;
152 }
153 atom_size = BE_64(&atom_bytes[0]);
154 fseeko(infile, atom_size - ATOM_PREAMBLE_SIZE * 2, SEEK_CUR);
155 } else {
156 fseeko(infile, atom_size - ATOM_PREAMBLE_SIZE, SEEK_CUR);
157 }
158 }
159
160 if (atom_type != MOOV_ATOM) {
161 printf ("last atom in file was not a moov atom\n");
162 fclose(infile);
163 return 0;
164 }
165
166 /* moov atom was, in fact, the last atom in the chunk; load the whole
167 * moov atom */
168 fseeko(infile, -atom_size, SEEK_END);
169 last_offset = ftello(infile);
170 moov_atom_size = atom_size;
171 moov_atom = malloc(moov_atom_size);
172 if (!moov_atom) {
173 printf ("could not allocate 0x%llX byte for moov atom\n",
174 atom_size);
175 fclose(infile);
176 return 1;
177 }
178 if (fread(moov_atom, atom_size, 1, infile) != 1) {
179 perror(argv[1]);
180 free(moov_atom);
181 fclose(infile);
182 return 1;
183 }
184
185 /* this utility does not support compressed atoms yet, so disqualify
186 * files with compressed QT atoms */
187 if (BE_32(&moov_atom[12]) == CMOV_ATOM) {
188 printf ("this utility does not support compressed moov atoms yet\n");
189 free(moov_atom);
190 fclose(infile);
191 return 1;
192 }
193
194 /* close; will be re-opened later */
195 fclose(infile);
196
197 /* crawl through the moov chunk in search of stco or co64 atoms */
198 for (i = 4; i < moov_atom_size - 4; i++) {
199 atom_type = BE_32(&moov_atom[i]);
200 if (atom_type == STCO_ATOM) {
201 printf (" patching stco atom...\n");
202 atom_size = BE_32(&moov_atom[i - 4]);
203 if (i + atom_size - 4 > moov_atom_size) {
204 printf (" bad atom size\n");
205 free(moov_atom);
206 return 1;
207 }
208 offset_count = BE_32(&moov_atom[i + 8]);
209 for (j = 0; j < offset_count; j++) {
210 current_offset = BE_32(&moov_atom[i + 12 + j * 4]);
211 current_offset += moov_atom_size;
212 moov_atom[i + 12 + j * 4 + 0] = (current_offset >> 24) & 0xFF;
213 moov_atom[i + 12 + j * 4 + 1] = (current_offset >> 16) & 0xFF;
214 moov_atom[i + 12 + j * 4 + 2] = (current_offset >> 8) & 0xFF;
215 moov_atom[i + 12 + j * 4 + 3] = (current_offset >> 0) & 0xFF;
216 }
217 i += atom_size - 4;
218 } else if (atom_type == CO64_ATOM) {
219 printf (" patching co64 atom...\n");
220 atom_size = BE_32(&moov_atom[i - 4]);
221 if (i + atom_size - 4 > moov_atom_size) {
222 printf (" bad atom size\n");
223 free(moov_atom);
224 return 1;
225 }
226 offset_count = BE_32(&moov_atom[i + 8]);
227 for (j = 0; j < offset_count; j++) {
228 current_offset = BE_64(&moov_atom[i + 12 + j * 8]);
229 current_offset += moov_atom_size;
230 moov_atom[i + 12 + j * 8 + 0] = (current_offset >> 56) & 0xFF;
231 moov_atom[i + 12 + j * 8 + 1] = (current_offset >> 48) & 0xFF;
232 moov_atom[i + 12 + j * 8 + 2] = (current_offset >> 40) & 0xFF;
233 moov_atom[i + 12 + j * 8 + 3] = (current_offset >> 32) & 0xFF;
234 moov_atom[i + 12 + j * 8 + 4] = (current_offset >> 24) & 0xFF;
235 moov_atom[i + 12 + j * 8 + 5] = (current_offset >> 16) & 0xFF;
236 moov_atom[i + 12 + j * 8 + 6] = (current_offset >> 8) & 0xFF;
237 moov_atom[i + 12 + j * 8 + 7] = (current_offset >> 0) & 0xFF;
238 }
239 i += atom_size - 4;
240 }
241 }
242
243 /* re-open the input file and open the output file */
244 infile = fopen(argv[1], "rb");
245 if (!infile) {
246 perror(argv[1]);
247 free(moov_atom);
248 return 1;
249 }
250
251 if (start_offset > 0) { /* seek after ftyp atom */
252 fseeko(infile, start_offset, SEEK_SET);
253 last_offset -= start_offset;
254 }
255
256 outfile = fopen(argv[2], "wb");
257 if (!outfile) {
258 perror(argv[2]);
259 fclose(outfile);
260 fclose(infile);
261 free(moov_atom);
262 return 1;
263 }
264
265 /* dump the same ftyp atom */
266 if (ftyp_atom_size > 0) {
267 printf (" writing ftyp atom...\n");
268 if (fwrite(ftyp_atom, ftyp_atom_size, 1, outfile) != 1) {
269 perror(argv[2]);
270 goto error_out;
271 }
272 }
273
274 /* dump the new moov atom */
275 printf (" writing moov atom...\n");
276 if (fwrite(moov_atom, moov_atom_size, 1, outfile) != 1) {
277 perror(argv[2]);
278 goto error_out;
279 }
280
281 /* copy the remainder of the infile, from offset 0 -> last_offset - 1 */
282 printf (" copying rest of file...\n");
283 while (last_offset) {
284 if (last_offset > COPY_BUFFER_SIZE)
285 bytes_to_copy = COPY_BUFFER_SIZE;
286 else
287 bytes_to_copy = last_offset;
288
289 if (fread(copy_buffer, bytes_to_copy, 1, infile) != 1) {
290 perror(argv[1]);
291 goto error_out;
292 }
293 if (fwrite(copy_buffer, bytes_to_copy, 1, outfile) != 1) {
294 perror(argv[2]);
295 goto error_out;
296 }
297
298 last_offset -= bytes_to_copy;
299 }
300
301 fclose(infile);
302 fclose(outfile);
303 free(moov_atom);
304 if (ftyp_atom_size > 0)
305 free(ftyp_atom);
306
307 return 0;
308
309error_out:
310 fclose(infile);
311 fclose(outfile);
312 free(moov_atom);
313 if (ftyp_atom_size > 0)
314 free(ftyp_atom);
315 return 1;
316}
diff --git a/src/plugins/ffmpeg/tools/trasher.c b/src/plugins/ffmpeg/tools/trasher.c
deleted file mode 100644
index 597bfb6..0000000
--- a/src/plugins/ffmpeg/tools/trasher.c
+++ /dev/null
@@ -1,70 +0,0 @@
1/*
2 * Copyright (c) 2007 Michael Niedermayer
3 *
4 * This file is part of FFmpeg.
5 *
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21#include <stdio.h>
22#include <stdlib.h>
23#include <time.h>
24#include <inttypes.h>
25
26int main(int argc, char** argv)
27{
28 FILE *f;
29 int count, maxburst, length;
30
31 if (argc < 4){
32 printf("USAGE: trasher <filename> <count> <maxburst>\n");
33 return 1;
34 }
35
36 f= fopen(argv[1], "rb+");
37 if (!f){
38 perror(argv[1]);
39 return 2;
40 }
41 count= atoi(argv[2]);
42 maxburst= atoi(argv[3]);
43
44 srandom (time (0));
45
46 fseek(f, 0, SEEK_END);
47 length= ftell(f);
48 fseek(f, 0, SEEK_SET);
49
50 while(count--){
51 int burst= 1 + random() * (uint64_t) (abs(maxburst)-1) / RAND_MAX;
52 int pos= random() * (uint64_t) length / RAND_MAX;
53 fseek(f, pos, SEEK_SET);
54
55 if(maxburst<0) burst= -maxburst;
56
57 if(pos + burst > length)
58 continue;
59
60 while(burst--){
61 int val= random() * 256ULL / RAND_MAX;
62
63 if(maxburst<0) val=0;
64
65 fwrite(&val, 1, 1, f);
66 }
67 }
68 fclose (f);
69 return 0;
70}
diff --git a/src/plugins/ffmpeg/tools/unwrap-diff b/src/plugins/ffmpeg/tools/unwrap-diff
deleted file mode 100755
index ccea99b..0000000
--- a/src/plugins/ffmpeg/tools/unwrap-diff
+++ /dev/null
@@ -1,2 +0,0 @@
1#!/bin/sh
2tr '\n' '\001' | sed 's/\x01\x01/\x01 \x01/g' | sed 's/\x01\([^-+ @]\)/ \1/g' | tr '\001' '\n'