/
types.go
54 lines (47 loc) · 949 Bytes
/
types.go
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package main
import (
"github.com/lazywei/go-opencv/opencv"
"github.com/gorilla/websocket"
"text/template"
"net"
)
type connection struct {
ws *websocket.Conn
send chan []byte
}
type hub struct {
connections map[*connection]bool
broadcast chan []byte
register chan *connection
unregister chan *connection
}
var h = hub{
broadcast: make(chan []byte),
register: make(chan *connection),
unregister: make(chan *connection),
connections: make(map[*connection]bool),
}
var l = hub{
broadcast: make(chan []byte),
register: make(chan *connection),
unregister: make(chan *connection),
connections: make(map[*connection]bool),
}
var (
homeTempl *template.Template
cap *opencv.Capture
avgFrame []float64
blurBytes []byte
colorBytes []byte
host = "127.0.0.1"
port = "1890"
remote = host + ":" + port
conn net.Conn
)
const (
BLUE = 0
GREEN = 1
RED = 2
FRAME_WIDTH = 640
FRAME_HEIGHT = 480
)