Skip to content

Commit ce95ce2

Browse files
committed
Add webcontrol for individual cameras
1 parent e87f72c commit ce95ce2

13 files changed

Lines changed: 290 additions & 191 deletions

doc/motion_config.html

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -441,30 +441,29 @@ <h2><a name="Configuration_OptionsTopic"></a> Configuration Options-Listed by T
441441
<tbody>
442442
<tr>
443443
<td bgcolor="#edf4f9" ><a href="#webcontrol_port" >webcontrol_port</a> </td>
444-
<td bgcolor="#edf4f9" ><a href="#webcontrol_port2" >webcontrol_port2</a> </td>
445444
<td bgcolor="#edf4f9" ><a href="#webcontrol_ipv6" >webcontrol_ipv6</a> </td>
446445
<td bgcolor="#edf4f9" ><a href="#webcontrol_localhost" >webcontrol_localhost</a> </td>
446+
<td bgcolor="#edf4f9" ><a href="#webcontrol_parms" >webcontrol_parms</a> </td>
447447
</tr>
448448
<tr>
449-
<td bgcolor="#edf4f9" ><a href="#webcontrol_parms" >webcontrol_parms</a> </td>
450449
<td bgcolor="#edf4f9" ><a href="#webcontrol_interface" >webcontrol_interface</a> </td>
451450
<td bgcolor="#edf4f9" ><a href="#webcontrol_auth_method" >webcontrol_auth_method</a> </td>
452451
<td bgcolor="#edf4f9" ><a href="#webcontrol_authentication" >webcontrol_authentication</a> </td>
452+
<td bgcolor="#edf4f9" ><a href="#webcontrol_tls" >webcontrol_tls</a> </td>
453453
</tr>
454454
<tr>
455-
<td bgcolor="#edf4f9" ><a href="#webcontrol_tls" >webcontrol_tls</a> </td>
456455
<td bgcolor="#edf4f9" ><a href="#webcontrol_cert" >webcontrol_cert</a> </td>
457456
<td bgcolor="#edf4f9" ><a href="#webcontrol_key" >webcontrol_key</a> </td>
458457
<td bgcolor="#edf4f9" ><a href="#webcontrol_headers" >webcontrol_headers</a> </td>
458+
<td bgcolor="#edf4f9" ><a href="#webcontrol_actions" >webcontrol_actions</a> </td>
459459
</tr>
460460
<tr>
461-
<td bgcolor="#edf4f9" ><a href="#webcontrol_actions" >webcontrol_actions</a> </td>
462461
<td bgcolor="#edf4f9" ><a href="#webcontrol_html" >webcontrol_html</a> </td>
463462
<td bgcolor="#edf4f9" ><a href="#webcontrol_base_path" >webcontrol_base_path</a> </td>
464463
<td bgcolor="#edf4f9" ><a href="#webcontrol_lock_attempts" >webcontrol_lock_attempts</a> </td>
464+
<td bgcolor="#edf4f9" ><a href="#webcontrol_lock_minutes" >webcontrol_lock_minutes</a> </td>
465465
</tr>
466466
<tr>
467-
<td bgcolor="#edf4f9" ><a href="#webcontrol_lock_minutes" >webcontrol_lock_minutes</a> </td>
468467
<td bgcolor="#edf4f9" ><a href="#webcontrol_lock_script" >webcontrol_lock_script</a> </td>
469468
</tr>
470469
</tbody>
@@ -2353,7 +2352,15 @@ <h3><a name="video_pipe_motion"></a> video_pipe_motion </h3>
23532352

23542353
<h3><a name="OptDetail_Webcontrol"></a>Web Control</a> </h3>
23552354
<p></p>
2356-
These options must be placed in the Motion.conf file and not in a camera config files.
2355+
These options may be placed in the motion.conf or camera.conf files.
2356+
When the same port is specified in multiple camera.conf files, then
2357+
all the cameras specified will be available. Note that if other
2358+
webcontrol parameters differ between camera files, Motion will only
2359+
select one of those sets to use for that port. For example, if
2360+
camera1.conf and camera2.conf both specify webcontrol_port 8081 but
2361+
camera1.conf and camera2.conf have different webcontrol_authentication
2362+
parameters, then Motion will only use EITHER the one in camera1.conf
2363+
OR the one in camera2.conf. Which one it uses is random.
23572364
<ul>
23582365
<h3><a name="webcontrol_port"></a> webcontrol_port </h3>
23592366
<ul>
@@ -2362,15 +2369,6 @@ <h3><a name="webcontrol_port"></a> webcontrol_port </h3>
23622369
</ul>
23632370
<p></p>
23642371

2365-
<h3><a name="webcontrol_port2"></a> webcontrol_port2 </h3>
2366-
<ul>
2367-
<li>Values: 0 to 65535 | Default: 0 (disabled)</li>
2368-
Second port for the web interface that does not use TLS. This allows for specifying one port that
2369-
provides a TLS connection (to be used externally) while this port serves the local lan without getting
2370-
certificate domain warnings.
2371-
</ul>
2372-
<p></p>
2373-
23742372
<h3><a name="webcontrol_ipv6"></a> webcontrol_ipv6 </h3>
23752373
<ul>
23762374
<li> Values: on, off | Default: off</li>

doc/motion_examples.html

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,48 @@ <h3><a name="database_setup"></a>Database Setup</h3>
268268

269269
<h3><a name="webcontrol_pages"></a>Webcontrol pages</h3>
270270
<ul>
271+
<li>The Motion webcontrol and live stream feeds are available by specifying
272+
the <code>webcontrol_port</code> along with other
273+
webcontrol / stream parameters in the motion.conf and camera.conf
274+
files.
275+
<p></p>
276+
Motion allows for running multiple ports at the same
277+
time to suit the needs of the user. By default, Motion will specify
278+
just a single port in the <code>motion.conf</code> file and that will
279+
provide control and access to all the cameras on that port. Users
280+
can control which configuration parameters can be updated or changed
281+
using the <code>webcontrol_parms</code> configuration option and also
282+
change which actions are permitted using the
283+
<code>webcontrol_actions</code> configuration option.
284+
<p></p>
285+
If the user wishes to have different options for each camera then
286+
a different <code>webcontrol_port</code> can be specified in the
287+
<code>camera.conf</code> files. If the same port is specified in
288+
multiple <code>camera.conf</code> files then all of the cameras
289+
with the same port will be available on that port. Additionally,
290+
the other webcontrol and stream parameters can also be specified and
291+
applied so that different limits on changes to parameters or actions
292+
would apply.
293+
<p></p>
294+
The following example illustrates having all the cameras available
295+
and being able to be controlled on port 8080 but on port 8081
296+
the user would only be able to view the parameters and perform
297+
actions since the webcontrol_parms was set to zero. </li>
298+
<code>motion.conf</code>
299+
<ul>
300+
<li><code>webcontrol_port 8080</code></li>
301+
<li><code>webcontrol_parms 3</code></li>
302+
</ul>
303+
<code>camera1.conf</code>
304+
<ul>
305+
<li><code>webcontrol_port 8081</code></li>
306+
<li><code>webcontrol_parms 0</code></li>
307+
</ul>
308+
<p></p>
309+
The following illustrates the availble streams
310+
and feeds provided by Motion.
311+
<p></p>
271312
<li><code>{IP}:{port0}/</code> Home html page with streams for all cameras</li>
272-
273313
The following JSON pages are available via the webcontrol.
274314
<ul>
275315
<li><code>{IP}:{port0}/0/config.json</code> JSON object with the configuration information for all cameras</li>

src/conf.cpp

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,6 @@ ctx_parm config_parms[] = {
154154
{"video_pipe_motion", PARM_TYP_STRING, PARM_CAT_12, PARM_LEVEL_LIMITED },
155155

156156
{"webcontrol_port", PARM_TYP_INT, PARM_CAT_13, PARM_LEVEL_ADVANCED },
157-
{"webcontrol_port2", PARM_TYP_INT, PARM_CAT_13, PARM_LEVEL_ADVANCED },
158157
{"webcontrol_base_path", PARM_TYP_STRING, PARM_CAT_13, PARM_LEVEL_ADVANCED },
159158
{"webcontrol_ipv6", PARM_TYP_BOOL, PARM_CAT_13, PARM_LEVEL_ADVANCED },
160159
{"webcontrol_localhost", PARM_TYP_BOOL, PARM_CAT_13, PARM_LEVEL_ADVANCED },
@@ -2302,25 +2301,6 @@ void cls_config::edit_webcontrol_port(std::string &parm, enum PARM_ACT pact)
23022301
MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","webcontrol_port",_("webcontrol_port"));
23032302
}
23042303

2305-
void cls_config::edit_webcontrol_port2(std::string &parm, enum PARM_ACT pact)
2306-
{
2307-
int parm_in;
2308-
if (pact == PARM_ACT_DFLT) {
2309-
webcontrol_port2 = 0;
2310-
} else if (pact == PARM_ACT_SET) {
2311-
parm_in = atoi(parm.c_str());
2312-
if ((parm_in < 0) || (parm_in > 65535)) {
2313-
MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid webcontrol_port2 %d"),parm_in);
2314-
} else {
2315-
webcontrol_port2 = parm_in;
2316-
}
2317-
} else if (pact == PARM_ACT_GET) {
2318-
parm = std::to_string(webcontrol_port2);
2319-
}
2320-
return;
2321-
MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","webcontrol_port2",_("webcontrol_port2"));
2322-
}
2323-
23242304
void cls_config::edit_webcontrol_base_path(std::string &parm, enum PARM_ACT pact)
23252305
{
23262306
if (pact == PARM_ACT_DFLT) {
@@ -3354,7 +3334,6 @@ void cls_config::edit_cat12(std::string parm_nm, std::string &parm_val, enum PAR
33543334
void cls_config::edit_cat13(std::string parm_nm, std::string &parm_val, enum PARM_ACT pact)
33553335
{
33563336
if (parm_nm == "webcontrol_port") { edit_webcontrol_port(parm_val, pact);
3357-
} else if (parm_nm == "webcontrol_port2") { edit_webcontrol_port2(parm_val, pact);
33583337
} else if (parm_nm == "webcontrol_base_path") { edit_webcontrol_base_path(parm_val, pact);
33593338
} else if (parm_nm == "webcontrol_ipv6") { edit_webcontrol_ipv6(parm_val, pact);
33603339
} else if (parm_nm == "webcontrol_localhost") { edit_webcontrol_localhost(parm_val, pact);

src/conf.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,6 @@
223223

224224
/* Webcontrol configuration parameters */
225225
int webcontrol_port;
226-
int webcontrol_port2;
227226
std::string webcontrol_base_path;
228227
bool webcontrol_ipv6;
229228
bool webcontrol_localhost;
@@ -482,7 +481,6 @@
482481
void edit_webcontrol_lock_script(std::string &parm, enum PARM_ACT pact);
483482
void edit_webcontrol_parms(std::string &parm, enum PARM_ACT pact);
484483
void edit_webcontrol_port(std::string &parm, enum PARM_ACT pact);
485-
void edit_webcontrol_port2(std::string &parm, enum PARM_ACT pact);
486484
void edit_webcontrol_tls(std::string &parm, enum PARM_ACT pact);
487485

488486
void edit_stream_grey(std::string &parm, enum PARM_ACT pact);

0 commit comments

Comments
 (0)