Sync development version
git-svn-id: https://svn.outlyer.net/svn/pub/video-contact-sheet/branches/1.13@560 da2faf11-d50b-4b07-92cd-6070d1bd8887
This commit is contained in:
parent
7d2ed96aa4
commit
3d9827b751
|
@ -1,4 +1,4 @@
|
|||
1.13 (2013-02-27):
|
||||
1.13 (2013-03-07):
|
||||
* Complete manual pages
|
||||
* Added 'anonymous' to the list of settings
|
||||
* Remove meaningless decimals when generating config files
|
||||
|
@ -13,10 +13,9 @@
|
|||
- Make "dynamic" settings case-insensitive, i.e.
|
||||
bg_heading=$bg_contact can also be written bg_heading=$BG_CONTACT
|
||||
- Correct extended-set resizing
|
||||
- Constraint checking of settings failed silently
|
||||
for alias-only names
|
||||
- Code typo: Produced error message when extended mode was
|
||||
narrower than contact sheet
|
||||
- Constraint checking of settings failed silently for alias-only names
|
||||
- Code typo: Produced error message when extended mode was narrower than
|
||||
contact sheet
|
||||
- Only warned about command-line GETOPT override when using uppercase
|
||||
setting name
|
||||
- Fixes for FreeBSD compatibility (regressions introduced in 1.12.3,
|
||||
|
@ -25,6 +24,8 @@
|
|||
FreeBSD's bash 4.0.10 (FreeBSD only)
|
||||
> Unsupported 'expr match' replaced by awk
|
||||
- Fix error when avoiding repeated captures
|
||||
- Don't filter cached captures more than once [#199]
|
||||
- Skip files where interval gets rounded to zero [#195]
|
||||
* Scheduled code cleanup:
|
||||
- Removal of deprecated configuration options: DEFAULT_END_OFFSET,
|
||||
shoehorned and safe_rename_pattern
|
||||
|
@ -47,7 +48,7 @@
|
|||
latter demonstrating how a profile can load other profiles
|
||||
- List also builtin profiles with --profile :list
|
||||
- Each profile can no longer be loaded more than once
|
||||
- Restore terminal through stty
|
||||
- Restore terminal through stty [#198]
|
||||
* UNDOCUMENTED/DEBUG:
|
||||
- Undocumented options:
|
||||
- Don't fail on unknown sub-options
|
||||
|
|
|
@ -166,6 +166,10 @@ declare -r NL=$'\012' # Newline
|
|||
#declare -r TAB=$'\011' # Tab
|
||||
|
||||
# New in 1.13
|
||||
# Set to 1 to disable blank frame evasion
|
||||
declare -i DISABLE_EVASION=0
|
||||
# Threshold to consider a frame blank (see capture_and_evade)
|
||||
declare -i BLANK_THRESHOLD=10
|
||||
# Offsets to try when trying to avoid blank frames
|
||||
# See capture() and capture_and_evade()
|
||||
declare -a EVASION_ALTERNATIVES=( -5 +5 -10 +10 -30 +30 )
|
||||
|
@ -2409,13 +2413,21 @@ compute_timecodes() {
|
|||
error "Internal error"
|
||||
return $EX_SOFTWARE
|
||||
fi
|
||||
# Keep three decimals, round to lower to avoid exceeding the video length
|
||||
inc=$(keepdecimals_lower $inc 3)
|
||||
if [[ $CAPTURER_HAS_MS -eq 0 ]]; then
|
||||
inc=$(keepdecimals_lower $inc 0)
|
||||
else
|
||||
# Keep three decimals, round to lower to avoid exceeding the video length
|
||||
inc=$(keepdecimals_lower $inc 3)
|
||||
fi
|
||||
|
||||
if fptest $inc -gt ${VID[$LEN]}; then
|
||||
error "Interval is longer than video length, skipping $f"
|
||||
error "Capture interval is longer than video length, skipping '$f'"
|
||||
return $EX_USAGE
|
||||
fi
|
||||
if fptest $inc -eq 0; then
|
||||
error "Capture interval is too low, skipping '$f'"
|
||||
return $EX_UNAVAILABLE
|
||||
fi
|
||||
|
||||
local stamp=$st
|
||||
local -a LTC
|
||||
|
@ -2520,9 +2532,8 @@ capture_and_evade() {
|
|||
error "Failed to capture frame at $(pretty_stamp $stamp) (${stamp}s)"
|
||||
return $EX_SOFTWARE
|
||||
fi
|
||||
# **XXX: EXPERIMENTAL: Blank frame evasion test
|
||||
# **XXX: EXPERIMENTAL: Blank frame evasion, initial test implementation
|
||||
local blank_val=$(convert "$ofile" -colorspace Gray -format '%[fx:image.mean*100]' info:)
|
||||
local BLANK_THRESHOLD=10
|
||||
local upper=$(( 100 - $BLANK_THRESHOLD ))
|
||||
if fptest $blank_val -lt $BLANK_THRESHOLD || fptest $blank_val -gt $upper ; then
|
||||
local msg=" Blank (enough) frame detected."
|
||||
|
@ -2543,11 +2554,13 @@ capture_and_evade() {
|
|||
|
||||
# Capture a frame, intermediate-level implementation, use capture() instead.
|
||||
# Sets $RESULT to '$timestamp:$output'
|
||||
# Sets $CAPTURED_FROM_CACHE to 1 if it was already captured
|
||||
# capture_impl($1 = filename, $2 = second, $3 = output file)
|
||||
capture_impl() {
|
||||
trace $@
|
||||
local f=$1 stamp=$2 ofile=$3
|
||||
RESULT=''
|
||||
CAPTURED_FROM_CACHE=0
|
||||
|
||||
# Avoid recapturing if timestamp is already captured.
|
||||
# The extended set includes the standard set so when using the extended mode
|
||||
|
@ -2562,10 +2575,11 @@ capture_impl() {
|
|||
else
|
||||
key=$(awkex $stamp)
|
||||
fi
|
||||
local cached=$(grep "^$key:" <<<"$CAPTURES")
|
||||
local cached=$(grep "^$key:" <<<"$CAPTURES" | head -1)
|
||||
if [[ $cached ]]; then
|
||||
notice "Skipped capture at $(pretty_stamp $key)"
|
||||
cp "${cached#*:}" "$ofile" # TODO: Is 'cp -s' safe?
|
||||
CAPTURED_FROM_CACHE=1
|
||||
else
|
||||
local capfn=${CAPTURER}_capture
|
||||
if [[ $DVD_MODE -eq 1 ]]; then
|
||||
|
@ -3762,7 +3776,8 @@ process() {
|
|||
hlcapfile=$(new_temp_file "-hl-$(pad 6 $n).png")
|
||||
|
||||
capture "$f" "$hlcapfile" $stamp '1' || return $?
|
||||
filter_vidcap "$hlcapfile" $pretty $vidcap_width $vidcap_height $CTX_HL $n || {
|
||||
[[ $CAPTURED_FROM_CACHE -eq 1 ]] ||\
|
||||
filter_vidcap "$hlcapfile" $pretty $vidcap_width $vidcap_height $CTX_HL $n || {
|
||||
local r=$?
|
||||
error "Failed to apply transformations to the capture."
|
||||
return $r
|
||||
|
@ -3795,12 +3810,13 @@ process() {
|
|||
# identified by capture number, padded to 6 characters
|
||||
tfile=$(new_temp_file "-cap-$(pad 6 $n).png")
|
||||
|
||||
capture "$f" "$tfile" $stamp || return $?
|
||||
capture "$f" "$tfile" $stamp $DISABLE_EVASION || return $?
|
||||
if [[ $RESULT != "$stamp" ]]; then
|
||||
stamp=$RESULT
|
||||
pretty=$(pretty_stamp $RESULT)
|
||||
fi
|
||||
filter_vidcap "$tfile" $pretty $vidcap_width $vidcap_height $CTX_STD $n || return $?
|
||||
[[ $CAPTURED_FROM_CACHE -eq 1 ]] ||\
|
||||
filter_vidcap "$tfile" $pretty $vidcap_width $vidcap_height $CTX_STD $n || return $?
|
||||
|
||||
capfiles=( "${capfiles[@]}" "$tfile" )
|
||||
(( n++ ))
|
||||
|
@ -3841,8 +3857,9 @@ process() {
|
|||
pretty=$(pretty_stamp $stamp)
|
||||
capfile=$(new_temp_file "-excap-$(pad 6 $n).png")
|
||||
inf "Generating capture from extended set: ${n}/${#TIMECODES[*]} ($pretty)..."
|
||||
capture "$f" "$capfile" $stamp || return $?
|
||||
filter_vidcap "$capfile" $pretty $w $h $CTX_EXT $n || return $?
|
||||
capture "$f" "$capfile" $stamp $DISABLE_EVASION || return $?
|
||||
[[ $CAPTURED_FROM_CACHE -eq 1 ]] ||\
|
||||
filter_vidcap "$capfile" $pretty $w $h $CTX_EXT $n || return $?
|
||||
|
||||
capfiles=( "${capfiles[@]}" "$capfile" )
|
||||
(( n++ ))
|
||||
|
@ -5095,6 +5112,10 @@ while true ; do
|
|||
else
|
||||
usrcap='{default}'
|
||||
fi
|
||||
evasion="Enabled (${EVASION_ALTERNATIVES[*]})"
|
||||
if [[ $DISABLE_EVASION -eq 1 ]]; then
|
||||
evasion='Disabled'
|
||||
fi
|
||||
cat >&2 <<-EOD
|
||||
=== Setup ===
|
||||
GETOPT: $GETOPT
|
||||
|
@ -5109,7 +5130,7 @@ while true ; do
|
|||
Chosen capturer: $usrcap
|
||||
Filterchain: [ ${FILTERS_IND[*]} ]
|
||||
Safe step: $QUIRKS_LEN_STEP
|
||||
Blank evasion: $prevent_evasion
|
||||
Blank evasion: $evasion
|
||||
=== Versions ===
|
||||
Bash: $BASH_VERSION
|
||||
Getopt: $($GETOPT --version)$awkv$sedv
|
||||
|
|
|
@ -20,6 +20,7 @@ inc/constants.inc.bash: $(VCS)
|
|||
mkdir -p inc/
|
||||
echo 'declare -r RELEASE=0' > $@
|
||||
echo 'declare DEBUG=1' >> $@
|
||||
echo 'INTERNAL_TRACE_FILTER=TRACE_NOTHING' >>$@
|
||||
echo '$(shell grep -m1 'VERSION=' "$(VCS)")' >> $@
|
||||
sed -n '/{{{ # Constants/,/}}}/p' "$(VCS)" >> $@
|
||||
|
||||
|
|
|
@ -21,5 +21,10 @@ echo 'while read line ; do'
|
|||
echo ' unittest $line'
|
||||
echo 'done <<< "$(sed "/^[[:space:]]*#/d" "'$testsfile'" | grep "^'${TESTNAME}' ")"'
|
||||
|
||||
|
||||
echo 'if [[ $RET -eq 0 ]]; then'
|
||||
echo ' echo -n "${G}All tests passed"'
|
||||
echo 'else'
|
||||
echo ' echo -n "${R}Some tests failed"'
|
||||
echo 'fi'
|
||||
echo 'echo $CLR'
|
||||
|
||||
|
|
|
@ -1,15 +1,41 @@
|
|||
# $Id$
|
||||
# Format:
|
||||
# test input [input ...] : expected_result
|
||||
#
|
||||
# >< as expected result means the operation will fail
|
||||
|
||||
####################
|
||||
#################### get_interval() tests
|
||||
####################
|
||||
|
||||
get_interval 1h : 3600
|
||||
get_interval 1h1m : 3660
|
||||
get_interval 1h1m1 : 3661
|
||||
get_interval 1h1m1s : 3661
|
||||
get_interval 100 : 100
|
||||
|
||||
# Leading 0's
|
||||
get_interval 010 : 10
|
||||
get_interval 01h0m01m01s : 3661
|
||||
|
||||
# Case insensitive
|
||||
get_interval 1H1M1S1s : 3662
|
||||
|
||||
# Reverse order of mangnitudes
|
||||
get_interval 1s1m1h : 3661
|
||||
|
||||
get_interval 1.22 : 1.22
|
||||
get_interval 1s.22 : 1.22
|
||||
get_interval .11.11.11 : 0.33
|
||||
get_interval 1s.11.11 : 1.22
|
||||
|
||||
# Rejected inputs
|
||||
get_interval s : ><
|
||||
get_interval .11s : ><
|
||||
get_interval 1ss : ><
|
||||
|
||||
# Repeated units
|
||||
get_interval 1s1s1s1s : 4
|
||||
get_interval 1m1m1m1m : 240
|
||||
get_interval 1h1h1h1h : 14400
|
||||
|
||||
|
||||
|
|
|
@ -21,12 +21,26 @@ function unittest {
|
|||
args=$(cut -d' ' -f2- <<<"$a" | sed 's/:.*$//' | sed 's/ *$//')
|
||||
expected=$(cut -d' ' -f2- <<<"$a" | sed 's/.*://')
|
||||
echo "$fn($args) -> $expected" >&2
|
||||
ret=$($fn $args)
|
||||
RET=$[ $RET + $?]
|
||||
if [[ $ret != $expected ]] && ! fptest "$ret" ~ "$expected" ; then
|
||||
echo -n "${R}FAILED => $ret != '$expected'"
|
||||
res=$($fn $args)
|
||||
ret=$?
|
||||
passed=
|
||||
if [[ $expected == '><' ]]; then # Expected to fail
|
||||
if [[ $ret != 0 ]]; then
|
||||
passed=1
|
||||
else
|
||||
passed=0
|
||||
fi
|
||||
elif [[ $res != $expected ]] && ( [[ $res ]] && ! fptest "$res" ~ "$expected" ) ; then
|
||||
passed=0
|
||||
else
|
||||
echo -n "${G}PASSED => $ret ~= $expected"
|
||||
passed=1
|
||||
fi
|
||||
|
||||
if [[ $passed -ne 1 ]]; then
|
||||
echo -n "${R}FAILED => $res != '$expected'"
|
||||
let 'RET++'
|
||||
else
|
||||
echo -n "${G}PASSED => $res ~= $expected"
|
||||
fi
|
||||
echo $CLR
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue