Class: Gst::Bus
- Inherits:
-
Object
- Object
- Gst::Bus
- Defined in:
- lib/gst/bus.rb
Instance Method Summary collapse
- #add_watch(priority = GLib::PRIORITY_DEFAULT, &block) ⇒ Object
- #add_watch_full ⇒ Object
- #poll(*args) ⇒ Object
- #poll_raw ⇒ Object
- #sync_handler(&block) ⇒ Object
Instance Method Details
#add_watch(priority = GLib::PRIORITY_DEFAULT, &block) ⇒ Object
20 21 22 |
# File 'lib/gst/bus.rb', line 20 def add_watch(priority=GLib::PRIORITY_DEFAULT, &block) add_watch_full(priority, &block) end |
#add_watch_full ⇒ Object
19 |
# File 'lib/gst/bus.rb', line 19 alias_method :add_watch_full, :add_watch |
#poll(*args) ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/gst/bus.rb', line 41 def poll(*args) events = nil timeout = nil n_args = args.size case n_args when 0 when 1 case args[0] when Hash = args[0] events = [:events] timeout = [:timeout] when Integer timeout = args[0] else events = args[0] end when 2 events, timeout = args else = "wrong number of arguments " << "(given #{n_args}, expected 0..2)" raise ArgumentError, end poll_raw(events || :any, timeout || CLOCK_TIME_NONE) end |
#poll_raw ⇒ Object
40 |
# File 'lib/gst/bus.rb', line 40 alias_method :poll_raw, :poll |
#sync_handler(&block) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/gst/bus.rb', line 24 def sync_handler(&block) @sync_handler = lambda do |bus, | begin block.call(bus, ) rescue Exception $stderr.puts("An exception is raised in " + "#{self.class}\##{__method__} callback: #{block}") $stderr.puts("#{$!.class}: #{$!.}") $stderr.puts($@) BusSyncReply::DROP end end set_sync_handler(&@sync_handler) end |