refactoring

This commit is contained in:
Devaev Maxim 2018-09-23 02:12:37 +03:00
parent 4cac722c6d
commit ec470480e6
10 changed files with 18 additions and 6 deletions

View File

@ -26,6 +26,7 @@
#include <strings.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/mman.h>
#include <linux/videodev2.h>
@ -42,7 +43,7 @@ static const struct {
{"UNKNOWN", V4L2_STD_UNKNOWN},
{"PAL", V4L2_STD_PAL},
{"NTSC", V4L2_STD_NTSC},
{"SECAM", V4L2_STD_SECAM}
{"SECAM", V4L2_STD_SECAM},
};
static const struct {
@ -51,7 +52,7 @@ static const struct {
} FORMATS[] = {
{"YUYV", V4L2_PIX_FMT_YUYV},
{"UYVY", V4L2_PIX_FMT_UYVY},
{"RGB565", V4L2_PIX_FMT_RGB565}
{"RGB565", V4L2_PIX_FMT_RGB565},
};

View File

@ -24,6 +24,7 @@
#include <stddef.h>
#include <stdbool.h>
#include <signal.h>
#include <linux/videodev2.h>

View File

@ -24,6 +24,7 @@
#include <string.h>
#include <time.h>
#include <assert.h>
#include <event2/event.h>
#include <event2/thread.h>
#include <event2/http.h>

View File

@ -21,6 +21,7 @@
#include <stdbool.h>
#include <time.h>
#include <event2/event.h>
#include <event2/http.h>

View File

@ -28,6 +28,7 @@
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <jpeglib.h>
#include <linux/videodev2.h>
@ -94,6 +95,7 @@ void jpeg_compress_buffer(struct device_t *dev, int index) {
# define WRITE_SCANLINES(_func) \
_func(&jpeg, line_buffer, dev->run->hw_buffers[index].start, dev->run->width, dev->run->height)
switch (dev->run->format) {
// https://www.fourcc.org/yuv.php
case V4L2_PIX_FMT_YUYV: WRITE_SCANLINES(_jpeg_write_scanlines_yuyv); break;
case V4L2_PIX_FMT_UYVY: WRITE_SCANLINES(_jpeg_write_scanlines_uyvy); break;
case V4L2_PIX_FMT_RGB565: WRITE_SCANLINES(_jpeg_write_scanlines_rgb565); break;

View File

@ -23,6 +23,7 @@
#include <stdlib.h>
#include <stddef.h>
#include "device.h"

View File

@ -25,10 +25,11 @@
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <pthread.h>
#include <time.h>
#include <assert.h>
#include <pthread.h>
#include "tools.h"

View File

@ -28,9 +28,10 @@
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
#include <pthread.h>
#include <getopt.h>
#include <pthread.h>
#include "tools.h"
#include "logging.h"
#include "device.h"
@ -61,7 +62,7 @@ static const struct option _long_opts[] = {
{"debug", no_argument, NULL, 5000},
{"log-level", required_argument, NULL, 5001},
{"help", no_argument, NULL, 'h'},
{NULL, 0, NULL, 0}
{NULL, 0, NULL, 0},
};
static void _help(struct device_t *dev, struct http_server_t *server) {

View File

@ -21,9 +21,11 @@
#include <unistd.h>
#include <errno.h>
#include <pthread.h>
#include <time.h>
#include <assert.h>
#include <pthread.h>
#include <sys/select.h>
#include <linux/videodev2.h>

View File

@ -23,6 +23,7 @@
#include <stdbool.h>
#include <signal.h>
#include <pthread.h>
#include "device.h"