From 42ab32b1a6171fcde93188f7a4ca810ea8161c67 Mon Sep 17 00:00:00 2001 From: Kamil Trzcinski Date: Fri, 8 Apr 2022 18:47:12 +0200 Subject: [PATCH] Move all into `device/` --- Makefile | 10 ++++++---- cmd/{main.c => camera_stream.c} | 12 ++++++------ {cmd => device}/camera.c | 8 ++++---- {cmd => device}/camera.h | 4 ++-- {cmd => device}/camera_decoder.c | 12 ++++++------ {cmd => device}/camera_direct.c | 12 ++++++------ {cmd => device}/camera_isp.c | 12 ++++++------ {cmd => device}/camera_legacy_isp.c | 12 ++++++------ {hw => device/hw}/buffer.c | 6 +++--- {hw => device/hw}/buffer.h | 0 {hw => device/hw}/buffer_list.c | 6 +++--- {hw => device/hw}/buffer_list.h | 0 {hw => device/hw}/buffer_lock.c | 4 ++-- {hw => device/hw}/buffer_lock.h | 0 {hw => device/hw}/buffer_queue.c | 6 +++--- {hw => device/hw}/device.c | 6 +++--- {hw => device/hw}/device.h | 0 {hw => device/hw}/device_media.c | 2 +- {hw => device/hw}/device_options.c | 2 +- {hw => device/hw}/links.c | 8 ++++---- {hw => device/hw}/links.h | 0 {hw => device/hw}/v4l2.c | 2 +- {hw => device/hw}/v4l2.h | 0 http/http.c | 2 +- http/http_ffmpeg.c | 8 ++++---- http/http_h264.c | 8 ++++---- http/http_jpeg.c | 4 ++-- opts/opts.c | 2 +- 28 files changed, 75 insertions(+), 73 deletions(-) rename cmd/{main.c => camera_stream.c} (93%) rename {cmd => device}/camera.c (96%) rename {cmd => device}/camera.h (95%) rename {cmd => device}/camera_decoder.c (93%) rename {cmd => device}/camera_direct.c (84%) rename {cmd => device}/camera_isp.c (94%) rename {cmd => device}/camera_legacy_isp.c (90%) rename {hw => device/hw}/buffer.c (95%) rename {hw => device/hw}/buffer.h (100%) rename {hw => device/hw}/buffer_list.c (98%) rename {hw => device/hw}/buffer_list.h (100%) rename {hw => device/hw}/buffer_lock.c (97%) rename {hw => device/hw}/buffer_lock.h (100%) rename {hw => device/hw}/buffer_queue.c (98%) rename {hw => device/hw}/device.c (98%) rename {hw => device/hw}/device.h (100%) rename {hw => device/hw}/device_media.c (98%) rename {hw => device/hw}/device_options.c (98%) rename {hw => device/hw}/links.c (98%) rename {hw => device/hw}/links.h (100%) rename {hw => device/hw}/v4l2.c (98%) rename {hw => device/hw}/v4l2.h (100%) diff --git a/Makefile b/Makefile index 094f4b1..13b7f25 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ TARGET := camera_stream -SRC := $(wildcard **/*.c) -HEADERS := $(wildcard **/*.h) +SRC := $(wildcard **/*.c) $(wildcard **/*/*.c) +HEADERS := $(wildcard **/*.h) $(wildcard **/*/*.h) HTML := $(wildcard html/*.js html/*.html) CFLAGS := -Werror -g -I$(PWD) @@ -18,14 +18,16 @@ OBJS = $(subst .c,.o,$(SRC) $(HTML_SRC)) .SUFFIXES: -$(TARGET): $(OBJS) +all: $(TARGET) + +%: cmd/%.c $(filter-out cmd/%, $(OBJS)) gcc $(CFLAGS) -o $@ $^ $(LDLIBS) install: $(TARGET) install $(TARGET) /usr/local/bin/ clean: - rm -f .depend $(OBJS) $(HTML_SRC) $(TARGET) + rm -f .depend $(OBJS) $(OBJS:.o=.d) $(HTML_SRC) $(TARGET) -include $(OBJS:.o=.d) diff --git a/cmd/main.c b/cmd/camera_stream.c similarity index 93% rename from cmd/main.c rename to cmd/camera_stream.c index f4674ee..cf1af40 100644 --- a/cmd/main.c +++ b/cmd/camera_stream.c @@ -1,11 +1,11 @@ -#include "hw/buffer.h" -#include "hw/buffer_list.h" -#include "hw/device.h" -#include "hw/links.h" -#include "hw/v4l2.h" +#include "device/hw/buffer.h" +#include "device/hw/buffer_list.h" +#include "device/hw/device.h" +#include "device/hw/links.h" +#include "device/hw/v4l2.h" #include "http/http.h" #include "opts/opts.h" -#include "camera.h" +#include "device/camera.h" #include diff --git a/cmd/camera.c b/device/camera.c similarity index 96% rename from cmd/camera.c rename to device/camera.c index 8c9dddf..6f52032 100644 --- a/cmd/camera.c +++ b/device/camera.c @@ -1,9 +1,9 @@ #include "camera.h" -#include "hw/device.h" -#include "hw/buffer_list.h" -#include "hw/links.h" -#include "hw/v4l2.h" +#include "device/hw/device.h" +#include "device/hw/buffer_list.h" +#include "device/hw/links.h" +#include "device/hw/v4l2.h" void camera_init(camera_t *camera) { diff --git a/cmd/camera.h b/device/camera.h similarity index 95% rename from cmd/camera.h rename to device/camera.h index 1808452..e184e67 100644 --- a/cmd/camera.h +++ b/device/camera.h @@ -1,7 +1,7 @@ #pragma once -#include "hw/links.h" -#include "hw/device.h" +#include "device/hw/links.h" +#include "device/hw/device.h" #define MAX_DEVICES 20 #define MAX_HTTP_METHODS 20 diff --git a/cmd/camera_decoder.c b/device/camera_decoder.c similarity index 93% rename from cmd/camera_decoder.c rename to device/camera_decoder.c index 6d288e0..ae8d4f2 100644 --- a/cmd/camera_decoder.c +++ b/device/camera_decoder.c @@ -1,11 +1,11 @@ #include "camera.h" -#include "hw/buffer.h" -#include "hw/buffer_list.h" -#include "hw/device.h" -#include "hw/links.h" -#include "hw/v4l2.h" -#include "hw/buffer_list.h" +#include "device/hw/buffer.h" +#include "device/hw/buffer_list.h" +#include "device/hw/device.h" +#include "device/hw/links.h" +#include "device/hw/v4l2.h" +#include "device/hw/buffer_list.h" #include "http/http.h" int camera_configure_decoder(camera_t *camera) diff --git a/cmd/camera_direct.c b/device/camera_direct.c similarity index 84% rename from cmd/camera_direct.c rename to device/camera_direct.c index 6216159..a6731b5 100644 --- a/cmd/camera_direct.c +++ b/device/camera_direct.c @@ -1,11 +1,11 @@ #include "camera.h" -#include "hw/buffer.h" -#include "hw/buffer_list.h" -#include "hw/device.h" -#include "hw/links.h" -#include "hw/v4l2.h" -#include "hw/buffer_list.h" +#include "device/hw/buffer.h" +#include "device/hw/buffer_list.h" +#include "device/hw/device.h" +#include "device/hw/links.h" +#include "device/hw/v4l2.h" +#include "device/hw/buffer_list.h" #include "http/http.h" int camera_configure_direct(camera_t *camera) diff --git a/cmd/camera_isp.c b/device/camera_isp.c similarity index 94% rename from cmd/camera_isp.c rename to device/camera_isp.c index 78134c9..718fa9b 100644 --- a/cmd/camera_isp.c +++ b/device/camera_isp.c @@ -1,11 +1,11 @@ #include "camera.h" -#include "hw/buffer.h" -#include "hw/buffer_list.h" -#include "hw/device.h" -#include "hw/links.h" -#include "hw/v4l2.h" -#include "hw/buffer_list.h" +#include "device/hw/buffer.h" +#include "device/hw/buffer_list.h" +#include "device/hw/device.h" +#include "device/hw/links.h" +#include "device/hw/v4l2.h" +#include "device/hw/buffer_list.h" #include "http/http.h" void write_yuvu(buffer_t *buffer); diff --git a/cmd/camera_legacy_isp.c b/device/camera_legacy_isp.c similarity index 90% rename from cmd/camera_legacy_isp.c rename to device/camera_legacy_isp.c index f0285af..eabf80b 100644 --- a/cmd/camera_legacy_isp.c +++ b/device/camera_legacy_isp.c @@ -1,11 +1,11 @@ #include "camera.h" -#include "hw/buffer.h" -#include "hw/buffer_list.h" -#include "hw/device.h" -#include "hw/links.h" -#include "hw/v4l2.h" -#include "hw/buffer_list.h" +#include "device/hw/buffer.h" +#include "device/hw/buffer_list.h" +#include "device/hw/device.h" +#include "device/hw/links.h" +#include "device/hw/v4l2.h" +#include "device/hw/buffer_list.h" #include "http/http.h" void write_yuvu(buffer_t *buffer) diff --git a/hw/buffer.c b/device/hw/buffer.c similarity index 95% rename from hw/buffer.c rename to device/hw/buffer.c index ea3cd66..1f2a559 100644 --- a/hw/buffer.c +++ b/device/hw/buffer.c @@ -1,6 +1,6 @@ -#include "hw/buffer.h" -#include "hw/buffer_list.h" -#include "hw/device.h" +#include "device/hw/buffer.h" +#include "device/hw/buffer_list.h" +#include "device/hw/device.h" buffer_t *buffer_open(const char *name, buffer_list_t *buf_list, int index) { buffer_t *buf = calloc(1, sizeof(buffer_t)); diff --git a/hw/buffer.h b/device/hw/buffer.h similarity index 100% rename from hw/buffer.h rename to device/hw/buffer.h diff --git a/hw/buffer_list.c b/device/hw/buffer_list.c similarity index 98% rename from hw/buffer_list.c rename to device/hw/buffer_list.c index 1e7fbf3..d39f62e 100644 --- a/hw/buffer_list.c +++ b/device/hw/buffer_list.c @@ -1,6 +1,6 @@ -#include "hw/buffer.h" -#include "hw/buffer_list.h" -#include "hw/device.h" +#include "device/hw/buffer.h" +#include "device/hw/buffer_list.h" +#include "device/hw/device.h" buffer_list_t *buffer_list_open(const char *name, struct device_s *dev, unsigned type, bool do_mmap) { diff --git a/hw/buffer_list.h b/device/hw/buffer_list.h similarity index 100% rename from hw/buffer_list.h rename to device/hw/buffer_list.h diff --git a/hw/buffer_lock.c b/device/hw/buffer_lock.c similarity index 97% rename from hw/buffer_lock.c rename to device/hw/buffer_lock.c index ea0c225..66273f9 100644 --- a/hw/buffer_lock.c +++ b/device/hw/buffer_lock.c @@ -1,5 +1,5 @@ -#include "hw/buffer_lock.h" -#include "hw/buffer_list.h" +#include "device/hw/buffer_lock.h" +#include "device/hw/buffer_list.h" bool buffer_lock_is_used(buffer_lock_t *buf_lock) { diff --git a/hw/buffer_lock.h b/device/hw/buffer_lock.h similarity index 100% rename from hw/buffer_lock.h rename to device/hw/buffer_lock.h diff --git a/hw/buffer_queue.c b/device/hw/buffer_queue.c similarity index 98% rename from hw/buffer_queue.c rename to device/hw/buffer_queue.c index 3677e56..e634f3a 100644 --- a/hw/buffer_queue.c +++ b/device/hw/buffer_queue.c @@ -1,6 +1,6 @@ -#include "hw/buffer.h" -#include "hw/buffer_list.h" -#include "hw/device.h" +#include "device/hw/buffer.h" +#include "device/hw/buffer_list.h" +#include "device/hw/device.h" #include diff --git a/hw/device.c b/device/hw/device.c similarity index 98% rename from hw/device.c rename to device/hw/device.c index 29c0ced..fd3bafa 100644 --- a/hw/device.c +++ b/device/hw/device.c @@ -1,6 +1,6 @@ -#include "hw/device.h" -#include "hw/buffer.h" -#include "hw/buffer_list.h" +#include "device/hw/device.h" +#include "device/hw/buffer.h" +#include "device/hw/buffer_list.h" device_t *device_open(const char *name, const char *path) { device_t *dev = calloc(1, sizeof(device_t)); diff --git a/hw/device.h b/device/hw/device.h similarity index 100% rename from hw/device.h rename to device/hw/device.h diff --git a/hw/device_media.c b/device/hw/device_media.c similarity index 98% rename from hw/device_media.c rename to device/hw/device_media.c index b6eae1b..fc8d99e 100644 --- a/hw/device_media.c +++ b/device/hw/device_media.c @@ -1,4 +1,4 @@ -#include "hw/device.h" +#include "device/hw/device.h" #include #include diff --git a/hw/device_options.c b/device/hw/device_options.c similarity index 98% rename from hw/device_options.c rename to device/hw/device_options.c index fdf1ba4..7c160f3 100644 --- a/hw/device_options.c +++ b/device/hw/device_options.c @@ -1,4 +1,4 @@ -#include "hw/device.h" +#include "device/hw/device.h" #include diff --git a/hw/links.c b/device/hw/links.c similarity index 98% rename from hw/links.c rename to device/hw/links.c index b4d5522..9d0d750 100644 --- a/hw/links.c +++ b/device/hw/links.c @@ -1,7 +1,7 @@ -#include "hw/device.h" -#include "hw/buffer.h" -#include "hw/buffer_list.h" -#include "hw/links.h" +#include "device/hw/device.h" +#include "device/hw/buffer.h" +#include "device/hw/buffer_list.h" +#include "device/hw/links.h" #define N_FDS 50 #define QUEUE_ON_CAPTURE // seems to provide better latency diff --git a/hw/links.h b/device/hw/links.h similarity index 100% rename from hw/links.h rename to device/hw/links.h diff --git a/hw/v4l2.c b/device/hw/v4l2.c similarity index 98% rename from hw/v4l2.c rename to device/hw/v4l2.c index 897b002..78bfcb5 100644 --- a/hw/v4l2.c +++ b/device/hw/v4l2.c @@ -1,4 +1,4 @@ -#include "hw/v4l2.h" +#include "device/hw/v4l2.h" int xioctl(const char *name, int fd, int request, void *arg) { diff --git a/hw/v4l2.h b/device/hw/v4l2.h similarity index 100% rename from hw/v4l2.h rename to device/hw/v4l2.h diff --git a/http/http.c b/http/http.c index a6574b7..10ce25c 100644 --- a/http/http.c +++ b/http/http.c @@ -11,7 +11,7 @@ #include #include "http/http.h" -#include "hw/v4l2.h" +#include "device/hw/v4l2.h" #define BUFSIZE 256 diff --git a/http/http_ffmpeg.c b/http/http_ffmpeg.c index 29cedf6..d1608d6 100644 --- a/http/http_ffmpeg.c +++ b/http/http_ffmpeg.c @@ -2,10 +2,10 @@ #include #include "http/http.h" -#include "hw/buffer.h" -#include "hw/buffer_lock.h" -#include "hw/buffer_list.h" -#include "hw/device.h" +#include "device/hw/buffer.h" +#include "device/hw/buffer_lock.h" +#include "device/hw/buffer_list.h" +#include "device/hw/device.h" #include "ffmpeg/remuxer.h" buffer_lock_t *http_h264_buffer_for_res(http_worker_t *worker); diff --git a/http/http_h264.c b/http/http_h264.c index c34e053..66d41b4 100644 --- a/http/http_h264.c +++ b/http/http_h264.c @@ -2,10 +2,10 @@ #include #include "http/http.h" -#include "hw/buffer.h" -#include "hw/buffer_lock.h" -#include "hw/buffer_list.h" -#include "hw/device.h" +#include "device/hw/buffer.h" +#include "device/hw/buffer_lock.h" +#include "device/hw/buffer_list.h" +#include "device/hw/device.h" DEFINE_BUFFER_LOCK(http_h264, 0); DEFINE_BUFFER_LOCK(http_h264_lowres, 0); diff --git a/http/http_jpeg.c b/http/http_jpeg.c index a1e0021..39b08d9 100644 --- a/http/http_jpeg.c +++ b/http/http_jpeg.c @@ -2,8 +2,8 @@ #include #include "http/http.h" -#include "hw/buffer.h" -#include "hw/buffer_lock.h" +#include "device/hw/buffer.h" +#include "device/hw/buffer_lock.h" DEFINE_BUFFER_LOCK(http_jpeg, 1000); DEFINE_BUFFER_LOCK(http_jpeg_lowres, 1000); diff --git a/opts/opts.c b/opts/opts.c index 4b08988..79a6bd8 100644 --- a/opts/opts.c +++ b/opts/opts.c @@ -1,5 +1,5 @@ #include "opts.h" -#include "hw/v4l2.h" +#include "device/hw/v4l2.h" #include #include