diff --git a/src/common/logging.c b/src/common/logging.c index ac7a2a2..fab476c 100644 --- a/src/common/logging.c +++ b/src/common/logging.c @@ -20,10 +20,6 @@ *****************************************************************************/ -#include - -#include - #include "logging.h" diff --git a/src/rawsink/rawsink.c b/src/rawsink/rawsink.c index f51d663..ad28e5f 100644 --- a/src/rawsink/rawsink.c +++ b/src/rawsink/rawsink.c @@ -22,20 +22,6 @@ #include "rawsink.h" -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include "../common/tools.h" -#include "../common/logging.h" - static int _sem_wait_monotonic(sem_t *sem, long double timeout); @@ -181,14 +167,14 @@ void rawsink_put( goto error; } -# define SH(_field) rawsink->shared->_field = _field - SH(format); - SH(width); - SH(height); - SH(grab_ts); - SH(size); +# define COPY(_field) rawsink->shared->_field = _field + COPY(format); + COPY(width); + COPY(height); + COPY(grab_ts); + COPY(size); memcpy(rawsink->shared->data, data, size); -# undef SH +# undef COPY if (sem_post(rawsink->signal_sem) < 0) { LOG_PERROR("RAWSINK: Can't post %s", rawsink->signal_name); @@ -237,14 +223,14 @@ int rawsink_get( WAIT_SEM(signal); WAIT_SEM(lock); -# define SH(_field) *_field = rawsink->shared->_field - SH(format); - SH(width); - SH(height); - SH(grab_ts); - SH(size); +# define COPY(_field) *_field = rawsink->shared->_field + COPY(format); + COPY(width); + COPY(height); + COPY(grab_ts); + COPY(size); memcpy(data, rawsink->shared->data, *size); -# undef SH +# undef COPY if (sem_post(rawsink->lock_sem) < 0) { LOG_PERROR("RAWSINK: Can't post %s", rawsink->lock_name); diff --git a/src/rawsink/rawsink.h b/src/rawsink/rawsink.h index 82fa095..2f4c575 100644 --- a/src/rawsink/rawsink.h +++ b/src/rawsink/rawsink.h @@ -23,10 +23,18 @@ #pragma once #include +#include +#include #include +#include +#include #include #include +#include + +#include "../common/tools.h" +#include "../common/logging.h" #ifndef CFG_RAWSINK_MAX_DATA diff --git a/src/ustreamer/device.c b/src/ustreamer/device.c index 877581b..58a457a 100644 --- a/src/ustreamer/device.c +++ b/src/ustreamer/device.c @@ -22,29 +22,6 @@ #include "device.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include - -#include "../common/tools.h" -#include "../common/logging.h" -#include "../common/threading.h" - -#include "xioctl.h" - static const struct { const char *name; diff --git a/src/ustreamer/device.h b/src/ustreamer/device.h index 8963170..cfad645 100644 --- a/src/ustreamer/device.h +++ b/src/ustreamer/device.h @@ -22,11 +22,29 @@ #pragma once +#include #include #include +#include +#include +#include +#include +#include +#include + +#include +#include +#include #include #include +#include + +#include "../common/tools.h" +#include "../common/logging.h" +#include "../common/threading.h" + +#include "xioctl.h" #ifdef WITH_RAWSINK # include "../rawsink/rawsink.h" diff --git a/src/ustreamer/encoder.c b/src/ustreamer/encoder.c index 10c95f5..880c130 100644 --- a/src/ustreamer/encoder.c +++ b/src/ustreamer/encoder.c @@ -22,26 +22,6 @@ #include "encoder.h" -#include -#include -#include -#include - -#include - -#include "../common/tools.h" -#include "../common/threading.h" -#include "../common/logging.h" - -#include "device.h" -#include "picture.h" - -#include "encoders/cpu/encoder.h" -#include "encoders/hw/encoder.h" -#ifdef WITH_OMX -# include "encoders/omx/encoder.h" -#endif - static const struct { const char *name; diff --git a/src/ustreamer/encoder.h b/src/ustreamer/encoder.h index a4fbb56..03cccdd 100644 --- a/src/ustreamer/encoder.h +++ b/src/ustreamer/encoder.h @@ -22,18 +22,27 @@ #pragma once +#include #include +#include +#include #include +#include + +#include "../common/tools.h" +#include "../common/threading.h" +#include "../common/logging.h" #include "device.h" #include "picture.h" +#include "encoders/cpu/encoder.h" +#include "encoders/hw/encoder.h" + #ifdef WITH_OMX # include "encoders/omx/encoder.h" - # define ENCODER_TYPES_OMX_HINT ", OMX" - # ifndef CFG_MAX_GLITCHED_RESOLUTIONS # define CFG_MAX_GLITCHED_RESOLUTIONS 1024 # endif diff --git a/src/ustreamer/encoders/cpu/encoder.c b/src/ustreamer/encoders/cpu/encoder.c index c734ac8..7f72a3a 100644 --- a/src/ustreamer/encoders/cpu/encoder.c +++ b/src/ustreamer/encoders/cpu/encoder.c @@ -27,18 +27,6 @@ #include "encoder.h" -#include -#include -#include - -#include - -#include - -#include "../../../common/tools.h" -#include "../../picture.h" -#include "../../device.h" - struct _jpeg_dest_manager_t { struct jpeg_destination_mgr mgr; // Default manager diff --git a/src/ustreamer/encoders/cpu/encoder.h b/src/ustreamer/encoders/cpu/encoder.h index b59c2e8..7e4ae0f 100644 --- a/src/ustreamer/encoders/cpu/encoder.h +++ b/src/ustreamer/encoders/cpu/encoder.h @@ -22,8 +22,17 @@ #pragma once -#include "../../device.h" +#include +#include +#include + +#include + +#include + +#include "../../../common/tools.h" #include "../../picture.h" +#include "../../device.h" void cpu_encoder_compress_buffer(struct hw_buffer_t *hw, struct picture_t *picture, unsigned quality); diff --git a/src/ustreamer/encoders/hw/encoder.c b/src/ustreamer/encoders/hw/encoder.c index bba9826..3c9f2a0 100644 --- a/src/ustreamer/encoders/hw/encoder.c +++ b/src/ustreamer/encoders/hw/encoder.c @@ -27,20 +27,6 @@ #include "encoder.h" -#include -#include -#include - -#include - -#include "../../../common/tools.h" -#include "../../../common/logging.h" -#include "../../xioctl.h" -#include "../../picture.h" -#include "../../device.h" - -#include "huffman.h" - void _copy_plus_huffman(const struct hw_buffer_t *src, struct picture_t *dest); static bool _is_huffman(const unsigned char *data); diff --git a/src/ustreamer/encoders/hw/encoder.h b/src/ustreamer/encoders/hw/encoder.h index 27a9600..fe784bf 100644 --- a/src/ustreamer/encoders/hw/encoder.h +++ b/src/ustreamer/encoders/hw/encoder.h @@ -22,8 +22,19 @@ #pragma once -#include "../../device.h" +#include +#include +#include + +#include + +#include "../../../common/tools.h" +#include "../../../common/logging.h" +#include "../../xioctl.h" #include "../../picture.h" +#include "../../device.h" + +#include "huffman.h" int hw_encoder_prepare(struct device_t *dev, unsigned quality); diff --git a/src/ustreamer/encoders/omx/component.c b/src/ustreamer/encoders/omx/component.c index 69f8a41..87fa128 100644 --- a/src/ustreamer/encoders/omx/component.c +++ b/src/ustreamer/encoders/omx/component.c @@ -22,15 +22,6 @@ #include "component.h" -#include - -#include -#include - -#include "../../../common/logging.h" - -#include "formatters.h" - static int _component_wait_port_changed(OMX_HANDLETYPE *component, OMX_U32 port, OMX_BOOL enabled); static int _component_wait_state_changed(OMX_HANDLETYPE *component, OMX_STATETYPE wanted); diff --git a/src/ustreamer/encoders/omx/component.h b/src/ustreamer/encoders/omx/component.h index f9c34b5..945ad69 100644 --- a/src/ustreamer/encoders/omx/component.h +++ b/src/ustreamer/encoders/omx/component.h @@ -23,10 +23,15 @@ #pragma once #include +#include #include #include +#include "../../../common/logging.h" + +#include "formatters.h" + #define OMX_INIT_STRUCTURE(_var) { \ memset(&(_var), 0, sizeof(_var)); \ diff --git a/src/ustreamer/encoders/omx/encoder.c b/src/ustreamer/encoders/omx/encoder.c index 774f3f1..04f526e 100644 --- a/src/ustreamer/encoders/omx/encoder.c +++ b/src/ustreamer/encoders/omx/encoder.c @@ -22,28 +22,6 @@ #include "encoder.h" -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include - -#include "../../../common/logging.h" -#include "../../../common/tools.h" -#include "../../device.h" -#include "../../picture.h" - -#include "formatters.h" -#include "component.h" - static const OMX_U32 _INPUT_PORT = 340; static const OMX_U32 _OUTPUT_PORT = 341; diff --git a/src/ustreamer/encoders/omx/encoder.h b/src/ustreamer/encoders/omx/encoder.h index 9995286..401a1da 100644 --- a/src/ustreamer/encoders/omx/encoder.h +++ b/src/ustreamer/encoders/omx/encoder.h @@ -22,14 +22,29 @@ #pragma once +#include #include +#include +#include +#include +#include + +#include +#include #include +#include #include +#include "../../../common/logging.h" +#include "../../../common/tools.h" #include "../../device.h" #include "../../picture.h" +#include "formatters.h" +#include "component.h" + + #ifndef CFG_OMX_MAX_ENCODERS # define CFG_OMX_MAX_ENCODERS 3 // Raspberry Pi limitation #endif diff --git a/src/ustreamer/encoders/omx/formatters.c b/src/ustreamer/encoders/omx/formatters.c index a920fa7..50448b9 100644 --- a/src/ustreamer/encoders/omx/formatters.c +++ b/src/ustreamer/encoders/omx/formatters.c @@ -22,14 +22,6 @@ #include "formatters.h" -#include -#include - -#include -#include - -#include "../../../common/tools.h" - #define CASE_TO_STRING(_value) \ case _value: { return #_value; } diff --git a/src/ustreamer/encoders/omx/formatters.h b/src/ustreamer/encoders/omx/formatters.h index 264a65b..d6f4420 100644 --- a/src/ustreamer/encoders/omx/formatters.h +++ b/src/ustreamer/encoders/omx/formatters.h @@ -22,10 +22,14 @@ #pragma once +#include +#include + #include #include #include +#include "../../../common/tools.h" #include "../../../common/logging.h" diff --git a/src/ustreamer/gpio/gpio.c b/src/ustreamer/gpio/gpio.c index 4c7c56d..5c813e2 100644 --- a/src/ustreamer/gpio/gpio.c +++ b/src/ustreamer/gpio/gpio.c @@ -22,18 +22,6 @@ #include "gpio.h" -#include -#include -#include -#include - -#include -#include - -#include "../../common/tools.h" -#include "../../common/logging.h" -#include "../../common/threading.h" - struct gpio_t gpio = { .path = "/dev/gpiochip0", diff --git a/src/ustreamer/gpio/gpio.h b/src/ustreamer/gpio/gpio.h index cd588fd..8451124 100644 --- a/src/ustreamer/gpio/gpio.h +++ b/src/ustreamer/gpio/gpio.h @@ -22,13 +22,17 @@ #pragma once +#include #include +#include +#include #include #include #include "../../common/tools.h" #include "../../common/logging.h" +#include "../../common/threading.h" struct gpio_output_t { diff --git a/src/ustreamer/options.c b/src/ustreamer/options.c index f34a7c5..cc0f369 100644 --- a/src/ustreamer/options.c +++ b/src/ustreamer/options.c @@ -22,28 +22,6 @@ #include "options.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "../common/config.h" -#include "../common/logging.h" -#include "../common/process.h" - -#include "device.h" -#include "encoder.h" -#include "http/server.h" -#ifdef WITH_GPIO -# include "gpio/gpio.h" -#endif - enum _OPT_VALUES { _O_DEVICE = 'd', diff --git a/src/ustreamer/options.h b/src/ustreamer/options.h index 50a17ab..e26a297 100644 --- a/src/ustreamer/options.h +++ b/src/ustreamer/options.h @@ -22,9 +22,27 @@ #pragma once +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../common/config.h" +#include "../common/logging.h" +#include "../common/process.h" + #include "device.h" #include "encoder.h" #include "http/server.h" +#ifdef WITH_GPIO +# include "gpio/gpio.h" +#endif struct options_t { diff --git a/src/ustreamer/picture.c b/src/ustreamer/picture.c index 11b0f21..c869cc8 100644 --- a/src/ustreamer/picture.c +++ b/src/ustreamer/picture.c @@ -22,14 +22,6 @@ #include "picture.h" -#include -#include -#include -#include - -#include "../common/tools.h" -#include "../common/logging.h" - struct picture_t *picture_init(void) { struct picture_t *picture; diff --git a/src/ustreamer/picture.h b/src/ustreamer/picture.h index 045ca40..0dd0b09 100644 --- a/src/ustreamer/picture.h +++ b/src/ustreamer/picture.h @@ -24,6 +24,12 @@ #include #include +#include +#include +#include + +#include "../common/tools.h" +#include "../common/logging.h" struct picture_t { diff --git a/src/ustreamer/stream.c b/src/ustreamer/stream.c index 471eff4..9406d1d 100644 --- a/src/ustreamer/stream.c +++ b/src/ustreamer/stream.c @@ -22,29 +22,6 @@ #include "stream.h" -#include -#include -#include -#include -#include -#include - -#include - -#include "../common/tools.h" -#include "../common/threading.h" -#include "../common/logging.h" - -#include "picture.h" -#include "device.h" -#include "encoder.h" -#ifdef WITH_RAWSINK -# include "../rawsink/rawsink.h" -#endif -#ifdef WITH_GPIO -# include "gpio/gpio.h" -#endif - struct _worker_t { pthread_t tid; diff --git a/src/ustreamer/stream.h b/src/ustreamer/stream.h index 18cf130..80b68a3 100644 --- a/src/ustreamer/stream.h +++ b/src/ustreamer/stream.h @@ -22,14 +22,28 @@ #pragma once +#include #include #include +#include +#include +#include #include +#include "../common/tools.h" +#include "../common/threading.h" +#include "../common/logging.h" + #include "picture.h" #include "device.h" #include "encoder.h" +#ifdef WITH_RAWSINK +# include "../rawsink/rawsink.h" +#endif +#ifdef WITH_GPIO +# include "gpio/gpio.h" +#endif struct process_t {