WebGL is now default

This commit is contained in:
Milan Nikolic
2018-01-27 01:59:46 +01:00
parent 1c9dfcb84c
commit 7392d8d9b8
4 changed files with 9 additions and 9 deletions

View File

@@ -46,8 +46,8 @@ Usage of ./cam2ip:
Path to htpasswd file, if empty auth is disabled
-index int
Camera index
-webgl
Use WebGL to draw images
-nowebgl
Disable WebGL drawing of images (html handler)
```
### Handlers

View File

@@ -21,7 +21,7 @@ func main() {
flag.IntVar(&srv.Delay, "delay", 10, "Delay between frames, in milliseconds")
flag.Float64Var(&srv.FrameWidth, "frame-width", 640, "Frame width")
flag.Float64Var(&srv.FrameHeight, "frame-height", 480, "Frame height")
flag.BoolVar(&srv.WebGL, "webgl", false, "Use WebGL to draw images")
flag.BoolVar(&srv.NoWebGL, "nowebgl", false, "Disable WebGL drawing of images (html handler)")
flag.StringVar(&srv.Bind, "bind-addr", ":56000", "Bind address")
flag.StringVar(&srv.Htpasswd, "htpasswd-file", "", "Path to htpasswd file, if empty auth is disabled")
flag.Parse()

View File

@@ -13,7 +13,7 @@ type HTML struct {
}
// NewHTML returns new HTML handler.
func NewHTML(bind string, width, height float64, gl bool) *HTML {
func NewHTML(bind string, width, height float64, nogl bool) *HTML {
h := &HTML{}
b := strings.Split(bind, ":")
@@ -21,9 +21,9 @@ func NewHTML(bind string, width, height float64, gl bool) *HTML {
bind = "127.0.0.1" + bind
}
tpl := html
if gl {
tpl = htmlWebGL
tpl := htmlWebGL
if nogl {
tpl = html
}
tpl = strings.Replace(tpl, "{BIND}", bind, -1)

View File

@@ -24,7 +24,7 @@ type Server struct {
Delay int
FrameWidth float64
FrameHeight float64
WebGL bool
NoWebGL bool
Camera *camera.Camera
}
@@ -43,7 +43,7 @@ func (s *Server) ListenAndServe() error {
basic = auth.NewBasicAuthenticator(realm, auth.HtpasswdFileProvider(s.Htpasswd))
}
http.Handle("/html", newAuthHandler(handlers.NewHTML(s.Bind, s.FrameWidth, s.FrameHeight, s.WebGL), basic))
http.Handle("/html", newAuthHandler(handlers.NewHTML(s.Bind, s.FrameWidth, s.FrameHeight, s.NoWebGL), basic))
http.Handle("/jpeg", newAuthHandler(handlers.NewJPEG(s.Camera), basic))
http.Handle("/mjpeg", newAuthHandler(handlers.NewMJPEG(s.Camera, s.Delay), basic))