mirror of
https://github.com/pikvm/ustreamer.git
synced 2026-03-13 02:53:42 +00:00
replaced MEMSET_ZERO to initializers
This commit is contained in:
@@ -175,8 +175,7 @@ int main(int argc, char *argv[]) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
_output_context_s ctx;
|
_output_context_s ctx = {0};
|
||||||
MEMSET_ZERO(ctx);
|
|
||||||
|
|
||||||
if (output_path && output_path[0] != '\0') {
|
if (output_path && output_path[0] != '\0') {
|
||||||
if ((ctx.v_output = (void *)output_file_init(output_path, output_json)) == NULL) {
|
if ((ctx.v_output = (void *)output_file_init(output_path, output_json)) == NULL) {
|
||||||
@@ -206,8 +205,7 @@ static void _signal_handler(int signum) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void _install_signal_handlers(void) {
|
static void _install_signal_handlers(void) {
|
||||||
struct sigaction sig_act;
|
struct sigaction sig_act = {0};
|
||||||
MEMSET_ZERO(sig_act);
|
|
||||||
|
|
||||||
assert(!sigemptyset(&sig_act.sa_mask));
|
assert(!sigemptyset(&sig_act.sa_mask));
|
||||||
sig_act.sa_handler = _signal_handler;
|
sig_act.sa_handler = _signal_handler;
|
||||||
|
|||||||
@@ -226,8 +226,7 @@ int device_export_to_vcsm(device_s *dev) {
|
|||||||
# define VCSM_HANDLE RUN(hw_bufs[index].vcsm_handle)
|
# define VCSM_HANDLE RUN(hw_bufs[index].vcsm_handle)
|
||||||
|
|
||||||
for (unsigned index = 0; index < RUN(n_bufs); ++index) {
|
for (unsigned index = 0; index < RUN(n_bufs); ++index) {
|
||||||
struct v4l2_exportbuffer exp;
|
struct v4l2_exportbuffer exp = {0};
|
||||||
MEMSET_ZERO(exp);
|
|
||||||
exp.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
exp.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||||
exp.index = index;
|
exp.index = index;
|
||||||
|
|
||||||
@@ -334,8 +333,7 @@ int device_select(device_s *dev, bool *has_read, bool *has_write, bool *has_erro
|
|||||||
int device_grab_buffer(device_s *dev, hw_buffer_s **hw) {
|
int device_grab_buffer(device_s *dev, hw_buffer_s **hw) {
|
||||||
*hw = NULL;
|
*hw = NULL;
|
||||||
|
|
||||||
struct v4l2_buffer buf;
|
struct v4l2_buffer buf = {0};
|
||||||
MEMSET_ZERO(buf);
|
|
||||||
buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||||
buf.memory = dev->io_method;
|
buf.memory = dev->io_method;
|
||||||
|
|
||||||
@@ -430,8 +428,7 @@ int device_consume_event(device_s *dev) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int _device_open_check_cap(device_s *dev) {
|
static int _device_open_check_cap(device_s *dev) {
|
||||||
struct v4l2_capability cap;
|
struct v4l2_capability cap = {0};
|
||||||
MEMSET_ZERO(cap);
|
|
||||||
|
|
||||||
LOG_DEBUG("Calling ioctl(VIDIOC_QUERYCAP) ...");
|
LOG_DEBUG("Calling ioctl(VIDIOC_QUERYCAP) ...");
|
||||||
if (xioctl(RUN(fd), VIDIOC_QUERYCAP, &cap) < 0) {
|
if (xioctl(RUN(fd), VIDIOC_QUERYCAP, &cap) < 0) {
|
||||||
@@ -477,9 +474,7 @@ static int _device_open_dv_timings(device_s *dev) {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct v4l2_event_subscription sub;
|
struct v4l2_event_subscription sub = {0};
|
||||||
|
|
||||||
MEMSET_ZERO(sub);
|
|
||||||
sub.type = V4L2_EVENT_SOURCE_CHANGE;
|
sub.type = V4L2_EVENT_SOURCE_CHANGE;
|
||||||
|
|
||||||
LOG_DEBUG("Calling ioctl(VIDIOC_SUBSCRIBE_EVENT) ...");
|
LOG_DEBUG("Calling ioctl(VIDIOC_SUBSCRIBE_EVENT) ...");
|
||||||
@@ -492,8 +487,7 @@ static int _device_open_dv_timings(device_s *dev) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int _device_apply_dv_timings(device_s *dev) {
|
static int _device_apply_dv_timings(device_s *dev) {
|
||||||
struct v4l2_dv_timings dv;
|
struct v4l2_dv_timings dv = {0};
|
||||||
MEMSET_ZERO(dv);
|
|
||||||
|
|
||||||
LOG_DEBUG("Calling ioctl(VIDIOC_QUERY_DV_TIMINGS) ...");
|
LOG_DEBUG("Calling ioctl(VIDIOC_QUERY_DV_TIMINGS) ...");
|
||||||
if (xioctl(RUN(fd), VIDIOC_QUERY_DV_TIMINGS, &dv) == 0) {
|
if (xioctl(RUN(fd), VIDIOC_QUERY_DV_TIMINGS, &dv) == 0) {
|
||||||
@@ -540,8 +534,7 @@ static int _device_apply_dv_timings(device_s *dev) {
|
|||||||
static int _device_open_format(device_s *dev, bool first) {
|
static int _device_open_format(device_s *dev, bool first) {
|
||||||
const unsigned stride = align_size(RUN(width), 32) << 1;
|
const unsigned stride = align_size(RUN(width), 32) << 1;
|
||||||
|
|
||||||
struct v4l2_format fmt;
|
struct v4l2_format fmt = {0};
|
||||||
MEMSET_ZERO(fmt);
|
|
||||||
fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||||
fmt.fmt.pix.width = RUN(width);
|
fmt.fmt.pix.width = RUN(width);
|
||||||
fmt.fmt.pix.height = RUN(height);
|
fmt.fmt.pix.height = RUN(height);
|
||||||
@@ -599,8 +592,7 @@ static int _device_open_format(device_s *dev, bool first) {
|
|||||||
static void _device_open_hw_fps(device_s *dev) {
|
static void _device_open_hw_fps(device_s *dev) {
|
||||||
RUN(hw_fps) = 0;
|
RUN(hw_fps) = 0;
|
||||||
|
|
||||||
struct v4l2_streamparm setfps;
|
struct v4l2_streamparm setfps = {0};
|
||||||
MEMSET_ZERO(setfps);
|
|
||||||
setfps.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
setfps.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||||
|
|
||||||
LOG_DEBUG("Calling ioctl(VIDIOC_G_PARM) ...");
|
LOG_DEBUG("Calling ioctl(VIDIOC_G_PARM) ...");
|
||||||
@@ -654,8 +646,7 @@ static void _device_open_jpeg_quality(device_s *dev) {
|
|||||||
unsigned quality = 0;
|
unsigned quality = 0;
|
||||||
|
|
||||||
if (is_jpeg(RUN(format))) {
|
if (is_jpeg(RUN(format))) {
|
||||||
struct v4l2_jpegcompression comp;
|
struct v4l2_jpegcompression comp = {0};
|
||||||
MEMSET_ZERO(comp);
|
|
||||||
|
|
||||||
if (xioctl(RUN(fd), VIDIOC_G_JPEGCOMP, &comp) < 0) {
|
if (xioctl(RUN(fd), VIDIOC_G_JPEGCOMP, &comp) < 0) {
|
||||||
LOG_ERROR("Device does not support setting of HW encoding quality parameters");
|
LOG_ERROR("Device does not support setting of HW encoding quality parameters");
|
||||||
@@ -683,8 +674,7 @@ static int _device_open_io_method(device_s *dev) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int _device_open_io_method_mmap(device_s *dev) {
|
static int _device_open_io_method_mmap(device_s *dev) {
|
||||||
struct v4l2_requestbuffers req;
|
struct v4l2_requestbuffers req = {0};
|
||||||
MEMSET_ZERO(req);
|
|
||||||
req.count = dev->n_bufs;
|
req.count = dev->n_bufs;
|
||||||
req.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
req.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||||
req.memory = V4L2_MEMORY_MMAP;
|
req.memory = V4L2_MEMORY_MMAP;
|
||||||
@@ -706,8 +696,7 @@ static int _device_open_io_method_mmap(device_s *dev) {
|
|||||||
|
|
||||||
A_CALLOC(RUN(hw_bufs), req.count);
|
A_CALLOC(RUN(hw_bufs), req.count);
|
||||||
for (RUN(n_bufs) = 0; RUN(n_bufs) < req.count; ++RUN(n_bufs)) {
|
for (RUN(n_bufs) = 0; RUN(n_bufs) < req.count; ++RUN(n_bufs)) {
|
||||||
struct v4l2_buffer buf;
|
struct v4l2_buffer buf = {0};
|
||||||
MEMSET_ZERO(buf);
|
|
||||||
buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||||
buf.memory = V4L2_MEMORY_MMAP;
|
buf.memory = V4L2_MEMORY_MMAP;
|
||||||
buf.index = RUN(n_bufs);
|
buf.index = RUN(n_bufs);
|
||||||
@@ -747,8 +736,7 @@ static int _device_open_io_method_mmap(device_s *dev) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int _device_open_io_method_userptr(device_s *dev) {
|
static int _device_open_io_method_userptr(device_s *dev) {
|
||||||
struct v4l2_requestbuffers req;
|
struct v4l2_requestbuffers req = {0};
|
||||||
MEMSET_ZERO(req);
|
|
||||||
req.count = dev->n_bufs;
|
req.count = dev->n_bufs;
|
||||||
req.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
req.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||||
req.memory = V4L2_MEMORY_USERPTR;
|
req.memory = V4L2_MEMORY_USERPTR;
|
||||||
@@ -785,8 +773,7 @@ static int _device_open_io_method_userptr(device_s *dev) {
|
|||||||
|
|
||||||
static int _device_open_queue_buffers(device_s *dev) {
|
static int _device_open_queue_buffers(device_s *dev) {
|
||||||
for (unsigned index = 0; index < RUN(n_bufs); ++index) {
|
for (unsigned index = 0; index < RUN(n_bufs); ++index) {
|
||||||
struct v4l2_buffer buf;
|
struct v4l2_buffer buf = {0};
|
||||||
MEMSET_ZERO(buf);
|
|
||||||
buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||||
buf.memory = dev->io_method;
|
buf.memory = dev->io_method;
|
||||||
buf.index = index;
|
buf.index = index;
|
||||||
@@ -905,8 +892,7 @@ static void _device_set_control(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct v4l2_control ctl;
|
struct v4l2_control ctl = {0};
|
||||||
MEMSET_ZERO(ctl);
|
|
||||||
ctl.id = cid;
|
ctl.id = cid;
|
||||||
ctl.value = value;
|
ctl.value = value;
|
||||||
|
|
||||||
|
|||||||
@@ -140,8 +140,7 @@ workers_pool_s *encoder_workers_pool_init(encoder_s *enc, device_s *dev) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
frame_s frame;
|
frame_s frame = {0};
|
||||||
MEMSET_ZERO(frame);
|
|
||||||
frame.width = DR(width);
|
frame.width = DR(width);
|
||||||
frame.height = DR(height);
|
frame.height = DR(height);
|
||||||
frame.format = DR(format);
|
frame.format = DR(format);
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
|
|
||||||
evutil_socket_t evhttp_my_bind_unix(struct evhttp *http, const char *path, bool rm, mode_t mode) {
|
evutil_socket_t evhttp_my_bind_unix(struct evhttp *http, const char *path, bool rm, mode_t mode) {
|
||||||
struct sockaddr_un addr;
|
struct sockaddr_un addr = {0};
|
||||||
|
|
||||||
# define MAX_SUN_PATH (sizeof(addr.sun_path) - 1)
|
# define MAX_SUN_PATH (sizeof(addr.sun_path) - 1)
|
||||||
|
|
||||||
@@ -33,7 +33,6 @@ evutil_socket_t evhttp_my_bind_unix(struct evhttp *http, const char *path, bool
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
MEMSET_ZERO(addr);
|
|
||||||
strncpy(addr.sun_path, path, MAX_SUN_PATH);
|
strncpy(addr.sun_path, path, MAX_SUN_PATH);
|
||||||
addr.sun_family = AF_UNIX;
|
addr.sun_family = AF_UNIX;
|
||||||
|
|
||||||
|
|||||||
@@ -94,8 +94,7 @@ static void _signal_handler(int signum) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void _install_signal_handlers(void) {
|
static void _install_signal_handlers(void) {
|
||||||
struct sigaction sig_act;
|
struct sigaction sig_act = {0};
|
||||||
MEMSET_ZERO(sig_act);
|
|
||||||
|
|
||||||
assert(!sigemptyset(&sig_act.sa_mask));
|
assert(!sigemptyset(&sig_act.sa_mask));
|
||||||
sig_act.sa_handler = _signal_handler;
|
sig_act.sa_handler = _signal_handler;
|
||||||
|
|||||||
Reference in New Issue
Block a user