示例#1
0
// AudioDeviceName returns the long name of an audio device.
// If it is not available, the short name is given.
func (this *Instance) AudioDeviceName(output string, device int) (s string, err error) {
	if this.ptr == nil {
		return "", syscall.EINVAL
	}

	c := C.CString(output)
	defer C.free(unsafe.Pointer(c))

	if r := C.libvlc_audio_output_device_longname(this.ptr, c, C.int(device)); r != nil {
		s = C.GoString(r)
		C.free(unsafe.Pointer(r))
		return
	}

	return "", checkError()
}
示例#2
0
文件: player.go 项目: henrym/go-vlc
// AudioDeviceName returns the long name of an audio device.
// If it is not available, the short name is given.
func (this *Player) AudioDeviceName(output string, device int) (s string, err error) {
	if this.ptr == nil {
		return "", &VLCError{"Player is nil"}
	}

	c := C.CString(output)
	defer C.free(unsafe.Pointer(c))

	if r := C.libvlc_audio_output_device_longname(this.ptr, c, C.int(device)); r != nil {
		s = C.GoString(r)
		C.free(unsafe.Pointer(r))
		return
	}

	return "", checkError()
}