noop encoder

This commit is contained in:
Devaev Maxim
2020-12-07 21:54:05 +03:00
parent 07b712a46b
commit 7bb0aae71e
4 changed files with 35 additions and 7 deletions

View File

@@ -46,10 +46,13 @@ static const struct {
const char *name;
const enum encoder_type_t type;
} _ENCODER_TYPES[] = {
{"CPU", ENCODER_TYPE_CPU},
{"HW", ENCODER_TYPE_HW},
{"CPU", ENCODER_TYPE_CPU},
{"HW", ENCODER_TYPE_HW},
# ifdef WITH_OMX
{"OMX", ENCODER_TYPE_OMX},
{"OMX", ENCODER_TYPE_OMX},
# endif
# ifdef WITH_RAWSINK
{"NOOP", ENCODER_TYPE_NOOP},
# endif
};
@@ -183,6 +186,10 @@ void encoder_prepare(struct encoder_t *encoder, struct device_t *dev) {
ok:
if (quality == 0) {
LOG_INFO("Using JPEG quality: encoder default");
# ifdef WITH_RAWSINK
} else if (type == ENCODER_TYPE_NOOP) {
LOG_INFO("Using JPEG NOOP encoder");
# endif
} else {
LOG_INFO("Using JPEG quality: %u%%", quality);
}
@@ -221,6 +228,12 @@ int encoder_compress_buffer(struct encoder_t *encoder, struct device_t *dev, uns
}
}
# endif
# ifdef WITH_RAWSINK
else if (encoder->run->type == ENCODER_TYPE_NOOP) {
LOG_VERBOSE("Compressing buffer %u using NOOP (do nothing)", buf_index);
}
# endif
dev->run->pictures[buf_index]->encode_end_ts = get_now_monotonic();

View File

@@ -41,10 +41,17 @@
# define ENCODER_TYPES_OMX_HINT ""
#endif
#ifdef WITH_RAWSINK
# define ENCODER_TYPES_NOOP_HINT ", NOOP"
#else
# define ENCODER_TYPES_NOOP_HINT ""
#endif
#define ENCODER_TYPES_STR \
"CPU, HW" \
ENCODER_TYPES_OMX_HINT
ENCODER_TYPES_OMX_HINT \
ENCODER_TYPES_NOOP_HINT
enum encoder_type_t {
ENCODER_TYPE_UNKNOWN, // Only for encoder_parse_type() and main()
@@ -53,6 +60,9 @@ enum encoder_type_t {
# ifdef WITH_OMX
ENCODER_TYPE_OMX,
# endif
# ifdef WITH_RAWSINK
ENCODER_TYPE_NOOP,
# endif
};
struct encoder_runtime_t {

View File

@@ -619,11 +619,14 @@ static void _help(struct device_t *dev, struct encoder_t *encoder, struct http_s
printf(" for sources that already output MJPG.\n\n");
printf(" -c|--encoder <type> ───────────────── Use specified encoder. It may affect the number of workers.\n");
printf(" Available:\n");
printf(" * CPU ─ Software MJPG encoding (default);\n");
printf(" * CPU ─ Software MJPG encoding (default);\n");
# ifdef WITH_OMX
printf(" * OMX ─ GPU hardware accelerated MJPG encoding with OpenMax;\n");
printf(" * OMX ─ GPU hardware accelerated MJPG encoding with OpenMax;\n");
# endif
printf(" * HW ─── Use pre-encoded MJPG frames directly from camera hardware.\n");
# ifdef WITH_RAWSINK
printf(" * NOOP ─ Don't compress stream. Useful for the RAW sink.\n\n");
# endif
printf(" * HW ── Use pre-encoded MJPG frames directly from camera hardware.\n\n");
# ifdef WITH_OMX
printf(" -g|--glitched-resolutions <WxH,...> ─ Comma-separated list of resolutions that require forced\n");
printf(" encoding on CPU instead of OMX. Default: disabled.\n\n");