Module: MPlayer::SlaveVideoCommands

Included in:
Slave
Defined in:
lib/mplayer-ruby/slave_video_commands.rb

Instance Method Summary collapse

Instance Method Details

#audio_delay(value, type = :relative) ⇒ Object

Set/adjust the audio delay. If type is :relative adjust the delay by <value> seconds. If type is :absolute, set the delay to <value> seconds.



7
8
9
# File 'lib/mplayer-ruby/slave_video_commands.rb', line 7

def audio_delay(value,type = :relative)
  adjust_set :audio_delay, value, type
end

#brightness(value, type = :relative) ⇒ Object

Set/adjust video parameters. If :relative, modifies parameter by <value>. If :absolute, parameter is set to <value>. <value> is in the range [-100, 100].



62
63
64
# File 'lib/mplayer-ruby/slave_video_commands.rb', line 62

def brightness(value, type = :relative)
  setting :brightness, value, type
end

#change_rectangle(coord, value, type = :relative) ⇒ Object



233
234
235
236
237
238
239
# File 'lib/mplayer-ruby/slave_video_commands.rb', line 233

def change_rectangle(coord,value,type = :relative)
  switch = case coord
  when :x then (0 + (type == :relative ? 2 : 0))
  when :y then (1 + (type == :relative ? 2 : 0))
  end
  command("change_rectangle #{switch} #{value}")
end

#contrast(value, type = :relative) ⇒ Object

Set/adjust video parameters. If :relative, modifies parameter by <value>. If :absolute, parameter is set to <value>. <value> is in the range [-100, 100].



38
39
40
# File 'lib/mplayer-ruby/slave_video_commands.rb', line 38

def contrast(value, type = :relative)
  setting :contrast, value, type
end

#dvdnav(button) ⇒ Object

presses the given dvd button available buttons are: :up :down :left :right :menu :select :prev :mouse



178
179
180
181
182
183
# File 'lib/mplayer-ruby/slave_video_commands.rb', line 178

def dvdnav(button)
  unless %w[up down left right menu select prev mouse].include? button.to_s
    raise ArgumentError, "Invalid button name"
  end
  command "dvdnav #{button}"
end

#frame_drop(value = nil) ⇒ Object

Toggle/set frame dropping mode if :on, turns on dropping mode if :off, turns off dropping mode call by itself toggles dropping mode



78
79
80
# File 'lib/mplayer-ruby/slave_video_commands.rb', line 78

def frame_drop(value = nil)
  toggle :frame_drop, value
end

#gamma(value, type = :relative) ⇒ Object

Set/adjust video parameters. If :relative, modifies parameter by <value>. If :absolute, parameter is set to <value>. <value> is in the range [-100, 100].



46
47
48
# File 'lib/mplayer-ruby/slave_video_commands.rb', line 46

def gamma(value, type = :relative)
  setting :gamma, value, type
end

#get_property(value) ⇒ Object

Print out the current value of a property. raises an error if it fails to get the property

Raises:

  • (StandardError)


187
188
189
190
191
# File 'lib/mplayer-ruby/slave_video_commands.rb', line 187

def get_property(value)
  resp = command("get_property #{value}",/#{value.to_s}/).gsub(/ANS(.+?)\=/,"")
  raise StandardError,resp if resp =~ /Failed/
  resp
end

#get_sub_visibilityObject Also known as: is_sub_visible?

Returns if it the sub is visibile mode. true if it is fullscreen false if it is windowed



219
220
221
222
223
# File 'lib/mplayer-ruby/slave_video_commands.rb', line 219

def get_sub_visibility
  resp = command "get_sub_visibility",/(0|1)/
  return true if resp =~ /1/
  false
end

#get_vofullscreenObject Also known as: is_fullscreen?

Returns if it is in fullscreen mode. true if it is fullscreen false if it is windowed



209
210
211
212
213
# File 'lib/mplayer-ruby/slave_video_commands.rb', line 209

def get_vofullscreen
  resp = command "get_vofullscreen",/(0|1)/
  return true if resp =~ /1/
  false
end

#hue(value, type = :relative) ⇒ Object

Set/adjust video parameters. If :relative, modifies parameter by <value>. If :absolute, parameter is set to <value>. <value> is in the range [-100, 100].



54
55
56
# File 'lib/mplayer-ruby/slave_video_commands.rb', line 54

def hue(value, type = :relative)
  setting :hue, value, type
end

#osd(level = nil) ⇒ Object

Toggle OSD mode or set it to <level>



13
14
15
# File 'lib/mplayer-ruby/slave_video_commands.rb', line 13

def osd(level=nil)
  command(level.nil? ? "osd" : "osd #{level}")
end

#osd_show_property_text(string, options = {}) ⇒ Object

Show an expanded property string on the OSD see -playing-msg for a list of available expansions :duration sets the length to display text. :level sets the osd level to display at. (default: 0 => always show)



29
30
31
32
# File 'lib/mplayer-ruby/slave_video_commands.rb', line 29

def osd_show_property_text(string,options={})
  options = {:duration => 0, :level => 0}.merge(options)
  command("osd_show_property_text #{string} #{options[:duration]} #{options[:level]}")
end

#osd_show_text(string, options = {}) ⇒ Object

Show <string> on the OSD. :duration sets the length to display text. :level sets the osd level to display at. (default: 0 => always show)



20
21
22
23
# File 'lib/mplayer-ruby/slave_video_commands.rb', line 20

def osd_show_text(string,options = {})
  options = {:duration => 0, :level => 0}.merge(options)
  command("osd_show_text #{string} #{options[:duration]} #{options[:level]}")
end

#panscan(value) ⇒ Object

Increases or descreases the panscan range by <value>. maximum is 1.0.

Raises:

  • (ArgumentError)


170
171
172
173
# File 'lib/mplayer-ruby/slave_video_commands.rb', line 170

def panscan(value)
  raise ArgumentError, "Value out of Range -1.0 .. 1.0" unless value.abs <= 1
  command "panscan #{value} 0"
end

#saturation(value, type = :relative) ⇒ Object

Set/adjust video parameters. If :relative, modifies parameter by <value>. If :absolute, parameter is set to <value>. <value> is in the range [-100, 100].



70
71
72
# File 'lib/mplayer-ruby/slave_video_commands.rb', line 70

def saturation(value, type = :relative)
  setting :saturation, value, type
end

#screenshot(toggle = nil) ⇒ Object

Take a screenshot. Requires the screenshot filter to be loaded. nil Take a single screenshot. :toggle Start/stop taking screenshot of each frame.



159
160
161
162
163
164
165
166
167
# File 'lib/mplayer-ruby/slave_video_commands.rb', line 159

def screenshot(toggle=nil)
  switch, pattern = case toggle
  when :toggle
    [ 1, // ]
  else
    [ 0, /screenshot/ ]
  end
  (command("screenshot #{switch}", pattern)) =~ /(shot\d*\.png)/ ? $~[1] : ""
end

#seek_chapter(value, type = :relative) ⇒ Object

Seek to the start of a chapter :relative does a relative seek (+/-) :absolute goes to the exact value of chapter



229
230
231
# File 'lib/mplayer-ruby/slave_video_commands.rb', line 229

def seek_chapter(value, type = :relative)
  adjust_set :seek_chapter, value, type
end

#set_property(name, value) ⇒ Object

Set the value to a property



194
195
196
# File 'lib/mplayer-ruby/slave_video_commands.rb', line 194

def set_property(name,value)
  command "set_property #{name} #{value}"
end

#step_property(name, value) ⇒ Object

adjust the propery by steps if value is < 0, steps downards else, steps upward



201
202
203
204
# File 'lib/mplayer-ruby/slave_video_commands.rb', line 201

def step_property(name,value)
  direction = value < 0 ? -1 : 1
  command "step_property #{name} #{value.abs} #{direction}"
end

#switch_angle(value = :cycle) ⇒ Object

switch_angle [value] (DVDs only) <value> Switch to the DVD angle with the ID [value]. :cycle available angles if [value] is omitted or negative.



91
92
93
# File 'lib/mplayer-ruby/slave_video_commands.rb', line 91

def switch_angle(value = :cycle)
  select_cycle :switch_angle, value
end

#switch_audio(value = :cycle) ⇒ Object

switch_audio [value] (currently MPEG*, AVI, Matroska and streams handled by libavformat) <value> Switch to the audio track with the ID <value>. :cycle available tracks if [value] is omitted or negative.



85
86
87
# File 'lib/mplayer-ruby/slave_video_commands.rb', line 85

def switch_audio(value = :cycle)
  select_cycle :switch_audio, value
end

#switch_ratio(value) ⇒ Object

switch_ratio [value] <value> Change aspect ratio at runtime. [value] is the new aspect ratio expressed as a float (e.g. 1.77778 for 16/9). There might be problems with some video filters.



106
# File 'lib/mplayer-ruby/slave_video_commands.rb', line 106

def switch_ratio(value); command("switch_ratio #{value}"); end

#switch_title(value = :cycle) ⇒ Object

switch_title [value] (DVDNAV only) <value> Switch to the DVD title with the ID [value]. :cycle available titles if [value] is omitted or negative.



98
99
100
# File 'lib/mplayer-ruby/slave_video_commands.rb', line 98

def switch_title(value = :cycle)
  select_cycle :switch_title, value
end

#switch_vsync(value = nil) ⇒ Object

switch_vsync [value] :on Toggle vsync on :off Toggle off nil for just Toggle



112
113
114
# File 'lib/mplayer-ruby/slave_video_commands.rb', line 112

def switch_vsync(value = nil)
  toggle :switch_vsync, value
end

#vo_border(value = nil) ⇒ Object

Toggle/set borderless display :on Toggle on :off Toggle off

nil for Toggle


120
121
122
# File 'lib/mplayer-ruby/slave_video_commands.rb', line 120

def vo_border(value = nil)
  toggle :vo_border, value
end

#vo_fullscreen(value = nil) ⇒ Object

Toggle/set fullscreen mode :on Toggle on :off Toggle off

nil for Toggle


136
137
138
# File 'lib/mplayer-ruby/slave_video_commands.rb', line 136

def vo_fullscreen(value = nil)
  toggle :vo_fullscreen, value
end

#vo_ontop(value = nil) ⇒ Object

Toggle/set stay-on-top :on Toggle on :off Toggle off

nil for Toggle


144
145
146
# File 'lib/mplayer-ruby/slave_video_commands.rb', line 144

def vo_ontop(value = nil)
  toggle :vo_ontop, value
end

#vo_rootwin(value = nil) ⇒ Object

Toggle/set playback on root window :on Toggle on :off Toggle off

nil for Toggle


152
153
154
# File 'lib/mplayer-ruby/slave_video_commands.rb', line 152

def vo_rootwin(value = nil)
  toggle :vo_rootwin, value
end