mirror of
https://github.com/pikvm/ustreamer.git
synced 2026-03-17 13:03:43 +00:00
refactoring, html fixes
This commit is contained in:
6
Makefile
6
Makefile
@@ -29,8 +29,8 @@ install: $(PROG)
|
|||||||
|
|
||||||
|
|
||||||
regen:
|
regen:
|
||||||
tools/make-jpeg-h.py src/data/blank.jpeg src/data/blank.h BLANK 640 480
|
tools/make-jpeg-h.py src/data/blank.jpeg src/data/blank_jpeg.h BLANK 640 480
|
||||||
tools/make-html-h.py src/data/index.html src/data/html_index.h HTML_INDEX_PAGE
|
tools/make-html-h.py src/data/index.html src/data/index_html.h HTML_INDEX_PAGE
|
||||||
|
|
||||||
|
|
||||||
$(PROG): $(OBJECTS)
|
$(PROG): $(OBJECTS)
|
||||||
@@ -57,7 +57,7 @@ push:
|
|||||||
git push
|
git push
|
||||||
git push --tags
|
git push --tags
|
||||||
|
|
||||||
|
clean-all: clean
|
||||||
clean:
|
clean:
|
||||||
rm -f src/*.o src/{jpeg,omx}/*.o vgcore.* $(PROG)
|
rm -f src/*.o src/{jpeg,omx}/*.o vgcore.* $(PROG)
|
||||||
rm -rf pkg src/$(PROG)-* src/v*.tar.gz v*.tar.gz $(PROG)-*.pkg.tar.xz
|
rm -rf pkg src/$(PROG)-* src/v*.tar.gz v*.tar.gz $(PROG)-*.pkg.tar.xz
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset=\"utf-8\">
|
<meta charset="utf-8" />
|
||||||
<title>uStreamer</title>
|
<title>uStreamer</title>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
@@ -11,35 +11,35 @@
|
|||||||
<hr>
|
<hr>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<a href=\"/ping\"><b>/ping</b></a><br>
|
<a href="/ping"><b><samp>/ping</samp></b></a><br>
|
||||||
Get JSON structure with state of the server.
|
Get JSON structure with state of the server.
|
||||||
</li>
|
</li>
|
||||||
<br>
|
<br>
|
||||||
<li>
|
<li>
|
||||||
<a href=\"/snapshot\"><b>/snapshot</b></a><br>
|
<a href="/snapshot"><b><samp>/snapshot</samp></b></a><br>
|
||||||
Get a current actual image from server.
|
Get a current actual image from the server.
|
||||||
</li>
|
</li>
|
||||||
<br>
|
<br>
|
||||||
<li>
|
<li>
|
||||||
<a href=\"/stream\"><b>/stream</b></a><br>
|
<a href="/stream"><b><samp>/stream</samp></b></a><br>
|
||||||
Get a live stream. Query params:<br>
|
Get a live stream. Query params:<br>
|
||||||
<br>
|
<br>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<i>extra_headers=1</i><br>
|
<b><samp>extra_headers=1</samp></b><br>
|
||||||
Add X-UStreamer-* headers to /stream handle (like on <a href=\"/snapshot\">/snapshot</a>).
|
Add <samp>X-UStreamer-*</samp> headers to /stream handle (like on <a href="/snapshot"><samp>/snapshot</samp></a>).
|
||||||
</li>
|
</li>
|
||||||
<br>
|
<br>
|
||||||
<li>
|
<li>
|
||||||
<i>advance_headers=1</i><br>
|
<b><samp>advance_headers=1</samp></b><br>
|
||||||
Enable workaround for Chromium/Blink
|
Enable workaround for Chromium/Blink
|
||||||
<a href=\"https://bugs.chromium.org/p/chromium/issues/detail?id=527446\">Bug #527446</a>.
|
<a href="https://bugs.chromium.org/p/chromium/issues/detail?id=527446">Bug #527446</a>.
|
||||||
</li>
|
</li>
|
||||||
<br>
|
<br>
|
||||||
<li>
|
<li>
|
||||||
<i>dual_final_frames=1</i><br>
|
<b><samp>dual_final_frames=1</samp></b><br>
|
||||||
Enable workaround for Safari/WebKit bug when using option --drop-same-frames.<br>
|
Enable workaround for Safari/WebKit bug when using option <samp>--drop-same-frames</samp>.<br>
|
||||||
Without this option, when the frame series is completed, WebKit-based browser<br>
|
Without this option, when the frame series is completed, WebKit-based browsers<br>
|
||||||
renders the last one with a delay.
|
renders the last one with a delay.
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
@@ -48,6 +48,6 @@
|
|||||||
</ul>
|
</ul>
|
||||||
<br>
|
<br>
|
||||||
<hr>
|
<hr>
|
||||||
<a href=\"https://github.com/pi-kvm/ustreamer\">Sources & docs</a>
|
<a href="https://github.com/pi-kvm/ustreamer">Sources & docs</a>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ const char *HTML_INDEX_PAGE = " \
|
|||||||
\
|
\
|
||||||
<html> \
|
<html> \
|
||||||
<head> \
|
<head> \
|
||||||
<meta charset=\"utf-8\"> \
|
<meta charset=\"utf-8\" /> \
|
||||||
<title>uStreamer</title> \
|
<title>uStreamer</title> \
|
||||||
</head> \
|
</head> \
|
||||||
\
|
\
|
||||||
@@ -38,35 +38,35 @@ const char *HTML_INDEX_PAGE = " \
|
|||||||
<hr> \
|
<hr> \
|
||||||
<ul> \
|
<ul> \
|
||||||
<li> \
|
<li> \
|
||||||
<a href=\"/ping\"><b>/ping</b></a><br> \
|
<a href=\"/ping\"><b><samp>/ping</samp></b></a><br> \
|
||||||
Get JSON structure with state of the server. \
|
Get JSON structure with state of the server. \
|
||||||
</li> \
|
</li> \
|
||||||
<br> \
|
<br> \
|
||||||
<li> \
|
<li> \
|
||||||
<a href=\"/snapshot\"><b>/snapshot</b></a><br> \
|
<a href=\"/snapshot\"><b><samp>/snapshot</samp></b></a><br> \
|
||||||
Get a current actual image from server. \
|
Get a current actual image from the server. \
|
||||||
</li> \
|
</li> \
|
||||||
<br> \
|
<br> \
|
||||||
<li> \
|
<li> \
|
||||||
<a href=\"/stream\"><b>/stream</b></a><br> \
|
<a href=\"/stream\"><b><samp>/stream</samp></b></a><br> \
|
||||||
Get a live stream. Query params:<br> \
|
Get a live stream. Query params:<br> \
|
||||||
<br> \
|
<br> \
|
||||||
<ul> \
|
<ul> \
|
||||||
<li> \
|
<li> \
|
||||||
<i>extra_headers=1</i><br> \
|
<b><samp>extra_headers=1</samp></b><br> \
|
||||||
Add X-UStreamer-* headers to /stream handle (like on <a href=\"/snapshot\">/snapshot</a>). \
|
Add <samp>X-UStreamer-*</samp> headers to /stream handle (like on <a href=\"/snapshot\"><samp>/snapshot</samp></a>). \
|
||||||
</li> \
|
</li> \
|
||||||
<br> \
|
<br> \
|
||||||
<li> \
|
<li> \
|
||||||
<i>advance_headers=1</i><br> \
|
<b><samp>advance_headers=1</samp></b><br> \
|
||||||
Enable workaround for Chromium/Blink \
|
Enable workaround for Chromium/Blink \
|
||||||
<a href=\"https://bugs.chromium.org/p/chromium/issues/detail?id=527446\">Bug #527446</a>. \
|
<a href=\"https://bugs.chromium.org/p/chromium/issues/detail?id=527446\">Bug #527446</a>. \
|
||||||
</li> \
|
</li> \
|
||||||
<br> \
|
<br> \
|
||||||
<li> \
|
<li> \
|
||||||
<i>dual_final_frames=1</i><br> \
|
<b><samp>dual_final_frames=1</samp></b><br> \
|
||||||
Enable workaround for Safari/WebKit bug when using option --drop-same-frames.<br> \
|
Enable workaround for Safari/WebKit bug when using option <samp>--drop-same-frames</samp>.<br> \
|
||||||
Without this option, when the frame series is completed, WebKit-based browser<br> \
|
Without this option, when the frame series is completed, WebKit-based browsers<br> \
|
||||||
renders the last one with a delay. \
|
renders the last one with a delay. \
|
||||||
</li> \
|
</li> \
|
||||||
</ul> \
|
</ul> \
|
||||||
14
src/http.c
14
src/http.c
@@ -43,8 +43,8 @@
|
|||||||
#include "stream.h"
|
#include "stream.h"
|
||||||
#include "http.h"
|
#include "http.h"
|
||||||
|
|
||||||
#include "data/html_index.h"
|
#include "data/index_html.h"
|
||||||
#include "data/blank.h"
|
#include "data/blank_jpeg.h"
|
||||||
|
|
||||||
|
|
||||||
static bool _http_get_param_true(struct evkeyvalq *params, const char *key);
|
static bool _http_get_param_true(struct evkeyvalq *params, const char *key);
|
||||||
@@ -192,7 +192,7 @@ static void _http_callback_ping(struct evhttp_request *request, void *v_server)
|
|||||||
" \"stream\": {\"queued_fps\": %u, \"clients\": %u, \"clients_stat\": {",
|
" \"stream\": {\"queued_fps\": %u, \"clients\": %u, \"clients_stat\": {",
|
||||||
(server->fake_width ? server->fake_width : server->run->exposed->width),
|
(server->fake_width ? server->fake_width : server->run->exposed->width),
|
||||||
(server->fake_height ? server->fake_height : server->run->exposed->height),
|
(server->fake_height ? server->fake_height : server->run->exposed->height),
|
||||||
(server->run->exposed->online ? "true" : "false"),
|
bool_to_string(server->run->exposed->online),
|
||||||
server->run->stream->encoder->quality,
|
server->run->stream->encoder->quality,
|
||||||
server->run->exposed->captured_fps,
|
server->run->exposed->captured_fps,
|
||||||
server->run->exposed->queued_fps,
|
server->run->exposed->queued_fps,
|
||||||
@@ -203,8 +203,8 @@ static void _http_callback_ping(struct evhttp_request *request, void *v_server)
|
|||||||
"\"%s\": {\"fps\": %u, \"advance_headers\": %s, \"dual_final_frames\": %s}%s",
|
"\"%s\": {\"fps\": %u, \"advance_headers\": %s, \"dual_final_frames\": %s}%s",
|
||||||
client->id,
|
client->id,
|
||||||
client->fps,
|
client->fps,
|
||||||
(client->advance_headers ? "true" : "false"),
|
bool_to_string(client->advance_headers),
|
||||||
(client->dual_final_frames ? "true" : "false"),
|
bool_to_string(client->dual_final_frames),
|
||||||
(client->next ? ", " : "")
|
(client->next ? ", " : "")
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
@@ -237,7 +237,7 @@ static void _http_callback_snapshot(struct evhttp_request *request, void *v_serv
|
|||||||
|
|
||||||
ADD_TIME_HEADER("X-Timestamp", get_now_real());
|
ADD_TIME_HEADER("X-Timestamp", get_now_real());
|
||||||
|
|
||||||
ADD_HEADER("X-UStreamer-Online", (EXPOSED(online) ? "true" : "false"));
|
ADD_HEADER("X-UStreamer-Online", bool_to_string(EXPOSED(online)));
|
||||||
ADD_TIME_HEADER("X-UStreamer-Grab-Time", EXPOSED(picture.grab_time));
|
ADD_TIME_HEADER("X-UStreamer-Grab-Time", EXPOSED(picture.grab_time));
|
||||||
ADD_TIME_HEADER("X-UStreamer-Encode-Begin-Time", EXPOSED(picture.encode_begin_time));
|
ADD_TIME_HEADER("X-UStreamer-Encode-Begin-Time", EXPOSED(picture.encode_begin_time));
|
||||||
ADD_TIME_HEADER("X-UStreamer-Encode-End-Time", EXPOSED(picture.encode_end_time));
|
ADD_TIME_HEADER("X-UStreamer-Encode-End-Time", EXPOSED(picture.encode_end_time));
|
||||||
@@ -406,7 +406,7 @@ static void _http_callback_stream_write(struct bufferevent *buf_event, void *v_c
|
|||||||
"X-UStreamer-Expose-End-Time: %.06Lf" RN
|
"X-UStreamer-Expose-End-Time: %.06Lf" RN
|
||||||
"X-UStreamer-Send-Time: %.06Lf" RN
|
"X-UStreamer-Send-Time: %.06Lf" RN
|
||||||
RN,
|
RN,
|
||||||
(EXPOSED(online) ? "true" : "false"),
|
bool_to_string(EXPOSED(online)),
|
||||||
client->fps,
|
client->fps,
|
||||||
EXPOSED(picture.grab_time),
|
EXPOSED(picture.grab_time),
|
||||||
EXPOSED(picture.encode_begin_time),
|
EXPOSED(picture.encode_begin_time),
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <stdbool.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
@@ -57,6 +58,10 @@
|
|||||||
#define UNUSED __attribute__((unused))
|
#define UNUSED __attribute__((unused))
|
||||||
|
|
||||||
|
|
||||||
|
INLINE char *bool_to_string(const bool flag) {
|
||||||
|
return (flag ? "true" : "false");
|
||||||
|
}
|
||||||
|
|
||||||
INLINE unsigned max_u(unsigned a, unsigned b) {
|
INLINE unsigned max_u(unsigned a, unsigned b) {
|
||||||
return (a > b ? a : b);
|
return (a > b ? a : b);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ def main():
|
|||||||
text = html_file.read()
|
text = html_file.read()
|
||||||
|
|
||||||
text = text.strip()
|
text = text.strip()
|
||||||
|
text = text.replace("\"", "\\\"")
|
||||||
text = text.replace("%VERSION%", "\" VERSION \"")
|
text = text.replace("%VERSION%", "\" VERSION \"")
|
||||||
text = textwrap.indent(text, "\t", (lambda line: True))
|
text = textwrap.indent(text, "\t", (lambda line: True))
|
||||||
text = "\n".join(("%s \\" if line.strip() else "%s\\") % (line) for line in text.split("\n"))
|
text = "\n".join(("%s \\" if line.strip() else "%s\\") % (line) for line in text.split("\n"))
|
||||||
|
|||||||
Reference in New Issue
Block a user