mirror of
https://github.com/pikvm/ustreamer.git
synced 2026-02-27 20:26:31 +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));
|
||||
}
|
||||
|
||||
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 push
|
||||
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);
|
||||
|
||||
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(
|
||||
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) {
|
||||
struct http_server_t *server = (struct http_server_t *)v_server;
|
||||
struct evbuffer *buf;
|
||||
enum encoder_type_t encoder_run_type;
|
||||
unsigned encoder_run_quality;
|
||||
enum encoder_type_t encoder_type;
|
||||
unsigned encoder_quality;
|
||||
|
||||
PREPROCESS_REQUEST;
|
||||
|
||||
# define ER(_next) STREAM(encoder->run->_next)
|
||||
A_MUTEX_LOCK(&ER(mutex));
|
||||
encoder_run_type = ER(type);
|
||||
encoder_run_quality = ER(quality);
|
||||
A_MUTEX_UNLOCK(&ER(mutex));
|
||||
# undef ER
|
||||
encoder_get_runtime_params(STREAM(encoder), &encoder_type, &encoder_quality);
|
||||
|
||||
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},"
|
||||
" \"online\": %s, \"desired_fps\": %u, \"captured_fps\": %u},"
|
||||
" \"stream\": {\"queued_fps\": %u, \"clients\": %u, \"clients_stat\": {",
|
||||
encoder_type_to_string(encoder_run_type),
|
||||
encoder_run_quality,
|
||||
encoder_type_to_string(encoder_type),
|
||||
encoder_quality,
|
||||
(server->fake_width ? server->fake_width : EX(picture->width)),
|
||||
(server->fake_height ? server->fake_height : EX(picture->height)),
|
||||
bool_to_string(EX(online)),
|
||||
|
||||
Reference in New Issue
Block a user