chenshijun
2019-12-16 0bbac062b44db5383da377c83ba450c207794a6c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package hikvoice
 
/*
#cgo CFLAGS: -I${SRCDIR}/include -w -g
#cgo LDFLAGS: -L${SRCDIR}/libs
#cgo LDFLAGS: -lHikVoice -lAudioRender -lHCCore -lhcnetsdk -lhpr
#cgo LDFLAGS: -ldl -lm
 
#include <stdlib.h>
#include "Voice.h"
*/
import "C"
import (
    "unsafe"
)
 
// SendVoice Send Voice
func SendVoice(ip,usrname,passwd,voiceFilePath string) int {
 
    cip := C.CString(ip)
    defer C.free(unsafe.Pointer(cip))
    cusrname := C.CString(usrname)
    defer C.free(unsafe.Pointer(cusrname))
    cpasswd := C.CString(passwd)
    defer C.free(unsafe.Pointer(cpasswd))
    cvoiceFilePath := C.CString(voiceFilePath)
    defer C.free(unsafe.Pointer(cvoiceFilePath))
 
    cRet := C.SendVoice(cip, cusrname, cpasswd, cvoiceFilePath)
    return int(cRet)
}