diff options
author | Mans Rullgard <mans@mansr.com> | 2012-05-09 04:29:53 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-06-03 02:08:16 +0200 |
commit | a128b310efa31ea0f2a3898cd58c0d954c8605be (patch) | |
tree | aa197a3b8ed4d2a2eea8fad37a78e64cccd95368 /configure | |
parent | d0f34c96b13e6ccbb359e23565ef0e8c944b7c0e (diff) | |
download | ffmpeg-streaming-a128b310efa31ea0f2a3898cd58c0d954c8605be.zip ffmpeg-streaming-a128b310efa31ea0f2a3898cd58c0d954c8605be.tar.gz |
configure: add --enable/disable-random option
This allows creating random configurations which is useful for
testing purposes.
Signed-off-by: Mans Rullgard <mans@mansr.com>
Conflicts:
configure
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'configure')
-rwxr-xr-x | configure | 40 |
1 files changed, 40 insertions, 0 deletions
@@ -287,6 +287,14 @@ Developer options (useful when working on FFmpeg itself): \$FATE_SAMPLES at make invocation time. --enable-xmm-clobber-test check XMM registers for clobbering (Win64-only; should be used only for debugging purposes) + --enable-random randomly enable/disable components + --disable-random + --enable-random=LIST randomly enable/disable specific components or + --disable-random=LIST component groups. LIST is a comma-separated list + of NAME[:PROB] entries where NAME is a component + (group) and PROB the probability associated with + NAME (default 0.5). + --random-seed=VALUE seed value for --enable/disable-random NOTE: Object files are built at the place where configure is launched. EOF @@ -1332,6 +1340,7 @@ CMDLINE_SET=" pkg_config postproc_version progs_suffix + random_seed samples strip sysinclude @@ -1959,6 +1968,27 @@ show_list() { exit 0 } +rand_list(){ + IFS=', ' + set -- $* + unset IFS + for thing; do + comp=${thing%:*} + prob=${thing#$comp} + prob=${prob#:} + is_in ${comp} $COMPONENT_LIST && eval comp=\$$(toupper ${comp%s})_LIST + echo "prob ${prob:-0.5}" + printf '%s\n' $comp + done +} + +do_random(){ + action=$1 + shift + random_seed=$(awk "BEGIN { srand($random_seed); print srand() }") + $action $(rand_list "$@" | awk "BEGIN { srand($random_seed) } \$1 == \"prob\" { prob = \$2; next } rand() < prob { print }") +} + for opt do optval="${opt#*=}" case "$opt" in @@ -1973,6 +2003,14 @@ for opt do --disable-everything) map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST ;; + --enable-random|--disable-random) + action=${opt%%-random} + do_random ${action#--} $COMPONENT_LIST + ;; + --enable-random=*|--disable-random=*) + action=${opt%%-random=*} + do_random ${action#--} $optval + ;; --enable-*=*|--disable-*=*) eval $(echo "${opt%%=*}" | sed 's/--/action=/;s/-/ thing=/') is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt" @@ -3558,6 +3596,8 @@ echo "openal enabled ${openal-no}" echo "openssl enabled ${openssl-no}" echo "zlib enabled ${zlib-no}" echo "bzlib enabled ${bzlib-no}" +test -n "$random_seed" && + echo "random seed ${random_seed}" echo for type in decoder encoder hwaccel parser demuxer muxer protocol filter bsf indev outdev; do |