diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..67ca2f8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,34 @@ +*.depend +*.layout +*.mode*v3 +*.pbxuser +*.app* +*.DS_* +._*.* + +.svn/ +obj/ +bin/ +!bin/data/ +build/ +xcuserdata/ + +ipch/ +*.suo +*.opensdf +*.vcxproj.user +*.db +*.opendb + +*.obj +*.tlog +*.sdf +*.pdb +*.idb +*.pch +Debug/ +Release/ + + +*~.xml +.vs/ diff --git a/README.md b/README.md index 0535f8c..6932c1d 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,9 @@ An Openframeworks addon to allow sending and receiving images over a network usi 06.08.18 - Updated for NDI SDK Vers 3.5 Visual Studio 2017 and Openframeworks 10.\ 10.03.19 - Updated for NDI SDK Vers 3.8\ 10.11.19 - Updated for NDI SDK Vers 4.0\ -15.11.19 - Change to dynamic load of NDI dlls +15.11.19 - Change to dynamic load of NDI dlls\ +16.11.19 - Reconfigure folders and include make files for the project generator\ +(as per [pull request](https://github.com/leadedge/ofxNDI/pull/11) by prisonerjohn). With update to NDI 4.0, shaders have been removed. All buffers need to be RGBA or BGRA and, for a sender, conversion to other formats are handled by the NDI API. Default receiving format is BGRA, and conversion to RGBA is made within the ofxNDIreceiver class. Experimental audio functions are included but not tested. @@ -15,19 +17,25 @@ ofxNDIsender and ofxNDIreceiver depend on Openframeworks. There are options to s ofxNDIsend and ofxNDIreceive classes can be used independently for applications other than Openframeworks. Sender size update and receiving buffer size change have to be manged from the application. -## Manual Setup +## Setup For Windows +### Project Generator + +The OF Project Generator will create your project with correct paths. Make sure "ofxNDI" is selected in the addons section and all headers, and DLLs will be imported in the Visual Studio project. + +### Manual Setup + 1. Add files from "ofxNDI" to your Visual Studio project. -2. Copy .dll's from "ofxNDI/libs/NDI/export" to the application "bin" folder +2. Copy .dll's from "ofxNDI/libs/NDI/export/vs/Win32" and "ofxNDI/libs/NDI/export/vs/x64" to the application "bin" folder 3. In your Visual Studio project properties : - Add "ofxNDI/src" to additional "C/C++/General/Additional Include Directories" - Add "ofxNDI/libs/NDI/include" to "C/C++/General/Additional Include Directories" - Add "#include ofxNDI.h" to your source header file ## Example sender -Copy the images from "ofxNDI/bin/data" to the application "bin/data" folder. +Copy the images from "ofxNDI/example-sender/bin/data" to the application "bin/data" folder. ## Example receiver Press 's' for a listing NDI senders. Press '0' to 'x' to select a sender. diff --git a/addon_config.mk b/addon_config.mk new file mode 100644 index 0000000..1f707cd --- /dev/null +++ b/addon_config.mk @@ -0,0 +1,85 @@ +# All variables and this file are optional, if they are not present the PG and the +# makefiles will try to parse the correct values from the file system. +# +# Variables that specify exclusions can use % as a wildcard to specify that anything in +# that position will match. A partial path can also be specified to, for example, exclude +# a whole folder from the parsed paths from the file system +# +# Variables can be specified using = or += +# = will clear the contents of that variable both specified from the file or the ones parsed +# from the file system +# += will add the values to the previous ones in the file or the ones parsed from the file +# system +# +# The PG can be used to detect errors in this file, just create a new project with this addon +# and the PG will write to the console the kind of error and in which line it is + +meta: + ADDON_NAME = ofxNDI + ADDON_DESCRIPTION = An Openframeworks addon to allow sending and receiving images over a network using the NewTek Network Device Protocol. + ADDON_AUTHOR = Lynn Jarvis + ADDON_TAGS = + ADDON_URL = https://github.com/leadedge/ofxNDI + +common: + # dependencies with other addons, a list of them separated by spaces + # or use += in several lines + # ADDON_DEPENDENCIES = + + # include search paths, this will be usually parsed from the file system + # but if the addon or addon libraries need special search paths they can be + # specified here separated by spaces or one per line using += + ADDON_INCLUDES = + ADDON_INCLUDES += libs/NDI/include + ADDON_INCLUDES += src + + # any special flag that should be passed to the compiler when using this + # addon + # ADDON_CFLAGS = + + # any special flag that should be passed to the linker when using this + # addon, also used for system libraries with -lname + # ADDON_LDFLAGS = + + # linux only, any library that should be included in the project using + # pkg-config + # ADDON_PKG_CONFIG_LIBRARIES = + + # osx/iOS only, any framework that should be included in the project + # ADDON_FRAMEWORKS = + + # source files, these will be usually parsed from the file system looking + # in the src folders in libs and the root of the addon. if your addon needs + # to include files in different places or a different set of files per platform + # they can be specified here + # ADDON_SOURCES = + + # some addons need resources to be copied to the bin/data folder of the project + # specify here any files that need to be copied, you can use wildcards like * and ? + # ADDON_DATA = + + # when parsing the file system looking for libraries exclude this for all or + # a specific platform + # ADDON_LIBS_EXCLUDE = + + ADDON_DLLS_TO_COPY = + ADDON_DLLS_TO_COPY += libs/NDI/export/vs/x64/Processing.NDI.Lib.x64.dll + ADDON_DLLS_TO_COPY += libs/NDI/export/vs/Win32/Processing.NDI.Lib.x86.dll + + # binary libraries, these will be usually parsed from the file system but some + # libraries need to passed to the linker in a specific order/ + # + # For example in the ofxOpenCV addon we do something like this: + # + # ADDON_LIBS = + # ADDON_LIBS += libs/opencv/lib/linuxarmv6l/libopencv_legacy.a + # ADDON_LIBS += libs/opencv/lib/linuxarmv6l/libopencv_calib3d.a + # ... + +linux64: +linux: +win_cb: +linuxarmv6l: +linuxarmv7l: +android/armeabi: +android/armeabi-v7a: \ No newline at end of file diff --git a/bin/data/NDI_Box.png b/bin/data/NDI_Box.png deleted file mode 100644 index 388c6ec..0000000 Binary files a/bin/data/NDI_Box.png and /dev/null differ diff --git a/bin/data/Test_Pattern.jpg b/bin/data/Test_Pattern.jpg deleted file mode 100644 index 8e156be..0000000 Binary files a/bin/data/Test_Pattern.jpg and /dev/null differ diff --git a/example-receiver/addons.make b/example-receiver/addons.make new file mode 100644 index 0000000..9850f54 --- /dev/null +++ b/example-receiver/addons.make @@ -0,0 +1 @@ +ofxNDI diff --git a/examples/example-receiver/main.cpp b/example-receiver/src/main.cpp similarity index 100% rename from examples/example-receiver/main.cpp rename to example-receiver/src/main.cpp diff --git a/examples/example-receiver/ofApp.cpp b/example-receiver/src/ofApp.cpp similarity index 100% rename from examples/example-receiver/ofApp.cpp rename to example-receiver/src/ofApp.cpp diff --git a/examples/example-receiver/ofApp.h b/example-receiver/src/ofApp.h similarity index 100% rename from examples/example-receiver/ofApp.h rename to example-receiver/src/ofApp.h diff --git a/example-sender/addons.make b/example-sender/addons.make new file mode 100644 index 0000000..9850f54 --- /dev/null +++ b/example-sender/addons.make @@ -0,0 +1 @@ +ofxNDI diff --git a/examples/example-sender/main.cpp b/example-sender/src/main.cpp similarity index 100% rename from examples/example-sender/main.cpp rename to example-sender/src/main.cpp diff --git a/examples/example-sender/ofApp.cpp b/example-sender/src/ofApp.cpp similarity index 100% rename from examples/example-sender/ofApp.cpp rename to example-sender/src/ofApp.cpp diff --git a/examples/example-sender/ofApp.h b/example-sender/src/ofApp.h similarity index 100% rename from examples/example-sender/ofApp.h rename to example-sender/src/ofApp.h diff --git a/example-webcam/addons.make b/example-webcam/addons.make new file mode 100644 index 0000000..9850f54 --- /dev/null +++ b/example-webcam/addons.make @@ -0,0 +1 @@ +ofxNDI diff --git a/examples/example-webcam/main.cpp b/example-webcam/src/main.cpp similarity index 100% rename from examples/example-webcam/main.cpp rename to example-webcam/src/main.cpp diff --git a/examples/example-webcam/ofApp.cpp b/example-webcam/src/ofApp.cpp similarity index 100% rename from examples/example-webcam/ofApp.cpp rename to example-webcam/src/ofApp.cpp diff --git a/examples/example-webcam/ofApp.h b/example-webcam/src/ofApp.h similarity index 100% rename from examples/example-webcam/ofApp.h rename to example-webcam/src/ofApp.h diff --git a/libs/NDI/export/Processing.NDI.Lib.x86.dll b/libs/NDI/export/vs/Win32/Processing.NDI.Lib.x86.dll similarity index 100% rename from libs/NDI/export/Processing.NDI.Lib.x86.dll rename to libs/NDI/export/vs/Win32/Processing.NDI.Lib.x86.dll diff --git a/libs/NDI/export/Processing.NDI.Lib.x64.dll b/libs/NDI/export/vs/x64/Processing.NDI.Lib.x64.dll similarity index 100% rename from libs/NDI/export/Processing.NDI.Lib.x64.dll rename to libs/NDI/export/vs/x64/Processing.NDI.Lib.x64.dll diff --git a/libs/readme.txt b/libs/readme.txt index 8447cbc..2d2ad95 100644 --- a/libs/readme.txt +++ b/libs/readme.txt @@ -1,7 +1,8 @@ Copy the required dlls to the application executable folder for either a 32 bit or 64bit application. - NDI/export/Processing.NDI.Lib.x86.dll - NDI/export/Processing.NDI.Lib.x64.dll + NDI/export/vs/Win32/Processing.NDI.Lib.x86.dll + or + NDI/export/vs/x64/Processing.NDI.Lib.x64.dll Alternatively install the NDI Runtime. Download from : http://new.tk/NDIRedistV4 diff --git a/src/ofxNDIreceive.cpp b/src/ofxNDIreceive.cpp index faf0941..80d80bb 100644 --- a/src/ofxNDIreceive.cpp +++ b/src/ofxNDIreceive.cpp @@ -98,6 +98,10 @@ 08.11.19 - Arch Linux x64 compatibility https://github.com/hugoaboud/ofxNDI To be tested + 15.11.19 - Change to dynamic load of NDI libraries + Add runtime download if load of library failed + 16.11.19 - Protect against loading the NDI dll again + */ #include "ofxNDIreceive.h" @@ -188,6 +192,10 @@ ofxNDIreceive::~ofxNDIreceive() // Dynamic loading of the NDI dlls to avoid needing to use the NDI SDK lib files bool ofxNDIreceive::LoadNDI() { + // Protect against loading the NDI dll again + if (bNDIinitialized) + return true; + std::string ndi_path = ""; #ifdef _WIN32 diff --git a/src/ofxNDIsend.cpp b/src/ofxNDIsend.cpp index 0aff008..bca9b1a 100644 --- a/src/ofxNDIsend.cpp +++ b/src/ofxNDIsend.cpp @@ -66,6 +66,9 @@ 12.10.18 - Remove set async false from SetFrameRate 14.10.18 - Reset frame rate in UpdateSender 08.11.19 - Removed output format option - fix to RGBA + 15.11.19 - Change to dynamic load of NDI libraries + - Add runtime download if load of library failed + 16.11.19 - Protect against loading the NDI dll again */ #include "ofxNDIsend.h" @@ -121,6 +124,10 @@ ofxNDIsend::~ofxNDIsend() // Dynamic loading of the NDI dlls to avoid needing to use the NDI SDK lib files bool ofxNDIsend::LoadNDI() { + // Protect against loading the NDI dll again + if (m_bNDIinitialized) + return true; + std::string ndi_path = ""; #ifdef _WIN32 @@ -161,7 +168,8 @@ bool ofxNDIsend::LoadNDI() // Try to load the library hNDILib = LoadLibraryA(ndi_path.c_str()); if (!hNDILib) { - MessageBoxA(NULL, "NDI library failed to load", "Warning", MB_OK); + MessageBoxA(NULL, "NDI library failed to load\nPlease re-install the NewTek NDI Runtimes\nfrom " NDILIB_REDIST_URL " to use this application", "Warning", MB_OK); + ShellExecuteA(NULL, "open", NDILIB_REDIST_URL, 0, 0, SW_SHOWNORMAL); return false; }