#include <stdio.h>
#include <string.h>
#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
#include "overlay_params.h"
+#include "util/os_socket.h"
+
static enum overlay_param_position
parse_position(const char *str)
{
return fopen(str, "w+");
}
+static int
+parse_control(const char *str)
+{
+ int ret = os_socket_listen_abstract(str, 1);
+ if (ret < 0) {
+ fprintf(stderr, "ERROR: Couldn't create socket pipe at '%s'\n", str);
+ fprintf(stderr, "ERROR: '%s'\n", strerror(errno));
+ return ret;
+ }
+
+ os_socket_block(ret, false);
+
+ return ret;
+}
+
static uint32_t
parse_fps_sampling_period(const char *str)
{
return strtol(str, NULL, 0) != 0;
}
+static unsigned
+parse_unsigned(const char *str)
+{
+ return strtol(str, NULL, 0);
+}
+
+#define parse_width(s) parse_unsigned(s)
+#define parse_height(s) parse_unsigned(s)
+
static bool
parse_help(const char *str)
{
fprintf(stderr, "\tfps_sampling_period=number-of-milliseconds\n");
fprintf(stderr, "\tno_display=0|1\n");
fprintf(stderr, "\toutput_file=/path/to/output.txt\n");
+ fprintf(stderr, "\twidth=width-in-pixels\n");
+ fprintf(stderr, "\theight=height-in-pixels\n");
return true;
}
params->enabled[OVERLAY_PARAM_ENABLED_fps] = true;
params->enabled[OVERLAY_PARAM_ENABLED_frame_timing] = true;
params->fps_sampling_period = 500000; /* 500ms */
+ params->width = params->height = 300;
+ params->control = -1;
if (!env)
return;