diff --git a/Build.mk b/Build.mk index 9e4f5da47..e3defd33d 100644 --- a/Build.mk +++ b/Build.mk @@ -6,7 +6,7 @@ version = 0.5 cflags = -O2 -g $(warn) $(warn_c) cxxflags = -O2 -g $(warn) $(warn_cxx) -cppflags = -Iinclude -I$(top_srcdir)/include +cppflags = -I$(top_builddir) -Iinclude -I$(top_srcdir)/include ldflags = $(if $(or $(have_apple),$(have_san)),,-Wl,--no-undefined) warn = -Wall \ @@ -49,9 +49,6 @@ SED ?= sed configs += atomic atomic-assert = __ATOMIC_SEQ_CST -configs += bigendian -bigendian-assert = __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ - configs += eventfd eventfd-includes = sys/eventfd.h eventfd-functions = eventfd @@ -94,24 +91,7 @@ includesubdir = $(notdir $(patsubst %/,%,$(dir $1))) genfiles = config.h include/upipe/config.h config.h: - $(call cmd,gen){ \ - $(if $(have_alsa),echo "#define HAVE_ALSA_ASOUNDLIB_H 1";) \ - $(if $(have_atomic),echo "#define HAVE_ATOMIC_OPS 1";) \ - $(if $(have_audiotoolbox),echo "#define HAVE_AUDIOTOOLBOX_AUDIOTOOLBOX_H 1";) \ - $(if $(have_bearssl),echo "#define HAVE_BEARSSL_H 1";) \ - $(if $(have_bigendian),echo "#define WORDS_BIGENDIAN 1";) \ - $(if $(have_bitstream),echo "#define HAVE_BITSTREAM_COMMON_H 1";) \ - $(if $(have_eventfd),echo "#define HAVE_EVENTFD 1";) \ - $(if $(have_features.h),echo "#define HAVE_FEATURES_H 1";) \ - $(if $(have_libgcrypt),echo "#define HAVE_GCRYPT_H 1";) \ - $(if $(have_libtasn1),echo "#define HAVE_LIBTASN1_H 1";) \ - $(if $(have_net/if.h),echo "#define HAVE_NET_IF_H 1";) \ - $(if $(have_pipe),echo "#define HAVE_PIPE 1";) \ - $(if $(have_semaphore),echo "#define HAVE_SEMAPHORE_H 1";) \ - $(if $(have_unistd.h),echo "#define HAVE_UNISTD_H 1";) \ - $(if $(have_x86asm),echo "#define HAVE_X86ASM 1";) \ - $(if $(have_zvbi-0.2),echo "#define HAVE_LIBZVBI_H 1";) \ - } > $@ + $(call cmd,config.h) # --- coding-style checks ------------------------------------------------------ diff --git a/Makefile b/Makefile index 95ea6591c..e81482c4f 100644 --- a/Makefile +++ b/Makefile @@ -714,6 +714,19 @@ config-deps: config-env: @$(foreach v,$(_config_env_vars),printf "%-15s: %s\n" $v '$($v)';) +[a-z] = a b c d e f g h i j k l m n o p q r s t u v w x y z +[A-Z] = A B C D E F G H I J K L M N O P Q R S T U V W X Y Z + +_tr = $(strip $(if $1,$(subst $(firstword $1),$(firstword $2),\ + $(call _tr,$(wordlist 2,26,$1),$(wordlist 2,26,$2),$3)),$3)) +_toupper = $(call _tr,$([a-z]),$([A-Z]),$1) +_toid = $(call _tr,- . /,_ _ _,$1) +_have = $(sort $(foreach c,$(configs) $(_pkgs),\ + $(if $(have_$c),$(call _toid,$(call _toupper,$c))))) + +print-config.h = CONFIG $@ +cmd-config.h = for i in $(_have); do echo "\#define HAVE_$$i 1"; done > $@ + _distcleanfiles = config.mk config.log $(if $(_oot),Makefile) $(_makefiles) # --- dependencies ------------------------------------------------------------- diff --git a/examples/hls2rtp.c b/examples/hls2rtp.c index 395a4e005..80f115781 100644 --- a/examples/hls2rtp.c +++ b/examples/hls2rtp.c @@ -30,7 +30,7 @@ #include #include -#include "upipe/config.h" +#include "config.h" #include "upipe/upipe_dump.h" #include "upipe/uprobe.h" #include "upipe/uprobe_helper_uprobe.h" @@ -81,10 +81,10 @@ #include "upipe-pthread/uprobe_pthread_upump_mgr.h" #include "upipe-pthread/upipe_pthread_transfer.h" #include "upipe-pthread/umutex_pthread.h" -#ifdef UPIPE_HAVE_OPENSSL_SSL_H +#ifdef HAVE_OPENSSL #include "upipe-openssl/uprobe_https_openssl.h" #endif -#ifdef UPIPE_HAVE_BEARSSL_H +#ifdef HAVE_BEARSSL #include "upipe-bearssl/uprobe_https_bearssl.h" #endif @@ -1287,10 +1287,10 @@ enum opt { OPT_DELAY, OPT_QUIT_TIMEOUT, OPT_USER_AGENT, -#ifdef UPIPE_HAVE_BEARSSL_H +#ifdef HAVE_BEARSSL OPT_USE_BEARSSL, #endif -#ifdef UPIPE_HAVE_OPENSSL_SSL_H +#ifdef HAVE_OPENSSL OPT_USE_OPENSSL, #endif }; @@ -1323,10 +1323,10 @@ static struct option options[] = { { "delay", required_argument, NULL, OPT_DELAY }, { "quit-timeout", required_argument, NULL, OPT_QUIT_TIMEOUT }, { "user-agent", required_argument, NULL, OPT_USER_AGENT }, -#ifdef UPIPE_HAVE_BEARSSL_H +#ifdef HAVE_BEARSSL { "use-bearssl", no_argument, NULL, OPT_USE_BEARSSL }, #endif -#ifdef UPIPE_HAVE_OPENSSL_SSL_H +#ifdef HAVE_OPENSSL { "use-openssl", no_argument, NULL, OPT_USE_OPENSSL }, #endif { 0, 0, 0, 0 }, @@ -1369,11 +1369,11 @@ int main(int argc, char **argv) enum upipe_ts_conformance conformance = UPIPE_TS_CONFORMANCE_AUTO; bool no_stdin = false; -#ifdef UPIPE_HAVE_BEARSSL_H +#ifdef HAVE_BEARSSL bool use_bearssl = true; #endif -#ifdef UPIPE_HAVE_OPENSSL_SSL_H +#ifdef HAVE_OPENSSL bool use_openssl = true; #endif @@ -1482,19 +1482,19 @@ int main(int argc, char **argv) case OPT_MISSING_ARG: return usage(argv[0], "missing argument"); -#ifdef UPIPE_HAVE_BEARSSL_H +#ifdef HAVE_BEARSSL case OPT_USE_BEARSSL: use_bearssl = true; -#ifdef UPIPE_HAVE_OPENSSL_SSL_H +#ifdef HAVE_OPENSSL use_openssl = false; #endif break; #endif -#ifdef UPIPE_HAVE_OPENSSL_SSL_H +#ifdef HAVE_OPENSSL case OPT_USE_OPENSSL: use_openssl = true; -#ifdef UPIPE_HAVE_BEARSSL_H +#ifdef HAVE_BEARSSL use_bearssl = false; #endif break; @@ -1793,12 +1793,12 @@ int main(int argc, char **argv) uprobe_release(main_probe); main_probe = &probe_src; -#ifdef UPIPE_HAVE_OPENSSL_SSL_H +#ifdef HAVE_OPENSSL if (use_openssl) main_probe = uprobe_https_openssl_alloc(main_probe); #endif -#ifdef UPIPE_HAVE_BEARSSL_H +#ifdef HAVE_BEARSSL if (use_bearssl) main_probe = uprobe_https_bearssl_alloc(main_probe); #endif diff --git a/examples/ts_encrypt.c b/examples/ts_encrypt.c index f0a0bdec9..80fa0bff1 100644 --- a/examples/ts_encrypt.c +++ b/examples/ts_encrypt.c @@ -23,7 +23,7 @@ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "upipe/config.h" +#include "config.h" #include "upump-ev/upump_ev.h" @@ -73,7 +73,7 @@ #include #include -#ifdef UPIPE_HAVE_GCRYPT_H +#ifdef HAVE_LIBGCRYPT #include #endif @@ -269,7 +269,7 @@ int main(int argc, char *argv[]) exit(-1); } -#ifdef UPIPE_HAVE_GCRYPT_H +#ifdef HAVE_LIBGCRYPT gcry_check_version(NULL); gcry_control(GCRYCTL_INITIALIZATION_FINISHED, 0); #endif diff --git a/examples/uplay.c b/examples/uplay.c index b9a6373d5..993ae4120 100644 --- a/examples/uplay.c +++ b/examples/uplay.c @@ -31,6 +31,7 @@ #include #include +#include "config.h" #include "upipe/uprobe.h" #include "upipe/uprobe_stdio.h" #include "upipe/uprobe_prefix.h" @@ -81,9 +82,9 @@ #include "upipe-gl/upipe_glx_sink.h" #include "upipe-gl/uprobe_gl_sink.h" #include "upipe-gl/uprobe_gl_sink_cube.h" -#ifdef UPIPE_HAVE_ALSA_ASOUNDLIB_H +#ifdef HAVE_ALSA #include "upipe-alsa/upipe_alsa_sink.h" -#elif defined(UPIPE_HAVE_AUDIOTOOLBOX_AUDIOTOOLBOX_H) +#elif defined(HAVE_AUDIOTOOLBOX) #include "upipe-osx/upipe_osx_audioqueue_sink.h" #endif @@ -482,7 +483,7 @@ static int catch_audio(struct uprobe *uprobe, struct upipe *upipe, uprobe_throw(uprobe_main, NULL, UPROBE_FREEZE_UPUMP_MGR); struct upipe *sink; -#ifdef UPIPE_HAVE_ALSA_ASOUNDLIB_H +#ifdef HAVE_ALSA struct upipe_mgr *upipe_alsink_mgr = upipe_alsink_mgr_alloc(); sink = upipe_void_alloc(upipe_alsink_mgr, uprobe_pfx_alloc(uprobe_use(uprobe_main), UPROBE_LOG_VERBOSE, @@ -490,7 +491,7 @@ static int catch_audio(struct uprobe *uprobe, struct upipe *upipe, assert(sink != NULL); upipe_mgr_release(upipe_alsink_mgr); upipe_attach_uclock(sink); -#elif defined(UPIPE_HAVE_AUDIOTOOLBOX_AUDIOTOOLBOX_H) +#elif defined(HAVE_AUDIOTOOLBOX) struct upipe_mgr *upipe_osx_audioqueue_sink_mgr = upipe_osx_audioqueue_sink_mgr_alloc(); sink = upipe_void_alloc(upipe_osx_audioqueue_sink_mgr, diff --git a/include/upipe-av/upipe_av_samplefmt.h b/include/upipe-av/upipe_av_samplefmt.h index e48c865d1..288064e76 100644 --- a/include/upipe-av/upipe_av_samplefmt.h +++ b/include/upipe-av/upipe_av_samplefmt.h @@ -35,6 +35,7 @@ extern "C" { #endif +#include "upipe/ubase.h" #include "upipe/uref_sound_flow.h" #include "upipe/uref_sound_flow_formats.h" #include @@ -50,7 +51,7 @@ static const struct { { AV_SAMPLE_FMT_S32, "sound.s32." }, { AV_SAMPLE_FMT_FLT, "sound.f32." }, { AV_SAMPLE_FMT_DBL, "sound.f64." }, -#ifdef UPIPE_WORDS_BIGENDIAN +#ifdef UBASE_BIGENDIAN { AV_SAMPLE_FMT_S16, "sound.s16be." }, { AV_SAMPLE_FMT_S32, "sound.s32be." }, { AV_SAMPLE_FMT_FLT, "sound.f32be." }, @@ -91,7 +92,7 @@ upipe_av_samplefmt_to_flow_format(enum AVSampleFormat fmt) { AV_SAMPLE_FMT_S64, &uref_sound_flow_format_s64 }, { AV_SAMPLE_FMT_S64P, &uref_sound_flow_format_s64_planar }, -#ifdef UPIPE_WORDS_BIGENDIAN +#ifdef UBASE_BIGENDIAN { AV_SAMPLE_FMT_S16, &uref_sound_flow_format_s16be }, { AV_SAMPLE_FMT_S32, &uref_sound_flow_format_s32be }, { AV_SAMPLE_FMT_FLT, &uref_sound_flow_format_f32be }, diff --git a/include/upipe/uatomic.h b/include/upipe/uatomic.h index ba21d8b0a..c465f93be 100644 --- a/include/upipe/uatomic.h +++ b/include/upipe/uatomic.h @@ -65,7 +65,7 @@ typedef void * _Atomic uatomic_ptr_t; #define uatomic_fetch_add atomic_fetch_add #define uatomic_fetch_sub atomic_fetch_sub -#elif defined(UPIPE_HAVE_ATOMIC_OPS) +#elif defined(UPIPE_HAVE_ATOMIC) /* * Preferred method: gcc atomic operations @@ -161,7 +161,7 @@ static inline uint32_t uatomic_fetch_sub(uatomic_uint32_t *obj, } -#elif defined(UPIPE_HAVE_SEMAPHORE_H) /* mkdoc:skip */ +#elif defined(UPIPE_HAVE_SEMAPHORE) /* mkdoc:skip */ /* * On POSIX platforms use semaphores (slower) diff --git a/include/upipe/ubase.h b/include/upipe/ubase.h index 2ebae643c..28a831043 100644 --- a/include/upipe/ubase.h +++ b/include/upipe/ubase.h @@ -174,7 +174,11 @@ static inline void uchain_init(struct uchain *uchain) uchain->next = uchain->prev = NULL; } -#ifdef UPIPE_WORDS_BIGENDIAN +#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ +#define UBASE_BIGENDIAN +#endif + +#ifdef UBASE_BIGENDIAN /** @This allows to define a 32-bit unsigned integer with 4 letters. */ \ # define UBASE_FOURCC(a, b, c, d) \ (((uint32_t)d) | (((uint32_t)c) << 8) | (((uint32_t)b) << 16) | \ diff --git a/lib/upipe-alsa/upipe_alsa_sink.c b/lib/upipe-alsa/upipe_alsa_sink.c index 17c6eb3e4..17e66ee2d 100644 --- a/lib/upipe-alsa/upipe_alsa_sink.c +++ b/lib/upipe-alsa/upipe_alsa_sink.c @@ -162,7 +162,7 @@ static snd_pcm_format_t upipe_alsink_format_from_flow_def(struct uref *flow_def) else if (!ubase_ncmp(def, "s16be.")) format = SND_PCM_FORMAT_S16_BE; else if (!ubase_ncmp(def, "s16.")) -#ifdef UPIPE_WORDS_BIGENDIAN +#ifdef UBASE_BIGENDIAN format = SND_PCM_FORMAT_S16_BE; #else format = SND_PCM_FORMAT_S16_LE; @@ -172,7 +172,7 @@ static snd_pcm_format_t upipe_alsink_format_from_flow_def(struct uref *flow_def) else if (!ubase_ncmp(def, "u16be.")) format = SND_PCM_FORMAT_U16_BE; else if (!ubase_ncmp(def, "u16.")) -#ifdef UPIPE_WORDS_BIGENDIAN +#ifdef UBASE_BIGENDIAN format = SND_PCM_FORMAT_U16_BE; #else format = SND_PCM_FORMAT_U16_LE; @@ -190,7 +190,7 @@ static snd_pcm_format_t upipe_alsink_format_from_flow_def(struct uref *flow_def) else if (!ubase_ncmp(def, "s32be.")) format = SND_PCM_FORMAT_S32_BE; else if (!ubase_ncmp(def, "s32.")) -#ifdef UPIPE_WORDS_BIGENDIAN +#ifdef UBASE_BIGENDIAN format = SND_PCM_FORMAT_S32_BE; #else format = SND_PCM_FORMAT_S32_LE; @@ -200,7 +200,7 @@ static snd_pcm_format_t upipe_alsink_format_from_flow_def(struct uref *flow_def) else if (!ubase_ncmp(def, "u32be.")) format = SND_PCM_FORMAT_U32_BE; else if (!ubase_ncmp(def, "u32.")) -#ifdef UPIPE_WORDS_BIGENDIAN +#ifdef UBASE_BIGENDIAN format = SND_PCM_FORMAT_U32_BE; #else format = SND_PCM_FORMAT_U32_LE; @@ -210,7 +210,7 @@ static snd_pcm_format_t upipe_alsink_format_from_flow_def(struct uref *flow_def) else if (!ubase_ncmp(def, "s24be.")) format = SND_PCM_FORMAT_S24_BE; else if (!ubase_ncmp(def, "s24.")) -#ifdef UPIPE_WORDS_BIGENDIAN +#ifdef UBASE_BIGENDIAN format = SND_PCM_FORMAT_S24_BE; #else format = SND_PCM_FORMAT_S24_LE; @@ -220,7 +220,7 @@ static snd_pcm_format_t upipe_alsink_format_from_flow_def(struct uref *flow_def) else if (!ubase_ncmp(def, "u24be.")) format = SND_PCM_FORMAT_U24_BE; else if (!ubase_ncmp(def, "u24.")) -#ifdef UPIPE_WORDS_BIGENDIAN +#ifdef UBASE_BIGENDIAN format = SND_PCM_FORMAT_U24_BE; #else format = SND_PCM_FORMAT_U24_LE; @@ -230,7 +230,7 @@ static snd_pcm_format_t upipe_alsink_format_from_flow_def(struct uref *flow_def) else if (!ubase_ncmp(def, "f32be.")) format = SND_PCM_FORMAT_FLOAT_BE; else if (!ubase_ncmp(def, "f32.")) -#ifdef UPIPE_WORDS_BIGENDIAN +#ifdef UBASE_BIGENDIAN format = SND_PCM_FORMAT_FLOAT_BE; #else format = SND_PCM_FORMAT_FLOAT_LE; @@ -240,7 +240,7 @@ static snd_pcm_format_t upipe_alsink_format_from_flow_def(struct uref *flow_def) else if (!ubase_ncmp(def, "f64be.")) format = SND_PCM_FORMAT_FLOAT64_BE; else if (!ubase_ncmp(def, "f64.")) -#ifdef UPIPE_WORDS_BIGENDIAN +#ifdef UBASE_BIGENDIAN format = SND_PCM_FORMAT_FLOAT64_BE; #else format = SND_PCM_FORMAT_FLOAT64_LE; diff --git a/lib/upipe-av/upipe_avcodec_decode.c b/lib/upipe-av/upipe_avcodec_decode.c index 1a0b90340..33bca01d6 100644 --- a/lib/upipe-av/upipe_avcodec_decode.c +++ b/lib/upipe-av/upipe_avcodec_decode.c @@ -29,6 +29,7 @@ * @short Upipe avcodec decode module */ +#include "upipe/ubase.h" #include "upipe/uclock.h" #include "upipe/ubuf.h" #include "upipe/uref.h" @@ -1120,7 +1121,7 @@ static void upipe_avcdec_output_sub(struct upipe *upipe, AVSubtitle *sub, } if (unlikely( -#ifdef UPIPE_WORDS_BIGENDIAN +#ifdef UBASE_BIGENDIAN !ubase_check(uref_pic_flow_set_argb(flow_def_attr)) || #else !ubase_check(uref_pic_flow_set_bgra(flow_def_attr)) || diff --git a/lib/upipe-blackmagic/sdi.c b/lib/upipe-blackmagic/sdi.c index 0d5d0374b..42131a6bb 100644 --- a/lib/upipe-blackmagic/sdi.c +++ b/lib/upipe-blackmagic/sdi.c @@ -5,6 +5,7 @@ #include #include "sdi.h" +#include "upipe/ubase.h" static const uint8_t reverse_tab[256] = { 0x00,0x80,0x40,0xC0,0x20,0xA0,0x60,0xE0,0x10,0x90,0x50,0xD0,0x30,0xB0,0x70,0xF0, @@ -118,7 +119,7 @@ void sdi_write_cdp(const uint8_t *src, size_t src_size, static inline uint32_t to_le32(uint32_t a) { -#ifdef UPIPE_WORDS_BIGENDIAN +#ifdef UBASE_BIGENDIAN return ((a << 24) & 0xff000000 ) | ((a << 8) & 0x00ff0000 ) | ((a >> 8) & 0x0000ff00 ) | @@ -169,7 +170,7 @@ void sdi_encode_v210(uint32_t *dst, uint16_t *src, int width) } } -#ifdef UPIPE_HAVE_LIBZVBI_H +#ifdef HAVE_ZVBI_0_2 int sdi_encode_ttx_sd(uint8_t *buf, const uint8_t *pic_data, vbi_sampling_par *sp) { uint8_t line_offset = dvbvbittx_get_line(&pic_data[DVBVBI_UNIT_HEADER_SIZE]); diff --git a/lib/upipe-blackmagic/sdi.h b/lib/upipe-blackmagic/sdi.h index 1c432908a..b79aa2830 100644 --- a/lib/upipe-blackmagic/sdi.h +++ b/lib/upipe-blackmagic/sdi.h @@ -1,8 +1,8 @@ #ifndef SDI_H_ #define SDI_H_ -#include "upipe/config.h" +#include "config.h" -#ifdef UPIPE_HAVE_LIBZVBI_H +#ifdef HAVE_ZVBI_0_2 #include #endif @@ -33,7 +33,7 @@ void sdi_write_cdp(const uint8_t *src, size_t src_size, void sdi_encode_v210_sd(uint32_t *dst, uint8_t *src, int width); void sdi_encode_v210(uint32_t *dst, uint16_t *src, int width); -#ifdef UPIPE_HAVE_LIBZVBI_H +#ifdef HAVE_ZVBI_0_2 int sdi_encode_ttx_sd(uint8_t *buf, const uint8_t *pic_data, vbi_sampling_par *sp); #endif void sdi_encode_ttx(uint16_t *buf, int packets, const uint8_t **packet, uint16_t *ctr); diff --git a/lib/upipe-blackmagic/upipe_blackmagic_sink.cpp b/lib/upipe-blackmagic/upipe_blackmagic_sink.cpp index afd4a68c1..09296878f 100644 --- a/lib/upipe-blackmagic/upipe_blackmagic_sink.cpp +++ b/lib/upipe-blackmagic/upipe_blackmagic_sink.cpp @@ -27,7 +27,7 @@ #define __STDC_FORMAT_MACROS 1 #define __STDC_CONSTANT_MACROS 1 -#include "upipe/config.h" +#include "config.h" #include "upipe/uatomic.h" #include "upipe/ulist.h" #include "upipe/uqueue.h" @@ -55,7 +55,7 @@ #include #include -#ifdef UPIPE_HAVE_LIBZVBI_H +#ifdef HAVE_ZVBI_0_2 #include #endif @@ -278,7 +278,7 @@ struct upipe_bmd_sink { /** OP47 teletext buffer. 5, packets per field */ uint8_t op47_ttx_buf[DVBVBI_LENGTH * OP47_PACKETS_PER_FIELD * 2]; -#ifdef UPIPE_HAVE_LIBZVBI_H +#ifdef HAVE_ZVBI_0_2 /** vbi **/ vbi_sampling_par sp; #endif @@ -477,7 +477,7 @@ class callback : public IDeckLinkVideoOutputCallback uint64_t pts; }; -#ifdef UPIPE_HAVE_LIBZVBI_H +#ifdef HAVE_ZVBI_0_2 /* VBI Teletext */ static void upipe_bmd_sink_extract_ttx(IDeckLinkVideoFrameAncillary *ancillary, const uint8_t *pic_data, size_t pic_data_size, int w, int sd, @@ -859,7 +859,7 @@ static upipe_bmd_sink_frame *get_video_frame(struct upipe *upipe, int w = upipe_bmd_sink->displayMode->GetWidth(); int h = upipe_bmd_sink->displayMode->GetHeight(); int sd = upipe_bmd_sink->mode == bmdModePAL || upipe_bmd_sink->mode == bmdModeNTSC; -#ifdef UPIPE_HAVE_LIBZVBI_H +#ifdef HAVE_ZVBI_0_2 int ttx = upipe_bmd_sink->mode == bmdModePAL || upipe_bmd_sink->mode == bmdModeHD1080i50; #endif @@ -932,7 +932,7 @@ static upipe_bmd_sink_frame *get_video_frame(struct upipe *upipe, uref_clock_get_pts_sys(uref, &vid_pts); vid_pts += upipe_bmd_sink->pic_subpipe.latency; -#ifdef UPIPE_HAVE_LIBZVBI_H +#ifdef HAVE_ZVBI_0_2 /* iterate through input subpipes */ pthread_mutex_lock(&upipe_bmd_sink->lock); struct uchain *uchain = NULL; @@ -1740,7 +1740,7 @@ static int upipe_bmd_open_vid(struct upipe *upipe) upipe_bmd_sink->genlock_status = -1; upipe_bmd_sink->genlock_transition_time = 0; -#ifdef UPIPE_HAVE_LIBZVBI_H +#ifdef HAVE_ZVBI_0_2 if (upipe_bmd_sink->mode == bmdModePAL) { upipe_bmd_sink->sp.scanning = 625; /* PAL */ upipe_bmd_sink->sp.sampling_format = VBI_PIXFMT_YUV420; diff --git a/lib/upipe-dvbcsa/upipe_dvbcsa_decrypt.c b/lib/upipe-dvbcsa/upipe_dvbcsa_decrypt.c index 48ec4f405..f2a96b213 100644 --- a/lib/upipe-dvbcsa/upipe_dvbcsa_decrypt.c +++ b/lib/upipe-dvbcsa/upipe_dvbcsa_decrypt.c @@ -24,7 +24,7 @@ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "upipe/config.h" +#include "config.h" #include "upipe/upipe.h" #include "upipe/upump.h" #include "upipe/uclock.h" @@ -46,7 +46,7 @@ #include #include -#ifdef UPIPE_HAVE_GCRYPT_H +#ifdef HAVE_LIBGCRYPT #include #endif @@ -63,7 +63,7 @@ static void upipe_dvbcsa_dec_worker(struct upump *upump); enum mode { CSA, CSA_BS, -#ifdef UPIPE_HAVE_GCRYPT_H +#ifdef HAVE_LIBGCRYPT AES, #endif }; @@ -105,7 +105,7 @@ struct upipe_dvbcsa_dec { dvbcsa_bs_key_t *key_bs[2]; /** dvbcsa key */ dvbcsa_key_t *key[2]; -#ifdef UPIPE_HAVE_GCRYPT_H +#ifdef HAVE_LIBGCRYPT /** AES handle */ gcry_cipher_hd_t aes[2]; #endif @@ -166,7 +166,7 @@ static void upipe_dvbcsa_dec_free_key(struct upipe *upipe) for (int i = 0; i < 2; i++) dvbcsa_bs_key_free(upipe_dvbcsa_dec->key_bs[i]); break; -#ifdef UPIPE_HAVE_GCRYPT_H +#ifdef HAVE_LIBGCRYPT case AES: for (int i = 0; i < 2; i++) if (upipe_dvbcsa_dec->aes[i]) @@ -232,7 +232,7 @@ static struct upipe *upipe_dvbcsa_dec_alloc(struct upipe_mgr *mgr, struct upipe_dvbcsa_common *common = upipe_dvbcsa_dec_to_common(upipe_dvbcsa_dec); -#ifdef UPIPE_HAVE_GCRYPT_H +#ifdef HAVE_LIBGCRYPT if (!gcry_control(GCRYCTL_INITIALIZATION_FINISHED_P)) { uprobe_err(uprobe, upipe, "Application did not initialize libgcrypt, see " "https://www.gnupg.org/documentation/manuals/gcrypt/Initializing-the-library.html"); @@ -470,7 +470,7 @@ static void upipe_dvbcsa_dec_input(struct upipe *upipe, return; } -#ifdef UPIPE_HAVE_GCRYPT_H +#ifdef HAVE_LIBGCRYPT if (upipe_dvbcsa_dec->mode == AES) { /* from biss2 spec */ static const uint8_t cissa_iv[16] = { @@ -592,7 +592,7 @@ static int upipe_dvbcsa_dec_set_key(struct upipe *upipe, const char *even_key, c upipe_dvbcsa_dec_free_key(upipe); UBASE_ALLOC_RETURN(upipe_dvbcsa_dec->key_bs[1]); dvbcsa_bs_key_set(odd_cw.value, upipe_dvbcsa_dec->key_bs[1]); -#ifdef UPIPE_HAVE_GCRYPT_H +#ifdef HAVE_LIBGCRYPT } else if (even_cw.str.len >= 32) { upipe_dvbcsa_dec->mode = AES; gcry_error_t err; diff --git a/lib/upipe-framers/upipe_h264_framer.c b/lib/upipe-framers/upipe_h264_framer.c index ff27d774c..3df9be4dd 100644 --- a/lib/upipe-framers/upipe_h264_framer.c +++ b/lib/upipe-framers/upipe_h264_framer.c @@ -23,6 +23,7 @@ * @short Upipe module building frames from chunks of an ISO 14496-10 stream */ +#include "upipe/ubase.h" #include "upipe/uref.h" #include "upipe/uref_flow.h" #include "upipe/uref_block.h" @@ -622,7 +623,7 @@ static bool upipe_h264f_activate_sps(struct upipe *upipe, uint32_t sps_id) chroma_idc != H264SPS_CHROMA_444 ? 8 : 12); } -#ifdef UPIPE_WORDS_BIGENDIAN +#ifdef UBASE_BIGENDIAN # define ENDIANNESS "b" #else # define ENDIANNESS "l" diff --git a/lib/upipe-framers/upipe_h265_framer.c b/lib/upipe-framers/upipe_h265_framer.c index 53593489a..ef44b29d8 100644 --- a/lib/upipe-framers/upipe_h265_framer.c +++ b/lib/upipe-framers/upipe_h265_framer.c @@ -22,6 +22,7 @@ * @short Upipe module building frames from chunks of an ITU-T H.265 stream */ +#include "upipe/ubase.h" #include "upipe/uref.h" #include "upipe/uref_flow.h" #include "upipe/uref_block.h" @@ -923,7 +924,7 @@ static bool upipe_h265f_activate_sps(struct upipe *upipe, uint32_t sps_id) return false; } -#ifdef UPIPE_WORDS_BIGENDIAN +#ifdef UBASE_BIGENDIAN # define ENDIANNESS "b" #else # define ENDIANNESS "l" diff --git a/lib/upipe-hbrmt/upipe_pack10bit.c b/lib/upipe-hbrmt/upipe_pack10bit.c index 5cf5cd494..9cdae2386 100644 --- a/lib/upipe-hbrmt/upipe_pack10bit.c +++ b/lib/upipe-hbrmt/upipe_pack10bit.c @@ -22,7 +22,7 @@ * @short Upipe pack10bit module */ -#include "upipe/config.h" +#include "config.h" #include "upipe/ubase.h" #include "upipe/uref.h" #include "upipe/ubuf.h" @@ -344,7 +344,7 @@ static struct upipe *upipe_pack10bit_alloc(struct upipe_mgr *mgr, upipe_pack10bit->pack = upipe_uyvy_to_sdi_c; -#if defined(UPIPE_HAVE_X86ASM) +#if defined(HAVE_X86ASM) #if defined(__i686__) || defined(__x86_64__) if (__builtin_cpu_supports("ssse3")) upipe_pack10bit->pack = upipe_uyvy_to_sdi_ssse3; diff --git a/lib/upipe-hbrmt/upipe_unpack10bit.c b/lib/upipe-hbrmt/upipe_unpack10bit.c index 101056775..ddf24f46c 100644 --- a/lib/upipe-hbrmt/upipe_unpack10bit.c +++ b/lib/upipe-hbrmt/upipe_unpack10bit.c @@ -22,7 +22,7 @@ * @short Upipe pack10bit module */ -#include "upipe/config.h" +#include "config.h" #include "upipe/ubase.h" #include "upipe/uref.h" #include "upipe/ubuf.h" @@ -330,7 +330,7 @@ static struct upipe *upipe_unpack10bit_alloc(struct upipe_mgr *mgr, struct upipe_unpack10bit *upipe_unpack10bit = upipe_unpack10bit_from_upipe(upipe); upipe_unpack10bit->unpack = upipe_sdi_to_uyvy_c; -#if defined(UPIPE_HAVE_X86ASM) +#if defined(HAVE_X86ASM) #if defined(__i686__) || defined(__x86_64__) if (__builtin_cpu_supports("ssse3")) upipe_unpack10bit->unpack = upipe_sdi_to_uyvy_ssse3; diff --git a/lib/upipe-modules/upipe_htons.c b/lib/upipe-modules/upipe_htons.c index cb9fa5b83..3fd8cebb6 100644 --- a/lib/upipe-modules/upipe_htons.c +++ b/lib/upipe-modules/upipe_htons.c @@ -81,7 +81,7 @@ static void upipe_htons_input(struct upipe *upipe, struct uref *uref, int bufsize = -1, offset = 0; uint8_t *buf = NULL; -#ifdef UPIPE_WORDS_BIGENDIAN +#ifdef UBASE_BIGENDIAN upipe_htons_output(upipe, uref, upump_p); return; #endif diff --git a/lib/upipe-modules/upipe_udp.c b/lib/upipe-modules/upipe_udp.c index 8a7246434..0eef567b2 100644 --- a/lib/upipe-modules/upipe_udp.c +++ b/lib/upipe-modules/upipe_udp.c @@ -28,6 +28,7 @@ * @short Upipe internal helper functions for udp modules */ +#include "config.h" #include "upipe/upipe.h" #include @@ -41,7 +42,7 @@ #include #include -#ifdef UPIPE_HAVE_NET_IF_H +#ifdef HAVE_NET_IF_H #include #endif #include "upipe_udp.h" diff --git a/lib/upipe-ts/upipe_ts_demux.c b/lib/upipe-ts/upipe_ts_demux.c index 9709bedc0..b75cf6638 100644 --- a/lib/upipe-ts/upipe_ts_demux.c +++ b/lib/upipe-ts/upipe_ts_demux.c @@ -39,7 +39,7 @@ * - ETSI TR 101 211 V1.9.1 (2009-06) (Guidelines of SI in DVB systems) */ -#include "upipe/config.h" +#include "config.h" #include "upipe/ubase.h" #include "upipe/ulist.h" #include "upipe/uprobe.h" @@ -81,7 +81,7 @@ #include "upipe-ts/upipe_ts_psi_split.h" #include "upipe-ts/upipe_ts_pat_decoder.h" #include "upipe-ts/upipe_ts_cat_decoder.h" -#if defined(UPIPE_HAVE_GCRYPT_H) && defined(UPIPE_HAVE_LIBTASN1_H) +#ifdef HAVE_TS_CRYPT #include "upipe-ts/upipe_ts_emm_decoder.h" #endif #include "upipe-ts/upipe_ts_pmt_decoder.h" @@ -3209,7 +3209,7 @@ static int upipe_ts_demux_catd_probe(struct uprobe *uprobe, upipe_throw_fatal(upipe, UBASE_ERR_ALLOC); return UBASE_ERR_ALLOC; } -#if defined(UPIPE_HAVE_GCRYPT_H) && defined(UPIPE_HAVE_LIBTASN1_H) +#ifdef HAVE_TS_CRYPT if (upipe_ts_demux->private_key) upipe_ts_emmd_set_private_key(upipe_ts_demux->emmd, upipe_ts_demux->private_key); @@ -3839,7 +3839,7 @@ static int upipe_ts_demux_control(struct upipe *upipe, const char *private_key = va_arg(args, const char *); free(upipe_ts_demux->private_key); upipe_ts_demux->private_key = strdup(private_key); -#if defined(UPIPE_HAVE_GCRYPT_H) && defined(UPIPE_HAVE_LIBTASN1_H) +#ifdef HAVE_TS_CRYPT if (upipe_ts_demux->emmd) upipe_ts_emmd_set_private_key(upipe_ts_demux->emmd, upipe_ts_demux->private_key); @@ -4129,7 +4129,7 @@ struct upipe_mgr *upipe_ts_demux_mgr_alloc(void) ts_demux_mgr->ts_psi_split_mgr = upipe_ts_psi_split_mgr_alloc(); ts_demux_mgr->ts_patd_mgr = upipe_ts_patd_mgr_alloc(); ts_demux_mgr->ts_catd_mgr = upipe_ts_catd_mgr_alloc(); -#if defined(UPIPE_HAVE_GCRYPT_H) && defined(UPIPE_HAVE_LIBTASN1_H) +#ifdef HAVE_TS_CRYPT ts_demux_mgr->ts_emmd_mgr = upipe_ts_emmd_mgr_alloc(); #endif ts_demux_mgr->ts_nitd_mgr = upipe_ts_nitd_mgr_alloc(); diff --git a/lib/upipe-v210/upipe_v210dec.c b/lib/upipe-v210/upipe_v210dec.c index 159e6f3ab..8729b2673 100644 --- a/lib/upipe-v210/upipe_v210dec.c +++ b/lib/upipe-v210/upipe_v210dec.c @@ -26,7 +26,7 @@ * @short Upipe v210dec module */ -#include "upipe/config.h" +#include "config.h" #include "upipe/ubase.h" #include "upipe/uref.h" #include "upipe/ubuf.h" @@ -168,7 +168,7 @@ static void v210dec_setup_asm(struct upipe *upipe, bool assembly) if (!assembly) return; -#ifdef UPIPE_HAVE_X86ASM +#ifdef HAVE_X86ASM #if defined(__i686__) || defined(__x86_64__) if (__builtin_cpu_supports("ssse3")) { v210dec->v210_to_planar_8 = upipe_v210_to_planar_8_ssse3; diff --git a/lib/upipe-v210/upipe_v210enc.c b/lib/upipe-v210/upipe_v210enc.c index 0de7d0e3b..d234d702f 100644 --- a/lib/upipe-v210/upipe_v210enc.c +++ b/lib/upipe-v210/upipe_v210enc.c @@ -26,7 +26,7 @@ * @short Upipe v210enc module */ -#include "upipe/config.h" +#include "config.h" #include "upipe/ubase.h" #include "upipe/uref.h" #include "upipe/ubuf.h" @@ -577,7 +577,7 @@ static struct upipe *upipe_v210enc_alloc(struct upipe_mgr *mgr, upipe_v210enc->pack_line_8 = upipe_planar_to_v210_8_c; upipe_v210enc->pack_line_10 = upipe_planar_to_v210_10_c; -#ifdef UPIPE_HAVE_X86ASM +#ifdef HAVE_X86ASM #if defined(__i686__) || defined(__x86_64__) if (__builtin_cpu_supports("ssse3")) { upipe_v210enc->pack_line_8 = upipe_planar_to_v210_8_ssse3; diff --git a/lib/upipe-x264/Build.mk b/lib/upipe-x264/Build.mk index 794d821af..717f1031a 100644 --- a/lib/upipe-x264/Build.mk +++ b/lib/upipe-x264/Build.mk @@ -14,7 +14,3 @@ configs += x264-mpeg2 x264-mpeg2-functions = x264_param_default_mpeg2 x264-mpeg2-includes = stdint.h x264.h x264-mpeg2-libs = x264 - -libupipe_x264-cppflags = \ - $(if $(have_x264-obe),-DHAVE_X264_OBE) \ - $(if $(have_x264-mpeg2),-DHAVE_X264_MPEG2) diff --git a/lib/upipe-x264/upipe_x264.c b/lib/upipe-x264/upipe_x264.c index f25e3305d..162ceb735 100644 --- a/lib/upipe-x264/upipe_x264.c +++ b/lib/upipe-x264/upipe_x264.c @@ -29,6 +29,7 @@ #define _GNU_SOURCE +#include "config.h" #include "upipe/uclock.h" #include "upipe/uref.h" #include "upipe/uref_flow.h" diff --git a/tests/checkasm/Build.mk b/tests/checkasm/Build.mk index b817121cf..205db0192 100644 --- a/tests/checkasm/Build.mk +++ b/tests/checkasm/Build.mk @@ -15,7 +15,7 @@ checkasm-src += \ $(if $(have_x86asm),checkasm_x86.asm timer_x86.h) checkasm-nasmflags = $(if $(have_pic),-DPIC) -checkasm-cppflags = -I$(top_srcdir) -I$(top_builddir) +checkasm-cppflags = -I$(top_srcdir) checkasm-libs = libavutil $(builddir)/checkasm: \ diff --git a/tests/checkasm/sdi_input.c b/tests/checkasm/sdi_input.c index 1a63631ce..d6d81de15 100644 --- a/tests/checkasm/sdi_input.c +++ b/tests/checkasm/sdi_input.c @@ -39,13 +39,13 @@ void checkasm_check_sdi_input(void) struct { void (*uyvy)(const uint8_t *src, uint16_t *dst, uintptr_t pixels); } s = { -#ifdef HAVE_BITSTREAM_COMMON_H +#ifdef HAVE_BITSTREAM .uyvy = upipe_sdi_to_uyvy_c, #endif }; #ifdef HAVE_X86ASM -#ifdef HAVE_BITSTREAM_COMMON_H +#ifdef HAVE_BITSTREAM int cpu_flags = av_get_cpu_flags(); if (cpu_flags & AV_CPU_FLAG_SSSE3) { diff --git a/tests/checkasm/uyvy_input.c b/tests/checkasm/uyvy_input.c index 54b4f381c..6b9bdd1f5 100644 --- a/tests/checkasm/uyvy_input.c +++ b/tests/checkasm/uyvy_input.c @@ -40,13 +40,13 @@ void checkasm_check_uyvy_input(void) struct { void (*sdi)(uint8_t *dst, const uint8_t *src, uintptr_t pixels); } s = { -#ifdef HAVE_BITSTREAM_COMMON_H +#ifdef HAVE_BITSTREAM .sdi = upipe_uyvy_to_sdi_c, #endif }; #ifdef HAVE_X86ASM -#ifdef HAVE_BITSTREAM_COMMON_H +#ifdef HAVE_BITSTREAM int cpu_flags = av_get_cpu_flags(); if (cpu_flags & AV_CPU_FLAG_SSSE3) { diff --git a/tests/upipe_auto_source_test.c b/tests/upipe_auto_source_test.c index af6509d83..2c64a11d6 100644 --- a/tests/upipe_auto_source_test.c +++ b/tests/upipe_auto_source_test.c @@ -1,6 +1,6 @@ #undef NDEBUG -#include "upipe/config.h" +#include "config.h" #include "upump-ev/upump_ev.h" #include "upipe/uprobe_stdio.h" #include "upipe/umem.h" @@ -21,10 +21,10 @@ #include "upipe-modules/upipe_http_source.h" #include "upipe-modules/upipe_dump.h" #include "upipe-modules/upipe_null.h" -#ifdef UPIPE_HAVE_BEARSSL_H +#ifdef HAVE_BEARSSL #include "upipe-bearssl/uprobe_https_bearssl.h" #endif -#ifdef UPIPE_HAVE_OPENSSL_SSL_H +#ifdef HAVE_OPENSSL #include "upipe-openssl/uprobe_https_openssl.h" #endif @@ -243,12 +243,12 @@ int main(int argc, char *argv[]) assert(main_probe); } -#ifdef UPIPE_HAVE_BEARSSL_H +#ifdef HAVE_BEARSSL main_probe = uprobe_https_bearssl_alloc(main_probe); assert(main_probe); #endif -#ifdef UPIPE_HAVE_OPENSSL_SSL_H +#ifdef HAVE_OPENSSL main_probe = uprobe_https_openssl_alloc(main_probe); assert(main_probe); #endif @@ -263,7 +263,7 @@ int main(int argc, char *argv[]) upipe_fsrc_mgr)); ubase_assert(upipe_auto_src_mgr_set_mgr(upipe_auto_src_mgr, "http", upipe_http_src_mgr)); -#if defined(UPIPE_HAVE_BEARSSL_H) || defined(UPIPE_HAVE_OPENSSL_SSL_H) +#if defined(HAVE_BEARSSL) || defined(HAVE_OPENSSL) ubase_assert(upipe_auto_src_mgr_set_mgr(upipe_auto_src_mgr, "https", upipe_http_src_mgr)); #endif diff --git a/tests/upipe_http_src_test.c b/tests/upipe_http_src_test.c index 0f16c781c..baf639584 100644 --- a/tests/upipe_http_src_test.c +++ b/tests/upipe_http_src_test.c @@ -29,7 +29,7 @@ #undef NDEBUG -#include "upipe/config.h" +#include "config.h" #include "upipe/uprobe.h" #include "upipe/uprobe_stdio.h" #include "upipe/uprobe_prefix.h" @@ -50,10 +50,10 @@ #include "upipe-modules/upipe_http_source.h" #include "upipe-modules/uprobe_http_redirect.h" #include "upipe-modules/upipe_file_sink.h" -#ifdef UPIPE_HAVE_BEARSSL_H +#ifdef HAVE_BEARSSL #include "upipe-bearssl/uprobe_https_bearssl.h" #endif -#ifdef UPIPE_HAVE_OPENSSL_SSL_H +#ifdef HAVE_OPENSSL #include "upipe-openssl/uprobe_https_openssl.h" #endif @@ -126,10 +126,10 @@ int main(int argc, char *argv[]) int opt; int index; int parallel = 1; -#ifdef UPIPE_HAVE_BEARSSL_H +#ifdef HAVE_BEARSSL bool use_bearssl = true; #endif -#ifdef UPIPE_HAVE_OPENSSL_SSL_H +#ifdef HAVE_OPENSSL bool use_openssl = true; #endif @@ -157,19 +157,19 @@ int main(int argc, char *argv[]) parallel = atoi(optarg); break; -#ifdef UPIPE_HAVE_BEARSSL_H +#ifdef HAVE_BEARSSL case OPT_USE_BEARSSL: use_bearssl = true; -#ifdef UPIPE_HAVE_OPENSSL_SSL_H +#ifdef HAVE_OPENSSL use_openssl = false; #endif break; #endif -#ifdef UPIPE_HAVE_OPENSSL_SSL_H +#ifdef HAVE_OPENSSL case OPT_USE_OPENSSL: use_openssl = true; -#ifdef UPIPE_HAVE_BEARSSL_H +#ifdef HAVE_BEARSSL use_bearssl = false; #endif break; @@ -218,14 +218,14 @@ int main(int argc, char *argv[]) assert(logger != NULL); logger = uprobe_http_redir_alloc(logger); assert(logger); -#ifdef UPIPE_HAVE_BEARSSL_H +#ifdef HAVE_BEARSSL if (use_bearssl) { logger = uprobe_https_bearssl_alloc(logger); assert(logger); } #endif -#ifdef UPIPE_HAVE_OPENSSL_SSL_H +#ifdef HAVE_OPENSSL if (use_openssl) { logger = uprobe_https_openssl_alloc(logger); assert(logger);