Exemplo n.º 1
0
func (s *Shout) UpdateMetadata(mname string, mvalue string) {
	md := C.shout_metadata_new()
	ptr1 := C.CString(mname)
	ptr2 := C.CString(mvalue)
	C.shout_metadata_add(md, ptr1, ptr2)
	C.free(unsafe.Pointer(ptr1))
	C.free(unsafe.Pointer(ptr2))
	C.shout_set_metadata(s.struc, md)
	C.shout_metadata_free(md)
}
Exemplo n.º 2
0
func (self *Shout) SendMetadata(meta string) error {
	/* Updates the metadata. This is only supported for MP3 streams */
	new_string := C.CString(meta)
	song_string := C.CString("song")
	// Make sure we call free at the end
	defer C.free(unsafe.Pointer(new_string))
	defer C.free(unsafe.Pointer(song_string))

	i := C.shout_metadata_add(self.shout_metadata, song_string, new_string)
	if i != C.SHOUTERR_SUCCESS {
		return self.createShoutError()
	}

	i = C.shout_set_metadata(self.shout, self.shout_metadata)
	if i != C.SHOUTERR_SUCCESS {
		return self.createShoutError()
	}

	return nil
}