mirror of
https://github.com/gen2brain/cam2ip.git
synced 2025-12-15 20:08:30 +00:00
WebGL is now default
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user