blob: 7ab096a7471f812c61af50297ffd3a1e806077f6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
|
# mplayer(1) completion -*- shell-script -*-
_comp_cmd_mplayer__options()
{
cur=${cur%\\}
_comp_compgen_split -- "$("$1" -noconfig all "$2" help 2>/dev/null |
command sed -e '/^Available/,/^$/!d' -e '/^Available/d' | _comp_awk '{print $1}' |
command sed -e 's/:$//' -e 's/^'"${2#-}"'$//' -e 's/<.*//')"
}
_comp_cmd_mplayer()
{
local cur prev words cword comp_args
_comp_initialize -n : -- "$@" || return
local cmd=${words[0]} i j k=0
case $prev in
-[av][cfo] | -[av]fm | -vop | -fstype | -demuxer | -o[av]c | -of | -profile | \
-audio-demuxer | -sub-demuxer)
_comp_cmd_mplayer__options "$cmd" "$prev"
return
;;
-show-profile)
_comp_cmd_mplayer__options "$cmd" -profile
return
;;
-audiofile | -audio-file)
_comp_compgen_filedir '@(mp3|mpg|og[ag]|w?(a)v|mid|flac|mka|ac3|ape)'
return
;;
-font | -subfont)
if [[ $prev == -font ]]; then
_comp_compgen_filedir '@(desc|ttf)'
else
_comp_compgen_filedir ttf
fi
_comp_compgen -a split -l -- "$(fc-list 2>/dev/null)"
return
;;
-sub | -sub-file)
_comp_compgen_filedir '@(srt|sub|txt|utf|rar|mpsub|smi|js|ssa|ass)'
return
;;
-vobsub)
if _comp_compgen_filedir '@(idx|ifo|sub)'; then
for i in "${!COMPREPLY[@]}"; do
if [[ -f ${COMPREPLY[i]} && -r ${COMPREPLY[i]} ]]; then
COMPREPLY[i]=${COMPREPLY[i]%.*}
fi
done
fi
return
;;
-subcp | -msgcharset)
local cp
if _comp_split cp "$(iconv --list 2>/dev/null | command sed -e "s@//@@;" 2>/dev/null)"; then
if [[ $cur == "${cur,,}" ]]; then
_comp_compgen -- -W '"${cp[@],,}"'
else
_comp_compgen -- -W '"${cp[@]^^}"'
fi
fi
return
;;
-ifo)
_comp_compgen_filedir ifo
return
;;
-cuefile)
_comp_compgen_filedir '@(bin|cue)'
return
;;
-skin)
# if you don't have installed mplayer in /usr you
# may want to set the MPLAYER_SKINS_DIR global variable
local -a dirs
if [[ $MPLAYER_SKINS_DIR ]]; then
_comp_split dirs "$MPLAYER_SKINS_DIR"
else
dirs=(/usr/share/mplayer/skins /usr/local/share/mplayer/skins)
fi
if ((${#dirs[@]})); then
local -a subdirs
for i in ~/.mplayer/skins "${dirs[@]}"; do
if [[ -d $i && -r $i ]]; then
_comp_compgen -v subdirs -c "$i/$cur" -- -d
for j in "${subdirs[@]}"; do
COMPREPLY[k++]=${j#"$i/"}
done
fi
done
fi
return
;;
-cdrom-device)
_comp_compgen_cd_devices
_comp_compgen -a dvd_devices
return
;;
-dvd-device)
_comp_compgen_dvd_devices
_comp_compgen -a filedir iso
return
;;
-bluray-device)
_comp_compgen_filedir -d
return
;;
-mixer | -dvdauth | -fb | -zrdev)
_comp_compgen -c "${cur:-/dev/}" filedir
return
;;
-edl | -edlout | -lircconf | -menu-cfg | -playlist | -csslib | -dumpfile | \
-subfile | -aofile | -fbmodeconfig | -include | -o | -dvdkey | -passlogfile)
_comp_compgen_filedir
return
;;
-autoq | -autosync | -loop | -menu-root | -speed | -sstep | -aid | -alang | \
-bandwidth | -bluray-angle | -bluray-chapter | -cache | -chapter | -dvd-speed | \
-dvdangle | -fps | -frames | -mc | -passwd | -user | -sb | -srate | -ss | -vcd | \
-vi | -vid | -vivo | -ffactor | -sid | -slang | -spualign | -spuaa | -spugauss | \
-vobsubid | -delay | -bpp | -brightness | -contrast | -dfbopts | -display | \
-fbmode | -geometry | -guiwid | -hue | -icelayer | -screen[wh] | -wid | \
-monitor-dotclock | -monitor-[hv]freq | -panscan | \
-saturation | -xineramascreen | -zrcrop | -zrnorm | -zrquality | \
-zr[xy]doff | -zr[vh]dec | -pp | -x | -y | -xy | -z | -stereo | \
-audio-density | -audio-delay | -audio-preload | -endpos | -osdlevel | \
-ffourcc | -sws | -skiplimit | -format | -ofps | -aadriver | \
-aaosdcolor | -aasubcolor | -vobsubout | -vobsuboutid | -vobsuboutindex | \
-sub-bg-alpha | -sub-bg-color | -subdelay | -subfps | -subpos | \
-subalign | -subwidth | -subfont-blur | -subfont-outline | \
-subfont-autoscale | -subfont-encoding | -subfont-osd-scale | \
-subfont-text-scale)
return
;;
-channels)
_comp_compgen -- -W '2 4 6 8'
return
;;
-aspect | -monitoraspect)
_comp_compgen -- -W '1:1 3:2 4:3 5:4 14:9 14:10 16:9 16:10 2.35:1'
_comp_ltrim_colon_completions "$cur"
return
;;
-lavdopts)
_comp_compgen -- -W 'bitexact bug= debug= ec= er= fast gray idct=
lowres= sb= st= skiploopfilter= skipidct= skipframe= threads=
vismv= vstats'
return
;;
-lavcopts)
_comp_compgen -- -W 'vcodec= vqmin= vqscale= vqmax= mbqmin= mbqmax=
vqdiff= vmax_b_frames= vme= vhq v4mv keyint= vb_strategy=
vpass= aspect= vbitrate= vratetol= vrc_maxrate= vrc_minrate=
vrc_buf_size= vb_qfactor= vi_qfactor= vb_qoffset= vi_qoffset=
vqblur= vqcomp= vrc_eq= vrc_override= vrc_init_cplx= vqsquish=
vlelim= vcelim= vstrict= vdpart vpsize= gray vfdct= idct=
lumi_mask= dark_mask= tcplx_mask= scplx_mask= naq ildct format=
pred qpel precmp= cmp= subcmp= predia= dia= trell last_pred=
preme= subq= psnr mpeg_quant aic umv'
return
;;
-ssf)
_comp_compgen -- -W 'lgb= cgb= ls= cs= chs= cvs='
return
;;
-jpeg)
_comp_compgen -- -W 'noprogressive progressive nobaseline baseline
optimize= smooth= quality= outdir='
return
;;
-xvidopts)
_comp_compgen -- -W 'dr2 nodr2'
return
;;
-xvidencopts)
_comp_compgen -- -W 'pass= bitrate= fixed_quant= me_quality= 4mv
rc_reaction_delay_factor= rc_averaging_period= rc_buffer=
quant_range= min_key_interval= max_key_interval= mpeg_quant
mod_quant lumi_mask hintedme hintfile debug keyframe_boost=
kfthreshold= kfreduction='
return
;;
-divx4opts)
_comp_compgen -- -W 'br= key= deinterlace q= min_quant= max_quant=
rc_period= rc_reaction_period= crispness= rc_reaction_ratio=
pass= vbrpass= help'
return
;;
-info)
_comp_compgen -- -W 'name= artist= genre= subject= copyright=
srcform= comment= help'
return
;;
-lameopts)
_comp_compgen -- -W 'vbr= abr cbr br= q= aq= ratio= vol= mode=
padding= fast preset= help'
return
;;
-rawaudio)
_comp_compgen -- -W 'on channels= rate= samplesize= format='
return
;;
-rawvideo)
_comp_compgen -- -W 'on fps= sqcif qcif cif 4cif pal ntsc w= h=
y420 yv12 yuy2 y8 format= size='
return
;;
-aop)
_comp_compgen -- -W 'list= delay= format= fout= volume= mul=
softclip'
return
;;
-dxr2)
_comp_compgen -- -W 'ar-mode= iec958-encoded iec958-decoded mute
ucode= 75ire bw color interlaced macrovision= norm=
square-pixel ccir601-pixel cr-left= cr-right= cr-top= cr-bot=
ck-rmin= ck-gmin= ck-bmin= ck-rmax= ck-gmax= ck-bmax= ck-r=
ck-g= ck-b= ignore-cache= ol-osd= olh-cor= olw-cor= olx-cor=
oly-cor= overlay overlay-ratio= update-cache'
return
;;
-tv)
_comp_compgen -- -W 'on noaudio driver= device= input= freq=
outfmt= width= height= buffersize= norm= channel= chanlist=
audiorate= forceaudio alsa amode= forcechan= adevice= audioid=
volume= bass= treble= balance= fps= channels= immediatemode='
return
;;
-mf)
_comp_compgen -- -W 'on w= h= fps= type='
return
;;
-cdda)
_comp_compgen -- -W 'speed= paranoia= generic-dev= sector-size=
overlap= toc-bias toc-offset= skip noskip'
return
;;
-input)
_comp_compgen -- -W 'conf= ar-delay ar-rate keylist cmdlist js-dev
file'
return
;;
-af-adv)
_comp_compgen -- -W 'force= list='
return
;;
-noconfig)
_comp_compgen -- -W 'all gui system user'
return
;;
-*)
# Assume arg is required for everything else except options
# for which -list-options says Type is Flag or Print.
$cmd -noconfig all -list-options 2>/dev/null |
while read -r i j k; do
if [[ $i == "${prev#-}" ]]; then
[[ ${j,,} != @(flag|print) ]] && return 1
break
fi
done || return
;;
esac
case $cur in
-*)
_comp_compgen_split -- "$("$cmd" -noconfig all -list-options 2>/dev/null |
command sed -ne "1,/^[[:space:]]*Name/d" \
-e "s/^[[:space:]]*/-/" -e "s/[[:space:]:].*//" \
-e "/^-\(Total\|.*\*\)\{0,1\}$/!p")"
;;
*)
_comp_compgen_filedir '@(m?(j)p?(e)g|M?(J)P?(E)G|wm[av]|WM[AV]|avi|AVI|asf|ASF|vob|VOB|bin|BIN|dat|DAT|vcd|VCD|ps|PS|pes|PES|fl[iv]|FL[IV]|fxm|FXM|viv|VIV|rm?(j)|RM?(J)|ra?(m)|RA?(M)|yuv|YUV|mov|MOV|qt|QT|mp[234]|MP[234]|m?(p)4[av]|M?(P)4[AV]|og[gmavx]|OG[GMAVX]|w?(a)v|W?(A)V|dump|DUMP|mk[av]|MK[AV]|aac|AAC|m2v|M2V|dv|DV|rmvb|RMVB|mid|MID|t[ps]|T[PS]|3g[p2]|3gpp?(2)|mpc|MPC|flac|FLAC|vro|VRO|divx|DIVX|aif?(f)|AIF?(F)|m2t?(s)|M2T?(S)|mts|MTS|vdr|VDR|xvid|XVID|ape|APE|gif|GIF|nut|NUT|bik|BIK|web[am]|WEB[AM]|amr|AMR|awb|AWB|iso|ISO|opus|OPUS|m[eo]d|M[EO]D|xm|XM|it|IT|s[t3]m|S[T3]M|mtm|MTM|w64|W64)?(.@(crdownload|part))'
;;
esac
} &&
complete -F _comp_cmd_mplayer mplayer mplayer2 mencoder gmplayer kplayer
# ex: filetype=sh
|