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].



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

def brightness(value, type = :relative)
  setting :brightness, value, type
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].



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

def contrast(value, type = :relative)
  setting :contrast, value, type
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



93
94
95
# File 'lib/mplayer-ruby/slave_video_commands.rb', line 93

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].



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

def gamma(value, type = :relative)
  setting :gamma, value, type
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].



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

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

#osd(level = nil) ⇒ Object

Toggle OSD mode or set it to <level>



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

def osd(level=nil)
  send(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)



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

def osd_show_property_text(string,options={})
  options.reverse_merge!({:duration => 0, :level => 0})
  send("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)



35
36
37
38
# File 'lib/mplayer-ruby/slave_video_commands.rb', line 35

def osd_show_text(string,options = {})
  options.reverse_merge!({:duration => 0, :level => 0})
  send("osd_show_text #{string} #{options[:duration]} #{options[:level]}")
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].



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

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

#sub_alignment(alignment = nil) ⇒ Object

Toggle/set subtitle alignment. [alignment] :top sets top alignment :center sets center alignment :bottom sets bottom alignment



108
109
110
111
112
113
114
115
# File 'lib/mplayer-ruby/slave_video_commands.rb', line 108

def sub_alignment(alignment = nil)
  send case alignment
  when :top then "sub_alignment 0"
  when :center then "sub_alignment 1"
  when :bottom then "sub_alignment 2"
  else "sub_alignment"
  end
end

#sub_delay(value, type = :absolute) ⇒ Object

Adjust the subtitle delay :relative is adjust by +/- <value> seconds. :absolute is set it to <value>. (default)



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

def sub_delay(value,type = :absolute)
  adjust_set :sub_delay, value, type
end

#sub_demux(value = :cycle) ⇒ Object

Display subtitle specifid by <value> for file subs. corresponding to ID_SUBTITLE_ID :off turns off sub :cycle will cycle all file subs. (Default)



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

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

#sub_file(value = :cycle) ⇒ Object

Display subtitle specifid by <value> for file subs. corresponding to ID_VOBSUB_ID :off turns off sub :cycle will cycle all file subs. (Default)



174
175
176
# File 'lib/mplayer-ruby/slave_video_commands.rb', line 174

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

#sub_load(file) ⇒ Object

Loads subtitles from <file>.

Raises:

  • (ArgumentError)


126
127
128
129
# File 'lib/mplayer-ruby/slave_video_commands.rb', line 126

def sub_load(file)
  raise ArgumentError, "Invalid File" unless File.exists? file
  send("sub_load #{file}")
end

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

Adjust/set subtitle position. If :relative, modifies parameter by <value>. If :absolute, parameter is set to <value>.



100
101
102
# File 'lib/mplayer-ruby/slave_video_commands.rb', line 100

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

#sub_remove(value = :all) ⇒ Object

Removes the selected sub file :all removes all sub files. (Default) <value> removes the sub file at that index.



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

def sub_remove(value = :all)
  cmd = (value == :all ? -1 : value)
  send "sub_remove #{cmd}"
end

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

Adjust the subtitle size by +/- <value> :set set it to <value> :relative adjusts it by value



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

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

#sub_select(value = :cycle) ⇒ Object

Displays subtitle :cycle will cycle through all sub_titles. (Default) <value> will display the sub_title at that index.



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

def sub_select(value = :cycle)
  cmd = (value == :cycle ? -2 : value)
  send "sub_select #{cmd}"
end

#sub_source(value = :cycle) ⇒ Object

Display first subtitle from <value>

:sub for SUB_SOURCE_SUBS for file subs
:vobsub for  SUB_SOURCE_VOBSUB for VOBsub files
:demux SUB_SOURCE_DEMUX for subtitle embedded in the media file or DVD subs.
:off will turn off subtitle display.
:cycle will cycle between the first subtitle of each currently available sources.


153
154
155
156
157
158
159
160
161
162
# File 'lib/mplayer-ruby/slave_video_commands.rb', line 153

def sub_source(value = :cycle)
  switch = case value
  when :sub then 0
  when :vobsub then 1
  when :demux then 2
  when :off then -1
  when :cycle then -2
  end
  send "sub_source #{switch}"
end

#sub_step(value, type = :forward) ⇒ Object

Step forward in the subtitle list by <value> steps step backwards if <value> is negative can also set type to :backward or :forward and return postive <value>



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

def sub_step(value, type = :forward)
  type = :backward if value < 0
  send(type == :forward ? "sub_step #{value.abs}" : "sub_step -#{value.abs}" )
end

#sub_visibility(value = nil) ⇒ Object

Toggle/set subtitle visibility. :on turns on visilibity. :off turns off visilibility. else toggles visibility.



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

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

#sub_vob(value = :cycle) ⇒ Object

Display subtitle specifid by <value> for file subs. corresponding to ID_FILE_SUB_ID :off turns off sub :cycle will cycle all file subs. (Default)



167
168
169
# File 'lib/mplayer-ruby/slave_video_commands.rb', line 167

def sub_vob(value = :cycle)
  select_cycle :sub_vob, value
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.



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

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.



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

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.



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

def switch_ratio(value); send("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.



208
209
210
# File 'lib/mplayer-ruby/slave_video_commands.rb', line 208

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



222
223
224
# File 'lib/mplayer-ruby/slave_video_commands.rb', line 222

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