codebase refactoring

This commit is contained in:
Devaev Maxim 2020-12-06 18:45:10 +03:00
parent b502714281
commit 720baf09b5
55 changed files with 59 additions and 54 deletions

View File

@ -6,7 +6,7 @@ parse = (?P<major>\d+)\.(?P<minor>\d+)(\.(?P<patch>\d+)(\-(?P<release>[a-z]+))?)
serialize =
{major}.{minor}
[bumpversion:file:src/config.h]
[bumpversion:file:src/common/config.h]
search = VERSION "{current_version}"
replace = VERSION "{new_version}"

View File

@ -20,7 +20,7 @@ LINTERS_IMAGE ?= $(PROG)-linters
# =====
_LIBS = -lm -ljpeg -pthread -levent -levent_pthreads -luuid
override CFLAGS += -c -std=c11 -Wall -Wextra -D_GNU_SOURCE
_SRCS = $(shell ls src/*.c src/http/*.c src/encoders/cpu/*.c src/encoders/hw/*.c)
_SRCS = $(shell ls src/common/*.c src/ustreamer/*.c src/ustreamer/http/*.c src/ustreamer/encoders/cpu/*.c src/ustreamer/encoders/hw/*.c)
define optbool
@ -31,14 +31,14 @@ endef
ifneq ($(call optbool,$(WITH_OMX)),)
_LIBS += -lbcm_host -lvcos -lopenmaxil -L$(RPI_VC_LIBS)
override CFLAGS += -DWITH_OMX -DOMX_SKIP64BIT -I$(RPI_VC_HEADERS)
_SRCS += $(shell ls src/encoders/omx/*.c)
_SRCS += $(shell ls src/ustreamer/encoders/omx/*.c)
endif
ifneq ($(call optbool,$(WITH_GPIO)),)
_LIBS += -lgpiod
override CFLAGS += -DWITH_GPIO
_SRCS += $(shell ls src/gpio/*.c)
_SRCS += $(shell ls src/ustreamer/gpio/*.c)
endif
@ -76,8 +76,8 @@ uninstall:
regen:
tools/make-jpeg-h.py src/http/data/blank.jpeg src/http/data/blank_jpeg.h BLANK
tools/make-html-h.py src/http/data/index.html src/http/data/index_html.h INDEX
tools/make-jpeg-h.py src/ustreamer/http/data/blank.jpeg src/ustreamer/http/data/blank_jpeg.h BLANK
tools/make-html-h.py src/ustreamer/http/data/index.html src/ustreamer/http/data/index_html.h INDEX
$(PROG): $(_SRCS:%.c=$(BUILD)/%.o)

View File

@ -47,4 +47,4 @@ deps =
[testenv:htmlhint]
whitelist_externals = htmlhint
commands = htmlhint src/http/data/*.html
commands = htmlhint src/ustreamer/http/data/*.html

View File

@ -39,9 +39,10 @@
#include <linux/videodev2.h>
#include <linux/v4l2-controls.h>
#include "tools.h"
#include "logging.h"
#include "threading.h"
#include "../common/tools.h"
#include "../common/logging.h"
#include "../common/threading.h"
#include "xioctl.h"
#include "picture.h"

View File

@ -29,9 +29,10 @@
#include <linux/videodev2.h>
#include "tools.h"
#include "threading.h"
#include "logging.h"
#include "../common/tools.h"
#include "../common/threading.h"
#include "../common/logging.h"
#include "device.h"
#include "encoders/cpu/encoder.h"

View File

@ -35,7 +35,7 @@
#include <linux/videodev2.h>
#include "../../tools.h"
#include "../../../common/tools.h"
#include "../../picture.h"
#include "../../device.h"

View File

@ -33,8 +33,8 @@
#include <linux/videodev2.h>
#include "../../tools.h"
#include "../../logging.h"
#include "../../../common/tools.h"
#include "../../../common/logging.h"
#include "../../xioctl.h"
#include "../../picture.h"
#include "../../device.h"

View File

@ -27,7 +27,7 @@
#include <IL/OMX_Core.h>
#include <IL/OMX_Component.h>
#include "../../logging.h"
#include "../../../common/logging.h"
#include "formatters.h"

View File

@ -36,8 +36,8 @@
#include <IL/OMX_Broadcom.h>
#include <interface/vcos/vcos_semaphore.h>
#include "../../logging.h"
#include "../../tools.h"
#include "../../../common/logging.h"
#include "../../../common/tools.h"
#include "../../picture.h"
#include "../../device.h"

View File

@ -28,7 +28,7 @@
#include <IL/OMX_IVCommon.h>
#include <IL/OMX_Core.h>
#include "../../tools.h"
#include "../../../common/tools.h"
#define CASE_TO_STRING(_value) \

View File

@ -26,7 +26,7 @@
#include <IL/OMX_Core.h>
#include <IL/OMX_Image.h>
#include "../../logging.h"
#include "../../../common/logging.h"
#define LOG_ERROR_OMX(_error, _msg, ...) { \

View File

@ -30,9 +30,9 @@
#include <pthread.h>
#include <gpiod.h>
#include "../tools.h"
#include "../logging.h"
#include "../threading.h"
#include "../../common/tools.h"
#include "../../common/logging.h"
#include "../../common/threading.h"
struct gpio_t gpio = {

View File

@ -27,8 +27,8 @@
#include <pthread.h>
#include <gpiod.h>
#include "../tools.h"
#include "../logging.h"
#include "../../common/tools.h"
#include "../../common/logging.h"
struct gpio_output_t {

View File

@ -25,7 +25,7 @@
#include <stdlib.h>
#include <string.h>
#include "../tools.h"
#include "../../common/tools.h"
static const char _ENCODING_TABLE[] = {

View File

@ -28,8 +28,8 @@
#include <jpeglib.h>
#include "../tools.h"
#include "../logging.h"
#include "../../common/tools.h"
#include "../../common/logging.h"
#include "../picture.h"
#include "data/blank_jpeg.h"

View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -22,7 +22,7 @@
#pragma once
#include "../../config.h"
#include "../../../common/config.h"
const char HTML_INDEX_PAGE[] = " \

View File

@ -26,7 +26,7 @@
#include <event2/util.h>
#include "../tools.h"
#include "../../common/tools.h"
static const struct {

View File

@ -28,7 +28,7 @@
#endif
#include <string.h>
#include "../tools.h"
#include "../../common/tools.h"
char *simplify_request_path(const char *str) {

View File

@ -51,10 +51,10 @@
# error Required libevent-pthreads support
#endif
#include "../tools.h"
#include "../threading.h"
#include "../logging.h"
#include "../process.h"
#include "../../common/tools.h"
#include "../../common/threading.h"
#include "../../common/logging.h"
#include "../../common/process.h"
#include "../picture.h"
#include "../encoder.h"
#include "../stream.h"

View File

@ -29,8 +29,8 @@
#include <sys/stat.h>
#include "../tools.h"
#include "../logging.h"
#include "../../common/tools.h"
#include "../../common/logging.h"
#include "path.h"

View File

@ -35,8 +35,8 @@
#include <event2/http.h>
#include <event2/util.h>
#include "../tools.h"
#include "../logging.h"
#include "../../common/tools.h"
#include "../../common/logging.h"
evutil_socket_t evhttp_my_bind_unix(struct evhttp *http, const char *path, bool rm, mode_t mode) {

View File

@ -36,9 +36,10 @@
#include <pthread.h>
#include "tools.h"
#include "threading.h"
#include "logging.h"
#include "../common/tools.h"
#include "../common/threading.h"
#include "../common/logging.h"
#include "options.h"
#include "device.h"
#include "encoder.h"

View File

@ -33,9 +33,10 @@
#include <errno.h>
#include <assert.h>
#include "config.h"
#include "logging.h"
#include "process.h"
#include "../common/config.h"
#include "../common/logging.h"
#include "../common/process.h"
#include "device.h"
#include "encoder.h"
#include "http/server.h"

View File

@ -27,8 +27,8 @@
#include <string.h>
#include <assert.h>
#include "tools.h"
#include "logging.h"
#include "../common/tools.h"
#include "../common/logging.h"
struct picture_t *picture_init(void) {

View File

@ -31,9 +31,10 @@
#include <pthread.h>
#include "tools.h"
#include "threading.h"
#include "logging.h"
#include "../common/tools.h"
#include "../common/threading.h"
#include "../common/logging.h"
#include "picture.h"
#include "device.h"
#include "encoder.h"

View File

@ -26,8 +26,8 @@
#include <sys/ioctl.h>
#include "tools.h"
#include "logging.h"
#include "../common/tools.h"
#include "../common/logging.h"
#ifndef CFG_XIOCTL_RETRIES

View File

@ -46,7 +46,7 @@ def main() -> None:
for line in html.split("\n")
)
text = f"{common.C_PREPEND}\n#include \"../../config.h\"\n\n\n"
text = f"{common.C_PREPEND}\n#include \"../../../common/config.h\"\n\n\n"
text += f"const char HTML_{name}_PAGE[] = \" \\\n{html}\n\";\n"
with open(header_path, "w") as header_file: