mirror of
https://github.com/pikvm/ustreamer.git
synced 2026-03-16 12:33:43 +00:00
codebase refactoring
This commit is contained in:
@@ -6,7 +6,7 @@ parse = (?P<major>\d+)\.(?P<minor>\d+)(\.(?P<patch>\d+)(\-(?P<release>[a-z]+))?)
|
|||||||
serialize =
|
serialize =
|
||||||
{major}.{minor}
|
{major}.{minor}
|
||||||
|
|
||||||
[bumpversion:file:src/config.h]
|
[bumpversion:file:src/common/config.h]
|
||||||
search = VERSION "{current_version}"
|
search = VERSION "{current_version}"
|
||||||
replace = VERSION "{new_version}"
|
replace = VERSION "{new_version}"
|
||||||
|
|
||||||
|
|||||||
10
Makefile
10
Makefile
@@ -20,7 +20,7 @@ LINTERS_IMAGE ?= $(PROG)-linters
|
|||||||
# =====
|
# =====
|
||||||
_LIBS = -lm -ljpeg -pthread -levent -levent_pthreads -luuid
|
_LIBS = -lm -ljpeg -pthread -levent -levent_pthreads -luuid
|
||||||
override CFLAGS += -c -std=c11 -Wall -Wextra -D_GNU_SOURCE
|
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
|
define optbool
|
||||||
@@ -31,14 +31,14 @@ endef
|
|||||||
ifneq ($(call optbool,$(WITH_OMX)),)
|
ifneq ($(call optbool,$(WITH_OMX)),)
|
||||||
_LIBS += -lbcm_host -lvcos -lopenmaxil -L$(RPI_VC_LIBS)
|
_LIBS += -lbcm_host -lvcos -lopenmaxil -L$(RPI_VC_LIBS)
|
||||||
override CFLAGS += -DWITH_OMX -DOMX_SKIP64BIT -I$(RPI_VC_HEADERS)
|
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
|
endif
|
||||||
|
|
||||||
|
|
||||||
ifneq ($(call optbool,$(WITH_GPIO)),)
|
ifneq ($(call optbool,$(WITH_GPIO)),)
|
||||||
_LIBS += -lgpiod
|
_LIBS += -lgpiod
|
||||||
override CFLAGS += -DWITH_GPIO
|
override CFLAGS += -DWITH_GPIO
|
||||||
_SRCS += $(shell ls src/gpio/*.c)
|
_SRCS += $(shell ls src/ustreamer/gpio/*.c)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
@@ -76,8 +76,8 @@ uninstall:
|
|||||||
|
|
||||||
|
|
||||||
regen:
|
regen:
|
||||||
tools/make-jpeg-h.py src/http/data/blank.jpeg src/http/data/blank_jpeg.h BLANK
|
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/http/data/index.html src/http/data/index_html.h INDEX
|
tools/make-html-h.py src/ustreamer/http/data/index.html src/ustreamer/http/data/index_html.h INDEX
|
||||||
|
|
||||||
|
|
||||||
$(PROG): $(_SRCS:%.c=$(BUILD)/%.o)
|
$(PROG): $(_SRCS:%.c=$(BUILD)/%.o)
|
||||||
|
|||||||
@@ -47,4 +47,4 @@ deps =
|
|||||||
|
|
||||||
[testenv:htmlhint]
|
[testenv:htmlhint]
|
||||||
whitelist_externals = htmlhint
|
whitelist_externals = htmlhint
|
||||||
commands = htmlhint src/http/data/*.html
|
commands = htmlhint src/ustreamer/http/data/*.html
|
||||||
|
|||||||
@@ -39,9 +39,10 @@
|
|||||||
#include <linux/videodev2.h>
|
#include <linux/videodev2.h>
|
||||||
#include <linux/v4l2-controls.h>
|
#include <linux/v4l2-controls.h>
|
||||||
|
|
||||||
#include "tools.h"
|
#include "../common/tools.h"
|
||||||
#include "logging.h"
|
#include "../common/logging.h"
|
||||||
#include "threading.h"
|
#include "../common/threading.h"
|
||||||
|
|
||||||
#include "xioctl.h"
|
#include "xioctl.h"
|
||||||
#include "picture.h"
|
#include "picture.h"
|
||||||
|
|
||||||
@@ -29,9 +29,10 @@
|
|||||||
|
|
||||||
#include <linux/videodev2.h>
|
#include <linux/videodev2.h>
|
||||||
|
|
||||||
#include "tools.h"
|
#include "../common/tools.h"
|
||||||
#include "threading.h"
|
#include "../common/threading.h"
|
||||||
#include "logging.h"
|
#include "../common/logging.h"
|
||||||
|
|
||||||
#include "device.h"
|
#include "device.h"
|
||||||
|
|
||||||
#include "encoders/cpu/encoder.h"
|
#include "encoders/cpu/encoder.h"
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
#include <linux/videodev2.h>
|
#include <linux/videodev2.h>
|
||||||
|
|
||||||
#include "../../tools.h"
|
#include "../../../common/tools.h"
|
||||||
#include "../../picture.h"
|
#include "../../picture.h"
|
||||||
#include "../../device.h"
|
#include "../../device.h"
|
||||||
|
|
||||||
@@ -33,8 +33,8 @@
|
|||||||
|
|
||||||
#include <linux/videodev2.h>
|
#include <linux/videodev2.h>
|
||||||
|
|
||||||
#include "../../tools.h"
|
#include "../../../common/tools.h"
|
||||||
#include "../../logging.h"
|
#include "../../../common/logging.h"
|
||||||
#include "../../xioctl.h"
|
#include "../../xioctl.h"
|
||||||
#include "../../picture.h"
|
#include "../../picture.h"
|
||||||
#include "../../device.h"
|
#include "../../device.h"
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
#include <IL/OMX_Core.h>
|
#include <IL/OMX_Core.h>
|
||||||
#include <IL/OMX_Component.h>
|
#include <IL/OMX_Component.h>
|
||||||
|
|
||||||
#include "../../logging.h"
|
#include "../../../common/logging.h"
|
||||||
|
|
||||||
#include "formatters.h"
|
#include "formatters.h"
|
||||||
|
|
||||||
@@ -36,8 +36,8 @@
|
|||||||
#include <IL/OMX_Broadcom.h>
|
#include <IL/OMX_Broadcom.h>
|
||||||
#include <interface/vcos/vcos_semaphore.h>
|
#include <interface/vcos/vcos_semaphore.h>
|
||||||
|
|
||||||
#include "../../logging.h"
|
#include "../../../common/logging.h"
|
||||||
#include "../../tools.h"
|
#include "../../../common/tools.h"
|
||||||
#include "../../picture.h"
|
#include "../../picture.h"
|
||||||
#include "../../device.h"
|
#include "../../device.h"
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@
|
|||||||
#include <IL/OMX_IVCommon.h>
|
#include <IL/OMX_IVCommon.h>
|
||||||
#include <IL/OMX_Core.h>
|
#include <IL/OMX_Core.h>
|
||||||
|
|
||||||
#include "../../tools.h"
|
#include "../../../common/tools.h"
|
||||||
|
|
||||||
|
|
||||||
#define CASE_TO_STRING(_value) \
|
#define CASE_TO_STRING(_value) \
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
#include <IL/OMX_Core.h>
|
#include <IL/OMX_Core.h>
|
||||||
#include <IL/OMX_Image.h>
|
#include <IL/OMX_Image.h>
|
||||||
|
|
||||||
#include "../../logging.h"
|
#include "../../../common/logging.h"
|
||||||
|
|
||||||
|
|
||||||
#define LOG_ERROR_OMX(_error, _msg, ...) { \
|
#define LOG_ERROR_OMX(_error, _msg, ...) { \
|
||||||
@@ -30,9 +30,9 @@
|
|||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <gpiod.h>
|
#include <gpiod.h>
|
||||||
|
|
||||||
#include "../tools.h"
|
#include "../../common/tools.h"
|
||||||
#include "../logging.h"
|
#include "../../common/logging.h"
|
||||||
#include "../threading.h"
|
#include "../../common/threading.h"
|
||||||
|
|
||||||
|
|
||||||
struct gpio_t gpio = {
|
struct gpio_t gpio = {
|
||||||
@@ -27,8 +27,8 @@
|
|||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <gpiod.h>
|
#include <gpiod.h>
|
||||||
|
|
||||||
#include "../tools.h"
|
#include "../../common/tools.h"
|
||||||
#include "../logging.h"
|
#include "../../common/logging.h"
|
||||||
|
|
||||||
|
|
||||||
struct gpio_output_t {
|
struct gpio_output_t {
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "../tools.h"
|
#include "../../common/tools.h"
|
||||||
|
|
||||||
|
|
||||||
static const char _ENCODING_TABLE[] = {
|
static const char _ENCODING_TABLE[] = {
|
||||||
@@ -28,8 +28,8 @@
|
|||||||
|
|
||||||
#include <jpeglib.h>
|
#include <jpeglib.h>
|
||||||
|
|
||||||
#include "../tools.h"
|
#include "../../common/tools.h"
|
||||||
#include "../logging.h"
|
#include "../../common/logging.h"
|
||||||
#include "../picture.h"
|
#include "../picture.h"
|
||||||
|
|
||||||
#include "data/blank_jpeg.h"
|
#include "data/blank_jpeg.h"
|
||||||
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
@@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "../../config.h"
|
#include "../../../common/config.h"
|
||||||
|
|
||||||
|
|
||||||
const char HTML_INDEX_PAGE[] = " \
|
const char HTML_INDEX_PAGE[] = " \
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
#include <event2/util.h>
|
#include <event2/util.h>
|
||||||
|
|
||||||
#include "../tools.h"
|
#include "../../common/tools.h"
|
||||||
|
|
||||||
|
|
||||||
static const struct {
|
static const struct {
|
||||||
@@ -28,7 +28,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "../tools.h"
|
#include "../../common/tools.h"
|
||||||
|
|
||||||
|
|
||||||
char *simplify_request_path(const char *str) {
|
char *simplify_request_path(const char *str) {
|
||||||
@@ -51,10 +51,10 @@
|
|||||||
# error Required libevent-pthreads support
|
# error Required libevent-pthreads support
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "../tools.h"
|
#include "../../common/tools.h"
|
||||||
#include "../threading.h"
|
#include "../../common/threading.h"
|
||||||
#include "../logging.h"
|
#include "../../common/logging.h"
|
||||||
#include "../process.h"
|
#include "../../common/process.h"
|
||||||
#include "../picture.h"
|
#include "../picture.h"
|
||||||
#include "../encoder.h"
|
#include "../encoder.h"
|
||||||
#include "../stream.h"
|
#include "../stream.h"
|
||||||
@@ -29,8 +29,8 @@
|
|||||||
|
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
#include "../tools.h"
|
#include "../../common/tools.h"
|
||||||
#include "../logging.h"
|
#include "../../common/logging.h"
|
||||||
|
|
||||||
#include "path.h"
|
#include "path.h"
|
||||||
|
|
||||||
@@ -35,8 +35,8 @@
|
|||||||
#include <event2/http.h>
|
#include <event2/http.h>
|
||||||
#include <event2/util.h>
|
#include <event2/util.h>
|
||||||
|
|
||||||
#include "../tools.h"
|
#include "../../common/tools.h"
|
||||||
#include "../logging.h"
|
#include "../../common/logging.h"
|
||||||
|
|
||||||
|
|
||||||
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) {
|
||||||
@@ -36,9 +36,10 @@
|
|||||||
|
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
|
||||||
#include "tools.h"
|
#include "../common/tools.h"
|
||||||
#include "threading.h"
|
#include "../common/threading.h"
|
||||||
#include "logging.h"
|
#include "../common/logging.h"
|
||||||
|
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "device.h"
|
#include "device.h"
|
||||||
#include "encoder.h"
|
#include "encoder.h"
|
||||||
@@ -33,9 +33,10 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#include "config.h"
|
#include "../common/config.h"
|
||||||
#include "logging.h"
|
#include "../common/logging.h"
|
||||||
#include "process.h"
|
#include "../common/process.h"
|
||||||
|
|
||||||
#include "device.h"
|
#include "device.h"
|
||||||
#include "encoder.h"
|
#include "encoder.h"
|
||||||
#include "http/server.h"
|
#include "http/server.h"
|
||||||
@@ -27,8 +27,8 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#include "tools.h"
|
#include "../common/tools.h"
|
||||||
#include "logging.h"
|
#include "../common/logging.h"
|
||||||
|
|
||||||
|
|
||||||
struct picture_t *picture_init(void) {
|
struct picture_t *picture_init(void) {
|
||||||
@@ -31,9 +31,10 @@
|
|||||||
|
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
|
||||||
#include "tools.h"
|
#include "../common/tools.h"
|
||||||
#include "threading.h"
|
#include "../common/threading.h"
|
||||||
#include "logging.h"
|
#include "../common/logging.h"
|
||||||
|
|
||||||
#include "picture.h"
|
#include "picture.h"
|
||||||
#include "device.h"
|
#include "device.h"
|
||||||
#include "encoder.h"
|
#include "encoder.h"
|
||||||
@@ -26,8 +26,8 @@
|
|||||||
|
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
|
|
||||||
#include "tools.h"
|
#include "../common/tools.h"
|
||||||
#include "logging.h"
|
#include "../common/logging.h"
|
||||||
|
|
||||||
|
|
||||||
#ifndef CFG_XIOCTL_RETRIES
|
#ifndef CFG_XIOCTL_RETRIES
|
||||||
@@ -46,7 +46,7 @@ def main() -> None:
|
|||||||
for line in html.split("\n")
|
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"
|
text += f"const char HTML_{name}_PAGE[] = \" \\\n{html}\n\";\n"
|
||||||
|
|
||||||
with open(header_path, "w") as header_file:
|
with open(header_path, "w") as header_file:
|
||||||
|
|||||||
Reference in New Issue
Block a user