Class: ActiveVlc::LibVlc::MediaList

Inherits:
Object
  • Object
show all
Defined in:
lib/activevlc/libvlc/media_list.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ptr) ⇒ MediaList

Returns a new instance of MediaList.



15
16
17
# File 'lib/activevlc/libvlc/media_list.rb', line 15

def initialize(ptr)
  @ptr = MediaListPtr.new(ptr)
end

Instance Attribute Details

#ptrObject (readonly)

Returns the value of attribute ptr.



13
14
15
# File 'lib/activevlc/libvlc/media_list.rb', line 13

def ptr
  @ptr
end

Instance Method Details

#<<(media) ⇒ Object



37
38
39
# File 'lib/activevlc/libvlc/media_list.rb', line 37

def <<(media)
  locked! { Api.libvlc_media_list_add_media(@ptr, media.ptr) }
end

#event_managerObject



29
30
31
# File 'lib/activevlc/libvlc/media_list.rb', line 29

def event_manager
  EventManager.new Api.libvlc_media_list_event_manager(@ptr)
end

#lengthObject



41
42
43
# File 'lib/activevlc/libvlc/media_list.rb', line 41

def length
  locked! { Api.libvlc_media_list_count(@ptr) }
end

#locked!Object

Execute the given block with the media_list lock acquired.



20
21
22
23
24
25
26
27
# File 'lib/activevlc/libvlc/media_list.rb', line 20

def locked!
  if block_given?
    _lock!
    res = yield
    _unlock!
    res
  end
end

#media=(media) ⇒ Object



33
34
35
# File 'lib/activevlc/libvlc/media_list.rb', line 33

def media=(media)
  Api.libvlc_media_list_set_media(@ptr, media.ptr)
end