haiku/data/etc/bash_completion.d/mplayer
Brecht Machiels 4a135b33b7 * upgraded bash_completion to v1.3
* upgraded to subversion bash completion script shipped with subversion 1.6.17
* added git bash completion script shipped with git 1.7.5.4
* readded bash completion to the image

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42257 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-06-19 21:19:36 +00:00

270 lines
10 KiB
Bash

# mplayer(1) completion
have mplayer && {
_mplayer_options_list()
{
cur=${cur%\\}
COMPREPLY=( $( compgen -W "$( $1 -nomsgcolor -nomsgmodule $2 help 2>/dev/null | \
sed -e '/^Available/,/^$/!d' -e '/^Available/d' | awk '{print $1}' | \
sed -e 's/:$//' -e 's/^'${2#-}'$//' -e 's/<.*//' )" -- "$cur" ) )
}
_mplayer()
{
local cmd cur prev i j k=0
COMPREPLY=()
cmd=${COMP_WORDS[0]}
_get_comp_words_by_ref cur prev
case $prev in
-[av][cfo]|-[av]fm|-vop|-fstype|-demuxer|-o[av]c|-of|-profile| \
-audio-demuxer|-sub-demuxer)
_mplayer_options_list $cmd $prev
return 0
;;
-show-profile)
_mplayer_options_list $cmd -profile
return 0
;;
-audiofile)
_filedir '@(mp3|mpg|ogg|w?(a)v|mid|flac|mka|ape)'
return 0
;;
-font|-subfont)
if [ "$prev" = -font ]; then
_filedir '@(desc|ttf)'
else
_filedir ttf
fi
local IFS=$'\n'
COMPREPLY=( "${COMPREPLY[@]}"
$( compgen -W '$( fc-list 2>/dev/null )' -- "$cur" ) )
return 0
;;
-sub)
_filedir '@(srt|sub|txt|utf|rar|mpsub|smi|js|ssa|ass)'
return 0
;;
-vobsub)
_filedir '@(idx|ifo|sub)'
local IFS=$'\n'
COMPREPLY=( $( for i in "${COMPREPLY[@]}"; do
if [[ -f $i && -r $i ]]; then
printf '%s\n' ${i%.*}
else
printf '%s\n' $i
fi
done ) )
return 0
;;
-ifo)
_filedir ifo
return 0
;;
-cuefile)
_filedir '@(bin|cue)'
return 0
;;
-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 [ -n "$MPLAYER_SKINS_DIR" ]; then
dirs=($MPLAYER_SKINS_DIR)
else
dirs=(/usr/share/mplayer/skins /usr/local/share/mplayer/skins)
fi
local IFS=$'\n'
for i in ~/.mplayer/skins ${dirs[@]}; do
if [[ -d $i && -r $i ]]; then
for j in $( compgen -d $i/$cur ); do
COMPREPLY[$k]=${j#$i/}
k=$((++k))
done
fi
done
return 0
;;
-cdrom-device)
_cd_devices
_dvd_devices
return 0
;;
-dvd-device)
_filedir
return 0
;;
-mixer|-dvdauth|-fb|-zrdev)
cur=${cur:=/dev/}
_filedir
return 0
;;
-edl|-edlout|-lircconf|-menu-cfg|-playlist|-csslib|-dumpfile| \
-subfile|-vobsub|-aofile|-fbmodeconfig|-include|-o|-dvdkey| \
-passlogfile)
_filedir
return 0
;;
-autoq|-autosync|-loop|-menu-root|-speed|-sstep|-aid|-alang| \
-bandwidth|-cache|-chapter| \
-dvd|-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| \
-monitoraspect|-monitor-dotclock|-monitor-[hv]freq|-panscan| \
-saturation|-xineramascreen|-zrcrop|-zrnorm|-zrquality| \
-zr[xy]doff|-zr[vh]dec|-aspect|-pp|-x|-y|-xy|-z|-stereo| \
-audio-density|-audio-delay|-audio-preload|-endpos|-osdlevel| \
-ffourcc|-sws|-channels|-skiplimit|-format|-ofps|-aadriver| \
-aaosdcolor|-aasubcolor|-vobsubout|-vobsuboutid|-vobsuboutindex| \
-sub-bg-alpha|-sub-bg-color|-sub-cp|-sub-delay|-sub-fps|-sub-pos| \
-sub-align|-sub-width|-subfont-blur|-subfont-outline| \
-subfont-autoscale|-subfont-encoding|-subfont-osd-scale| \
-subfont-osd-text)
return 0
;;
-lavdopts)
COMPREPLY=( $( compgen -W 'bitexact bug= debug= ec= er= fast gray idct= lowres= sb= st= skiploopfilter= skipidct= skipframe= threads= vismv= vstats' -- "$cur" ) )
return 0
;;
-lavcopts)
COMPREPLY=( $( 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' -- "$cur" ) )
return 0
;;
-ssf)
COMPREPLY=( $( compgen -W 'lgb= cgb= ls= cs= chs= cvs=' \
-- "$cur" ) )
return 0
;;
-jpeg)
COMPREPLY=( $( compgen -W 'noprogressive progressive nobaseline \
baseline optimize= smooth= quality= outdir=' -- "$cur" ) )
return 0
;;
-xvidopts)
COMPREPLY=( $( compgen -W 'dr2 nodr2' -- "$cur" ) )
return 0
;;
-xvidencopts)
COMPREPLY=( $( 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=' -- "$cur" ) )
return 0
;;
-divx4opts)
COMPREPLY=( $( compgen -W 'br= key= deinterlace q= min_quant= \
max_quant= rc_period= rc_reaction_period= crispness= \
rc_reaction_ratio= pass= vbrpass= help' -- "$cur" ) )
return 0
;;
-info)
COMPREPLY=( $( compgen -W 'name= artist= genre= subject= \
copyright= srcform= comment= help' -- "$cur" ) )
return 0
;;
-lameopts)
COMPREPLY=( $( compgen -W 'vbr= abr cbr br= q= aq= ratio= vol= \
mode= padding= fast preset= help' -- "$cur" ) )
return 0
;;
-rawaudio)
COMPREPLY=( $( compgen -W 'on channels= rate= samplesize= format=' \
-- "$cur" ) )
return 0
;;
-rawvideo)
COMPREPLY=( $( compgen -W 'on fps= sqcif qcif cif 4cif pal ntsc w= \
h= y420 yv12 yuy2 y8 format= size=' -- "$cur" ) )
return 0
;;
-aop)
COMPREPLY=( $( compgen -W 'list= delay= format= fout= volume= mul= \
softclip' -- "$cur" ) )
return 0
;;
-dxr2)
COMPREPLY=( $( 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' -- "$cur" ))
return 0
;;
-tv)
COMPREPLY=( $( 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=' \
-- "$cur" ) )
return 0
;;
-mf)
COMPREPLY=( $( compgen -W 'on w= h= fps= type=' -- "$cur" ) )
return 0
;;
-cdda)
COMPREPLY=( $( compgen -W 'speed= paranoia= generic-dev= \
sector-size= overlap= toc-bias toc-offset= skip noskip' \
-- "$cur" ) )
return 0
;;
-input)
COMPREPLY=( $( compgen -W 'conf= ar-delay ar-rate keylist cmdlist \
js-dev file' -- "$cur" ) )
return 0
;;
-af)
COMPREPLY=( $( compgen -W 'resample resample= channels channels= \
format format= volume volume= delay delay= pan pan= sub sub= \
surround surround=' -- "$cur" ) )
return 0
;;
-af-adv)
COMPREPLY=( $( compgen -W 'force= list=' -- "$cur" ) )
return 0
;;
-noconfig)
COMPREPLY=( $( compgen -W 'all gui system user' -- "$cur" ) )
return 0
;;
esac
case $cur in
-*)
COMPREPLY=( $( compgen -W '$( $cmd -nomsgcolor -nomsgmodule -list-options 2>/dev/null | \
sed -ne '1,/^[[:space:]]*Name/d' \
-e "s/^[[:space:]]*/-/" -e "s/[[:space:]:].*//" \
-e "/^-\(Total\|.*\*\)\{0,1\}$/!p" )' -- "$cur" ) )
;;
*)
_filedir '@(mp?(e)g|MP?(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]|m4[av]|M4[AV]|og[gmavx]|OG[GMAVX]|w?(a)v|W?(A)V|dump|DUMP|mk[av]|MK[AV]|m4a|M4A|aac|AAC|m[24]v|M[24]V|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)|vdr|VDR|xvid|XVID|ape|APE|gif|GIF|nut|NUT|bik|BIK|webm|WEBM|amr|AMR|awb|AWB|iso|ISO)?(.part)'
;;
esac
return 0
}
complete -F _mplayer mplayer mencoder gmplayer kplayer
}
# Local variables:
# mode: shell-script
# sh-basic-offset: 4
# sh-indent-comment: t
# indent-tabs-mode: nil
# End:
# ex: ts=4 sw=4 et filetype=sh