/ping -> /state; some docs

This commit is contained in:
Devaev Maxim
2018-11-07 05:59:48 +03:00
parent b1d40d1b3a
commit ed7dabbfcb
4 changed files with 22 additions and 10 deletions

View File

@@ -11,7 +11,7 @@
<hr> <hr>
<ul> <ul>
<li> <li>
<a href="/ping"><b><samp>/ping</samp></b></a><br> <a href="/state"><b><samp>/state</samp></b></a><br>
Get JSON structure with state of the server. Get JSON structure with state of the server.
</li> </li>
<br> <br>
@@ -25,6 +25,12 @@
Get a live stream. Query params:<br> Get a live stream. Query params:<br>
<br> <br>
<ul> <ul>
<li>
<b><samp>key=abc123</samp></b><br>
User-defined key, which is part of cookie <samp>stream_client</samp>, which allows<br>
the stream client to determine its identifier and view statistics using <a href="/state"><samp>/state</samp></a>.
</li>
<br>
<li> <li>
<b><samp>extra_headers=1</samp></b><br> <b><samp>extra_headers=1</samp></b><br>
Add <samp>X-UStreamer-*</samp> headers to /stream handle (like on <a href="/snapshot"><samp>/snapshot</samp></a>). Add <samp>X-UStreamer-*</samp> headers to /stream handle (like on <a href="/snapshot"><samp>/snapshot</samp></a>).
@@ -40,7 +46,7 @@
<b><samp>dual_final_frames=1</samp></b><br> <b><samp>dual_final_frames=1</samp></b><br>
Enable workaround for Safari/WebKit bug when using option <samp>--drop-same-frames</samp>.<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 browsers<br> Without this option, when the frame series is completed, WebKit-based browsers<br>
renders the last one with a delay. renders the last frame with a delay.
</li> </li>
</ul> </ul>
</li> </li>

View File

@@ -38,7 +38,7 @@ const char *HTML_INDEX_PAGE = " \
<hr> \ <hr> \
<ul> \ <ul> \
<li> \ <li> \
<a href=\"/ping\"><b><samp>/ping</samp></b></a><br> \ <a href=\"/state\"><b><samp>/state</samp></b></a><br> \
Get JSON structure with state of the server. \ Get JSON structure with state of the server. \
</li> \ </li> \
<br> \ <br> \
@@ -52,6 +52,12 @@ const char *HTML_INDEX_PAGE = " \
Get a live stream. Query params:<br> \ Get a live stream. Query params:<br> \
<br> \ <br> \
<ul> \ <ul> \
<li> \
<b><samp>key=abc123</samp></b><br> \
User-defined key, which is part of cookie <samp>stream_client</samp>, which allows<br> \
the stream client to determine its identifier and view statistics using <a href=\"/state\"><samp>/state</samp></a>. \
</li> \
<br> \
<li> \ <li> \
<b><samp>extra_headers=1</samp></b><br> \ <b><samp>extra_headers=1</samp></b><br> \
Add <samp>X-UStreamer-*</samp> headers to /stream handle (like on <a href=\"/snapshot\"><samp>/snapshot</samp></a>). \ Add <samp>X-UStreamer-*</samp> headers to /stream handle (like on <a href=\"/snapshot\"><samp>/snapshot</samp></a>). \
@@ -67,7 +73,7 @@ const char *HTML_INDEX_PAGE = " \
<b><samp>dual_final_frames=1</samp></b><br> \ <b><samp>dual_final_frames=1</samp></b><br> \
Enable workaround for Safari/WebKit bug when using option <samp>--drop-same-frames</samp>.<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 browsers<br> \ Without this option, when the frame series is completed, WebKit-based browsers<br> \
renders the last one with a delay. \ renders the last frame with a delay. \
</li> \ </li> \
</ul> \ </ul> \
</li> \ </li> \

View File

@@ -51,7 +51,7 @@ static bool _http_get_param_true(struct evkeyvalq *params, const char *key);
static char *_http_get_param_uri(struct evkeyvalq *params, const char *key); static char *_http_get_param_uri(struct evkeyvalq *params, const char *key);
static void _http_callback_root(struct evhttp_request *request, void *arg); static void _http_callback_root(struct evhttp_request *request, void *arg);
static void _http_callback_ping(struct evhttp_request *request, void *v_server); static void _http_callback_state(struct evhttp_request *request, void *v_server);
static void _http_callback_snapshot(struct evhttp_request *request, void *v_server); static void _http_callback_snapshot(struct evhttp_request *request, void *v_server);
static void _http_callback_stream(struct evhttp_request *request, void *v_server); static void _http_callback_stream(struct evhttp_request *request, void *v_server);
@@ -91,7 +91,7 @@ struct http_server_t *http_server_init(struct stream_t *stream) {
evhttp_set_allowed_methods(run->http, EVHTTP_REQ_GET|EVHTTP_REQ_HEAD); evhttp_set_allowed_methods(run->http, EVHTTP_REQ_GET|EVHTTP_REQ_HEAD);
assert(!evhttp_set_cb(run->http, "/", _http_callback_root, NULL)); assert(!evhttp_set_cb(run->http, "/", _http_callback_root, NULL));
assert(!evhttp_set_cb(run->http, "/ping", _http_callback_ping, (void *)server)); assert(!evhttp_set_cb(run->http, "/state", _http_callback_state, (void *)server));
assert(!evhttp_set_cb(run->http, "/snapshot", _http_callback_snapshot, (void *)server)); assert(!evhttp_set_cb(run->http, "/snapshot", _http_callback_snapshot, (void *)server));
assert(!evhttp_set_cb(run->http, "/stream", _http_callback_stream, (void *)server)); assert(!evhttp_set_cb(run->http, "/stream", _http_callback_stream, (void *)server));
@@ -189,7 +189,7 @@ static void _http_callback_root(struct evhttp_request *request, UNUSED void *arg
evbuffer_free(buf); evbuffer_free(buf);
} }
static void _http_callback_ping(struct evhttp_request *request, void *v_server) { static void _http_callback_state(struct evhttp_request *request, void *v_server) {
struct http_server_t *server = (struct http_server_t *)v_server; struct http_server_t *server = (struct http_server_t *)v_server;
struct evbuffer *buf; struct evbuffer *buf;

View File

@@ -135,8 +135,8 @@ static void _help(struct device_t *dev, struct encoder_t *encoder, struct http_s
printf(" It can significantly reduce the outgoing traffic, but will increase\n"); printf(" It can significantly reduce the outgoing traffic, but will increase\n");
printf(" the CPU loading. Don't use this option with analog signal sources\n"); printf(" the CPU loading. Don't use this option with analog signal sources\n");
printf(" or webcams, it's useless. Default: disabled.\n\n"); printf(" or webcams, it's useless. Default: disabled.\n\n");
printf(" --fake-width <N> -- Override image width for /ping. Default: disabled\n\n"); printf(" --fake-width <N> -- Override image width for /state. Default: disabled\n\n");
printf(" --fake-height <N> -- Override image height for /ping. Default: disabled.\n\n"); printf(" --fake-height <N> -- Override image height for /state. Default: disabled.\n\n");
printf(" --server-timeout <seconds> -- Timeout for client connections. Default: %d\n\n", server->timeout); printf(" --server-timeout <seconds> -- Timeout for client connections. Default: %d\n\n", server->timeout);
printf("Misc options:\n"); printf("Misc options:\n");
printf("-------------\n"); printf("-------------\n");