Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

MPlayer completion fonction



hi,

i submit you the first completion function for mplayer.

i don't know how to use pattern matching in order to take only
driver of a mplayer -vo help. (how to suppress the first line ?)
if you have an idea...

++

-- 
 Bruno Bonfils
 Admin Sys GNU/Linux

 http://www.oxianet.com
#compdef mplayer

#
# MPlayer Zsh function
#
# Dec 2001, Bruno Bonfils <asyd@xxxxxxxxx>
#

_audio-codec-list ()
{
    local list
    list=(${$(mplayer -ac help | sed '1,7d' | more | awk '{ print $1 }\' )})
    _wanted audio-codec expl 'audio-codec require' compadd $list
}

_video-codec-list ()
{
    local list
    list=(${$(mplayer -vc help | sed '1,7d' | more | awk '{ print $1 }\' )})
    _wanted video-codec expl 'video-codec require' compadd $list
}

_video-driver-list ()
{
    local list
    list=(${$(mplayer -vo help | sed '1,5d' | cut -f 2)})
    _wanted video-driver expl 'video-driver require' compadd $list
}

_audio-driver-list ()
{
    local list
    list=(${$(mplayer -ao help | sed '1,5d' | cut -f 2)})
    _wanted audio-driver expl 'audio-driver require' compadd $list
}

_arguments -C -s \
    '-framedrop[enable slow dropping (for slow machine)]' \
    '-nobps[use alternative A-V sync method for AVI files]' \
    '-fs[fullscreen]' \
    '-gui[start with the gui]' \
    '-nosound[no sound]' \
    '-dvd[tell MPlayer which movies to play]:titleid' \
    '-chapter[specify which chapter to start playing at]:chapter' \
    '-vo[video driver]:video-driver attachment:_video-driver-list' \
    '-ao[audio driver]:audio-driver attachment:_audio-driver-list' \
    '-vcd[play video cd track]:track' \
    '-vm[use XF86VidMode extension for mode changing]' \
    '-zoom[use software scaling, where available (use with -nofs)]' \
    '-x[scale image to x width if driver supports]:width' \
    '-y[scale image to y height if driver supports]:height' \
    '-xy[scale image by factor if driver supports]:factor' \
    '-pp[apply postprocess filter]:filter attachment:_filter-list' \
    '-ffactor[resample alphmap of the font]:factor:(0 0.75 1 10)' \
    '-sub[use/display this subtitle file]:subtitle:_files' \
    '-subfps[specify frame/sec rate of subtitle file only]:rate' \
    '-osdlevel[specifies which mode the osd should start]:osd-level:(0 1 2)' \
    '-lircconf[specifies a configfile for lirc]:lirc-config-files attachment:_files' \
    '-v[enable verbose output]' \
    '-quiet[display less output, status messages]' \
    '-benchmark[use with combination with -nosound and -vo null for benchmarking]' \
    '-skin[skin directory]:skin directory:_path_files -/' \
    '-aspect[set aspect ratio of movies]:ratio' \
    '-monitoraspect[set aspect ratio of your screen]:ratio' \
    '-vc[force usage of a specific video codec]:video-codec attachment:_video-codec-list' \
    '-ac[force usage of a specific audio codec]:audio-codec attachment:_audio-codec-list' \
    '-vfm[force usage of a specific video codec family]:video-codec-family:(1 2 3 4 5)' \
    '-afm[force usage of a specific audio codec family]:audio-codec-family:(1 2 3 4 5)' \
    '-sb[seek to byte position]:byte' \
    '-ss[seek to given time position (format hh:mm\[:ss\])]:position' \
    '-abs[sound carte audio buffer size(in bytes, default: measuring)]' \
    '-delay[audio delay in seconds (may be +/- float value)]:delay' \
    '-nobps[do not use avg byte/sec value for A-V sync (AVI)]' \
    '-aid[select audio channel]:audio-channel' \
    '-vid[select video channel]:video-channel' \
    '-fps[force frame rate (if value is wrong in the header)]:frame-rate' \
    '-mc[maximun sync correction per 5 frames (in second)]:max-sync-correction' \
    '-ni[force usage of non-interlaced avi parser]' \
    '-include[specify config file to be parsed after the default]:config-file:_files' \
    '-z[specify compression level for png output]:compression-level:(0 1 2 3 4 5 6 7 8)' \
    '-idx[rebuilds index of the avi]' \
    '-forceidx[force rebuilding of index]' \
    '-nodshow[disable usage of directshow video codecs]' \
    '-forcexv[force using xvideo (sdl)]' \
    '-dumpaudio[writes audio stream of the file to ./stream.dump]' \
    '-noframedrop[no frame dropping]' \
    '-framedrop[frame dropping]' \
    '-nodouble[disable double buffering (default)]' \
    '-double[enable double buffering]' \
    '-dvdkey[key to decrypt stream encoded with css]:key' \
    '-steromode[select type of mpeg1 stereo output]:stereo-mode:(0 1 2)' \
    '-srate[specifies Hz to playback audio on]:frequence' \
    '-config[specifies where to search for config files]' \
    '-display[specify the hostname and display number of the X server]:x-display' \
    '-unicode[tells mplayer to handle the subtitle file as unicode]' \
    '-utf8[tells mplayer to handle the subtitle file as utf8]' \
    '-fsmode[fullscreen mode]:fs-mode:(0 1 2 3)' \
    '-frames[mplayer plays number frame, and quits]:frame-number' \
    '-fb[specifies the framebuffer device to user]' \
    '-fbmode[change videomode from /etc/fb.modes]:fbmode' \
    '-fbmodeconfig[use config file instead /etc/fb.modes]:fbmodeconfig:_files' \
    '*:video file:_files -g \*.\(\#i\)avi \*.\(\#i\)mpeg \*.\(\#i\)mpg \*.\(\#i\)mov \*.\(\#i\)asf \*.\(\#i\)vob \*.\(\#i\)mjpg' \
    && return 0

return 1

Attachment: pgp3gtpQECrC6.pgp
Description: PGP signature



Messages sorted by: Reverse Date, Date, Thread, Author