lib/gui/base.rb
# basically run mplayer/smplayer on a file or DVD
basically run mplayer/smplayer on a file or DVD
basically run mplayer / smplayer on a file or DVD
def run_smplayer_blocking play_this, title_track_maybe_nil, passed_in_extra_options, force_use_mplayer, show_subs, start_full_screen, srt_filename
      puts "starting mplayer..."
	  raise unless passed_in_extra_options 
      extra_options = []
      extra_options << "-framedrop" 
      extra_options << "-mc 2"
      extra_options << "-autosync 30" 
	  extra_options << "-nosoftvol -af volume=20.0:0" 
      extra_options << "-osdlevel 2" 
      if we_are_in_create_mode
        extra_options << "-osd-verbose" if we_are_in_developer_mode?		 
      end
      extra_options << "-osd-fractions 1"
      if !show_subs && !srt_filename
        extra_options << "-nosub -noautosub -forcedsubsonly -sid 1000"
      end
	    if srt_filename
	      extra_options << "-sub #{srt_filename}"
  	  else
        extra_options << "-alang en"
        extra_options << "-slang en"
	    end
      force_use_mplayer ||= OS.mac?
      parent_parent = File.basename(File.dirname(play_this))
      if parent_parent == 'VIDEO_TS'
        dvd_device_dir = normalize_path(File.dirname(play_this))
        play_this = "\"dvdnav://#{title_track_maybe_nil}/#{dvd_device_dir}/..\""
      elsif File.exist?(play_this + '/VIDEO_TS') || (play_this =~ /\/dev\/rdisk\d/)
        play_this = "\"dvdnav://#{title_track_maybe_nil}/#{play_this}\""
      else
      end
      if play_this =~ /dvdnav/ && title_track_maybe_nil
        extra_options << "-msglevel identify=4" 
      end
      extra_options << "-mouse-movements" 
	  if get_upconvert_secondary_settings.present?
	    extra_options << get_upconvert_secondary_settings
      end
      extra_options << "-lavdopts threads=#{OS.cpu_count}" 
      if force_use_mplayer
        extra_options << "-font #{File.expand_path('vendor/subfont.ttf')}"
	    key_strokes = <<-EOL
RIGHT seek +10
LEFT seek -10
DOWN seek -60
UP seek +60
ENTER {dvdnav} dvdnav select	  
MOUSE_BTN0 {dvdnav} dvdnav select
MOUSE_BTN0_DBL vo_fullscreen
MOUSE_BTN2 vo_fullscreen
KP_ENTER dvdnav select
# some for os x, some for doze. huh?
       EOL
       conf_file = File.expand_path './mplayer_input_conf'
       File.write conf_file, key_strokes
       extra_options << "-volume 100" 
       if OS.windows?
        extra_options << "-vo direct3d"
        conf_file = conf_file[2..-1] 
       end
       if start_full_screen
         extra_options << "-fs"
         upconv = get_upconvert_vf_settings
         upconv = "-vf #{upconv}" if upconv.present?
       else
        upconv = ""
       end
       mplayer_loc = mplayer_local false
       assert File.exist?(mplayer_loc)
       c = "#{mplayer_loc} #{extra_options.join(' ')} #{upconv} -input conf=\"#{conf_file}\" #{passed_in_extra_options} \"#{play_this}\" "
      else
        if OS.windows?
          extra_options << "-vo direct3d" 
        end
        set_smplayer_opts extra_options.join(' ') + " " + passed_in_extra_options, get_upconvert_vf_settings, show_subs
        c = "smplayer \"#{play_this}\" -config-path \"#{File.dirname  EightThree.convert_path_to_8_3(SMPlayerIniFile)}\" " 
        c += " -fullscreen " if start_full_screen
        if !we_are_in_create_mode
        end
      end
      puts c
      system_blocking c
    end
def run_smplayer_blocking play_this , title_track_maybe_nil , passed_in_extra_options , force_use_mplayer , show_subs , start_full_screen , srt_filename puts "starting mplayer..." raise unless passed_in_extra_options extra_options = [ ] extra_options << "-framedrop" extra_options << "-mc 2" extra_options << "-autosync 30" extra_options << "-nosoftvol -af volume=20.0:0" extra_options << "-osdlevel 2" if we_are_in_create_mode extra_options << "-osd-verbose" if we_are_in_developer_mode? end extra_options << "-osd-fractions 1" if ! show_subs && ! srt_filename extra_options << "-nosub -noautosub -forcedsubsonly -sid 1000" end if srt_filename extra_options << "-sub #{srt_filename}" else extra_options << "-alang en" extra_options << "-slang en" end force_use_mplayer ||= OS . mac? parent_parent = File . basename ( File . dirname ( play_this ) ) if parent_parent == 'VIDEO_TS' dvd_device_dir = normalize_path ( File . dirname ( play_this ) ) play_this = "\"dvdnav://#{title_track_maybe_nil}/#{dvd_device_dir}/..\"" elsif File . exist? ( play_this + '/VIDEO_TS' ) || ( play_this =~ / \/ dev \/ rdisk \d / ) play_this = "\"dvdnav://#{title_track_maybe_nil}/#{play_this}\"" else end if play_this =~ / dvdnav / && title_track_maybe_nil extra_options << "-msglevel identify=4" end extra_options << "-mouse-movements" if get_upconvert_secondary_settings . present? extra_options << get_upconvert_secondary_settings end extra_options << "-lavdopts threads=#{OS.cpu_count}" if force_use_mplayer extra_options << "-font #{File.expand_path('vendor/subfont.ttf')}" key_strokes = <<-EOL 
RIGHT seek +10
LEFT seek -10
DOWN seek -60
UP seek +60
ENTER {dvdnav} dvdnav select	  
MOUSE_BTN0 {dvdnav} dvdnav select
MOUSE_BTN0_DBL vo_fullscreen
MOUSE_BTN2 vo_fullscreen
KP_ENTER dvdnav select
# some for os x, some for doze. huh?
        EOL conf_file = File . expand_path './mplayer_input_conf' File . write conf_file , key_strokes extra_options << "-volume 100" if OS . windows? extra_options << "-vo direct3d" conf_file = conf_file [ 2 .. - 1 ] end if start_full_screen extra_options << "-fs" upconv = get_upconvert_vf_settings upconv = "-vf #{upconv}" if upconv . present? else upconv = "" end mplayer_loc = mplayer_local false assert File . exist? ( mplayer_loc ) c = "#{mplayer_loc} #{extra_options.join(' ')} #{upconv} -input conf=\"#{conf_file}\" #{passed_in_extra_options} \"#{play_this}\" " else if OS . windows? extra_options << "-vo direct3d" end set_smplayer_opts extra_options . join ( ' ' ) + " " + passed_in_extra_options , get_upconvert_vf_settings , show_subs c = "smplayer \"#{play_this}\" -config-path \"#{File.dirname  EightThree.convert_path_to_8_3(SMPlayerIniFile)}\" " c += " -fullscreen " if start_full_screen if ! we_are_in_create_mode end end puts c system_blocking c end
basically run mplayer/smplayer on a file or DVD
basically run mplayer / smplayer on a file or DVD
# cannot be nil # -framedrop is for slow CPU's # same with -autosync to try and help it stay in sync... -mc 0.03 is to A/V correct 1s audio per 2s video # -hardframedrop might help but hurts the eyes just too much # even in create mode, if the audio ever gets off, we're hosed with making accurate timestamps...so drop, until I hear otherwise... # allow a larger max volume # amplify without using buggy software mixer softvol--0 is soft clipping off, whatever that means # who doesn't want to see those fraction decimal points :) # console output # disable all subtitles :P # case d:\yo\VIDEO_TS\title0.vob # case d:\ where d:\VIDEO_TS exists [DVD mounted in drive, or DVD dir] or mac's /dev/rdisk1 # case g:\video\filename.mpg # leave it the same... # prevent smplayer from using *forever* to look up info on DVD's with -identify ... # just in case smplayer also needs -mouse-movements... :) LODO it prolly doesn't # just in case this helps [supposed to with h.264] # NB fast *crashes* doze... # why start low? mplayer why oh why LODO tell them not to, also tell them the default should be dvdnavigable, really...yes? # direct3d for windows 7 old nvidia cards' sake [yipes] and also dvdnav sake # strip off drive letter, which it doesn't seem to like no sir # more light nvidia...should be ok...this wastes cpu...but we have to have it I guess... #c += " -close-at-end " # smplayer close after...still a bit too unstable though...
play_this
title_track_maybe_nil
passed_in_extra_options
force_use_mplayer
show_subs
start_full_screen
srt_filename