3 #=======================================================================
5 # File ID: 3623557a-fa66-11dd-83e3-000475e441b9
7 # Play a media file in mpv
9 # Author: Øyvind A. Holm <sunny@sunbase.org>
10 # License: GNU General Public License version 2 or later.
11 #=======================================================================
31 " -n "$progname" -- "$@
")"
32 test "$?" = "0" ||
exit 1
43 -a|
--amplify) opt_amplify
=$2; shift 2 ;;
44 -h|
--help) opt_help
=1; shift ;;
45 -q|
--quiet) opt_quiet
=$
(($opt_quiet + 1)); shift ;;
46 -s|
--slow) opt_slow
=1; shift ;;
47 -t|
--tempo) opt_tempo
=$2; shift 2 ;;
48 -v|
--verbose) opt_verbose
=$
(($opt_verbose + 1)); shift ;;
49 --version) echo $progname $VERSION; exit 0 ;;
51 *) echo $progname: Internal error
>&2; exit 1 ;;
54 opt_verbose
=$
(($opt_verbose - $opt_quiet))
56 if test "$opt_help" = "1"; then
57 test $opt_verbose -gt 0 && { echo; echo $progname $VERSION; }
60 Play a media file in mpv.
62 Usage: $progname [options] file [files [...]]
67 Amplify sound with X dB. 10 is a nice value to start with.
71 Be more quiet. Can be repeated to increase silence.
73 Use less resources when playing movie files.
74 -t TEMPO, --tempo TEMPO
75 Play audio with tempo TEMPO without changing the pitch.
76 FIXME: Make it work with video too.
78 Increase level of verbosity. Can be repeated.
80 Print version information.
86 sess_str
="sess -d p -t c_p --"
87 test "$HISTFILE" = "/dev/null" && unset sess_str
90 pgrep jackd
&& ao_str
=" -ao jack"
91 if test -n "$opt_amplify"; then
92 echo "$opt_amplify" |
grep -q -E '^[0-9]+$' ||
{
93 # Well, mplayer also understands floats, but it's easier to
94 # just check for [0-9].
95 echo $progname: -a needs an integer argument
>&2
98 amplify_str
=" --af=volume=$opt_amplify"
100 test "$opt_slow" = "1" && slow
=" -lavdopts fast:skiploopfilter=all"
101 if test -n "$opt_tempo"; then
102 tempo_str
=" --af=scaletempo=scale=$opt_tempo"
106 test -e /dg-vbox.mrk
&& vo_str
=" -vo x11 -zoom"
107 $sess_str mpv
-fs --no-audio-display \
108 $tempo_str$slow$vo_str$ao_str$amplify_str "$@"