mirror of
https://github.com/pikvm/ustreamer.git
synced 2026-03-16 20:43:42 +00:00
refactoring
This commit is contained in:
@@ -191,6 +191,13 @@ void encoder_prepare(struct encoder_t *encoder, struct device_t *dev) {
|
|||||||
A_MUTEX_UNLOCK(&ER(mutex));
|
A_MUTEX_UNLOCK(&ER(mutex));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void encoder_get_runtime_params(struct encoder_t *encoder, enum encoder_type_t *type, unsigned *quality) {
|
||||||
|
A_MUTEX_LOCK(&ER(mutex));
|
||||||
|
*type = ER(type);
|
||||||
|
*quality = ER(quality);
|
||||||
|
A_MUTEX_UNLOCK(&ER(mutex));
|
||||||
|
}
|
||||||
|
|
||||||
#pragma GCC diagnostic ignored "-Wunused-parameter"
|
#pragma GCC diagnostic ignored "-Wunused-parameter"
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
int encoder_compress_buffer(
|
int encoder_compress_buffer(
|
||||||
|
|||||||
@@ -109,6 +109,7 @@ enum encoder_type_t encoder_parse_type(const char *str);
|
|||||||
const char *encoder_type_to_string(enum encoder_type_t type);
|
const char *encoder_type_to_string(enum encoder_type_t type);
|
||||||
|
|
||||||
void encoder_prepare(struct encoder_t *encoder, struct device_t *dev);
|
void encoder_prepare(struct encoder_t *encoder, struct device_t *dev);
|
||||||
|
void encoder_get_runtime_params(struct encoder_t *encoder, enum encoder_type_t *type, unsigned *quality);
|
||||||
|
|
||||||
int encoder_compress_buffer(
|
int encoder_compress_buffer(
|
||||||
struct encoder_t *encoder, unsigned worker_number,
|
struct encoder_t *encoder, unsigned worker_number,
|
||||||
|
|||||||
@@ -394,17 +394,12 @@ static void _http_callback_static(struct evhttp_request *request, void *v_server
|
|||||||
static void _http_callback_state(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;
|
||||||
enum encoder_type_t encoder_run_type;
|
enum encoder_type_t encoder_type;
|
||||||
unsigned encoder_run_quality;
|
unsigned encoder_quality;
|
||||||
|
|
||||||
PREPROCESS_REQUEST;
|
PREPROCESS_REQUEST;
|
||||||
|
|
||||||
# define ER(_next) STREAM(encoder->run->_next)
|
encoder_get_runtime_params(STREAM(encoder), &encoder_type, &encoder_quality);
|
||||||
A_MUTEX_LOCK(&ER(mutex));
|
|
||||||
encoder_run_type = ER(type);
|
|
||||||
encoder_run_quality = ER(quality);
|
|
||||||
A_MUTEX_UNLOCK(&ER(mutex));
|
|
||||||
# undef ER
|
|
||||||
|
|
||||||
assert((buf = evbuffer_new()));
|
assert((buf = evbuffer_new()));
|
||||||
|
|
||||||
@@ -414,8 +409,8 @@ static void _http_callback_state(struct evhttp_request *request, void *v_server)
|
|||||||
" \"source\": {\"resolution\": {\"width\": %u, \"height\": %u},"
|
" \"source\": {\"resolution\": {\"width\": %u, \"height\": %u},"
|
||||||
" \"online\": %s, \"desired_fps\": %u, \"captured_fps\": %u},"
|
" \"online\": %s, \"desired_fps\": %u, \"captured_fps\": %u},"
|
||||||
" \"stream\": {\"queued_fps\": %u, \"clients\": %u, \"clients_stat\": {",
|
" \"stream\": {\"queued_fps\": %u, \"clients\": %u, \"clients_stat\": {",
|
||||||
encoder_type_to_string(encoder_run_type),
|
encoder_type_to_string(encoder_type),
|
||||||
encoder_run_quality,
|
encoder_quality,
|
||||||
(server->fake_width ? server->fake_width : EX(picture->width)),
|
(server->fake_width ? server->fake_width : EX(picture->width)),
|
||||||
(server->fake_height ? server->fake_height : EX(picture->height)),
|
(server->fake_height ? server->fake_height : EX(picture->height)),
|
||||||
bool_to_string(EX(online)),
|
bool_to_string(EX(online)),
|
||||||
|
|||||||
Reference in New Issue
Block a user