mirror of
https://github.com/pikvm/ustreamer.git
synced 2026-03-18 05:23:43 +00:00
removed option --glitched-resolutions
This commit is contained in:
@@ -111,15 +111,9 @@ void encoder_prepare(encoder_s *enc, device_s *dev) {
|
|||||||
}
|
}
|
||||||
# ifdef WITH_OMX
|
# ifdef WITH_OMX
|
||||||
else if (type == ENCODER_TYPE_OMX) {
|
else if (type == ENCODER_TYPE_OMX) {
|
||||||
for (unsigned index = 0; index < enc->n_glitched_resolutions; ++index) {
|
if (align_size(DR(width), 32) != DR(width) || align_size(DR(height), 16) != DR(height)) {
|
||||||
if (
|
LOG_INFO("Switching to CPU encoder because OMX can't handle %ux%u", DR(width), DR(height));
|
||||||
enc->glitched_resolutions[index][0] == DR(width)
|
goto use_cpu;
|
||||||
&& enc->glitched_resolutions[index][1] == DR(height)
|
|
||||||
) {
|
|
||||||
LOG_INFO("Switching to CPU encoder the resolution %ux%u marked as glitchy for OMX",
|
|
||||||
DR(width), DR(height));
|
|
||||||
goto use_cpu;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_DEBUG("Preparing OMX encoder ...");
|
LOG_DEBUG("Preparing OMX encoder ...");
|
||||||
|
|||||||
@@ -43,10 +43,6 @@
|
|||||||
#ifdef WITH_OMX
|
#ifdef WITH_OMX
|
||||||
# include "encoders/omx/encoder.h"
|
# include "encoders/omx/encoder.h"
|
||||||
# define ENCODER_TYPES_OMX_HINT ", OMX"
|
# define ENCODER_TYPES_OMX_HINT ", OMX"
|
||||||
# ifndef CFG_MAX_GLITCHED_RESOLUTIONS
|
|
||||||
# define CFG_MAX_GLITCHED_RESOLUTIONS 1024
|
|
||||||
# endif
|
|
||||||
# define MAX_GLITCHED_RESOLUTIONS ((unsigned)(CFG_MAX_GLITCHED_RESOLUTIONS))
|
|
||||||
#else
|
#else
|
||||||
# define ENCODER_TYPES_OMX_HINT ""
|
# define ENCODER_TYPES_OMX_HINT ""
|
||||||
#endif
|
#endif
|
||||||
@@ -84,10 +80,6 @@ typedef struct {
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
encoder_type_e type;
|
encoder_type_e type;
|
||||||
unsigned n_workers;
|
unsigned n_workers;
|
||||||
# ifdef WITH_OMX
|
|
||||||
unsigned n_glitched_resolutions;
|
|
||||||
unsigned glitched_resolutions[2][MAX_GLITCHED_RESOLUTIONS];
|
|
||||||
# endif
|
|
||||||
|
|
||||||
encoder_runtime_s *run;
|
encoder_runtime_s *run;
|
||||||
} encoder_s;
|
} encoder_s;
|
||||||
|
|||||||
@@ -206,9 +206,6 @@ static const struct option _LONG_OPTS[] = {
|
|||||||
|
|
||||||
|
|
||||||
static int _parse_resolution(const char *str, unsigned *width, unsigned *height, bool limited);
|
static int _parse_resolution(const char *str, unsigned *width, unsigned *height, bool limited);
|
||||||
#ifdef WITH_OMX
|
|
||||||
static int _parse_glitched_resolutions(const char *str, encoder_s *enc);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void _features(void);
|
static void _features(void);
|
||||||
static void _help(FILE *fp, device_s *dev, encoder_s *enc, stream_s *stream, server_s *server);
|
static void _help(FILE *fp, device_s *dev, encoder_s *enc, stream_s *stream, server_s *server);
|
||||||
@@ -357,11 +354,7 @@ int options_parse(options_s *options, device_s *dev, encoder_s *enc, stream_s *s
|
|||||||
case _O_QUALITY: OPT_NUMBER("--quality", dev->jpeg_quality, 1, 100, 0);
|
case _O_QUALITY: OPT_NUMBER("--quality", dev->jpeg_quality, 1, 100, 0);
|
||||||
case _O_ENCODER: OPT_PARSE("encoder type", enc->type, encoder_parse_type, ENCODER_TYPE_UNKNOWN, ENCODER_TYPES_STR);
|
case _O_ENCODER: OPT_PARSE("encoder type", enc->type, encoder_parse_type, ENCODER_TYPE_UNKNOWN, ENCODER_TYPES_STR);
|
||||||
# ifdef WITH_OMX
|
# ifdef WITH_OMX
|
||||||
case _O_GLITCHED_RESOLUTIONS:
|
case _O_GLITCHED_RESOLUTIONS: break;
|
||||||
if (_parse_glitched_resolutions(optarg, enc) < 0) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
# endif
|
# endif
|
||||||
case _O_BLANK: OPT_SET(blank_path, optarg);
|
case _O_BLANK: OPT_SET(blank_path, optarg);
|
||||||
case _O_LAST_AS_BLANK: OPT_NUMBER("--last-as-blank", stream->last_as_blank, 0, 86400, 0);
|
case _O_LAST_AS_BLANK: OPT_NUMBER("--last-as-blank", stream->last_as_blank, 0, 86400, 0);
|
||||||
@@ -505,55 +498,6 @@ static int _parse_resolution(const char *str, unsigned *width, unsigned *height,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WITH_OMX
|
|
||||||
static int _parse_glitched_resolutions(const char *str, encoder_s *enc) {
|
|
||||||
char *str_copy;
|
|
||||||
assert((str_copy = strdup(str)) != NULL);
|
|
||||||
|
|
||||||
char *ptr = strtok(str_copy, ",;:\n\t ");
|
|
||||||
unsigned count = 0;
|
|
||||||
|
|
||||||
while (ptr != NULL) {
|
|
||||||
if (count >= MAX_GLITCHED_RESOLUTIONS) {
|
|
||||||
printf("Too big '--glitched-resolutions' list: maxlen=%u\n", MAX_GLITCHED_RESOLUTIONS);
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned width;
|
|
||||||
unsigned height;
|
|
||||||
switch (_parse_resolution(ptr, &width, &height, true)) {
|
|
||||||
case -1:
|
|
||||||
printf("Invalid resolution format of '%s' in '--glitched-resolutions=%s\n", ptr, str_copy);
|
|
||||||
goto error;
|
|
||||||
case -2:
|
|
||||||
printf("Invalid width of '%s' in '--glitched-resolutions=%s: min=%u, max=%u\n",
|
|
||||||
ptr, str_copy, VIDEO_MIN_WIDTH, VIDEO_MIN_HEIGHT);
|
|
||||||
goto error;
|
|
||||||
case -3:
|
|
||||||
printf("Invalid width of '%s' in '--glitched-resolutions=%s: min=%u, max=%u\n",
|
|
||||||
ptr, str_copy, VIDEO_MIN_WIDTH, VIDEO_MIN_HEIGHT);
|
|
||||||
goto error;
|
|
||||||
case 0: break;
|
|
||||||
default: assert(0 && "Unknown error");
|
|
||||||
}
|
|
||||||
|
|
||||||
enc->glitched_resolutions[count][0] = width;
|
|
||||||
enc->glitched_resolutions[count][1] = height;
|
|
||||||
count += 1;
|
|
||||||
|
|
||||||
ptr = strtok(NULL, ",;:\n\t ");
|
|
||||||
}
|
|
||||||
|
|
||||||
enc->n_glitched_resolutions = count;
|
|
||||||
free(str_copy);
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
error:
|
|
||||||
free(str_copy);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void _features(void) {
|
static void _features(void) {
|
||||||
# ifdef WITH_OMX
|
# ifdef WITH_OMX
|
||||||
puts("+ WITH_OMX");
|
puts("+ WITH_OMX");
|
||||||
@@ -630,8 +574,7 @@ static void _help(FILE *fp, device_s *dev, encoder_s *enc, stream_s *stream, ser
|
|||||||
SAY(" * HW ─── Use pre-encoded MJPG frames directly from camera hardware.");
|
SAY(" * HW ─── Use pre-encoded MJPG frames directly from camera hardware.");
|
||||||
SAY(" * NOOP ─ Don't compress MJPG stream (do nothing).\n");
|
SAY(" * NOOP ─ Don't compress MJPG stream (do nothing).\n");
|
||||||
# ifdef WITH_OMX
|
# ifdef WITH_OMX
|
||||||
SAY(" -g|--glitched-resolutions <WxH,...> ─ Comma-separated list of resolutions that require forced");
|
SAY(" -g|--glitched-resolutions <WxH,...> ─ It doesn't do anything. Still here for compatibility. Default: disabled.\n");
|
||||||
SAY(" encoding on CPU instead of OMX. Default: disabled.\n");
|
|
||||||
# endif
|
# endif
|
||||||
SAY(" -k|--blank <path> ─────────────────── Path to JPEG file that will be shown when the device is disconnected");
|
SAY(" -k|--blank <path> ─────────────────── Path to JPEG file that will be shown when the device is disconnected");
|
||||||
SAY(" during the streaming. Default: black screen 640x480 with 'NO SIGNAL'.\n");
|
SAY(" during the streaming. Default: black screen 640x480 with 'NO SIGNAL'.\n");
|
||||||
|
|||||||
@@ -97,8 +97,7 @@ HW ─ Use pre-encoded MJPG frames directly from camera hardware.
|
|||||||
NOOP ─ Don't compress MJPG stream (do nothing).
|
NOOP ─ Don't compress MJPG stream (do nothing).
|
||||||
.TP
|
.TP
|
||||||
.BR \-g\ \fIWxH,... ", " \-\-glitched\-resolutions\ \fIWxH,...
|
.BR \-g\ \fIWxH,... ", " \-\-glitched\-resolutions\ \fIWxH,...
|
||||||
Comma-separated list of resolutions that require forced
|
It doesn't do anything. Still here for compatibility. Required \fBWITH_OMX\fR feature. Default: disabled.
|
||||||
encoding on CPU instead of OMX. Required \fBWITH_OMX\fR feature. Default: disabled.
|
|
||||||
.TP
|
.TP
|
||||||
.BR \-k\ \fIpath ", " \-\-blank\ \fIpath
|
.BR \-k\ \fIpath ", " \-\-blank\ \fIpath
|
||||||
Path to JPEG file that will be shown when the device is disconnected during the streaming. Default: black screen 640x480 with 'NO SIGNAL'.
|
Path to JPEG file that will be shown when the device is disconnected during the streaming. Default: black screen 640x480 with 'NO SIGNAL'.
|
||||||
|
|||||||
Reference in New Issue
Block a user