* MPlayer function
@ 2002-02-03 18:04 Bruno Bonfils
2002-02-03 18:38 ` Peter Stephenson
0 siblings, 1 reply; 2+ messages in thread
From: Bruno Bonfils @ 2002-02-03 18:04 UTC (permalink / raw)
To: zsh-workers
[-- Attachment #1.1: Type: text/plain, Size: 416 bytes --]
Hi all,
this is new version of my mplayer's completion function. Support at
least 0.50, 0.60 and CVS Version. I use cache for stock drivers and
codes list.
I need to add the completion for the skins but i don't use the GUI..
comments about _mplayer are welcome
PS : i'm looking for the way to do a periodic rehash.. it's possible ?
Thank you very much.
--
Bruno Bonfils
Admin Sys GNU/Linux
[-- Attachment #1.2: _mplayer --]
[-- Type: text/plain, Size: 6601 bytes --]
#compdef mplayer
#
# MPlayer Zsh function
#
# Feb 2002, Bruno Bonfils <asyd@zshfr.org>
#
# thanks to #zsh@irc.openprojects.net (specially Clint)
#
_audio-codec-list ()
{
if ( [[ ${+_mplayer_audio_codec} -eq 0 ]] ||
_cache_invalid MPlayer_ac ) &&
! _retrieve_cache MPlayer_ac; then
local buffer version
buffer=(${(@f)"$(mplayer -ac help)"})
version=buffer[1]
if [[ "$version" = *\0.50* ]]; then
_mplayer_audio_codec=(${buffer[3,-1]%% *})
else
_mplayer_audio_codec=(${buffer[9,-1]%% *})
fi
_store_cache MPlayer_ac _mplayer_audio_codec
fi
_wanted audio-codec expl 'audio-codec' compadd $_mplayer_audio_codec
}
_audio-driver-list ()
{
if ( [[ ${+_mplayer_audio_driver} -eq 0 ]] ||
_cache_invalid MPlayer_ao ) &&
! _retrieve_cache MPlayer_ao; then
local buffer version
buffer=(${(@f)"$(mplayer -ao help)"})
version=$buffer[1]
if [[ "$version" = *\0.50* ]]; then
_mplayer_audio_driver=(${${buffer[3,-1]/[[:blank:]]/}%%[[:blank:]]*})
else
_mplayer_audio_driver=(${${buffer[7,-1]/[[:blank:]]/}%%[[:blank:]]*})
fi
_store_cache MPlayer_ao _mplayer_audio_driver
fi
_wanted audio-driver expl 'audio-driver' compadd $_mplayer_audio_driver
}
_video-codec-list ()
{
if ( [[ ${+_mplayer_video_codec} -eq 0 ]] ||
_cache_invalid MPlayer_vc ) &&
! _retrieve_cache MPlayer_vc; then
local buffer version
buffer=(${(@f)"$(mplayer -vc help)"})
version=buffer[1]
if [[ "$version" = *\0.50* ]]; then
_mplayer_video_codec=(${buffer[3,-1]%% *})
else
_mplayer_video_codec=(${buffer[9,-1]%% *})
fi
_store_cache MPlayer_vc _mplayer_video_codec
fi
_wanted video-codec expl 'video-codec' compadd $_mplayer_video_codec
}
_video-driver-list ()
{
if ( [[ ${+_mplayer_video_driver} -eq 0 ]] ||
_cache_invalid MPlayer_vo ) &&
! _retrieve_cache MPlayer_vo; then
local buffer version
buffer=(${(@f)"$(mplayer -vo help)"})
version=$buffer[1]
if [[ "$version" = *\0.50* ]]; then
_mplayer_video_driver=(${${buffer[3,-1]/[[:blank:]]/}%%[[:blank:]]*})
else
_mplayer_video_driver=(${${buffer[7,-1]/[[:blank:]]/}%%[[:blank:]]*})
fi
_store_cache MPlayer_vo _mplayer_video_driver
fi
_wanted video-driver expl 'video-driver' compadd $_mplayer_video_driver
}
_arguments -C -s \
'-abs[sound card audio buffer size(in bytes, default: measuring)]:buffer size' \
'-ac[force usage of a specific audio codec]:audio-codec attachment:_audio-codec-list' \
'-afm[force usage of a specific audio codec family]:audio-codec-family:(1 2 3 4 5)' \
'-aid[select audio channel]:audio-channel' \
'-ao[audio driver]:audio-driver attachment:_audio-driver-list' \
'-aspect[set aspect ratio of movies]:ratio' \
'-benchmark[use with combination with -nosound and -vo null for benchmarking]' \
'-chapter[specify which chapter to start playing at]:chapter' \
'-config[specifies where to search for config files]' \
'-delay[audio delay in seconds (may be +/- float value)]:delay' \
'-display[specify the hostname and display number of the X server]:display attachment:_x_display' \
'-double[enable double buffering]' \
'-dumpaudio[writes audio stream of the file to ./stream.dump]' \
'-dvdkey[key to decrypt stream encoded with css]:key' \
'-dvd[tell MPlayer which movies to play]:titleid' \
'-fbmode[change videomode from /etc/fb.modes]:fbmode' \
'-fbmodeconfig[use config file instead /etc/fb.modes]:fbmodeconfig:_files' \
'-fb[specifies the framebuffer device to user]' \
'-ffactor[resample alphamap of the font]:factor:(0 0.75 1 10)' \
'-forceidx[force rebuilding of index]' \
'-forcexv[force using xvideo (sdl)]' \
'-fps[force frame rate (if value is wrong in the header)]:frame-rate' \
'-framedrop[enable slow dropping (for slow machine)]' \
'-framedrop[frame dropping]' \
'-frames[mplayer plays number frame, and quits]:frame-number' \
'-fs[fullscreen]' \
'-fsmode[fullscreen mode]:fs-mode:(0 1 2 3)' \
'-gui[start with the gui]' \
'-idx[rebuilds index of the avi]' \
'-include[specify config file to be parsed after the default]:config-file:_files' \
'-lircconf[specifies a configfile for lirc]:lirc-config-files attachment:_files' \
'-mc[maximun sync correction per 5 frames (in second)]:max-sync-correction' \
'-monitoraspect[set aspect ratio of your screen]:ratio' \
'-ni[force usage of non-interlaced avi parser]' \
'-nobps[do not use avg byte/sec value for A-V sync (AVI)]' \
'-nobps[use alternative A-V sync method for AVI files]' \
'-nodouble[disable double buffering (default)]' \
'-nodshow[disable usage of directshow video codecs]' \
'-noframedrop[no frame dropping]' \
'-nosound[no sound]' \
'-osdlevel[specifies which mode the osd should start]:osd-level:(0 1 2)' \
'-pp[apply postprocess filter]:filter attachment:_filter-list' \
'-quiet[display less output, status messages]' \
'-sb[seek to byte position]:byte' \
'-skin[skin directory]:skin directory:_path_files -/' \
'-srate[specifies Hz to playback audio on]:frequence' \
'-ss[seek to given time position (format hh:mm\[:ss\])]:position' \
'-steromode[select type of mpeg1 stereo output]:stereo-mode:(0 1 2)' \
'-subfps[specify frame/sec rate of subtitle file only]:rate' \
'-sub[use/display this subtitle file]:subtitle:_files' \
'-unicode[tells mplayer to handle the subtitle file as unicode]' \
'-utf8[tells mplayer to handle the subtitle file as utf8]' \
'-vcd[play video cd track]:track' \
'-vc[force usage of a specific video codec]:video-codec attachment:_video-codec-list' \
'-v[enable verbose output]' \
'-vfm[force usage of a specific video codec family]:video-codec-family:(1 2 3 4 5)' \
'-vid[select video channel]:video-channel' \
'-vm[use XF86VidMode extension for mode changing]' \
'-vo[video driver]:video-driver attachment:_video-driver-list' \
'-x[scale image to x width if driver supports]:width' \
'-xy[scale image by factor if driver supports]:factor' \
'-y[scale image to y height if driver supports]:height' \
'-zoom[use software scaling, where available (use with -nofs)]' \
'-z[specify compression level for png output]:compression-level:(0 1 2 3 4 5 6 7 8)' \
'*:video file:_files -g \*\.\(\#i\)\(mpg\|avi\|mpeg\|mov\|asf\|vob\|mjpg\)' \
&& return 0
return 1
[-- Attachment #2: Type: application/pgp-signature, Size: 249 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: MPlayer function
2002-02-03 18:04 MPlayer function Bruno Bonfils
@ 2002-02-03 18:38 ` Peter Stephenson
0 siblings, 0 replies; 2+ messages in thread
From: Peter Stephenson @ 2002-02-03 18:38 UTC (permalink / raw)
To: Zsh hackers list
Bruno Bonfils wrote:
> PS : i'm looking for the way to do a periodic rehash.. it's possible ?
would you believe
periodic() { rehash; }
? You need to pick a period in seconds.
PERIOD=60
It will only run before a prompt, but that's when you need it.
--
Peter Stephenson <pws@pwstephenson.fsnet.co.uk>
Work: pws@csr.com
Web: http://www.pwstephenson.fsnet.co.uk
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-02-03 18:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-02-03 18:04 MPlayer function Bruno Bonfils
2002-02-03 18:38 ` Peter Stephenson
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).