diff --git a/README.md b/README.md index ee9b673..7c6f9a6 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/cam2ip.go b/cam2ip.go index 78c9b09..fc3789c 100644 --- a/cam2ip.go +++ b/cam2ip.go @@ -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() diff --git a/handlers/html.go b/handlers/html.go index 3f47b51..9b9ad3a 100644 --- a/handlers/html.go +++ b/handlers/html.go @@ -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) diff --git a/server/server.go b/server/server.go index 7525c5c..b573167 100644 --- a/server/server.go +++ b/server/server.go @@ -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))