From: Ted Hess Date: Fri, 10 Oct 2014 22:27:40 +0000 (-0400) Subject: luci-app-mjpg-streamer: Add new module for mjpg-streamer management X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fluci.git;a=commitdiff_plain;h=624e37ceae2fa2bef7f51565f28bfc827ad0f704 luci-app-mjpg-streamer: Add new module for mjpg-streamer management Signed-off-by: Ted Hess --- diff --git a/applications/luci-mjpg-streamer/Makefile b/applications/luci-mjpg-streamer/Makefile new file mode 100644 index 000000000..1726202af --- /dev/null +++ b/applications/luci-mjpg-streamer/Makefile @@ -0,0 +1,4 @@ +PO = mjpg-streamer + +include ../../build/config.mk +include ../../build/module.mk diff --git a/applications/luci-mjpg-streamer/ipkg/postinst b/applications/luci-mjpg-streamer/ipkg/postinst new file mode 100644 index 000000000..cfca9d308 --- /dev/null +++ b/applications/luci-mjpg-streamer/ipkg/postinst @@ -0,0 +1,6 @@ +#!/bin/sh +[ -n "${IPKG_INSTROOT}" ] || { + ( . /etc/uci-defaults/luci-mjpg-streamer ) && rm -f /etc/uci-defaults/luci-mjpg-streamer + /etc/init.d/mjpg-streamer enabled || /etc/init.d/mjpg-streamer enable + exit 0 +} diff --git a/applications/luci-mjpg-streamer/luasrc/controller/mjpg-streamer.lua b/applications/luci-mjpg-streamer/luasrc/controller/mjpg-streamer.lua new file mode 100644 index 000000000..97b9aa4ab --- /dev/null +++ b/applications/luci-mjpg-streamer/luasrc/controller/mjpg-streamer.lua @@ -0,0 +1,29 @@ +--[[ +LuCI MJPEG Streamer + +(c) 2014 Roger D +Based on work by: vargabab and OpenWrt Dreambox + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +$Id$ +]]-- + +module("luci.controller.mjpg-streamer", package.seeall) + +function index() + require("luci.i18n") + luci.i18n.loadc("mjpg-streamer") + if not nixio.fs.access("/etc/config/mjpg-streamer") then + return + end + + local page = entry({"admin", "services", "mjpg-streamer"}, cbi("mjpg-streamer"), _("MJPG-streamer")) + page.i18n = "mjpg-streamer" + page.dependent = true + +end diff --git a/applications/luci-mjpg-streamer/luasrc/model/cbi/mjpg-streamer.lua b/applications/luci-mjpg-streamer/luasrc/model/cbi/mjpg-streamer.lua new file mode 100644 index 000000000..1a627a6f3 --- /dev/null +++ b/applications/luci-mjpg-streamer/luasrc/model/cbi/mjpg-streamer.lua @@ -0,0 +1,235 @@ +--[[ + +LuCI MJPEG Streamer + +(c) 2014 Roger D +Based on work by: vargabab and OpenWrt Dreambox + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +]]-- + +m = Map("mjpg-streamer", "MJPG-streamer", translate("mjpg streamer is a streaming application for Linux-UVC compatible webcams")) + +--- General settings --- + +section_gen = m:section(TypedSection, "mjpg-streamer", "General") + section_gen.addremove=false + section_gen.anonymous=true + +enabled = section_gen:option(Flag, "enabled", "Enabled", "Enable MJPG-streamer") + +input = section_gen:option(ListValue, "input", "Input plugin") + input:depends("enabled", "1") + input:value("uvc", "UVC") + ---input:value("file", "File") + input.optional = false + +output = section_gen:option(ListValue, "output", "Output plugin") + output:depends("enabled", "1") + output:value("http", "HTTP") + output:value("file", "File") + output.optional = false + + +--- Plugin settings --- + +s = m:section(TypedSection, "mjpg-streamer", "Plugin settings") + s.addremove=false + s.anonymous=true + + s:tab("output_http", translate("HTTP output")) + s:tab("output_file", translate("File output")) + s:tab("input_uvc", translate("UVC input")) + ---s:tab("input_file", translate("File input")) + + +--- Input UVC settings --- + +this_tab = "input_uvc" + +device = s:taboption(this_tab, Value, "device", translate("Device")) + device.default="/dev/video0" + --device.datatype = "device" + device:value("/dev/video0", "/dev/video0") + device:value("/dev/video1", "/dev/video1") + device:value("/dev/video2", "/dev/video2") + device.optional = false + +resolution = s:taboption(this_tab, Value, "resolution", translate("Resolution")) + resolution.default = "640x480" + resolution:value("320x240", "320x240") + resolution:value("640x480", "640x480") + resolution:value("800x600", "800x600") + resolution:value("864x480", "864x480") + resolution:value("960x544", "960x544") + resolution:value("960x720", "960x720") + resolution:value("1280x720", "1280x720") + resolution:value("1280x960", "1280x960") + resolution:value("1920x1080", "1920x1080") + resolution.optional = true + +fps = s:taboption(this_tab, Value, "fps", translate("Frames per second")) + fps.datatype = "and(uinteger, min(1))" + fps.placeholder = "5" + fps.optional = true + +yuv = s:taboption(this_tab, Flag, "yuv", translate("Enable YUYV format"), translate("Automatic disabling of MJPEG mode")) + +quality = s:taboption(this_tab, Value, "quality", translate("JPEG compression quality"), translate("Set the quality in percent. This setting activates YUYV format, disables MJPEG")) + quality.datatype = "range(0, 100)" + +minimum_size = s:taboption(this_tab, Value, "minimum_size", translate("Drop frames smaller then this limit"),translate("Set the minimum size if the webcam produces small-sized garbage frames. May happen under low light conditions")) + minimum_size.datatype = "uinteger" + +no_dynctrl = s:taboption(this_tab, Flag, "no_dynctrl", translate("Don't initalize dynctrls"), translate("Do not initalize dynctrls of Linux-UVC driver")) + +led = s:taboption(this_tab, ListValue, "led", translate("Led control")) + led:value("on", translate("On")) + led:value("off", translate("Off")) + led:value("blink", translate("Blink")) + led:value("auto", translate("Auto")) + led.optional = true + + +--- Output HTTP settings --- + +this_tab = "output_http" + +port=s:taboption(this_tab, Value, "port", translate("Port"), translate("TCP port for this HTTP server")) + port.datatype = "port" + port.placeholder = "8080" + +enable_auth = s:taboption(this_tab, Flag, "enable_auth", translate("Authentication required"), translate("Ask for username and password on connect")) + enable_auth.default = false + +username = s:taboption(this_tab, Value, "username", translate("Username")) + username:depends("enable_auth", "1") + username.optional = false + +password = s:taboption(this_tab, Value, "password", translate("Password")) + password:depends("enable_auth", "1") + password.password = true + password.optional = false + password.default = false + +www = s:taboption(this_tab, Value, "www", translate("WWW folder"), translate("Folder that contains webpages")) + www.datatype = "directory" + www.default = "/www/webcam/" + www.optional = false + + +--- HTTP preview --- + +html = [[ + + +
+ +

Stream unavailable

+
+ + +]] + +preview = s:taboption(this_tab, DummyValue, "_dummy", html) + preview:depends("output", "http") + +--- Output file settings --- + +this_tab = "output_file" + +folder=s:taboption(this_tab, Value, "folder", translate("Folder"), translate("Set folder to save pictures")) + folder.placeholder="/tmp/images" + folder.datatype = "directory" + +--mjpeg=s:taboption(this_tab, Value, "mjpeg", translate("Mjpeg output"), translate("Check to save the stream to an mjpeg file")) + +delay=s:taboption(this_tab, Value, "delay", translate("Interval between saving pictures"), translate("Set the inteval in millisecond")) + delay.placeholder="5000" + delay.datatype = "uinteger" + +ringbuffer=s:taboption(this_tab, Value, "ringbuffer", translate("Ring buffer size"), translate("Max. number of pictures to hold")) + ringbuffer.placeholder="10" + ringbuffer.datatype = "uinteger" + +exceed=s:taboption(this_tab, Value, "exceed", translate("Exceed"), translate("Allow ringbuffer to exceed limit by this amount")) + exceed.datatype = "uinteger" + +command=s:taboption(this_tab, Value, "command", translate("Command to run"), translate("Execute command after saving picture. Mjpg-streamer parse the filename as first parameter to your script.")) + + +return m diff --git a/applications/luci-mjpg-streamer/root/etc/uci-defaults/luci-mjpg-streamer b/applications/luci-mjpg-streamer/root/etc/uci-defaults/luci-mjpg-streamer new file mode 100755 index 000000000..6a380cfe5 --- /dev/null +++ b/applications/luci-mjpg-streamer/root/etc/uci-defaults/luci-mjpg-streamer @@ -0,0 +1,11 @@ +#!/bin/sh + +uci -q batch <<-EOF >/dev/null + delete ucitrack.@mjpg-streamer[-1] + add ucitrack mjpg-streamer + set ucitrack.@mjpg-streamer[-1].init=mjpg-streamer + commit ucitrack +EOF + +rm -f /tmp/luci-indexcache +exit 0 diff --git a/contrib/package/luci-addons/Makefile b/contrib/package/luci-addons/Makefile index 859390cb2..1e4c31ed3 100644 --- a/contrib/package/luci-addons/Makefile +++ b/contrib/package/luci-addons/Makefile @@ -217,7 +217,7 @@ $(eval $(call application,shairplay,LuCI Support for Shairplay,shairplay)) $(eval $(call application,shairport,LuCI Support for Shairport,shairport)) $(eval $(call application,transmission,LuCI Support for Transmission,transmission-daemon)) $(eval $(call application,watchcat,LuCI Support for Watchcat,watchcat)) - +$(eval $(call application,mjpg-streamer,MJPG-Streamer service configuration module,mjpg-streamer)) ### Themes ### define theme diff --git a/po/templates/mjpg-streamer.pot b/po/templates/mjpg-streamer.pot new file mode 100644 index 000000000..5cd722f3a --- /dev/null +++ b/po/templates/mjpg-streamer.pot @@ -0,0 +1,135 @@ +msgid "" +msgstr "Content-Type: text/plain; charset=UTF-8" + +msgid "Allow ringbuffer to exceed limit by this amount" +msgstr "" + +msgid "Ask for username and password on connect" +msgstr "" + +msgid "Authentication required" +msgstr "" + +msgid "Auto" +msgstr "" + +msgid "Automatic disabling of MJPEG mode" +msgstr "" + +msgid "Blink" +msgstr "" + +msgid "Check to save the stream to an mjpeg file" +msgstr "" + +msgid "Command to run" +msgstr "" + +msgid "Device" +msgstr "" + +msgid "Do not initalize dynctrls of Linux-UVC driver" +msgstr "" + +msgid "Don't initalize dynctrls" +msgstr "" + +msgid "Drop frames smaller then this limit" +msgstr "" + +msgid "Enable YUYV format" +msgstr "" + +msgid "Exceed" +msgstr "" + +msgid "" +"Execute command after saving picture. Mjpg-streamer parse the filename as " +"first parameter to your script." +msgstr "" + +msgid "File input" +msgstr "" + +msgid "File output" +msgstr "" + +msgid "Folder" +msgstr "" + +msgid "Folder that contains webpages" +msgstr "" + +msgid "Frames per second" +msgstr "" + +msgid "HTTP output" +msgstr "" + +msgid "Interval between saving pictures" +msgstr "" + +msgid "JPEG compression quality" +msgstr "" + +msgid "Led control" +msgstr "" + +msgid "MJPG-streamer" +msgstr "" + +msgid "Max. number of pictures to hold" +msgstr "" + +msgid "Mjpeg output" +msgstr "" + +msgid "Off" +msgstr "" + +msgid "On" +msgstr "" + +msgid "Password" +msgstr "" + +msgid "Port" +msgstr "" + +msgid "Resolution" +msgstr "" + +msgid "Ring buffer size" +msgstr "" + +msgid "Set folder to save pictures" +msgstr "" + +msgid "Set the inteval in millisecond" +msgstr "" + +msgid "" +"Set the minimum size if the webcam produces small-sized garbage frames. May " +"happen under low light conditions" +msgstr "" + +msgid "" +"Set the quality in percent. This setting activates YUYV format, disables " +"MJPEG" +msgstr "" + +msgid "TCP port for this HTTP server" +msgstr "" + +msgid "UVC input" +msgstr "" + +msgid "Username" +msgstr "" + +msgid "WWW folder" +msgstr "" + +msgid "" +"mjpg streamer is a streaming application for Linux-UVC compatible webcams" +msgstr ""