示例#1
0
文件: media.go 项目: henrym/go-vlc
// SetMeta sets the metadata for this media instance.
// Note: This method does not save the metadata. Call Media.SaveMeta() for this purpose.
func (this *Media) SetMeta(mp MetaProperty, v string) {
	if this.ptr == nil {
		return
	}

	c := C.CString(v)
	C.libvlc_media_set_meta(this.ptr, C.libvlc_meta_t(mp), c)
	C.free(unsafe.Pointer(c))
}
示例#2
0
文件: media.go 项目: henrym/go-vlc
// Meta reads the specified metadata property of the media.
//
// If the media has not yet been parsed this will return an empty string.
//
// This method automatically calls Media.ParseAsync(), so after calling
// it you may receive a MediaMetaChanged event. If you prefer a synchronous
// version, ensure that you call Media.Parse() before Media.Meta().
func (this *Media) Meta(mp MetaProperty) (s string) {
	if this.ptr == nil {
		return
	}

	if c := C.libvlc_media_get_meta(this.ptr, C.libvlc_meta_t(mp)); c != nil {
		s = C.GoString(c)
		C.free(unsafe.Pointer(c))
	}

	return
}
示例#3
0
文件: main.go 项目: cfstras/cfmedias
func (m *Media) GetMeta(meta Meta) string {
	str := C.libvlc_media_get_meta((*C.struct_libvlc_media_t)(m), C.libvlc_meta_t(meta))
	defer C.free(unsafe.Pointer(str))
	return C.GoString(str)
}