early-access version 1432
This commit is contained in:
19
externals/ffmpeg/tools/.gitignore
vendored
Executable file
19
externals/ffmpeg/tools/.gitignore
vendored
Executable file
@@ -0,0 +1,19 @@
|
||||
/aviocat
|
||||
/ffbisect
|
||||
/bisect.need
|
||||
/crypto_bench
|
||||
/cws2fws
|
||||
/fourcc2pixfmt
|
||||
/ffescape
|
||||
/ffeval
|
||||
/ffhash
|
||||
/graph2dot
|
||||
/ismindex
|
||||
/pktdumper
|
||||
/probetest
|
||||
/qt-faststart
|
||||
/sidxindex
|
||||
/trasher
|
||||
/seek_print
|
||||
/uncoded_frame
|
||||
/zmqsend
|
19
externals/ffmpeg/tools/Makefile
vendored
Executable file
19
externals/ffmpeg/tools/Makefile
vendored
Executable file
@@ -0,0 +1,19 @@
|
||||
TOOLS = qt-faststart trasher uncoded_frame
|
||||
TOOLS-$(CONFIG_LIBMYSOFA) += sofa2wavs
|
||||
TOOLS-$(CONFIG_ZLIB) += cws2fws
|
||||
|
||||
tools/target_dec_%_fuzzer.o: tools/target_dec_fuzzer.c
|
||||
$(COMPILE_C) -DFFMPEG_DECODER=$*
|
||||
|
||||
tools/target_bsf_%_fuzzer.o: tools/target_bsf_fuzzer.c
|
||||
$(COMPILE_C) -DFFMPEG_BSF=$*
|
||||
|
||||
tools/target_dem_fuzzer.o: tools/target_dem_fuzzer.c
|
||||
$(COMPILE_C)
|
||||
|
||||
OUTDIRS += tools
|
||||
|
||||
clean::
|
||||
$(RM) $(CLEANSUFFIXES:%=tools/%)
|
||||
|
||||
-include $(wildcard tools/*.d)
|
141
externals/ffmpeg/tools/aviocat.c
vendored
Executable file
141
externals/ffmpeg/tools/aviocat.c
vendored
Executable file
@@ -0,0 +1,141 @@
|
||||
/*
|
||||
* Copyright (c) 2012 Martin Storsjo
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* 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 FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "libavutil/time.h"
|
||||
#include "libavformat/avformat.h"
|
||||
|
||||
static int usage(const char *argv0, int ret)
|
||||
{
|
||||
fprintf(stderr, "%s [-b bytespersec] [-d duration] [-oi <options>] [-oo <options>] [-v] input_url output_url\n", argv0);
|
||||
fprintf(stderr, "<options>: AVOptions expressed as key=value, :-separated\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int bps = 0, duration = 0, verbose = 0, ret, i;
|
||||
const char *input_url = NULL, *output_url = NULL;
|
||||
int64_t stream_pos = 0;
|
||||
int64_t start_time;
|
||||
char errbuf[50];
|
||||
AVIOContext *input, *output;
|
||||
AVDictionary *in_opts = NULL;
|
||||
AVDictionary *out_opts = NULL;
|
||||
|
||||
avformat_network_init();
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (!strcmp(argv[i], "-b") && i + 1 < argc) {
|
||||
bps = atoi(argv[i + 1]);
|
||||
i++;
|
||||
} else if (!strcmp(argv[i], "-d") && i + 1 < argc) {
|
||||
duration = atoi(argv[i + 1]);
|
||||
i++;
|
||||
} else if (!strcmp(argv[i], "-oi") && i + 1 < argc) {
|
||||
if (av_dict_parse_string(&in_opts, argv[i + 1], "=", ":", 0) < 0) {
|
||||
fprintf(stderr, "Cannot parse option string %s\n",
|
||||
argv[i + 1]);
|
||||
return usage(argv[0], 1);
|
||||
}
|
||||
i++;
|
||||
} else if (!strcmp(argv[i], "-oo") && i + 1 < argc) {
|
||||
if (av_dict_parse_string(&out_opts, argv[i + 1], "=", ":", 0) < 0) {
|
||||
fprintf(stderr, "Cannot parse option string %s\n",
|
||||
argv[i + 1]);
|
||||
return usage(argv[0], 1);
|
||||
}
|
||||
i++;
|
||||
} else if (!strcmp(argv[i], "-v")) {
|
||||
verbose = 1;
|
||||
} else if (!input_url) {
|
||||
input_url = argv[i];
|
||||
} else if (!output_url) {
|
||||
output_url = argv[i];
|
||||
} else {
|
||||
return usage(argv[0], 1);
|
||||
}
|
||||
}
|
||||
if (!output_url)
|
||||
return usage(argv[0], 1);
|
||||
|
||||
ret = avio_open2(&input, input_url, AVIO_FLAG_READ, NULL, &in_opts);
|
||||
if (ret) {
|
||||
av_strerror(ret, errbuf, sizeof(errbuf));
|
||||
fprintf(stderr, "Unable to open %s: %s\n", input_url, errbuf);
|
||||
return 1;
|
||||
}
|
||||
if (verbose) {
|
||||
int64_t size = avio_seek(input, 0, AVSEEK_SIZE);
|
||||
if (size >= 0) {
|
||||
fprintf(stderr, "aviocat: input size: %"PRId64"\n", size);
|
||||
} else {
|
||||
fprintf(stderr, "aviocat: input size: unknown\n");
|
||||
}
|
||||
}
|
||||
if (duration && !bps) {
|
||||
int64_t size = avio_size(input);
|
||||
if (size < 0) {
|
||||
av_strerror(ret, errbuf, sizeof(errbuf));
|
||||
fprintf(stderr, "Unable to get size of %s: %s\n", input_url, errbuf);
|
||||
goto fail;
|
||||
}
|
||||
bps = size / duration;
|
||||
}
|
||||
ret = avio_open2(&output, output_url, AVIO_FLAG_WRITE, NULL, &out_opts);
|
||||
if (ret) {
|
||||
av_strerror(ret, errbuf, sizeof(errbuf));
|
||||
fprintf(stderr, "Unable to open %s: %s\n", output_url, errbuf);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
start_time = av_gettime_relative();
|
||||
while (1) {
|
||||
uint8_t buf[1024];
|
||||
int n;
|
||||
n = avio_read(input, buf, sizeof(buf));
|
||||
if (n <= 0)
|
||||
break;
|
||||
avio_write(output, buf, n);
|
||||
if (output->error) {
|
||||
av_strerror(output->error, errbuf, sizeof(errbuf));
|
||||
fprintf(stderr, "Unable to write %s: %s\n", output_url, errbuf);
|
||||
break;
|
||||
}
|
||||
stream_pos += n;
|
||||
if (bps) {
|
||||
avio_flush(output);
|
||||
while ((av_gettime_relative() - start_time) * bps / AV_TIME_BASE < stream_pos)
|
||||
av_usleep(50 * 1000);
|
||||
}
|
||||
}
|
||||
|
||||
avio_flush(output);
|
||||
avio_close(output);
|
||||
|
||||
fail:
|
||||
av_dict_free(&in_opts);
|
||||
av_dict_free(&out_opts);
|
||||
avio_close(input);
|
||||
avformat_network_deinit();
|
||||
return ret ? 1 : 0;
|
||||
}
|
46
externals/ffmpeg/tools/bisect-create
vendored
Executable file
46
externals/ffmpeg/tools/bisect-create
vendored
Executable file
@@ -0,0 +1,46 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
if test "bisect-create" = "`basename $0`" ; then
|
||||
echo tools/ffbisect created
|
||||
git show master:tools/bisect-create > tools/ffbisect
|
||||
chmod u+x tools/ffbisect
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! git show master:tools/bisect-create | diff - tools/ffbisect > /dev/null ; then
|
||||
echo updating tools/ffbisect script to HEAD.
|
||||
git show master:tools/bisect-create > tools/ffbisect
|
||||
chmod u+x tools/ffbisect
|
||||
tools/ffbisect $*
|
||||
exit 0
|
||||
fi
|
||||
|
||||
case "$1" in
|
||||
need)
|
||||
case $2 in
|
||||
ffmpeg|ffplay|ffprobe)
|
||||
echo $2.c >> tools/bisect.need
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
start|reset)
|
||||
echo . > tools/bisect.need
|
||||
git bisect $*
|
||||
;;
|
||||
skip)
|
||||
git bisect $*
|
||||
;;
|
||||
good|bad)
|
||||
git bisect $*
|
||||
|
||||
until ls `cat tools/bisect.need` > /dev/null 2> /dev/null; do
|
||||
git bisect skip || break
|
||||
done
|
||||
;;
|
||||
run)
|
||||
shift # remove "run" from arguments
|
||||
git bisect run sh -c "ls \`cat tools/bisect.need\` > /dev/null 2> /dev/null || exit 125; \"\$@\"" sh "$@"
|
||||
;;
|
||||
esac
|
53
externals/ffmpeg/tools/bookmarklets.html
vendored
Executable file
53
externals/ffmpeg/tools/bookmarklets.html
vendored
Executable file
@@ -0,0 +1,53 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<!--
|
||||
This file is part of FFmpeg.
|
||||
|
||||
All scripts contained in this file can be considered public domain.
|
||||
-->
|
||||
<title>FFmpeg bookmarklets</title>
|
||||
<meta charset="UTF-8">
|
||||
<script type="text/javascript">
|
||||
function convert(js) {
|
||||
js = js.replace(/\/\*.*?\*\//g, ""); /* comments */
|
||||
js = js.replace(/\s+/g, " ");
|
||||
js = js.replace(/\s+\z/, "");
|
||||
js = "(function(){" + js + "})();void 0";
|
||||
return "javascript:" + escape(js);
|
||||
}
|
||||
function init() {
|
||||
var pre = document.getElementsByTagName("pre");
|
||||
for (var i = 0; pre.length > i; i++) {
|
||||
document.getElementById(pre[i].id + "-link").href = convert(pre[i].textContent);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style type="text/css">
|
||||
pre { border: solid black 1px; padding: 0.2ex; font-size: 80% }
|
||||
</style>
|
||||
</head>
|
||||
<body onload="init()">
|
||||
|
||||
<h1>Introduction</h1>
|
||||
<p>The scripts in this page are
|
||||
<a href="http://en.wikipedia.org/wiki/Bookmarklet">bookmarklets</a>: store
|
||||
their link version in a bookmark, and later activate the bookmark on a page
|
||||
to run the script.</p>
|
||||
|
||||
<h1>TED Talks captions</h1>
|
||||
<p><a id="ted_talks_captions-link" href="#">Get links to the captions</a></p>
|
||||
|
||||
<pre id="ted_talks_captions">
|
||||
d = window.open("", "sub", "width=256,height=512,resizable=yes,scrollbars=yes").document;
|
||||
l = document.getElementById("languageCode").getElementsByTagName("option");
|
||||
for (i = 1; i < l.length ; i++) {
|
||||
d.body.appendChild(p = d.createElement("p"));
|
||||
p.appendChild(a = d.createElement("a"));
|
||||
a.appendChild(d.createTextNode(l[i].textContent));
|
||||
a.href="http://www.ted.com/talks/subtitles/id/" + talkID+"/lang/" + l[i].value;
|
||||
}
|
||||
</pre>
|
||||
|
||||
</body>
|
||||
</html>
|
36
externals/ffmpeg/tools/cl2c
vendored
Executable file
36
externals/ffmpeg/tools/cl2c
vendored
Executable file
@@ -0,0 +1,36 @@
|
||||
#!/bin/sh
|
||||
# Convert an OpenCL source file into a C source file containing the
|
||||
# OpenCL source as a C string. Also adds a #line directive so that
|
||||
# compiler messages are useful.
|
||||
|
||||
# This file is part of FFmpeg.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# 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 FFmpeg; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
input="$1"
|
||||
output="$2"
|
||||
|
||||
name=$(basename "$input" | sed 's/.cl$//')
|
||||
|
||||
cat >$output <<EOF
|
||||
// Generated from $input
|
||||
const char *ff_opencl_source_$name =
|
||||
"#line 1 \"$input\"\n"
|
||||
EOF
|
||||
|
||||
# Convert \ to \\ and " to \", then add " to the start and end of the line.
|
||||
cat "$input" | sed 's/\\/\\\\/g;s/\"/\\\"/g;s/^/\"/;s/$/\\n\"/' >>$output
|
||||
|
||||
echo ";" >>$output
|
11
externals/ffmpeg/tools/clean-diff
vendored
Executable file
11
externals/ffmpeg/tools/clean-diff
vendored
Executable file
@@ -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' '<27>' |\
|
||||
sed 's/\(@@[^@]*@@<40>[^@]*\)/\n\1/g' |\
|
||||
egrep -v '@@[^@]*@@<40>(( [^<5E>]*<2A>)|([+-][[:space:]]*<2A>)|(-[[:space:]]*([^<5E>]*)<29>\+[[:space:]]*\5<>))*$' |\
|
||||
tr -d '\n' |\
|
||||
tr '<27>' '\n'
|
79
externals/ffmpeg/tools/coverity.c
vendored
Executable file
79
externals/ffmpeg/tools/coverity.c
vendored
Executable file
@@ -0,0 +1,79 @@
|
||||
/* Coverity Scan model
|
||||
*
|
||||
* Copyright (C) 2014 Red Hat, Inc.
|
||||
*
|
||||
* Authors:
|
||||
* Markus Armbruster <armbru@redhat.com>
|
||||
* Paolo Bonzini <pbonzini@redhat.com>
|
||||
*
|
||||
* This work is licensed under the terms of the GNU GPL, version 2 or, at your
|
||||
* option, any later version. See the COPYING file in the top-level directory.
|
||||
*/
|
||||
/*
|
||||
* This is the source code for our Coverity user model file. The
|
||||
* purpose of user models is to increase scanning accuracy by explaining
|
||||
* code Coverity can't see (out of tree libraries) or doesn't
|
||||
* sufficiently understand. Better accuracy means both fewer false
|
||||
* positives and more true defects. Memory leaks in particular.
|
||||
*
|
||||
* - A model file can't import any header files. Some built-in primitives are
|
||||
* available but not wchar_t, NULL etc.
|
||||
* - Modeling doesn't need full structs and typedefs. Rudimentary structs
|
||||
* and similar types are sufficient.
|
||||
* - An uninitialized local variable signifies that the variable could be
|
||||
* any value.
|
||||
*
|
||||
* The model file must be uploaded by an admin in the analysis settings of
|
||||
* https://scan.coverity.com/projects/54
|
||||
*
|
||||
* above text is based on https://github.com/qemu/qemu/blob/master/scripts/coverity-model.c
|
||||
*/
|
||||
|
||||
#define NULL (void *)0
|
||||
|
||||
// Based on https://scan.coverity.com/models
|
||||
void *av_malloc(size_t size) {
|
||||
int has_memory;
|
||||
__coverity_negative_sink__(size);
|
||||
if (has_memory) {
|
||||
void *ptr = __coverity_alloc__(size);
|
||||
__coverity_mark_as_uninitialized_buffer__(ptr);
|
||||
__coverity_mark_as_afm_allocated__(ptr, "av_free");
|
||||
return ptr;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void *av_mallocz(size_t size) {
|
||||
int has_memory;
|
||||
__coverity_negative_sink__(size);
|
||||
if (has_memory) {
|
||||
void *ptr = __coverity_alloc__(size);
|
||||
__coverity_writeall0__(ptr);
|
||||
__coverity_mark_as_afm_allocated__(ptr, "av_free");
|
||||
return ptr;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void *av_realloc(void *ptr, size_t size) {
|
||||
int has_memory;
|
||||
__coverity_negative_sink__(size);
|
||||
if (has_memory) {
|
||||
__coverity_escape__(ptr);
|
||||
ptr = __coverity_alloc__(size);
|
||||
__coverity_writeall__(ptr);
|
||||
__coverity_mark_as_afm_allocated__(ptr, "av_free");
|
||||
return ptr;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void *av_free(void *ptr) {
|
||||
__coverity_free__(ptr);
|
||||
__coverity_mark_as_afm_freed__(ptr, "av_free");
|
||||
}
|
||||
|
720
externals/ffmpeg/tools/crypto_bench.c
vendored
Executable file
720
externals/ffmpeg/tools/crypto_bench.c
vendored
Executable file
@@ -0,0 +1,720 @@
|
||||
/*
|
||||
* Copyright (c) 2013 Nicolas George
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* 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 FFmpeg; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/* Optional external libraries; can be enabled using:
|
||||
* make VERSUS=crypto+gcrypt+tomcrypt+mbedcrypto tools/crypto_bench */
|
||||
#define USE_crypto 0x01 /* OpenSSL's libcrypto */
|
||||
#define USE_gcrypt 0x02 /* GnuTLS's libgcrypt */
|
||||
#define USE_tomcrypt 0x04 /* LibTomCrypt */
|
||||
#define USE_mbedcrypto 0x08 /* mbed TLS */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "libavutil/avutil.h"
|
||||
#include "libavutil/avstring.h"
|
||||
#include "libavutil/crc.h"
|
||||
#include "libavutil/intreadwrite.h"
|
||||
#include "libavutil/timer.h"
|
||||
|
||||
#ifndef AV_READ_TIME
|
||||
#define AV_READ_TIME(x) 0
|
||||
#endif
|
||||
|
||||
#if HAVE_UNISTD_H
|
||||
#include <unistd.h> /* for getopt */
|
||||
#endif
|
||||
#if !HAVE_GETOPT
|
||||
#include "compat/getopt.c"
|
||||
#endif
|
||||
|
||||
#define MAX_INPUT_SIZE 1048576
|
||||
#define MAX_OUTPUT_SIZE 128
|
||||
|
||||
static const char *enabled_libs;
|
||||
static const char *enabled_algos;
|
||||
static unsigned specified_runs;
|
||||
|
||||
static const uint8_t *hardcoded_key = "FFmpeg is the best program ever.";
|
||||
|
||||
static void fatal_error(const char *tag)
|
||||
{
|
||||
av_log(NULL, AV_LOG_ERROR, "Fatal error: %s\n", tag);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
struct hash_impl {
|
||||
const char *lib;
|
||||
const char *name;
|
||||
void (*run)(uint8_t *output, const uint8_t *input, unsigned size);
|
||||
const char *output;
|
||||
};
|
||||
|
||||
/***************************************************************************
|
||||
* lavu: libavutil
|
||||
***************************************************************************/
|
||||
|
||||
#include "libavutil/md5.h"
|
||||
#include "libavutil/sha.h"
|
||||
#include "libavutil/sha512.h"
|
||||
#include "libavutil/ripemd.h"
|
||||
#include "libavutil/aes.h"
|
||||
#include "libavutil/blowfish.h"
|
||||
#include "libavutil/camellia.h"
|
||||
#include "libavutil/cast5.h"
|
||||
#include "libavutil/des.h"
|
||||
#include "libavutil/twofish.h"
|
||||
#include "libavutil/rc4.h"
|
||||
#include "libavutil/xtea.h"
|
||||
|
||||
#define IMPL_USE_lavu IMPL_USE
|
||||
|
||||
static void run_lavu_md5(uint8_t *output,
|
||||
const uint8_t *input, unsigned size)
|
||||
{
|
||||
av_md5_sum(output, input, size);
|
||||
}
|
||||
|
||||
#define DEFINE_LAVU_MD(suffix, type, namespace, hsize) \
|
||||
static void run_lavu_ ## suffix(uint8_t *output, \
|
||||
const uint8_t *input, unsigned size) \
|
||||
{ \
|
||||
static struct type *h; \
|
||||
if (!h && !(h = av_ ## namespace ## _alloc())) \
|
||||
fatal_error("out of memory"); \
|
||||
av_ ## namespace ## _init(h, hsize); \
|
||||
av_ ## namespace ## _update(h, input, size); \
|
||||
av_ ## namespace ## _final(h, output); \
|
||||
}
|
||||
|
||||
DEFINE_LAVU_MD(sha1, AVSHA, sha, 160);
|
||||
DEFINE_LAVU_MD(sha256, AVSHA, sha, 256);
|
||||
DEFINE_LAVU_MD(sha512, AVSHA512, sha512, 512);
|
||||
DEFINE_LAVU_MD(ripemd128, AVRIPEMD, ripemd, 128);
|
||||
DEFINE_LAVU_MD(ripemd160, AVRIPEMD, ripemd, 160);
|
||||
|
||||
static void run_lavu_aes128(uint8_t *output,
|
||||
const uint8_t *input, unsigned size)
|
||||
{
|
||||
static struct AVAES *aes;
|
||||
if (!aes && !(aes = av_aes_alloc()))
|
||||
fatal_error("out of memory");
|
||||
av_aes_init(aes, hardcoded_key, 128, 0);
|
||||
av_aes_crypt(aes, output, input, size >> 4, NULL, 0);
|
||||
}
|
||||
|
||||
static void run_lavu_blowfish(uint8_t *output,
|
||||
const uint8_t *input, unsigned size)
|
||||
{
|
||||
static struct AVBlowfish *blowfish;
|
||||
if (!blowfish && !(blowfish = av_blowfish_alloc()))
|
||||
fatal_error("out of memory");
|
||||
av_blowfish_init(blowfish, hardcoded_key, 16);
|
||||
av_blowfish_crypt(blowfish, output, input, size >> 3, NULL, 0);
|
||||
}
|
||||
|
||||
static void run_lavu_camellia(uint8_t *output,
|
||||
const uint8_t *input, unsigned size)
|
||||
{
|
||||
static struct AVCAMELLIA *camellia;
|
||||
if (!camellia && !(camellia = av_camellia_alloc()))
|
||||
fatal_error("out of memory");
|
||||
av_camellia_init(camellia, hardcoded_key, 128);
|
||||
av_camellia_crypt(camellia, output, input, size >> 4, NULL, 0);
|
||||
}
|
||||
|
||||
static void run_lavu_cast128(uint8_t *output,
|
||||
const uint8_t *input, unsigned size)
|
||||
{
|
||||
static struct AVCAST5 *cast;
|
||||
if (!cast && !(cast = av_cast5_alloc()))
|
||||
fatal_error("out of memory");
|
||||
av_cast5_init(cast, hardcoded_key, 128);
|
||||
av_cast5_crypt(cast, output, input, size >> 3, 0);
|
||||
}
|
||||
|
||||
static void run_lavu_des(uint8_t *output,
|
||||
const uint8_t *input, unsigned size)
|
||||
{
|
||||
static struct AVDES *des;
|
||||
if (!des && !(des = av_des_alloc()))
|
||||
fatal_error("out of memory");
|
||||
av_des_init(des, hardcoded_key, 64, 0);
|
||||
av_des_crypt(des, output, input, size >> 3, NULL, 0);
|
||||
}
|
||||
|
||||
static void run_lavu_twofish(uint8_t *output,
|
||||
const uint8_t *input, unsigned size)
|
||||
{
|
||||
static struct AVTWOFISH *twofish;
|
||||
if (!twofish && !(twofish = av_twofish_alloc()))
|
||||
fatal_error("out of memory");
|
||||
av_twofish_init(twofish, hardcoded_key, 128);
|
||||
av_twofish_crypt(twofish, output, input, size >> 4, NULL, 0);
|
||||
}
|
||||
|
||||
static void run_lavu_rc4(uint8_t *output,
|
||||
const uint8_t *input, unsigned size)
|
||||
{
|
||||
static struct AVRC4 *rc4;
|
||||
if (!rc4 && !(rc4 = av_rc4_alloc()))
|
||||
fatal_error("out of memory");
|
||||
av_rc4_init(rc4, hardcoded_key, 128, 0);
|
||||
av_rc4_crypt(rc4, output, input, size, NULL, 0);
|
||||
}
|
||||
|
||||
static void run_lavu_xtea(uint8_t *output,
|
||||
const uint8_t *input, unsigned size)
|
||||
{
|
||||
static struct AVXTEA *xtea;
|
||||
if (!xtea && !(xtea = av_xtea_alloc()))
|
||||
fatal_error("out of memory");
|
||||
av_xtea_init(xtea, hardcoded_key);
|
||||
av_xtea_crypt(xtea, output, input, size >> 3, NULL, 0);
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
* crypto: OpenSSL's libcrypto
|
||||
***************************************************************************/
|
||||
|
||||
#if (USE_EXT_LIBS) & USE_crypto
|
||||
|
||||
#define OPENSSL_DISABLE_OLD_DES_SUPPORT
|
||||
#include <openssl/md5.h>
|
||||
#include <openssl/sha.h>
|
||||
#include <openssl/ripemd.h>
|
||||
#include <openssl/aes.h>
|
||||
#include <openssl/blowfish.h>
|
||||
#include <openssl/camellia.h>
|
||||
#include <openssl/cast.h>
|
||||
#include <openssl/des.h>
|
||||
#include <openssl/rc4.h>
|
||||
|
||||
#define DEFINE_CRYPTO_WRAPPER(suffix, function) \
|
||||
static void run_crypto_ ## suffix(uint8_t *output, \
|
||||
const uint8_t *input, unsigned size) \
|
||||
{ \
|
||||
function(input, size, output); \
|
||||
}
|
||||
|
||||
DEFINE_CRYPTO_WRAPPER(md5, MD5)
|
||||
DEFINE_CRYPTO_WRAPPER(sha1, SHA1)
|
||||
DEFINE_CRYPTO_WRAPPER(sha256, SHA256)
|
||||
DEFINE_CRYPTO_WRAPPER(sha512, SHA512)
|
||||
DEFINE_CRYPTO_WRAPPER(ripemd160, RIPEMD160)
|
||||
|
||||
static void run_crypto_aes128(uint8_t *output,
|
||||
const uint8_t *input, unsigned size)
|
||||
{
|
||||
AES_KEY aes;
|
||||
unsigned i;
|
||||
|
||||
AES_set_encrypt_key(hardcoded_key, 128, &aes);
|
||||
size -= 15;
|
||||
for (i = 0; i < size; i += 16)
|
||||
AES_encrypt(input + i, output + i, &aes);
|
||||
}
|
||||
|
||||
static void run_crypto_blowfish(uint8_t *output,
|
||||
const uint8_t *input, unsigned size)
|
||||
{
|
||||
BF_KEY blowfish;
|
||||
unsigned i;
|
||||
|
||||
BF_set_key(&blowfish, 16, hardcoded_key);
|
||||
for (i = 0; i < size; i += 8)
|
||||
BF_ecb_encrypt(input + i, output + i, &blowfish, 1);
|
||||
}
|
||||
|
||||
static void run_crypto_camellia(uint8_t *output,
|
||||
const uint8_t *input, unsigned size)
|
||||
{
|
||||
CAMELLIA_KEY camellia;
|
||||
unsigned i;
|
||||
|
||||
Camellia_set_key(hardcoded_key, 128, &camellia);
|
||||
size -= 15;
|
||||
for (i = 0; i < size; i += 16)
|
||||
Camellia_ecb_encrypt(input + i, output + i, &camellia, 1);
|
||||
}
|
||||
|
||||
static void run_crypto_cast128(uint8_t *output,
|
||||
const uint8_t *input, unsigned size)
|
||||
{
|
||||
CAST_KEY cast;
|
||||
unsigned i;
|
||||
|
||||
CAST_set_key(&cast, 16, hardcoded_key);
|
||||
for (i = 0; i < size; i += 8)
|
||||
CAST_ecb_encrypt(input + i, output + i, &cast, 1);
|
||||
}
|
||||
|
||||
static void run_crypto_des(uint8_t *output,
|
||||
const uint8_t *input, unsigned size)
|
||||
{
|
||||
DES_key_schedule des;
|
||||
unsigned i;
|
||||
|
||||
DES_set_key(hardcoded_key, &des);
|
||||
for (i = 0; i < size; i += 8)
|
||||
DES_ecb_encrypt(input + i, output + i, &des, 1);
|
||||
}
|
||||
|
||||
static void run_crypto_rc4(uint8_t *output,
|
||||
const uint8_t *input, unsigned size)
|
||||
{
|
||||
RC4_KEY rc4;
|
||||
|
||||
RC4_set_key(&rc4, 16, hardcoded_key);
|
||||
RC4(&rc4, size, input, output);
|
||||
}
|
||||
|
||||
#define IMPL_USE_crypto(...) IMPL_USE(__VA_ARGS__)
|
||||
#else
|
||||
#define IMPL_USE_crypto(...) /* ignore */
|
||||
#endif
|
||||
|
||||
/***************************************************************************
|
||||
* gcrypt: GnuTLS's libgcrypt
|
||||
***************************************************************************/
|
||||
|
||||
#if (USE_EXT_LIBS) & USE_gcrypt
|
||||
|
||||
#include <gcrypt.h>
|
||||
|
||||
#define DEFINE_GCRYPT_WRAPPER(suffix, algo) \
|
||||
static void run_gcrypt_ ## suffix(uint8_t *output, \
|
||||
const uint8_t *input, unsigned size) \
|
||||
{ \
|
||||
gcry_md_hash_buffer(GCRY_MD_ ## algo, output, input, size); \
|
||||
}
|
||||
|
||||
DEFINE_GCRYPT_WRAPPER(md5, MD5)
|
||||
DEFINE_GCRYPT_WRAPPER(sha1, SHA1)
|
||||
DEFINE_GCRYPT_WRAPPER(sha256, SHA256)
|
||||
DEFINE_GCRYPT_WRAPPER(sha512, SHA512)
|
||||
DEFINE_GCRYPT_WRAPPER(ripemd160, RMD160)
|
||||
|
||||
#define DEFINE_GCRYPT_CYPHER_WRAPPER(suffix, cypher, mode, sz) \
|
||||
static void run_gcrypt_ ## suffix(uint8_t *output, \
|
||||
const uint8_t *input, unsigned size) \
|
||||
{ \
|
||||
static gcry_cipher_hd_t suffix; \
|
||||
if (!suffix) \
|
||||
gcry_cipher_open(&suffix, GCRY_CIPHER_ ## cypher, GCRY_CIPHER_MODE_ ## mode, 0); \
|
||||
gcry_cipher_setkey(suffix, hardcoded_key, sz); \
|
||||
gcry_cipher_encrypt(suffix, output, size, input, size); \
|
||||
}
|
||||
|
||||
DEFINE_GCRYPT_CYPHER_WRAPPER(aes128, AES128, ECB, 16)
|
||||
DEFINE_GCRYPT_CYPHER_WRAPPER(blowfish, BLOWFISH, ECB, 16)
|
||||
DEFINE_GCRYPT_CYPHER_WRAPPER(camellia, CAMELLIA128, ECB, 16)
|
||||
DEFINE_GCRYPT_CYPHER_WRAPPER(cast128, CAST5, ECB, 16)
|
||||
DEFINE_GCRYPT_CYPHER_WRAPPER(des, DES, ECB, 8)
|
||||
DEFINE_GCRYPT_CYPHER_WRAPPER(twofish, TWOFISH128, ECB, 16)
|
||||
DEFINE_GCRYPT_CYPHER_WRAPPER(rc4, ARCFOUR, STREAM, 16)
|
||||
|
||||
#define IMPL_USE_gcrypt(...) IMPL_USE(__VA_ARGS__)
|
||||
#else
|
||||
#define IMPL_USE_gcrypt(...) /* ignore */
|
||||
#endif
|
||||
|
||||
/***************************************************************************
|
||||
* mbedcrypto: mbed TLS
|
||||
***************************************************************************/
|
||||
|
||||
#if (USE_EXT_LIBS) & USE_mbedcrypto
|
||||
|
||||
#include <mbedtls/aes.h>
|
||||
#include <mbedtls/arc4.h>
|
||||
#include <mbedtls/blowfish.h>
|
||||
#include <mbedtls/camellia.h>
|
||||
#include <mbedtls/des.h>
|
||||
#include <mbedtls/md5.h>
|
||||
#include <mbedtls/ripemd160.h>
|
||||
#include <mbedtls/sha1.h>
|
||||
#include <mbedtls/sha256.h>
|
||||
#include <mbedtls/sha512.h>
|
||||
#include <mbedtls/xtea.h>
|
||||
|
||||
#define DEFINE_MBEDCRYPTO_WRAPPER(suffix) \
|
||||
static void run_mbedcrypto_ ## suffix(uint8_t *output, \
|
||||
const uint8_t *input, unsigned size) \
|
||||
{ \
|
||||
mbedtls_ ## suffix ## _ret(input, size, output); \
|
||||
}
|
||||
|
||||
#define DEFINE_MBEDCRYPTO_WRAPPER_SHA2(suffix) \
|
||||
static void run_mbedcrypto_ ## suffix(uint8_t *output, \
|
||||
const uint8_t *input, unsigned size) \
|
||||
{ \
|
||||
mbedtls_ ## suffix ## _ret(input, size, output, 0); \
|
||||
}
|
||||
|
||||
DEFINE_MBEDCRYPTO_WRAPPER(md5)
|
||||
DEFINE_MBEDCRYPTO_WRAPPER(ripemd160)
|
||||
DEFINE_MBEDCRYPTO_WRAPPER(sha1)
|
||||
DEFINE_MBEDCRYPTO_WRAPPER_SHA2(sha256)
|
||||
DEFINE_MBEDCRYPTO_WRAPPER_SHA2(sha512)
|
||||
|
||||
|
||||
#define DEFINE_MBEDCRYPTO_CYPHER_WRAPPER(suffix, cypher, algo) \
|
||||
static void run_mbedcrypto_ ## suffix(uint8_t *output, \
|
||||
const uint8_t *input, unsigned size) \
|
||||
{ \
|
||||
mbedtls_ ## cypher ## _context cypher; \
|
||||
\
|
||||
mbedtls_ ## cypher ## _init(&cypher); \
|
||||
mbedtls_ ## cypher ## _setkey_enc(&cypher, hardcoded_key, 128); \
|
||||
for (int i = 0; i < size; i += 16) \
|
||||
mbedtls_ ## cypher ## _crypt_ecb(&cypher, MBEDTLS_ ## algo ## _ENCRYPT, \
|
||||
input + i, output + i); \
|
||||
mbedtls_ ## cypher ## _free(&cypher); \
|
||||
}
|
||||
|
||||
DEFINE_MBEDCRYPTO_CYPHER_WRAPPER(aes128, aes, AES)
|
||||
DEFINE_MBEDCRYPTO_CYPHER_WRAPPER(camellia, camellia, CAMELLIA)
|
||||
|
||||
static void run_mbedcrypto_blowfish(uint8_t *output,
|
||||
const uint8_t *input, unsigned size)
|
||||
{
|
||||
mbedtls_blowfish_context blowfish;
|
||||
|
||||
mbedtls_blowfish_init(&blowfish);
|
||||
mbedtls_blowfish_setkey(&blowfish, hardcoded_key, 128);
|
||||
for (int i = 0; i < size; i += 8)
|
||||
mbedtls_blowfish_crypt_ecb(&blowfish, MBEDTLS_BLOWFISH_ENCRYPT,
|
||||
input + i, output + i);
|
||||
mbedtls_blowfish_free(&blowfish);
|
||||
}
|
||||
|
||||
static void run_mbedcrypto_des(uint8_t *output,
|
||||
const uint8_t *input, unsigned size)
|
||||
{
|
||||
mbedtls_des_context des;
|
||||
|
||||
mbedtls_des_init(&des);
|
||||
mbedtls_des_setkey_enc(&des, hardcoded_key);
|
||||
for (int i = 0; i < size; i += 8)
|
||||
mbedtls_des_crypt_ecb(&des, input + i, output + i);
|
||||
mbedtls_des_free(&des);
|
||||
}
|
||||
|
||||
static void run_mbedcrypto_rc4(uint8_t *output,
|
||||
const uint8_t *input, unsigned size)
|
||||
{
|
||||
mbedtls_arc4_context rc4;
|
||||
|
||||
mbedtls_arc4_init(&rc4);
|
||||
mbedtls_arc4_setup(&rc4, hardcoded_key, 16);
|
||||
mbedtls_arc4_crypt(&rc4, size, input, output);
|
||||
mbedtls_arc4_free(&rc4);
|
||||
}
|
||||
|
||||
static void run_mbedcrypto_xtea(uint8_t *output,
|
||||
const uint8_t *input, unsigned size)
|
||||
{
|
||||
mbedtls_xtea_context xtea;
|
||||
|
||||
mbedtls_xtea_init(&xtea);
|
||||
mbedtls_xtea_setup(&xtea, hardcoded_key);
|
||||
for (int i = 0; i < size; i += 8)
|
||||
mbedtls_xtea_crypt_ecb(&xtea, MBEDTLS_XTEA_ENCRYPT,
|
||||
input + i, output + i);
|
||||
mbedtls_xtea_free(&xtea);
|
||||
}
|
||||
|
||||
#define IMPL_USE_mbedcrypto(...) IMPL_USE(__VA_ARGS__)
|
||||
#else
|
||||
#define IMPL_USE_mbedcrypto(...) /* ignore */
|
||||
#endif
|
||||
|
||||
/***************************************************************************
|
||||
* tomcrypt: LibTomCrypt
|
||||
***************************************************************************/
|
||||
|
||||
#if (USE_EXT_LIBS) & USE_tomcrypt
|
||||
|
||||
#include <tomcrypt.h>
|
||||
|
||||
#define DEFINE_TOMCRYPT_WRAPPER(suffix, namespace, algo) \
|
||||
static void run_tomcrypt_ ## suffix(uint8_t *output, \
|
||||
const uint8_t *input, unsigned size) \
|
||||
{ \
|
||||
hash_state md; \
|
||||
namespace ## _init(&md); \
|
||||
namespace ## _process(&md, input, size); \
|
||||
namespace ## _done(&md, output); \
|
||||
}
|
||||
|
||||
DEFINE_TOMCRYPT_WRAPPER(md5, md5, MD5)
|
||||
DEFINE_TOMCRYPT_WRAPPER(sha1, sha1, SHA1)
|
||||
DEFINE_TOMCRYPT_WRAPPER(sha256, sha256, SHA256)
|
||||
DEFINE_TOMCRYPT_WRAPPER(sha512, sha512, SHA512)
|
||||
DEFINE_TOMCRYPT_WRAPPER(ripemd128, rmd128, RIPEMD128)
|
||||
DEFINE_TOMCRYPT_WRAPPER(ripemd160, rmd160, RIPEMD160)
|
||||
|
||||
static void run_tomcrypt_aes128(uint8_t *output,
|
||||
const uint8_t *input, unsigned size)
|
||||
{
|
||||
symmetric_key aes;
|
||||
unsigned i;
|
||||
|
||||
aes_setup(hardcoded_key, 16, 0, &aes);
|
||||
size -= 15;
|
||||
for (i = 0; i < size; i += 16)
|
||||
aes_ecb_encrypt(input + i, output + i, &aes);
|
||||
}
|
||||
|
||||
static void run_tomcrypt_blowfish(uint8_t *output,
|
||||
const uint8_t *input, unsigned size)
|
||||
{
|
||||
symmetric_key blowfish;
|
||||
unsigned i;
|
||||
|
||||
blowfish_setup(hardcoded_key, 16, 0, &blowfish);
|
||||
for (i = 0; i < size; i += 8)
|
||||
blowfish_ecb_encrypt(input + i, output + i, &blowfish);
|
||||
}
|
||||
|
||||
static void run_tomcrypt_camellia(uint8_t *output,
|
||||
const uint8_t *input, unsigned size)
|
||||
{
|
||||
symmetric_key camellia;
|
||||
unsigned i;
|
||||
|
||||
camellia_setup(hardcoded_key, 16, 0, &camellia);
|
||||
size -= 15;
|
||||
for (i = 0; i < size; i += 16)
|
||||
camellia_ecb_encrypt(input + i, output + i, &camellia);
|
||||
}
|
||||
|
||||
static void run_tomcrypt_cast128(uint8_t *output,
|
||||
const uint8_t *input, unsigned size)
|
||||
{
|
||||
symmetric_key cast;
|
||||
unsigned i;
|
||||
|
||||
cast5_setup(hardcoded_key, 16, 0, &cast);
|
||||
for (i = 0; i < size; i += 8)
|
||||
cast5_ecb_encrypt(input + i, output + i, &cast);
|
||||
}
|
||||
|
||||
static void run_tomcrypt_des(uint8_t *output,
|
||||
const uint8_t *input, unsigned size)
|
||||
{
|
||||
symmetric_key des;
|
||||
unsigned i;
|
||||
|
||||
des_setup(hardcoded_key, 8, 0, &des);
|
||||
for (i = 0; i < size; i += 8)
|
||||
des_ecb_encrypt(input + i, output + i, &des);
|
||||
}
|
||||
|
||||
static void run_tomcrypt_rc4(uint8_t *output,
|
||||
const uint8_t *input, unsigned size)
|
||||
{
|
||||
rc4_state rc4;
|
||||
|
||||
rc4_stream_setup(&rc4, hardcoded_key, 16);
|
||||
rc4_stream_crypt(&rc4, input, size, output);
|
||||
rc4_stream_done(&rc4);
|
||||
}
|
||||
|
||||
static void run_tomcrypt_twofish(uint8_t *output,
|
||||
const uint8_t *input, unsigned size)
|
||||
{
|
||||
symmetric_key twofish;
|
||||
unsigned i;
|
||||
|
||||
twofish_setup(hardcoded_key, 16, 0, &twofish);
|
||||
size -= 15;
|
||||
for (i = 0; i < size; i += 16)
|
||||
twofish_ecb_encrypt(input + i, output + i, &twofish);
|
||||
}
|
||||
|
||||
static void run_tomcrypt_xtea(uint8_t *output,
|
||||
const uint8_t *input, unsigned size)
|
||||
{
|
||||
symmetric_key xtea;
|
||||
unsigned i;
|
||||
|
||||
xtea_setup(hardcoded_key, 16, 0, &xtea);
|
||||
for (i = 0; i < size; i += 8)
|
||||
xtea_ecb_encrypt(input + i, output + i, &xtea);
|
||||
}
|
||||
|
||||
|
||||
#define IMPL_USE_tomcrypt(...) IMPL_USE(__VA_ARGS__)
|
||||
#else
|
||||
#define IMPL_USE_tomcrypt(...) /* ignore */
|
||||
#endif
|
||||
|
||||
/***************************************************************************
|
||||
* Driver code
|
||||
***************************************************************************/
|
||||
|
||||
static unsigned crc32(const uint8_t *data, unsigned size)
|
||||
{
|
||||
return av_crc(av_crc_get_table(AV_CRC_32_IEEE), 0, data, size);
|
||||
}
|
||||
|
||||
static void run_implementation(const uint8_t *input, uint8_t *output,
|
||||
struct hash_impl *impl, unsigned size)
|
||||
{
|
||||
uint64_t t0, t1;
|
||||
unsigned nruns = specified_runs ? specified_runs : (1 << 30) / size;
|
||||
unsigned outlen = 0, outcrc = 0;
|
||||
unsigned i, j, val;
|
||||
double mtime, ttime = 0, ttime2 = 0, stime;
|
||||
uint8_t outref[MAX_OUTPUT_SIZE];
|
||||
|
||||
if (enabled_libs && !av_stristr(enabled_libs, impl->lib) ||
|
||||
enabled_algos && !av_stristr(enabled_algos, impl->name))
|
||||
return;
|
||||
if (!sscanf(impl->output, "crc:%x", &outcrc)) {
|
||||
outlen = strlen(impl->output) / 2;
|
||||
for (i = 0; i < outlen; i++) {
|
||||
sscanf(impl->output + i * 2, "%02x", &val);
|
||||
outref[i] = val;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < 8; i++) /* heat caches */
|
||||
impl->run(output, input, size);
|
||||
for (i = 0; i < nruns; i++) {
|
||||
memset(output, 0, size); /* avoid leftovers from previous runs */
|
||||
t0 = AV_READ_TIME();
|
||||
impl->run(output, input, size);
|
||||
t1 = AV_READ_TIME();
|
||||
if (outlen ? memcmp(output, outref, outlen) :
|
||||
crc32(output, size) != outcrc) {
|
||||
fprintf(stderr, "Expected: ");
|
||||
if (outlen)
|
||||
for (j = 0; j < outlen; j++)
|
||||
fprintf(stderr, "%02x", output[j]);
|
||||
else
|
||||
fprintf(stderr, "%08x", crc32(output, size));
|
||||
fprintf(stderr, "\n");
|
||||
fatal_error("output mismatch");
|
||||
}
|
||||
mtime = (double)(t1 - t0) / size;
|
||||
ttime += mtime;
|
||||
ttime2 += mtime * mtime;
|
||||
}
|
||||
|
||||
ttime /= nruns;
|
||||
ttime2 /= nruns;
|
||||
stime = sqrt(ttime2 - ttime * ttime);
|
||||
printf("%-10s %-12s size: %7d runs: %6d time: %8.3f +- %.3f\n",
|
||||
impl->lib, impl->name, size, nruns, ttime, stime);
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
#define IMPL_USE(lib, name, symbol, output) \
|
||||
{ #lib, name, run_ ## lib ## _ ## symbol, output },
|
||||
#define IMPL(lib, ...) IMPL_USE_ ## lib(lib, __VA_ARGS__)
|
||||
#define IMPL_ALL(...) \
|
||||
IMPL(lavu, __VA_ARGS__) \
|
||||
IMPL(crypto, __VA_ARGS__) \
|
||||
IMPL(gcrypt, __VA_ARGS__) \
|
||||
IMPL(mbedcrypto, __VA_ARGS__) \
|
||||
IMPL(tomcrypt, __VA_ARGS__)
|
||||
|
||||
struct hash_impl implementations[] = {
|
||||
IMPL_ALL("MD5", md5, "aa26ff5b895356bcffd9292ba9f89e66")
|
||||
IMPL_ALL("SHA-1", sha1, "1fd8bd1fa02f5b0fe916b0d71750726b096c5744")
|
||||
IMPL_ALL("SHA-256", sha256, "14028ac673b3087e51a1d407fbf0df4deeec8f217119e13b07bf2138f93db8c5")
|
||||
IMPL_ALL("SHA-512", sha512, "3afdd44a80d99af15c87bd724cb717243193767835ce866dd5d58c02d674bb57"
|
||||
"7c25b9e118c200a189fcd5a01ef106a4e200061f3e97dbf50ba065745fd46bef")
|
||||
IMPL(lavu, "RIPEMD-128", ripemd128, "9ab8bfba2ddccc5d99c9d4cdfb844a5f")
|
||||
IMPL(tomcrypt, "RIPEMD-128", ripemd128, "9ab8bfba2ddccc5d99c9d4cdfb844a5f")
|
||||
IMPL_ALL("RIPEMD-160", ripemd160, "62a5321e4fc8784903bb43ab7752c75f8b25af00")
|
||||
IMPL_ALL("AES-128", aes128, "crc:ff6bc888")
|
||||
IMPL_ALL("CAMELLIA", camellia, "crc:7abb59a7")
|
||||
IMPL(lavu, "CAST-128", cast128, "crc:456aa584")
|
||||
IMPL(crypto, "CAST-128", cast128, "crc:456aa584")
|
||||
IMPL(gcrypt, "CAST-128", cast128, "crc:456aa584")
|
||||
IMPL(tomcrypt, "CAST-128", cast128, "crc:456aa584")
|
||||
IMPL_ALL("BLOWFISH", blowfish, "crc:33e8aa74")
|
||||
IMPL_ALL("DES", des, "crc:31291e0b")
|
||||
IMPL(lavu, "TWOFISH", twofish, "crc:9edbd5c1")
|
||||
IMPL(gcrypt, "TWOFISH", twofish, "crc:9edbd5c1")
|
||||
IMPL(tomcrypt, "TWOFISH", twofish, "crc:9edbd5c1")
|
||||
IMPL_ALL("RC4", rc4, "crc:538d37b2")
|
||||
IMPL(lavu, "XTEA", xtea, "crc:931fc270")
|
||||
IMPL(mbedcrypto, "XTEA", xtea, "crc:931fc270")
|
||||
IMPL(tomcrypt, "XTEA", xtea, "crc:931fc270")
|
||||
};
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
uint8_t *input;
|
||||
uint8_t *output;
|
||||
unsigned i, impl, size;
|
||||
int opt;
|
||||
|
||||
while ((opt = getopt(argc, argv, "hl:a:r:")) != -1) {
|
||||
switch (opt) {
|
||||
case 'l':
|
||||
enabled_libs = optarg;
|
||||
break;
|
||||
case 'a':
|
||||
enabled_algos = optarg;
|
||||
break;
|
||||
case 'r':
|
||||
specified_runs = strtol(optarg, NULL, 0);
|
||||
break;
|
||||
case 'h':
|
||||
default:
|
||||
fprintf(stderr, "Usage: %s [-l libs] [-a algos] [-r runs]\n",
|
||||
argv[0]);
|
||||
if ((USE_EXT_LIBS)) {
|
||||
char buf[1024];
|
||||
snprintf(buf, sizeof(buf), "%s%s%s%s",
|
||||
((USE_EXT_LIBS) & USE_crypto) ? "+crypto" : "",
|
||||
((USE_EXT_LIBS) & USE_gcrypt) ? "+gcrypt" : "",
|
||||
((USE_EXT_LIBS) & USE_mbedcrypto) ? "+mbedcrypto" : "",
|
||||
((USE_EXT_LIBS) & USE_tomcrypt) ? "+tomcrypt" : "");
|
||||
fprintf(stderr, "Built with the following external libraries:\n"
|
||||
"make VERSUS=%s\n", buf + 1);
|
||||
} else {
|
||||
fprintf(stderr, "Built without external libraries; use\n"
|
||||
"make VERSUS=crypto+gcrypt+mbedcrypto+tomcrypt tools/crypto_bench\n"
|
||||
"to enable them.\n");
|
||||
}
|
||||
exit(opt != 'h');
|
||||
}
|
||||
}
|
||||
input = av_malloc(MAX_INPUT_SIZE * 2);
|
||||
if (!input)
|
||||
fatal_error("out of memory");
|
||||
for (i = 0; i < MAX_INPUT_SIZE; i += 4)
|
||||
AV_WB32(input + i, i);
|
||||
|
||||
output = input + MAX_INPUT_SIZE;
|
||||
|
||||
size = MAX_INPUT_SIZE;
|
||||
for (impl = 0; impl < FF_ARRAY_ELEMS(implementations); impl++)
|
||||
run_implementation(input, output, &implementations[impl], size);
|
||||
|
||||
av_free(input);
|
||||
|
||||
return 0;
|
||||
}
|
148
externals/ffmpeg/tools/cws2fws.c
vendored
Executable file
148
externals/ffmpeg/tools/cws2fws.c
vendored
Executable file
@@ -0,0 +1,148 @@
|
||||
/*
|
||||
* cws2fws by Alex Beregszaszi
|
||||
* This file is placed in the public domain.
|
||||
* Use the program however you see fit.
|
||||
*
|
||||
* This utility converts compressed Macromedia Flash files to uncompressed ones.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#if HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#if HAVE_IO_H
|
||||
#include <io.h>
|
||||
#endif
|
||||
#include <zlib.h>
|
||||
|
||||
#ifdef DEBUG
|
||||
#define dbgprintf printf
|
||||
#else
|
||||
#define dbgprintf(...) do { if (0) printf(__VA_ARGS__); } while (0)
|
||||
#endif
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int fd_in, fd_out, comp_len, uncomp_len, i, last_out;
|
||||
char buf_in[1024], buf_out[65536];
|
||||
z_stream zstream;
|
||||
struct stat statbuf;
|
||||
int ret = 1;
|
||||
|
||||
if (argc < 3) {
|
||||
printf("Usage: %s <infile.swf> <outfile.swf>\n", argv[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
fd_in = open(argv[1], O_RDONLY);
|
||||
if (fd_in < 0) {
|
||||
perror("Error opening input file");
|
||||
return 1;
|
||||
}
|
||||
|
||||
fd_out = open(argv[2], O_WRONLY | O_CREAT, 00644);
|
||||
if (fd_out < 0) {
|
||||
perror("Error opening output file");
|
||||
close(fd_in);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (read(fd_in, &buf_in, 8) != 8) {
|
||||
printf("Header error\n");
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (buf_in[0] != 'C' || buf_in[1] != 'W' || buf_in[2] != 'S') {
|
||||
printf("Not a compressed flash file\n");
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (fstat(fd_in, &statbuf) < 0) {
|
||||
perror("fstat failed");
|
||||
return 1;
|
||||
}
|
||||
comp_len = statbuf.st_size;
|
||||
uncomp_len = buf_in[4] | (buf_in[5] << 8) | (buf_in[6] << 16) | (buf_in[7] << 24);
|
||||
|
||||
printf("Compressed size: %d Uncompressed size: %d\n",
|
||||
comp_len - 4, uncomp_len - 4);
|
||||
|
||||
// write out modified header
|
||||
buf_in[0] = 'F';
|
||||
if (write(fd_out, &buf_in, 8) < 8) {
|
||||
perror("Error writing output file");
|
||||
goto out;
|
||||
}
|
||||
|
||||
zstream.zalloc = NULL;
|
||||
zstream.zfree = NULL;
|
||||
zstream.opaque = NULL;
|
||||
if (inflateInit(&zstream) != Z_OK) {
|
||||
fprintf(stderr, "inflateInit failed\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
for (i = 0; i < comp_len - 8;) {
|
||||
int ret, len = read(fd_in, &buf_in, 1024);
|
||||
|
||||
dbgprintf("read %d bytes\n", len);
|
||||
|
||||
last_out = zstream.total_out;
|
||||
|
||||
zstream.next_in = &buf_in[0];
|
||||
zstream.avail_in = len;
|
||||
zstream.next_out = &buf_out[0];
|
||||
zstream.avail_out = 65536;
|
||||
|
||||
ret = inflate(&zstream, Z_SYNC_FLUSH);
|
||||
if (ret != Z_STREAM_END && ret != Z_OK) {
|
||||
printf("Error while decompressing: %d\n", ret);
|
||||
inflateEnd(&zstream);
|
||||
goto out;
|
||||
}
|
||||
|
||||
dbgprintf("a_in: %d t_in: %lu a_out: %d t_out: %lu -- %lu out\n",
|
||||
zstream.avail_in, zstream.total_in, zstream.avail_out,
|
||||
zstream.total_out, zstream.total_out - last_out);
|
||||
|
||||
if (write(fd_out, &buf_out, zstream.total_out - last_out) <
|
||||
zstream.total_out - last_out) {
|
||||
perror("Error writing output file");
|
||||
inflateEnd(&zstream);
|
||||
goto out;
|
||||
}
|
||||
|
||||
i += len;
|
||||
|
||||
if (ret == Z_STREAM_END || ret == Z_BUF_ERROR)
|
||||
break;
|
||||
}
|
||||
|
||||
if (zstream.total_out != uncomp_len - 8) {
|
||||
printf("Size mismatch (%lu != %d), updating header...\n",
|
||||
zstream.total_out, uncomp_len - 8);
|
||||
|
||||
buf_in[0] = (zstream.total_out + 8) & 0xff;
|
||||
buf_in[1] = ((zstream.total_out + 8) >> 8) & 0xff;
|
||||
buf_in[2] = ((zstream.total_out + 8) >> 16) & 0xff;
|
||||
buf_in[3] = ((zstream.total_out + 8) >> 24) & 0xff;
|
||||
|
||||
if ( lseek(fd_out, 4, SEEK_SET) < 0
|
||||
|| write(fd_out, &buf_in, 4) < 4) {
|
||||
perror("Error writing output file");
|
||||
inflateEnd(&zstream);
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
inflateEnd(&zstream);
|
||||
out:
|
||||
close(fd_in);
|
||||
close(fd_out);
|
||||
return ret;
|
||||
}
|
127
externals/ffmpeg/tools/dvd2concat
vendored
Executable file
127
externals/ffmpeg/tools/dvd2concat
vendored
Executable file
@@ -0,0 +1,127 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
# Copyright (c) 2014 Nicolas George
|
||||
#
|
||||
# This file is part of FFmpeg.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# 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 FFmpeg; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
=head1 NAME
|
||||
|
||||
dvd2concat - create a concat script for a DVD title
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
tools/dvd2concat I<path/to/dvd/structure> > I<file.concat>
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
This script uses B<lsdvd> to produce concat script for a DVD title.
|
||||
The resulting script can be used to play the DVD using B<ffplay>, to
|
||||
transcode it using B<ffmpeg> or any other similar use.
|
||||
|
||||
I<path/to/dvd/structure> is the path to the DVD structure hierarchy; it
|
||||
normally contains a directory named B<VIDEO_TS>. It must not be encrypted
|
||||
with CSS.
|
||||
|
||||
I<file.concat> is the output file. It can be used as an input to ffmpeg.
|
||||
It will require the B<-safe 0> option.
|
||||
|
||||
=cut
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Getopt::Long ":config" => "require_order";
|
||||
use Pod::Usage;
|
||||
|
||||
my $title;
|
||||
|
||||
GetOptions (
|
||||
"help|usage|?|h" => sub { pod2usage({ -verbose => 1, -exitval => 0 }) },
|
||||
"manpage|m" => sub { pod2usage({ -verbose => 2, -exitval => 0 }) },
|
||||
"title|t=i" => \$title,
|
||||
) and @ARGV == 1 or pod2usage({ -verbose => 1, -exitval => 1 });
|
||||
my ($path) = @ARGV;
|
||||
|
||||
my $lsdvd_message =
|
||||
"Make sure your lsdvd version has the two following patches applied:\n" .
|
||||
"http://sourceforge.net/p/lsdvd/feature-requests/1/\n" .
|
||||
"https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=603826\n";
|
||||
|
||||
my $lsdvd = do {
|
||||
open my $l, "-|", "lsdvd", "-Op", "-x", $path
|
||||
or die "You need to install lsdvd for this script to work.\n$lsdvd_message";
|
||||
local $/;
|
||||
<$l>;
|
||||
};
|
||||
my %lsdvd = eval $lsdvd;
|
||||
die $@ if $@;
|
||||
|
||||
if (!defined $title) {
|
||||
$title = $lsdvd{longest_track};
|
||||
warn "Using longest title $title\n";
|
||||
}
|
||||
my $track = $lsdvd{track}[$title - 1]
|
||||
or die "Title $title does not exist (1-", scalar(@{$lsdvd{track}}), ")\n";
|
||||
my $vts_base = sprintf "%s/VIDEO_TS/VTS_%02d_", $path, $track->{vts};
|
||||
my @frag;
|
||||
for my $i (1 .. 9) {
|
||||
my $file = sprintf "%s%d.VOB", $vts_base, $i;
|
||||
my $size = -s $file or last;
|
||||
push @frag, { file => $file, size => $size >> 11 };
|
||||
}
|
||||
|
||||
my $concat = "ffconcat version 1.0\n";
|
||||
$concat .= "\nstream\nexact_stream_id 0x1E0\n";
|
||||
for my $audio (@{$track->{audio}}) {
|
||||
$concat .= "\nstream\nexact_stream_id " . $audio->{streamid} . "\n";
|
||||
}
|
||||
for my $subp (@{$track->{subp}}) {
|
||||
$concat .= "\nstream\nexact_stream_id " . $subp->{streamid} . "\n";
|
||||
}
|
||||
for my $cell (@{$track->{cell}}) {
|
||||
my $off = $cell->{first_sector};
|
||||
die "Your lsdvd version does not print cell sectors.\n$lsdvd_message"
|
||||
unless defined $off;
|
||||
my $size = $cell->{last_sector} + 1 - $cell->{first_sector};
|
||||
|
||||
my $frag = 0;
|
||||
while ($frag < @frag) {
|
||||
last if $off < $frag[$frag]->{size};
|
||||
$off -= $frag[$frag++]->{size};
|
||||
}
|
||||
die "Cell beyond VOB data\n" unless $frag < @frag;
|
||||
my $cur_off = $off;
|
||||
my $cur_size = $size;
|
||||
my @files;
|
||||
while ($cur_size > $frag[$frag]->{size} - $cur_off) {
|
||||
push @files, $frag[$frag]->{file};
|
||||
$cur_size -= $frag[$frag]->{size} - $cur_off;
|
||||
$cur_off = 0;
|
||||
die "Cell end beyond VOB data\n" unless ++$frag < @frag;
|
||||
}
|
||||
push @files, $frag[$frag]->{file};
|
||||
my $file = @files == 1 ? $files[0] : "concat:" . join("|", @files);
|
||||
my $start = $off << 11;
|
||||
my $end = ($off + $size) << 11;
|
||||
$file = "subfile,,start,${start},end,${end},,:$file";
|
||||
|
||||
my $dur = int(1000 * $cell->{length});
|
||||
$concat .= sprintf "\nfile '%s'\nduration %02d:%02d:%02d.%03d\n", $file,
|
||||
int($dur / 3600000), int($dur / 60000) % 60, int($dur / 1000) % 60,
|
||||
$dur % 1000;
|
||||
}
|
||||
|
||||
print $concat;
|
144
externals/ffmpeg/tools/enum_options.c
vendored
Executable file
144
externals/ffmpeg/tools/enum_options.c
vendored
Executable file
@@ -0,0 +1,144 @@
|
||||
/*
|
||||
* Copyright (c) 2011 Anton Khirnov
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* 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 FFmpeg; 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)
|
||||
{
|
||||
const AVInputFormat *iformat = NULL;
|
||||
const AVOutputFormat *oformat = NULL;
|
||||
void *iformat_opaque = NULL;
|
||||
void *oformat_opaque = NULL;
|
||||
|
||||
printf("@section Generic format AVOptions\n");
|
||||
show_opts(avformat_get_class());
|
||||
|
||||
printf("@section Format-specific AVOptions\n");
|
||||
while ((iformat = av_demuxer_iterate(&iformat_opaque))) {
|
||||
if (!iformat->priv_class)
|
||||
continue;
|
||||
printf("@subsection %s AVOptions\n", iformat->priv_class->class_name);
|
||||
show_opts(iformat->priv_class);
|
||||
}
|
||||
while ((oformat = av_muxer_iterate(&oformat_opaque))) {
|
||||
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)
|
||||
{
|
||||
void *iter = NULL;
|
||||
AVCodec *c = NULL;
|
||||
|
||||
printf("@section Generic codec AVOptions\n");
|
||||
show_opts(avcodec_get_class());
|
||||
|
||||
printf("@section Codec-specific AVOptions\n");
|
||||
while ((c = av_codec_iterate(&iter))) {
|
||||
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();
|
||||
|
||||
if (!strcmp(argv[1], "format"))
|
||||
show_format_opts();
|
||||
else if (!strcmp(argv[1], "codec"))
|
||||
show_codec_opts();
|
||||
else
|
||||
print_usage();
|
||||
|
||||
return 0;
|
||||
}
|
180
externals/ffmpeg/tools/ffescape.c
vendored
Executable file
180
externals/ffmpeg/tools/ffescape.c
vendored
Executable file
@@ -0,0 +1,180 @@
|
||||
/*
|
||||
* Copyright (c) 2012 Stefano Sabatini
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* 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 FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#if HAVE_UNISTD_H
|
||||
#include <unistd.h> /* getopt */
|
||||
#endif
|
||||
|
||||
#include "libavutil/log.h"
|
||||
#include "libavutil/bprint.h"
|
||||
|
||||
#if !HAVE_GETOPT
|
||||
#include "compat/getopt.c"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @file
|
||||
* escaping utility
|
||||
*/
|
||||
|
||||
static void usage(void)
|
||||
{
|
||||
printf("Escape an input string, adopting the av_get_token() escaping logic\n");
|
||||
printf("usage: ffescape [OPTIONS]\n");
|
||||
printf("\n"
|
||||
"Options:\n"
|
||||
"-e echo each input line on output\n"
|
||||
"-f flag select an escape flag, can assume the values 'whitespace' and 'strict'\n"
|
||||
"-h print this help\n"
|
||||
"-i INFILE set INFILE as input file, stdin if omitted\n"
|
||||
"-l LEVEL set the number of escaping levels, 1 if omitted\n"
|
||||
"-m ESCAPE_MODE select escape mode between 'auto', 'backslash', 'quote'\n"
|
||||
"-o OUTFILE set OUTFILE as output file, stdout if omitted\n"
|
||||
"-p PROMPT set output prompt, is '=> ' by default\n"
|
||||
"-s SPECIAL_CHARS set the list of special characters\n");
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
AVBPrint src;
|
||||
char *src_buf, *dst_buf;
|
||||
const char *outfilename = NULL, *infilename = NULL;
|
||||
FILE *outfile = NULL, *infile = NULL;
|
||||
const char *prompt = "=> ";
|
||||
enum AVEscapeMode escape_mode = AV_ESCAPE_MODE_AUTO;
|
||||
int escape_flags = 0;
|
||||
int level = 1;
|
||||
int echo = 0;
|
||||
char *special_chars = NULL;
|
||||
int c;
|
||||
|
||||
while ((c = getopt(argc, argv, "ef:hi:l:o:m:p:s:")) != -1) {
|
||||
switch (c) {
|
||||
case 'e':
|
||||
echo = 1;
|
||||
break;
|
||||
case 'h':
|
||||
usage();
|
||||
return 0;
|
||||
case 'i':
|
||||
infilename = optarg;
|
||||
break;
|
||||
case 'f':
|
||||
if (!strcmp(optarg, "whitespace")) escape_flags |= AV_ESCAPE_FLAG_WHITESPACE;
|
||||
else if (!strcmp(optarg, "strict")) escape_flags |= AV_ESCAPE_FLAG_STRICT;
|
||||
else {
|
||||
av_log(NULL, AV_LOG_ERROR,
|
||||
"Invalid value '%s' for option -f, "
|
||||
"valid arguments are 'whitespace', and 'strict'\n", optarg);
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
case 'l':
|
||||
{
|
||||
char *tail;
|
||||
long int li = strtol(optarg, &tail, 10);
|
||||
if (*tail || li > INT_MAX || li < 0) {
|
||||
av_log(NULL, AV_LOG_ERROR,
|
||||
"Invalid value '%s' for option -l, argument must be a non negative integer\n",
|
||||
optarg);
|
||||
return 1;
|
||||
}
|
||||
level = li;
|
||||
break;
|
||||
}
|
||||
case 'm':
|
||||
if (!strcmp(optarg, "auto")) escape_mode = AV_ESCAPE_MODE_AUTO;
|
||||
else if (!strcmp(optarg, "backslash")) escape_mode = AV_ESCAPE_MODE_BACKSLASH;
|
||||
else if (!strcmp(optarg, "quote")) escape_mode = AV_ESCAPE_MODE_QUOTE;
|
||||
else {
|
||||
av_log(NULL, AV_LOG_ERROR,
|
||||
"Invalid value '%s' for option -m, "
|
||||
"valid arguments are 'backslash', and 'quote'\n", optarg);
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
case 'o':
|
||||
outfilename = optarg;
|
||||
break;
|
||||
case 'p':
|
||||
prompt = optarg;
|
||||
break;
|
||||
case 's':
|
||||
special_chars = optarg;
|
||||
break;
|
||||
case '?':
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (!infilename || !strcmp(infilename, "-")) {
|
||||
infilename = "stdin";
|
||||
infile = stdin;
|
||||
} else {
|
||||
infile = fopen(infilename, "r");
|
||||
}
|
||||
if (!infile) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Impossible to open input file '%s': %s\n", infilename, strerror(errno));
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!outfilename || !strcmp(outfilename, "-")) {
|
||||
outfilename = "stdout";
|
||||
outfile = stdout;
|
||||
} else {
|
||||
outfile = fopen(outfilename, "w");
|
||||
}
|
||||
if (!outfile) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Impossible to open output file '%s': %s\n", outfilename, strerror(errno));
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* grab the input and store it in src */
|
||||
av_bprint_init(&src, 1, AV_BPRINT_SIZE_UNLIMITED);
|
||||
while ((c = fgetc(infile)) != EOF)
|
||||
av_bprint_chars(&src, c, 1);
|
||||
av_bprint_chars(&src, 0, 1);
|
||||
|
||||
if (!av_bprint_is_complete(&src)) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Could not allocate a buffer for the source string\n");
|
||||
av_bprint_finalize(&src, NULL);
|
||||
return 1;
|
||||
}
|
||||
av_bprint_finalize(&src, &src_buf);
|
||||
|
||||
if (echo)
|
||||
fprintf(outfile, "%s", src_buf);
|
||||
|
||||
/* escape */
|
||||
dst_buf = src_buf;
|
||||
while (level--) {
|
||||
if (av_escape(&dst_buf, src_buf, special_chars, escape_mode, escape_flags) < 0) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Could not escape string\n");
|
||||
return 1;
|
||||
}
|
||||
av_free(src_buf);
|
||||
src_buf = dst_buf;
|
||||
}
|
||||
|
||||
fprintf(outfile, "%s%s", prompt, dst_buf);
|
||||
av_free(dst_buf);
|
||||
return 0;
|
||||
}
|
139
externals/ffmpeg/tools/ffeval.c
vendored
Executable file
139
externals/ffmpeg/tools/ffeval.c
vendored
Executable file
@@ -0,0 +1,139 @@
|
||||
/*
|
||||
* Copyright (c) 2012 Stefano Sabatini
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* 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 FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#if HAVE_UNISTD_H
|
||||
#include <unistd.h> /* getopt */
|
||||
#endif
|
||||
|
||||
#include "libavutil/eval.h"
|
||||
#include "libavutil/mem.h"
|
||||
|
||||
#if !HAVE_GETOPT
|
||||
#include "compat/getopt.c"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @file
|
||||
* simple arithmetic expression evaluator
|
||||
*/
|
||||
|
||||
static void usage(void)
|
||||
{
|
||||
printf("Simple expression evalutor, please *don't* turn me to a feature-complete language interpreter\n");
|
||||
printf("usage: ffeval [OPTIONS]\n");
|
||||
printf("\n"
|
||||
"Options:\n"
|
||||
"-e echo each input line on output\n"
|
||||
"-h print this help\n"
|
||||
"-i INFILE set INFILE as input file, stdin if omitted\n"
|
||||
"-o OUTFILE set OUTFILE as output file, stdout if omitted\n"
|
||||
"-p PROMPT set output prompt\n");
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int buf_size = 0;
|
||||
char *buf = NULL;
|
||||
const char *outfilename = NULL, *infilename = NULL;
|
||||
FILE *outfile = NULL, *infile = NULL;
|
||||
const char *prompt = "=> ";
|
||||
int count = 0, echo = 0;
|
||||
int c;
|
||||
|
||||
#define GROW_ARRAY() \
|
||||
do { \
|
||||
if (!av_dynarray2_add((void **)&buf, &buf_size, 1, NULL)) { \
|
||||
av_log(NULL, AV_LOG_ERROR, \
|
||||
"Memory allocation problem occurred\n"); \
|
||||
return 1; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
GROW_ARRAY();
|
||||
while ((c = getopt(argc, argv, "ehi:o:p:")) != -1) {
|
||||
switch (c) {
|
||||
case 'e':
|
||||
echo = 1;
|
||||
break;
|
||||
case 'h':
|
||||
usage();
|
||||
return 0;
|
||||
case 'i':
|
||||
infilename = optarg;
|
||||
break;
|
||||
case 'o':
|
||||
outfilename = optarg;
|
||||
break;
|
||||
case 'p':
|
||||
prompt = optarg;
|
||||
break;
|
||||
case '?':
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (!infilename || !strcmp(infilename, "-")) {
|
||||
infilename = "stdin";
|
||||
infile = stdin;
|
||||
} else {
|
||||
infile = fopen(infilename, "r");
|
||||
}
|
||||
if (!infile) {
|
||||
fprintf(stderr, "Impossible to open input file '%s': %s\n", infilename, strerror(errno));
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!outfilename || !strcmp(outfilename, "-")) {
|
||||
outfilename = "stdout";
|
||||
outfile = stdout;
|
||||
} else {
|
||||
outfile = fopen(outfilename, "w");
|
||||
}
|
||||
if (!outfile) {
|
||||
fprintf(stderr, "Impossible to open output file '%s': %s\n", outfilename, strerror(errno));
|
||||
return 1;
|
||||
}
|
||||
|
||||
while ((c = fgetc(infile)) != EOF) {
|
||||
if (c == '\n') {
|
||||
double d;
|
||||
|
||||
buf[count] = 0;
|
||||
if (buf[0] != '#') {
|
||||
int ret = av_expr_parse_and_eval(&d, buf,
|
||||
NULL, NULL,
|
||||
NULL, NULL, NULL, NULL, NULL, 0, NULL);
|
||||
if (echo)
|
||||
fprintf(outfile, "%s ", buf);
|
||||
if (ret >= 0) fprintf(outfile, "%s%f\n", prompt, d);
|
||||
else fprintf(outfile, "%s%f (%s)\n", prompt, d, av_err2str(ret));
|
||||
}
|
||||
count = 0;
|
||||
} else {
|
||||
if (count >= buf_size-1)
|
||||
GROW_ARRAY();
|
||||
buf[count++] = c;
|
||||
}
|
||||
}
|
||||
|
||||
av_free(buf);
|
||||
return 0;
|
||||
}
|
152
externals/ffmpeg/tools/ffhash.c
vendored
Executable file
152
externals/ffmpeg/tools/ffhash.c
vendored
Executable file
@@ -0,0 +1,152 @@
|
||||
/*
|
||||
* Copyright (c) 2002 Fabrice Bellard
|
||||
* Copyright (c) 2013 Michael Niedermayer
|
||||
* Copyright (c) 2013 James Almer
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* 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 FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "libavutil/avstring.h"
|
||||
#include "libavutil/error.h"
|
||||
#include "libavutil/hash.h"
|
||||
#include "libavutil/mem.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#if HAVE_IO_H
|
||||
#include <io.h>
|
||||
#endif
|
||||
#if HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#define SIZE 65536
|
||||
|
||||
static struct AVHashContext *hash;
|
||||
static int out_b64;
|
||||
|
||||
static void usage(void)
|
||||
{
|
||||
int i = 0;
|
||||
const char *name;
|
||||
|
||||
printf("usage: ffhash [b64:]algorithm [input]...\n");
|
||||
printf("Supported hash algorithms:");
|
||||
do {
|
||||
name = av_hash_names(i);
|
||||
if (name)
|
||||
printf(" %s", name);
|
||||
i++;
|
||||
} while(name);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
static void finish(void)
|
||||
{
|
||||
char res[2 * AV_HASH_MAX_SIZE + 4];
|
||||
|
||||
printf("%s=", av_hash_get_name(hash));
|
||||
if (out_b64) {
|
||||
av_hash_final_b64(hash, res, sizeof(res));
|
||||
printf("b64:%s", res);
|
||||
} else {
|
||||
av_hash_final_hex(hash, res, sizeof(res));
|
||||
printf("0x%s", res);
|
||||
}
|
||||
}
|
||||
|
||||
static int check(char *file)
|
||||
{
|
||||
uint8_t buffer[SIZE];
|
||||
int fd, flags = O_RDONLY;
|
||||
int ret = 0;
|
||||
|
||||
#ifdef O_BINARY
|
||||
flags |= O_BINARY;
|
||||
#endif
|
||||
if (file) fd = open(file, flags);
|
||||
else fd = 0;
|
||||
if (fd == -1) {
|
||||
printf("%s=OPEN-FAILED: %s:", av_hash_get_name(hash), strerror(errno));
|
||||
ret = 1;
|
||||
goto end;
|
||||
}
|
||||
|
||||
av_hash_init(hash);
|
||||
for (;;) {
|
||||
int size = read(fd, buffer, SIZE);
|
||||
if (size < 0) {
|
||||
int err = errno;
|
||||
close(fd);
|
||||
finish();
|
||||
printf("+READ-FAILED: %s", strerror(err));
|
||||
ret = 2;
|
||||
goto end;
|
||||
} else if(!size)
|
||||
break;
|
||||
av_hash_update(hash, buffer, size);
|
||||
}
|
||||
close(fd);
|
||||
|
||||
finish();
|
||||
end:
|
||||
if (file)
|
||||
printf(" *%s", file);
|
||||
printf("\n");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
int ret = 0;
|
||||
const char *hash_name;
|
||||
|
||||
if (argc == 1) {
|
||||
usage();
|
||||
return 0;
|
||||
}
|
||||
|
||||
hash_name = argv[1];
|
||||
out_b64 = av_strstart(hash_name, "b64:", &hash_name);
|
||||
if ((ret = av_hash_alloc(&hash, hash_name)) < 0) {
|
||||
switch(ret) {
|
||||
case AVERROR(EINVAL):
|
||||
printf("Invalid hash type: %s\n", hash_name);
|
||||
break;
|
||||
case AVERROR(ENOMEM):
|
||||
printf("%s\n", strerror(errno));
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
for (i = 2; i < argc; i++)
|
||||
ret |= check(argv[i]);
|
||||
|
||||
if (argc < 3)
|
||||
ret |= check(NULL);
|
||||
|
||||
av_hash_freep(&hash);
|
||||
|
||||
return ret;
|
||||
}
|
117
externals/ffmpeg/tools/fourcc2pixfmt.c
vendored
Executable file
117
externals/ffmpeg/tools/fourcc2pixfmt.c
vendored
Executable file
@@ -0,0 +1,117 @@
|
||||
/*
|
||||
* Copyright (c) 2012 Stefano Sabatini
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* 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 FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#if HAVE_UNISTD_H
|
||||
#include <unistd.h> /* getopt */
|
||||
#endif
|
||||
|
||||
#include "libavutil/pixdesc.h"
|
||||
#include "libavcodec/avcodec.h"
|
||||
#include "libavutil/common.h"
|
||||
#include "libavcodec/raw.h"
|
||||
|
||||
#undef printf
|
||||
#undef fprintf
|
||||
|
||||
#if !HAVE_GETOPT
|
||||
#include "compat/getopt.c"
|
||||
#endif
|
||||
|
||||
static void usage(void)
|
||||
{
|
||||
printf("Show the relationships between rawvideo pixel formats and FourCC tags.\n");
|
||||
printf("usage: fourcc2pixfmt [OPTIONS]\n");
|
||||
printf("\n"
|
||||
"Options:\n"
|
||||
"-l list the pixel format for each fourcc\n"
|
||||
"-L list the fourccs for each pixel format\n"
|
||||
"-p PIX_FMT given a pixel format, print the list of associated fourccs (one per line)\n"
|
||||
"-h print this help\n");
|
||||
}
|
||||
|
||||
static void print_pix_fmt_fourccs(enum AVPixelFormat pix_fmt, const PixelFormatTag *pix_fmt_tags, char sep)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; pix_fmt_tags[i].pix_fmt != AV_PIX_FMT_NONE; i++)
|
||||
if (pix_fmt_tags[i].pix_fmt == pix_fmt)
|
||||
printf("%s%c", av_fourcc2str(pix_fmt_tags[i].fourcc), sep);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int i, list_fourcc_pix_fmt = 0, list_pix_fmt_fourccs = 0;
|
||||
const PixelFormatTag *pix_fmt_tags = avpriv_get_raw_pix_fmt_tags();
|
||||
const char *pix_fmt_name = NULL;
|
||||
char c;
|
||||
|
||||
if (argc == 1) {
|
||||
usage();
|
||||
return 0;
|
||||
}
|
||||
|
||||
while ((c = getopt(argc, argv, "hp:lL")) != -1) {
|
||||
switch (c) {
|
||||
case 'h':
|
||||
usage();
|
||||
return 0;
|
||||
case 'l':
|
||||
list_fourcc_pix_fmt = 1;
|
||||
break;
|
||||
case 'L':
|
||||
list_pix_fmt_fourccs = 1;
|
||||
break;
|
||||
case 'p':
|
||||
pix_fmt_name = optarg;
|
||||
break;
|
||||
case '?':
|
||||
usage();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (list_fourcc_pix_fmt)
|
||||
for (i = 0; pix_fmt_tags[i].pix_fmt != AV_PIX_FMT_NONE; i++)
|
||||
printf("%s: %s\n", av_fourcc2str(pix_fmt_tags[i].fourcc),
|
||||
av_get_pix_fmt_name(pix_fmt_tags[i].pix_fmt));
|
||||
|
||||
if (list_pix_fmt_fourccs) {
|
||||
for (i = 0; av_pix_fmt_desc_get(i); i++) {
|
||||
const AVPixFmtDescriptor *pix_desc = av_pix_fmt_desc_get(i);
|
||||
if (!pix_desc->name || pix_desc->flags & AV_PIX_FMT_FLAG_HWACCEL)
|
||||
continue;
|
||||
printf("%s: ", pix_desc->name);
|
||||
print_pix_fmt_fourccs(i, pix_fmt_tags, ' ');
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (pix_fmt_name) {
|
||||
enum AVPixelFormat pix_fmt = av_get_pix_fmt(pix_fmt_name);
|
||||
if (pix_fmt == AV_PIX_FMT_NONE) {
|
||||
fprintf(stderr, "Invalid pixel format selected '%s'\n", pix_fmt_name);
|
||||
return 1;
|
||||
}
|
||||
print_pix_fmt_fourccs(pix_fmt, pix_fmt_tags, '\n');
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
121
externals/ffmpeg/tools/gen-rc
vendored
Executable file
121
externals/ffmpeg/tools/gen-rc
vendored
Executable file
@@ -0,0 +1,121 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (c) 2012 James Almer
|
||||
# Copyright (c) 2013 Tiancheng "Timothy" Gu
|
||||
#
|
||||
# This file is part of FFmpeg.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# 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 FFmpeg; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
## Help
|
||||
die() {
|
||||
cat <<EOF >&2
|
||||
This script is used to generate Windows resources file for the FFmpeg libraries.
|
||||
The output .rc file is to be compiled by windres(1). It is mainly useful for
|
||||
FFmpeg developers to tweak and regenerate all resources files at once.
|
||||
|
||||
Usage: $0 <libname> <comment>
|
||||
|
||||
The script will output the file to '<libname>/<libname-without-lib>res.rc'.
|
||||
|
||||
Example: $0 libavcodec 'FFmpeg codecs library'
|
||||
EOF
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Script to generate all:
|
||||
# (to remove prefix '# ' and add 'tools/' as prefix: sed -r 's/^.{2}/tools\//')
|
||||
# gen-rc libavutil "FFmpeg utility library"
|
||||
# gen-rc libavcodec "FFmpeg codec library"
|
||||
# gen-rc libavformat "FFmpeg container format library"
|
||||
# gen-rc libavdevice "FFmpeg device handling library"
|
||||
# gen-rc libavfilter "FFmpeg audio/video filtering library"
|
||||
# gen-rc libpostproc "FFmpeg postprocessing library"
|
||||
# gen-rc libavresample "Libav audio resampling library"
|
||||
# gen-rc libswscale "FFmpeg image rescaling library"
|
||||
# gen-rc libswresample "FFmpeg audio resampling library"
|
||||
|
||||
## Sanity checks and argument parsing
|
||||
if test $# -lt 2 || test $# -gt 3; then
|
||||
die
|
||||
fi
|
||||
|
||||
name=$1
|
||||
shortname=${name#lib}
|
||||
comment=$2
|
||||
capname=`echo $name | awk '{print toupper($0)}'`
|
||||
version=${capname}_VERSION
|
||||
|
||||
mkdir -p "$name"
|
||||
output="$name/${shortname}res.rc"
|
||||
|
||||
## REAL magic
|
||||
cat <<EOF > $output
|
||||
/*
|
||||
* Windows resource file for $name
|
||||
*
|
||||
* Copyright (C) 2012 James Almer
|
||||
* Copyright (C) 2013 Tiancheng "Timothy" Gu
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* 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 FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include "$name/version.h"
|
||||
#include "libavutil/ffversion.h"
|
||||
#include "config.h"
|
||||
|
||||
1 VERSIONINFO
|
||||
FILEVERSION ${version}_MAJOR, ${version}_MINOR, ${version}_MICRO, 0
|
||||
PRODUCTVERSION ${version}_MAJOR, ${version}_MINOR, ${version}_MICRO, 0
|
||||
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
|
||||
FILEOS VOS_NT_WINDOWS32
|
||||
FILETYPE VFT_DLL
|
||||
{
|
||||
BLOCK "StringFileInfo"
|
||||
{
|
||||
BLOCK "040904B0"
|
||||
{
|
||||
VALUE "CompanyName", "FFmpeg Project"
|
||||
VALUE "FileDescription", "$comment"
|
||||
VALUE "FileVersion", AV_STRINGIFY($version)
|
||||
VALUE "InternalName", "$name"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2000-" AV_STRINGIFY(CONFIG_THIS_YEAR) " FFmpeg Project"
|
||||
VALUE "OriginalFilename", "$shortname" BUILDSUF "-" AV_STRINGIFY(${version}_MAJOR) SLIBSUF
|
||||
VALUE "ProductName", "FFmpeg"
|
||||
VALUE "ProductVersion", FFMPEG_VERSION
|
||||
}
|
||||
}
|
||||
|
||||
BLOCK "VarFileInfo"
|
||||
{
|
||||
VALUE "Translation", 0x0409, 0x04B0
|
||||
}
|
||||
}
|
||||
EOF
|
204
externals/ffmpeg/tools/graph2dot.c
vendored
Executable file
204
externals/ffmpeg/tools/graph2dot.c
vendored
Executable file
@@ -0,0 +1,204 @@
|
||||
/*
|
||||
* Copyright (c) 2008-2010 Stefano Sabatini
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* 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 FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#if HAVE_UNISTD_H
|
||||
#include <unistd.h> /* getopt */
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "libavutil/channel_layout.h"
|
||||
#include "libavutil/mem.h"
|
||||
#include "libavutil/pixdesc.h"
|
||||
#include "libavfilter/avfilter.h"
|
||||
|
||||
#if !HAVE_GETOPT
|
||||
#include "compat/getopt.c"
|
||||
#endif
|
||||
|
||||
static void usage(void)
|
||||
{
|
||||
printf("Convert a libavfilter graph to a dot file.\n");
|
||||
printf("Usage: graph2dot [OPTIONS]\n");
|
||||
printf("\n"
|
||||
"Options:\n"
|
||||
"-i INFILE set INFILE as input file, stdin if omitted\n"
|
||||
"-o OUTFILE set OUTFILE as output file, stdout if omitted\n"
|
||||
"-h print this help\n");
|
||||
}
|
||||
|
||||
struct line {
|
||||
char data[256];
|
||||
struct line *next;
|
||||
};
|
||||
|
||||
static void print_digraph(FILE *outfile, AVFilterGraph *graph)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
fprintf(outfile, "digraph G {\n");
|
||||
fprintf(outfile, "node [shape=box]\n");
|
||||
fprintf(outfile, "rankdir=LR\n");
|
||||
|
||||
for (i = 0; i < graph->nb_filters; i++) {
|
||||
char filter_ctx_label[128];
|
||||
const AVFilterContext *filter_ctx = graph->filters[i];
|
||||
|
||||
snprintf(filter_ctx_label, sizeof(filter_ctx_label), "%s\\n(%s)",
|
||||
filter_ctx->name,
|
||||
filter_ctx->filter->name);
|
||||
|
||||
for (j = 0; j < filter_ctx->nb_outputs; j++) {
|
||||
AVFilterLink *link = filter_ctx->outputs[j];
|
||||
if (link) {
|
||||
char dst_filter_ctx_label[128];
|
||||
const AVFilterContext *dst_filter_ctx = link->dst;
|
||||
|
||||
snprintf(dst_filter_ctx_label, sizeof(dst_filter_ctx_label),
|
||||
"%s\\n(%s)",
|
||||
dst_filter_ctx->name,
|
||||
dst_filter_ctx->filter->name);
|
||||
|
||||
fprintf(outfile, "\"%s\" -> \"%s\" [ label= \"inpad:%s -> outpad:%s\\n",
|
||||
filter_ctx_label, dst_filter_ctx_label,
|
||||
avfilter_pad_get_name(link->srcpad, 0),
|
||||
avfilter_pad_get_name(link->dstpad, 0));
|
||||
|
||||
if (link->type == AVMEDIA_TYPE_VIDEO) {
|
||||
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(link->format);
|
||||
fprintf(outfile,
|
||||
"fmt:%s w:%d h:%d tb:%d/%d",
|
||||
desc->name,
|
||||
link->w, link->h,
|
||||
link->time_base.num, link->time_base.den);
|
||||
} else if (link->type == AVMEDIA_TYPE_AUDIO) {
|
||||
char buf[255];
|
||||
av_get_channel_layout_string(buf, sizeof(buf), -1,
|
||||
link->channel_layout);
|
||||
fprintf(outfile,
|
||||
"fmt:%s sr:%d cl:%s tb:%d/%d",
|
||||
av_get_sample_fmt_name(link->format),
|
||||
link->sample_rate, buf,
|
||||
link->time_base.num, link->time_base.den);
|
||||
}
|
||||
fprintf(outfile, "\" ];\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
fprintf(outfile, "}\n");
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
const char *outfilename = NULL;
|
||||
const char *infilename = NULL;
|
||||
FILE *outfile = NULL;
|
||||
FILE *infile = NULL;
|
||||
char *graph_string = NULL;
|
||||
AVFilterGraph *graph = av_mallocz(sizeof(AVFilterGraph));
|
||||
char c;
|
||||
|
||||
av_log_set_level(AV_LOG_DEBUG);
|
||||
|
||||
while ((c = getopt(argc, argv, "hi:o:")) != -1) {
|
||||
switch (c) {
|
||||
case 'h':
|
||||
usage();
|
||||
return 0;
|
||||
case 'i':
|
||||
infilename = optarg;
|
||||
break;
|
||||
case 'o':
|
||||
outfilename = optarg;
|
||||
break;
|
||||
case '?':
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (!infilename || !strcmp(infilename, "-"))
|
||||
infilename = "/dev/stdin";
|
||||
infile = fopen(infilename, "r");
|
||||
if (!infile) {
|
||||
fprintf(stderr, "Failed to open input file '%s': %s\n",
|
||||
infilename, strerror(errno));
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!outfilename || !strcmp(outfilename, "-"))
|
||||
outfilename = "/dev/stdout";
|
||||
outfile = fopen(outfilename, "w");
|
||||
if (!outfile) {
|
||||
fprintf(stderr, "Failed to open output file '%s': %s\n",
|
||||
outfilename, strerror(errno));
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* read from infile and put it in a buffer */
|
||||
{
|
||||
int64_t count = 0;
|
||||
struct line *line, *last_line, *first_line;
|
||||
char *p;
|
||||
last_line = first_line = av_malloc(sizeof(struct line));
|
||||
if (!last_line) {
|
||||
fprintf(stderr, "Memory allocation failure\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
while (fgets(last_line->data, sizeof(last_line->data), infile)) {
|
||||
struct line *new_line = av_malloc(sizeof(struct line));
|
||||
if (!new_line) {
|
||||
fprintf(stderr, "Memory allocation failure\n");
|
||||
return 1;
|
||||
}
|
||||
count += strlen(last_line->data);
|
||||
last_line->next = new_line;
|
||||
last_line = new_line;
|
||||
}
|
||||
last_line->next = NULL;
|
||||
|
||||
graph_string = av_malloc(count + 1);
|
||||
if (!graph_string) {
|
||||
fprintf(stderr, "Memory allocation failure\n");
|
||||
return 1;
|
||||
}
|
||||
p = graph_string;
|
||||
for (line = first_line; line->next; line = line->next) {
|
||||
size_t l = strlen(line->data);
|
||||
memcpy(p, line->data, l);
|
||||
p += l;
|
||||
}
|
||||
*p = '\0';
|
||||
}
|
||||
|
||||
if (avfilter_graph_parse(graph, graph_string, NULL, NULL, NULL) < 0) {
|
||||
fprintf(stderr, "Failed to parse the graph description\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (avfilter_graph_config(graph, NULL) < 0)
|
||||
return 1;
|
||||
|
||||
print_digraph(outfile, graph);
|
||||
fflush(outfile);
|
||||
|
||||
return 0;
|
||||
}
|
837
externals/ffmpeg/tools/ismindex.c
vendored
Executable file
837
externals/ffmpeg/tools/ismindex.c
vendored
Executable file
@@ -0,0 +1,837 @@
|
||||
/*
|
||||
* Copyright (c) 2012 Martin Storsjo
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* 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 FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/*
|
||||
* To create a simple file for smooth streaming:
|
||||
* ffmpeg <normal input/transcoding options> -movflags frag_keyframe foo.ismv
|
||||
* ismindex -n foo foo.ismv
|
||||
* This step creates foo.ism and foo.ismc that is required by IIS for
|
||||
* serving it.
|
||||
*
|
||||
* With -ismf, it also creates foo.ismf, which maps fragment names to
|
||||
* start-end offsets in the ismv, for use in your own streaming server.
|
||||
*
|
||||
* By adding -path-prefix path/, the produced foo.ism will refer to the
|
||||
* files foo.ismv as "path/foo.ismv" - the prefix for the generated ismc
|
||||
* file can be set with the -ismc-prefix option similarly.
|
||||
*
|
||||
* To pre-split files for serving as static files by a web server without
|
||||
* any extra server support, create the ismv file as above, and split it:
|
||||
* ismindex -split foo.ismv
|
||||
* This step creates a file Manifest and directories QualityLevel(...),
|
||||
* that can be read directly by a smooth streaming player.
|
||||
*
|
||||
* The -output dir option can be used to request that output files
|
||||
* (both .ism/.ismc, or Manifest/QualityLevels* when splitting)
|
||||
* should be written to this directory instead of in the current directory.
|
||||
* (The directory itself isn't created if it doesn't already exist.)
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "libavformat/avformat.h"
|
||||
#include "libavformat/isom.h"
|
||||
#include "libavformat/os_support.h"
|
||||
#include "libavutil/intreadwrite.h"
|
||||
#include "libavutil/mathematics.h"
|
||||
|
||||
static int usage(const char *argv0, int ret)
|
||||
{
|
||||
fprintf(stderr, "%s [-split] [-ismf] [-n basename] [-path-prefix prefix] "
|
||||
"[-ismc-prefix prefix] [-output dir] file1 [file2] ...\n", argv0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct MoofOffset {
|
||||
int64_t time;
|
||||
int64_t offset;
|
||||
int64_t duration;
|
||||
};
|
||||
|
||||
struct Track {
|
||||
const char *name;
|
||||
int64_t duration;
|
||||
int bitrate;
|
||||
int track_id;
|
||||
int is_audio, is_video;
|
||||
int width, height;
|
||||
int chunks;
|
||||
int sample_rate, channels;
|
||||
uint8_t *codec_private;
|
||||
int codec_private_size;
|
||||
struct MoofOffset *offsets;
|
||||
int timescale;
|
||||
const char *fourcc;
|
||||
int blocksize;
|
||||
int tag;
|
||||
};
|
||||
|
||||
struct Tracks {
|
||||
int nb_tracks;
|
||||
int64_t duration;
|
||||
struct Track **tracks;
|
||||
int video_track, audio_track;
|
||||
int nb_video_tracks, nb_audio_tracks;
|
||||
};
|
||||
|
||||
static int expect_tag(int32_t got_tag, int32_t expected_tag) {
|
||||
if (got_tag != expected_tag) {
|
||||
char got_tag_str[4], expected_tag_str[4];
|
||||
AV_WB32(got_tag_str, got_tag);
|
||||
AV_WB32(expected_tag_str, expected_tag);
|
||||
fprintf(stderr, "wanted tag %.4s, got %.4s\n", expected_tag_str,
|
||||
got_tag_str);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int copy_tag(AVIOContext *in, AVIOContext *out, int32_t tag_name)
|
||||
{
|
||||
int32_t size, tag;
|
||||
|
||||
size = avio_rb32(in);
|
||||
tag = avio_rb32(in);
|
||||
avio_wb32(out, size);
|
||||
avio_wb32(out, tag);
|
||||
if (expect_tag(tag, tag_name) != 0)
|
||||
return -1;
|
||||
size -= 8;
|
||||
while (size > 0) {
|
||||
char buf[1024];
|
||||
int len = FFMIN(sizeof(buf), size);
|
||||
int got;
|
||||
if ((got = avio_read(in, buf, len)) != len) {
|
||||
fprintf(stderr, "short read, wanted %d, got %d\n", len, got);
|
||||
break;
|
||||
}
|
||||
avio_write(out, buf, len);
|
||||
size -= len;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int skip_tag(AVIOContext *in, int32_t tag_name)
|
||||
{
|
||||
int64_t pos = avio_tell(in);
|
||||
int32_t size, tag;
|
||||
|
||||
size = avio_rb32(in);
|
||||
tag = avio_rb32(in);
|
||||
if (expect_tag(tag, tag_name) != 0)
|
||||
return -1;
|
||||
avio_seek(in, pos + size, SEEK_SET);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int write_fragment(const char *filename, AVIOContext *in)
|
||||
{
|
||||
AVIOContext *out = NULL;
|
||||
int ret;
|
||||
|
||||
if ((ret = avio_open2(&out, filename, AVIO_FLAG_WRITE, NULL, NULL)) < 0) {
|
||||
char errbuf[100];
|
||||
av_strerror(ret, errbuf, sizeof(errbuf));
|
||||
fprintf(stderr, "Unable to open %s: %s\n", filename, errbuf);
|
||||
return ret;
|
||||
}
|
||||
ret = copy_tag(in, out, MKBETAG('m', 'o', 'o', 'f'));
|
||||
if (!ret)
|
||||
ret = copy_tag(in, out, MKBETAG('m', 'd', 'a', 't'));
|
||||
|
||||
avio_flush(out);
|
||||
avio_close(out);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int skip_fragment(AVIOContext *in)
|
||||
{
|
||||
int ret;
|
||||
ret = skip_tag(in, MKBETAG('m', 'o', 'o', 'f'));
|
||||
if (!ret)
|
||||
ret = skip_tag(in, MKBETAG('m', 'd', 'a', 't'));
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int write_fragments(struct Tracks *tracks, int start_index,
|
||||
AVIOContext *in, const char *basename,
|
||||
int split, int ismf, const char* output_prefix)
|
||||
{
|
||||
char dirname[2048], filename[2048], idxname[2048];
|
||||
int i, j, ret = 0, fragment_ret;
|
||||
FILE* out = NULL;
|
||||
|
||||
if (ismf) {
|
||||
snprintf(idxname, sizeof(idxname), "%s%s.ismf", output_prefix, basename);
|
||||
out = fopen(idxname, "w");
|
||||
if (!out) {
|
||||
ret = AVERROR(errno);
|
||||
perror(idxname);
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
for (i = start_index; i < tracks->nb_tracks; i++) {
|
||||
struct Track *track = tracks->tracks[i];
|
||||
const char *type = track->is_video ? "video" : "audio";
|
||||
snprintf(dirname, sizeof(dirname), "%sQualityLevels(%d)", output_prefix, track->bitrate);
|
||||
if (split) {
|
||||
if (mkdir(dirname, 0777) == -1 && errno != EEXIST) {
|
||||
ret = AVERROR(errno);
|
||||
perror(dirname);
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
for (j = 0; j < track->chunks; j++) {
|
||||
snprintf(filename, sizeof(filename), "%s/Fragments(%s=%"PRId64")",
|
||||
dirname, type, track->offsets[j].time);
|
||||
avio_seek(in, track->offsets[j].offset, SEEK_SET);
|
||||
if (ismf)
|
||||
fprintf(out, "%s %"PRId64, filename, avio_tell(in));
|
||||
if (split)
|
||||
fragment_ret = write_fragment(filename, in);
|
||||
else
|
||||
fragment_ret = skip_fragment(in);
|
||||
if (ismf)
|
||||
fprintf(out, " %"PRId64"\n", avio_tell(in));
|
||||
if (fragment_ret != 0) {
|
||||
fprintf(stderr, "failed fragment %d in track %d (%s)\n", j,
|
||||
track->track_id, track->name);
|
||||
ret = fragment_ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
fail:
|
||||
if (out)
|
||||
fclose(out);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int64_t read_trun_duration(AVIOContext *in, int default_duration,
|
||||
int64_t end)
|
||||
{
|
||||
int64_t dts = 0;
|
||||
int64_t pos;
|
||||
int flags, i;
|
||||
int entries;
|
||||
int64_t first_pts = 0;
|
||||
int64_t max_pts = 0;
|
||||
avio_r8(in); /* version */
|
||||
flags = avio_rb24(in);
|
||||
if (default_duration <= 0 && !(flags & MOV_TRUN_SAMPLE_DURATION)) {
|
||||
fprintf(stderr, "No sample duration in trun flags\n");
|
||||
return -1;
|
||||
}
|
||||
entries = avio_rb32(in);
|
||||
|
||||
if (flags & MOV_TRUN_DATA_OFFSET) avio_rb32(in);
|
||||
if (flags & MOV_TRUN_FIRST_SAMPLE_FLAGS) avio_rb32(in);
|
||||
|
||||
pos = avio_tell(in);
|
||||
for (i = 0; i < entries && pos < end; i++) {
|
||||
int sample_duration = default_duration;
|
||||
int64_t pts = dts;
|
||||
if (flags & MOV_TRUN_SAMPLE_DURATION) sample_duration = avio_rb32(in);
|
||||
if (flags & MOV_TRUN_SAMPLE_SIZE) avio_rb32(in);
|
||||
if (flags & MOV_TRUN_SAMPLE_FLAGS) avio_rb32(in);
|
||||
if (flags & MOV_TRUN_SAMPLE_CTS) pts += avio_rb32(in);
|
||||
if (sample_duration < 0) {
|
||||
fprintf(stderr, "Negative sample duration %d\n", sample_duration);
|
||||
return -1;
|
||||
}
|
||||
if (i == 0)
|
||||
first_pts = pts;
|
||||
max_pts = FFMAX(max_pts, pts + sample_duration);
|
||||
dts += sample_duration;
|
||||
pos = avio_tell(in);
|
||||
}
|
||||
|
||||
return max_pts - first_pts;
|
||||
}
|
||||
|
||||
static int64_t read_moof_duration(AVIOContext *in, int64_t offset)
|
||||
{
|
||||
int64_t ret = -1;
|
||||
int32_t moof_size, size, tag;
|
||||
int64_t pos = 0;
|
||||
int default_duration = 0;
|
||||
|
||||
avio_seek(in, offset, SEEK_SET);
|
||||
moof_size = avio_rb32(in);
|
||||
tag = avio_rb32(in);
|
||||
if (expect_tag(tag, MKBETAG('m', 'o', 'o', 'f')) != 0)
|
||||
goto fail;
|
||||
while (pos < offset + moof_size) {
|
||||
pos = avio_tell(in);
|
||||
size = avio_rb32(in);
|
||||
tag = avio_rb32(in);
|
||||
if (tag == MKBETAG('t', 'r', 'a', 'f')) {
|
||||
int64_t traf_pos = pos;
|
||||
int64_t traf_size = size;
|
||||
while (pos < traf_pos + traf_size) {
|
||||
pos = avio_tell(in);
|
||||
size = avio_rb32(in);
|
||||
tag = avio_rb32(in);
|
||||
if (tag == MKBETAG('t', 'f', 'h', 'd')) {
|
||||
int flags = 0;
|
||||
avio_r8(in); /* version */
|
||||
flags = avio_rb24(in);
|
||||
avio_rb32(in); /* track_id */
|
||||
if (flags & MOV_TFHD_BASE_DATA_OFFSET)
|
||||
avio_rb64(in);
|
||||
if (flags & MOV_TFHD_STSD_ID)
|
||||
avio_rb32(in);
|
||||
if (flags & MOV_TFHD_DEFAULT_DURATION)
|
||||
default_duration = avio_rb32(in);
|
||||
}
|
||||
if (tag == MKBETAG('t', 'r', 'u', 'n')) {
|
||||
return read_trun_duration(in, default_duration,
|
||||
pos + size);
|
||||
}
|
||||
avio_seek(in, pos + size, SEEK_SET);
|
||||
}
|
||||
fprintf(stderr, "Couldn't find trun\n");
|
||||
goto fail;
|
||||
}
|
||||
avio_seek(in, pos + size, SEEK_SET);
|
||||
}
|
||||
fprintf(stderr, "Couldn't find traf\n");
|
||||
|
||||
fail:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int read_tfra(struct Tracks *tracks, int start_index, AVIOContext *f)
|
||||
{
|
||||
int ret = AVERROR_EOF, track_id;
|
||||
int version, fieldlength, i, j;
|
||||
int64_t pos = avio_tell(f);
|
||||
uint32_t size = avio_rb32(f);
|
||||
struct Track *track = NULL;
|
||||
|
||||
if (avio_rb32(f) != MKBETAG('t', 'f', 'r', 'a'))
|
||||
goto fail;
|
||||
version = avio_r8(f);
|
||||
avio_rb24(f);
|
||||
track_id = avio_rb32(f); /* track id */
|
||||
for (i = start_index; i < tracks->nb_tracks && !track; i++)
|
||||
if (tracks->tracks[i]->track_id == track_id)
|
||||
track = tracks->tracks[i];
|
||||
if (!track) {
|
||||
/* Ok, continue parsing the next atom */
|
||||
ret = 0;
|
||||
goto fail;
|
||||
}
|
||||
fieldlength = avio_rb32(f);
|
||||
track->chunks = avio_rb32(f);
|
||||
track->offsets = av_mallocz_array(track->chunks, sizeof(*track->offsets));
|
||||
if (!track->offsets) {
|
||||
track->chunks = 0;
|
||||
ret = AVERROR(ENOMEM);
|
||||
goto fail;
|
||||
}
|
||||
// The duration here is always the difference between consecutive
|
||||
// start times.
|
||||
for (i = 0; i < track->chunks; i++) {
|
||||
if (version == 1) {
|
||||
track->offsets[i].time = avio_rb64(f);
|
||||
track->offsets[i].offset = avio_rb64(f);
|
||||
} else {
|
||||
track->offsets[i].time = avio_rb32(f);
|
||||
track->offsets[i].offset = avio_rb32(f);
|
||||
}
|
||||
for (j = 0; j < ((fieldlength >> 4) & 3) + 1; j++)
|
||||
avio_r8(f);
|
||||
for (j = 0; j < ((fieldlength >> 2) & 3) + 1; j++)
|
||||
avio_r8(f);
|
||||
for (j = 0; j < ((fieldlength >> 0) & 3) + 1; j++)
|
||||
avio_r8(f);
|
||||
if (i > 0)
|
||||
track->offsets[i - 1].duration = track->offsets[i].time -
|
||||
track->offsets[i - 1].time;
|
||||
}
|
||||
if (track->chunks > 0) {
|
||||
track->offsets[track->chunks - 1].duration = track->offsets[0].time +
|
||||
track->duration -
|
||||
track->offsets[track->chunks - 1].time;
|
||||
}
|
||||
// Now try to read the actual durations from the trun sample data.
|
||||
for (i = 0; i < track->chunks; i++) {
|
||||
int64_t duration = read_moof_duration(f, track->offsets[i].offset);
|
||||
if (duration > 0 && llabs(duration - track->offsets[i].duration) > 3) {
|
||||
// 3 allows for integer duration to drift a few units,
|
||||
// e.g., for 1/3 durations
|
||||
track->offsets[i].duration = duration;
|
||||
}
|
||||
}
|
||||
if (track->chunks > 0) {
|
||||
if (track->offsets[track->chunks - 1].duration <= 0) {
|
||||
fprintf(stderr, "Calculated last chunk duration for track %d "
|
||||
"was non-positive (%"PRId64"), probably due to missing "
|
||||
"fragments ", track->track_id,
|
||||
track->offsets[track->chunks - 1].duration);
|
||||
if (track->chunks > 1) {
|
||||
track->offsets[track->chunks - 1].duration =
|
||||
track->offsets[track->chunks - 2].duration;
|
||||
} else {
|
||||
track->offsets[track->chunks - 1].duration = 1;
|
||||
}
|
||||
fprintf(stderr, "corrected to %"PRId64"\n",
|
||||
track->offsets[track->chunks - 1].duration);
|
||||
track->duration = track->offsets[track->chunks - 1].time +
|
||||
track->offsets[track->chunks - 1].duration -
|
||||
track->offsets[0].time;
|
||||
fprintf(stderr, "Track duration corrected to %"PRId64"\n",
|
||||
track->duration);
|
||||
}
|
||||
}
|
||||
ret = 0;
|
||||
|
||||
fail:
|
||||
avio_seek(f, pos + size, SEEK_SET);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int read_mfra(struct Tracks *tracks, int start_index,
|
||||
const char *file, int split, int ismf,
|
||||
const char *basename, const char* output_prefix)
|
||||
{
|
||||
int err = 0;
|
||||
const char* err_str = "";
|
||||
AVIOContext *f = NULL;
|
||||
int32_t mfra_size;
|
||||
|
||||
if ((err = avio_open2(&f, file, AVIO_FLAG_READ, NULL, NULL)) < 0)
|
||||
goto fail;
|
||||
avio_seek(f, avio_size(f) - 4, SEEK_SET);
|
||||
mfra_size = avio_rb32(f);
|
||||
avio_seek(f, -mfra_size, SEEK_CUR);
|
||||
if (avio_rb32(f) != mfra_size) {
|
||||
err = AVERROR_INVALIDDATA;
|
||||
err_str = "mfra size mismatch";
|
||||
goto fail;
|
||||
}
|
||||
if (avio_rb32(f) != MKBETAG('m', 'f', 'r', 'a')) {
|
||||
err = AVERROR_INVALIDDATA;
|
||||
err_str = "mfra tag mismatch";
|
||||
goto fail;
|
||||
}
|
||||
while (!read_tfra(tracks, start_index, f)) {
|
||||
/* Empty */
|
||||
}
|
||||
|
||||
if (split || ismf)
|
||||
err = write_fragments(tracks, start_index, f, basename, split, ismf,
|
||||
output_prefix);
|
||||
err_str = "error in write_fragments";
|
||||
|
||||
fail:
|
||||
if (f)
|
||||
avio_close(f);
|
||||
if (err)
|
||||
fprintf(stderr, "Unable to read the MFRA atom in %s (%s)\n", file, err_str);
|
||||
return err;
|
||||
}
|
||||
|
||||
static int get_private_data(struct Track *track, AVCodecParameters *codecpar)
|
||||
{
|
||||
track->codec_private_size = 0;
|
||||
track->codec_private = av_mallocz(codecpar->extradata_size);
|
||||
if (!track->codec_private)
|
||||
return AVERROR(ENOMEM);
|
||||
track->codec_private_size = codecpar->extradata_size;
|
||||
memcpy(track->codec_private, codecpar->extradata, codecpar->extradata_size);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int get_video_private_data(struct Track *track, AVCodecParameters *codecpar)
|
||||
{
|
||||
AVIOContext *io = NULL;
|
||||
uint16_t sps_size, pps_size;
|
||||
int err;
|
||||
|
||||
if (codecpar->codec_id == AV_CODEC_ID_VC1)
|
||||
return get_private_data(track, codecpar);
|
||||
|
||||
if ((err = avio_open_dyn_buf(&io)) < 0)
|
||||
goto fail;
|
||||
err = AVERROR(EINVAL);
|
||||
if (codecpar->extradata_size < 11 || codecpar->extradata[0] != 1)
|
||||
goto fail;
|
||||
sps_size = AV_RB16(&codecpar->extradata[6]);
|
||||
if (11 + sps_size > codecpar->extradata_size)
|
||||
goto fail;
|
||||
avio_wb32(io, 0x00000001);
|
||||
avio_write(io, &codecpar->extradata[8], sps_size);
|
||||
pps_size = AV_RB16(&codecpar->extradata[9 + sps_size]);
|
||||
if (11 + sps_size + pps_size > codecpar->extradata_size)
|
||||
goto fail;
|
||||
avio_wb32(io, 0x00000001);
|
||||
avio_write(io, &codecpar->extradata[11 + sps_size], pps_size);
|
||||
err = 0;
|
||||
|
||||
fail:
|
||||
track->codec_private_size = avio_close_dyn_buf(io, &track->codec_private);
|
||||
return err;
|
||||
}
|
||||
|
||||
static int handle_file(struct Tracks *tracks, const char *file, int split,
|
||||
int ismf, const char *basename,
|
||||
const char* output_prefix)
|
||||
{
|
||||
AVFormatContext *ctx = NULL;
|
||||
int err = 0, i, orig_tracks = tracks->nb_tracks;
|
||||
char errbuf[50], *ptr;
|
||||
struct Track *track;
|
||||
|
||||
err = avformat_open_input(&ctx, file, NULL, NULL);
|
||||
if (err < 0) {
|
||||
av_strerror(err, errbuf, sizeof(errbuf));
|
||||
fprintf(stderr, "Unable to open %s: %s\n", file, errbuf);
|
||||
return 1;
|
||||
}
|
||||
|
||||
err = avformat_find_stream_info(ctx, NULL);
|
||||
if (err < 0) {
|
||||
av_strerror(err, errbuf, sizeof(errbuf));
|
||||
fprintf(stderr, "Unable to identify %s: %s\n", file, errbuf);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (ctx->nb_streams < 1) {
|
||||
fprintf(stderr, "No streams found in %s\n", file);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
for (i = 0; i < ctx->nb_streams; i++) {
|
||||
struct Track **temp;
|
||||
AVStream *st = ctx->streams[i];
|
||||
|
||||
if (st->codecpar->bit_rate == 0) {
|
||||
fprintf(stderr, "Skipping track %d in %s as it has zero bitrate\n",
|
||||
st->id, file);
|
||||
continue;
|
||||
}
|
||||
|
||||
track = av_mallocz(sizeof(*track));
|
||||
if (!track) {
|
||||
err = AVERROR(ENOMEM);
|
||||
goto fail;
|
||||
}
|
||||
temp = av_realloc_array(tracks->tracks,
|
||||
tracks->nb_tracks + 1,
|
||||
sizeof(*tracks->tracks));
|
||||
if (!temp) {
|
||||
av_free(track);
|
||||
err = AVERROR(ENOMEM);
|
||||
goto fail;
|
||||
}
|
||||
tracks->tracks = temp;
|
||||
tracks->tracks[tracks->nb_tracks] = track;
|
||||
|
||||
track->name = file;
|
||||
if ((ptr = strrchr(file, '/')))
|
||||
track->name = ptr + 1;
|
||||
|
||||
track->bitrate = st->codecpar->bit_rate;
|
||||
track->track_id = st->id;
|
||||
track->timescale = st->time_base.den;
|
||||
track->duration = st->duration;
|
||||
track->is_audio = st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO;
|
||||
track->is_video = st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO;
|
||||
|
||||
if (!track->is_audio && !track->is_video) {
|
||||
fprintf(stderr,
|
||||
"Track %d in %s is neither video nor audio, skipping\n",
|
||||
track->track_id, file);
|
||||
av_freep(&tracks->tracks[tracks->nb_tracks]);
|
||||
continue;
|
||||
}
|
||||
|
||||
tracks->duration = FFMAX(tracks->duration,
|
||||
av_rescale_rnd(track->duration, AV_TIME_BASE,
|
||||
track->timescale, AV_ROUND_UP));
|
||||
|
||||
if (track->is_audio) {
|
||||
if (tracks->audio_track < 0)
|
||||
tracks->audio_track = tracks->nb_tracks;
|
||||
tracks->nb_audio_tracks++;
|
||||
track->channels = st->codecpar->channels;
|
||||
track->sample_rate = st->codecpar->sample_rate;
|
||||
if (st->codecpar->codec_id == AV_CODEC_ID_AAC) {
|
||||
track->fourcc = "AACL";
|
||||
track->tag = 255;
|
||||
track->blocksize = 4;
|
||||
} else if (st->codecpar->codec_id == AV_CODEC_ID_WMAPRO) {
|
||||
track->fourcc = "WMAP";
|
||||
track->tag = st->codecpar->codec_tag;
|
||||
track->blocksize = st->codecpar->block_align;
|
||||
}
|
||||
get_private_data(track, st->codecpar);
|
||||
}
|
||||
if (track->is_video) {
|
||||
if (tracks->video_track < 0)
|
||||
tracks->video_track = tracks->nb_tracks;
|
||||
tracks->nb_video_tracks++;
|
||||
track->width = st->codecpar->width;
|
||||
track->height = st->codecpar->height;
|
||||
if (st->codecpar->codec_id == AV_CODEC_ID_H264)
|
||||
track->fourcc = "H264";
|
||||
else if (st->codecpar->codec_id == AV_CODEC_ID_VC1)
|
||||
track->fourcc = "WVC1";
|
||||
get_video_private_data(track, st->codecpar);
|
||||
}
|
||||
|
||||
tracks->nb_tracks++;
|
||||
}
|
||||
|
||||
avformat_close_input(&ctx);
|
||||
|
||||
err = read_mfra(tracks, orig_tracks, file, split, ismf, basename,
|
||||
output_prefix);
|
||||
|
||||
fail:
|
||||
if (ctx)
|
||||
avformat_close_input(&ctx);
|
||||
return err;
|
||||
}
|
||||
|
||||
static void output_server_manifest(struct Tracks *tracks, const char *basename,
|
||||
const char *output_prefix,
|
||||
const char *path_prefix,
|
||||
const char *ismc_prefix)
|
||||
{
|
||||
char filename[1000];
|
||||
FILE *out;
|
||||
int i;
|
||||
|
||||
snprintf(filename, sizeof(filename), "%s%s.ism", output_prefix, basename);
|
||||
out = fopen(filename, "w");
|
||||
if (!out) {
|
||||
perror(filename);
|
||||
return;
|
||||
}
|
||||
fprintf(out, "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
|
||||
fprintf(out, "<smil xmlns=\"http://www.w3.org/2001/SMIL20/Language\">\n");
|
||||
fprintf(out, "\t<head>\n");
|
||||
fprintf(out, "\t\t<meta name=\"clientManifestRelativePath\" "
|
||||
"content=\"%s%s.ismc\" />\n", ismc_prefix, basename);
|
||||
fprintf(out, "\t</head>\n");
|
||||
fprintf(out, "\t<body>\n");
|
||||
fprintf(out, "\t\t<switch>\n");
|
||||
for (i = 0; i < tracks->nb_tracks; i++) {
|
||||
struct Track *track = tracks->tracks[i];
|
||||
const char *type = track->is_video ? "video" : "audio";
|
||||
fprintf(out, "\t\t\t<%s src=\"%s%s\" systemBitrate=\"%d\">\n",
|
||||
type, path_prefix, track->name, track->bitrate);
|
||||
fprintf(out, "\t\t\t\t<param name=\"trackID\" value=\"%d\" "
|
||||
"valueType=\"data\" />\n", track->track_id);
|
||||
fprintf(out, "\t\t\t</%s>\n", type);
|
||||
}
|
||||
fprintf(out, "\t\t</switch>\n");
|
||||
fprintf(out, "\t</body>\n");
|
||||
fprintf(out, "</smil>\n");
|
||||
fclose(out);
|
||||
}
|
||||
|
||||
static void print_track_chunks(FILE *out, struct Tracks *tracks, int main,
|
||||
const char *type)
|
||||
{
|
||||
int i, j;
|
||||
int64_t pos = 0;
|
||||
struct Track *track = tracks->tracks[main];
|
||||
int should_print_time_mismatch = 1;
|
||||
|
||||
for (i = 0; i < track->chunks; i++) {
|
||||
for (j = main + 1; j < tracks->nb_tracks; j++) {
|
||||
if (tracks->tracks[j]->is_audio == track->is_audio) {
|
||||
if (track->offsets[i].duration != tracks->tracks[j]->offsets[i].duration) {
|
||||
fprintf(stderr, "Mismatched duration of %s chunk %d in %s (%d) and %s (%d)\n",
|
||||
type, i, track->name, main, tracks->tracks[j]->name, j);
|
||||
should_print_time_mismatch = 1;
|
||||
}
|
||||
if (track->offsets[i].time != tracks->tracks[j]->offsets[i].time) {
|
||||
if (should_print_time_mismatch)
|
||||
fprintf(stderr, "Mismatched (start) time of %s chunk %d in %s (%d) and %s (%d)\n",
|
||||
type, i, track->name, main, tracks->tracks[j]->name, j);
|
||||
should_print_time_mismatch = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
fprintf(out, "\t\t<c n=\"%d\" d=\"%"PRId64"\" ",
|
||||
i, track->offsets[i].duration);
|
||||
if (pos != track->offsets[i].time) {
|
||||
fprintf(out, "t=\"%"PRId64"\" ", track->offsets[i].time);
|
||||
pos = track->offsets[i].time;
|
||||
}
|
||||
pos += track->offsets[i].duration;
|
||||
fprintf(out, "/>\n");
|
||||
}
|
||||
}
|
||||
|
||||
static void output_client_manifest(struct Tracks *tracks, const char *basename,
|
||||
const char *output_prefix, int split)
|
||||
{
|
||||
char filename[1000];
|
||||
FILE *out;
|
||||
int i, j;
|
||||
|
||||
if (split)
|
||||
snprintf(filename, sizeof(filename), "%sManifest", output_prefix);
|
||||
else
|
||||
snprintf(filename, sizeof(filename), "%s%s.ismc", output_prefix, basename);
|
||||
out = fopen(filename, "w");
|
||||
if (!out) {
|
||||
perror(filename);
|
||||
return;
|
||||
}
|
||||
fprintf(out, "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
|
||||
fprintf(out, "<SmoothStreamingMedia MajorVersion=\"2\" MinorVersion=\"0\" "
|
||||
"Duration=\"%"PRId64 "\">\n", tracks->duration * 10);
|
||||
if (tracks->video_track >= 0) {
|
||||
struct Track *track = tracks->tracks[tracks->video_track];
|
||||
struct Track *first_track = track;
|
||||
int index = 0;
|
||||
fprintf(out,
|
||||
"\t<StreamIndex Type=\"video\" QualityLevels=\"%d\" "
|
||||
"Chunks=\"%d\" "
|
||||
"Url=\"QualityLevels({bitrate})/Fragments(video={start time})\">\n",
|
||||
tracks->nb_video_tracks, track->chunks);
|
||||
for (i = 0; i < tracks->nb_tracks; i++) {
|
||||
track = tracks->tracks[i];
|
||||
if (!track->is_video)
|
||||
continue;
|
||||
fprintf(out,
|
||||
"\t\t<QualityLevel Index=\"%d\" Bitrate=\"%d\" "
|
||||
"FourCC=\"%s\" MaxWidth=\"%d\" MaxHeight=\"%d\" "
|
||||
"CodecPrivateData=\"",
|
||||
index, track->bitrate, track->fourcc, track->width, track->height);
|
||||
for (j = 0; j < track->codec_private_size; j++)
|
||||
fprintf(out, "%02X", track->codec_private[j]);
|
||||
fprintf(out, "\" />\n");
|
||||
index++;
|
||||
if (track->chunks != first_track->chunks)
|
||||
fprintf(stderr, "Mismatched number of video chunks in %s (id: %d, chunks %d) and %s (id: %d, chunks %d)\n",
|
||||
track->name, track->track_id, track->chunks, first_track->name, first_track->track_id, first_track->chunks);
|
||||
}
|
||||
print_track_chunks(out, tracks, tracks->video_track, "video");
|
||||
fprintf(out, "\t</StreamIndex>\n");
|
||||
}
|
||||
if (tracks->audio_track >= 0) {
|
||||
struct Track *track = tracks->tracks[tracks->audio_track];
|
||||
struct Track *first_track = track;
|
||||
int index = 0;
|
||||
fprintf(out,
|
||||
"\t<StreamIndex Type=\"audio\" QualityLevels=\"%d\" "
|
||||
"Chunks=\"%d\" "
|
||||
"Url=\"QualityLevels({bitrate})/Fragments(audio={start time})\">\n",
|
||||
tracks->nb_audio_tracks, track->chunks);
|
||||
for (i = 0; i < tracks->nb_tracks; i++) {
|
||||
track = tracks->tracks[i];
|
||||
if (!track->is_audio)
|
||||
continue;
|
||||
fprintf(out,
|
||||
"\t\t<QualityLevel Index=\"%d\" Bitrate=\"%d\" "
|
||||
"FourCC=\"%s\" SamplingRate=\"%d\" Channels=\"%d\" "
|
||||
"BitsPerSample=\"16\" PacketSize=\"%d\" "
|
||||
"AudioTag=\"%d\" CodecPrivateData=\"",
|
||||
index, track->bitrate, track->fourcc, track->sample_rate,
|
||||
track->channels, track->blocksize, track->tag);
|
||||
for (j = 0; j < track->codec_private_size; j++)
|
||||
fprintf(out, "%02X", track->codec_private[j]);
|
||||
fprintf(out, "\" />\n");
|
||||
index++;
|
||||
if (track->chunks != first_track->chunks)
|
||||
fprintf(stderr, "Mismatched number of audio chunks in %s and %s\n",
|
||||
track->name, first_track->name);
|
||||
}
|
||||
print_track_chunks(out, tracks, tracks->audio_track, "audio");
|
||||
fprintf(out, "\t</StreamIndex>\n");
|
||||
}
|
||||
fprintf(out, "</SmoothStreamingMedia>\n");
|
||||
fclose(out);
|
||||
}
|
||||
|
||||
static void clean_tracks(struct Tracks *tracks)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < tracks->nb_tracks; i++) {
|
||||
av_freep(&tracks->tracks[i]->codec_private);
|
||||
av_freep(&tracks->tracks[i]->offsets);
|
||||
av_freep(&tracks->tracks[i]);
|
||||
}
|
||||
av_freep(&tracks->tracks);
|
||||
tracks->nb_tracks = 0;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
const char *basename = NULL;
|
||||
const char *path_prefix = "", *ismc_prefix = "";
|
||||
const char *output_prefix = "";
|
||||
char output_prefix_buf[2048];
|
||||
int split = 0, ismf = 0, i;
|
||||
struct Tracks tracks = { 0, .video_track = -1, .audio_track = -1 };
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (!strcmp(argv[i], "-n")) {
|
||||
basename = argv[i + 1];
|
||||
i++;
|
||||
} else if (!strcmp(argv[i], "-path-prefix")) {
|
||||
path_prefix = argv[i + 1];
|
||||
i++;
|
||||
} else if (!strcmp(argv[i], "-ismc-prefix")) {
|
||||
ismc_prefix = argv[i + 1];
|
||||
i++;
|
||||
} else if (!strcmp(argv[i], "-output")) {
|
||||
output_prefix = argv[i + 1];
|
||||
i++;
|
||||
if (output_prefix[strlen(output_prefix) - 1] != '/') {
|
||||
snprintf(output_prefix_buf, sizeof(output_prefix_buf),
|
||||
"%s/", output_prefix);
|
||||
output_prefix = output_prefix_buf;
|
||||
}
|
||||
} else if (!strcmp(argv[i], "-split")) {
|
||||
split = 1;
|
||||
} else if (!strcmp(argv[i], "-ismf")) {
|
||||
ismf = 1;
|
||||
} else if (argv[i][0] == '-') {
|
||||
return usage(argv[0], 1);
|
||||
} else {
|
||||
if (!basename)
|
||||
ismf = 0;
|
||||
if (handle_file(&tracks, argv[i], split, ismf,
|
||||
basename, output_prefix))
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
if (!tracks.nb_tracks || (!basename && !split))
|
||||
return usage(argv[0], 1);
|
||||
|
||||
if (!split)
|
||||
output_server_manifest(&tracks, basename, output_prefix,
|
||||
path_prefix, ismc_prefix);
|
||||
output_client_manifest(&tracks, basename, output_prefix, split);
|
||||
|
||||
clean_tracks(&tracks);
|
||||
|
||||
return 0;
|
||||
}
|
22
externals/ffmpeg/tools/libav-merge-next-commit
vendored
Executable file
22
externals/ffmpeg/tools/libav-merge-next-commit
vendored
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ "$1" != "merge" -a "$1" != "noop" ]; then
|
||||
printf "Usage: $0 <merge|noop [REF_HASH]>\n"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
[ "$1" = "noop" ] && merge_opts="-s ours"
|
||||
|
||||
nextrev=$(git rev-list libav/master --not master --no-merges | tail -n1)
|
||||
if [ -z "$nextrev" ]; then
|
||||
printf "Nothing to merge..\n"
|
||||
exit 0
|
||||
fi
|
||||
printf "Merging $(git log -n 1 --oneline $nextrev)\n"
|
||||
git merge --no-commit $merge_opts --no-ff --log $nextrev
|
||||
|
||||
if [ "$1" = "noop" -a -n "$2" ]; then
|
||||
printf "\nThis commit is a noop, see $2\n" >> .git/MERGE_MSG
|
||||
fi
|
||||
|
||||
printf "\nMerged-by: $(git config --get user.name) <$(git config --get user.email)>\n" >> .git/MERGE_MSG
|
61
externals/ffmpeg/tools/loudnorm.rb
vendored
Executable file
61
externals/ffmpeg/tools/loudnorm.rb
vendored
Executable file
@@ -0,0 +1,61 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
require 'open3'
|
||||
require 'json'
|
||||
|
||||
ffmpeg_bin = 'ffmpeg'
|
||||
target_il = -24.0
|
||||
target_lra = +11.0
|
||||
target_tp = -2.0
|
||||
samplerate = '48k'
|
||||
|
||||
if ARGF.argv.count != 2
|
||||
puts "Usage: #{$PROGRAM_NAME} input.wav output.wav"
|
||||
exit 1
|
||||
end
|
||||
|
||||
ff_cmd = Array.new([
|
||||
ffmpeg_bin,
|
||||
'-hide_banner',
|
||||
'-i', ARGF.argv[0],
|
||||
'-af', "loudnorm='I=#{target_il}:LRA=#{target_lra}:tp=#{target_tp}:print_format=json'",
|
||||
'-f', 'null',
|
||||
'-']);
|
||||
|
||||
_stdin, _stdout, stderr, wait_thr = Open3.popen3(*ff_cmd)
|
||||
|
||||
if wait_thr.value.success?
|
||||
stats = JSON.parse(stderr.read.lines[-12, 12].join)
|
||||
loudnorm_string = 'loudnorm='
|
||||
loudnorm_string += 'print_format=summary:'
|
||||
loudnorm_string += 'linear=true:'
|
||||
loudnorm_string += "I=#{target_il}:"
|
||||
loudnorm_string += "LRA=#{target_lra}:"
|
||||
loudnorm_string += "tp=#{target_tp}:"
|
||||
loudnorm_string += "measured_I=#{stats['input_i']}:"
|
||||
loudnorm_string += "measured_LRA=#{stats['input_lra']}:"
|
||||
loudnorm_string += "measured_tp=#{stats['input_tp']}:"
|
||||
loudnorm_string += "measured_thresh=#{stats['input_thresh']}:"
|
||||
loudnorm_string += "offset=#{stats['target_offset']}"
|
||||
else
|
||||
puts stderr.read
|
||||
exit 1
|
||||
end
|
||||
|
||||
ff_cmd = Array.new([
|
||||
ffmpeg_bin,
|
||||
'-y', '-hide_banner',
|
||||
'-i', ARGF.argv[0],
|
||||
'-af', loudnorm_string,
|
||||
'-ar', samplerate,
|
||||
ARGF.argv[1].to_s]);
|
||||
|
||||
_stdin, _stdout, stderr, wait_thr = Open3.popen3(*ff_cmd)
|
||||
|
||||
if wait_thr.value.success?
|
||||
puts stderr.read.lines[-12, 12].join
|
||||
exit 0
|
||||
else
|
||||
puts stderr.read
|
||||
exit 1
|
||||
end
|
114
externals/ffmpeg/tools/make_chlayout_test
vendored
Executable file
114
externals/ffmpeg/tools/make_chlayout_test
vendored
Executable file
@@ -0,0 +1,114 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
# Copyright (c) 2012 Nicolas George
|
||||
#
|
||||
# This file is part of FFmpeg.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# 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 FFmpeg; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
=head1 NAME
|
||||
|
||||
make_chlayout_test - produce a multichannel test file with the channels
|
||||
clearly identified
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
tools/make_chlayout_test I<channels> I<out_options>
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
This script uses B<ffmpeg> and B<libflite> to produce a file with audio
|
||||
channels clearly identified by their name. The resulting file can be used to
|
||||
check that the layout and order of channels is correctly handled by a piece
|
||||
of software, either a part of B<FFmpeg> or not.
|
||||
|
||||
I<channels> is a list of channels or channel layouts, separated by '+'.
|
||||
|
||||
I<out_options> is a list of valid ffmpeg outout options, including the
|
||||
output file.
|
||||
|
||||
Note that some output codecs or formats can not handle arbitrary channel
|
||||
layout.
|
||||
|
||||
This script requires a B<ffmpeg> binary, either in the source tree or in the
|
||||
search path; it must have the flite audio source enabled.
|
||||
|
||||
=head1 EXAMPLES
|
||||
|
||||
Check that the speakers are correctly plugged:
|
||||
|
||||
tools/make_chlayout_test FL+FR -f alsa default
|
||||
|
||||
Produce a 5.1 FLAC file:
|
||||
|
||||
tools/make_chlayout_test 5.1 surround.flac
|
||||
|
||||
=cut
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Getopt::Long ":config" => "require_order";
|
||||
use Pod::Usage;
|
||||
|
||||
GetOptions (
|
||||
"help|usage|?|h" => sub { pod2usage({ -verbose => 1, -exitval => 0 }) },
|
||||
"manpage|m" => sub { pod2usage({ -verbose => 2, -exitval => 0 }) },
|
||||
) and @ARGV >= 2 or pod2usage({ -verbose => 1, -exitval => 1 });
|
||||
|
||||
my $channels = shift @ARGV;
|
||||
my @out_options = @ARGV;
|
||||
|
||||
my $ffmpeg = exists $ENV{FFMPEG} ? $ENV{FFMPEG} :
|
||||
$0 =~ /(.*)\// && -e "$1/../ffmpeg" ? "$1/../ffmpeg" :
|
||||
"ffmpeg";
|
||||
|
||||
my %channel_label_to_descr;
|
||||
my %layout_to_channels;
|
||||
|
||||
{
|
||||
open my $stderr, ">&STDERR";
|
||||
open STDERR, ">", "/dev/null";
|
||||
open my $f, "-|", $ffmpeg, "-layouts" or die "$ffmpeg: $!\n";
|
||||
open STDERR, ">&", $stderr;
|
||||
while (<$f>) {
|
||||
chomp;
|
||||
next if /^NAME/ or /:$/ or /^$/; # skip headings
|
||||
my ($name, $descr) = split " ", $_, 2;
|
||||
next unless $descr;
|
||||
if ($descr =~ /^[[:upper:]]+(?:\+[[:upper:]]+)*$/) {
|
||||
$layout_to_channels{$name} = [ split /\+/, $descr ];
|
||||
} else {
|
||||
$channel_label_to_descr{$name} = $descr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
my @channels = map { @{$layout_to_channels{$_} // [$_]} } split /\+/, $channels;
|
||||
|
||||
my $layout = join "+", @channels;
|
||||
my $graph = "";
|
||||
my $concat_in = "";
|
||||
for my $i (0 .. $#channels) {
|
||||
my $label = $channels[$i];
|
||||
my $descr = $channel_label_to_descr{$label}
|
||||
or die "Channel $label not found\n";
|
||||
$graph .= "flite=text='${descr}', aformat=channel_layouts=mono, " .
|
||||
"pan=${layout}:${label}=c0 [ch$i] ;\n";
|
||||
$concat_in .= "[ch$i] ";
|
||||
}
|
||||
$graph .= "${concat_in}concat=v=0:a=1:n=" . scalar(@channels);
|
||||
|
||||
exec $ffmpeg, "-f", "lavfi", "-i", $graph, @out_options
|
||||
or die "$ffmpeg: $!\n";
|
36
externals/ffmpeg/tools/missing_codec_desc
vendored
Executable file
36
externals/ffmpeg/tools/missing_codec_desc
vendored
Executable file
@@ -0,0 +1,36 @@
|
||||
#!/bin/sh
|
||||
|
||||
srcdir=${0%/*}/..
|
||||
|
||||
while read -r field equal value; do
|
||||
case "$field $equal" in
|
||||
".id =")
|
||||
eval "known_${value%,}=1"
|
||||
;;
|
||||
esac
|
||||
done < $srcdir/libavcodec/codec_desc.c
|
||||
|
||||
known_AV_CODEC_ID_NONE=1
|
||||
known_AV_CODEC_ID_FIRST_AUDIO=1
|
||||
known_AV_CODEC_ID_FIRST_SUBTITLE=1
|
||||
known_AV_CODEC_ID_FIRST_UNKNOWN=1
|
||||
known_AV_CODEC_ID_PROBE=1
|
||||
known_AV_CODEC_ID_MPEG2TS=1
|
||||
known_AV_CODEC_ID_MPEG4SYSTEMS=1
|
||||
known_AV_CODEC_ID_FFMETADATA=1
|
||||
|
||||
in=0
|
||||
while read -r line; do
|
||||
case "$in-$line" in
|
||||
0-"enum AVCodecID"*) in=1;;
|
||||
1-*"};"*) in=0;;
|
||||
1-*AV_CODEC_ID_*,*)
|
||||
cid="${line%%[, =]*}"
|
||||
eval "known=\$known_$cid"
|
||||
case "$known" in
|
||||
1) ;;
|
||||
*) echo "$cid missing";;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
done < $srcdir/libavcodec/avcodec.h
|
11
externals/ffmpeg/tools/murge
vendored
Executable file
11
externals/ffmpeg/tools/murge
vendored
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
grep -A99999 '^<<<<<<<' | grep -B99999 '^>>>>>>>' >murge.X
|
||||
grep -A99999 '^====' murge.X | egrep -v '^(=======|<<<<<<<|>>>>>>>|\|\|\|\|\|\|\|)' >murge.theirs
|
||||
grep -B99999 '^||||' murge.X | egrep -v '^(=======|<<<<<<<|>>>>>>>|\|\|\|\|\|\|\|)' >murge.ours
|
||||
grep -B99999 '^====' murge.X | grep -A99999 '^||||' | egrep -v '^(=======|<<<<<<<|>>>>>>>|\|\|\|\|\|\|\|)' >murge.common
|
||||
|
||||
colordiff -du $* murge.ours murge.theirs
|
||||
grep . murge.common > /dev/null && colordiff -du $* murge.common murge.theirs
|
||||
grep . murge.common > /dev/null && colordiff -du $* murge.common murge.ours
|
||||
rm murge.theirs murge.common murge.ours murge.X
|
33
externals/ffmpeg/tools/normalize.py
vendored
Executable file
33
externals/ffmpeg/tools/normalize.py
vendored
Executable file
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env python2
|
||||
|
||||
import sys, subprocess
|
||||
|
||||
if len(sys.argv) > 2:
|
||||
ifile = sys.argv[1]
|
||||
encopt = sys.argv[2:-1]
|
||||
ofile = sys.argv[-1]
|
||||
else:
|
||||
print 'usage: %s <input> [encode_options] <output>' % sys.argv[0]
|
||||
sys.exit(1)
|
||||
|
||||
analysis_cmd = 'ffprobe -v error -of compact=p=0:nk=1 '
|
||||
analysis_cmd += '-show_entries frame_tags=lavfi.r128.I -f lavfi '
|
||||
analysis_cmd += "amovie='%s',ebur128=metadata=1" % ifile
|
||||
try:
|
||||
probe_out = subprocess.check_output(analysis_cmd, shell=True)
|
||||
except subprocess.CalledProcessError, e:
|
||||
sys.exit(e.returncode)
|
||||
loudness = ref = -23
|
||||
for line in probe_out.splitlines():
|
||||
sline = line.rstrip()
|
||||
if sline:
|
||||
loudness = sline
|
||||
adjust = ref - float(loudness)
|
||||
if abs(adjust) < 0.0001:
|
||||
print 'No normalization needed for ' + ifile
|
||||
else:
|
||||
print "Adjust %s by %.1fdB" % (ifile, adjust)
|
||||
norm_cmd = ['ffmpeg', '-i', ifile, '-af', 'volume=%fdB' % adjust]
|
||||
norm_cmd += encopt + [ofile]
|
||||
print ' => %s' % ' '.join(norm_cmd)
|
||||
subprocess.call(norm_cmd)
|
180
externals/ffmpeg/tools/patcheck
vendored
Executable file
180
externals/ffmpeg/tools/patcheck
vendored
Executable file
@@ -0,0 +1,180 @@
|
||||
#!/bin/sh
|
||||
|
||||
# if no argument provided, write stdin to a file and re-run the script
|
||||
if [ $# = 0 ]; then
|
||||
cat > patcheck.stdout
|
||||
$0 patcheck.stdout
|
||||
rm -f patcheck.stdout
|
||||
exit
|
||||
fi
|
||||
|
||||
GREP=grep
|
||||
EGREP=egrep
|
||||
TMP=patcheck.tmp
|
||||
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, 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 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_]*'
|
||||
ERE_FUNCS="$ERE_TYPES"' *\('
|
||||
|
||||
hiegrep(){
|
||||
arg="$1"
|
||||
msg="$2"
|
||||
shift 2
|
||||
$GREP $OPT '^+' $* | $GREP -v ':+++'| $EGREP --color=always -- "$arg"> $TMP && printf "\n$msg\n"
|
||||
cat $TMP
|
||||
}
|
||||
|
||||
hiegrep2(){
|
||||
arg="$1"
|
||||
varg="$2"
|
||||
msg="$3"
|
||||
shift 3
|
||||
$GREP $OPT '^+' $* | $GREP -v ':+++' | $EGREP -v -- "$varg" | $EGREP --color=always -- "$arg" > $TMP && printf "\n$msg\n"
|
||||
cat $TMP
|
||||
}
|
||||
|
||||
hiegrep 'static[^(]*\*[a-zA-Z_]*\[' 'pointer array is not const' $*
|
||||
hiegrep '[[:space:]]$' 'trailing whitespace' $*
|
||||
hiegrep "$(echo x | tr 'x' '\t')" 'tabs' $*
|
||||
#hiegrep ':\+$' 'Empty lines' $*
|
||||
hiegrep ';;' 'double ;' $*
|
||||
hiegrep2 '\b_[a-zA-Z0-9_]{1,}' '__(asm|attribute)([^a-zA-Z0-9]|$)' 'reserved identifer' $*
|
||||
hiegrep '//[-/<\* ]*$' 'empty comment' $*
|
||||
hiegrep '/\*[-<\* ]*\*/' 'empty comment' $*
|
||||
hiegrep '(static|inline|const) *\1[^_a-zA-Z]' 'duplicate word' $*
|
||||
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' $*
|
||||
|
||||
hiegrep '\+= *1 *;' 'can be simplified to ++' $*
|
||||
hiegrep '-= *1 *;' 'can be simplified to --' $*
|
||||
hiegrep '((!|=)= *(0|NULL)[^0-9a-z]|[^0-9a-z](0|NULL) *(!|=)=)' 'x==0 / x!=0 can be simplified to !x / x' $*
|
||||
|
||||
$EGREP $OPT '^\+ *(const *|)static' $*| $EGREP --color=always '[^=]= *(0|NULL)[^0-9a-zA-Z]'> $TMP && printf '\nuseless 0 init\n'
|
||||
cat $TMP
|
||||
hiegrep '# *ifdef * (HAVE|CONFIG)_' 'ifdefs that should be #if' $*
|
||||
|
||||
hiegrep '\b(awnser|cant|dont|wont|doesnt|usefull|successfull|occured|teh|alot|wether|skiped|skiping|heigth|informations|colums|loosy|loosing|ouput|seperate|preceed|upto|paket|posible|unkown|inpossible|dimention|acheive|funtions|overriden|outputing|seperation|initalize|compatibilty|bistream|knwon|unknwon|choosen|additonal|gurantee|availble|wich|begining|milisecond|missmatch|threshhold)\b' 'common typos' $*
|
||||
|
||||
hiegrep 'av_log\( *NULL' 'Missing context in av_log' $*
|
||||
hiegrep '[^sn]printf' 'Please use av_log' $*
|
||||
hiegrep '\bmalloc' 'Please use av_malloc' $*
|
||||
hiegrep '\) *av_malloc' 'useless casts' $*
|
||||
hiegrep ':\+ *'"$ERE_PRITYP"' *inline' 'non static inline or strangely ordered inline+static' $*
|
||||
hiegrep "$ERE_FUNCS"' *\)' 'missing void' $*
|
||||
hiegrep '(sprintf|strcat|strcpy)' 'Possible security issue, make sure this is safe or use snprintf/av_strl*' $*
|
||||
hiegrep '/ *(2|4|8|16|32|64|128|256|512|1024|2048|4096|8192|16384|32768|65536)[^0-9]' 'divide by 2^x could use >> maybe' $*
|
||||
hiegrep '#(el|)if *(0|1)' 'useless #if' $*
|
||||
hiegrep 'if *\( *(0|1) *\)' 'useless if()' $*
|
||||
hiegrep '& *[a-zA-Z0-9_]* *\[ *0 *\]' 'useless & [0]' $*
|
||||
hiegrep '(\( *[0-9] *(&&|\|\|)|(&&|\|\|) *[0-9] *\))' 'overriding condition' $*
|
||||
hiegrep '(:\+|,|;)( *|static|\*)*'"$ERE_PRITYP"' *\*( |\*)*(src|source|input|in[^a-z])' 'missing const?' $*
|
||||
hiegrep '(:\+|,|;)( *|static|\*)*'"$ERE_PRITYP"' *(src|source|input|in)([0-9A-Z_][0-9A-Za-z_]*){1,} *\[' 'missing const (test2)?' $*
|
||||
hiegrep ' *static *'"$ERE_FUNCS"'[^)]*\);' 'static prototype, maybe you should reorder your functions' $*
|
||||
hiegrep '@file: *[a-zA-Z0-9_]' 'doxy filetag with filename can in the future cause problems when forgotten during a rename' $*
|
||||
hiegrep '\bassert' 'Please use av_assert0, av_assert1 or av_assert2' $*
|
||||
|
||||
hiegrep2 '\.long_name *=' 'NULL_IF_CONFIG_SMAL' 'missing NULL_IF_CONFIG_SMAL' $*
|
||||
hiegrep2 '\.pix_fmts *= *\(' 'const' 'missing const for pix_fmts array' $*
|
||||
hiegrep2 '\.sample_fmts *= *\(' 'const' 'missing const for sample_fmts array' $*
|
||||
hiegrep2 '\.supported_framerates *= *\(' 'const' 'missing const for supported_framerates array' $*
|
||||
hiegrep2 '\.channel_layouts *= *\(' 'const' 'missing const for channel_layouts array' $*
|
||||
|
||||
#$EGREP $OPT '^\+.*const ' $*| $GREP -v 'static'> $TMP && printf '\nnon static const\n'
|
||||
#cat $TMP
|
||||
|
||||
hiegrep2 "$ERE_TYPES" '(static|av_|ff_|typedef|:\+[^a-zA-Z_])' 'Non static with no ff_/av_ prefix' $*
|
||||
|
||||
hiegrep ':\+[^}#]*else' 'missing } prior to else' $*
|
||||
hiegrep '(if|while|for)\(' 'missing whitespace between keyword and ( (feel free to ignore)' $*
|
||||
hiegrep '(else|do){' 'missing whitespace between keyword and { (feel free to ignore)' $*
|
||||
hiegrep '}(else|while)' 'missing whitespace between } and keyword (feel free to ignore)' $*
|
||||
|
||||
#FIXME this should print the previous statement maybe
|
||||
hiegrep ':\+ *{ *$' '{ should be on the same line as the related previous statement' $*
|
||||
|
||||
|
||||
rm $TMP
|
||||
for i in $($GREP -H '^+.*@param' $*| sed 's/^\([^:]*\):.*@param\(\[.*\]\|\) *\([a-zA-Z0-9_]*\) .*$/\1:\3/') ; do
|
||||
doxpar=$(echo $i | sed 's/^.*:\(.*\)$/\1/')
|
||||
file=$(echo $i | sed 's/^\([^:]*\):.*$/\1/')
|
||||
$GREP " *$doxpar *[),]" $file | $GREP -v '@param' >/dev/null || $GREP --color=always "@param *$doxpar" $file >>$TMP
|
||||
done
|
||||
if test -e $TMP ; then
|
||||
printf '\nmismatching doxy params\n'
|
||||
cat $TMP
|
||||
fi
|
||||
|
||||
$EGREP -B2 $OPT '^(\+|) *('"$ERE_TYPES"'|# *define)' $* | $EGREP -A2 --color=always '(:|-)\+[^/]*/(\*([^*]|$)|/([^/]|$))' > $TMP && printf "\n Non doxy comments\n"
|
||||
cat $TMP
|
||||
|
||||
rm $TMP
|
||||
for i in \
|
||||
$($EGREP -H '^\+ *'"$ERE_TYPES" $* |\
|
||||
$GREP -v '(' | $EGREP -v '\Wgoto\W' |\
|
||||
xargs -d '\n' -n 1 |\
|
||||
$GREP -o '[* ][* ]*[a-zA-Z][0-9a-zA-Z_]* *[,;=]' |\
|
||||
sed 's/.[* ]*\([a-zA-Z][0-9a-zA-Z_]*\) *[,;=]/\1/') \
|
||||
; do
|
||||
echo $i | $GREP '^NULL$' && continue
|
||||
$EGREP $i' *(\+|-|\*|/|\||&|%|)=[^=]' $* >/dev/null || echo "possibly never written:"$i >> $TMP
|
||||
$EGREP '(=|\(|return).*'$i'(==|[^=])*$' $* >/dev/null || echo "possibly never read :"$i >> $TMP
|
||||
$EGREP -o $i' *((\+|-|\*|/|\||&|%|)=[^=]|\+\+|--) *(0x|)[0-9]*(;|)' $* |\
|
||||
$EGREP -v $i' *= *(0x|)[0-9]{1,};'>/dev/null || echo "possibly constant :"$i >> $TMP
|
||||
done
|
||||
if test -e $TMP ; then
|
||||
printf '\npossibly unused variables\n'
|
||||
cat $TMP
|
||||
fi
|
||||
|
||||
$GREP '^+++ .*Changelog' $* >/dev/null || printf "\nMissing changelog entry (ignore if minor change)\n"
|
||||
|
||||
cat $* | $GREP -v '^-' | tr '\n' '@' | $EGREP --color=always -o '(fprintf|av_log|printf)\([^)]*\)[+ ;@]*\1' >$TMP && printf "\nMergeable calls\n"
|
||||
cat $TMP | tr '@' '\n'
|
||||
|
||||
cat $* | tr '\n' '@' | $EGREP --color=always -o '\+ *if *\( *([A-Za-z0-9_]*) *[<>]=? *[0-9]* *\) * \1 *= *[0-9]* *;[ @\\+]*else *if *\( *\1 *[<>]=? *[0-9]* *\) *\1 *= *[0-9]* *;' >$TMP && printf "\nav_clip / av_clip_uint8 / av_clip_int16 / ...\n"
|
||||
cat $TMP | tr '@' '\n'
|
||||
|
||||
cat $* | tr '\n' '@' | $EGREP --color=always -o '\+ *if *\( *([A-Za-z0-9_]*) *[<>]=? *([A-Za-z0-9_]*) *\)[ @\\+]*(\1|\2) *= *(\1|\2) *;' >$TMP && printf "\nFFMIN/FFMAX\n"
|
||||
cat $TMP | tr '@' '\n'
|
||||
|
||||
cat $* | tr '\n' '@' | $EGREP --color=always -o '\+ *if *\( *([A-Za-z0-9_]*) *\)[ @\\+]*av_free(p|) *\( *(&|) *\1[^-.]' >$TMP && printf "\nav_free(NULL) is safe\n"
|
||||
cat $TMP | tr '@' '\n'
|
||||
|
||||
cat $* | tr '\n' '@' | $EGREP --color=always -o '[^a-zA-Z0-9_]([a-zA-Z0-9_]*) *= *av_malloc *\([^)]*\)[ @;\\+]*memset *\( *\1' >$TMP && printf "\nav_mallocz()\n"
|
||||
cat $TMP | tr '@' '\n'
|
||||
|
||||
|
||||
# does not work
|
||||
#cat $* | tr '\n' '@' | $EGREP -o '[^a-zA-Z_0-9]([a-zA-Z][a-zA-Z_0-9]*) *=[^=].*\1' | $EGREP -o '[^a-zA-Z_0-9]([a-zA-Z][a-zA-Z_0-9]*) *=[^=].*\1 *=[^=]' >$TMP && printf "\nPossibly written 2x before read\n"
|
||||
#cat $TMP | tr '@' '\n'
|
||||
|
||||
exit
|
||||
|
||||
TODO/idea list:
|
||||
|
||||
for all demuxers & muxers
|
||||
$EGREP for "avctx->priv_data"
|
||||
|
||||
vertical align =
|
||||
/* and * align
|
||||
arrays fitting in smaller types
|
||||
variables written to twice with no interspaced read
|
||||
memset(block, 0, 6*64*sizeof(int16_t)); -> clear_blocks
|
||||
check existence of long_name in AVCodec
|
||||
check that the patch does not touch codec & (de)muxer layer at the same time ->split
|
||||
|
||||
write a regression test containing at least a line that triggers each warning once
|
134
externals/ffmpeg/tools/pktdumper.c
vendored
Executable file
134
externals/ffmpeg/tools/pktdumper.c
vendored
Executable file
@@ -0,0 +1,134 @@
|
||||
/*
|
||||
* Copyright (c) 2005 Francois Revol
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* 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 FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <limits.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#if HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#if HAVE_IO_H
|
||||
#include <io.h>
|
||||
#endif
|
||||
|
||||
#include "libavutil/avstring.h"
|
||||
#include "libavutil/time.h"
|
||||
#include "libavformat/avformat.h"
|
||||
|
||||
#define FILENAME_BUF_SIZE 4096
|
||||
#define PKTFILESUFF "_%08" PRId64 "_%02d_%010" PRId64 "_%06d_%c.bin"
|
||||
|
||||
static int usage(int ret)
|
||||
{
|
||||
fprintf(stderr, "Dump (up to maxpkts) AVPackets as they are demuxed by libavformat.\n");
|
||||
fprintf(stderr, "Each packet is dumped in its own file named like\n");
|
||||
fprintf(stderr, "$(basename file.ext)_$PKTNUM_$STREAMINDEX_$STAMP_$SIZE_$FLAGS.bin\n");
|
||||
fprintf(stderr, "pktdumper [-nw] file [maxpkts]\n");
|
||||
fprintf(stderr, "-n\twrite No file at all, only demux.\n");
|
||||
fprintf(stderr, "-w\tWait at end of processing instead of quitting.\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
char fntemplate[FILENAME_BUF_SIZE];
|
||||
char pktfilename[FILENAME_BUF_SIZE];
|
||||
AVFormatContext *fctx = NULL;
|
||||
AVPacket pkt;
|
||||
int64_t pktnum = 0;
|
||||
int64_t maxpkts = 0;
|
||||
int donotquit = 0;
|
||||
int nowrite = 0;
|
||||
int err;
|
||||
|
||||
if ((argc > 1) && !strncmp(argv[1], "-", 1)) {
|
||||
if (strchr(argv[1], 'w'))
|
||||
donotquit = 1;
|
||||
if (strchr(argv[1], 'n'))
|
||||
nowrite = 1;
|
||||
argv++;
|
||||
argc--;
|
||||
}
|
||||
if (argc < 2)
|
||||
return usage(1);
|
||||
if (argc > 2)
|
||||
maxpkts = atoi(argv[2]);
|
||||
av_strlcpy(fntemplate, argv[1], sizeof(fntemplate));
|
||||
if (strrchr(argv[1], '/'))
|
||||
av_strlcpy(fntemplate, strrchr(argv[1], '/') + 1, sizeof(fntemplate));
|
||||
if (strrchr(fntemplate, '.'))
|
||||
*strrchr(fntemplate, '.') = '\0';
|
||||
if (strchr(fntemplate, '%')) {
|
||||
fprintf(stderr, "cannot use filenames containing '%%'\n");
|
||||
return usage(1);
|
||||
}
|
||||
if (strlen(fntemplate) + sizeof(PKTFILESUFF) >= sizeof(fntemplate) - 1) {
|
||||
fprintf(stderr, "filename too long\n");
|
||||
return usage(1);
|
||||
}
|
||||
strcat(fntemplate, PKTFILESUFF);
|
||||
printf("FNTEMPLATE: '%s'\n", fntemplate);
|
||||
|
||||
err = avformat_open_input(&fctx, argv[1], NULL, NULL);
|
||||
if (err < 0) {
|
||||
fprintf(stderr, "cannot open input: error %d\n", err);
|
||||
return 1;
|
||||
}
|
||||
|
||||
err = avformat_find_stream_info(fctx, NULL);
|
||||
if (err < 0) {
|
||||
fprintf(stderr, "avformat_find_stream_info: error %d\n", err);
|
||||
return 1;
|
||||
}
|
||||
|
||||
av_init_packet(&pkt);
|
||||
|
||||
while ((err = av_read_frame(fctx, &pkt)) >= 0) {
|
||||
int fd;
|
||||
snprintf(pktfilename, sizeof(pktfilename), fntemplate, pktnum,
|
||||
pkt.stream_index, pkt.pts, pkt.size,
|
||||
(pkt.flags & AV_PKT_FLAG_KEY) ? 'K' : '_');
|
||||
printf(PKTFILESUFF "\n", pktnum, pkt.stream_index, pkt.pts, pkt.size,
|
||||
(pkt.flags & AV_PKT_FLAG_KEY) ? 'K' : '_');
|
||||
if (!nowrite) {
|
||||
fd = open(pktfilename, O_WRONLY | O_CREAT, 0644);
|
||||
err = write(fd, pkt.data, pkt.size);
|
||||
if (err < 0) {
|
||||
fprintf(stderr, "write: error %d\n", err);
|
||||
return 1;
|
||||
}
|
||||
close(fd);
|
||||
}
|
||||
av_packet_unref(&pkt);
|
||||
pktnum++;
|
||||
if (maxpkts && (pktnum >= maxpkts))
|
||||
break;
|
||||
}
|
||||
|
||||
avformat_close_input(&fctx);
|
||||
|
||||
while (donotquit)
|
||||
av_usleep(60 * 1000000);
|
||||
|
||||
return 0;
|
||||
}
|
164
externals/ffmpeg/tools/plotframes
vendored
Executable file
164
externals/ffmpeg/tools/plotframes
vendored
Executable file
@@ -0,0 +1,164 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
# Copyright (c) 2007-2013 Stefano Sabatini
|
||||
#
|
||||
# This file is part of FFmpeg.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# 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 FFmpeg; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
=head1 NAME
|
||||
|
||||
plotframes - Plot video frame sizes using ffprobe and gnuplot
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
plotframes [I<options>] [I<input>]
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
plotframes reads a multimedia files with ffprobe, and plots the
|
||||
collected video sizes with gnuplot.
|
||||
|
||||
=head1 OPTIONS
|
||||
|
||||
=over 4
|
||||
|
||||
=item B<--input|-i> I<infile>
|
||||
|
||||
Specify multimedia file to read. This is the file passed to the
|
||||
ffprobe command. If not specified it is the first argument passed to
|
||||
the script.
|
||||
|
||||
=item B<--help|--usage|-h|-?>
|
||||
|
||||
Print a brief help message and exit.
|
||||
|
||||
=item B<--manpage|-m>
|
||||
|
||||
Print the man page.
|
||||
|
||||
=item B<--output|-o> I<outfile>
|
||||
|
||||
Set the name of the output used by gnuplot. If not specified no output
|
||||
is created. Must be used in conjunction with the B<terminal> option.
|
||||
|
||||
=item B<--stream|--s> I<stream_specifier>
|
||||
|
||||
Specify stream. The value must be a string containing a stream
|
||||
specifier. Default value is "v".
|
||||
|
||||
=item B<--terminal|-t> I<terminal>
|
||||
|
||||
Set the name of the terminal used by gnuplot. By default it is
|
||||
"x11". Must be used in conjunction with the B<output> option. Check
|
||||
the gnuplot manual for the valid values.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
ffprobe(1), gnuplot(1)
|
||||
|
||||
=cut
|
||||
|
||||
use warnings;
|
||||
use strict;
|
||||
|
||||
use File::Temp;
|
||||
use JSON -support_by_pp;
|
||||
use Getopt::Long;
|
||||
use Pod::Usage;
|
||||
|
||||
my $input = $ARGV[0];
|
||||
my $stream_specifier = "v";
|
||||
my $gnuplot_terminal = "x11";
|
||||
my $gnuplot_output;
|
||||
|
||||
GetOptions (
|
||||
'input|i=s' => \$input,
|
||||
'help|usage|?|h' => sub { pod2usage ( { -verbose => 1, -exitval => 0 }) },
|
||||
'manpage|m' => sub { pod2usage ( { -verbose => 2, -exitval => 0 }) },
|
||||
'stream|s=s' => \$stream_specifier,
|
||||
'terminal|t=s' => \$gnuplot_terminal,
|
||||
'output|o=s' => \$gnuplot_output,
|
||||
) or pod2usage( { -message=> "Parsing error", -verbose => 1, -exitval => 1 });
|
||||
|
||||
die "You must specify an input file\n" unless $input;
|
||||
|
||||
# fetch data
|
||||
my @cmd = (qw{ffprobe -show_entries frame -select_streams}, $stream_specifier, "-of", "json", $input);
|
||||
print STDERR "Executing command: @cmd\n";
|
||||
my $json_struct;
|
||||
{
|
||||
open(FH, "-|", @cmd) or die "ffprobe command failed: $!\n";
|
||||
local $/;
|
||||
my $json_text = <FH>;
|
||||
close FH;
|
||||
die "ffprobe command failed" if $?;
|
||||
eval { $json_struct = decode_json($json_text); };
|
||||
die "JSON parsing error: $@\n" if $@;
|
||||
}
|
||||
|
||||
# collect and print frame statistics per pict_type
|
||||
my %stats;
|
||||
my $frames = $json_struct->{frames};
|
||||
my $frame_count = 0;
|
||||
foreach my $frame (@{$frames}) {
|
||||
my $type = $frame->{pict_type};
|
||||
$frame->{count} = $frame_count++;
|
||||
if (not $stats{$type}) {
|
||||
$stats{$type}->{tmpfile} = File::Temp->new(SUFFIX => '.dat');
|
||||
my $fn = $stats{$type}->{tmpfile}->filename;
|
||||
open($stats{$type}->{fh}, ">", $fn) or die "Can't open $fn";
|
||||
}
|
||||
|
||||
print { $stats{$type}->{fh} }
|
||||
"$frame->{count} ", $frame->{pkt_size} * 8 / 1000, "\n";
|
||||
}
|
||||
foreach (keys %stats) { close $stats{$_}->{fh}; }
|
||||
|
||||
# write gnuplot script
|
||||
my %type_color_map = (
|
||||
"I" => "red",
|
||||
"P" => "green",
|
||||
"B" => "blue"
|
||||
);
|
||||
|
||||
my $gnuplot_script_tmpfile = File::Temp->new(SUFFIX => '.gnuplot');
|
||||
my $fn = $gnuplot_script_tmpfile->filename;
|
||||
open(FH, ">", $fn) or die "Couldn't open $fn: $!";
|
||||
print FH << "EOF";
|
||||
set title "video frame sizes"
|
||||
set xlabel "frame time"
|
||||
set ylabel "frame size (Kbits)"
|
||||
set grid
|
||||
set terminal "$gnuplot_terminal"
|
||||
EOF
|
||||
|
||||
print FH "set output \"$gnuplot_output\"\n" if $gnuplot_output;
|
||||
print FH "plot";
|
||||
my $sep = "";
|
||||
foreach my $type (keys %stats) {
|
||||
my $fn = $stats{$type}->{tmpfile}->filename;
|
||||
print FH "$sep\"$fn\" title \"$type frames\" with impulses";
|
||||
print FH " linecolor rgb \"$type_color_map{$type}\"" if $type_color_map{$type};
|
||||
$sep = ", ";
|
||||
}
|
||||
close FH;
|
||||
|
||||
# launch gnuplot with the generated script
|
||||
system ("gnuplot", "--persist", $gnuplot_script_tmpfile->filename);
|
202
externals/ffmpeg/tools/probetest.c
vendored
Executable file
202
externals/ffmpeg/tools/probetest.c
vendored
Executable file
@@ -0,0 +1,202 @@
|
||||
/*
|
||||
* copyright (c) 2009 Michael Niedermayer <michaelni@gmx.at>
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* 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 FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "libavformat/avformat.h"
|
||||
#include "libavcodec/put_bits.h"
|
||||
#include "libavutil/lfg.h"
|
||||
#include "libavutil/timer.h"
|
||||
|
||||
#define MAX_FORMATS 1000 //this must be larger than the number of formats
|
||||
static int score_array[MAX_FORMATS];
|
||||
static int64_t time_array[MAX_FORMATS];
|
||||
static int failures = 0;
|
||||
static const char *single_format;
|
||||
|
||||
#ifndef AV_READ_TIME
|
||||
#define AV_READ_TIME(x) 0
|
||||
#endif
|
||||
|
||||
static void probe(AVProbeData *pd, int type, int p, int size)
|
||||
{
|
||||
int i = 0;
|
||||
const AVInputFormat *fmt = NULL;
|
||||
void *fmt_opaque = NULL;
|
||||
|
||||
while ((fmt = av_demuxer_iterate(&fmt_opaque))) {
|
||||
if (fmt->flags & AVFMT_NOFILE)
|
||||
continue;
|
||||
if (fmt->read_probe &&
|
||||
(!single_format || !strcmp(single_format, fmt->name))
|
||||
) {
|
||||
int score;
|
||||
int64_t start = AV_READ_TIME();
|
||||
score = fmt->read_probe(pd);
|
||||
time_array[i] += AV_READ_TIME() - start;
|
||||
if (score > score_array[i] && score > AVPROBE_SCORE_MAX / 4) {
|
||||
score_array[i] = score;
|
||||
fprintf(stderr,
|
||||
"Failure of %s probing code with score=%d type=%d p=%X size=%d\n",
|
||||
fmt->name, score, type, p, size);
|
||||
failures++;
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
static void print_times(void)
|
||||
{
|
||||
int i = 0;
|
||||
const AVInputFormat *fmt = NULL;
|
||||
void *fmt_opaque = NULL;
|
||||
|
||||
while ((fmt = av_demuxer_iterate(&fmt_opaque))) {
|
||||
if (fmt->flags & AVFMT_NOFILE)
|
||||
continue;
|
||||
if (time_array[i] > 1000000) {
|
||||
fprintf(stderr, "%12"PRIu64" cycles, %12s\n",
|
||||
time_array[i], fmt->name);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
static int read_int(char *arg) {
|
||||
int ret;
|
||||
|
||||
if (!arg || !*arg)
|
||||
return -1;
|
||||
ret = strtol(arg, &arg, 0);
|
||||
if (*arg)
|
||||
return -1;
|
||||
return ret;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
unsigned int p, i, type, size, retry;
|
||||
AVProbeData pd = { 0 };
|
||||
AVLFG state;
|
||||
PutBitContext pb;
|
||||
int retry_count= 4097;
|
||||
int max_size = 65537;
|
||||
int j;
|
||||
|
||||
for (j = i = 1; i<argc; i++) {
|
||||
if (!strcmp(argv[i], "-f") && i+1<argc && !single_format) {
|
||||
single_format = argv[++i];
|
||||
} else if (read_int(argv[i])>0 && j == 1) {
|
||||
retry_count = read_int(argv[i]);
|
||||
j++;
|
||||
} else if (read_int(argv[i])>0 && j == 2) {
|
||||
max_size = read_int(argv[i]);
|
||||
j++;
|
||||
} else {
|
||||
fprintf(stderr, "probetest [-f <input format>] [<retry_count> [<max_size>]]\n");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (max_size > 1000000000U/8) {
|
||||
fprintf(stderr, "max_size out of bounds\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (retry_count > 1000000000U) {
|
||||
fprintf(stderr, "retry_count out of bounds\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
av_lfg_init(&state, 0xdeadbeef);
|
||||
|
||||
pd.buf = NULL;
|
||||
for (size = 1; size < max_size; size *= 2) {
|
||||
pd.buf_size = size;
|
||||
pd.buf = av_realloc(pd.buf, size + AVPROBE_PADDING_SIZE);
|
||||
pd.filename = "";
|
||||
|
||||
if (!pd.buf) {
|
||||
fprintf(stderr, "out of memory\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
memset(pd.buf, 0, size + AVPROBE_PADDING_SIZE);
|
||||
|
||||
fprintf(stderr, "testing size=%d\n", size);
|
||||
|
||||
for (retry = 0; retry < retry_count; retry += FFMAX(size, 32)) {
|
||||
for (type = 0; type < 4; type++) {
|
||||
for (p = 0; p < 4096; p++) {
|
||||
unsigned hist = 0;
|
||||
init_put_bits(&pb, pd.buf, size);
|
||||
switch (type) {
|
||||
case 0:
|
||||
for (i = 0; i < size * 8; i++)
|
||||
put_bits(&pb, 1, (av_lfg_get(&state) & 0xFFFFFFFF) > p << 20);
|
||||
break;
|
||||
case 1:
|
||||
for (i = 0; i < size * 8; i++) {
|
||||
unsigned int p2 = hist ? p & 0x3F : (p >> 6);
|
||||
unsigned int v = (av_lfg_get(&state) & 0xFFFFFFFF) > p2 << 26;
|
||||
put_bits(&pb, 1, v);
|
||||
hist = v;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
for (i = 0; i < size * 8; i++) {
|
||||
unsigned int p2 = (p >> (hist * 3)) & 7;
|
||||
unsigned int v = (av_lfg_get(&state) & 0xFFFFFFFF) > p2 << 29;
|
||||
put_bits(&pb, 1, v);
|
||||
hist = (2 * hist + v) & 3;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
for (i = 0; i < size; i++) {
|
||||
int c = 0;
|
||||
while (p & 63) {
|
||||
c = (av_lfg_get(&state) & 0xFFFFFFFF) >> 24;
|
||||
if (c >= 'a' && c <= 'z' && (p & 1))
|
||||
break;
|
||||
else if (c >= 'A' && c <= 'Z' && (p & 2))
|
||||
break;
|
||||
else if (c >= '0' && c <= '9' && (p & 4))
|
||||
break;
|
||||
else if (c == ' ' && (p & 8))
|
||||
break;
|
||||
else if (c == 0 && (p & 16))
|
||||
break;
|
||||
else if (c == 1 && (p & 32))
|
||||
break;
|
||||
}
|
||||
pd.buf[i] = c;
|
||||
}
|
||||
}
|
||||
flush_put_bits(&pb);
|
||||
probe(&pd, type, p, size);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(AV_READ_TIME())
|
||||
print_times();
|
||||
return failures;
|
||||
}
|
56
externals/ffmpeg/tools/python/convert.py
vendored
Executable file
56
externals/ffmpeg/tools/python/convert.py
vendored
Executable file
@@ -0,0 +1,56 @@
|
||||
# Copyright (c) 2019 Guo Yejun
|
||||
#
|
||||
# This file is part of FFmpeg.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# 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 FFmpeg; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
# ==============================================================================
|
||||
|
||||
# verified with Python 3.5.2 on Ubuntu 16.04
|
||||
import argparse
|
||||
import os
|
||||
from convert_from_tensorflow import *
|
||||
|
||||
def get_arguments():
|
||||
parser = argparse.ArgumentParser(description='generate native mode model with weights from deep learning model')
|
||||
parser.add_argument('--outdir', type=str, default='./', help='where to put generated files')
|
||||
parser.add_argument('--infmt', type=str, default='tensorflow', help='format of the deep learning model')
|
||||
parser.add_argument('infile', help='path to the deep learning model with weights')
|
||||
parser.add_argument('--dump4tb', type=str, default='no', help='dump file for visualization in tensorboard')
|
||||
|
||||
return parser.parse_args()
|
||||
|
||||
def main():
|
||||
args = get_arguments()
|
||||
|
||||
if not os.path.isfile(args.infile):
|
||||
print('the specified input file %s does not exist' % args.infile)
|
||||
exit(1)
|
||||
|
||||
if not os.path.exists(args.outdir):
|
||||
print('create output directory %s' % args.outdir)
|
||||
os.mkdir(args.outdir)
|
||||
|
||||
basefile = os.path.split(args.infile)[1]
|
||||
basefile = os.path.splitext(basefile)[0]
|
||||
outfile = os.path.join(args.outdir, basefile) + '.model'
|
||||
dump4tb = False
|
||||
if args.dump4tb.lower() in ('yes', 'true', 't', 'y', '1'):
|
||||
dump4tb = True
|
||||
|
||||
if args.infmt == 'tensorflow':
|
||||
convert_from_tensorflow(args.infile, outfile, dump4tb)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
459
externals/ffmpeg/tools/python/convert_from_tensorflow.py
vendored
Executable file
459
externals/ffmpeg/tools/python/convert_from_tensorflow.py
vendored
Executable file
@@ -0,0 +1,459 @@
|
||||
# Copyright (c) 2019 Guo Yejun
|
||||
#
|
||||
# This file is part of FFmpeg.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# 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 FFmpeg; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
# ==============================================================================
|
||||
|
||||
import tensorflow as tf
|
||||
import numpy as np
|
||||
import sys, struct
|
||||
import convert_header as header
|
||||
|
||||
__all__ = ['convert_from_tensorflow']
|
||||
|
||||
class Operand(object):
|
||||
IOTYPE_INPUT = 1
|
||||
IOTYPE_OUTPUT = 2
|
||||
IOTYPE_INTERMEDIATE = IOTYPE_INPUT | IOTYPE_OUTPUT
|
||||
DTYPE_FLOAT = 1
|
||||
DTYPE_UINT8 = 4
|
||||
index = 0
|
||||
def __init__(self, name, dtype, dims):
|
||||
self.name = name
|
||||
self.dtype = dtype
|
||||
self.dims = dims
|
||||
self.iotype = 0
|
||||
self.used_count = 0
|
||||
self.index = Operand.index
|
||||
Operand.index = Operand.index + 1
|
||||
self.iotype2str = {Operand.IOTYPE_INPUT: 'in', Operand.IOTYPE_OUTPUT: 'out', Operand.IOTYPE_INTERMEDIATE: 'inout'}
|
||||
self.dtype2str = {Operand.DTYPE_FLOAT: 'DT_FLOAT', Operand.DTYPE_UINT8: 'DT_UINT8'}
|
||||
|
||||
def add_iotype(self, iotype):
|
||||
self.iotype = self.iotype | iotype
|
||||
if iotype == Operand.IOTYPE_INPUT:
|
||||
self.used_count = self.used_count + 1
|
||||
|
||||
def __str__(self):
|
||||
return "{}: (name: {}, iotype: {}, dtype: {}, dims: ({},{},{},{}) used_count: {})".format(self.index,
|
||||
self.name, self.iotype2str[self.iotype], self.dtype2str[self.dtype],
|
||||
self.dims[0], self.dims[1], self.dims[2], self.dims[3], self.used_count)
|
||||
|
||||
def __lt__(self, other):
|
||||
return self.index < other.index
|
||||
|
||||
class TFConverter:
|
||||
def __init__(self, graph_def, nodes, outfile, dump4tb):
|
||||
self.graph_def = graph_def
|
||||
self.nodes = nodes
|
||||
self.outfile = outfile
|
||||
self.dump4tb = dump4tb
|
||||
self.layer_number = 0
|
||||
self.output_names = []
|
||||
self.name_node_dict = {}
|
||||
self.edges = {}
|
||||
self.conv_activations = {'Relu':0, 'Tanh':1, 'Sigmoid':2, 'None':3, 'LeakyRelu':4}
|
||||
self.conv_paddings = {'VALID':0, 'SAME':1}
|
||||
self.converted_nodes = set()
|
||||
self.conv2d_scope_names = set()
|
||||
self.conv2d_scopename_inputname_dict = {}
|
||||
self.op2code = {'Conv2D':1, 'DepthToSpace':2, 'MirrorPad':3, 'Maximum':4, 'MathBinary':5, 'MathUnary':6}
|
||||
self.mathbin2code = {'Sub':0, 'Add':1, 'Mul':2, 'RealDiv':3, 'Minimum':4}
|
||||
self.mathun2code = {'Abs':0}
|
||||
self.mirrorpad_mode = {'CONSTANT':0, 'REFLECT':1, 'SYMMETRIC':2}
|
||||
self.name_operand_dict = {}
|
||||
|
||||
|
||||
def add_operand(self, name, type):
|
||||
node = self.name_node_dict[name]
|
||||
if name not in self.name_operand_dict:
|
||||
dtype = node.attr['dtype'].type
|
||||
if dtype == 0:
|
||||
dtype = node.attr['T'].type
|
||||
dims = [-1,-1,-1,-1]
|
||||
if 'shape' in node.attr:
|
||||
dims[0] = node.attr['shape'].shape.dim[0].size
|
||||
dims[1] = node.attr['shape'].shape.dim[1].size
|
||||
dims[2] = node.attr['shape'].shape.dim[2].size
|
||||
dims[3] = node.attr['shape'].shape.dim[3].size
|
||||
operand = Operand(name, dtype, dims)
|
||||
self.name_operand_dict[name] = operand;
|
||||
self.name_operand_dict[name].add_iotype(type)
|
||||
return self.name_operand_dict[name].index
|
||||
|
||||
|
||||
def dump_for_tensorboard(self):
|
||||
graph = tf.get_default_graph()
|
||||
tf.import_graph_def(self.graph_def, name="")
|
||||
tf.summary.FileWriter('/tmp/graph', graph)
|
||||
print('graph saved, run "tensorboard --logdir=/tmp/graph" to see it')
|
||||
|
||||
|
||||
def get_conv2d_params(self, conv2d_scope_name):
|
||||
knode = self.name_node_dict[conv2d_scope_name + '/kernel']
|
||||
bnode = self.name_node_dict[conv2d_scope_name + '/bias']
|
||||
|
||||
if conv2d_scope_name + '/dilation_rate' in self.name_node_dict:
|
||||
dnode = self.name_node_dict[conv2d_scope_name + '/dilation_rate']
|
||||
else:
|
||||
dnode = None
|
||||
|
||||
# the BiasAdd name is possible be changed into the output name,
|
||||
# if activation is None, and BiasAdd.next is the last op which is Identity
|
||||
if conv2d_scope_name + '/BiasAdd' in self.edges:
|
||||
anode = self.edges[conv2d_scope_name + '/BiasAdd'][0]
|
||||
if anode.op not in self.conv_activations:
|
||||
anode = None
|
||||
else:
|
||||
anode = None
|
||||
return knode, bnode, dnode, anode
|
||||
|
||||
|
||||
def dump_complex_conv2d_to_file(self, node, f):
|
||||
assert(node.op == 'Conv2D')
|
||||
self.layer_number = self.layer_number + 1
|
||||
self.converted_nodes.add(node.name)
|
||||
|
||||
scope_name = TFConverter.get_scope_name(node.name)
|
||||
#knode for kernel, bnode for bias, dnode for dilation, anode for activation
|
||||
knode, bnode, dnode, anode = self.get_conv2d_params(scope_name)
|
||||
|
||||
if dnode is not None:
|
||||
dilation = struct.unpack('i', dnode.attr['value'].tensor.tensor_content[0:4])[0]
|
||||
else:
|
||||
dilation = 1
|
||||
|
||||
if anode is not None:
|
||||
activation = anode.op
|
||||
else:
|
||||
activation = 'None'
|
||||
|
||||
padding = node.attr['padding'].s.decode("utf-8")
|
||||
# conv2d with dilation > 1 generates tens of nodes, not easy to parse them, so use this tricky method.
|
||||
if dilation > 1 and scope_name + '/stack' in self.name_node_dict:
|
||||
if self.name_node_dict[scope_name + '/stack'].op == "Const":
|
||||
padding = 'SAME'
|
||||
padding = self.conv_paddings[padding]
|
||||
|
||||
ktensor = knode.attr['value'].tensor
|
||||
filter_height = ktensor.tensor_shape.dim[0].size
|
||||
filter_width = ktensor.tensor_shape.dim[1].size
|
||||
in_channels = ktensor.tensor_shape.dim[2].size
|
||||
out_channels = ktensor.tensor_shape.dim[3].size
|
||||
kernel = np.frombuffer(ktensor.tensor_content, dtype=np.float32)
|
||||
kernel = kernel.reshape(filter_height, filter_width, in_channels, out_channels)
|
||||
kernel = np.transpose(kernel, [3, 0, 1, 2])
|
||||
|
||||
has_bias = 1
|
||||
np.array([self.op2code[node.op], dilation, padding, self.conv_activations[activation], in_channels, out_channels, filter_height, has_bias], dtype=np.uint32).tofile(f)
|
||||
kernel.tofile(f)
|
||||
|
||||
btensor = bnode.attr['value'].tensor
|
||||
if btensor.tensor_shape.dim[0].size == 1:
|
||||
bias = struct.pack("f", btensor.float_val[0])
|
||||
else:
|
||||
bias = btensor.tensor_content
|
||||
f.write(bias)
|
||||
|
||||
input_name = self.conv2d_scopename_inputname_dict[scope_name]
|
||||
input_operand_index = self.add_operand(input_name, Operand.IOTYPE_INPUT)
|
||||
|
||||
if anode is not None:
|
||||
output_operand_index = self.add_operand(anode.name, Operand.IOTYPE_OUTPUT)
|
||||
else:
|
||||
output_operand_index = self.add_operand(self.edges[bnode.name][0].name, Operand.IOTYPE_OUTPUT)
|
||||
np.array([input_operand_index, output_operand_index], dtype=np.uint32).tofile(f)
|
||||
|
||||
|
||||
def dump_simple_conv2d_to_file(self, node, f):
|
||||
assert(node.op == 'Conv2D')
|
||||
self.layer_number = self.layer_number + 1
|
||||
self.converted_nodes.add(node.name)
|
||||
|
||||
node0 = self.name_node_dict[node.input[0]]
|
||||
node1 = self.name_node_dict[node.input[1]]
|
||||
if node0.op == 'Const':
|
||||
knode = node0
|
||||
input_name = node.input[1]
|
||||
else:
|
||||
knode = node1
|
||||
input_name = node.input[0]
|
||||
|
||||
ktensor = knode.attr['value'].tensor
|
||||
filter_height = ktensor.tensor_shape.dim[0].size
|
||||
filter_width = ktensor.tensor_shape.dim[1].size
|
||||
in_channels = ktensor.tensor_shape.dim[2].size
|
||||
out_channels = ktensor.tensor_shape.dim[3].size
|
||||
if filter_height * filter_width * in_channels * out_channels == 1:
|
||||
kernel = np.float32(ktensor.float_val[0])
|
||||
else:
|
||||
kernel = np.frombuffer(ktensor.tensor_content, dtype=np.float32)
|
||||
kernel = kernel.reshape(filter_height, filter_width, in_channels, out_channels)
|
||||
kernel = np.transpose(kernel, [3, 0, 1, 2])
|
||||
|
||||
has_bias = 0
|
||||
dilation = 1
|
||||
padding = node.attr['padding'].s.decode("utf-8")
|
||||
np.array([self.op2code[node.op], dilation, self.conv_paddings[padding], self.conv_activations['None'],
|
||||
in_channels, out_channels, filter_height, has_bias], dtype=np.uint32).tofile(f)
|
||||
kernel.tofile(f)
|
||||
|
||||
input_operand_index = self.add_operand(input_name, Operand.IOTYPE_INPUT)
|
||||
output_operand_index = self.add_operand(node.name, Operand.IOTYPE_OUTPUT)
|
||||
np.array([input_operand_index, output_operand_index], dtype=np.uint32).tofile(f)
|
||||
|
||||
|
||||
def dump_depth2space_to_file(self, node, f):
|
||||
assert(node.op == 'DepthToSpace')
|
||||
self.layer_number = self.layer_number + 1
|
||||
block_size = node.attr['block_size'].i
|
||||
np.array([self.op2code[node.op], block_size], dtype=np.uint32).tofile(f)
|
||||
self.converted_nodes.add(node.name)
|
||||
input_operand_index = self.add_operand(node.input[0], Operand.IOTYPE_INPUT)
|
||||
output_operand_index = self.add_operand(node.name, Operand.IOTYPE_OUTPUT)
|
||||
np.array([input_operand_index, output_operand_index], dtype=np.uint32).tofile(f)
|
||||
|
||||
|
||||
def dump_mirrorpad_to_file(self, node, f):
|
||||
assert(node.op == 'MirrorPad')
|
||||
self.layer_number = self.layer_number + 1
|
||||
mode = node.attr['mode'].s
|
||||
mode = self.mirrorpad_mode[mode.decode("utf-8")]
|
||||
np.array([self.op2code[node.op], mode], dtype=np.uint32).tofile(f)
|
||||
pnode = self.name_node_dict[node.input[1]]
|
||||
self.converted_nodes.add(pnode.name)
|
||||
paddings = pnode.attr['value'].tensor.tensor_content
|
||||
f.write(paddings)
|
||||
self.converted_nodes.add(node.name)
|
||||
input_operand_index = self.add_operand(node.input[0], Operand.IOTYPE_INPUT)
|
||||
output_operand_index = self.add_operand(node.name, Operand.IOTYPE_OUTPUT)
|
||||
np.array([input_operand_index, output_operand_index], dtype=np.uint32).tofile(f)
|
||||
|
||||
|
||||
def dump_maximum_to_file(self, node, f):
|
||||
assert(node.op == 'Maximum')
|
||||
self.layer_number = self.layer_number + 1
|
||||
ynode = self.name_node_dict[node.input[1]]
|
||||
y = ynode.attr['value'].tensor.float_val[0]
|
||||
np.array([self.op2code[node.op]], dtype=np.uint32).tofile(f)
|
||||
np.array([y], dtype=np.float32).tofile(f)
|
||||
self.converted_nodes.add(node.name)
|
||||
input_operand_index = self.add_operand(node.input[0], Operand.IOTYPE_INPUT)
|
||||
output_operand_index = self.add_operand(node.name, Operand.IOTYPE_OUTPUT)
|
||||
np.array([input_operand_index, output_operand_index], dtype=np.uint32).tofile(f)
|
||||
|
||||
|
||||
def dump_mathbinary_to_file(self, node, f):
|
||||
self.layer_number = self.layer_number + 1
|
||||
self.converted_nodes.add(node.name)
|
||||
i0_node = self.name_node_dict[node.input[0]]
|
||||
i1_node = self.name_node_dict[node.input[1]]
|
||||
np.array([self.op2code['MathBinary'], self.mathbin2code[node.op]], dtype=np.uint32).tofile(f)
|
||||
if i0_node.op == 'Const':
|
||||
scalar = i0_node.attr['value'].tensor.float_val[0]
|
||||
np.array([1], dtype=np.uint32).tofile(f) # broadcast: 1
|
||||
np.array([scalar], dtype=np.float32).tofile(f)
|
||||
np.array([0], dtype=np.uint32).tofile(f) # broadcast: 0
|
||||
input_operand_index = self.add_operand(i1_node.name, Operand.IOTYPE_INPUT)
|
||||
np.array([input_operand_index], dtype=np.uint32).tofile(f)
|
||||
elif i1_node.op == 'Const':
|
||||
scalar = i1_node.attr['value'].tensor.float_val[0]
|
||||
np.array([0], dtype=np.uint32).tofile(f)
|
||||
input_operand_index = self.add_operand(i0_node.name, Operand.IOTYPE_INPUT)
|
||||
np.array([input_operand_index], dtype=np.uint32).tofile(f)
|
||||
np.array([1], dtype=np.uint32).tofile(f)
|
||||
np.array([scalar], dtype=np.float32).tofile(f)
|
||||
else:
|
||||
np.array([0], dtype=np.uint32).tofile(f)
|
||||
input_operand_index = self.add_operand(i0_node.name, Operand.IOTYPE_INPUT)
|
||||
np.array([input_operand_index], dtype=np.uint32).tofile(f)
|
||||
np.array([0], dtype=np.uint32).tofile(f)
|
||||
input_operand_index = self.add_operand(i1_node.name, Operand.IOTYPE_INPUT)
|
||||
np.array([input_operand_index], dtype=np.uint32).tofile(f)
|
||||
output_operand_index = self.add_operand(node.name, Operand.IOTYPE_OUTPUT)
|
||||
np.array([output_operand_index], dtype=np.uint32).tofile(f)
|
||||
|
||||
|
||||
def dump_mathunary_to_file(self, node, f):
|
||||
self.layer_number = self.layer_number + 1
|
||||
self.converted_nodes.add(node.name)
|
||||
i0_node = self.name_node_dict[node.input[0]]
|
||||
np.array([self.op2code['MathUnary'], self.mathun2code[node.op]], dtype=np.uint32).tofile(f)
|
||||
input_operand_index = self.add_operand(i0_node.name, Operand.IOTYPE_INPUT)
|
||||
np.array([input_operand_index], dtype=np.uint32).tofile(f)
|
||||
output_operand_index = self.add_operand(node.name, Operand.IOTYPE_OUTPUT)
|
||||
np.array([output_operand_index],dtype=np.uint32).tofile(f)
|
||||
|
||||
|
||||
def dump_layers_to_file(self, f):
|
||||
for node in self.nodes:
|
||||
if node.name in self.converted_nodes:
|
||||
continue
|
||||
|
||||
# conv2d with dilation generates very complex nodes, so handle it in special
|
||||
if self.in_conv2d_scope(node.name):
|
||||
if node.op == 'Conv2D':
|
||||
self.dump_complex_conv2d_to_file(node, f)
|
||||
continue
|
||||
|
||||
if node.op == 'Conv2D':
|
||||
self.dump_simple_conv2d_to_file(node, f)
|
||||
elif node.op == 'DepthToSpace':
|
||||
self.dump_depth2space_to_file(node, f)
|
||||
elif node.op == 'MirrorPad':
|
||||
self.dump_mirrorpad_to_file(node, f)
|
||||
elif node.op == 'Maximum':
|
||||
self.dump_maximum_to_file(node, f)
|
||||
elif node.op in self.mathbin2code:
|
||||
self.dump_mathbinary_to_file(node, f)
|
||||
elif node.op in self.mathun2code:
|
||||
self.dump_mathunary_to_file(node, f)
|
||||
|
||||
|
||||
def dump_operands_to_file(self, f):
|
||||
operands = sorted(self.name_operand_dict.values())
|
||||
for operand in operands:
|
||||
#print('{}'.format(operand))
|
||||
np.array([operand.index, len(operand.name)], dtype=np.uint32).tofile(f)
|
||||
f.write(operand.name.encode('utf-8'))
|
||||
np.array([operand.iotype, operand.dtype], dtype=np.uint32).tofile(f)
|
||||
np.array([operand.dims[0], operand.dims[1], operand.dims[2], operand.dims[3]], dtype=np.uint32).tofile(f)
|
||||
|
||||
|
||||
def dump_to_file(self):
|
||||
with open(self.outfile, 'wb') as f:
|
||||
f.write(header.str.encode('utf-8'))
|
||||
np.array([header.major, header.minor], dtype=np.uint32).tofile(f)
|
||||
self.dump_layers_to_file(f)
|
||||
self.dump_operands_to_file(f)
|
||||
np.array([self.layer_number, len(self.name_operand_dict)], dtype=np.uint32).tofile(f)
|
||||
|
||||
|
||||
def generate_name_node_dict(self):
|
||||
for node in self.nodes:
|
||||
self.name_node_dict[node.name] = node
|
||||
|
||||
|
||||
def generate_output_names(self):
|
||||
used_names = []
|
||||
for node in self.nodes:
|
||||
for input in node.input:
|
||||
used_names.append(input)
|
||||
|
||||
for node in self.nodes:
|
||||
if node.name not in used_names:
|
||||
self.output_names.append(node.name)
|
||||
|
||||
|
||||
def remove_identity(self):
|
||||
id_nodes = []
|
||||
id_dict = {}
|
||||
for node in self.nodes:
|
||||
if node.op == 'Identity':
|
||||
name = node.name
|
||||
input = node.input[0]
|
||||
id_nodes.append(node)
|
||||
# do not change the output name
|
||||
if name in self.output_names:
|
||||
self.name_node_dict[input].name = name
|
||||
self.name_node_dict[name] = self.name_node_dict[input]
|
||||
del self.name_node_dict[input]
|
||||
else:
|
||||
id_dict[name] = input
|
||||
|
||||
for idnode in id_nodes:
|
||||
self.nodes.remove(idnode)
|
||||
|
||||
for node in self.nodes:
|
||||
for i in range(len(node.input)):
|
||||
input = node.input[i]
|
||||
if input in id_dict:
|
||||
node.input[i] = id_dict[input]
|
||||
|
||||
|
||||
def generate_edges(self):
|
||||
for node in self.nodes:
|
||||
for input in node.input:
|
||||
if input in self.edges:
|
||||
self.edges[input].append(node)
|
||||
else:
|
||||
self.edges[input] = [node]
|
||||
|
||||
|
||||
@staticmethod
|
||||
def get_scope_name(name):
|
||||
index = name.rfind('/')
|
||||
if index == -1:
|
||||
return ""
|
||||
return name[0:index]
|
||||
|
||||
|
||||
def in_conv2d_scope(self, name):
|
||||
inner_scope = TFConverter.get_scope_name(name)
|
||||
if inner_scope == "":
|
||||
return False;
|
||||
for scope in self.conv2d_scope_names:
|
||||
index = inner_scope.find(scope)
|
||||
if index == 0:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def generate_conv2d_scope_info(self):
|
||||
# mostly, conv2d is a sub block in graph, get the scope name
|
||||
for node in self.nodes:
|
||||
if node.op == 'Conv2D':
|
||||
scope = TFConverter.get_scope_name(node.name)
|
||||
# for the case tf.nn.conv2d is called directly
|
||||
if scope == '':
|
||||
continue
|
||||
# for the case tf.nn.conv2d is called within a scope
|
||||
if scope + '/kernel' not in self.name_node_dict:
|
||||
continue
|
||||
self.conv2d_scope_names.add(scope)
|
||||
|
||||
# get the input name to the conv2d sub block
|
||||
for node in self.nodes:
|
||||
scope = TFConverter.get_scope_name(node.name)
|
||||
if scope in self.conv2d_scope_names:
|
||||
if node.op == 'Conv2D' or node.op == 'Shape':
|
||||
for inp in node.input:
|
||||
if TFConverter.get_scope_name(inp) != scope:
|
||||
self.conv2d_scopename_inputname_dict[scope] = inp
|
||||
|
||||
|
||||
def run(self):
|
||||
self.generate_name_node_dict()
|
||||
self.generate_output_names()
|
||||
self.remove_identity()
|
||||
self.generate_edges()
|
||||
self.generate_conv2d_scope_info()
|
||||
|
||||
if self.dump4tb:
|
||||
self.dump_for_tensorboard()
|
||||
|
||||
self.dump_to_file()
|
||||
|
||||
|
||||
def convert_from_tensorflow(infile, outfile, dump4tb):
|
||||
with open(infile, 'rb') as f:
|
||||
# read the file in .proto format
|
||||
graph_def = tf.GraphDef()
|
||||
graph_def.ParseFromString(f.read())
|
||||
nodes = graph_def.node
|
||||
|
||||
converter = TFConverter(graph_def, nodes, outfile, dump4tb)
|
||||
converter.run()
|
26
externals/ffmpeg/tools/python/convert_header.py
vendored
Executable file
26
externals/ffmpeg/tools/python/convert_header.py
vendored
Executable file
@@ -0,0 +1,26 @@
|
||||
# Copyright (c) 2019
|
||||
#
|
||||
# This file is part of FFmpeg.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# 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 FFmpeg; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
# ==============================================================================
|
||||
|
||||
str = 'FFMPEGDNNNATIVE'
|
||||
|
||||
# increase major and reset minor when we have to re-convert the model file
|
||||
major = 1
|
||||
|
||||
# increase minor when we don't have to re-convert the model file
|
||||
minor = 6
|
677
externals/ffmpeg/tools/qt-faststart.c
vendored
Executable file
677
externals/ffmpeg/tools/qt-faststart.c
vendored
Executable file
@@ -0,0 +1,677 @@
|
||||
/*
|
||||
* qt-faststart.c, v0.2
|
||||
* by Mike Melanson (melanson@pcisys.net)
|
||||
* This file is placed in the public domain. Use the program however you
|
||||
* see fit.
|
||||
*
|
||||
* This utility rearranges a Quicktime file such that the moov atom
|
||||
* is in front of the data, thus facilitating network streaming.
|
||||
*
|
||||
* To compile this program, start from the base directory from which you
|
||||
* 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
|
||||
* guaranteed, particularly on 64-bit platforms.
|
||||
* Invoke the program with:
|
||||
* qt-faststart <infile.mov> <outfile.mov>
|
||||
*
|
||||
* Notes: Quicktime files can come in many configurations of top-level
|
||||
* atoms. This utility stipulates that the very last atom in the file needs
|
||||
* to be a moov atom. When given such a file, this utility will rearrange
|
||||
* the top-level atoms by shifting the moov atom from the back of the file
|
||||
* to the front, and patch the chunk offsets along the way. This utility
|
||||
* presently only operates on uncompressed moov atoms.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <inttypes.h>
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
|
||||
#ifdef __MINGW32__
|
||||
#undef fseeko
|
||||
#define fseeko(x, y, z) fseeko64(x, y, z)
|
||||
#undef ftello
|
||||
#define ftello(x) ftello64(x)
|
||||
#elif defined(_WIN32)
|
||||
#undef fseeko
|
||||
#define fseeko(x, y, z) _fseeki64(x, y, z)
|
||||
#undef ftello
|
||||
#define ftello(x) _ftelli64(x)
|
||||
#endif
|
||||
|
||||
#define MIN(a,b) ((a) > (b) ? (b) : (a))
|
||||
|
||||
#define BE_32(x) (((uint32_t)(((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 AV_WB32(p, val) { \
|
||||
((uint8_t*)(p))[0] = ((val) >> 24) & 0xff; \
|
||||
((uint8_t*)(p))[1] = ((val) >> 16) & 0xff; \
|
||||
((uint8_t*)(p))[2] = ((val) >> 8) & 0xff; \
|
||||
((uint8_t*)(p))[3] = (val) & 0xff; \
|
||||
}
|
||||
|
||||
#define AV_WB64(p, val) { \
|
||||
AV_WB32(p, (val) >> 32) \
|
||||
AV_WB32(p + 4, val) \
|
||||
}
|
||||
|
||||
#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 */
|
||||
#define FREE_ATOM QT_ATOM('f', 'r', 'e', 'e')
|
||||
#define JUNK_ATOM QT_ATOM('j', 'u', 'n', 'k')
|
||||
#define MDAT_ATOM QT_ATOM('m', 'd', 'a', 't')
|
||||
#define MOOV_ATOM QT_ATOM('m', 'o', 'o', 'v')
|
||||
#define PNOT_ATOM QT_ATOM('p', 'n', 'o', 't')
|
||||
#define SKIP_ATOM QT_ATOM('s', 'k', 'i', 'p')
|
||||
#define WIDE_ATOM QT_ATOM('w', 'i', 'd', 'e')
|
||||
#define PICT_ATOM QT_ATOM('P', 'I', 'C', 'T')
|
||||
#define FTYP_ATOM QT_ATOM('f', 't', 'y', 'p')
|
||||
#define UUID_ATOM QT_ATOM('u', 'u', 'i', 'd')
|
||||
|
||||
#define CMOV_ATOM QT_ATOM('c', 'm', 'o', 'v')
|
||||
#define TRAK_ATOM QT_ATOM('t', 'r', 'a', 'k')
|
||||
#define MDIA_ATOM QT_ATOM('m', 'd', 'i', 'a')
|
||||
#define MINF_ATOM QT_ATOM('m', 'i', 'n', 'f')
|
||||
#define STBL_ATOM QT_ATOM('s', 't', 'b', 'l')
|
||||
#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 33554432
|
||||
#define MAX_FTYP_ATOM_SIZE 1048576
|
||||
|
||||
typedef struct {
|
||||
uint32_t type;
|
||||
uint32_t header_size;
|
||||
uint64_t size;
|
||||
unsigned char *data;
|
||||
} atom_t;
|
||||
|
||||
typedef struct {
|
||||
uint64_t moov_atom_size;
|
||||
uint64_t stco_offset_count;
|
||||
uint64_t stco_data_size;
|
||||
int stco_overflow;
|
||||
uint32_t depth;
|
||||
} update_chunk_offsets_context_t;
|
||||
|
||||
typedef struct {
|
||||
unsigned char *dest;
|
||||
uint64_t original_moov_size;
|
||||
uint64_t new_moov_size;
|
||||
} upgrade_stco_context_t;
|
||||
|
||||
typedef int (*parse_atoms_callback_t)(void *context, atom_t *atom);
|
||||
|
||||
static int parse_atoms(
|
||||
unsigned char *buf,
|
||||
uint64_t size,
|
||||
parse_atoms_callback_t callback,
|
||||
void *context)
|
||||
{
|
||||
unsigned char *pos = buf;
|
||||
unsigned char *end = pos + size;
|
||||
atom_t atom;
|
||||
int ret;
|
||||
|
||||
while (end - pos >= ATOM_PREAMBLE_SIZE) {
|
||||
atom.size = BE_32(pos);
|
||||
atom.type = BE_32(pos + 4);
|
||||
pos += ATOM_PREAMBLE_SIZE;
|
||||
atom.header_size = ATOM_PREAMBLE_SIZE;
|
||||
|
||||
switch (atom.size) {
|
||||
case 1:
|
||||
if (end - pos < 8) {
|
||||
fprintf(stderr, "not enough room for 64 bit atom size\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
atom.size = BE_64(pos);
|
||||
pos += 8;
|
||||
atom.header_size = ATOM_PREAMBLE_SIZE + 8;
|
||||
break;
|
||||
|
||||
case 0:
|
||||
atom.size = ATOM_PREAMBLE_SIZE + end - pos;
|
||||
break;
|
||||
}
|
||||
|
||||
if (atom.size < atom.header_size) {
|
||||
fprintf(stderr, "atom size %"PRIu64" too small\n", atom.size);
|
||||
return -1;
|
||||
}
|
||||
|
||||
atom.size -= atom.header_size;
|
||||
|
||||
if (atom.size > end - pos) {
|
||||
fprintf(stderr, "atom size %"PRIu64" too big\n", atom.size);
|
||||
return -1;
|
||||
}
|
||||
|
||||
atom.data = pos;
|
||||
ret = callback(context, &atom);
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
pos += atom.size;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int update_stco_offsets(update_chunk_offsets_context_t *context, atom_t *atom)
|
||||
{
|
||||
uint32_t current_offset;
|
||||
uint32_t offset_count;
|
||||
unsigned char *pos;
|
||||
unsigned char *end;
|
||||
|
||||
printf(" patching stco atom...\n");
|
||||
if (atom->size < 8) {
|
||||
fprintf(stderr, "stco atom size %"PRIu64" too small\n", atom->size);
|
||||
return -1;
|
||||
}
|
||||
|
||||
offset_count = BE_32(atom->data + 4);
|
||||
if (offset_count > (atom->size - 8) / 4) {
|
||||
fprintf(stderr, "stco offset count %"PRIu32" too big\n", offset_count);
|
||||
return -1;
|
||||
}
|
||||
|
||||
context->stco_offset_count += offset_count;
|
||||
context->stco_data_size += atom->size - 8;
|
||||
|
||||
for (pos = atom->data + 8, end = pos + offset_count * 4;
|
||||
pos < end;
|
||||
pos += 4) {
|
||||
current_offset = BE_32(pos);
|
||||
if (current_offset > UINT_MAX - context->moov_atom_size) {
|
||||
context->stco_overflow = 1;
|
||||
}
|
||||
current_offset += context->moov_atom_size;
|
||||
AV_WB32(pos, current_offset);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int update_co64_offsets(update_chunk_offsets_context_t *context, atom_t *atom)
|
||||
{
|
||||
uint64_t current_offset;
|
||||
uint32_t offset_count;
|
||||
unsigned char *pos;
|
||||
unsigned char *end;
|
||||
|
||||
printf(" patching co64 atom...\n");
|
||||
if (atom->size < 8) {
|
||||
fprintf(stderr, "co64 atom size %"PRIu64" too small\n", atom->size);
|
||||
return -1;
|
||||
}
|
||||
|
||||
offset_count = BE_32(atom->data + 4);
|
||||
if (offset_count > (atom->size - 8) / 8) {
|
||||
fprintf(stderr, "co64 offset count %"PRIu32" too big\n", offset_count);
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (pos = atom->data + 8, end = pos + offset_count * 8;
|
||||
pos < end;
|
||||
pos += 8) {
|
||||
current_offset = BE_64(pos);
|
||||
current_offset += context->moov_atom_size;
|
||||
AV_WB64(pos, current_offset);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int update_chunk_offsets_callback(void *ctx, atom_t *atom)
|
||||
{
|
||||
update_chunk_offsets_context_t *context = ctx;
|
||||
int ret;
|
||||
|
||||
switch (atom->type) {
|
||||
case STCO_ATOM:
|
||||
return update_stco_offsets(context, atom);
|
||||
|
||||
case CO64_ATOM:
|
||||
return update_co64_offsets(context, atom);
|
||||
|
||||
case MOOV_ATOM:
|
||||
case TRAK_ATOM:
|
||||
case MDIA_ATOM:
|
||||
case MINF_ATOM:
|
||||
case STBL_ATOM:
|
||||
context->depth++;
|
||||
if (context->depth > 10) {
|
||||
fprintf(stderr, "atoms too deeply nested\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = parse_atoms(
|
||||
atom->data,
|
||||
atom->size,
|
||||
update_chunk_offsets_callback,
|
||||
context);
|
||||
context->depth--;
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void set_atom_size(unsigned char *header, uint32_t header_size, uint64_t size)
|
||||
{
|
||||
switch (header_size) {
|
||||
case 8:
|
||||
AV_WB32(header, size);
|
||||
break;
|
||||
|
||||
case 16:
|
||||
AV_WB64(header + 8, size);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void upgrade_stco_atom(upgrade_stco_context_t *context, atom_t *atom)
|
||||
{
|
||||
unsigned char *pos;
|
||||
unsigned char *end;
|
||||
uint64_t new_offset;
|
||||
uint32_t offset_count;
|
||||
uint32_t original_offset;
|
||||
|
||||
/* Note: not performing validations since they were performed on the first pass */
|
||||
|
||||
offset_count = BE_32(atom->data + 4);
|
||||
|
||||
/* write the header */
|
||||
memcpy(context->dest, atom->data - atom->header_size, atom->header_size + 8);
|
||||
AV_WB32(context->dest + 4, CO64_ATOM);
|
||||
set_atom_size(context->dest, atom->header_size, atom->header_size + 8 + offset_count * 8);
|
||||
context->dest += atom->header_size + 8;
|
||||
|
||||
/* write the data */
|
||||
for (pos = atom->data + 8, end = pos + offset_count * 4;
|
||||
pos < end;
|
||||
pos += 4) {
|
||||
original_offset = BE_32(pos) - context->original_moov_size;
|
||||
new_offset = (uint64_t)original_offset + context->new_moov_size;
|
||||
AV_WB64(context->dest, new_offset);
|
||||
context->dest += 8;
|
||||
}
|
||||
}
|
||||
|
||||
static int upgrade_stco_callback(void *ctx, atom_t *atom)
|
||||
{
|
||||
upgrade_stco_context_t *context = ctx;
|
||||
unsigned char *start_pos;
|
||||
uint64_t copy_size;
|
||||
|
||||
switch (atom->type) {
|
||||
case STCO_ATOM:
|
||||
upgrade_stco_atom(context, atom);
|
||||
break;
|
||||
|
||||
case MOOV_ATOM:
|
||||
case TRAK_ATOM:
|
||||
case MDIA_ATOM:
|
||||
case MINF_ATOM:
|
||||
case STBL_ATOM:
|
||||
/* write the atom header */
|
||||
memcpy(context->dest, atom->data - atom->header_size, atom->header_size);
|
||||
start_pos = context->dest;
|
||||
context->dest += atom->header_size;
|
||||
|
||||
/* parse internal atoms*/
|
||||
if (parse_atoms(
|
||||
atom->data,
|
||||
atom->size,
|
||||
upgrade_stco_callback,
|
||||
context) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* update the atom size */
|
||||
set_atom_size(start_pos, atom->header_size, context->dest - start_pos);
|
||||
break;
|
||||
|
||||
default:
|
||||
copy_size = atom->header_size + atom->size;
|
||||
memcpy(context->dest, atom->data - atom->header_size, copy_size);
|
||||
context->dest += copy_size;
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int update_moov_atom(
|
||||
unsigned char **moov_atom,
|
||||
uint64_t *moov_atom_size)
|
||||
{
|
||||
update_chunk_offsets_context_t update_context = { 0 };
|
||||
upgrade_stco_context_t upgrade_context;
|
||||
unsigned char *new_moov_atom;
|
||||
|
||||
update_context.moov_atom_size = *moov_atom_size;
|
||||
|
||||
if (parse_atoms(
|
||||
*moov_atom,
|
||||
*moov_atom_size,
|
||||
update_chunk_offsets_callback,
|
||||
&update_context) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!update_context.stco_overflow) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
printf(" upgrading stco atoms to co64...\n");
|
||||
upgrade_context.new_moov_size = *moov_atom_size +
|
||||
update_context.stco_offset_count * 8 -
|
||||
update_context.stco_data_size;
|
||||
|
||||
new_moov_atom = malloc(upgrade_context.new_moov_size);
|
||||
if (new_moov_atom == NULL) {
|
||||
fprintf(stderr, "could not allocate %"PRIu64" bytes for updated moov atom\n",
|
||||
upgrade_context.new_moov_size);
|
||||
return -1;
|
||||
}
|
||||
|
||||
upgrade_context.original_moov_size = *moov_atom_size;
|
||||
upgrade_context.dest = new_moov_atom;
|
||||
|
||||
if (parse_atoms(
|
||||
*moov_atom,
|
||||
*moov_atom_size,
|
||||
upgrade_stco_callback,
|
||||
&upgrade_context) < 0) {
|
||||
free(new_moov_atom);
|
||||
return -1;
|
||||
}
|
||||
|
||||
free(*moov_atom);
|
||||
*moov_atom = new_moov_atom;
|
||||
*moov_atom_size = upgrade_context.new_moov_size;
|
||||
|
||||
if (upgrade_context.dest != *moov_atom + *moov_atom_size) {
|
||||
fprintf(stderr, "unexpected - wrong number of moov bytes written\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
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;
|
||||
uint64_t atom_offset = 0;
|
||||
int64_t last_offset;
|
||||
unsigned char *moov_atom = NULL;
|
||||
unsigned char *ftyp_atom = NULL;
|
||||
uint64_t moov_atom_size;
|
||||
uint64_t ftyp_atom_size = 0;
|
||||
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"
|
||||
"Note: alternatively you can use -movflags +faststart in ffmpeg\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!strcmp(argv[1], argv[2])) {
|
||||
fprintf(stderr, "input and output files need to be different\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
infile = fopen(argv[1], "rb");
|
||||
if (!infile) {
|
||||
perror(argv[1]);
|
||||
goto error_out;
|
||||
}
|
||||
|
||||
/* traverse through the atoms in the file to make sure that 'moov' is
|
||||
* at the end */
|
||||
while (!feof(infile)) {
|
||||
if (fread(atom_bytes, ATOM_PREAMBLE_SIZE, 1, infile) != 1) {
|
||||
break;
|
||||
}
|
||||
atom_size = BE_32(&atom_bytes[0]);
|
||||
atom_type = BE_32(&atom_bytes[4]);
|
||||
|
||||
/* keep ftyp atom */
|
||||
if (atom_type == FTYP_ATOM) {
|
||||
if (atom_size > MAX_FTYP_ATOM_SIZE) {
|
||||
fprintf(stderr, "ftyp atom size %"PRIu64" too big\n",
|
||||
atom_size);
|
||||
goto error_out;
|
||||
}
|
||||
ftyp_atom_size = atom_size;
|
||||
free(ftyp_atom);
|
||||
ftyp_atom = malloc(ftyp_atom_size);
|
||||
if (!ftyp_atom) {
|
||||
fprintf(stderr, "could not allocate %"PRIu64" bytes for ftyp atom\n",
|
||||
atom_size);
|
||||
goto error_out;
|
||||
}
|
||||
if (fseeko(infile, -ATOM_PREAMBLE_SIZE, SEEK_CUR) ||
|
||||
fread(ftyp_atom, atom_size, 1, infile) != 1 ||
|
||||
(start_offset = ftello(infile)) < 0) {
|
||||
perror(argv[1]);
|
||||
goto error_out;
|
||||
}
|
||||
} else {
|
||||
int ret;
|
||||
/* 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]);
|
||||
ret = fseeko(infile, atom_size - ATOM_PREAMBLE_SIZE * 2, SEEK_CUR);
|
||||
} else {
|
||||
ret = fseeko(infile, atom_size - ATOM_PREAMBLE_SIZE, SEEK_CUR);
|
||||
}
|
||||
if (ret) {
|
||||
perror(argv[1]);
|
||||
goto error_out;
|
||||
}
|
||||
}
|
||||
printf("%c%c%c%c %10"PRIu64" %"PRIu64"\n",
|
||||
(atom_type >> 24) & 255,
|
||||
(atom_type >> 16) & 255,
|
||||
(atom_type >> 8) & 255,
|
||||
(atom_type >> 0) & 255,
|
||||
atom_offset,
|
||||
atom_size);
|
||||
if ((atom_type != FREE_ATOM) &&
|
||||
(atom_type != JUNK_ATOM) &&
|
||||
(atom_type != MDAT_ATOM) &&
|
||||
(atom_type != MOOV_ATOM) &&
|
||||
(atom_type != PNOT_ATOM) &&
|
||||
(atom_type != SKIP_ATOM) &&
|
||||
(atom_type != WIDE_ATOM) &&
|
||||
(atom_type != PICT_ATOM) &&
|
||||
(atom_type != UUID_ATOM) &&
|
||||
(atom_type != FTYP_ATOM)) {
|
||||
fprintf(stderr, "encountered non-QT top-level atom (is this a QuickTime file?)\n");
|
||||
break;
|
||||
}
|
||||
atom_offset += atom_size;
|
||||
|
||||
/* The atom header is 8 (or 16 bytes), if the atom size (which
|
||||
* includes these 8 or 16 bytes) is less than that, we won't be
|
||||
* 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) {
|
||||
printf("last atom in file was not a moov atom\n");
|
||||
free(ftyp_atom);
|
||||
fclose(infile);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (atom_size < 16) {
|
||||
fprintf(stderr, "bad moov atom size\n");
|
||||
goto error_out;
|
||||
}
|
||||
|
||||
/* moov atom was, in fact, the last atom in the chunk; load the whole
|
||||
* moov atom */
|
||||
if (fseeko(infile, -(atom_size + free_size), SEEK_END)) {
|
||||
perror(argv[1]);
|
||||
goto error_out;
|
||||
}
|
||||
last_offset = ftello(infile);
|
||||
if (last_offset < 0) {
|
||||
perror(argv[1]);
|
||||
goto error_out;
|
||||
}
|
||||
moov_atom_size = atom_size;
|
||||
moov_atom = malloc(moov_atom_size);
|
||||
if (!moov_atom) {
|
||||
fprintf(stderr, "could not allocate %"PRIu64" bytes for moov atom\n", atom_size);
|
||||
goto error_out;
|
||||
}
|
||||
if (fread(moov_atom, atom_size, 1, infile) != 1) {
|
||||
perror(argv[1]);
|
||||
goto error_out;
|
||||
}
|
||||
|
||||
/* this utility does not support compressed atoms yet, so disqualify
|
||||
* files with compressed QT atoms */
|
||||
if (BE_32(&moov_atom[12]) == CMOV_ATOM) {
|
||||
fprintf(stderr, "this utility does not support compressed moov atoms yet\n");
|
||||
goto error_out;
|
||||
}
|
||||
|
||||
/* close; will be re-opened later */
|
||||
fclose(infile);
|
||||
infile = NULL;
|
||||
|
||||
if (update_moov_atom(&moov_atom, &moov_atom_size) < 0) {
|
||||
goto error_out;
|
||||
}
|
||||
|
||||
/* re-open the input file and open the output file */
|
||||
infile = fopen(argv[1], "rb");
|
||||
if (!infile) {
|
||||
perror(argv[1]);
|
||||
goto error_out;
|
||||
}
|
||||
|
||||
if (start_offset > 0) { /* seek after ftyp atom */
|
||||
if (fseeko(infile, start_offset, SEEK_SET)) {
|
||||
perror(argv[1]);
|
||||
goto error_out;
|
||||
}
|
||||
|
||||
last_offset -= start_offset;
|
||||
}
|
||||
|
||||
outfile = fopen(argv[2], "wb");
|
||||
if (!outfile) {
|
||||
perror(argv[2]);
|
||||
goto error_out;
|
||||
}
|
||||
|
||||
/* dump the same ftyp atom */
|
||||
if (ftyp_atom_size > 0) {
|
||||
printf(" writing ftyp atom...\n");
|
||||
if (fwrite(ftyp_atom, ftyp_atom_size, 1, outfile) != 1) {
|
||||
perror(argv[2]);
|
||||
goto error_out;
|
||||
}
|
||||
}
|
||||
|
||||
/* dump the new moov atom */
|
||||
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 */
|
||||
bytes_to_copy = MIN(COPY_BUFFER_SIZE, last_offset);
|
||||
copy_buffer = malloc(bytes_to_copy);
|
||||
if (!copy_buffer) {
|
||||
fprintf(stderr, "could not allocate %d bytes for copy_buffer\n", bytes_to_copy);
|
||||
goto error_out;
|
||||
}
|
||||
printf(" copying rest of file...\n");
|
||||
while (last_offset) {
|
||||
bytes_to_copy = MIN(bytes_to_copy, last_offset);
|
||||
|
||||
if (fread(copy_buffer, bytes_to_copy, 1, infile) != 1) {
|
||||
perror(argv[1]);
|
||||
goto error_out;
|
||||
}
|
||||
if (fwrite(copy_buffer, bytes_to_copy, 1, outfile) != 1) {
|
||||
perror(argv[2]);
|
||||
goto error_out;
|
||||
}
|
||||
last_offset -= bytes_to_copy;
|
||||
}
|
||||
|
||||
fclose(infile);
|
||||
fclose(outfile);
|
||||
free(moov_atom);
|
||||
free(ftyp_atom);
|
||||
free(copy_buffer);
|
||||
|
||||
return 0;
|
||||
|
||||
error_out:
|
||||
if (infile)
|
||||
fclose(infile);
|
||||
if (outfile)
|
||||
fclose(outfile);
|
||||
free(moov_atom);
|
||||
free(ftyp_atom);
|
||||
free(copy_buffer);
|
||||
return 1;
|
||||
}
|
104
externals/ffmpeg/tools/seek_print.c
vendored
Executable file
104
externals/ffmpeg/tools/seek_print.c
vendored
Executable file
@@ -0,0 +1,104 @@
|
||||
/*
|
||||
* Copyright (c) 2013 Nicolas George
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* 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 FFmpeg; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#if HAVE_UNISTD_H
|
||||
#include <unistd.h> /* getopt */
|
||||
#endif
|
||||
|
||||
#include "libavformat/avformat.h"
|
||||
#include "libavutil/timestamp.h"
|
||||
|
||||
#if !HAVE_GETOPT
|
||||
#include "compat/getopt.c"
|
||||
#endif
|
||||
|
||||
static void usage(int ret)
|
||||
{
|
||||
fprintf(ret ? stderr : stdout,
|
||||
"Usage: seek_print file [command ...]\n"
|
||||
"Commands:\n"
|
||||
" read\n"
|
||||
" seek:stream:min_ts:ts:max_ts:flags\n"
|
||||
);
|
||||
exit(ret);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int opt, ret, stream, flags;
|
||||
const char *filename;
|
||||
AVFormatContext *avf = NULL;
|
||||
int64_t min_ts, max_ts, ts;
|
||||
AVPacket packet;
|
||||
|
||||
while ((opt = getopt(argc, argv, "h")) != -1) {
|
||||
switch (opt) {
|
||||
case 'h':
|
||||
usage(0);
|
||||
default:
|
||||
usage(1);
|
||||
}
|
||||
}
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
if (!argc)
|
||||
usage(1);
|
||||
filename = *argv;
|
||||
argv++;
|
||||
argc--;
|
||||
|
||||
if ((ret = avformat_open_input(&avf, filename, NULL, NULL)) < 0) {
|
||||
fprintf(stderr, "%s: %s\n", filename, av_err2str(ret));
|
||||
return 1;
|
||||
}
|
||||
if ((ret = avformat_find_stream_info(avf, NULL)) < 0) {
|
||||
fprintf(stderr, "%s: could not find codec parameters: %s\n", filename,
|
||||
av_err2str(ret));
|
||||
return 1;
|
||||
}
|
||||
|
||||
for (; argc; argc--, argv++) {
|
||||
if (!strcmp(*argv, "read")) {
|
||||
ret = av_read_frame(avf, &packet);
|
||||
if (ret < 0) {
|
||||
printf("read: %d (%s)\n", ret, av_err2str(ret));
|
||||
} else {
|
||||
AVRational *tb = &avf->streams[packet.stream_index]->time_base;
|
||||
printf("read: %d size=%d stream=%d dts=%s (%s) pts=%s (%s)\n",
|
||||
ret, packet.size, packet.stream_index,
|
||||
av_ts2str(packet.dts), av_ts2timestr(packet.dts, tb),
|
||||
av_ts2str(packet.pts), av_ts2timestr(packet.pts, tb));
|
||||
av_packet_unref(&packet);
|
||||
}
|
||||
} else if (sscanf(*argv, "seek:%i:%"SCNi64":%"SCNi64":%"SCNi64":%i",
|
||||
&stream, &min_ts, &ts, &max_ts, &flags) == 5) {
|
||||
ret = avformat_seek_file(avf, stream, min_ts, ts, max_ts, flags);
|
||||
printf("seek: %d (%s)\n", ret, av_err2str(ret));
|
||||
} else {
|
||||
fprintf(stderr, "'%s': unknown command\n", *argv);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
avformat_close_input(&avf);
|
||||
|
||||
return 0;
|
||||
}
|
385
externals/ffmpeg/tools/sidxindex.c
vendored
Executable file
385
externals/ffmpeg/tools/sidxindex.c
vendored
Executable file
@@ -0,0 +1,385 @@
|
||||
/*
|
||||
* Copyright (c) 2014 Martin Storsjo
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* 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 FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "libavformat/avformat.h"
|
||||
#include "libavutil/avstring.h"
|
||||
#include "libavutil/intreadwrite.h"
|
||||
#include "libavutil/mathematics.h"
|
||||
|
||||
static int usage(const char *argv0, int ret)
|
||||
{
|
||||
fprintf(stderr, "%s -out foo.mpd file1\n", argv0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct Track {
|
||||
const char *name;
|
||||
int64_t duration;
|
||||
int bitrate;
|
||||
int track_id;
|
||||
int is_audio, is_video;
|
||||
int width, height;
|
||||
int sample_rate, channels;
|
||||
int timescale;
|
||||
char codec_str[30];
|
||||
int64_t sidx_start, sidx_length;
|
||||
};
|
||||
|
||||
struct Tracks {
|
||||
int nb_tracks;
|
||||
int64_t duration;
|
||||
struct Track **tracks;
|
||||
int multiple_tracks_per_file;
|
||||
};
|
||||
|
||||
static void set_codec_str(AVCodecParameters *codecpar, char *str, int size)
|
||||
{
|
||||
switch (codecpar->codec_id) {
|
||||
case AV_CODEC_ID_H264:
|
||||
snprintf(str, size, "avc1");
|
||||
if (codecpar->extradata_size >= 4 && codecpar->extradata[0] == 1) {
|
||||
av_strlcatf(str, size, ".%02x%02x%02x",
|
||||
codecpar->extradata[1], codecpar->extradata[2],
|
||||
codecpar->extradata[3]);
|
||||
}
|
||||
break;
|
||||
case AV_CODEC_ID_AAC:
|
||||
snprintf(str, size, "mp4a.40"); // 0x40 is the mp4 object type for AAC
|
||||
if (codecpar->extradata_size >= 2) {
|
||||
int aot = codecpar->extradata[0] >> 3;
|
||||
if (aot == 31)
|
||||
aot = ((AV_RB16(codecpar->extradata) >> 5) & 0x3f) + 32;
|
||||
av_strlcatf(str, size, ".%d", aot);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static int find_sidx(struct Tracks *tracks, int start_index,
|
||||
const char *file)
|
||||
{
|
||||
int err = 0;
|
||||
AVIOContext *f = NULL;
|
||||
int i;
|
||||
|
||||
if ((err = avio_open2(&f, file, AVIO_FLAG_READ, NULL, NULL)) < 0)
|
||||
goto fail;
|
||||
|
||||
while (!f->eof_reached) {
|
||||
int64_t pos = avio_tell(f);
|
||||
int32_t size, tag;
|
||||
|
||||
size = avio_rb32(f);
|
||||
tag = avio_rb32(f);
|
||||
if (size < 8)
|
||||
break;
|
||||
if (tag == MKBETAG('s', 'i', 'd', 'x')) {
|
||||
for (i = start_index; i < tracks->nb_tracks; i++) {
|
||||
struct Track *track = tracks->tracks[i];
|
||||
if (!track->sidx_start) {
|
||||
track->sidx_start = pos;
|
||||
track->sidx_length = size;
|
||||
} else if (pos == track->sidx_start + track->sidx_length) {
|
||||
track->sidx_length = pos + size - track->sidx_start;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (avio_seek(f, pos + size, SEEK_SET) != pos + size)
|
||||
break;
|
||||
}
|
||||
|
||||
fail:
|
||||
if (f)
|
||||
avio_close(f);
|
||||
return err;
|
||||
}
|
||||
|
||||
static int handle_file(struct Tracks *tracks, const char *file)
|
||||
{
|
||||
AVFormatContext *ctx = NULL;
|
||||
int err = 0, i, orig_tracks = tracks->nb_tracks;
|
||||
char errbuf[50], *ptr;
|
||||
struct Track *track;
|
||||
|
||||
err = avformat_open_input(&ctx, file, NULL, NULL);
|
||||
if (err < 0) {
|
||||
av_strerror(err, errbuf, sizeof(errbuf));
|
||||
fprintf(stderr, "Unable to open %s: %s\n", file, errbuf);
|
||||
return 1;
|
||||
}
|
||||
|
||||
err = avformat_find_stream_info(ctx, NULL);
|
||||
if (err < 0) {
|
||||
av_strerror(err, errbuf, sizeof(errbuf));
|
||||
fprintf(stderr, "Unable to identify %s: %s\n", file, errbuf);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (ctx->nb_streams < 1) {
|
||||
fprintf(stderr, "No streams found in %s\n", file);
|
||||
goto fail;
|
||||
}
|
||||
if (ctx->nb_streams > 1)
|
||||
tracks->multiple_tracks_per_file = 1;
|
||||
|
||||
for (i = 0; i < ctx->nb_streams; i++) {
|
||||
struct Track **temp;
|
||||
AVStream *st = ctx->streams[i];
|
||||
|
||||
if (st->codecpar->bit_rate == 0) {
|
||||
fprintf(stderr, "Skipping track %d in %s as it has zero bitrate\n",
|
||||
st->id, file);
|
||||
continue;
|
||||
}
|
||||
|
||||
track = av_mallocz(sizeof(*track));
|
||||
if (!track) {
|
||||
err = AVERROR(ENOMEM);
|
||||
goto fail;
|
||||
}
|
||||
temp = av_realloc_array(tracks->tracks, tracks->nb_tracks + 1,
|
||||
sizeof(*tracks->tracks));
|
||||
if (!temp) {
|
||||
av_free(track);
|
||||
err = AVERROR(ENOMEM);
|
||||
goto fail;
|
||||
}
|
||||
tracks->tracks = temp;
|
||||
tracks->tracks[tracks->nb_tracks] = track;
|
||||
|
||||
track->name = file;
|
||||
if ((ptr = strrchr(file, '/')))
|
||||
track->name = ptr + 1;
|
||||
|
||||
track->bitrate = st->codecpar->bit_rate;
|
||||
track->track_id = st->id;
|
||||
track->timescale = st->time_base.den;
|
||||
track->duration = st->duration;
|
||||
track->is_audio = st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO;
|
||||
track->is_video = st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO;
|
||||
|
||||
if (!track->is_audio && !track->is_video) {
|
||||
fprintf(stderr,
|
||||
"Track %d in %s is neither video nor audio, skipping\n",
|
||||
track->track_id, file);
|
||||
av_freep(&tracks->tracks[tracks->nb_tracks]);
|
||||
continue;
|
||||
}
|
||||
|
||||
tracks->duration = FFMAX(tracks->duration,
|
||||
av_rescale_rnd(track->duration, AV_TIME_BASE,
|
||||
track->timescale, AV_ROUND_UP));
|
||||
|
||||
if (track->is_audio) {
|
||||
track->channels = st->codecpar->channels;
|
||||
track->sample_rate = st->codecpar->sample_rate;
|
||||
}
|
||||
if (track->is_video) {
|
||||
track->width = st->codecpar->width;
|
||||
track->height = st->codecpar->height;
|
||||
}
|
||||
set_codec_str(st->codecpar, track->codec_str, sizeof(track->codec_str));
|
||||
|
||||
tracks->nb_tracks++;
|
||||
}
|
||||
|
||||
avformat_close_input(&ctx);
|
||||
|
||||
err = find_sidx(tracks, orig_tracks, file);
|
||||
|
||||
fail:
|
||||
if (ctx)
|
||||
avformat_close_input(&ctx);
|
||||
return err;
|
||||
}
|
||||
|
||||
static void write_time(FILE *out, int64_t time, int decimals, enum AVRounding round)
|
||||
{
|
||||
int seconds = time / AV_TIME_BASE;
|
||||
int fractions = time % AV_TIME_BASE;
|
||||
int minutes = seconds / 60;
|
||||
int hours = minutes / 60;
|
||||
fractions = av_rescale_rnd(fractions, pow(10, decimals), AV_TIME_BASE, round);
|
||||
seconds %= 60;
|
||||
minutes %= 60;
|
||||
fprintf(out, "PT");
|
||||
if (hours)
|
||||
fprintf(out, "%dH", hours);
|
||||
if (hours || minutes)
|
||||
fprintf(out, "%dM", minutes);
|
||||
fprintf(out, "%d.%0*dS", seconds, decimals, fractions);
|
||||
}
|
||||
|
||||
static int output_mpd(struct Tracks *tracks, const char *filename)
|
||||
{
|
||||
FILE *out;
|
||||
int i, j, ret = 0;
|
||||
struct Track **adaptation_sets_buf[2] = { NULL };
|
||||
struct Track ***adaptation_sets;
|
||||
int nb_tracks_buf[2] = { 0 };
|
||||
int *nb_tracks;
|
||||
int set, nb_sets;
|
||||
|
||||
if (!tracks->multiple_tracks_per_file) {
|
||||
adaptation_sets = adaptation_sets_buf;
|
||||
nb_tracks = nb_tracks_buf;
|
||||
nb_sets = 2;
|
||||
for (i = 0; i < 2; i++) {
|
||||
adaptation_sets[i] = av_malloc_array(tracks->nb_tracks, sizeof(*adaptation_sets[i]));
|
||||
if (!adaptation_sets[i]) {
|
||||
ret = AVERROR(ENOMEM);
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < tracks->nb_tracks; i++) {
|
||||
int set_index = -1;
|
||||
if (tracks->tracks[i]->is_video)
|
||||
set_index = 0;
|
||||
else if (tracks->tracks[i]->is_audio)
|
||||
set_index = 1;
|
||||
else
|
||||
continue;
|
||||
adaptation_sets[set_index][nb_tracks[set_index]++] = tracks->tracks[i];
|
||||
}
|
||||
} else {
|
||||
adaptation_sets = &tracks->tracks;
|
||||
nb_tracks = &tracks->nb_tracks;
|
||||
nb_sets = 1;
|
||||
}
|
||||
|
||||
out = fopen(filename, "w");
|
||||
if (!out) {
|
||||
ret = AVERROR(errno);
|
||||
perror(filename);
|
||||
return ret;
|
||||
}
|
||||
fprintf(out, "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
|
||||
fprintf(out, "<MPD xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
|
||||
"\txmlns=\"urn:mpeg:dash:schema:mpd:2011\"\n"
|
||||
"\txmlns:xlink=\"http://www.w3.org/1999/xlink\"\n"
|
||||
"\txsi:schemaLocation=\"urn:mpeg:DASH:schema:MPD:2011 http://standards.iso.org/ittf/PubliclyAvailableStandards/MPEG-DASH_schema_files/DASH-MPD.xsd\"\n"
|
||||
"\tprofiles=\"urn:mpeg:dash:profile:isoff-on-demand:2011\"\n"
|
||||
"\ttype=\"static\"\n");
|
||||
fprintf(out, "\tmediaPresentationDuration=\"");
|
||||
write_time(out, tracks->duration, 1, AV_ROUND_DOWN);
|
||||
fprintf(out, "\"\n");
|
||||
fprintf(out, "\tminBufferTime=\"PT5S\">\n");
|
||||
|
||||
fprintf(out, "\t<Period start=\"PT0.0S\">\n");
|
||||
|
||||
for (set = 0; set < nb_sets; set++) {
|
||||
if (nb_tracks[set] == 0)
|
||||
continue;
|
||||
fprintf(out, "\t\t<AdaptationSet segmentAlignment=\"true\">\n");
|
||||
if (nb_sets == 1) {
|
||||
for (i = 0; i < nb_tracks[set]; i++) {
|
||||
struct Track *track = adaptation_sets[set][i];
|
||||
if (strcmp(track->name, adaptation_sets[set][0]->name))
|
||||
break;
|
||||
fprintf(out, "\t\t\t<ContentComponent id=\"%d\" contentType=\"%s\" />\n", track->track_id, track->is_audio ? "audio" : "video");
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < nb_tracks[set]; ) {
|
||||
struct Track *first_track = adaptation_sets[set][i];
|
||||
int width = 0, height = 0, sample_rate = 0, channels = 0, bitrate = 0;
|
||||
fprintf(out, "\t\t\t<Representation id=\"%d\" codecs=\"", i);
|
||||
for (j = i; j < nb_tracks[set]; j++) {
|
||||
struct Track *track = adaptation_sets[set][j];
|
||||
if (strcmp(track->name, first_track->name))
|
||||
break;
|
||||
if (track->is_audio) {
|
||||
sample_rate = track->sample_rate;
|
||||
channels = track->channels;
|
||||
}
|
||||
if (track->is_video) {
|
||||
width = track->width;
|
||||
height = track->height;
|
||||
}
|
||||
bitrate += track->bitrate;
|
||||
if (j > i)
|
||||
fprintf(out, ",");
|
||||
fprintf(out, "%s", track->codec_str);
|
||||
}
|
||||
fprintf(out, "\" mimeType=\"%s/mp4\" bandwidth=\"%d\"",
|
||||
width ? "video" : "audio", bitrate);
|
||||
if (width > 0 && height > 0)
|
||||
fprintf(out, " width=\"%d\" height=\"%d\"", width, height);
|
||||
if (sample_rate > 0)
|
||||
fprintf(out, " audioSamplingRate=\"%d\"", sample_rate);
|
||||
fprintf(out, ">\n");
|
||||
if (channels > 0)
|
||||
fprintf(out, "\t\t\t\t<AudioChannelConfiguration schemeIdUri=\"urn:mpeg:dash:23003:3:audio_channel_configuration:2011\" value=\"%d\" />\n", channels);
|
||||
fprintf(out, "\t\t\t\t<BaseURL>%s</BaseURL>\n", first_track->name);
|
||||
fprintf(out, "\t\t\t\t<SegmentBase indexRange=\"%"PRId64"-%"PRId64"\" />\n", first_track->sidx_start, first_track->sidx_start + first_track->sidx_length - 1);
|
||||
fprintf(out, "\t\t\t</Representation>\n");
|
||||
i = j;
|
||||
}
|
||||
fprintf(out, "\t\t</AdaptationSet>\n");
|
||||
}
|
||||
fprintf(out, "\t</Period>\n");
|
||||
fprintf(out, "</MPD>\n");
|
||||
|
||||
fclose(out);
|
||||
err:
|
||||
for (i = 0; i < 2; i++)
|
||||
av_free(adaptation_sets_buf[i]);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void clean_tracks(struct Tracks *tracks)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < tracks->nb_tracks; i++) {
|
||||
av_freep(&tracks->tracks[i]);
|
||||
}
|
||||
av_freep(&tracks->tracks);
|
||||
tracks->nb_tracks = 0;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
const char *out = NULL;
|
||||
struct Tracks tracks = { 0 };
|
||||
int i;
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (!strcmp(argv[i], "-out")) {
|
||||
out = argv[i + 1];
|
||||
i++;
|
||||
} else if (argv[i][0] == '-') {
|
||||
return usage(argv[0], 1);
|
||||
} else {
|
||||
if (handle_file(&tracks, argv[i]))
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
if (!tracks.nb_tracks || !out)
|
||||
return usage(argv[0], 1);
|
||||
|
||||
output_mpd(&tracks, out);
|
||||
|
||||
clean_tracks(&tracks);
|
||||
|
||||
return 0;
|
||||
}
|
99
externals/ffmpeg/tools/sofa2wavs.c
vendored
Executable file
99
externals/ffmpeg/tools/sofa2wavs.c
vendored
Executable file
@@ -0,0 +1,99 @@
|
||||
/*
|
||||
* Copyright (c) 2017 Paul B Mahol
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* 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 FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <mysofa.h>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
struct MYSOFA_HRTF *hrtf;
|
||||
int sample_rate;
|
||||
int err, i, j;
|
||||
|
||||
if (argc < 3) {
|
||||
printf("usage: %s input_SOFA_file output_directory\n", argv[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
hrtf = mysofa_load(argv[1], &err);
|
||||
if (!hrtf || err) {
|
||||
printf("invalid input SOFA file: %s\n", argv[1]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (hrtf->DataSamplingRate.elements != 1)
|
||||
goto fail;
|
||||
sample_rate = hrtf->DataSamplingRate.values[0];
|
||||
|
||||
err = mkdir(argv[2], 0744);
|
||||
if (err)
|
||||
goto fail;
|
||||
|
||||
err = chdir(argv[2]);
|
||||
if (err)
|
||||
goto fail;
|
||||
|
||||
for (i = 0; i < hrtf->M; i++) {
|
||||
FILE *file;
|
||||
int bps = 32;
|
||||
int blkalign = 8;
|
||||
int bytespersec = blkalign * sample_rate;
|
||||
char filename[1024];
|
||||
int azi = hrtf->SourcePosition.values[i * 3];
|
||||
int ele = hrtf->SourcePosition.values[i * 3 + 1];
|
||||
int dis = hrtf->SourcePosition.values[i * 3 + 2];
|
||||
int size = 8 * hrtf->N;
|
||||
int offset = i * 2 * hrtf->N;
|
||||
|
||||
snprintf(filename, sizeof(filename), "azi_%d_ele_%d_dis_%d.wav", azi, ele, dis);
|
||||
file = fopen(filename, "w+");
|
||||
fwrite("RIFF", 4, 1, file);
|
||||
fwrite("\xFF\xFF\xFF\xFF", 4, 1, file);
|
||||
fwrite("WAVE", 4, 1, file);
|
||||
fwrite("fmt ", 4, 1, file);
|
||||
fwrite("\x10\x00\00\00", 4, 1, file);
|
||||
fwrite("\x03\x00", 2, 1, file);
|
||||
fwrite("\x02\x00", 2, 1, file);
|
||||
fwrite(&sample_rate, 4, 1, file);
|
||||
fwrite(&bytespersec, 4, 1, file);
|
||||
fwrite(&blkalign, 2, 1, file);
|
||||
fwrite(&bps, 2, 1, file);
|
||||
fwrite("data", 4, 1, file);
|
||||
fwrite(&size, 4, 1, file);
|
||||
|
||||
for (j = 0; j < hrtf->N; j++) {
|
||||
float l, r;
|
||||
|
||||
l = hrtf->DataIR.values[offset + j];
|
||||
r = hrtf->DataIR.values[offset + j + hrtf->N];
|
||||
fwrite(&l, 4, 1, file);
|
||||
fwrite(&r, 4, 1, file);
|
||||
}
|
||||
fclose(file);
|
||||
}
|
||||
|
||||
fail:
|
||||
mysofa_free(hrtf);
|
||||
|
||||
return 0;
|
||||
}
|
153
externals/ffmpeg/tools/target_bsf_fuzzer.c
vendored
Executable file
153
externals/ffmpeg/tools/target_bsf_fuzzer.c
vendored
Executable file
@@ -0,0 +1,153 @@
|
||||
/*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* 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 FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "libavutil/imgutils.h"
|
||||
|
||||
#include "libavcodec/avcodec.h"
|
||||
#include "libavcodec/bsf_internal.h"
|
||||
#include "libavcodec/bytestream.h"
|
||||
#include "libavcodec/internal.h"
|
||||
|
||||
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size);
|
||||
|
||||
static void error(const char *err)
|
||||
{
|
||||
fprintf(stderr, "%s", err);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
static AVBitStreamFilter *f = NULL;
|
||||
|
||||
static const uint64_t FUZZ_TAG = 0x4741542D5A5A5546ULL;
|
||||
|
||||
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
||||
const uint64_t fuzz_tag = FUZZ_TAG;
|
||||
const uint8_t *last = data;
|
||||
const uint8_t *end = data + size;
|
||||
AVBSFContext *bsf = NULL;
|
||||
AVPacket in, out;
|
||||
uint64_t keyframes = 0;
|
||||
int res;
|
||||
|
||||
if (!f) {
|
||||
#ifdef FFMPEG_BSF
|
||||
#define BSF_SYMBOL0(BSF) ff_##BSF##_bsf
|
||||
#define BSF_SYMBOL(BSF) BSF_SYMBOL0(BSF)
|
||||
extern AVBitStreamFilter BSF_SYMBOL(FFMPEG_BSF);
|
||||
f = &BSF_SYMBOL(FFMPEG_BSF);
|
||||
#else
|
||||
extern AVBitStreamFilter ff_null_bsf;
|
||||
f = &ff_null_bsf;
|
||||
#endif
|
||||
av_log_set_level(AV_LOG_PANIC);
|
||||
}
|
||||
|
||||
res = av_bsf_alloc(f, &bsf);
|
||||
if (res < 0)
|
||||
error("Failed memory allocation");
|
||||
|
||||
if (size > 1024) {
|
||||
GetByteContext gbc;
|
||||
int extradata_size;
|
||||
size -= 1024;
|
||||
bytestream2_init(&gbc, data + size, 1024);
|
||||
bsf->par_in->width = bytestream2_get_le32(&gbc);
|
||||
bsf->par_in->height = bytestream2_get_le32(&gbc);
|
||||
bsf->par_in->bit_rate = bytestream2_get_le64(&gbc);
|
||||
bsf->par_in->bits_per_coded_sample = bytestream2_get_le32(&gbc);
|
||||
|
||||
if (f->codec_ids) {
|
||||
int i, id;
|
||||
for (i = 0; f->codec_ids[i] != AV_CODEC_ID_NONE; i++);
|
||||
id = f->codec_ids[bytestream2_get_byte(&gbc) % i];
|
||||
bsf->par_in->codec_id = id;
|
||||
bsf->par_in->codec_tag = bytestream2_get_le32(&gbc);
|
||||
}
|
||||
|
||||
extradata_size = bytestream2_get_le32(&gbc);
|
||||
|
||||
bsf->par_in->sample_rate = bytestream2_get_le32(&gbc);
|
||||
bsf->par_in->channels = (unsigned)bytestream2_get_le32(&gbc) % FF_SANE_NB_CHANNELS;
|
||||
bsf->par_in->block_align = bytestream2_get_le32(&gbc);
|
||||
keyframes = bytestream2_get_le64(&gbc);
|
||||
|
||||
if (extradata_size < size) {
|
||||
bsf->par_in->extradata = av_mallocz(extradata_size + AV_INPUT_BUFFER_PADDING_SIZE);
|
||||
if (bsf->par_in->extradata) {
|
||||
bsf->par_in->extradata_size = extradata_size;
|
||||
size -= bsf->par_in->extradata_size;
|
||||
memcpy(bsf->par_in->extradata, data + size, bsf->par_in->extradata_size);
|
||||
}
|
||||
}
|
||||
if (av_image_check_size(bsf->par_in->width, bsf->par_in->height, 0, bsf))
|
||||
bsf->par_in->width = bsf->par_in->height = 0;
|
||||
}
|
||||
|
||||
res = av_bsf_init(bsf);
|
||||
if (res < 0) {
|
||||
av_bsf_free(&bsf);
|
||||
return 0; // Failure of av_bsf_init() does not imply that a issue was found
|
||||
}
|
||||
|
||||
av_init_packet(&in);
|
||||
av_init_packet(&out);
|
||||
out.data = NULL;
|
||||
out.size = 0;
|
||||
while (data < end) {
|
||||
// Search for the TAG
|
||||
while (data + sizeof(fuzz_tag) < end) {
|
||||
if (data[0] == (fuzz_tag & 0xFF) && AV_RN64(data) == fuzz_tag)
|
||||
break;
|
||||
data++;
|
||||
}
|
||||
if (data + sizeof(fuzz_tag) > end)
|
||||
data = end;
|
||||
|
||||
res = av_new_packet(&in, data - last);
|
||||
if (res < 0)
|
||||
error("Failed memory allocation");
|
||||
memcpy(in.data, last, data - last);
|
||||
in.flags = (keyframes & 1) * AV_PKT_FLAG_DISCARD + (!!(keyframes & 2)) * AV_PKT_FLAG_KEY;
|
||||
keyframes = (keyframes >> 2) + (keyframes<<62);
|
||||
data += sizeof(fuzz_tag);
|
||||
last = data;
|
||||
|
||||
while (in.size) {
|
||||
res = av_bsf_send_packet(bsf, &in);
|
||||
if (res < 0 && res != AVERROR(EAGAIN))
|
||||
break;
|
||||
res = av_bsf_receive_packet(bsf, &out);
|
||||
if (res < 0)
|
||||
break;
|
||||
av_packet_unref(&out);
|
||||
}
|
||||
av_packet_unref(&in);
|
||||
}
|
||||
|
||||
res = av_bsf_send_packet(bsf, NULL);
|
||||
while (!res) {
|
||||
res = av_bsf_receive_packet(bsf, &out);
|
||||
if (res < 0)
|
||||
break;
|
||||
av_packet_unref(&out);
|
||||
}
|
||||
|
||||
av_bsf_free(&bsf);
|
||||
return 0;
|
||||
}
|
656
externals/ffmpeg/tools/target_dec_fate.list
vendored
Executable file
656
externals/ffmpeg/tools/target_dec_fate.list
vendored
Executable file
@@ -0,0 +1,656 @@
|
||||
496/clusterfuzz-testcase-5805083497332736 target_dec_jpegls_fuzzer
|
||||
498/clusterfuzz-testcase-6157986632302592 target_dec_tiff_fuzzer
|
||||
500/clusterfuzz-testcase-6315221727576064 target_dec_png_fuzzer
|
||||
501/clusterfuzz-testcase-5672752870588416 target_dec_sipr_fuzzer
|
||||
503/clusterfuzz-testcase-6386429735206912 target_dec_mp3_fuzzer
|
||||
508/clusterfuzz-testcase-6245747678773248 target_dec_amrnb_fuzzer
|
||||
510/clusterfuzz-testcase-5737865715646464 target_dec_dca_fuzzer
|
||||
540/clusterfuzz-testcase-5674546153652224 target_dec_jpegls_fuzzer
|
||||
544/clusterfuzz-testcase-5936536407244800.f8bd9b24_8ba77916_70c2c7be_3df6a2ea_96cd9f14 target_dec_interplay_video_fuzzer
|
||||
546/clusterfuzz-testcase-4809433909559296 target_dec_png_fuzzer
|
||||
555/clusterfuzz-testcase-5986646595993600 target_dec_movtext_fuzzer
|
||||
559/clusterfuzz-testcase-6424225917173760 target_dec_pictor_fuzzer
|
||||
607/clusterfuzz-testcase-5108792465293312 target_dec_wavpack_fuzzer
|
||||
608/clusterfuzz-testcase-6039782863929344 target_dec_mpeg2video_fuzzer
|
||||
609/clusterfuzz-testcase-4825202619842560 target_dec_png_fuzzer
|
||||
610/clusterfuzz-testcase-4831030085156864 target_dec_ac3_fuzzer
|
||||
611/clusterfuzz-testcase-5613455820193792 target_dec_mjpeg_fuzzer
|
||||
612/clusterfuzz-testcase-4707817137111040 target_dec_mpeg4_fuzzer
|
||||
614/clusterfuzz-testcase-4931860079575040 target_dec_h264_fuzzer
|
||||
615/clusterfuzz-testcase-5488002644049920 target_dec_h264_fuzzer
|
||||
616/clusterfuzz-testcase-5724692654587904 target_dec_jpegls_fuzzer
|
||||
617/clusterfuzz-testcase-6413875723370496 target_dec_subrip_fuzzer
|
||||
618/clusterfuzz-testcase-6594990333493248 target_dec_h263_fuzzer
|
||||
619/clusterfuzz-testcase-5803914534322176 target_dec_dvbsub_fuzzer
|
||||
622/clusterfuzz-testcase-5745722022428672 target_dec_pictor_fuzzer
|
||||
626/clusterfuzz-testcase-4738718621499392 target_dec_flac_fuzzer
|
||||
628/clusterfuzz-testcase-6187747641393152 target_dec_flac_fuzzer
|
||||
629/clusterfuzz-testcase-6697457381539840 target_dec_dca_fuzzer
|
||||
630/clusterfuzz-testcase-6608718928019456 target_dec_rv40_fuzzer
|
||||
631/clusterfuzz-testcase-6725491035734016 target_dec_mp3_fuzzer
|
||||
633/clusterfuzz-testcase-4553133554401280 target_dec_dvvideo_fuzzer
|
||||
634/clusterfuzz-testcase-5285420445204480 target_dec_h264_fuzzer
|
||||
637/clusterfuzz-testcase-5713159862091776 target_dec_rv40_fuzzer
|
||||
639/clusterfuzz-testcase-5143866241974272 target_dec_h263_fuzzer
|
||||
656/clusterfuzz-testcase-6463814516080640 target_dec_mpeg4_fuzzer
|
||||
657/clusterfuzz-testcase-6674741433729024 target_dec_jpegls_fuzzer
|
||||
658/clusterfuzz-testcase-6691260146384896 target_dec_mpeg4_fuzzer
|
||||
659/clusterfuzz-testcase-5866673603084288 target_dec_h263_fuzzer
|
||||
662/clusterfuzz-testcase-4898131432964096 target_dec_rv30_fuzzer
|
||||
662/clusterfuzz-testcase-4898131432964096 target_dec_rv40_fuzzer
|
||||
664/clusterfuzz-testcase-4917047475568640 target_dec_vp6_fuzzer
|
||||
665/clusterfuzz-testcase-4863789881098240 target_dec_mp2_fuzzer
|
||||
665/clusterfuzz-testcase-4863789881098240 target_dec_mp3_fuzzer
|
||||
670/clusterfuzz-testcase-4852021066727424 target_dec_h263_fuzzer
|
||||
671/clusterfuzz-testcase-4990381827555328 target_dec_mpeg1video_fuzzer
|
||||
672/clusterfuzz-testcase-5595018867769344 target_dec_eac3_fuzzer
|
||||
673/clusterfuzz-testcase-5948736536576000 target_dec_flac_fuzzer
|
||||
674/clusterfuzz-testcase-6713275880308736 target_dec_mpeg4_fuzzer
|
||||
675/clusterfuzz-testcase-6722971232108544 target_dec_pictor_fuzzer
|
||||
677/clusterfuzz-testcase-6635120628858880 target_dec_h264_fuzzer
|
||||
680/clusterfuzz-testcase-5416627266912256 target_dec_dca_fuzzer
|
||||
681/clusterfuzz-testcase-5013323462475776 target_dec_dca_fuzzer
|
||||
700/clusterfuzz-testcase-5660909504561152 target_dec_vp6_fuzzer
|
||||
701/clusterfuzz-testcase-6594719951880192 target_dec_mpeg4_fuzzer
|
||||
702/clusterfuzz-testcase-4553541576294400 target_dec_vp5_fuzzer
|
||||
712/clusterfuzz-testcase-6647676227551232 target_dec_h264_fuzzer
|
||||
713/clusterfuzz-testcase-4999324687663104 target_dec_h264_fuzzer
|
||||
716/clusterfuzz-testcase-4890287480504320 target_dec_mpeg4_fuzzer
|
||||
717/clusterfuzz-testcase-5434924129583104 target_dec_wavpack_fuzzer
|
||||
719/clusterfuzz-testcase-6214837208088576 target_dec_vp6f_fuzzer
|
||||
722/clusterfuzz-testcase-5711268868521984 target_dec_dca_fuzzer
|
||||
723/clusterfuzz-testcase-6471394663596032 target_dec_wavpack_fuzzer
|
||||
724/clusterfuzz-testcase-6738249571631104 target_dec_pictor_fuzzer
|
||||
729/clusterfuzz-testcase-5154831595470848 target_dec_wavpack_fuzzer
|
||||
730/clusterfuzz-testcase-5265113739165696 target_dec_vp8_fuzzer
|
||||
731/clusterfuzz-testcase-5391628980191232 target_dec_flac_fuzzer
|
||||
732/clusterfuzz-testcase-4872990070145024 target_dec_dca_fuzzer
|
||||
733/clusterfuzz-testcase-4682158096515072 target_dec_mjpeg_fuzzer
|
||||
734/clusterfuzz-testcase-4821293192970240 target_dec_h264_fuzzer
|
||||
736/clusterfuzz-testcase-5580263943831552 target_dec_mpeg4_fuzzer
|
||||
741/clusterfuzz-testcase-5869962004529152 target_dec_movtext_fuzzer
|
||||
755/clusterfuzz-testcase-5369072516595712 target_dec_h264_fuzzer
|
||||
758/clusterfuzz-testcase-4720832028868608 target_dec_vp5_fuzzer
|
||||
761/clusterfuzz-testcase-5442222252097536 target_dec_wavpack_fuzzer
|
||||
762/clusterfuzz-testcase-5927683747741696 target_dec_dca_fuzzer
|
||||
763/clusterfuzz-testcase-6007567320875008 target_dec_amrwb_fuzzer
|
||||
764/clusterfuzz-testcase-6273034652483584 target_dec_mpeg2video_fuzzer
|
||||
766/clusterfuzz-testcase-4603047080624128 target_dec_vp6_fuzzer
|
||||
767/clusterfuzz-testcase-6743603416137728 target_dec_vp6f_fuzzer
|
||||
768/clusterfuzz-testcase-4807444305805312 target_dec_rv40_fuzzer
|
||||
772/clusterfuzz-testcase-5453962780082176 target_dec_h264_fuzzer
|
||||
773/clusterfuzz-testcase-6362160458366976 target_dec_vp6f_fuzzer
|
||||
779/clusterfuzz-testcase-5568669545398272 target_dec_mpeg4_fuzzer
|
||||
780/clusterfuzz-testcase-6393552642768896 target_dec_gif_fuzzer
|
||||
807/clusterfuzz-testcase-6470061042696192 target_dec_vp6f_fuzzer
|
||||
808/clusterfuzz-testcase-4715513349406720 target_dec_wavpack_fuzzer
|
||||
809/clusterfuzz-testcase-6172687908995072 target_dec_vp6f_fuzzer
|
||||
810/clusterfuzz-testcase-5249282825256960 target_dec_targa_fuzzer
|
||||
811/clusterfuzz-testcase-6465493076541440 target_dec_mjpeg_fuzzer
|
||||
822/clusterfuzz-testcase-4873433189974016 target_dec_wavpack_fuzzer
|
||||
823/clusterfuzz-testcase-6727060074528768 target_dec_pictor_fuzzer
|
||||
826/clusterfuzz-testcase-5316921379520512 target_dec_tiff_fuzzer
|
||||
830/clusterfuzz-testcase-6253175327686656 target_dec_mp2_fuzzer
|
||||
839/clusterfuzz-testcase-4871084446842880 target_dec_wavpack_fuzzer
|
||||
842/clusterfuzz-testcase-6361547318231040 target_dec_tiff_fuzzer
|
||||
847/clusterfuzz-testcase-5291877358108672 target_dec_vp5_fuzzer
|
||||
848/clusterfuzz-testcase-5432155620507648 target_dec_vp6f_fuzzer
|
||||
850/clusterfuzz-testcase-5721296509861888 target_dec_vp6f_fuzzer
|
||||
857/clusterfuzz-testcase-5319093760557056 target_dec_h264_fuzzer
|
||||
858/clusterfuzz-testcase-5168477042114560 target_dec_h264_fuzzer
|
||||
861/clusterfuzz-testcase-5688284384591872 target_dec_tiff_fuzzer
|
||||
864/clusterfuzz-testcase-4774385942528000 target_dec_h264_fuzzer
|
||||
870/clusterfuzz-testcase-5649105424482304 target_dec_mjpeg_fuzzer
|
||||
873/clusterfuzz-testcase-5714546230558720 target_dec_mp3_fuzzer
|
||||
874/clusterfuzz-testcase-5252796175613952 target_dec_tiff_fuzzer
|
||||
894/clusterfuzz-testcase-4841537823309824 target_dec_wavpack_fuzzer
|
||||
898/clusterfuzz-testcase-6149765467209728 target_dec_pictor_fuzzer
|
||||
902/clusterfuzz-testcase-4561155144024064 target_dec_h264_fuzzer
|
||||
911/clusterfuzz-testcase-5415105606975488 target_dec_h264_fuzzer
|
||||
936/clusterfuzz-testcase-4700061919346688 target_dec_tiff_fuzzer
|
||||
938/clusterfuzz-testcase-4791735110598656 target_dec_amrnb_fuzzer
|
||||
939/clusterfuzz-testcase-6515070404132864 target_dec_h264_fuzzer
|
||||
940/clusterfuzz-testcase-5200378381467648 target_dec_wavpack_fuzzer
|
||||
943/clusterfuzz-testcase-5114865297391616 target_dec_jpegls_fuzzer
|
||||
943/clusterfuzz-testcase-5114865297391616 target_dec_mjpeg_fuzzer
|
||||
945/clusterfuzz-testcase-6037937588273152 target_dec_wavpack_fuzzer
|
||||
979/clusterfuzz-testcase-4940780542099456 target_dec_h264_fuzzer
|
||||
1044/clusterfuzz-testcase-minimized-ffmpeg_AUDIO_AV_CODEC_ID_DTS_fuzzer-6135262067294208 target_dec_dca_fuzzer
|
||||
1072/clusterfuzz-testcase-6456688074817536 target_dec_aac_fuzzer
|
||||
1080/clusterfuzz-testcase-5353236754071552 target_dec_dvdsub_fuzzer
|
||||
1085/clusterfuzz-testcase-6089649833377792 target_dec_tiff_fuzzer
|
||||
1133/clusterfuzz-testcase-minimized-ffmpeg_VIDEO_AV_CODEC_ID_MJPEG_fuzzer-4861925596856320 target_dec_mjpeg_fuzzer
|
||||
1136/clusterfuzz-testcase-6024209379622912 target_dec_sipr_fuzzer
|
||||
1137/clusterfuzz-testcase-6711216560930816 target_dec_jpegls_fuzzer
|
||||
1141/clusterfuzz-testcase-6659734767665152 target_dec_amrnb_fuzzer
|
||||
1213/clusterfuzz-testcase-minimized-6022987469815808 target_dec_tiff_fuzzer
|
||||
1214/clusterfuzz-testcase-minimized-6130606599569408 target_dec_h264_fuzzer
|
||||
1271/clusterfuzz-testcase-minimized-6095220498235392 target_dec_targa_fuzzer
|
||||
1275/clusterfuzz-testcase-minimized-6718162017976320 target_dec_mdec_fuzzer
|
||||
1280/clusterfuzz-testcase-minimized-6102353767825408 target_dec_svq3_fuzzer
|
||||
1282/clusterfuzz-testcase-minimized-5400131681648640 target_dec_bmp_fuzzer
|
||||
1283/clusterfuzz-testcase-minimized-6221126759874560 target_dec_vp3_fuzzer
|
||||
1290/clusterfuzz-testcase-minimized-5815578902134784 target_dec_indeo2_fuzzer
|
||||
1292/clusterfuzz-testcase-minimized-5795512143839232 target_dec_flic_fuzzer
|
||||
1293/clusterfuzz-testcase-minimized-6054752074858496 target_dec_smc_fuzzer
|
||||
1298/clusterfuzz-testcase-minimized-5955580877340672 target_dec_mpeg4_fuzzer
|
||||
1305/clusterfuzz-testcase-minimized-5787235003662336 target_dec_amv_fuzzer
|
||||
1306/clusterfuzz-testcase-minimized-6152296217968640 target_dec_msvideo1_fuzzer
|
||||
1309/clusterfuzz-testcase-minimized-5754803370065920 target_dec_pcx_fuzzer
|
||||
1314/clusterfuzz-testcase-minimized-4621997222920192 target_dec_png_fuzzer
|
||||
1321/clusterfuzz-testcase-minimized-5875549597597696 target_dec_cinepak_fuzzer
|
||||
1322/clusterfuzz-testcase-minimized-4728193644756992 target_dec_png_fuzzer
|
||||
1335/clusterfuzz-testcase-minimized-5566961566089216 target_dec_cavs_fuzzer
|
||||
1336/clusterfuzz-testcase-minimized-4761381930795008 target_dec_pixlet_fuzzer
|
||||
1337/clusterfuzz-testcase-minimized-5212314171080704 target_dec_aac_fuzzer
|
||||
1338/clusterfuzz-testcase-minimized-6485546354343936 target_dec_wnv1_fuzzer
|
||||
1339/clusterfuzz-testcase-minimized-4614671485108224 target_dec_dss_sp_fuzzer
|
||||
1340/clusterfuzz-testcase-minimized-4669892148068352 target_dec_adpcm_g722_fuzzer
|
||||
1341/clusterfuzz-testcase-minimized-5441502618583040 target_dec_cdxl_fuzzer
|
||||
1342/clusterfuzz-testcase-minimized-5490842129137664 target_dec_nellymoser_fuzzer
|
||||
1344/clusterfuzz-testcase-minimized-5567131804499968 target_dec_zmbv_fuzzer
|
||||
1345/clusterfuzz-testcase-minimized-6062963045695488 target_dec_dfa_fuzzer
|
||||
1346/clusterfuzz-testcase-minimized-5776732600664064 target_dec_mdec_fuzzer
|
||||
1348/clusterfuzz-testcase-minimized-6195673642827776 target_dec_tiertexseqvideo_fuzzer
|
||||
1349/clusterfuzz-testcase-minimized-5370707196248064 target_dec_aac_fuzzer
|
||||
1351/clusterfuzz-testcase-minimized-5861971645693952 target_dec_indeo4_fuzzer
|
||||
1352/clusterfuzz-testcase-minimized-5757565017260032 target_dec_ac3_fixed_fuzzer
|
||||
1353/clusterfuzz-testcase-minimized-5208180449607680 target_dec_snow_fuzzer
|
||||
1354/clusterfuzz-testcase-minimized-5520132195483648 target_dec_sami_fuzzer
|
||||
1355/clusterfuzz-testcase-minimized-6662205472768000 target_dec_mlp_fuzzer
|
||||
1356/clusterfuzz-testcase-minimized-6008489086287872 target_dec_fic_fuzzer
|
||||
1360/clusterfuzz-testcase-minimized-5606472043986944 target_dec_clearvideo_fuzzer
|
||||
1362/clusterfuzz-testcase-minimized-6097275002552320 target_dec_opus_fuzzer
|
||||
1365/clusterfuzz-testcase-minimized-5624158450876416 target_dec_mimic_fuzzer
|
||||
1366/clusterfuzz-testcase-minimized-5958052211589120 target_dec_ppm_fuzzer
|
||||
1367/clusterfuzz-testcase-minimized-5714968823463936 target_dec_g723_1_fuzzer
|
||||
1368/clusterfuzz-testcase-minimized-4507293276176384 target_dec_dfa_fuzzer
|
||||
1369/clusterfuzz-testcase-minimized-5048908029886464 target_dec_webp_fuzzer
|
||||
1371/clusterfuzz-testcase-minimized-5770822591447040 target_dec_shorten_fuzzer
|
||||
1372/clusterfuzz-testcase-minimized-5712192982745088 target_dec_msa1_fuzzer
|
||||
1374/clusterfuzz-testcase-minimized-5692496346611712 target_dec_mpeg1video_fuzzer
|
||||
1375/clusterfuzz-testcase-minimized-6070134701555712 target_dec_hq_hqa_fuzzer
|
||||
1376/clusterfuzz-testcase-minimized-6361794975105024 target_dec_targa_y216_fuzzer
|
||||
1377/clusterfuzz-testcase-minimized-5487049807233024 target_dec_aac_fixed_fuzzer
|
||||
1378/clusterfuzz-testcase-minimized-5715088008806400 target_dec_cdxl_fuzzer
|
||||
1380/clusterfuzz-testcase-minimized-6501225451225088 target_dec_dds_fuzzer
|
||||
1381/clusterfuzz-testcase-minimized-5513944540119040 target_dec_msmpeg4v1_fuzzer
|
||||
1382/clusterfuzz-testcase-minimized-6013445293998080 target_dec_svq3_fuzzer
|
||||
1385/clusterfuzz-testcase-minimized-5552882663292928 target_dec_indeo4_fuzzer
|
||||
1386/clusterfuzz-testcase-minimized-5323086394032128 target_dec_txd_fuzzer
|
||||
1387/clusterfuzz-testcase-minimized-4802757766676480 target_dec_mts2_fuzzer
|
||||
1388/clusterfuzz-testcase-minimized-6680800936329216 target_dec_ra_144_fuzzer
|
||||
1389/clusterfuzz-testcase-minimized-5330877464707072 target_dec_shorten_fuzzer
|
||||
1390/clusterfuzz-testcase-minimized-5452757630713856 target_dec_magicyuv_fuzzer
|
||||
1391/clusterfuzz-testcase-minimized-4556900198776832 target_dec_indeo4_fuzzer
|
||||
1393/clusterfuzz-testcase-minimized-5948366791901184 target_dec_adpcm_g726_fuzzer
|
||||
1394/clusterfuzz-testcase-minimized-6493376885030912 target_dec_eamad_fuzzer
|
||||
1395/clusterfuzz-testcase-minimized-5330939741732864 target_dec_s302m_fuzzer
|
||||
1397/clusterfuzz-testcase-minimized-6369226291937280 target_dec_hevc_fuzzer
|
||||
1398/clusterfuzz-testcase-minimized-4576913622302720 target_dec_aac_fuzzer
|
||||
1399/clusterfuzz-testcase-minimized-4866094172995584 target_dec_xwd_fuzzer
|
||||
1401/clusterfuzz-testcase-minimized-6526248148795392 target_dec_wmv2_fuzzer
|
||||
1402/clusterfuzz-testcase-minimized-6302213041291264 target_dec_h264_fuzzer
|
||||
1403/clusterfuzz-testcase-minimized-4724820484816896 target_dec_ffv1_fuzzer
|
||||
1404/clusterfuzz-testcase-minimized-5000441286885376 target_dec_cavs_fuzzer
|
||||
1405/clusterfuzz-testcase-minimized-5011491835084800 target_dec_hqx_fuzzer
|
||||
1406/clusterfuzz-testcase-minimized-5064865125236736 target_dec_vp7_fuzzer
|
||||
1407/clusterfuzz-testcase-minimized-6044604124102656 target_dec_webp_fuzzer
|
||||
1408/clusterfuzz-testcase-minimized-6529985844084736 target_dec_dvbsub_fuzzer
|
||||
1409/clusterfuzz-testcase-minimized-5237365020819456 target_dec_dss_sp_fuzzer
|
||||
1410/clusterfuzz-testcase-minimized-6065423843852288 target_dec_magicyuv_fuzzer
|
||||
1411/clusterfuzz-testcase-minimized-5776085184675840 target_dec_bmv_video_fuzzer
|
||||
1412/clusterfuzz-testcase-minimized-6561308772139008 target_dec_g723_1_fuzzer
|
||||
1413/clusterfuzz-testcase-minimized-5923451770503168 target_dec_fic_fuzzer
|
||||
1415/clusterfuzz-testcase-minimized-6417783363469312 target_dec_dvbsub_fuzzer
|
||||
1416/clusterfuzz-testcase-minimized-5536862435278848 target_dec_indeo2_fuzzer
|
||||
1417/clusterfuzz-testcase-minimized-6606778030620672 target_dec_clearvideo_fuzzer
|
||||
1418/clusterfuzz-testcase-minimized-5934472438480896 target_dec_flac_fuzzer
|
||||
1419/clusterfuzz-testcase-minimized-6108700873850880 target_dec_snow_fuzzer
|
||||
1420/clusterfuzz-testcase-minimized-6059927359455232 target_dec_webp_fuzzer
|
||||
1421/clusterfuzz-testcase-minimized-6239947507892224 target_dec_cllc_fuzzer
|
||||
1422/clusterfuzz-testcase-minimized-5030993939398656 target_dec_scpr_fuzzer
|
||||
1423/clusterfuzz-testcase-minimized-5063889899225088 target_dec_tak_fuzzer
|
||||
1424/clusterfuzz-testcase-minimized-6088327159611392 target_dec_lagarith_fuzzer
|
||||
1425/clusterfuzz-testcase-minimized-6295712339853312 target_dec_lagarith_fuzzer
|
||||
1426/clusterfuzz-testcase-minimized-4774371304407040 target_dec_lagarith_fuzzer
|
||||
1427/clusterfuzz-testcase-minimized-5020737339392000 target_dec_cdxl_fuzzer
|
||||
1428/clusterfuzz-testcase-minimized-5263281793007616 target_dec_dds_fuzzer
|
||||
1429/clusterfuzz-testcase-minimized-5959951610544128 target_dec_svq3_fuzzer
|
||||
1434/clusterfuzz-testcase-minimized-6314998085189632 target_dec_webp_fuzzer
|
||||
1435/clusterfuzz-testcase-minimized-6483783723253760 target_dec_webp_fuzzer
|
||||
1437/clusterfuzz-testcase-minimized-4569970002362368 target_dec_y41p_fuzzer
|
||||
1438/clusterfuzz-testcase-minimized-4917542646710272 target_dec_cavs_fuzzer
|
||||
1439/clusterfuzz-testcase-minimized-4999148417843200 target_dec_g723_1_fuzzer
|
||||
1440/clusterfuzz-testcase-minimized-5785716111966208 target_dec_vp7_fuzzer
|
||||
1441/clusterfuzz-testcase-minimized-6223152357048320 target_dec_dss_sp_fuzzer
|
||||
1443/clusterfuzz-testcase-minimized-4826998612426752 target_dec_eatqi_fuzzer
|
||||
1446/clusterfuzz-testcase-minimized-5577409124368384 target_dec_truemotion1_fuzzer
|
||||
1453/clusterfuzz-testcase-minimized-5024976874766336 target_dec_wavpack_fuzzer
|
||||
1462/clusterfuzz-testcase-minimized-6558894463647744 target_dec_pixlet_fuzzer
|
||||
1464/clusterfuzz-testcase-minimized-4925445571084288 target_dec_mpeg2video_fuzzer
|
||||
1466/clusterfuzz-testcase-minimized-5961584419536896 target_dec_xpm_fuzzer
|
||||
1468/clusterfuzz-testcase-minimized-5235964056174592 target_dec_mimic_fuzzer
|
||||
1470/clusterfuzz-testcase-minimized-5404421666111488 target_dec_webp_fuzzer
|
||||
1471/clusterfuzz-testcase-minimized-6376460543590400 target_dec_aac_fixed_fuzzer
|
||||
1472/clusterfuzz-testcase-minimized-5677426430443520 target_dec_webp_fuzzer
|
||||
1473/clusterfuzz-testcase-minimized-5768907824562176 target_dec_dvbsub_fuzzer
|
||||
1478/clusterfuzz-testcase-minimized-5285486908145664 target_dec_scpr_fuzzer
|
||||
1479/clusterfuzz-testcase-minimized-6638493360979968 target_dec_cllc_fuzzer
|
||||
1480/clusterfuzz-testcase-minimized-5188321007370240 target_dec_msmpeg4v2_fuzzer
|
||||
1481/clusterfuzz-testcase-minimized-5264379509473280 target_dec_shorten_fuzzer
|
||||
1483/clusterfuzz-testcase-minimized-6386507814273024 target_dec_msa1_fuzzer
|
||||
1485/clusterfuzz-testcase-minimized-6639880215986176 target_dec_msa1_fuzzer
|
||||
1487/clusterfuzz-testcase-minimized-6288036495097856 target_dec_dirac_fuzzer
|
||||
1489/clusterfuzz-testcase-minimized-5075102901207040 target_dec_aac_fuzzer
|
||||
1503/clusterfuzz-testcase-minimized-5369271855087616 target_dec_wmv2_fuzzer
|
||||
1504/clusterfuzz-testcase-minimized-6249212138225664 target_dec_g723_1_fuzzer
|
||||
1505/clusterfuzz-testcase-minimized-4561688818876416 target_dec_dds_fuzzer
|
||||
1506/clusterfuzz-testcase-minimized-5401272918212608 target_dec_cavs_fuzzer
|
||||
1507/clusterfuzz-testcase-minimized-4955228300378112 target_dec_hq_hqa_fuzzer
|
||||
1508/clusterfuzz-testcase-minimized-5011336327069696 target_dec_fmvc_fuzzer
|
||||
1509/clusterfuzz-testcase-minimized-5129419876204544 target_dec_rscc_fuzzer
|
||||
1510/clusterfuzz-testcase-minimized-5826231746428928 target_dec_dds_fuzzer
|
||||
1511/clusterfuzz-testcase-minimized-5906663800307712 target_dec_ffv1_fuzzer
|
||||
1512/clusterfuzz-testcase-minimized-4713846423945216 target_dec_mlp_fuzzer
|
||||
1513/clusterfuzz-testcase-minimized-6246484833992704 target_dec_h264_fuzzer
|
||||
1514/clusterfuzz-testcase-minimized-6437666243477504 target_dec_indeo4_fuzzer
|
||||
1519/clusterfuzz-testcase-minimized-5286680976162816 target_dec_scpr_fuzzer
|
||||
1535/clusterfuzz-testcase-minimized-5826695535788032 target_dec_aac_fixed_fuzzer
|
||||
1536/clusterfuzz-testcase-minimized-5973925404082176 target_dec_webp_fuzzer
|
||||
1538/clusterfuzz-testcase-minimized-4696904925446144 target_dec_ac3_fuzzer
|
||||
1541/clusterfuzz-testcase-minimized-6403410590957568 target_dec_mlp_fuzzer
|
||||
1556/clusterfuzz-testcase-minimized-5027865978470400 target_dec_svq3_fuzzer
|
||||
1557/clusterfuzz-testcase-minimized-6535013757616128 target_dec_webp_fuzzer
|
||||
1559/clusterfuzz-testcase-minimized-5048096079740928 target_dec_ffv1_fuzzer
|
||||
1560/clusterfuzz-testcase-minimized-6011037813833728 target_dec_ffv1_fuzzer
|
||||
1567/clusterfuzz-testcase-minimized-5693653555085312 target_dec_g723_1_fuzzer
|
||||
1568/clusterfuzz-testcase-minimized-5944868608147456 target_dec_hqx_fuzzer
|
||||
1569/clusterfuzz-testcase-minimized-6328690508038144 target_dec_pixlet_fuzzer
|
||||
1570/clusterfuzz-testcase-minimized-6455337349545984 target_dec_ac3_fuzzer
|
||||
1572/clusterfuzz-testcase-minimized-4578773729017856 target_dec_mpeg4_fuzzer
|
||||
1576/clusterfuzz-testcase-minimized-5592896440893440 target_dec_tiff_fuzzer
|
||||
1604/clusterfuzz-testcase-minimized-5312060206350336 target_dec_svq3_fuzzer
|
||||
1609/clusterfuzz-testcase-minimized-5102163007111168 target_dec_g723_1_fuzzer
|
||||
1615/clusterfuzz-testcase-minimized-6625214647500800 target_dec_scpr_fuzzer
|
||||
1616/clusterfuzz-testcase-minimized-5119196578971648 target_dec_truemotion1_fuzzer
|
||||
1626/clusterfuzz-testcase-minimized-6416580571299840 target_dec_hq_hqa_fuzzer
|
||||
1630/clusterfuzz-testcase-minimized-6326111917047808 target_dec_tak_fuzzer
|
||||
1631/clusterfuzz-testcase-minimized-4861568200212480 target_dec_tiff_fuzzer
|
||||
1635/clusterfuzz-testcase-minimized-4992749856096256 target_dec_tak_fuzzer
|
||||
1636/clusterfuzz-testcase-minimized-5310494757879808 target_dec_mlp_fuzzer
|
||||
1637/clusterfuzz-testcase-minimized-5376582493405184 target_dec_flic_fuzzer
|
||||
1639/clusterfuzz-testcase-minimized-5693801463021568 target_dec_h264_fuzzer
|
||||
1643/clusterfuzz-testcase-minimized-6117573403869184 target_dec_fmvc_fuzzer
|
||||
1654/clusterfuzz-testcase-minimized-5151903795118080 target_dec_aac_fixed_fuzzer
|
||||
1655/clusterfuzz-testcase-minimized-5587079276789760 target_dec_rv40_fuzzer
|
||||
1656/clusterfuzz-testcase-minimized-5900404925661184 target_dec_aac_latm_fuzzer
|
||||
1657/clusterfuzz-testcase-minimized-4710000079405056 target_dec_dfa_fuzzer
|
||||
1658/clusterfuzz-testcase-minimized-4889937130291200 target_dec_mlp_fuzzer
|
||||
1659/clusterfuzz-testcase-minimized-5396490639900672 target_dec_wavpack_fuzzer
|
||||
1664/clusterfuzz-testcase-minimized-6587801187385344 target_dec_pixlet_fuzzer
|
||||
1669/clusterfuzz-testcase-minimized-5287529198649344 target_dec_fic_fuzzer
|
||||
1671/clusterfuzz-testcase-minimized-4759078033162240 target_dec_mimic_fuzzer
|
||||
1674/clusterfuzz-testcase-minimized-6092531563495424 target_dec_aac_fixed_fuzzer
|
||||
1681/clusterfuzz-testcase-minimized-5970545365483520 target_dec_aac_fixed_fuzzer
|
||||
1686/clusterfuzz-testcase-minimized-6282691643179008 target_dec_aac_fixed_fuzzer
|
||||
1699/clusterfuzz-testcase-minimized-6327177438035968 target_dec_mlp_fuzzer
|
||||
1702/clusterfuzz-testcase-minimized-5777869676478464 target_dec_ffv1_fuzzer
|
||||
1706/clusterfuzz-testcase-minimized-6112772670619648 target_dec_tak_fuzzer
|
||||
1707/clusterfuzz-testcase-minimized-6502767008940032 target_dec_escape124_fuzzer
|
||||
1708/clusterfuzz-testcase-minimized-5035111957397504 target_dec_mlp_fuzzer
|
||||
1709/clusterfuzz-testcase-minimized-4513580554649600 target_dec_aac_fixed_fuzzer
|
||||
1710/clusterfuzz-testcase-minimized-4837032931098624 target_dec_vp9_fuzzer
|
||||
1711/clusterfuzz-testcase-minimized-5248503515185152 target_dec_mlp_fuzzer
|
||||
1713/clusterfuzz-testcase-minimized-5791887476654080 target_dec_tak_fuzzer
|
||||
1716/clusterfuzz-testcase-minimized-4691012196761600 target_dec_aac_fixed_fuzzer
|
||||
1717/clusterfuzz-testcase-minimized-5491696676634624 target_dec_vmnc_fuzzer
|
||||
1719/clusterfuzz-testcase-minimized-6375090079924224 target_dec_tscc2_fuzzer
|
||||
1720/clusterfuzz-testcase-minimized-4952373438971904 target_dec_mlp_fuzzer
|
||||
1721/clusterfuzz-testcase-minimized-4719352135811072 target_dec_aac_fixed_fuzzer
|
||||
1723/clusterfuzz-testcase-minimized-5309409372667904 target_dec_mpeg4_fuzzer
|
||||
1724/clusterfuzz-testcase-minimized-4842395432648704 target_dec_thp_fuzzer
|
||||
1725/clusterfuzz-testcase-minimized-5132425044688896 target_dec_cavs_fuzzer
|
||||
1726/clusterfuzz-testcase-minimized-4509005575618560 target_dec_aac_fixed_fuzzer
|
||||
1727/clusterfuzz-testcase-minimized-5900685306494976 target_dec_mpeg4_fuzzer
|
||||
1731/clusterfuzz-testcase-minimized-5123972414832640 target_dec_mp3adu_fuzzer
|
||||
1734/clusterfuzz-testcase-minimized-5385630815092736 target_dec_indeo5_fuzzer
|
||||
1735/clusterfuzz-testcase-minimized-5350472347025408 target_dec_aac_fixed_fuzzer
|
||||
1737/clusterfuzz-testcase-minimized-5922321338466304 target_dec_mpeg4_fuzzer
|
||||
1738/clusterfuzz-testcase-minimized-6734814327603200 target_dec_aac_fixed_fuzzer
|
||||
1739/clusterfuzz-testcase-minimized-5399237707694080 target_dec_tak_fuzzer
|
||||
1743/clusterfuzz-testcase-minimized-4994834022531072 target_dec_tak_fuzzer
|
||||
1745/clusterfuzz-testcase-minimized-6160693365571584 target_dec_paf_video_fuzzer
|
||||
1746/clusterfuzz-testcase-minimized-6687393392361472 target_dec_asv2_fuzzer
|
||||
1747/clusterfuzz-testcase-minimized-6035451213250560 target_dec_xsub_fuzzer
|
||||
1748/clusterfuzz-testcase-minimized-6690208340770816 target_dec_ffv1_fuzzer
|
||||
1753/clusterfuzz-testcase-minimized-6205127620820992 target_dec_pbm_fuzzer
|
||||
1758/clusterfuzz-testcase-minimized-6054857184116736 target_dec_g723_1_fuzzer
|
||||
1762/clusterfuzz-testcase-minimized-5150981081792512 target_dec_aac_fixed_fuzzer
|
||||
1763/clusterfuzz-testcase-minimized-5191733576990720 target_dec_pam_fuzzer
|
||||
1764/clusterfuzz-testcase-minimized-5394243164045312 target_dec_lagarith_fuzzer
|
||||
1766/clusterfuzz-testcase-minimized-6562020075765760 target_dec_g723_1_fuzzer
|
||||
1767/clusterfuzz-testcase-minimized-6657181250224128 target_dec_pgm_fuzzer
|
||||
1770/clusterfuzz-testcase-minimized-5285511235108864 target_dec_aac_fixed_fuzzer
|
||||
1773/clusterfuzz-testcase-minimized-4832523987189760 target_dec_mjpeg_fuzzer
|
||||
1775/clusterfuzz-testcase-minimized-5330288148217856 target_dec_aac_fixed_fuzzer
|
||||
1776/clusterfuzz-testcase-minimized-6191258231898112 target_dec_wavpack_fuzzer
|
||||
1778/clusterfuzz-testcase-minimized-5128953268273152 target_dec_wavpack_fuzzer
|
||||
1781/clusterfuzz-testcase-minimized-4617176877105152 target_dec_dirac_fuzzer
|
||||
1785/clusterfuzz-testcase-minimized-6035918794260480 target_dec_ppm_fuzzer
|
||||
1802/clusterfuzz-testcase-minimized-5008293510512640 target_dec_cllc_fuzzer
|
||||
1807/clusterfuzz-testcase-minimized-6258676199325696 target_dec_wavpack_fuzzer
|
||||
1815/clusterfuzz-testcase-minimized-5237739320508416 target_dec_jpeg2000_fuzzer
|
||||
1817/clusterfuzz-testcase-minimized-5104230530547712 target_dec_subrip_fuzzer
|
||||
1818/clusterfuzz-testcase-minimized-5039166473633792 target_dec_smc_fuzzer
|
||||
1821/clusterfuzz-testcase-minimized-6050283782144000 target_dec_vp3_fuzzer
|
||||
1825/clusterfuzz-testcase-minimized-6002833050566656 target_dec_aac_fixed_fuzzer
|
||||
1826/clusterfuzz-testcase-minimized-5728569256837120 target_dec_clearvideo_fuzzer
|
||||
1829/clusterfuzz-testcase-minimized-5527165321871360 target_dec_pixlet_fuzzer
|
||||
1830/clusterfuzz-testcase-minimized-5828293733384192 target_dec_ra_144_fuzzer
|
||||
1832/clusterfuzz-testcase-minimized-6574546079449088 target_dec_mlp_fuzzer
|
||||
1839/clusterfuzz-testcase-minimized-6238490993885184 target_dec_indeo4_fuzzer
|
||||
1841/clusterfuzz-testcase-minimized-5858969564217344 target_dec_aac_fixed_fuzzer
|
||||
1845/clusterfuzz-testcase-minimized-5075974343360512 target_dec_wnv1_fuzzer
|
||||
1851/clusterfuzz-testcase-minimized-5692607495667712 target_dec_aac_fixed_fuzzer
|
||||
1853/clusterfuzz-testcase-minimized-5471155626442752 target_dec_wavpack_fuzzer
|
||||
1858/clusterfuzz-testcase-minimized-6450473802399744 target_dec_sheervideo_fuzzer
|
||||
1870/clusterfuzz-testcase-minimized-4686788029317120 target_dec_jpeg2000_fuzzer
|
||||
1871/clusterfuzz-testcase-minimized-5719950331215872 target_dec_snow_fuzzer
|
||||
1874/clusterfuzz-testcase-minimized-5037763613163520 target_dec_ylc_fuzzer
|
||||
1875/clusterfuzz-testcase-minimized-5536474562822144 target_dec_webp_fuzzer
|
||||
1878/clusterfuzz-testcase-minimized-6441918630199296 target_dec_aac_fixed_fuzzer
|
||||
1880/clusterfuzz-testcase-minimized-4900645322620928 target_dec_aac_fixed_fuzzer
|
||||
1882/clusterfuzz-testcase-minimized-5539735650959360 target_dec_aac_fuzzer
|
||||
1884/clusterfuzz-testcase-minimized-4637425835966464 target_dec_ra_144_fuzzer
|
||||
1885/clusterfuzz-testcase-minimized-5336328549957632 target_dec_ra_144_fuzzer
|
||||
1888/clusterfuzz-testcase-minimized-5237704826552320 target_dec_truemotion2_fuzzer
|
||||
1890/clusterfuzz-testcase-minimized-6329019509243904 target_dec_jpeg2000_fuzzer
|
||||
1891/clusterfuzz-testcase-minimized-6274417925554176 target_dec_dds_fuzzer
|
||||
1892/clusterfuzz-testcase-minimized-4519341733183488 target_dec_ansi_fuzzer
|
||||
1894/clusterfuzz-testcase-minimized-4716739789062144 target_dec_wavpack_fuzzer
|
||||
1898/clusterfuzz-testcase-minimized-5970744880136192 target_dec_wavpack_fuzzer
|
||||
1902/clusterfuzz-testcase-minimized-4762451407011840 target_dec_amrwb_fuzzer
|
||||
1903/clusterfuzz-testcase-minimized-5359318167715840 target_dec_cavs_fuzzer
|
||||
1906/clusterfuzz-testcase-minimized-4599315114754048 target_dec_pgmyuv_fuzzer
|
||||
1908/clusterfuzz-testcase-minimized-5392712477966336 target_dec_ra_144_fuzzer
|
||||
1909/clusterfuzz-testcase-minimized-6732072662073344 target_dec_hevc_fuzzer
|
||||
1917/clusterfuzz-testcase-minimized-5023221273329664 target_dec_cinepak_fuzzer
|
||||
1922/clusterfuzz-testcase-minimized-5561194112876544 target_dec_wavpack_fuzzer
|
||||
1925/clusterfuzz-testcase-minimized-5564569688735744 target_dec_cfhd_fuzzer
|
||||
1934/clusterfuzz-testcase-minimized-4659523174268928 target_dec_mp1_fuzzer
|
||||
1935/clusterfuzz-testcase-minimized-4939127826939904 target_dec_mp2float_fuzzer
|
||||
1938/clusterfuzz-testcase-minimized-6595305602547712 target_dec_mp3float_fuzzer
|
||||
1939/clusterfuzz-testcase-minimized-5544941956628480 target_dec_vp9_fuzzer
|
||||
1941/clusterfuzz-testcase-minimized-4719816059387904 target_dec_h264_fuzzer
|
||||
1942/clusterfuzz-testcase-minimized-4870171724349440 target_dec_h264_fuzzer
|
||||
1943/clusterfuzz-testcase-minimized-4912348974284800 target_dec_vp9_fuzzer
|
||||
1944/clusterfuzz-testcase-minimized-4957953339686912 target_dec_aac_fixed_fuzzer
|
||||
1946/clusterfuzz-testcase-minimized-5780475010351104 target_dec_vp9_fuzzer
|
||||
1947/clusterfuzz-testcase-minimized-6266250911023104 target_dec_vp9_fuzzer
|
||||
1948/clusterfuzz-testcase-minimized-6601933810827264 target_dec_rv40_fuzzer
|
||||
1949/clusterfuzz-testcase-minimized-6645980176842752 target_dec_svq3_fuzzer
|
||||
1967/clusterfuzz-testcase-minimized-5757031199801344 target_dec_wavpack_fuzzer
|
||||
2001/clusterfuzz-testcase-minimized-6187599389523968 target_dec_asv2_fuzzer
|
||||
2004/clusterfuzz-testcase-minimized-5533262866808832 target_dec_snow_fuzzer
|
||||
2005/clusterfuzz-testcase-minimized-5744226438479872 target_dec_aac_fixed_fuzzer
|
||||
2006/clusterfuzz-testcase-minimized-5766515037044736 target_dec_dxv_fuzzer
|
||||
2010/clusterfuzz-testcase-minimized-6209288450080768 target_dec_hevc_fuzzer
|
||||
2014/clusterfuzz-testcase-minimized-5186337030275072 target_dec_aac_fixed_fuzzer
|
||||
2038/clusterfuzz-testcase-minimized-4521466148159488 target_dec_wavpack_fuzzer
|
||||
2045/clusterfuzz-testcase-minimized-6751255865065472 target_dec_aac_fixed_fuzzer
|
||||
2065/clusterfuzz-testcase-minimized-6298930457346048 target_dec_qdraw_fuzzer
|
||||
2067/clusterfuzz-testcase-minimized-5578430902960128 target_dec_cavs_fuzzer
|
||||
2071/clusterfuzz-testcase-minimized-6036414271586304 target_dec_aac_fixed_fuzzer
|
||||
2076/clusterfuzz-testcase-minimized-6542640243802112 target_dec_tiff_fuzzer
|
||||
2079/clusterfuzz-testcase-minimized-5345861779324928 target_dec_tak_fuzzer
|
||||
2096/clusterfuzz-testcase-minimized-4901566068817920 target_dec_aac_fixed_fuzzer
|
||||
2097/clusterfuzz-testcase-minimized-5036861833609216 target_dec_mxpeg_fuzzer
|
||||
2100/clusterfuzz-testcase-minimized-4522961547558912 target_dec_paf_video_fuzzer
|
||||
2106/clusterfuzz-testcase-minimized-6136503639998464 target_dec_mpeg4_fuzzer
|
||||
2113/clusterfuzz-testcase-minimized-6510704959946752 target_dec_ac3_fixed_fuzzer
|
||||
2115/clusterfuzz-testcase-minimized-6594111748440064 target_dec_indeo4_fuzzer
|
||||
2127/clusterfuzz-testcase-minimized-6595787859427328 target_dec_subrip_fuzzer
|
||||
2131/clusterfuzz-testcase-minimized-4718045157130240 target_dec_shorten_fuzzer
|
||||
2134/clusterfuzz-testcase-minimized-4619258405322752 target_dec_wavpack_fuzzer
|
||||
2143/clusterfuzz-testcase-minimized-5482288060039168 target_dec_dvbsub_fuzzer
|
||||
2145/clusterfuzz-testcase-minimized-5866217724182528 target_dec_h264_fuzzer
|
||||
2154/clusterfuzz-testcase-minimized-4879971375906816 target_dec_hevc_fuzzer
|
||||
2159/clusterfuzz-testcase-minimized-5267945972301824 target_dec_h264_fuzzer
|
||||
2164/clusterfuzz-testcase-minimized-4715936172998656 target_dec_aac_fixed_fuzzer
|
||||
2169/clusterfuzz-testcase-minimized-5688641642823680 target_dec_cfhd_fuzzer
|
||||
2174/clusterfuzz-testcase-minimized-5739234533048320 target_dec_flic_fuzzer
|
||||
2175/clusterfuzz-testcase-minimized-5809657849315328 target_dec_ra_144_fuzzer
|
||||
2176/clusterfuzz-testcase-minimized-5908197216878592 target_dec_tiff_fuzzer
|
||||
2181/clusterfuzz-testcase-minimized-6314784322486272 target_dec_wavpack_fuzzer
|
||||
2192/clusterfuzz-testcase-minimized-5370387988742144 target_dec_mpeg4_fuzzer
|
||||
2195/clusterfuzz-testcase-minimized-4736721533009920 target_dec_aac_fixed_fuzzer
|
||||
2197/clusterfuzz-testcase-minimized-6010716676947968 target_dec_snow_fuzzer
|
||||
2204/clusterfuzz-testcase-minimized-5616756909408256 target_dec_mpeg4_fuzzer
|
||||
2208/clusterfuzz-testcase-minimized-5976593765761024 target_dec_jpeg2000_fuzzer
|
||||
2209/clusterfuzz-testcase-minimized-5012343912136704 target_dec_hevc_fuzzer
|
||||
2224/clusterfuzz-testcase-minimized-6208559949807616 target_dec_aac_fixed_fuzzer
|
||||
2225/clusterfuzz-testcase-minimized-5505632079708160 target_dec_jpeg2000_fuzzer
|
||||
2231/clusterfuzz-testcase-minimized-4565181982048256 target_dec_jpeg2000_fuzzer
|
||||
2233/clusterfuzz-testcase-minimized-5943031318446080 target_dec_truemotion2_fuzzer
|
||||
2234/clusterfuzz-testcase-minimized-6266896041115648 target_dec_tak_fuzzer
|
||||
2239/clusterfuzz-testcase-minimized-5639766592716800 target_dec_jpeg2000_fuzzer
|
||||
2243/clusterfuzz-testcase-minimized-4683988125876224 target_dec_vp9_fuzzer
|
||||
2247/clusterfuzz-testcase-minimized-5165385038954496 target_dec_vp9_fuzzer
|
||||
2249/clusterfuzz-testcase-minimized-5388542379294720 target_dec_gdv_fuzzer
|
||||
2250/clusterfuzz-testcase-minimized-5693382112313344 target_dec_hevc_fuzzer
|
||||
2254/clusterfuzz-testcase-minimized-4735977664806912 target_dec_vp9_fuzzer
|
||||
2255/clusterfuzz-testcase-minimized-4917394667470848 target_dec_vp9_fuzzer
|
||||
2257/clusterfuzz-testcase-minimized-5622708022804480 target_dec_vp9_fuzzer
|
||||
2258/clusterfuzz-testcase-minimized-5924773878038528 target_dec_vp9_fuzzer
|
||||
2263/clusterfuzz-testcase-minimized-4800359627227136 target_dec_hevc_fuzzer
|
||||
2271/clusterfuzz-testcase-minimized-5778297776504832 target_dec_jpeg2000_fuzzer
|
||||
2272/clusterfuzz-testcase-minimized-5059103858622464 target_dec_iff_ilbm_fuzzer
|
||||
2286/clusterfuzz-testcase-minimized-5711764169687040 target_dec_aac_fixed_fuzzer
|
||||
2291/clusterfuzz-testcase-minimized-5538453481586688 target_dec_wavpack_fuzzer
|
||||
2292/clusterfuzz-testcase-minimized-6156080415506432 target_dec_mpeg4_fuzzer
|
||||
2299/clusterfuzz-testcase-minimized-4843509351710720 target_dec_hevc_fuzzer
|
||||
2303/clusterfuzz-testcase-minimized-5529675273076736 target_dec_cfhd_fuzzer
|
||||
2306/clusterfuzz-testcase-minimized-5002997392211968 target_dec_cfhd_fuzzer
|
||||
2310/clusterfuzz-testcase-minimized-4534784887881728 target_dec_tiff_fuzzer
|
||||
2314/clusterfuzz-testcase-minimized-4519333877252096 target_dec_tak_fuzzer
|
||||
2331/clusterfuzz-testcase-minimized-6182185830711296 target_dec_wavpack_fuzzer
|
||||
2333/clusterfuzz-testcase-minimized-5223935677300736 target_dec_hevc_fuzzer
|
||||
2338/clusterfuzz-testcase-minimized-5153426541379584 target_dec_mpeg4_fuzzer
|
||||
2339/clusterfuzz-testcase-minimized-6663164320022528 target_dec_hevc_fuzzer
|
||||
2351/clusterfuzz-testcase-minimized-5359403240783872 target_dec_wavpack_fuzzer
|
||||
2365/clusterfuzz-testcase-minimized-6020421927305216 target_dec_jpeg2000_fuzzer
|
||||
2367/clusterfuzz-testcase-minimized-4648678897745920 target_dec_jpeg2000_fuzzer
|
||||
2377/clusterfuzz-testcase-minimized-6108505935183872 target_dec_wavpack_fuzzer
|
||||
2385/clusterfuzz-testcase-minimized-6594333576790016 target_dec_hevc_fuzzer
|
||||
2393/clusterfuzz-testcase-minimized-6128334993883136 target_dec_vb_fuzzer
|
||||
2395/clusterfuzz-testcase-minimized-6540529313513472 target_dec_cfhd_fuzzer
|
||||
2406/clusterfuzz-testcase-minimized-5294603055923200 target_dec_interplay_video_fuzzer
|
||||
2407/clusterfuzz-testcase-minimized-5858436027777024 target_dec_interplay_video_fuzzer
|
||||
2408/clusterfuzz-testcase-minimized-5432734438653952 target_dec_interplay_video_fuzzer
|
||||
2415/clusterfuzz-testcase-minimized-4672827619803136 target_dec_interplay_video_fuzzer
|
||||
2422/clusterfuzz-testcase-minimized-5242114713583616 target_dec_hevc_fuzzer
|
||||
2442/clusterfuzz-testcase-minimized-4985479546011648 target_dec_interplay_video_fuzzer
|
||||
2451/clusterfuzz-testcase-minimized-4781613957251072 target_dec_hevc_fuzzer
|
||||
2456/clusterfuzz-testcase-minimized-4822695051001856 target_dec_h264_fuzzer
|
||||
2467/clusterfuzz-testcase-minimized-4755798049685504 target_dec_interplay_video_fuzzer
|
||||
2478/clusterfuzz-testcase-minimized-4649584649306112 target_dec_aac_fuzzer
|
||||
2515/clusterfuzz-testcase-minimized-6197200012967936 target_dec_ylc_fuzzer
|
||||
2527/clusterfuzz-testcase-minimized-5260915396050944 target_dec_aac_fixed_fuzzer
|
||||
2533/clusterfuzz-testcase-minimized-5372857678823424 target_dec_thp_fuzzer
|
||||
2550/clusterfuzz-testcase-minimized-6275019871092736 target_dec_aac_fixed_fuzzer
|
||||
2568/clusterfuzz-testcase-minimized-4926115716005888 target_dec_magicyuv_fuzzer
|
||||
2576/clusterfuzz-testcase-minimized-6002596705730560 target_dec_hevc_fuzzer
|
||||
2577/clusterfuzz-testcase-minimized-4802472348483584 target_dec_shorten_fuzzer
|
||||
2578/clusterfuzz-testcase-minimized-5098313588146176 target_dec_h264_fuzzer
|
||||
2581/clusterfuzz-testcase-minimized-4681474395602944 target_dec_aac_fixed_fuzzer
|
||||
2614/clusterfuzz-testcase-minimized-5949228129976320 target_dec_dirac_fuzzer
|
||||
2634/clusterfuzz-testcase-minimized-4540890636877824 target_dec_ffv1_fuzzer
|
||||
2674/clusterfuzz-testcase-minimized-4999700518273024 target_dec_dirac_fuzzer
|
||||
2678/clusterfuzz-testcase-minimized-4702787684270080 target_dec_aac_fixed_fuzzer
|
||||
2698/clusterfuzz-testcase-minimized-4713541443518464 target_dec_ylc_fuzzer
|
||||
2699/clusterfuzz-testcase-minimized-5631303862976512 target_dec_aac_fixed_fuzzer
|
||||
2702/clusterfuzz-testcase-minimized-4511932591636480 target_dec_hevc_fuzzer
|
||||
2707/clusterfuzz-testcase-minimized-5179636394754048 target_dec_jpeg2000_fuzzer
|
||||
2708/clusterfuzz-testcase-minimized-5510405650644992 target_dec_pixlet_fuzzer
|
||||
2710/clusterfuzz-testcase-minimized-4750001420894208 target_dec_zmbv_fuzzer
|
||||
2711/clusterfuzz-testcase-minimized-4975142398590976 target_dec_tak_fuzzer
|
||||
2715/clusterfuzz-testcase-minimized-5099055292088320 target_dec_jpeg2000_fuzzer
|
||||
2729/clusterfuzz-testcase-minimized-5902915464069120 target_dec_dirac_fuzzer
|
||||
2737/clusterfuzz-testcase-minimized-4968639147016192 target_dec_dirac_fuzzer
|
||||
2739/clusterfuzz-testcase-minimized-6737297955356672 target_dec_dirac_fuzzer
|
||||
2742/clusterfuzz-testcase-minimized-5724322402402304 target_dec_dirac_fuzzer
|
||||
2743/clusterfuzz-testcase-minimized-5820652076400640 target_dec_snow_fuzzer
|
||||
2744/clusterfuzz-testcase-minimized-4672435653705728 target_dec_dirac_fuzzer
|
||||
2747/clusterfuzz-testcase-minimized-5108132302815232 target_dec_dirac_fuzzer
|
||||
2749/clusterfuzz-testcase-minimized-5298741273690112 target_dec_dirac_fuzzer
|
||||
2764/clusterfuzz-testcase-minimized-5382561922547712 target_dec_dirac_fuzzer
|
||||
2809/clusterfuzz-testcase-minimized-4785181833560064 target_dec_h264_fuzzer
|
||||
2815/clusterfuzz-testcase-minimized-6062914471460864 target_dec_hevc_fuzzer
|
||||
2817/clusterfuzz-testcase-minimized-5289691240726528 target_dec_h264_fuzzer
|
||||
2818/clusterfuzz-testcase-minimized-5062943676825600 target_dec_aac_fixed_fuzzer
|
||||
2819/clusterfuzz-testcase-minimized-4743700301217792 target_dec_dirac_fuzzer
|
||||
2826/clusterfuzz-testcase-minimized-5901511613743104 target_dec_mpeg4_fuzzer
|
||||
2834/clusterfuzz-testcase-minimized-5988039123795968 target_dec_ffv1_fuzzer
|
||||
2838/clusterfuzz-testcase-minimized-6260066086813696 target_dec_dirac_fuzzer
|
||||
2841/clusterfuzz-testcase-minimized-4869071805874176 target_dec_dirac_fuzzer
|
||||
2844/clusterfuzz-testcase-minimized-5561715838156800 target_dec_dirac_fuzzer
|
||||
2860/clusterfuzz-testcase-minimized-4672811689836544 target_dec_dirac_fuzzer
|
||||
2861/clusterfuzz-testcase-minimized-5361070510178304 target_dec_dirac_fuzzer
|
||||
2866/clusterfuzz-testcase-minimized-4581973265743872 target_dec_hevc_fuzzer
|
||||
2873/clusterfuzz-testcase-minimized-5924145713905664 target_dec_aac_latm_fuzzer
|
||||
2879/clusterfuzz-testcase-minimized-6317542639403008 target_dec_pixlet_fuzzer
|
||||
2891/clusterfuzz-testcase-minimized-5881795457318912 target_dec_h264_fuzzer
|
||||
2893/clusterfuzz-testcase-minimized-5809330567774208 target_dec_hevc_fuzzer
|
||||
#2914/clusterfuzz-testcase-minimized-4787845073993728 target_dec_mpeg4_fuzzer
|
||||
#2919/clusterfuzz-testcase-minimized-4828609145470976 target_dec_dnxhd_fuzzer
|
||||
#2925/clusterfuzz-testcase-minimized-4971717589991424 target_dec_dca_fuzzer
|
||||
#2926/clusterfuzz-testcase-minimized-4987110014582784 target_dec_gdv_fuzzer
|
||||
#2928/clusterfuzz-testcase-minimized-4992812120539136 target_dec_shorten_fuzzer
|
||||
#2931/clusterfuzz-testcase-minimized-5051106906341376 target_dec_aac_latm_fuzzer
|
||||
#2933/clusterfuzz-testcase-minimized-5124990208835584 target_dec_lagarith_fuzzer
|
||||
#2943/clusterfuzz-testcase-minimized-5430257156882432 target_dec_cavs_fuzzer
|
||||
#2953/clusterfuzz-testcase-minimized-5604124211019776 target_dec_thp_fuzzer
|
||||
#2962/clusterfuzz-testcase-minimized-5812616687517696 target_dec_mjpeg_fuzzer
|
||||
#2971/clusterfuzz-testcase-minimized-6130678276030464 target_dec_ffv1_fuzzer
|
||||
#2973/clusterfuzz-testcase-minimized-6244323446226944 target_dec_vp9_fuzzer
|
||||
#2992/clusterfuzz-testcase-minimized-6649611793989632 target_dec_comfortnoise_fuzzer
|
||||
3013/clusterfuzz-testcase-minimized-4644084197097472 target_dec_dirac_fuzzer
|
||||
3023/clusterfuzz-testcase-minimized-6421736130084864 target_dec_snow_fuzzer
|
||||
3024/clusterfuzz-testcase-minimized-5885660323905536 target_dec_fic_fuzzer
|
||||
3030/clusterfuzz-testcase-minimized-4649809254285312 target_dec_pixlet_fuzzer
|
||||
3042/clusterfuzz-testcase-minimized-5174210131394560 target_dec_jpeg2000_fuzzer
|
||||
3051/clusterfuzz-testcase-minimized-5745818336231424 target_dec_dvbsub_fuzzer
|
||||
3053/clusterfuzz-testcase-minimized-6355082062856192 target_dec_dirac_fuzzer
|
||||
#3073/clusterfuzz-testcase-minimized-6717666356101120 target_dec_jpegls_fuzzer
|
||||
3077/clusterfuzz-testcase-minimized-4684917524922368 target_dec_hevc_fuzzer
|
||||
3081/clusterfuzz-testcase-minimized-4807564879462400 target_dec_dirac_fuzzer
|
||||
3091/clusterfuzz-testcase-minimized-6229767969832960 target_dec_hevc_fuzzer
|
||||
3124/clusterfuzz-testcase-minimized-4546434357526528 target_dec_dirac_fuzzer
|
||||
#3142/clusterfuzz-testcase-minimized-5007853163118592 target_dec_snow_fuzzer
|
||||
#3147/clusterfuzz-testcase-minimized-4870592182353920 target_dec_clearvideo_fuzzer
|
||||
3175/clusterfuzz-testcase-minimized-4736774054084608 target_dec_hevc_fuzzer
|
||||
3191/clusterfuzz-testcase-minimized-5688798451073024 target_dec_aac_fixed_fuzzer
|
||||
3196/clusterfuzz-testcase-minimized-4528307146063872 target_dec_tak_fuzzer
|
||||
#3200/clusterfuzz-testcase-minimized-5750022136135680 target_dec_wmv2_fuzzer
|
||||
3202/clusterfuzz-testcase-minimized-4988291642294272 target_dec_tak_fuzzer
|
||||
3203/clusterfuzz-testcase-minimized-4514553595428864 target_dec_png_fuzzer
|
||||
#3218/clusterfuzz-testcase-minimized-5390672154591232 target_dec_dvbsub_fuzzer
|
||||
#3242/clusterfuzz-testcase-minimized-5811951672229888 target_dec_scpr_fuzzer
|
||||
3279/clusterfuzz-testcase-minimized-4564805744590848 target_dec_dirac_fuzzer
|
||||
#3291/clusterfuzz-testcase-minimized-4630024655208448 target_dec_dxv_fuzzer
|
||||
3295/clusterfuzz-testcase-minimized-4738998142500864 target_dec_dirac_fuzzer
|
||||
3336/clusterfuzz-testcase-minimized-5656839179993088 target_dec_truemotion2_fuzzer
|
||||
3348/clusterfuzz-testcase-minimized-4809500517203968 target_dec_svq3_fuzzer
|
||||
3361/clusterfuzz-testcase-minimized-5065842955911168 target_dec_ffv1_fuzzer
|
||||
3373/clusterfuzz-testcase-minimized-5604083912146944 target_dec_hevc_fuzzer
|
||||
3410/clusterfuzz-testcase-minimized-5313377960198144 target_dec_prores_fuzzer
|
||||
3416/clusterfuzz-testcase-minimized-6125587682820096 target_dec_h264_fuzzer
|
||||
3443/clusterfuzz-testcase-minimized-5369987105554432 target_dec_aac_fixed_fuzzer
|
||||
3444/clusterfuzz-testcase-minimized-6270352105668608 target_dec_aac_latm_fuzzer
|
||||
3453/clusterfuzz-testcase-minimized-5555554657239040 target_dec_mpeg4_fuzzer
|
||||
3463/clusterfuzz-testcase-minimized-5557381989662720 target_dec_tiff_fuzzer
|
||||
3482/clusterfuzz-testcase-minimized-5446915875405824 target_dec_prores_fuzzer
|
||||
3485/clusterfuzz-testcase-minimized-4940429332054016 target_dec_dirac_fuzzer
|
||||
3492/clusterfuzz-testcase-minimized-5784775283441664 target_dec_aac_fixed_fuzzer
|
||||
3512/clusterfuzz-testcase-minimized-4812747210489856 target_dec_snow_fuzzer
|
||||
3516/clusterfuzz-testcase-minimized-4608518562775040 target_dec_mpeg4_fuzzer
|
||||
3528/clusterfuzz-testcase-minimized-6283628420005888 target_dec_mpeg4_fuzzer
|
||||
#3529/clusterfuzz-testcase-minimized-5057068371279872 target_dec_paf_video_fuzzer
|
||||
3541/clusterfuzz-testcase-minimized-6469958596820992 target_dec_jpeg2000_fuzzer
|
||||
3547/clusterfuzz-testcase-minimized-6009386439802880 target_dec_aac_fixed_fuzzer
|
||||
3594/clusterfuzz-testcase-minimized-4650622935629824 target_dec_aac_fixed_fuzzer
|
||||
3612/clusterfuzz-testcase-minimized-6393461273001984 target_dec_xan_wc3_fuzzer
|
||||
3642/clusterfuzz-testcase-minimized-5443853801750528 target_dec_aac_fixed_fuzzer
|
||||
#3707/clusterfuzz-testcase-minimized-6465922706440192 target_dec_xan_wc3_fuzzer
|
||||
3787/clusterfuzz-testcase-minimized-5728764920070144 target_dec_exr_fuzzer
|
||||
3805/clusterfuzz-testcase-minimized-6578427831255040 target_dec_h264_fuzzer
|
||||
3902/clusterfuzz-testcase-minimized-6081926122176512 target_dec_exr_fuzzer
|
||||
3984/clusterfuzz-testcase-minimized-5265759929368576 target_dec_snow_fuzzer
|
||||
4019/clusterfuzz-testcase-minimized-5823336006287360 target_dec_h264_fuzzer
|
||||
4035/clusterfuzz-testcase-minimized-6479308925173760 target_dec_dirac_fuzzer
|
||||
4037/clusterfuzz-testcase-minimized-5290998163832832 target_dec_hevc_fuzzer
|
||||
4074/clusterfuzz-testcase-minimized-4516104123711488 target_dec_truehd_fuzzer
|
||||
#4086/clusterfuzz-testcase-minimized-5452429861584896 target_dec_h264_fuzzer
|
||||
4143/clusterfuzz-testcase-minimized-4736864637419520 target_dec_zmbv_fuzzer
|
||||
4151/clusterfuzz-testcase-minimized-4854089193095168 target_dec_libfdk_aac_fuzzer
|
||||
4196/clusterfuzz-testcase-minimized-5580648594014208 target_dec_h264_fuzzer
|
||||
#4271/clusterfuzz-testcase-minimized-4676667768307712 target_dec_kgv1_fuzzer
|
||||
4326/clusterfuzz-testcase-minimized-5689449645080576 target_dec_truehd_fuzzer
|
||||
4337/clusterfuzz-testcase-minimized-6192658616680448 target_dec_aac_fixed_fuzzer
|
||||
4354/clusterfuzz-testcase-minimized-4671122764201984 target_dec_dirac_fuzzer
|
||||
4397/clusterfuzz-testcase-minimized-4779061080489984 target_dec_hevc_fuzzer
|
||||
4415/clusterfuzz-testcase-minimized-4677752314658816 target_dec_amrwb_fuzzer
|
||||
4427/clusterfuzz-testcase-minimized-5106919271301120 target_dec_jpeg2000_fuzzer
|
||||
4478/clusterfuzz-testcase-minimized-4752113767809024 target_dec_dirac_fuzzer
|
||||
4479/clusterfuzz-testcase-minimized-6529894147162112 target_dec_dirac_fuzzer
|
||||
4490/clusterfuzz-testcase-minimized-5210014592532480 target_dec_vp9_fuzzer
|
||||
4524/clusterfuzz-testcase-minimized-6055590120914944 target_dec_hevc_fuzzer
|
||||
4525/clusterfuzz-testcase-minimized-6400713073623040 target_dec_jpeg2000_fuzzer
|
||||
4554/clusterfuzz-testcase-minimized-4843714515042304 target_dec_hevc_fuzzer
|
||||
4555/clusterfuzz-testcase-minimized-4505532481142784 target_dec_hevc_fuzzer
|
||||
4563/clusterfuzz-testcase-minimized-5438979567517696 target_dec_dirac_fuzzer
|
||||
4626/clusterfuzz-testcase-minimized-5647837887987712 target_dec_hevc_fuzzer
|
||||
4671/clusterfuzz-testcase-minimized-6027464343027712 target_dec_dnxhd_fuzzer
|
||||
4683/clusterfuzz-testcase-minimized-6152313673613312 target_dec_exr_fuzzer
|
||||
4688/clusterfuzz-testcase-minimized-6572210748653568 target_dec_flac_fuzzer
|
||||
4690/clusterfuzz-testcase-minimized-6117482428366848 target_dec_hevc_fuzzer
|
||||
4698/clusterfuzz-testcase-minimized-5096956322906112 target_dec_h264_fuzzer
|
||||
4716/clusterfuzz-testcase-minimized-5835915940331520 target_dec_flac_fuzzer
|
||||
4756/clusterfuzz-testcase-minimized-4812495563784192 target_dec_jpeg2000_fuzzer
|
||||
4780/clusterfuzz-testcase-minimized-4709066174627840 target_dec_h264_fuzzer
|
||||
4792/clusterfuzz-testcase-minimized-6322450775146496 target_dec_dirac_fuzzer
|
||||
4793/clusterfuzz-testcase-minimized-5707366629638144 target_dec_exr_fuzzer
|
||||
4800/clusterfuzz-testcase-minimized-6110372403609600 target_dec_ac3_fixed_fuzzer
|
||||
4810/clusterfuzz-testcase-minimized-6034253235093504 target_dec_jpeg2000_fuzzer
|
||||
4823/clusterfuzz-testcase-minimized-4551896611160064 target_dec_wavpack_fuzzer
|
||||
4828/clusterfuzz-testcase-minimized-5100849937252352 target_dec_snow_fuzzer
|
||||
4830/clusterfuzz-testcase-minimized-5255392054476800 target_dec_dirac_fuzzer
|
||||
#4832/clusterfuzz-testcase-minimized-4699096590843904 target_dec_ulti_fuzzer
|
||||
4833/clusterfuzz-testcase-minimized-5302840101699584 target_dec_hevc_fuzzer
|
||||
4861/clusterfuzz-testcase-minimized-4570316383715328 target_dec_truemotion2_fuzzer
|
||||
#4863/clusterfuzz-testcase-minimized-6347354178322432 target_dec_dxtory_fuzzer
|
||||
4868/clusterfuzz-testcase-minimized-6236542906400768 target_dec_hevc_fuzzer
|
||||
4900/clusterfuzz-testcase-minimized-5769019744321536 target_dec_thp_fuzzer
|
||||
4959/clusterfuzz-testcase-minimized-6035350934781952 target_dec_aac_fixed_fuzzer
|
||||
5237/clusterfuzz-testcase-minimized-4569895275593728 target_dec_dirac_fuzzer
|
||||
5264/clusterfuzz-testcase-minimized-4621956621008896 target_dec_indeo5_fuzzer
|
||||
5275/clusterfuzz-testcase-minimized-5367635958038528 target_dec_aac_fixed_fuzzer
|
||||
5396/clusterfuzz-testcase-minimized-6558555529281536 target_dec_wavpack_fuzzer
|
||||
#5487/clusterfuzz-testcase-minimized-4696837035393024 target_dec_ffvhuff_fuzzer
|
||||
5540/clusterfuzz-testcase-minimized-6122458273808384 target_dec_scpr_fuzzer
|
||||
5549/clusterfuzz-testcase-minimized-5390553567985664 target_dec_paf_video_fuzzer
|
||||
5567/clusterfuzz-testcase-minimized-5769966247739392 target_dec_truemotion2_fuzzer
|
||||
#5653/clusterfuzz-testcase-minimized-5497680018014208 target_dec_vp7_fuzzer
|
||||
5733/clusterfuzz-testcase-minimized-4906757966004224 target_dec_jpeg2000_fuzzer
|
||||
5746/clusterfuzz-testcase-minimized-6270097623613440 target_dec_h264_fuzzer
|
||||
#5792/clusterfuzz-testcase-minimized-6698155757273088 target_dec_hevc_fuzzer
|
||||
5796/clusterfuzz-testcase-minimized-5206729085157376 target_dec_dxtory_fuzzer
|
||||
5888/clusterfuzz-testcase-minimized-5634701067812864 target_dec_hevc_fuzzer
|
||||
5894/clusterfuzz-testcase-minimized-5315325420634112 target_dec_dirac_fuzzer
|
||||
5911/clusterfuzz-testcase-minimized-6450382197751808 target_dec_dirac_fuzzer
|
||||
5918/clusterfuzz-testcase-minimized-5120505435652096 target_dec_jpeg2000_fuzzer
|
||||
5919/clusterfuzz-testcase-minimized-5859311382167552 target_dec_vp3_fuzzer
|
||||
5948/clusterfuzz-testcase-minimized-5791479856365568 target_dec_aac_fixed_fuzzer
|
||||
7279/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_G2M_fuzzer-5977332473921536 target_dec_g2m_fuzzer
|
||||
10053/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PROSUMER_fuzzer-5636993883570176 target_dec_prosumer_fuzzer
|
83
externals/ffmpeg/tools/target_dec_fate.sh
vendored
Executable file
83
externals/ffmpeg/tools/target_dec_fate.sh
vendored
Executable file
@@ -0,0 +1,83 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# * Copyright (C) 2018 Michael Niedermayer (michaelni@gmx.at)
|
||||
# *
|
||||
# * This file is part of FFmpeg.
|
||||
# *
|
||||
# * FFmpeg is free software; you can redistribute it and/or modify
|
||||
# * it under the terms of the GNU General Public License as published by
|
||||
# * the Free Software Foundation; either version 2 of the License, or
|
||||
# * (at your option) any later version.
|
||||
# *
|
||||
# * 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 General Public License for more details.
|
||||
# *
|
||||
# * You should have received a copy of the GNU General Public License
|
||||
# * along with FFmpeg; if not, write to the Free Software
|
||||
# * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
set -e
|
||||
|
||||
LC_ALL=C
|
||||
export LC_ALL
|
||||
|
||||
LIST=target_dec_fate.list
|
||||
|
||||
show_help(){
|
||||
cat <<EOF
|
||||
Usage: ./target_dec_fate.sh <directory> [<test to run>]
|
||||
|
||||
directory the directory into which sample files will be downloaded
|
||||
test to run the number of the issue to test
|
||||
Note, some test samples may not yet be available to the public, also this
|
||||
script will not download samples which are already in the directory. So you
|
||||
may want to preserve its content between runs.
|
||||
EOF
|
||||
exit 0
|
||||
}
|
||||
|
||||
test -z "$1" && show_help
|
||||
test ! -d "$1" && echo $1 is not an accessable directory && show_help
|
||||
test ! -f target_dec_fate.sh && echo $0 Must be run from its location && show_help
|
||||
grep 'CONFIG_OSSFUZZ 0' ../config.h && echo not configured for ossfuzz && show_help
|
||||
|
||||
#Download testcases
|
||||
while read -r LINE; do
|
||||
ISSUE_NUM=`echo $LINE | sed 's#/.*##'`
|
||||
FILE_ID=`echo $LINE | sed 's#.*/clusterfuzz-testcase[a-zA-Z0-9_-]*-\([0-9]*\).*#\1#'`
|
||||
FILE=`echo $LINE | sed 's# .*##'`
|
||||
if test -f "$1/$FILE" ; then
|
||||
echo exists $FILE
|
||||
elif echo "$ISSUE_NUM" | grep '#' >/dev/null ; then
|
||||
echo disabled $FILE
|
||||
else
|
||||
echo downloading $FILE
|
||||
mkdir -p "$1/$ISSUE_NUM"
|
||||
wget -O "$1/$FILE" "https://oss-fuzz.com/download?testcase_id=$FILE_ID" || rm "$1/$FILE"
|
||||
fi
|
||||
done < "$LIST"
|
||||
|
||||
#Find which fuzzers we need to build
|
||||
TOOLS=
|
||||
while read -r LINE; do
|
||||
TOOL_ID=`echo $LINE | sed 's#[^ ]* ##'`
|
||||
TOOLS="$TOOLS tools/$TOOL_ID"
|
||||
done < "$LIST"
|
||||
|
||||
cd ..
|
||||
#Build fuzzers
|
||||
make -j4 $TOOLS
|
||||
|
||||
#Run testcases
|
||||
while read -r LINE; do
|
||||
TOOL_ID=`echo $LINE | sed 's#[^ ]* ##'`
|
||||
FILE=`echo $LINE | sed 's# .*##'`
|
||||
if ! test -f "$1/$FILE" ; then
|
||||
continue
|
||||
fi
|
||||
tools/$TOOL_ID $1/$FILE
|
||||
done < "tools/$LIST"
|
||||
|
||||
echo OK
|
376
externals/ffmpeg/tools/target_dec_fuzzer.c
vendored
Executable file
376
externals/ffmpeg/tools/target_dec_fuzzer.c
vendored
Executable file
@@ -0,0 +1,376 @@
|
||||
/*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* 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 FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
/* Targeted fuzzer that targets specific codecs depending on two
|
||||
compile-time flags.
|
||||
INSTRUCTIONS:
|
||||
|
||||
* Get the very fresh clang, e.g. see http://libfuzzer.info#versions
|
||||
* Get and build libFuzzer:
|
||||
svn co http://llvm.org/svn/llvm-project/llvm/trunk/lib/Fuzzer
|
||||
./Fuzzer/build.sh
|
||||
* build ffmpeg for fuzzing:
|
||||
FLAGS="-fsanitize=address -fsanitize-coverage=trace-pc-guard,trace-cmp -g" CC="clang $FLAGS" CXX="clang++ $FLAGS" ./configure --disable-x86asm
|
||||
make clean && make -j
|
||||
* build the fuzz target.
|
||||
Choose the value of FFMPEG_CODEC (e.g. AV_CODEC_ID_DVD_SUBTITLE) and
|
||||
choose one of FUZZ_FFMPEG_VIDEO, FUZZ_FFMPEG_AUDIO, FUZZ_FFMPEG_SUBTITLE.
|
||||
clang -fsanitize=address -fsanitize-coverage=trace-pc-guard,trace-cmp tools/target_dec_fuzzer.c -o target_dec_fuzzer -I. -DFFMPEG_CODEC=AV_CODEC_ID_MPEG1VIDEO -DFUZZ_FFMPEG_VIDEO ../../libfuzzer/libFuzzer.a -Llibavcodec -Llibavdevice -Llibavfilter -Llibavformat -Llibavresample -Llibavutil -Llibpostproc -Llibswscale -Llibswresample -Wl,--as-needed -Wl,-z,noexecstack -Wl,--warn-common -Wl,-rpath-link=:libpostproc:libswresample:libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil:libavresample -lavdevice -lavfilter -lavformat -lavcodec -lswresample -lswscale -lavutil -ldl -lxcb -lxcb-shm -lxcb -lxcb-xfixes -lxcb -lxcb-shape -lxcb -lX11 -lasound -lm -lbz2 -lz -pthread
|
||||
* create a corpus directory and put some samples there (empty dir is ok too):
|
||||
mkdir CORPUS && cp some-files CORPUS
|
||||
|
||||
* Run fuzzing:
|
||||
./target_dec_fuzzer -max_len=100000 CORPUS
|
||||
|
||||
More info:
|
||||
http://libfuzzer.info
|
||||
http://tutorial.libfuzzer.info
|
||||
https://github.com/google/oss-fuzz
|
||||
http://lcamtuf.coredump.cx/afl/
|
||||
https://security.googleblog.com/2016/08/guided-in-process-fuzzing-of-chrome.html
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "libavutil/avassert.h"
|
||||
#include "libavutil/imgutils.h"
|
||||
#include "libavutil/intreadwrite.h"
|
||||
|
||||
#include "libavcodec/avcodec.h"
|
||||
#include "libavcodec/bytestream.h"
|
||||
#include "libavformat/avformat.h"
|
||||
|
||||
//For FF_SANE_NB_CHANNELS, so we dont waste energy testing things that will get instantly rejected
|
||||
#include "libavcodec/internal.h"
|
||||
|
||||
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size);
|
||||
|
||||
extern AVCodec * codec_list[];
|
||||
|
||||
static void error(const char *err)
|
||||
{
|
||||
fprintf(stderr, "%s", err);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
static AVCodec *c = NULL;
|
||||
static AVCodec *AVCodecInitialize(enum AVCodecID codec_id)
|
||||
{
|
||||
AVCodec *res;
|
||||
|
||||
res = avcodec_find_decoder(codec_id);
|
||||
if (!res)
|
||||
error("Failed to find decoder");
|
||||
return res;
|
||||
}
|
||||
|
||||
static int subtitle_handler(AVCodecContext *avctx, void *frame,
|
||||
int *got_sub_ptr, AVPacket *avpkt)
|
||||
{
|
||||
AVSubtitle sub;
|
||||
int ret = avcodec_decode_subtitle2(avctx, &sub, got_sub_ptr, avpkt);
|
||||
if (ret >= 0 && *got_sub_ptr)
|
||||
avsubtitle_free(&sub);
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Ensure we don't loop forever
|
||||
const uint32_t maxiteration = 8096;
|
||||
const uint64_t maxpixels_per_frame = 4096 * 4096;
|
||||
uint64_t maxpixels;
|
||||
|
||||
uint64_t maxsamples_per_frame = 256*1024*32;
|
||||
uint64_t maxsamples;
|
||||
|
||||
static const uint64_t FUZZ_TAG = 0x4741542D5A5A5546ULL;
|
||||
|
||||
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
||||
const uint64_t fuzz_tag = FUZZ_TAG;
|
||||
const uint8_t *last = data;
|
||||
const uint8_t *end = data + size;
|
||||
uint32_t it = 0;
|
||||
uint64_t ec_pixels = 0;
|
||||
uint64_t nb_samples = 0;
|
||||
int (*decode_handler)(AVCodecContext *avctx, AVFrame *picture,
|
||||
int *got_picture_ptr,
|
||||
const AVPacket *avpkt) = NULL;
|
||||
AVCodecParserContext *parser = NULL;
|
||||
uint64_t keyframes = 0;
|
||||
AVDictionary *opts = NULL;
|
||||
|
||||
if (!c) {
|
||||
#ifdef FFMPEG_DECODER
|
||||
#define DECODER_SYMBOL0(CODEC) ff_##CODEC##_decoder
|
||||
#define DECODER_SYMBOL(CODEC) DECODER_SYMBOL0(CODEC)
|
||||
extern AVCodec DECODER_SYMBOL(FFMPEG_DECODER);
|
||||
codec_list[0] = &DECODER_SYMBOL(FFMPEG_DECODER);
|
||||
avcodec_register(&DECODER_SYMBOL(FFMPEG_DECODER));
|
||||
|
||||
#if FFMPEG_DECODER == tiff || FFMPEG_DECODER == tdsc
|
||||
extern AVCodec DECODER_SYMBOL(mjpeg);
|
||||
codec_list[1] = &DECODER_SYMBOL(mjpeg);
|
||||
avcodec_register(&DECODER_SYMBOL(mjpeg));
|
||||
#endif
|
||||
|
||||
c = &DECODER_SYMBOL(FFMPEG_DECODER);
|
||||
#else
|
||||
avcodec_register_all();
|
||||
c = AVCodecInitialize(FFMPEG_CODEC); // Done once.
|
||||
#endif
|
||||
av_log_set_level(AV_LOG_PANIC);
|
||||
}
|
||||
|
||||
switch (c->type) {
|
||||
case AVMEDIA_TYPE_AUDIO : decode_handler = avcodec_decode_audio4; break;
|
||||
case AVMEDIA_TYPE_VIDEO : decode_handler = avcodec_decode_video2; break;
|
||||
case AVMEDIA_TYPE_SUBTITLE: decode_handler = subtitle_handler ; break;
|
||||
}
|
||||
switch (c->id) {
|
||||
case AV_CODEC_ID_APE: maxsamples_per_frame /= 256; break;
|
||||
}
|
||||
maxpixels = maxpixels_per_frame * maxiteration;
|
||||
maxsamples = maxsamples_per_frame * maxiteration;
|
||||
switch (c->id) {
|
||||
case AV_CODEC_ID_BINKVIDEO: maxpixels /= 32; break;
|
||||
case AV_CODEC_ID_CFHD: maxpixels /= 128; break;
|
||||
case AV_CODEC_ID_DIRAC: maxpixels /= 8192; break;
|
||||
case AV_CODEC_ID_DST: maxsamples /= 8192; break;
|
||||
case AV_CODEC_ID_DXV: maxpixels /= 32; break;
|
||||
case AV_CODEC_ID_FFWAVESYNTH: maxsamples /= 16384; break;
|
||||
case AV_CODEC_ID_G2M: maxpixels /= 64; break;
|
||||
case AV_CODEC_ID_GDV: maxpixels /= 512; break;
|
||||
case AV_CODEC_ID_GIF: maxpixels /= 16; break;
|
||||
case AV_CODEC_ID_HAP: maxpixels /= 128; break;
|
||||
case AV_CODEC_ID_HEVC: maxpixels /= 16384; break;
|
||||
case AV_CODEC_ID_HNM4_VIDEO: maxpixels /= 128; break;
|
||||
case AV_CODEC_ID_IFF_ILBM: maxpixels /= 128; break;
|
||||
case AV_CODEC_ID_INDEO4: maxpixels /= 128; break;
|
||||
case AV_CODEC_ID_LSCR: maxpixels /= 16; break;
|
||||
case AV_CODEC_ID_MOTIONPIXELS:maxpixels /= 256; break;
|
||||
case AV_CODEC_ID_MP4ALS: maxsamples /= 65536; break;
|
||||
case AV_CODEC_ID_MSRLE: maxpixels /= 16; break;
|
||||
case AV_CODEC_ID_MSS2: maxpixels /= 16384; break;
|
||||
case AV_CODEC_ID_MSZH: maxpixels /= 128; break;
|
||||
case AV_CODEC_ID_PNG: maxpixels /= 128; break;
|
||||
case AV_CODEC_ID_APNG: maxpixels /= 128; break;
|
||||
case AV_CODEC_ID_QTRLE: maxpixels /= 16; break;
|
||||
case AV_CODEC_ID_RASC: maxpixels /= 16; break;
|
||||
case AV_CODEC_ID_SANM: maxpixels /= 16; break;
|
||||
case AV_CODEC_ID_SCPR: maxpixels /= 32; break;
|
||||
case AV_CODEC_ID_SCREENPRESSO:maxpixels /= 64; break;
|
||||
case AV_CODEC_ID_SMACKVIDEO: maxpixels /= 64; break;
|
||||
case AV_CODEC_ID_SNOW: maxpixels /= 128; break;
|
||||
case AV_CODEC_ID_TGV: maxpixels /= 32; break;
|
||||
case AV_CODEC_ID_TRUEMOTION2: maxpixels /= 1024; break;
|
||||
case AV_CODEC_ID_VP7: maxpixels /= 256; break;
|
||||
case AV_CODEC_ID_VP9: maxpixels /= 4096; break;
|
||||
case AV_CODEC_ID_ZEROCODEC: maxpixels /= 128; break;
|
||||
}
|
||||
|
||||
|
||||
AVCodecContext* ctx = avcodec_alloc_context3(c);
|
||||
AVCodecContext* parser_avctx = avcodec_alloc_context3(NULL);
|
||||
if (!ctx || !parser_avctx)
|
||||
error("Failed memory allocation");
|
||||
|
||||
if (ctx->max_pixels == 0 || ctx->max_pixels > maxpixels_per_frame)
|
||||
ctx->max_pixels = maxpixels_per_frame; //To reduce false positive OOM and hangs
|
||||
ctx->refcounted_frames = 1; //To reduce false positive timeouts and focus testing on the refcounted API
|
||||
|
||||
ctx->max_samples = maxsamples_per_frame;
|
||||
|
||||
if (size > 1024) {
|
||||
GetByteContext gbc;
|
||||
int extradata_size;
|
||||
int flags;
|
||||
size -= 1024;
|
||||
bytestream2_init(&gbc, data + size, 1024);
|
||||
ctx->width = bytestream2_get_le32(&gbc);
|
||||
ctx->height = bytestream2_get_le32(&gbc);
|
||||
ctx->bit_rate = bytestream2_get_le64(&gbc);
|
||||
ctx->bits_per_coded_sample = bytestream2_get_le32(&gbc);
|
||||
// Try to initialize a parser for this codec, note, this may fail which just means we test without one
|
||||
flags = bytestream2_get_byte(&gbc);
|
||||
if (flags & 1)
|
||||
parser = av_parser_init(c->id);
|
||||
if (flags & 2)
|
||||
ctx->strict_std_compliance = FF_COMPLIANCE_EXPERIMENTAL;
|
||||
if (flags & 4) {
|
||||
ctx->err_recognition = AV_EF_AGGRESSIVE | AV_EF_COMPLIANT | AV_EF_CAREFUL;
|
||||
if (flags & 8)
|
||||
ctx->err_recognition |= AV_EF_EXPLODE;
|
||||
}
|
||||
if ((flags & 0x10) && c->id != AV_CODEC_ID_H264)
|
||||
ctx->flags2 |= AV_CODEC_FLAG2_FAST;
|
||||
|
||||
if (flags & 0x40)
|
||||
av_force_cpu_flags(0);
|
||||
|
||||
extradata_size = bytestream2_get_le32(&gbc);
|
||||
|
||||
ctx->sample_rate = bytestream2_get_le32(&gbc) & 0x7FFFFFFF;
|
||||
ctx->channels = (unsigned)bytestream2_get_le32(&gbc) % FF_SANE_NB_CHANNELS;
|
||||
ctx->block_align = bytestream2_get_le32(&gbc) & 0x7FFFFFFF;
|
||||
ctx->codec_tag = bytestream2_get_le32(&gbc);
|
||||
if (c->codec_tags) {
|
||||
int n;
|
||||
for (n = 0; c->codec_tags[n] != FF_CODEC_TAGS_END; n++);
|
||||
ctx->codec_tag = c->codec_tags[ctx->codec_tag % n];
|
||||
}
|
||||
keyframes = bytestream2_get_le64(&gbc);
|
||||
ctx->request_channel_layout = bytestream2_get_le64(&gbc);
|
||||
|
||||
ctx->idct_algo = bytestream2_get_byte(&gbc) % 25;
|
||||
|
||||
if (flags & 0x20) {
|
||||
switch (ctx->codec_id) {
|
||||
case AV_CODEC_ID_AC3:
|
||||
case AV_CODEC_ID_EAC3:
|
||||
av_dict_set_int(&opts, "cons_noisegen", bytestream2_get_byte(&gbc) & 1, 0);
|
||||
av_dict_set_int(&opts, "heavy_compr", bytestream2_get_byte(&gbc) & 1, 0);
|
||||
av_dict_set_int(&opts, "target_level", (int)(bytestream2_get_byte(&gbc) % 32) - 31, 0);
|
||||
av_dict_set_int(&opts, "dmix_mode", (int)(bytestream2_get_byte(&gbc) % 4) - 1, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (extradata_size < size) {
|
||||
ctx->extradata = av_mallocz(extradata_size + AV_INPUT_BUFFER_PADDING_SIZE);
|
||||
if (ctx->extradata) {
|
||||
ctx->extradata_size = extradata_size;
|
||||
size -= ctx->extradata_size;
|
||||
memcpy(ctx->extradata, data + size, ctx->extradata_size);
|
||||
}
|
||||
}
|
||||
if (av_image_check_size(ctx->width, ctx->height, 0, ctx))
|
||||
ctx->width = ctx->height = 0;
|
||||
}
|
||||
|
||||
int res = avcodec_open2(ctx, c, &opts);
|
||||
if (res < 0) {
|
||||
avcodec_free_context(&ctx);
|
||||
av_free(parser_avctx);
|
||||
av_parser_close(parser);
|
||||
av_dict_free(&opts);
|
||||
return 0; // Failure of avcodec_open2() does not imply that a issue was found
|
||||
}
|
||||
parser_avctx->codec_id = ctx->codec_id;
|
||||
|
||||
int got_frame;
|
||||
AVFrame *frame = av_frame_alloc();
|
||||
if (!frame)
|
||||
error("Failed memory allocation");
|
||||
|
||||
// Read very simple container
|
||||
AVPacket avpkt, parsepkt;
|
||||
av_init_packet(&avpkt);
|
||||
av_init_packet(&parsepkt);
|
||||
while (data < end && it < maxiteration) {
|
||||
// Search for the TAG
|
||||
while (data + sizeof(fuzz_tag) < end) {
|
||||
if (data[0] == (fuzz_tag & 0xFF) && AV_RN64(data) == fuzz_tag)
|
||||
break;
|
||||
data++;
|
||||
}
|
||||
if (data + sizeof(fuzz_tag) > end)
|
||||
data = end;
|
||||
|
||||
res = av_new_packet(&parsepkt, data - last);
|
||||
if (res < 0)
|
||||
error("Failed memory allocation");
|
||||
memcpy(parsepkt.data, last, data - last);
|
||||
parsepkt.flags = (keyframes & 1) * AV_PKT_FLAG_DISCARD + (!!(keyframes & 2)) * AV_PKT_FLAG_KEY;
|
||||
keyframes = (keyframes >> 2) + (keyframes<<62);
|
||||
data += sizeof(fuzz_tag);
|
||||
last = data;
|
||||
|
||||
while (parsepkt.size > 0) {
|
||||
|
||||
if (parser) {
|
||||
av_init_packet(&avpkt);
|
||||
int ret = av_parser_parse2(parser, parser_avctx, &avpkt.data, &avpkt.size,
|
||||
parsepkt.data, parsepkt.size,
|
||||
parsepkt.pts, parsepkt.dts, parsepkt.pos);
|
||||
if (avpkt.data == parsepkt.data) {
|
||||
avpkt.buf = av_buffer_ref(parsepkt.buf);
|
||||
if (!avpkt.buf)
|
||||
error("Failed memory allocation");
|
||||
} else {
|
||||
if (av_packet_make_refcounted(&avpkt) < 0)
|
||||
error("Failed memory allocation");
|
||||
}
|
||||
parsepkt.data += ret;
|
||||
parsepkt.size -= ret;
|
||||
parsepkt.pos += ret;
|
||||
avpkt.pts = parser->pts;
|
||||
avpkt.dts = parser->dts;
|
||||
avpkt.pos = parser->pos;
|
||||
if ( parser->key_frame == 1 ||
|
||||
(parser->key_frame == -1 && parser->pict_type == AV_PICTURE_TYPE_I))
|
||||
avpkt.flags |= AV_PKT_FLAG_KEY;
|
||||
avpkt.flags |= parsepkt.flags & AV_PKT_FLAG_DISCARD;
|
||||
} else {
|
||||
av_packet_move_ref(&avpkt, &parsepkt);
|
||||
}
|
||||
|
||||
// Iterate through all data
|
||||
while (avpkt.size > 0 && it++ < maxiteration) {
|
||||
av_frame_unref(frame);
|
||||
int ret = decode_handler(ctx, frame, &got_frame, &avpkt);
|
||||
|
||||
ec_pixels += (ctx->width + 32LL) * (ctx->height + 32LL);
|
||||
if (it > 20 || ec_pixels > 4 * ctx->max_pixels)
|
||||
ctx->error_concealment = 0;
|
||||
if (ec_pixels > maxpixels)
|
||||
goto maximums_reached;
|
||||
|
||||
nb_samples += frame->nb_samples;
|
||||
if (nb_samples > maxsamples)
|
||||
goto maximums_reached;
|
||||
|
||||
if (ret <= 0 || ret > avpkt.size)
|
||||
break;
|
||||
if (ctx->codec_type != AVMEDIA_TYPE_AUDIO)
|
||||
ret = avpkt.size;
|
||||
avpkt.data += ret;
|
||||
avpkt.size -= ret;
|
||||
}
|
||||
av_packet_unref(&avpkt);
|
||||
}
|
||||
av_packet_unref(&parsepkt);
|
||||
}
|
||||
maximums_reached:
|
||||
|
||||
av_packet_unref(&avpkt);
|
||||
|
||||
do {
|
||||
got_frame = 0;
|
||||
av_frame_unref(frame);
|
||||
decode_handler(ctx, frame, &got_frame, &avpkt);
|
||||
} while (got_frame == 1 && it++ < maxiteration);
|
||||
|
||||
fprintf(stderr, "pixels decoded: %"PRId64", samples decoded: %"PRId64", iterations: %d\n", ec_pixels, nb_samples, it);
|
||||
|
||||
av_frame_free(&frame);
|
||||
avcodec_free_context(&ctx);
|
||||
avcodec_free_context(&parser_avctx);
|
||||
av_parser_close(parser);
|
||||
av_packet_unref(&parsepkt);
|
||||
av_dict_free(&opts);
|
||||
return 0;
|
||||
}
|
163
externals/ffmpeg/tools/target_dem_fuzzer.c
vendored
Executable file
163
externals/ffmpeg/tools/target_dem_fuzzer.c
vendored
Executable file
@@ -0,0 +1,163 @@
|
||||
/*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* 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 FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "libavutil/avassert.h"
|
||||
|
||||
#include "libavcodec/avcodec.h"
|
||||
#include "libavcodec/bytestream.h"
|
||||
#include "libavformat/avformat.h"
|
||||
|
||||
|
||||
typedef struct IOContext {
|
||||
int64_t pos;
|
||||
int64_t filesize;
|
||||
uint8_t *fuzz;
|
||||
int fuzz_size;
|
||||
} IOContext;
|
||||
|
||||
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size);
|
||||
|
||||
static void error(const char *err)
|
||||
{
|
||||
fprintf(stderr, "%s", err);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
static int io_read(void *opaque, uint8_t *buf, int buf_size)
|
||||
{
|
||||
IOContext *c = opaque;
|
||||
int size = FFMIN(buf_size, c->fuzz_size);
|
||||
|
||||
if (!c->fuzz_size) {
|
||||
c->filesize = FFMIN(c->pos, c->filesize);
|
||||
return AVERROR_EOF;
|
||||
}
|
||||
|
||||
memcpy(buf, c->fuzz, size);
|
||||
c->fuzz += size;
|
||||
c->fuzz_size -= size;
|
||||
c->pos += size;
|
||||
c->filesize = FFMAX(c->filesize, c->pos);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
static int64_t io_seek(void *opaque, int64_t offset, int whence)
|
||||
{
|
||||
IOContext *c = opaque;
|
||||
|
||||
if (whence == SEEK_CUR) {
|
||||
if (offset > INT64_MAX - c->pos)
|
||||
return -1;
|
||||
offset += c->pos;
|
||||
} else if (whence == SEEK_END) {
|
||||
if (offset > INT64_MAX - c->filesize)
|
||||
return -1;
|
||||
offset += c->filesize;
|
||||
} else if (whence == AVSEEK_SIZE) {
|
||||
return c->filesize;
|
||||
}
|
||||
if (offset < 0 || offset > c->filesize)
|
||||
return -1;
|
||||
c->pos = offset;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Ensure we don't loop forever
|
||||
const uint32_t maxiteration = 8096;
|
||||
|
||||
static const uint64_t FUZZ_TAG = 0x4741542D5A5A5546ULL;
|
||||
|
||||
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
||||
const uint64_t fuzz_tag = FUZZ_TAG;
|
||||
uint32_t it = 0;
|
||||
AVFormatContext *avfmt = avformat_alloc_context();
|
||||
AVPacket pkt;
|
||||
char filename[1025] = {0};
|
||||
AVIOContext *fuzzed_pb = NULL;
|
||||
uint8_t *io_buffer;
|
||||
int io_buffer_size = 32768;
|
||||
int64_t filesize = size;
|
||||
IOContext opaque;
|
||||
static int c;
|
||||
int seekable = 0;
|
||||
int ret;
|
||||
|
||||
if (!c) {
|
||||
av_register_all();
|
||||
avcodec_register_all();
|
||||
av_log_set_level(AV_LOG_PANIC);
|
||||
c=1;
|
||||
}
|
||||
|
||||
if (!avfmt)
|
||||
error("Failed avformat_alloc_context()");
|
||||
|
||||
if (size > 2048) {
|
||||
GetByteContext gbc;
|
||||
memcpy (filename, data + size - 1024, 1024);
|
||||
bytestream2_init(&gbc, data + size - 2048, 1024);
|
||||
size -= 2048;
|
||||
|
||||
io_buffer_size = bytestream2_get_le32(&gbc) & 0xFFFFFFF;
|
||||
seekable = bytestream2_get_byte(&gbc) & 1;
|
||||
filesize = bytestream2_get_le64(&gbc) & 0x7FFFFFFFFFFFFFFF;
|
||||
}
|
||||
io_buffer = av_malloc(io_buffer_size);
|
||||
if (!io_buffer)
|
||||
error("Failed to allocate io_buffer");
|
||||
|
||||
opaque.filesize = filesize;
|
||||
opaque.pos = 0;
|
||||
opaque.fuzz = data;
|
||||
opaque.fuzz_size= size;
|
||||
fuzzed_pb = avio_alloc_context(io_buffer, io_buffer_size, 0, &opaque,
|
||||
io_read, NULL, seekable ? io_seek : NULL);
|
||||
if (!fuzzed_pb)
|
||||
error("avio_alloc_context failed");
|
||||
|
||||
avfmt->pb = fuzzed_pb;
|
||||
|
||||
ret = avformat_open_input(&avfmt, filename, NULL, NULL);
|
||||
if (ret < 0) {
|
||||
av_freep(&fuzzed_pb->buffer);
|
||||
av_freep(&fuzzed_pb);
|
||||
avformat_free_context(avfmt);
|
||||
return 0;
|
||||
}
|
||||
|
||||
ret = avformat_find_stream_info(avfmt, NULL);
|
||||
|
||||
av_init_packet(&pkt);
|
||||
|
||||
//TODO, test seeking
|
||||
|
||||
for(it = 0; it < maxiteration; it++) {
|
||||
ret = av_read_frame(avfmt, &pkt);
|
||||
if (ret < 0)
|
||||
break;
|
||||
av_packet_unref(&pkt);
|
||||
}
|
||||
end:
|
||||
av_freep(&fuzzed_pb->buffer);
|
||||
av_freep(&fuzzed_pb);
|
||||
avformat_close_input(&avfmt);
|
||||
|
||||
return 0;
|
||||
}
|
87
externals/ffmpeg/tools/trasher.c
vendored
Executable file
87
externals/ffmpeg/tools/trasher.c
vendored
Executable file
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
* Copyright (c) 2007 Michael Niedermayer
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* 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 FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <inttypes.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
||||
static uint32_t state;
|
||||
static uint32_t ran(void)
|
||||
{
|
||||
return state = state * 1664525 + 1013904223;
|
||||
}
|
||||
|
||||
static void checked_seek(FILE *stream, int64_t offset, int whence)
|
||||
{
|
||||
offset = fseek(stream, offset, whence);
|
||||
if (offset < 0) {
|
||||
fprintf(stderr, "seek failed\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
FILE *f;
|
||||
int count, maxburst, length;
|
||||
|
||||
if (argc < 5) {
|
||||
printf("USAGE: trasher <filename> <count> <maxburst> <seed>\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
f = fopen(argv[1], "rb+");
|
||||
if (!f) {
|
||||
perror(argv[1]);
|
||||
return 2;
|
||||
}
|
||||
count = atoi(argv[2]);
|
||||
maxburst = atoi(argv[3]);
|
||||
state = atoi(argv[4]);
|
||||
|
||||
checked_seek(f, 0, SEEK_END);
|
||||
length = ftell(f);
|
||||
checked_seek(f, 0, SEEK_SET);
|
||||
|
||||
while (count--) {
|
||||
int burst = 1 + ran() * (uint64_t) (abs(maxburst) - 1) / UINT32_MAX;
|
||||
int pos = ran() * (uint64_t) length / UINT32_MAX;
|
||||
checked_seek(f, pos, SEEK_SET);
|
||||
|
||||
if (maxburst < 0)
|
||||
burst = -maxburst;
|
||||
|
||||
if (pos + burst > length)
|
||||
continue;
|
||||
|
||||
while (burst--) {
|
||||
int val = ran() * 256ULL / UINT32_MAX;
|
||||
|
||||
if (maxburst < 0)
|
||||
val = 0;
|
||||
|
||||
fwrite(&val, 1, 1, f);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
273
externals/ffmpeg/tools/uncoded_frame.c
vendored
Executable file
273
externals/ffmpeg/tools/uncoded_frame.c
vendored
Executable file
@@ -0,0 +1,273 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "libavutil/avassert.h"
|
||||
#include "libavdevice/avdevice.h"
|
||||
#include "libavfilter/avfilter.h"
|
||||
#include "libavfilter/buffersink.h"
|
||||
#include "libavformat/avformat.h"
|
||||
|
||||
typedef struct {
|
||||
AVFormatContext *mux;
|
||||
AVStream *stream;
|
||||
AVFilterContext *sink;
|
||||
} Stream;
|
||||
|
||||
static int create_sink(Stream *st, AVFilterGraph *graph,
|
||||
AVFilterContext *f, int idx)
|
||||
{
|
||||
enum AVMediaType type = avfilter_pad_get_type(f->output_pads, idx);
|
||||
const char *sink_name;
|
||||
int ret;
|
||||
|
||||
switch (type) {
|
||||
case AVMEDIA_TYPE_VIDEO: sink_name = "buffersink"; break;
|
||||
case AVMEDIA_TYPE_AUDIO: sink_name = "abuffersink"; break;
|
||||
default:
|
||||
av_log(NULL, AV_LOG_ERROR, "Stream type not supported\n");
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
ret = avfilter_graph_create_filter(&st->sink,
|
||||
avfilter_get_by_name(sink_name),
|
||||
NULL, NULL, NULL, graph);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
ret = avfilter_link(f, idx, st->sink, 0);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
char *in_graph_desc, **out_dev_name;
|
||||
int nb_out_dev = 0, nb_streams = 0;
|
||||
AVFilterGraph *in_graph = NULL;
|
||||
Stream *streams = NULL, *st;
|
||||
AVFrame *frame = NULL;
|
||||
int i, j, run = 1, ret;
|
||||
|
||||
//av_log_set_level(AV_LOG_DEBUG);
|
||||
|
||||
if (argc < 3) {
|
||||
av_log(NULL, AV_LOG_ERROR,
|
||||
"Usage: %s filter_graph dev:out [dev2:out2...]\n\n"
|
||||
"Examples:\n"
|
||||
"%s movie=file.nut:s=v+a xv:- alsa:default\n"
|
||||
"%s movie=file.nut:s=v+a uncodedframecrc:pipe:0\n",
|
||||
argv[0], argv[0], argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
in_graph_desc = argv[1];
|
||||
out_dev_name = argv + 2;
|
||||
nb_out_dev = argc - 2;
|
||||
|
||||
avdevice_register_all();
|
||||
|
||||
/* Create input graph */
|
||||
if (!(in_graph = avfilter_graph_alloc())) {
|
||||
ret = AVERROR(ENOMEM);
|
||||
av_log(NULL, AV_LOG_ERROR, "Unable to alloc graph graph: %s\n",
|
||||
av_err2str(ret));
|
||||
goto fail;
|
||||
}
|
||||
ret = avfilter_graph_parse_ptr(in_graph, in_graph_desc, NULL, NULL, NULL);
|
||||
if (ret < 0) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Unable to parse graph: %s\n",
|
||||
av_err2str(ret));
|
||||
goto fail;
|
||||
}
|
||||
nb_streams = 0;
|
||||
for (i = 0; i < in_graph->nb_filters; i++) {
|
||||
AVFilterContext *f = in_graph->filters[i];
|
||||
for (j = 0; j < f->nb_inputs; j++) {
|
||||
if (!f->inputs[j]) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Graph has unconnected inputs\n");
|
||||
ret = AVERROR(EINVAL);
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
for (j = 0; j < f->nb_outputs; j++)
|
||||
if (!f->outputs[j])
|
||||
nb_streams++;
|
||||
}
|
||||
if (!nb_streams) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Graph has no output stream\n");
|
||||
ret = AVERROR(EINVAL);
|
||||
goto fail;
|
||||
}
|
||||
if (nb_out_dev != 1 && nb_out_dev != nb_streams) {
|
||||
av_log(NULL, AV_LOG_ERROR,
|
||||
"Graph has %d output streams, %d devices given\n",
|
||||
nb_streams, nb_out_dev);
|
||||
ret = AVERROR(EINVAL);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (!(streams = av_calloc(nb_streams, sizeof(*streams)))) {
|
||||
ret = AVERROR(ENOMEM);
|
||||
av_log(NULL, AV_LOG_ERROR, "Could not allocate streams\n");
|
||||
}
|
||||
st = streams;
|
||||
for (i = 0; i < in_graph->nb_filters; i++) {
|
||||
AVFilterContext *f = in_graph->filters[i];
|
||||
for (j = 0; j < f->nb_outputs; j++) {
|
||||
if (!f->outputs[j]) {
|
||||
if ((ret = create_sink(st++, in_graph, f, j)) < 0)
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
}
|
||||
av_assert0(st - streams == nb_streams);
|
||||
if ((ret = avfilter_graph_config(in_graph, NULL)) < 0) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Failed to configure graph\n");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* Create output devices */
|
||||
for (i = 0; i < nb_out_dev; i++) {
|
||||
char *fmt = NULL, *dev = out_dev_name[i];
|
||||
st = &streams[i];
|
||||
if ((dev = strchr(dev, ':'))) {
|
||||
*(dev++) = 0;
|
||||
fmt = out_dev_name[i];
|
||||
}
|
||||
ret = avformat_alloc_output_context2(&st->mux, NULL, fmt, dev);
|
||||
if (ret < 0) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Failed to allocate output: %s\n",
|
||||
av_err2str(ret));
|
||||
goto fail;
|
||||
}
|
||||
if (!(st->mux->oformat->flags & AVFMT_NOFILE)) {
|
||||
ret = avio_open2(&st->mux->pb, st->mux->url, AVIO_FLAG_WRITE,
|
||||
NULL, NULL);
|
||||
if (ret < 0) {
|
||||
av_log(st->mux, AV_LOG_ERROR, "Failed to init output: %s\n",
|
||||
av_err2str(ret));
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (; i < nb_streams; i++)
|
||||
streams[i].mux = streams[0].mux;
|
||||
|
||||
/* Create output device streams */
|
||||
for (i = 0; i < nb_streams; i++) {
|
||||
st = &streams[i];
|
||||
if (!(st->stream = avformat_new_stream(st->mux, NULL))) {
|
||||
ret = AVERROR(ENOMEM);
|
||||
av_log(NULL, AV_LOG_ERROR, "Failed to create output stream\n");
|
||||
goto fail;
|
||||
}
|
||||
st->stream->codecpar->codec_type = av_buffersink_get_type(st->sink);
|
||||
st->stream->time_base = av_buffersink_get_time_base(st->sink);
|
||||
switch (av_buffersink_get_type(st->sink)) {
|
||||
case AVMEDIA_TYPE_VIDEO:
|
||||
st->stream->codecpar->codec_id = AV_CODEC_ID_RAWVIDEO;
|
||||
st->stream->avg_frame_rate =
|
||||
st->stream-> r_frame_rate = av_buffersink_get_frame_rate(st->sink);
|
||||
st->stream->codecpar->width = av_buffersink_get_w(st->sink);
|
||||
st->stream->codecpar->height = av_buffersink_get_h(st->sink);
|
||||
st->stream->codecpar->sample_aspect_ratio = av_buffersink_get_sample_aspect_ratio(st->sink);
|
||||
st->stream->codecpar->format = av_buffersink_get_format(st->sink);
|
||||
break;
|
||||
case AVMEDIA_TYPE_AUDIO:
|
||||
st->stream->codecpar->channel_layout = av_buffersink_get_channel_layout(st->sink);
|
||||
st->stream->codecpar->channels = av_buffersink_get_channels(st->sink);
|
||||
st->stream->codecpar->sample_rate = av_buffersink_get_sample_rate(st->sink);
|
||||
st->stream->codecpar->format = av_buffersink_get_format(st->sink);
|
||||
st->stream->codecpar->codec_id = av_get_pcm_codec(st->stream->codecpar->format, -1);
|
||||
break;
|
||||
default:
|
||||
av_assert0(!"reached");
|
||||
}
|
||||
}
|
||||
|
||||
/* Init output devices */
|
||||
for (i = 0; i < nb_out_dev; i++) {
|
||||
st = &streams[i];
|
||||
if ((ret = avformat_write_header(st->mux, NULL)) < 0) {
|
||||
av_log(st->mux, AV_LOG_ERROR, "Failed to init output: %s\n",
|
||||
av_err2str(ret));
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
||||
/* Check output devices */
|
||||
for (i = 0; i < nb_streams; i++) {
|
||||
st = &streams[i];
|
||||
ret = av_write_uncoded_frame_query(st->mux, st->stream->index);
|
||||
if (ret < 0) {
|
||||
av_log(st->mux, AV_LOG_ERROR,
|
||||
"Uncoded frames not supported on stream #%d: %s\n",
|
||||
i, av_err2str(ret));
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
||||
while (run) {
|
||||
ret = avfilter_graph_request_oldest(in_graph);
|
||||
if (ret < 0) {
|
||||
if (ret == AVERROR_EOF) {
|
||||
run = 0;
|
||||
} else {
|
||||
av_log(NULL, AV_LOG_ERROR, "Error filtering: %s\n",
|
||||
av_err2str(ret));
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < nb_streams; i++) {
|
||||
st = &streams[i];
|
||||
while (1) {
|
||||
if (!frame && !(frame = av_frame_alloc())) {
|
||||
ret = AVERROR(ENOMEM);
|
||||
av_log(NULL, AV_LOG_ERROR, "Could not allocate frame\n");
|
||||
goto fail;
|
||||
}
|
||||
ret = av_buffersink_get_frame_flags(st->sink, frame,
|
||||
AV_BUFFERSINK_FLAG_NO_REQUEST);
|
||||
if (ret < 0) {
|
||||
if (ret != AVERROR(EAGAIN) && ret != AVERROR_EOF)
|
||||
av_log(NULL, AV_LOG_WARNING, "Error in sink: %s\n",
|
||||
av_err2str(ret));
|
||||
break;
|
||||
}
|
||||
if (frame->pts != AV_NOPTS_VALUE)
|
||||
frame->pts = av_rescale_q(frame->pts,
|
||||
av_buffersink_get_time_base(st->sink),
|
||||
st->stream->time_base);
|
||||
ret = av_interleaved_write_uncoded_frame(st->mux,
|
||||
st->stream->index,
|
||||
frame);
|
||||
frame = NULL;
|
||||
if (ret < 0) {
|
||||
av_log(st->mux, AV_LOG_ERROR,
|
||||
"Error writing frame: %s\n", av_err2str(ret));
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ret = 0;
|
||||
|
||||
for (i = 0; i < nb_out_dev; i++) {
|
||||
st = &streams[i];
|
||||
av_write_trailer(st->mux);
|
||||
}
|
||||
|
||||
fail:
|
||||
av_frame_free(&frame);
|
||||
avfilter_graph_free(&in_graph);
|
||||
if (streams) {
|
||||
for (i = 0; i < nb_out_dev; i++) {
|
||||
st = &streams[i];
|
||||
if (st->mux) {
|
||||
if (st->mux->pb)
|
||||
avio_closep(&st->mux->pb);
|
||||
avformat_free_context(st->mux);
|
||||
}
|
||||
}
|
||||
}
|
||||
av_freep(&streams);
|
||||
return ret < 0;
|
||||
}
|
2
externals/ffmpeg/tools/unwrap-diff
vendored
Executable file
2
externals/ffmpeg/tools/unwrap-diff
vendored
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
tr '\n' '\001' | sed 's/\x01\x01/\x01 \x01/g' | sed 's/\x01\([^-+ @]\)/ \1/g' | tr '\001' '\n'
|
195
externals/ffmpeg/tools/venc_data_dump.c
vendored
Executable file
195
externals/ffmpeg/tools/venc_data_dump.c
vendored
Executable file
@@ -0,0 +1,195 @@
|
||||
/*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* 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 FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "libavutil/common.h"
|
||||
#include "libavutil/dict.h"
|
||||
#include "libavutil/error.h"
|
||||
#include "libavutil/video_enc_params.h"
|
||||
|
||||
#include "libavformat/avformat.h"
|
||||
|
||||
#include "libavcodec/avcodec.h"
|
||||
|
||||
static int decode_read(AVCodecContext *decoder, AVFrame *frame, int flush, int max_frames)
|
||||
{
|
||||
const int ret_done = flush ? AVERROR_EOF : AVERROR(EAGAIN);
|
||||
int ret = 0;
|
||||
|
||||
while (ret >= 0 &&
|
||||
(max_frames == 0 || decoder->frame_number < max_frames)) {
|
||||
AVFrameSideData *sd;
|
||||
|
||||
ret = avcodec_receive_frame(decoder, frame);
|
||||
if (ret < 0)
|
||||
return (ret == ret_done) ? 0 : ret;
|
||||
|
||||
fprintf(stdout, "frame %d\n", decoder->frame_number - 1);
|
||||
|
||||
sd = av_frame_get_side_data(frame, AV_FRAME_DATA_VIDEO_ENC_PARAMS);
|
||||
if (sd) {
|
||||
AVVideoEncParams *par = (AVVideoEncParams*)sd->data;
|
||||
|
||||
fprintf(stdout, "AVVideoEncParams %d\n", par->type);
|
||||
fprintf(stdout, "qp %d\n", par->qp);
|
||||
for (int i = 0; i < FF_ARRAY_ELEMS(par->delta_qp); i++)
|
||||
for (int j = 0; j < FF_ARRAY_ELEMS(par->delta_qp[i]); j++) {
|
||||
if (par->delta_qp[i][j])
|
||||
fprintf(stdout, "delta_qp[%d][%d] %"PRId32"\n", i, j, par->delta_qp[i][j]);
|
||||
}
|
||||
|
||||
if (par->nb_blocks) {
|
||||
fprintf(stdout, "nb_blocks %d\n", par->nb_blocks);
|
||||
for (int i = 0; i < par->nb_blocks; i++) {
|
||||
AVVideoBlockParams *b = av_video_enc_params_block(par, i);
|
||||
|
||||
fprintf(stdout, "block %d %d:%d %dx%d %"PRId32"\n",
|
||||
i, b->src_x, b->src_y, b->w, b->h, b->delta_qp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
av_frame_unref(frame);
|
||||
|
||||
if (max_frames && decoder->frame_number == max_frames)
|
||||
return 1;
|
||||
}
|
||||
|
||||
return (max_frames == 0 || decoder->frame_number < max_frames) ? 0 : 1;
|
||||
}
|
||||
|
||||
static int decoder_init(AVFormatContext *demuxer, int stream_idx,
|
||||
AVCodecContext **dec, AVDictionary **opts)
|
||||
{
|
||||
const AVCodec *codec;
|
||||
int ret;
|
||||
|
||||
if (stream_idx < 0 || stream_idx >= demuxer->nb_streams)
|
||||
return AVERROR(EINVAL);
|
||||
|
||||
codec = avcodec_find_decoder(demuxer->streams[stream_idx]->codecpar->codec_id);
|
||||
if (!codec)
|
||||
return AVERROR_DECODER_NOT_FOUND;
|
||||
|
||||
*dec = avcodec_alloc_context3(codec);
|
||||
if (!*dec)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
ret = avcodec_open2(*dec, NULL, opts);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
AVFormatContext *demuxer = NULL;
|
||||
AVCodecContext *decoder = NULL;
|
||||
AVDictionary *opts = NULL;
|
||||
|
||||
AVPacket *pkt = NULL;
|
||||
AVFrame *frame = NULL;
|
||||
|
||||
unsigned int stream_idx, max_frames;
|
||||
const char *filename, *thread_type = NULL, *nb_threads = NULL;
|
||||
int ret = 0;
|
||||
|
||||
if (argc <= 3) {
|
||||
fprintf(stderr, "Usage: %s <input file> <stream index> <max frame count> [<thread count> <thread type>]\n", argv[0]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
filename = argv[1];
|
||||
stream_idx = strtol(argv[2], NULL, 0);
|
||||
max_frames = strtol(argv[3], NULL, 0);
|
||||
if (argc > 5) {
|
||||
nb_threads = argv[4];
|
||||
thread_type = argv[5];
|
||||
}
|
||||
|
||||
ret = av_dict_set(&opts, "threads", nb_threads, 0);
|
||||
ret |= av_dict_set(&opts, "thread_type", thread_type, 0);
|
||||
ret |= av_dict_set(&opts, "export_side_data", "venc_params", 0);
|
||||
|
||||
ret = avformat_open_input(&demuxer, filename, NULL, NULL);
|
||||
if (ret < 0) {
|
||||
fprintf(stderr, "Error opening input file: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = decoder_init(demuxer, stream_idx, &decoder, &opts);
|
||||
if (ret < 0) {
|
||||
fprintf(stderr, "Error initializing decoder\n");
|
||||
goto finish;
|
||||
}
|
||||
|
||||
pkt = av_packet_alloc();
|
||||
frame = av_frame_alloc();
|
||||
if (!pkt || !frame) {
|
||||
ret = AVERROR(ENOMEM);
|
||||
goto finish;
|
||||
}
|
||||
|
||||
while (ret >= 0) {
|
||||
ret = av_read_frame(demuxer, pkt);
|
||||
if (ret < 0)
|
||||
goto flush;
|
||||
if (pkt->stream_index != stream_idx) {
|
||||
av_packet_unref(pkt);
|
||||
continue;
|
||||
}
|
||||
|
||||
ret = avcodec_send_packet(decoder, pkt);
|
||||
if (ret < 0) {
|
||||
fprintf(stderr, "Error decoding: %d\n", ret);
|
||||
goto finish;
|
||||
}
|
||||
av_packet_unref(pkt);
|
||||
|
||||
ret = decode_read(decoder, frame, 0, max_frames);
|
||||
if (ret < 0) {
|
||||
fprintf(stderr, "Error decoding: %d\n", ret);
|
||||
goto finish;
|
||||
} else if (ret > 0) {
|
||||
ret = 0;
|
||||
goto finish;
|
||||
}
|
||||
}
|
||||
|
||||
flush:
|
||||
avcodec_send_packet(decoder, NULL);
|
||||
ret = decode_read(decoder, frame, 1, max_frames);
|
||||
if (ret < 0) {
|
||||
fprintf(stderr, "Error flushing: %d\n", ret);
|
||||
goto finish;
|
||||
}
|
||||
ret = 0;
|
||||
|
||||
finish:
|
||||
av_dict_free(&opts);
|
||||
av_packet_free(&pkt);
|
||||
av_frame_free(&frame);
|
||||
avcodec_free_context(&decoder);
|
||||
avformat_close_input(&demuxer);
|
||||
|
||||
return ret;
|
||||
}
|
184
externals/ffmpeg/tools/yuvcmp.c
vendored
Executable file
184
externals/ffmpeg/tools/yuvcmp.c
vendored
Executable file
@@ -0,0 +1,184 @@
|
||||
/*
|
||||
* originally by Andreas Öman (andoma)
|
||||
* some changes by Alexander Strange
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <inttypes.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#if HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
int fd[2];
|
||||
int print_pixels = 0;
|
||||
int dump_blocks = 0;
|
||||
|
||||
int width;
|
||||
int height;
|
||||
int to_skip = 0;
|
||||
|
||||
if (argc < 6) {
|
||||
fprintf(stderr, "%s [YUV file 1] [YUV file 2] width height pixelcmp|blockdump (# to skip)\n", argv[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
width = atoi(argv[3]);
|
||||
height = atoi(argv[4]);
|
||||
if (argc > 6)
|
||||
to_skip = atoi(argv[6]);
|
||||
|
||||
uint8_t *Y[2], *C[2][2];
|
||||
int i, v, c, p;
|
||||
int lsiz = width * height;
|
||||
int csiz = width * height / 4;
|
||||
int x, y;
|
||||
int cwidth = width / 2;
|
||||
int fr = to_skip;
|
||||
int mb;
|
||||
char *mberrors;
|
||||
int mb_x, mb_y;
|
||||
uint8_t *a;
|
||||
uint8_t *b;
|
||||
int die = 0;
|
||||
|
||||
print_pixels = strstr(argv[5], "pixelcmp") ? 1 : 0;
|
||||
dump_blocks = strstr(argv[5], "blockdump") ? 1 : 0;
|
||||
|
||||
for(i = 0; i < 2; i++) {
|
||||
Y[i] = malloc(lsiz);
|
||||
C[0][i] = malloc(csiz);
|
||||
C[1][i] = malloc(csiz);
|
||||
|
||||
fd[i] = open(argv[1 + i], O_RDONLY);
|
||||
if(fd[i] == -1) {
|
||||
perror("open");
|
||||
exit(1);
|
||||
}
|
||||
fcntl(fd[i], F_NOCACHE, 1);
|
||||
|
||||
if (to_skip)
|
||||
lseek(fd[i], to_skip * (lsiz + 2*csiz), SEEK_SET);
|
||||
}
|
||||
|
||||
mb_x = width / 16;
|
||||
mb_y = height / 16;
|
||||
|
||||
mberrors = malloc(mb_x * mb_y);
|
||||
|
||||
while(!die) {
|
||||
memset(mberrors, 0, mb_x * mb_y);
|
||||
|
||||
printf("Loading frame %d\n", ++fr);
|
||||
|
||||
for(i = 0; i < 2; i++) {
|
||||
v = read(fd[i], Y[i], lsiz);
|
||||
if(v != lsiz) {
|
||||
fprintf(stderr, "Unable to read Y from file %d, exiting\n", i + 1);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for(c = 0; c < lsiz; c++) {
|
||||
if(Y[0][c] != Y[1][c]) {
|
||||
x = c % width;
|
||||
y = c / width;
|
||||
|
||||
mb = x / 16 + (y / 16) * mb_x;
|
||||
|
||||
if(print_pixels)
|
||||
printf("Luma diff 0x%02x != 0x%02x at pixel (%4d,%-4d) mb(%d,%d) #%d\n",
|
||||
Y[0][c],
|
||||
Y[1][c],
|
||||
x, y,
|
||||
x / 16,
|
||||
y / 16,
|
||||
mb);
|
||||
|
||||
mberrors[mb] |= 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Chroma planes */
|
||||
|
||||
for(p = 0; p < 2; p++) {
|
||||
|
||||
for(i = 0; i < 2; i++) {
|
||||
v = read(fd[i], C[p][i], csiz);
|
||||
if(v != csiz) {
|
||||
fprintf(stderr, "Unable to read %c from file %d, exiting\n",
|
||||
"UV"[p], i + 1);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
for(c = 0; c < csiz; c++) {
|
||||
if(C[p][0][c] != C[p][1][c]) {
|
||||
x = c % cwidth;
|
||||
y = c / cwidth;
|
||||
|
||||
mb = x / 8 + (y / 8) * mb_x;
|
||||
|
||||
mberrors[mb] |= 2 << p;
|
||||
|
||||
if(print_pixels)
|
||||
|
||||
printf("c%c diff 0x%02x != 0x%02x at pixel (%4d,%-4d) "
|
||||
"mb(%3d,%-3d) #%d\n",
|
||||
p ? 'r' : 'b',
|
||||
C[p][0][c],
|
||||
C[p][1][c],
|
||||
|
||||
x, y,
|
||||
x / 8,
|
||||
y / 8,
|
||||
x / 8 + y / 8 * cwidth / 8);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(i = 0; i < mb_x * mb_y; i++) {
|
||||
x = i % mb_x;
|
||||
y = i / mb_x;
|
||||
|
||||
if(mberrors[i]) {
|
||||
die = 1;
|
||||
|
||||
printf("MB (%3d,%-3d) %4d %d %c%c%c damaged\n",
|
||||
x, y, i, mberrors[i],
|
||||
mberrors[i] & 1 ? 'Y' : ' ',
|
||||
mberrors[i] & 2 ? 'U' : ' ',
|
||||
mberrors[i] & 4 ? 'V' : ' ');
|
||||
|
||||
if(dump_blocks) {
|
||||
a = Y[0] + x * 16 + y * 16 * width;
|
||||
b = Y[1] + x * 16 + y * 16 * width;
|
||||
|
||||
for(y = 0; y < 16; y++) {
|
||||
printf("%c ", "TB"[y&1]);
|
||||
for(x = 0; x < 16; x++)
|
||||
printf("%02x%c", a[x + y * width],
|
||||
a[x + y * width] != b[x + y * width] ? '<' : ' ');
|
||||
|
||||
printf("| ");
|
||||
for(x = 0; x < 16; x++)
|
||||
printf("%02x%c", b[x + y * width],
|
||||
a[x + y * width] != b[x + y * width] ? '<' : ' ');
|
||||
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
168
externals/ffmpeg/tools/zmqsend.c
vendored
Executable file
168
externals/ffmpeg/tools/zmqsend.c
vendored
Executable file
@@ -0,0 +1,168 @@
|
||||
/*
|
||||
* Copyright (c) 2013 Stefano Sabatini
|
||||
*
|
||||
* This file is part of FFmpeg.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* 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 FFmpeg; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <zmq.h>
|
||||
|
||||
#include "libavutil/mem.h"
|
||||
#include "libavutil/bprint.h"
|
||||
|
||||
#if HAVE_UNISTD_H
|
||||
#include <unistd.h> /* getopt */
|
||||
#endif
|
||||
|
||||
#if !HAVE_GETOPT
|
||||
#include "compat/getopt.c"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @file
|
||||
* zmq message sender example, meant to be used with the zmq filters
|
||||
*/
|
||||
|
||||
static void usage(void)
|
||||
{
|
||||
printf("send message to ZMQ recipient, to use with the zmq filters\n");
|
||||
printf("usage: zmqsend [OPTIONS]\n");
|
||||
printf("\n"
|
||||
"Options:\n"
|
||||
"-b ADDRESS set bind address\n"
|
||||
"-h print this help\n"
|
||||
"-i INFILE set INFILE as input file, stdin if omitted\n");
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
AVBPrint src;
|
||||
char *src_buf, *recv_buf;
|
||||
int c;
|
||||
int recv_buf_size, ret = 0;
|
||||
void *zmq_ctx, *socket;
|
||||
const char *bind_address = "tcp://localhost:5555";
|
||||
const char *infilename = NULL;
|
||||
FILE *infile = NULL;
|
||||
zmq_msg_t msg;
|
||||
|
||||
while ((c = getopt(argc, argv, "b:hi:")) != -1) {
|
||||
switch (c) {
|
||||
case 'b':
|
||||
bind_address = optarg;
|
||||
break;
|
||||
case 'h':
|
||||
usage();
|
||||
return 0;
|
||||
case 'i':
|
||||
infilename = optarg;
|
||||
break;
|
||||
case '?':
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (!infilename || !strcmp(infilename, "-")) {
|
||||
infilename = "stdin";
|
||||
infile = stdin;
|
||||
} else {
|
||||
infile = fopen(infilename, "r");
|
||||
}
|
||||
if (!infile) {
|
||||
av_log(NULL, AV_LOG_ERROR,
|
||||
"Impossible to open input file '%s': %s\n", infilename, strerror(errno));
|
||||
return 1;
|
||||
}
|
||||
|
||||
zmq_ctx = zmq_ctx_new();
|
||||
if (!zmq_ctx) {
|
||||
av_log(NULL, AV_LOG_ERROR,
|
||||
"Could not create ZMQ context: %s\n", zmq_strerror(errno));
|
||||
return 1;
|
||||
}
|
||||
|
||||
socket = zmq_socket(zmq_ctx, ZMQ_REQ);
|
||||
if (!socket) {
|
||||
av_log(NULL, AV_LOG_ERROR,
|
||||
"Could not create ZMQ socket: %s\n", zmq_strerror(errno));
|
||||
ret = 1;
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (zmq_connect(socket, bind_address) == -1) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Could not bind ZMQ responder to address '%s': %s\n",
|
||||
bind_address, zmq_strerror(errno));
|
||||
ret = 1;
|
||||
goto end;
|
||||
}
|
||||
|
||||
/* grab the input and store it in src */
|
||||
av_bprint_init(&src, 1, AV_BPRINT_SIZE_UNLIMITED);
|
||||
while ((c = fgetc(infile)) != EOF)
|
||||
av_bprint_chars(&src, c, 1);
|
||||
av_bprint_chars(&src, 0, 1);
|
||||
|
||||
if (!av_bprint_is_complete(&src)) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Could not allocate a buffer for the source string\n");
|
||||
av_bprint_finalize(&src, NULL);
|
||||
ret = 1;
|
||||
goto end;
|
||||
}
|
||||
av_bprint_finalize(&src, &src_buf);
|
||||
|
||||
if (zmq_send(socket, src_buf, strlen(src_buf), 0) == -1) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Could not send message: %s\n", zmq_strerror(errno));
|
||||
ret = 1;
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (zmq_msg_init(&msg) == -1) {
|
||||
av_log(NULL, AV_LOG_ERROR,
|
||||
"Could not initialize receiving message: %s\n", zmq_strerror(errno));
|
||||
ret = 1;
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (zmq_msg_recv(&msg, socket, 0) == -1) {
|
||||
av_log(NULL, AV_LOG_ERROR,
|
||||
"Could not receive message: %s\n", zmq_strerror(errno));
|
||||
zmq_msg_close(&msg);
|
||||
ret = 1;
|
||||
goto end;
|
||||
}
|
||||
|
||||
recv_buf_size = zmq_msg_size(&msg) + 1;
|
||||
recv_buf = av_malloc(recv_buf_size);
|
||||
if (!recv_buf) {
|
||||
av_log(NULL, AV_LOG_ERROR,
|
||||
"Could not allocate receiving message buffer\n");
|
||||
zmq_msg_close(&msg);
|
||||
ret = 1;
|
||||
goto end;
|
||||
}
|
||||
memcpy(recv_buf, zmq_msg_data(&msg), recv_buf_size - 1);
|
||||
recv_buf[recv_buf_size-1] = 0;
|
||||
printf("%s\n", recv_buf);
|
||||
zmq_msg_close(&msg);
|
||||
av_free(recv_buf);
|
||||
|
||||
end:
|
||||
zmq_close(socket);
|
||||
zmq_ctx_destroy(zmq_ctx);
|
||||
return ret;
|
||||
}
|
26
externals/ffmpeg/tools/zmqshell.py
vendored
Executable file
26
externals/ffmpeg/tools/zmqshell.py
vendored
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env python2
|
||||
|
||||
import sys, zmq, cmd
|
||||
|
||||
class LavfiCmd(cmd.Cmd):
|
||||
prompt = 'lavfi> '
|
||||
|
||||
def __init__(self, bind_address):
|
||||
context = zmq.Context()
|
||||
self.requester = context.socket(zmq.REQ)
|
||||
self.requester.connect(bind_address)
|
||||
cmd.Cmd.__init__(self)
|
||||
|
||||
def onecmd(self, cmd):
|
||||
if cmd == 'EOF':
|
||||
sys.exit(0)
|
||||
print 'Sending command:[%s]' % cmd
|
||||
self.requester.send(cmd)
|
||||
message = self.requester.recv()
|
||||
print 'Received reply:[%s]' % message
|
||||
|
||||
try:
|
||||
bind_address = sys.argv[1] if len(sys.argv) > 1 else "tcp://localhost:5555"
|
||||
LavfiCmd(bind_address).cmdloop('FFmpeg libavfilter interactive shell')
|
||||
except KeyboardInterrupt:
|
||||
pass
|
Reference in New Issue
Block a user