// Attach registers the given event handler and returns a unique id // we can use to detach the event at a later point. func (this *EventManager) Attach(et EventType, cb EventHandler, userdata interface{}) (id int, err error) { if this.ptr == nil { return 0, &VLCError{"EventManager is nil"} } id = this.getUniqId() this.m.Lock() this.events[id] = &eventData{C.libvlc_event_type_t(et), cb, userdata} this.m.Unlock() if C.goAttach(this.ptr, this.events[id].t, unsafe.Pointer(this.events[id])) != 0 { err = checkError() } return }
func (this EventType) String() string { return C.GoString(C.libvlc_event_type_name(C.libvlc_event_type_t(this))) }