class Gst::Bus

Public Instance Methods

add_watch(priority=GLib::PRIORITY_DEFAULT, &block) click to toggle source
# File lib/gst/bus.rb, line 20
def add_watch(priority=GLib::PRIORITY_DEFAULT, &block)
  add_watch_full(priority, &block)
end
Also aliased as: add_watch_full
add_watch_full(priority=GLib::PRIORITY_DEFAULT, &block)
Alias for: add_watch
poll(*args) click to toggle source
# 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
      options = args[0]
      events = options[:events]
      timeout = options[:timeout]
    when Integer
      timeout = args[0]
    else
      events = args[0]
    end
  when 2
    events, timeout = args
  else
    message = "wrong number of arguments "
    message << "(given #{n_args}, expected 0..2)"
    raise ArgumentError, message
  end
  poll_raw(events || :any,
           timeout || CLOCK_TIME_NONE)
end
Also aliased as: poll_raw
poll_raw(*args)
Alias for: poll
sync_handler(&block) click to toggle source
# File lib/gst/bus.rb, line 24
def sync_handler(&block)
  @sync_handler = lambda do |bus, message|
    begin
      block.call(bus, message)
    rescue Exception
      $stderr.puts("An exception is raised in " +
                     "#{self.class}\##{__method__} callback: #{block}")
      $stderr.puts("#{$!.class}: #{$!.message}")
      $stderr.puts($@)
      BusSyncReply::DROP
    end
  end
  set_sync_handler(&@sync_handler)
end