| | |
| | | "goshm/shmparser" |
| | | "io/ioutil" |
| | | "os" |
| | | "strings" |
| | | "time" |
| | | ) |
| | | |
| | |
| | | if i < 2 { |
| | | w, h = 720, 576 |
| | | } |
| | | timestamp := strings.Replace(time.Now().Format("2006-01-02 15:04:05.000"), ".", ":", -1) |
| | | |
| | | d := readFile(f) |
| | | shmparser.Image2Shm(shm, "cameraid", "cameraname", d, w, h, 1122331122) |
| | | shmparser.Image2Shm(shm, "cameraid", "cameraname", timestamp, d, w, h, 1122331122) |
| | | printImage(shm, fmt.Sprintf("./npic/%dx%d.%d", w, h, i)) |
| | | } |
| | | } else { |
| | |
| | | if i < 2 { |
| | | w, h = 720, 576 |
| | | } |
| | | |
| | | timestamp := strings.Replace(time.Now().Format("2006-01-02 15:04:05.000"), ".", ":", -1) |
| | | |
| | | d := readFile(files[i]) |
| | | shmparser.Image2Shm(shm, "cameraid", "cameraname", d, w, h, 1122331122) |
| | | shmparser.Image2Shm(shm, "cameraid", "cameraname", timestamp, d, w, h, 1122331122) |
| | | printImage(shm, fmt.Sprintf("./npic/%dx%d.%d", w, h, i)) |
| | | } |
| | | } |
| | |
| | | */ |
| | | import "C" |
| | | import ( |
| | | "strings" |
| | | "time" |
| | | "unsafe" |
| | | ) |
| | | |
| | |
| | | } |
| | | |
| | | // Image2Shm fill image to shm |
| | | func Image2Shm(shm []byte, cid, cname string, data []byte, w, h int, fid int64) { |
| | | timestamp := strings.Replace(time.Now().Format("2006-01-02 15:04:05.000"), ".", ":", -1) |
| | | func Image2Shm(shm []byte, cid, cname, timestamp string, data []byte, w, h int, fid int64) { |
| | | |
| | | dataptr := (*C.uchar)(unsafe.Pointer(&data[0])) |
| | | cidbyte := str2byte(cid) |