Merge branch 'master' of http://192.168.5.5:10010/r/valib/c_shm
| | |
| | | "fmt" |
| | | "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)) |
| | | } |
| | | } |
| | |
| | | // targets count |
| | | tmp = put_number(tmp, RULE_SDK_TGT_COUNT, res->count); |
| | | cursize += tmp - old; |
| | | |
| | | // targets |
| | | tmp = put_targets(tmp, res, &cursize); |
| | | if (res->count > 0) |
| | | tmp = put_targets(tmp, res, &cursize); |
| | | |
| | | // 最后修改 psdksize 内容 |
| | | Put64(pheader, cursize); |
| | |
| | | tmp = get_string(tmp, &cmd, &sdk.timestamp, &sdk.timestamp_size); |
| | | tmp = get_number(tmp, &cmd, &sdk.tgt_count); |
| | | |
| | | sdk.tgt = (struct sttgt*)calloc(sdk.tgt_count, sizeof(struct sttgt)); |
| | | tmp = get_targets(tmp, sdk.tgt, sdk.tgt_count); |
| | | if (sdk.tgt_count > 0){ |
| | | sdk.tgt = (struct sttgt*)calloc(sdk.tgt_count, sizeof(struct sttgt)); |
| | | tmp = get_targets(tmp, sdk.tgt, sdk.tgt_count); |
| | | } |
| | | |
| | | sdkarray[i] = sdk; |
| | | } |
| | |
| | | */ |
| | | 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) |