Permalink
Browse files

rename Ffmpeg FFmpeg, try to dry up some swing

  • Loading branch information...
1 parent 39be67f commit 98c87632be5834482a7d87f652abc7f31cc7cc07 @rdp committed Oct 13, 2012
Showing with 19 additions and 6 deletions.
  1. +16 −3 lib/simple_gui_creator/ffmpeg_helpers.rb
  2. +3 −3 lib/simple_gui_creator/swing_helpers.rb
@@ -1,7 +1,9 @@
require 'sane'
+# windows directshow ffmpeg helper
+
# NB requires a version of ffmpeg.{exe,bat} to be in the path or current working dir, and of course it will just use the first one it finds (cwd or then in the path
-module FfmpegHelpers # LODO rename
+module FFmpegHelpers
# returns like {:audio => ['audio name 1', 'audio name 2'], :video => ['vid name 1', 'vid name 2' ]}
# use like vid_names = FfmpegHelpers.enumerate_directshow_devices[:video]
# use like name = DropDownSelector.new(nil, vid_names, "Select audio device to capture and stream").go_selected_value
@@ -63,9 +65,20 @@ def self.wait_for_ffmpeg_close out_handle # like the result of IO.popen("ffmpeg
end
end
+
+def self.combine_devices_for_ffmpeg_input audio_device, video_device
+ if audio_device
+ audio_device="-f dshow -i audio=\"#{FFmpegHelpers.escape_for_input audio_device}\""
+ end
+ if video_device
+ video_device="-f dshow -i video=\"#{FFmpegHelpers.escape_for_input video_device}\""
+ end
+ "#{video_device} #{audio_device}"
+end
+
end
if $0 == __FILE__
- p FfmpegHelpers.enumerate_directshow_devices
- FfmpegHelpers.enumerate_directshow_devices[:video].each{|name| p name, FfmpegHelpers.get_options_video_device(name) }
+ p FFmpegHelpers.enumerate_directshow_devices
+ FFmpegHelpers.enumerate_directshow_devices[:video].each{|name| p name, FFmpegHelpers.get_options_video_device(name) }
end
@@ -55,7 +55,6 @@ def initialize(*args)
def on_clicked &block
raise unless block # sanity check
- @block = block
add_action_listener do |e|
begin
block.call
@@ -80,13 +79,14 @@ def on_clicked &block
end
def simulate_click
- @block.call
+ doClick
end
+
alias click! simulate_click
def tool_tip= text
if text
- text = "<html>" + text + "</html>"
+ text = "<html>" + text + "</html>" # allow for multiple lines...
text = text.gsub("\n", "<br/>")
end
self.set_tool_tip_text text

0 comments on commit 98c8763

Please sign in to comment.