diff --git a/janus/Makefile b/janus/Makefile index b8b8ba6..8d00eca 100644 --- a/janus/Makefile +++ b/janus/Makefile @@ -12,7 +12,7 @@ _PLUGIN = libjanus_ustreamer.so _CFLAGS = -fPIC -MD -c -std=c11 -Wall -Wextra -D_GNU_SOURCE $(shell pkg-config --cflags glib-2.0) $(CFLAGS) _LDFLAGS = -shared -lm -pthread -lrt -ljansson -lopus -lasound $(shell pkg-config --libs glib-2.0) $(LDFLAGS) -_SRCS = $(shell ls src/*.c) +_SRCS = $(shell ls src/uslibs/*.c src/*.c) _BUILD = build diff --git a/janus/src/audio.h b/janus/src/audio.h index 075c063..5bde8d2 100644 --- a/janus/src/audio.h +++ b/janus/src/audio.h @@ -37,9 +37,10 @@ #include #include -#include "tools.h" +#include "uslibs/tools.h" +#include "uslibs/threading.h" + #include "jlogging.h" -#include "threading.h" #include "queue.h" diff --git a/janus/src/base64.c b/janus/src/base64.c deleted file mode 120000 index a911067..0000000 --- a/janus/src/base64.c +++ /dev/null @@ -1 +0,0 @@ -../../src/libs/base64.c \ No newline at end of file diff --git a/janus/src/base64.h b/janus/src/base64.h deleted file mode 120000 index 1a74653..0000000 --- a/janus/src/base64.h +++ /dev/null @@ -1 +0,0 @@ -../../src/libs/base64.h \ No newline at end of file diff --git a/janus/src/config.h b/janus/src/config.h deleted file mode 120000 index 4bf94da..0000000 --- a/janus/src/config.h +++ /dev/null @@ -1 +0,0 @@ -../../src/libs/config.h \ No newline at end of file diff --git a/janus/src/frame.c b/janus/src/frame.c deleted file mode 120000 index 3bc454d..0000000 --- a/janus/src/frame.c +++ /dev/null @@ -1 +0,0 @@ -../../src/libs/frame.c \ No newline at end of file diff --git a/janus/src/frame.h b/janus/src/frame.h deleted file mode 120000 index 73ed450..0000000 --- a/janus/src/frame.h +++ /dev/null @@ -1 +0,0 @@ -../../src/libs/frame.h \ No newline at end of file diff --git a/janus/src/jlogging.h b/janus/src/jlogging.h index 0bc80c6..52bba97 100644 --- a/janus/src/jlogging.h +++ b/janus/src/jlogging.h @@ -22,7 +22,7 @@ #include -#include "tools.h" +#include "uslibs/tools.h" #define JLOG_INFO(_prefix, _msg, ...) JANUS_LOG(LOG_INFO, "== ustreamer/%-9s -- " _msg "\n", _prefix, ##__VA_ARGS__) diff --git a/janus/src/list.h b/janus/src/list.h deleted file mode 120000 index faaa81a..0000000 --- a/janus/src/list.h +++ /dev/null @@ -1 +0,0 @@ -../../src/libs/list.h \ No newline at end of file diff --git a/janus/src/memsinksh.h b/janus/src/memsinksh.h deleted file mode 120000 index 52d4728..0000000 --- a/janus/src/memsinksh.h +++ /dev/null @@ -1 +0,0 @@ -../../src/libs/memsinksh.h \ No newline at end of file diff --git a/janus/src/plugin.c b/janus/src/plugin.c index 144c250..9b89378 100644 --- a/janus/src/plugin.c +++ b/janus/src/plugin.c @@ -38,12 +38,13 @@ #include #include -#include "config.h" -#include "tools.h" +#include "uslibs/config.h" +#include "uslibs/tools.h" +#include "uslibs/threading.h" +#include "uslibs/list.h" +#include "uslibs/memsinksh.h" + #include "jlogging.h" -#include "threading.h" -#include "list.h" -#include "memsinksh.h" #include "audio.h" #include "rtpv.h" #include "rtpa.h" diff --git a/janus/src/queue.h b/janus/src/queue.h index 8ac67cc..c96d98d 100644 --- a/janus/src/queue.h +++ b/janus/src/queue.h @@ -27,8 +27,8 @@ #include -#include "tools.h" -#include "threading.h" +#include "uslibs/tools.h" +#include "uslibs/threading.h" // Based on https://github.com/seifzadeh/c-pthread-queue/blob/master/queue.h diff --git a/janus/src/rtp.h b/janus/src/rtp.h index 36dc09a..74e1ade 100644 --- a/janus/src/rtp.h +++ b/janus/src/rtp.h @@ -31,7 +31,7 @@ #include -#include "tools.h" +#include "uslibs/tools.h" // https://stackoverflow.com/questions/47635545/why-webrtc-chose-rtp-max-packet-size-to-1200-bytes diff --git a/janus/src/rtpa.h b/janus/src/rtpa.h index 90399b8..3c0deca 100644 --- a/janus/src/rtpa.h +++ b/janus/src/rtpa.h @@ -32,9 +32,9 @@ #include -#include "tools.h" -#include "threading.h" -#include "audio.h" +#include "uslibs/tools.h" +#include "uslibs/threading.h" + #include "rtp.h" diff --git a/janus/src/rtpv.h b/janus/src/rtpv.h index 4ca7e58..780dcd8 100644 --- a/janus/src/rtpv.h +++ b/janus/src/rtpv.h @@ -36,10 +36,11 @@ #include -#include "tools.h" -#include "threading.h" -#include "frame.h" -#include "base64.h" +#include "uslibs/tools.h" +#include "uslibs/threading.h" +#include "uslibs/frame.h" +#include "uslibs/base64.h" + #include "rtp.h" diff --git a/janus/src/threading.h b/janus/src/threading.h deleted file mode 120000 index 44824c3..0000000 --- a/janus/src/threading.h +++ /dev/null @@ -1 +0,0 @@ -../../src/libs/threading.h \ No newline at end of file diff --git a/janus/src/tools.h b/janus/src/tools.h deleted file mode 120000 index c2a07b7..0000000 --- a/janus/src/tools.h +++ /dev/null @@ -1 +0,0 @@ -../../src/libs/tools.h \ No newline at end of file diff --git a/janus/src/uslibs/base64.c b/janus/src/uslibs/base64.c new file mode 120000 index 0000000..e23719d --- /dev/null +++ b/janus/src/uslibs/base64.c @@ -0,0 +1 @@ +../../../src/libs/base64.c \ No newline at end of file diff --git a/janus/src/uslibs/base64.h b/janus/src/uslibs/base64.h new file mode 120000 index 0000000..72182d3 --- /dev/null +++ b/janus/src/uslibs/base64.h @@ -0,0 +1 @@ +../../../src/libs/base64.h \ No newline at end of file diff --git a/janus/src/uslibs/config.h b/janus/src/uslibs/config.h new file mode 120000 index 0000000..b2ea182 --- /dev/null +++ b/janus/src/uslibs/config.h @@ -0,0 +1 @@ +../../../src/libs/config.h \ No newline at end of file diff --git a/janus/src/uslibs/frame.c b/janus/src/uslibs/frame.c new file mode 120000 index 0000000..456f8ec --- /dev/null +++ b/janus/src/uslibs/frame.c @@ -0,0 +1 @@ +../../../src/libs/frame.c \ No newline at end of file diff --git a/janus/src/uslibs/frame.h b/janus/src/uslibs/frame.h new file mode 120000 index 0000000..0e86d5e --- /dev/null +++ b/janus/src/uslibs/frame.h @@ -0,0 +1 @@ +../../../src/libs/frame.h \ No newline at end of file diff --git a/janus/src/uslibs/list.h b/janus/src/uslibs/list.h new file mode 120000 index 0000000..6c7ff6f --- /dev/null +++ b/janus/src/uslibs/list.h @@ -0,0 +1 @@ +../../../src/libs/list.h \ No newline at end of file diff --git a/janus/src/uslibs/memsinksh.h b/janus/src/uslibs/memsinksh.h new file mode 120000 index 0000000..6fe82d0 --- /dev/null +++ b/janus/src/uslibs/memsinksh.h @@ -0,0 +1 @@ +../../../src/libs/memsinksh.h \ No newline at end of file diff --git a/janus/src/uslibs/threading.h b/janus/src/uslibs/threading.h new file mode 120000 index 0000000..bde3eff --- /dev/null +++ b/janus/src/uslibs/threading.h @@ -0,0 +1 @@ +../../../src/libs/threading.h \ No newline at end of file diff --git a/janus/src/uslibs/tools.h b/janus/src/uslibs/tools.h new file mode 120000 index 0000000..f2b790a --- /dev/null +++ b/janus/src/uslibs/tools.h @@ -0,0 +1 @@ +../../../src/libs/tools.h \ No newline at end of file diff --git a/python/setup.py b/python/setup.py index 74c3436..e6dc3dd 100644 --- a/python/setup.py +++ b/python/setup.py @@ -1,10 +1,21 @@ import os +from typing import List + from setuptools import Extension from setuptools import setup # ===== +def _find_sources(suffix: str) -> List[str]: + sources: List[str] = [] + for (root_path, _, names) in os.walk("src"): + for name in names: + if name.endswith(suffix): + sources.append(os.path.join(root_path, name)) + return sources + + if __name__ == "__main__": setup( name="ustreamer", @@ -18,8 +29,8 @@ if __name__ == "__main__": "ustreamer", libraries=["rt", "m", "pthread"], undef_macros=["NDEBUG"], - sources=["src/" + name for name in os.listdir("src") if name.endswith(".c")], - depends=["src/" + name for name in os.listdir("src") if name.endswith(".h")], + sources=_find_sources(".c"), + depends=_find_sources(".h"), ), ], ) diff --git a/python/src/frame.c b/python/src/frame.c deleted file mode 120000 index 3bc454d..0000000 --- a/python/src/frame.c +++ /dev/null @@ -1 +0,0 @@ -../../src/libs/frame.c \ No newline at end of file diff --git a/python/src/frame.h b/python/src/frame.h deleted file mode 120000 index 73ed450..0000000 --- a/python/src/frame.h +++ /dev/null @@ -1 +0,0 @@ -../../src/libs/frame.h \ No newline at end of file diff --git a/python/src/memsinksh.h b/python/src/memsinksh.h deleted file mode 120000 index 52d4728..0000000 --- a/python/src/memsinksh.h +++ /dev/null @@ -1 +0,0 @@ -../../src/libs/memsinksh.h \ No newline at end of file diff --git a/python/src/tools.h b/python/src/tools.h deleted file mode 120000 index c2a07b7..0000000 --- a/python/src/tools.h +++ /dev/null @@ -1 +0,0 @@ -../../src/libs/tools.h \ No newline at end of file diff --git a/python/src/uslibs/frame.c b/python/src/uslibs/frame.c new file mode 120000 index 0000000..456f8ec --- /dev/null +++ b/python/src/uslibs/frame.c @@ -0,0 +1 @@ +../../../src/libs/frame.c \ No newline at end of file diff --git a/python/src/uslibs/frame.h b/python/src/uslibs/frame.h new file mode 120000 index 0000000..0e86d5e --- /dev/null +++ b/python/src/uslibs/frame.h @@ -0,0 +1 @@ +../../../src/libs/frame.h \ No newline at end of file diff --git a/python/src/uslibs/memsinksh.h b/python/src/uslibs/memsinksh.h new file mode 120000 index 0000000..6fe82d0 --- /dev/null +++ b/python/src/uslibs/memsinksh.h @@ -0,0 +1 @@ +../../../src/libs/memsinksh.h \ No newline at end of file diff --git a/python/src/uslibs/tools.h b/python/src/uslibs/tools.h new file mode 120000 index 0000000..f2b790a --- /dev/null +++ b/python/src/uslibs/tools.h @@ -0,0 +1 @@ +../../../src/libs/tools.h \ No newline at end of file diff --git a/python/src/ustreamer.c b/python/src/ustreamer.c index a17129b..49813c9 100644 --- a/python/src/ustreamer.c +++ b/python/src/ustreamer.c @@ -13,9 +13,9 @@ #include -#include "tools.h" -#include "frame.h" -#include "memsinksh.h" +#include "uslibs/tools.h" +#include "uslibs/frame.h" +#include "uslibs/memsinksh.h" typedef struct {