Skip to content

Commit

Permalink
Restructure for OF
Browse files Browse the repository at this point in the history
Reconfigure folders and include make files for the project generator as per pull request by prisonerjohn (#11).
  • Loading branch information
leadedge committed Nov 16, 2019
1 parent 43c23e0 commit 0eea6ac
Show file tree
Hide file tree
Showing 22 changed files with 154 additions and 7 deletions.
34 changes: 34 additions & 0 deletions .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/
16 changes: 12 additions & 4 deletions README.md
Expand Up @@ -7,27 +7,35 @@ 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.

ofxNDIsender and ofxNDIreceiver depend on Openframeworks. There are options to send and receive using ofFbo, ofTexture, ofPixels as well as an unsigned char pixel buffer. If receiving to ofFbo, ofTexture of ofPixels, it is not necessary to manage sender size change from the application. Nor is it necessary to handle receiver creation. Simply use the receive functions alone. For best efficiency, the sender class includes pbo pixel buffer readback, activated by SetReadback(). Refer to the header files for details. Examples have been updated to include all the options available. For a simple, practical example, refer to the webcam sender. The examples assume Openframeworks 10 and are not compatible with previous versions.

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.
Expand Down
85 changes: 85 additions & 0 deletions 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:
Binary file removed bin/data/NDI_Box.png
Binary file not shown.
Binary file removed bin/data/Test_Pattern.jpg
Binary file not shown.
1 change: 1 addition & 0 deletions example-receiver/addons.make
@@ -0,0 +1 @@
ofxNDI
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions example-sender/addons.make
@@ -0,0 +1 @@
ofxNDI
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions example-webcam/addons.make
@@ -0,0 +1 @@
ofxNDI
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 3 additions & 2 deletions 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

8 changes: 8 additions & 0 deletions src/ofxNDIreceive.cpp
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down
10 changes: 9 additions & 1 deletion src/ofxNDIsend.cpp
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 0eea6ac

Please sign in to comment.