Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--[-rwxr-xr-x]tools/build_libstagefright0
-rwxr-xr-xtools/clean-diff11
-rw-r--r--tools/cws2fws.c18
-rw-r--r--tools/enum_options.c143
-rw-r--r--tools/graph2dot.c13
-rw-r--r--tools/lavfi-showfiltfmts.c75
-rwxr-xr-xtools/patcheck11
-rw-r--r--tools/pktdumper.c16
-rw-r--r--tools/probetest.c8
-rw-r--r--tools/qt-faststart.c110
-rw-r--r--tools/trasher.c8
-rwxr-xr-xtools/unwrap-diff2
12 files changed, 302 insertions, 113 deletions
diff --git a/tools/build_libstagefright b/tools/build_libstagefright
index 78c20841ee..78c20841ee 100755..100644
--- a/tools/build_libstagefright
+++ b/tools/build_libstagefright
diff --git a/tools/clean-diff b/tools/clean-diff
new file mode 100755
index 0000000000..4600702b10
--- /dev/null
+++ b/tools/clean-diff
@@ -0,0 +1,11 @@
+#!/bin/sh
+sed '/^+[^+]/!s/ /TaBBaT/g' |\
+ expand -t $(seq -s , 9 8 200) |\
+ sed 's/TaBBaT/ /g' |\
+ sed '/^+[^+]/s/ * $//' |\
+ tr -d '\015' |\
+ tr '\n' '°' |\
+ sed 's/\(@@[^@]*@@°[^@]*\)/\n\1/g' |\
+ egrep -v '@@[^@]*@@°(( [^°]*°)|([+-][[:space:]]*°)|(-[[:space:]]*([^°]*)°\+[[:space:]]*\5°))*$' |\
+ tr -d '\n' |\
+ tr '°' '\n'
diff --git a/tools/cws2fws.c b/tools/cws2fws.c
index b8535feaa4..35fce35683 100644
--- a/tools/cws2fws.c
+++ b/tools/cws2fws.c
@@ -29,14 +29,14 @@ int main(int argc, char *argv[])
if (argc < 3)
{
printf("Usage: %s <infile.swf> <outfile.swf>\n", argv[0]);
- exit(1);
+ return 1;
}
fd_in = open(argv[1], O_RDONLY);
if (fd_in < 0)
{
perror("Error opening input file");
- exit(1);
+ return 1;
}
fd_out = open(argv[2], O_WRONLY|O_CREAT, 00644);
@@ -44,7 +44,7 @@ int main(int argc, char *argv[])
{
perror("Error opening output file");
close(fd_in);
- exit(1);
+ return 1;
}
if (read(fd_in, &buf_in, 8) != 8)
@@ -52,13 +52,13 @@ int main(int argc, char *argv[])
printf("Header error\n");
close(fd_in);
close(fd_out);
- exit(1);
+ return 1;
}
if (buf_in[0] != 'C' || buf_in[1] != 'W' || buf_in[2] != 'S')
{
printf("Not a compressed flash file\n");
- exit(1);
+ return 1;
}
fstat(fd_in, &statbuf);
@@ -71,7 +71,7 @@ int main(int argc, char *argv[])
buf_in[0] = 'F';
if (write(fd_out, &buf_in, 8) < 8) {
perror("Error writing output file");
- exit(1);
+ return 1;
}
zstream.zalloc = NULL;
@@ -97,7 +97,7 @@ int main(int argc, char *argv[])
{
printf("Error while decompressing: %d\n", ret);
inflateEnd(&zstream);
- exit(1);
+ return 1;
}
dbgprintf("a_in: %d t_in: %lu a_out: %d t_out: %lu -- %lu out\n",
@@ -106,7 +106,7 @@ int main(int argc, char *argv[])
if (write(fd_out, &buf_out, zstream.total_out - last_out) < zstream.total_out - last_out) {
perror("Error writing output file");
- exit(1);
+ return 1;
}
i += len;
@@ -128,7 +128,7 @@ int main(int argc, char *argv[])
lseek(fd_out, 4, SEEK_SET);
if (write(fd_out, &buf_in, 4) < 4) {
perror("Error writing output file");
- exit(1);
+ return 1;
}
}
diff --git a/tools/enum_options.c b/tools/enum_options.c
new file mode 100644
index 0000000000..45ac727d04
--- /dev/null
+++ b/tools/enum_options.c
@@ -0,0 +1,143 @@
+/*
+ * Copyright (c) 2011 Anton Khirnov
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/*
+ * enumerate avoptions and format them in texinfo format
+ */
+
+#include <string.h>
+
+#include "libavformat/avformat.h"
+#include "libavcodec/avcodec.h"
+#include "libavutil/log.h"
+#include "libavutil/opt.h"
+
+static void print_usage(void)
+{
+ fprintf(stderr, "Usage: enum_options type\n"
+ "type: format codec\n");
+ exit(1);
+}
+
+static void print_option(const AVClass *class, const AVOption *o)
+{
+ printf("@item -%s @var{", o->name);
+ switch (o->type) {
+ case FF_OPT_TYPE_BINARY: printf("hexadecimal string"); break;
+ case FF_OPT_TYPE_STRING: printf("string"); break;
+ case FF_OPT_TYPE_INT:
+ case FF_OPT_TYPE_INT64: printf("integer"); break;
+ case FF_OPT_TYPE_FLOAT:
+ case FF_OPT_TYPE_DOUBLE: printf("float"); break;
+ case FF_OPT_TYPE_RATIONAL: printf("rational number"); break;
+ case FF_OPT_TYPE_FLAGS: printf("flags"); break;
+ default: printf("value"); break;
+ }
+ printf("} (@emph{");
+
+ if (o->flags & AV_OPT_FLAG_ENCODING_PARAM) {
+ printf("input");
+ if (o->flags & AV_OPT_FLAG_ENCODING_PARAM)
+ printf("/");
+ }
+ if (o->flags & AV_OPT_FLAG_ENCODING_PARAM)
+ printf("output");
+
+ printf("})\n");
+ if (o->help)
+ printf("%s\n", o->help);
+
+ if (o->unit) {
+ const AVOption *u = NULL;
+ printf("\nPossible values:\n@table @samp\n");
+
+ while ((u = av_next_option(&class, u)))
+ if (u->type == FF_OPT_TYPE_CONST && u->unit && !strcmp(u->unit, o->unit))
+ printf("@item %s\n%s\n", u->name, u->help ? u->help : "");
+ printf("@end table\n");
+ }
+}
+
+static void show_opts(const AVClass *class)
+{
+ const AVOption *o = NULL;
+
+ printf("@table @option\n");
+ while ((o = av_next_option(&class, o)))
+ if (o->type != FF_OPT_TYPE_CONST)
+ print_option(class, o);
+ printf("@end table\n");
+}
+
+static void show_format_opts(void)
+{
+ AVInputFormat *iformat = NULL;
+ AVOutputFormat *oformat = NULL;
+
+ printf("@section Generic format AVOptions\n");
+ show_opts(avformat_get_class());
+
+ printf("@section Format-specific AVOptions\n");
+ while ((iformat = av_iformat_next(iformat))) {
+ if (!iformat->priv_class)
+ continue;
+ printf("@subsection %s AVOptions\n", iformat->priv_class->class_name);
+ show_opts(iformat->priv_class);
+ }
+ while ((oformat = av_oformat_next(oformat))) {
+ if (!oformat->priv_class)
+ continue;
+ printf("@subsection %s AVOptions\n", oformat->priv_class->class_name);
+ show_opts(oformat->priv_class);
+ }
+}
+
+static void show_codec_opts(void)
+{
+ AVCodec *c = NULL;
+
+ printf("@section Generic codec AVOptions\n");
+ show_opts(avcodec_get_class());
+
+ printf("@section Codec-specific AVOptions\n");
+ while ((c = av_codec_next(c))) {
+ if (!c->priv_class)
+ continue;
+ printf("@subsection %s AVOptions\n", c->priv_class->class_name);
+ show_opts(c->priv_class);
+ }
+}
+
+int main(int argc, char **argv)
+{
+ if (argc < 2)
+ print_usage();
+
+ av_register_all();
+
+ if (!strcmp(argv[1], "format"))
+ show_format_opts();
+ else if (!strcmp(argv[1], "codec"))
+ show_codec_opts();
+ else
+ print_usage();
+
+ return 0;
+}
diff --git a/tools/graph2dot.c b/tools/graph2dot.c
index 5ec6e204f7..766afdb050 100644
--- a/tools/graph2dot.c
+++ b/tools/graph2dot.c
@@ -1,20 +1,20 @@
/*
* Copyright (c) 2008-2010 Stefano Sabatini
*
- * This file is part of Libav.
+ * This file is part of FFmpeg.
*
- * Libav is free software; you can redistribute it and/or
+ * FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
- * Libav is distributed in the hope that it will be useful,
+ * FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with Libav; if not, write to the Free Software
+ * License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
@@ -75,9 +75,10 @@ static void print_digraph(FILE *outfile, AVFilterGraph *graph)
} else if (link->type == AVMEDIA_TYPE_AUDIO) {
char buf[255];
av_get_channel_layout_string(buf, sizeof(buf), -1, link->channel_layout);
- fprintf(outfile, " [ label= \"fmt:%s sr:%"PRId64" cl:%s\" ]",
+ fprintf(outfile, " [ label= \"fmt:%s sr:%"PRId64" cl:%s tb:%d/%d\" ]",
av_get_sample_fmt_name(link->format),
- link->sample_rate, buf);
+ link->sample_rate, buf,
+ link->time_base.num, link->time_base.den);
}
fprintf(outfile, ";\n");
}
diff --git a/tools/lavfi-showfiltfmts.c b/tools/lavfi-showfiltfmts.c
index 30d472559c..436f985cb2 100644
--- a/tools/lavfi-showfiltfmts.c
+++ b/tools/lavfi-showfiltfmts.c
@@ -1,34 +1,81 @@
/*
* Copyright (c) 2009 Stefano Sabatini
*
- * This file is part of Libav.
+ * This file is part of FFmpeg.
*
- * Libav is free software; you can redistribute it and/or
+ * FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
- * Libav is distributed in the hope that it will be useful,
+ * FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with Libav; if not, write to the Free Software
+ * License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libavformat/avformat.h"
#include "libavutil/pixdesc.h"
+#include "libavutil/samplefmt.h"
#include "libavfilter/avfilter.h"
+static void print_formats(AVFilterContext *filter_ctx)
+{
+ int i, j;
+
+#define PRINT_FMTS(inout, outin, INOUT) \
+ for (i = 0; i < filter_ctx->input_count; i++) { \
+ if (filter_ctx->inout##puts[i]->type == AVMEDIA_TYPE_VIDEO) { \
+ AVFilterFormats *fmts = \
+ filter_ctx->inout##puts[i]->outin##_formats; \
+ for (j = 0; j < fmts->format_count; j++) \
+ if(av_get_pix_fmt_name(fmts->formats[j])) \
+ printf(#INOUT "PUT[%d] %s: fmt:%s\n", \
+ i, filter_ctx->filter->inout##puts[i].name, \
+ av_get_pix_fmt_name(fmts->formats[j])); \
+ } else if (filter_ctx->inout##puts[i]->type == AVMEDIA_TYPE_AUDIO) { \
+ AVFilterFormats *fmts; \
+ \
+ fmts = filter_ctx->inout##puts[i]->outin##_formats; \
+ for (j = 0; j < fmts->format_count; j++) \
+ printf(#INOUT "PUT[%d] %s: fmt:%s\n", \
+ i, filter_ctx->filter->inout##puts[i].name, \
+ av_get_sample_fmt_name(fmts->formats[j])); \
+ \
+ fmts = filter_ctx->inout##puts[i]->outin##_chlayouts; \
+ for (j = 0; j < fmts->format_count; j++) { \
+ char buf[256]; \
+ av_get_channel_layout_string(buf, sizeof(buf), -1, \
+ fmts->formats[j]); \
+ printf(#INOUT "PUT[%d] %s: chlayout:%s\n", \
+ i, filter_ctx->filter->inout##puts[i].name, buf); \
+ } \
+ \
+ fmts = filter_ctx->inout##puts[i]->outin##_packing; \
+ for (j = 0; j < fmts->format_count; j++) { \
+ printf(#INOUT "PUT[%d] %s: packing:%s\n", \
+ i, filter_ctx->filter->inout##puts[i].name, \
+ fmts->formats[j] == AVFILTER_PACKED ? \
+ "packed" : "planar"); \
+ } \
+ } \
+ } \
+
+ PRINT_FMTS(in, out, IN);
+ PRINT_FMTS(out, in, OUT);
+}
+
int main(int argc, char **argv)
{
AVFilter *filter;
AVFilterContext *filter_ctx;
const char *filter_name;
const char *filter_args = NULL;
- int i, j;
+ int i;
av_log_set_level(AV_LOG_DEBUG);
@@ -75,23 +122,7 @@ int main(int argc, char **argv)
else
avfilter_default_query_formats(filter_ctx);
- /* print the supported formats in input */
- for (i = 0; i < filter_ctx->input_count; i++) {
- AVFilterFormats *fmts = filter_ctx->inputs[i]->out_formats;
- for (j = 0; j < fmts->format_count; j++)
- printf("INPUT[%d] %s: %s\n",
- i, filter_ctx->filter->inputs[i].name,
- av_pix_fmt_descriptors[fmts->formats[j]].name);
- }
-
- /* print the supported formats in output */
- for (i = 0; i < filter_ctx->output_count; i++) {
- AVFilterFormats *fmts = filter_ctx->outputs[i]->in_formats;
- for (j = 0; j < fmts->format_count; j++)
- printf("OUTPUT[%d] %s: %s\n",
- i, filter_ctx->filter->outputs[i].name,
- av_pix_fmt_descriptors[fmts->formats[j]].name);
- }
+ print_formats(filter_ctx);
avfilter_free(filter_ctx);
fflush(stdout);
diff --git a/tools/patcheck b/tools/patcheck
index 19faf47b1d..39f5715e2a 100755
--- a/tools/patcheck
+++ b/tools/patcheck
@@ -15,11 +15,11 @@ OPT="-nH"
#FILES=$($GREP '^+++' $* | sed 's/+++ //g')
echo patCHeck 1e10.0
-echo This tool is intended to help a human check/review patches it is very far from
-echo being free of false positives and negatives, its output are just hints of what
+echo This tool is intended to help a human check/review patches. It is very far from
+echo being free of false positives and negatives, and its output are just hints of what
echo may or may not be bad. When you use it and it misses something or detects
-echo something wrong, fix it and send a patch to the libav-devel mailing list.
-echo License:GPL Autor: Michael Niedermayer
+echo something wrong, fix it and send a patch to the ffmpeg-devel mailing list.
+echo License: GPL, Author: Michael Niedermayer
ERE_PRITYP='(unsigned *|)(char|short|long|int|long *int|short *int|void|float|double|(u|)int(8|16|32|64)_t)'
ERE_TYPES='(const|static|av_cold|inline| *)*('$ERE_PRITYP'|[a-zA-Z][a-zA-Z0-9_]*)[* ]{1,}[a-zA-Z][a-zA-Z0-9_]*'
@@ -55,6 +55,7 @@ hiegrep 'INIT_VLC_USE_STATIC' 'forbidden ancient vlc type' $*
hiegrep '=[-+\*\&] ' 'looks like compound assignment' $*
hiegrep2 '/\*\* *[a-zA-Z0-9].*' '\*/' 'Inconsistently formatted doxygen comment' $*
hiegrep '; */\*\*[^<]' 'Misformatted doxygen comment' $*
+hiegrep '//!|/\*!' 'inconsistent doxygen syntax' $*
hiegrep2 '(int|unsigned|static|void)[a-zA-Z0-9 _]*(init|end)[a-zA-Z0-9 _]*\(.*[^;]$' '(av_cold|:\+[^a-zA-Z_])' 'These functions may need av_cold, please review the whole patch for similar functions needing av_cold' $*
@@ -66,7 +67,7 @@ $EGREP $OPT '^\+ *(const *|)static' $*| $EGREP --color=always '[^=]= *(0|NULL)[^
cat $TMP
hiegrep '# *ifdef * (HAVE|CONFIG)_' 'ifdefs that should be #if' $*
-hiegrep '\b(awnser|cant|dont|quantised|quantisation|teh|wont)\b' 'common typos' $*
+hiegrep '\b(awnser|cant|dont|wont|usefull|successfull|occured|teh|alot|wether|skiped|heigth|informations|colums|loosy|loosing|seperate|preceed|upto|paket)\b' 'common typos' $*
hiegrep 'av_log\( *NULL' 'Missing context in av_log' $*
hiegrep '[^sn]printf' 'Please use av_log' $*
diff --git a/tools/pktdumper.c b/tools/pktdumper.c
index 56bc7b7ce0..999e1e6c63 100644
--- a/tools/pktdumper.c
+++ b/tools/pktdumper.c
@@ -1,20 +1,20 @@
/*
* Copyright (c) 2005 Francois Revol
*
- * This file is part of Libav.
+ * This file is part of FFmpeg.
*
- * Libav is free software; you can redistribute it and/or
+ * FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
- * Libav is distributed in the hope that it will be useful,
+ * FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with Libav; if not, write to the Free Software
+ * License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
@@ -44,7 +44,7 @@ int main(int argc, char **argv)
{
char fntemplate[PATH_MAX];
char pktfilename[PATH_MAX];
- AVFormatContext *fctx;
+ AVFormatContext *fctx = NULL;
AVPacket pkt;
int64_t pktnum = 0;
int64_t maxpkts = 0;
@@ -83,9 +83,9 @@ int main(int argc, char **argv)
// register all file formats
av_register_all();
- err = av_open_input_file(&fctx, argv[1], NULL, 0, NULL);
+ err = avformat_open_input(&fctx, argv[1], NULL, NULL);
if (err < 0) {
- fprintf(stderr, "av_open_input_file: error %d\n", err);
+ fprintf(stderr, "cannot open input: error %d\n", err);
return 1;
}
@@ -117,7 +117,7 @@ int main(int argc, char **argv)
break;
}
- av_close_input_file(fctx);
+ avformat_close_input(&fctx);
while (donotquit)
sleep(60);
diff --git a/tools/probetest.c b/tools/probetest.c
index 7f8d54e973..b4bb5aea9e 100644
--- a/tools/probetest.c
+++ b/tools/probetest.c
@@ -1,20 +1,20 @@
/*
* copyright (c) 2009 Michael Niedermayer <michaelni@gmx.at>
*
- * This file is part of Libav.
+ * This file is part of FFmpeg.
*
- * Libav is free software; you can redistribute it and/or
+ * FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
- * Libav is distributed in the hope that it will be useful,
+ * FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with Libav; if not, write to the Free Software
+ * License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
diff --git a/tools/qt-faststart.c b/tools/qt-faststart.c
index eefeafdfac..79467f0415 100644
--- a/tools/qt-faststart.c
+++ b/tools/qt-faststart.c
@@ -8,7 +8,7 @@
* is in front of the data, thus facilitating network streaming.
*
* To compile this program, start from the base directory from which you
- * are building Libav and type:
+ * are building FFmpeg and type:
* make tools/qt-faststart
* The qt-faststart program will be built in the tools/ directory. If you
* do not build the program in this manner, correct results are not
@@ -30,29 +30,31 @@
#include <string.h>
#ifdef __MINGW32__
-#define fseeko(x,y,z) fseeko64(x,y,z)
-#define ftello(x) ftello64(x)
+#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) | \
- (((uint8_t*)(x))[2] << 8) | \
+#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) | \
+ (((uint8_t*)(x))[2] << 8) | \
((uint8_t*)(x))[3])
-#define BE_64(x) (((uint64_t)(((uint8_t*)(x))[0]) << 56) | \
- ((uint64_t)(((uint8_t*)(x))[1]) << 48) | \
- ((uint64_t)(((uint8_t*)(x))[2]) << 40) | \
- ((uint64_t)(((uint8_t*)(x))[3]) << 32) | \
- ((uint64_t)(((uint8_t*)(x))[4]) << 24) | \
- ((uint64_t)(((uint8_t*)(x))[5]) << 16) | \
- ((uint64_t)(((uint8_t*)(x))[6]) << 8) | \
- ((uint64_t)((uint8_t*)(x))[7]))
-
-#define BE_FOURCC( ch0, ch1, ch2, ch3 ) \
- ( (uint32_t)(unsigned char)(ch3) | \
- ( (uint32_t)(unsigned char)(ch2) << 8 ) | \
- ( (uint32_t)(unsigned char)(ch1) << 16 ) | \
- ( (uint32_t)(unsigned char)(ch0) << 24 ) )
+
+#define BE_64(x) (((uint64_t)(((uint8_t*)(x))[0]) << 56) | \
+ ((uint64_t)(((uint8_t*)(x))[1]) << 48) | \
+ ((uint64_t)(((uint8_t*)(x))[2]) << 40) | \
+ ((uint64_t)(((uint8_t*)(x))[3]) << 32) | \
+ ((uint64_t)(((uint8_t*)(x))[4]) << 24) | \
+ ((uint64_t)(((uint8_t*)(x))[5]) << 16) | \
+ ((uint64_t)(((uint8_t*)(x))[6]) << 8) | \
+ ((uint64_t)( (uint8_t*)(x))[7]))
+
+#define BE_FOURCC(ch0, ch1, ch2, ch3) \
+ ( (uint32_t)(unsigned char)(ch3) | \
+ ((uint32_t)(unsigned char)(ch2) << 8) | \
+ ((uint32_t)(unsigned char)(ch1) << 16) | \
+ ((uint32_t)(unsigned char)(ch0) << 24) )
#define QT_ATOM BE_FOURCC
/* top level atoms */
@@ -71,16 +73,16 @@
#define STCO_ATOM QT_ATOM('s', 't', 'c', 'o')
#define CO64_ATOM QT_ATOM('c', 'o', '6', '4')
-#define ATOM_PREAMBLE_SIZE 8
-#define COPY_BUFFER_SIZE 1024
+#define ATOM_PREAMBLE_SIZE 8
+#define COPY_BUFFER_SIZE 1024
int main(int argc, char *argv[])
{
FILE *infile = NULL;
FILE *outfile = NULL;
unsigned char atom_bytes[ATOM_PREAMBLE_SIZE];
- uint32_t atom_type = 0;
- uint64_t atom_size = 0;
+ uint32_t atom_type = 0;
+ uint64_t atom_size = 0;
uint64_t atom_offset = 0;
uint64_t last_offset;
unsigned char *moov_atom = NULL;
@@ -95,7 +97,7 @@ int main(int argc, char *argv[])
int bytes_to_copy;
if (argc != 3) {
- printf ("Usage: qt-faststart <infile.mov> <outfile.mov>\n");
+ printf("Usage: qt-faststart <infile.mov> <outfile.mov>\n");
return 0;
}
@@ -116,7 +118,7 @@ int main(int argc, char *argv[])
if (fread(atom_bytes, ATOM_PREAMBLE_SIZE, 1, infile) != 1) {
break;
}
- atom_size = (uint32_t)BE_32(&atom_bytes[0]);
+ atom_size = (uint32_t) BE_32(&atom_bytes[0]);
atom_type = BE_32(&atom_bytes[4]);
/* keep ftyp atom */
@@ -125,8 +127,8 @@ int main(int argc, char *argv[])
free(ftyp_atom);
ftyp_atom = malloc(ftyp_atom_size);
if (!ftyp_atom) {
- printf ("could not allocate %"PRIu64" byte for ftyp atom\n",
- atom_size);
+ printf("could not allocate %"PRIu64" bytes for ftyp atom\n",
+ atom_size);
goto error_out;
}
fseeko(infile, -ATOM_PREAMBLE_SIZE, SEEK_CUR);
@@ -137,17 +139,17 @@ int main(int argc, char *argv[])
start_offset = ftello(infile);
} else {
- /* 64-bit special case */
- if (atom_size == 1) {
- if (fread(atom_bytes, ATOM_PREAMBLE_SIZE, 1, infile) != 1) {
- break;
+ /* 64-bit special case */
+ if (atom_size == 1) {
+ if (fread(atom_bytes, ATOM_PREAMBLE_SIZE, 1, infile) != 1) {
+ break;
+ }
+ atom_size = BE_64(&atom_bytes[0]);
+ fseeko(infile, atom_size - ATOM_PREAMBLE_SIZE * 2, SEEK_CUR);
+ } else {
+ fseeko(infile, atom_size - ATOM_PREAMBLE_SIZE, SEEK_CUR);
}
- atom_size = BE_64(&atom_bytes[0]);
- fseeko(infile, atom_size - ATOM_PREAMBLE_SIZE * 2, SEEK_CUR);
- } else {
- fseeko(infile, atom_size - ATOM_PREAMBLE_SIZE, SEEK_CUR);
}
- }
printf("%c%c%c%c %10"PRIu64" %"PRIu64"\n",
(atom_type >> 24) & 255,
(atom_type >> 16) & 255,
@@ -165,7 +167,7 @@ int main(int argc, char *argv[])
(atom_type != PICT_ATOM) &&
(atom_type != UUID_ATOM) &&
(atom_type != FTYP_ATOM)) {
- printf ("encountered non-QT top-level atom (is this a Quicktime file?)\n");
+ printf("encountered non-QT top-level atom (is this a QuickTime file?)\n");
break;
}
atom_offset += atom_size;
@@ -178,7 +180,7 @@ int main(int argc, char *argv[])
}
if (atom_type != MOOV_ATOM) {
- printf ("last atom in file was not a moov atom\n");
+ printf("last atom in file was not a moov atom\n");
free(ftyp_atom);
fclose(infile);
return 0;
@@ -187,12 +189,11 @@ int main(int argc, char *argv[])
/* moov atom was, in fact, the last atom in the chunk; load the whole
* moov atom */
fseeko(infile, -atom_size, SEEK_END);
- last_offset = ftello(infile);
+ last_offset = ftello(infile);
moov_atom_size = atom_size;
- moov_atom = malloc(moov_atom_size);
+ moov_atom = malloc(moov_atom_size);
if (!moov_atom) {
- printf ("could not allocate %"PRIu64" byte for moov atom\n",
- atom_size);
+ printf("could not allocate %"PRIu64" bytes for moov atom\n", atom_size);
goto error_out;
}
if (fread(moov_atom, atom_size, 1, infile) != 1) {
@@ -203,7 +204,7 @@ int main(int argc, char *argv[])
/* this utility does not support compressed atoms yet, so disqualify
* files with compressed QT atoms */
if (BE_32(&moov_atom[12]) == CMOV_ATOM) {
- printf ("this utility does not support compressed moov atoms yet\n");
+ printf("this utility does not support compressed moov atoms yet\n");
goto error_out;
}
@@ -215,15 +216,15 @@ int main(int argc, char *argv[])
for (i = 4; i < moov_atom_size - 4; i++) {
atom_type = BE_32(&moov_atom[i]);
if (atom_type == STCO_ATOM) {
- printf (" patching stco atom...\n");
+ printf(" patching stco atom...\n");
atom_size = BE_32(&moov_atom[i - 4]);
if (i + atom_size - 4 > moov_atom_size) {
- printf (" bad atom size\n");
+ printf(" bad atom size\n");
goto error_out;
}
offset_count = BE_32(&moov_atom[i + 8]);
for (j = 0; j < offset_count; j++) {
- current_offset = BE_32(&moov_atom[i + 12 + j * 4]);
+ current_offset = BE_32(&moov_atom[i + 12 + j * 4]);
current_offset += moov_atom_size;
moov_atom[i + 12 + j * 4 + 0] = (current_offset >> 24) & 0xFF;
moov_atom[i + 12 + j * 4 + 1] = (current_offset >> 16) & 0xFF;
@@ -232,15 +233,15 @@ int main(int argc, char *argv[])
}
i += atom_size - 4;
} else if (atom_type == CO64_ATOM) {
- printf (" patching co64 atom...\n");
+ printf(" patching co64 atom...\n");
atom_size = BE_32(&moov_atom[i - 4]);
if (i + atom_size - 4 > moov_atom_size) {
- printf (" bad atom size\n");
+ printf(" bad atom size\n");
goto error_out;
}
offset_count = BE_32(&moov_atom[i + 8]);
for (j = 0; j < offset_count; j++) {
- current_offset = BE_64(&moov_atom[i + 12 + j * 8]);
+ current_offset = BE_64(&moov_atom[i + 12 + j * 8]);
current_offset += moov_atom_size;
moov_atom[i + 12 + j * 8 + 0] = (current_offset >> 56) & 0xFF;
moov_atom[i + 12 + j * 8 + 1] = (current_offset >> 48) & 0xFF;
@@ -275,7 +276,7 @@ int main(int argc, char *argv[])
/* dump the same ftyp atom */
if (ftyp_atom_size > 0) {
- printf (" writing ftyp atom...\n");
+ printf(" writing ftyp atom...\n");
if (fwrite(ftyp_atom, ftyp_atom_size, 1, outfile) != 1) {
perror(argv[2]);
goto error_out;
@@ -283,14 +284,14 @@ int main(int argc, char *argv[])
}
/* dump the new moov atom */
- printf (" writing moov atom...\n");
+ printf(" writing moov atom...\n");
if (fwrite(moov_atom, moov_atom_size, 1, outfile) != 1) {
perror(argv[2]);
goto error_out;
}
/* copy the remainder of the infile, from offset 0 -> last_offset - 1 */
- printf (" copying rest of file...\n");
+ printf(" copying rest of file...\n");
while (last_offset) {
if (last_offset > COPY_BUFFER_SIZE)
bytes_to_copy = COPY_BUFFER_SIZE;
@@ -305,7 +306,6 @@ int main(int argc, char *argv[])
perror(argv[2]);
goto error_out;
}
-
last_offset -= bytes_to_copy;
}
diff --git a/tools/trasher.c b/tools/trasher.c
index e099aa30d6..114eb78a68 100644
--- a/tools/trasher.c
+++ b/tools/trasher.c
@@ -1,20 +1,20 @@
/*
* Copyright (c) 2007 Michael Niedermayer
*
- * This file is part of Libav.
+ * This file is part of FFmpeg.
*
- * Libav is free software; you can redistribute it and/or
+ * FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
- * Libav is distributed in the hope that it will be useful,
+ * FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with Libav; if not, write to the Free Software
+ * License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
diff --git a/tools/unwrap-diff b/tools/unwrap-diff
new file mode 100755
index 0000000000..ccea99b7b4
--- /dev/null
+++ b/tools/unwrap-diff
@@ -0,0 +1,2 @@
+#!/bin/sh
+tr '\n' '\001' | sed 's/\x01\x01/\x01 \x01/g' | sed 's/\x01\([^-+ @]\)/ \1/g' | tr '\001' '\n'