From 397f660e1461168f2edaa9bd519bf9c794a4c18f Mon Sep 17 00:00:00 2001 From: "Alfred E. Heggestad" Date: Mon, 21 Apr 2014 14:23:50 +0200 Subject: modules: add USE_AVCAPTURE and try to detect it --- mk/modules.mk | 16 ++++++++++++++++ src/config.c | 12 ++++++++++++ 2 files changed, 28 insertions(+) diff --git a/mk/modules.mk b/mk/modules.mk index 90c877c..339391b 100644 --- a/mk/modules.mk +++ b/mk/modules.mk @@ -7,6 +7,7 @@ # # USE_ALSA ALSA audio driver # USE_AMR Adaptive Multi-Rate (AMR) audio codec +# USE_AVCAPTURE AVFoundation video capture for OSX/iOS # USE_BV32 BroadVoice32 Wideband Audio codec # USE_CAIRO Cairo module # USE_CONS Console input driver @@ -64,6 +65,7 @@ USE_AMR := $(shell [ -d $(SYSROOT)/include/opencore-amrnb ] || \ USE_BV32 := $(shell [ -f $(SYSROOT)/include/bv32/bv32.h ] || \ [ -f $(SYSROOT)/local/include/bv32/bv32.h ] && echo "yes") USE_CAIRO := $(shell [ -f $(SYSROOT)/include/cairo/cairo.h ] || \ + [ -f $(SYSROOT)/local/include/cairo/cairo.h ] || \ [ -f $(SYSROOT_ALT)/include/cairo/cairo.h ] && echo "yes") USE_DTLS := $(shell [ -f $(SYSROOT)/include/openssl/dtls1.h ] || \ [ -f $(SYSROOT)/local/include/openssl/dtls1.h ] || \ @@ -98,6 +100,7 @@ USE_ILBC := $(shell [ -f $(SYSROOT)/include/iLBC_define.h ] || \ USE_ISAC := $(shell [ -f $(SYSROOT)/include/isac.h ] || \ [ -f $(SYSROOT)/local/include/isac.h ] && echo "yes") USE_MPG123 := $(shell [ -f $(SYSROOT)/include/mpg123.h ] || \ + [ -f $(SYSROOT)/local/include/mpg123.h ] || \ [ -f $(SYSROOT_ALT)/include/mpg123.h ] && echo "yes") USE_OPUS := $(shell [ -f $(SYSROOT)/include/opus/opus.h ] || \ [ -f $(SYSROOT_ALT)/include/opus/opus.h ] || \ @@ -186,7 +189,17 @@ endif endif + +USE_AVFOUNDATION := \ + $(shell [ -d /System/Library/Frameworks/AVFoundation.framework ] \ + && echo "yes") + +ifneq ($(USE_AVFOUNDATION),) +USE_AVCAPTURE := yes +else USE_QTCAPTURE := yes +endif + endif ifeq ($(OS),linux) @@ -223,6 +236,9 @@ endif ifneq ($(USE_AMR),) MODULES += amr endif +ifneq ($(USE_AVCAPTURE),) +MODULES += avcapture +endif ifneq ($(USE_BV32),) MODULES += bv32 endif diff --git a/src/config.c b/src/config.c index 4a84b67..dd94584 100644 --- a/src/config.c +++ b/src/config.c @@ -346,7 +346,13 @@ static const char *default_audio_device(void) static const char *default_video_device(void) { #ifdef DARWIN + +#ifdef QTCAPTURE_RUNLOOP return "qtcapture,nil"; +#else + return "avcapture,nil"; +#endif + #else return "v4l2,/dev/video0"; #endif @@ -608,7 +614,13 @@ int config_write_template(const char *file, const struct config *cfg) (void)re_fprintf(f, "\n# Video source modules\n"); #if defined (DARWIN) + +#ifdef QTCAPTURE_RUNLOOP (void)re_fprintf(f, "module\t\t\t" MOD_PRE "qtcapture" MOD_EXT "\n"); +#else + (void)re_fprintf(f, "module\t\t\t" MOD_PRE "avcapture" MOD_EXT "\n"); +#endif + #else (void)re_fprintf(f, "#module\t\t\t" MOD_PRE "v4l" MOD_EXT "\n"); (void)re_fprintf(f, "#module\t\t\t" MOD_PRE "v4l2" MOD_EXT "\n"); -- cgit v1.2.3