Skip to content

Commit 33a7deb

Browse files
committed
Adding ISP adjustments to the WebUI
1 parent a9d3db8 commit 33a7deb

3 files changed

Lines changed: 69 additions & 2 deletions

File tree

doc/config.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ This document describes the fields that can be found within a configuration file
117117
- **height**: Video height in pixels.
118118
- **fps**: Frames per second.
119119
- **bitrate**: Bitrate in kbps.
120+
- **qfactor**: JPEG compression quality factor.
120121

121122
## HTTP POST section
122123

@@ -128,4 +129,4 @@ This document describes the fields that can be found within a configuration file
128129
- **width**: Image width sent in pixels.
129130
- **height**: Image height sent in pixels.
130131
- **interval**: Interval between requests in seconds.
131-
- **qfactor**: JPEG compression quality factor for HTTP POST.
132+
- **qfactor**: JPEG compression quality factor.

res/index.html

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,37 @@ <h2 class="unl">Live</h2>
413413
<div class="c cont">
414414
<h2 class="unl">Media</h2>
415415
<div class="row">
416-
<div class="12 col box">
416+
<div class="6 col box">
417+
<fieldset>
418+
<legend>ISP adjustments</legend>
419+
<table class="w-100">
420+
<tr>
421+
<td><label for="isp_mirror">Mirror</label></td>
422+
<td><select id="isp_mirror">
423+
<option value="false">OFF</option>
424+
<option value="true">ON</option>
425+
</select></td>
426+
</tr>
427+
<tr>
428+
<td><label for="isp_flip">Flip</label></td>
429+
<td><select id="isp_flip">
430+
<option value="false">OFF</option>
431+
<option value="true">ON</option>
432+
</select></td>
433+
</tr>
434+
<tr>
435+
<td><label for="isp_antiflicker">Anti-flicker</label></td>
436+
<td><select id="isp_antiflicker">
437+
<option value="0">Disabled</option>
438+
<option value="50">50 Hz</option>
439+
<option value="60">60 Hz</option>
440+
</select></td>
441+
</tr>
442+
</table>
443+
<a href="javascript:apiApply('isp')" class="btn right">Apply</a>
444+
</fieldset>
445+
</div>
446+
<div class="6 col box">
417447
<fieldset>
418448
<legend>Recordings</legend>
419449
<table class="w-100">

src/server.c

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -901,6 +901,42 @@ void respond_request(http_request_t *req) {
901901
return;
902902
}
903903

904+
if (EQUALS(req->uri, "/api/isp")) {
905+
if (!EMPTY(req->query)) {
906+
char *remain;
907+
while (req->query) {
908+
char *value = split(&req->query, "&");
909+
if (!value || !*value) continue;
910+
unescape_uri(value);
911+
char *key = split(&value, "=");
912+
if (!key || !*key || !value || !*value) continue;
913+
if (EQUALS(key, "mirror")) {
914+
if (EQUALS_CASE(value, "true") || EQUALS(value, "1"))
915+
app_config.mirror = 1;
916+
else if (EQUALS_CASE(value, "false") || EQUALS(value, "0"))
917+
app_config.mirror = 0;
918+
} else if (EQUALS(key, "flip")) {
919+
if (EQUALS_CASE(value, "true") || EQUALS(value, "1"))
920+
app_config.flip = 1;
921+
else if (EQUALS_CASE(value, "false") || EQUALS(value, "0"))
922+
app_config.flip = 0;
923+
} else if (EQUALS(key, "antiflicker")) {
924+
app_config.antiflicker = strtol(value, &remain, 10);
925+
}
926+
}
927+
}
928+
respLen = sprintf(response,
929+
"HTTP/1.1 200 OK\r\n"
930+
"Content-Type: application/json;charset=UTF-8\r\n"
931+
"Connection: close\r\n"
932+
"\r\n"
933+
"{\"mirror\":%s, \"flip\":%s, \"antiflicker\":%d}",
934+
app_config.mirror ? "true" : "false", app_config.flip ? "true" : "false",
935+
app_config.antiflicker);
936+
send_and_close(req->clntFd, response, respLen);
937+
return;
938+
}
939+
904940
if (EQUALS(req->uri, "/api/jpeg")) {
905941
if (!EMPTY(req->query)) {
906942
char *remain;

0 commit comments

Comments
 (0)