#!/usr/local/bin/wish -f set mpeg2play_command /usr/local/bin/mpeg2play # configure the two lines above to hold the paths to wish and mpeg2play ################################################################################ # Tk/Tcl wrapper for mpeg2play to make it realistically usable as an mpeg_play # replacement for WWW browsers. # Written by David S. Blumenthal, jugit@skyjuggler.com, 2/23/95 # Inspired by and based loosely on xmpeg: # Written by Alexei Rodriguez (alexei@cis.ufl.edu) and # Bradley C. Spatz (bcs@cis.ufl.edu). 10oct93 # This is my first contact with Tk/Tcl, so please excuse (and tell me about) # any errors or stylistic faux pas. ################################################################################ # variables set mpeg_file [lindex $argv 0] set verbose_level 0 set output_format 0 set loop 0 set quiet 0 set frame_rate 30 ################################################################################ # tiling frames (not really needed but I was experimenting with the packer) frame .top frame .bottom ################################################################################ # mpeg file name and action buttons frame .top.actions frame .top.actions.title -relief sunken -borderwidth 2 label .top.actions.title.label -text $mpeg_file pack .top.actions.title.label pack .top.actions.title -side top -pady 4 button .top.actions.play -text "Play" -command play_mpeg button .top.actions.quit -text "Quit" -command {destroy .} pack .top.actions.play .top.actions.quit -side left -expand yes -pady 5 ################################################################################ # display settings frame .top.display -relief raised -borderwidth 2 label .top.display.label -text "Display Settings" frame .top.display.loop checkbutton .top.display.loop.iloop -text "Loop" -variable loop pack .top.display.loop.iloop -side left -padx 10 -fill both frame .top.display.noX checkbutton .top.display.noX.inoX -text "Suppress X Display" \ -variable output_format pack .top.display.noX.inoX -side left -padx 10 -fill both pack .top.display.label -side top -expand yes pack .top.display.loop -side top -pady 2 -fill x pack .top.display.noX -side top -pady 2 -fill x ################################################################################ # frame rate frame .bottom.fr -relief raised -borderwidth 2 label .bottom.fr.label -text "Max. Frames Per Second" scale .bottom.fr.framerate -command {set frame_rate} \ -from 0 -to 90 -length 200 -tickinterval 15 \ -label "(0 = no limit)" -orient horizontal pack .bottom.fr.label .bottom.fr.framerate -side top -expand yes ################################################################################ # output settings frame .bottom.output -relief raised -borderwidth 2 label .bottom.output.label -text "Output Settings" frame .bottom.output.quiet checkbutton .bottom.output.quiet.iquiet -text "Suppress Error Messages" \ -variable quiet pack .bottom.output.quiet.iquiet -side left -padx 10 -fill both scale .bottom.output.verbose -command {set verbose_level} \ -from 0 -to 10 -length 200 -tickinterval 1 \ -label "Output Verbosity" -orient horizontal pack .bottom.output.label .bottom.output.quiet .bottom.output.verbose \ -side top -expand yes ################################################################################ # main window pack .top.actions -side top -fill both pack .top.display -side top -fill both pack .bottom.fr -side top -fill both pack .bottom.output -side left -fill both pack .top .bottom -side top -fill both -expand yes wm minsize . 10 10 ################################################################################ # build the mpeg2play command and execute proc play_mpeg {} { global mpeg2play_command mpeg_file verbose_level output_format \ loop quiet frame_rate set looparg "" set quietarg "" if {$loop == 1} {set looparg -l} if {$quiet == 1} {set quietarg -q} # uncomment the following to see what's getting passed to eval # puts stdout "exec $mpeg2play_command -v$verbose_level -o$output_format \ # $looparg $quietarg -f$frame_rate \"$mpeg_file\" \ # <@stdin >@stdout 2>@stderr &" catch { eval exec $mpeg2play_command -v$verbose_level -o$output_format \ $looparg $quietarg -f$frame_rate \"$mpeg_file\" \ <@stdin >@stdout 2>@stderr & } }