Skip to content

Commit 4a70b8b

Browse files
committed
GUI - add support for streaming the GUI via Syphon on macOS
1 parent 21714e7 commit 4a70b8b

95 files changed

Lines changed: 9660 additions & 1 deletion

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎LICENSE.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ relevant licenses:
111111
- [kissnet](https://github.com/Ybalrid/kissnet) - [MIT License](http://opensource.org/licenses/MIT)
112112
- [liblo](https://github.com/radarsat1/liblo) - [GNU Lesser General Public License v2.1](https://www.gnu.org/licenses/lgpl-2.1.html)
113113
- [TLSF](http://www.gii.upv.es/tlsf/) - [GNU Lesser General Public License v2.1](https://www.gnu.org/licenses/lgpl-2.1.html)
114+
- [Syphon](https://github.com/Syphon/Syphon-Framework) - [BSD 3-Clause License](http://opensource.org/licenses/BSD-3-Clause) (macOS only)
114115

115116
### Dynamically Linked Libraries for SuperSonic
116117

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Syphon.xcodeproj/project.xcworkspace
2+
Syphon.xcodeproj/xcuserdata
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
.objc_class_name_SyphonOpenGLClient
2+
.objc_class_name_SyphonClientBase
3+
.objc_class_name_SyphonClient
4+
.objc_class_name_SyphonOpenGLServer
5+
.objc_class_name_SyphonServerBase
6+
.objc_class_name_SyphonServer
7+
.objc_class_name_SyphonServerDirectory
8+
.objc_class_name_SyphonOpenGLImage
9+
.objc_class_name_SyphonImage
10+
.objc_class_name_SyphonMetalServer
11+
.objc_class_name_SyphonMetalClient
12+
_SyphonServerAnnounceNotification
13+
_SyphonServerDescriptionAppNameKey
14+
_SyphonServerDescriptionIconKey
15+
_SyphonServerDescriptionNameKey
16+
_SyphonServerDescriptionUUIDKey
17+
_SyphonServerOptionIsPrivate
18+
_SyphonServerOptionAntialiasSampleCount
19+
_SyphonServerOptionStencilBufferResolution
20+
_SyphonServerOptionDepthBufferResolution
21+
_SyphonServerRetireNotification
22+
_SyphonServerUpdateNotification
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>CFBundleDevelopmentRegion</key>
6+
<string>English</string>
7+
<key>CFBundleExecutable</key>
8+
<string>${EXECUTABLE_NAME}</string>
9+
<key>CFBundleIconFile</key>
10+
<string></string>
11+
<key>CFBundleIdentifier</key>
12+
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
13+
<key>CFBundleInfoDictionaryVersion</key>
14+
<string>6.0</string>
15+
<key>CFBundleName</key>
16+
<string>${PRODUCT_NAME}</string>
17+
<key>CFBundlePackageType</key>
18+
<string>FMWK</string>
19+
<key>CFBundleShortVersionString</key>
20+
<string>5</string>
21+
<key>CFBundleSignature</key>
22+
<string>????</string>
23+
<key>CFBundleVersion</key>
24+
<string>5</string>
25+
<key>NSPrincipalClass</key>
26+
<string></string>
27+
</dict>
28+
</plist>
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
Syphon Framework License:
2+
3+
Copyright 2010 bangnoise (Tom Butterworth) & vade (Anton Marini).
4+
All rights reserved.
5+
6+
Redistribution and use in source and binary forms, with or without
7+
modification, are permitted provided that the following conditions are met:
8+
9+
* Redistributions of source code must retain the above copyright
10+
notice, this list of conditions and the following disclaimer.
11+
12+
* Redistributions in binary form must reproduce the above copyright
13+
notice, this list of conditions and the following disclaimer in the
14+
documentation and/or other materials provided with the distribution.
15+
16+
* Neither the name of the Syphon Project nor the names of its contributors
17+
may be used to endorse or promote products derived from this software
18+
without specific prior written permission.
19+
20+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
21+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
24+
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
27+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Syphon is an open source Mac OS X technology that allows applications to share video and still images with one another in realtime.
2+
3+
See http://syphon.github.io for more information.
4+
5+
This project hosts the Syphon.framework for developers who want to integrate Syphon in their own software. If you are looking for the Syphon plugins for Quartz Composer, Max/Jitter, FFGL, etc, the project for the Syphon Implementations currently at http://github.com/Syphon
239 KB
Binary file not shown.
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
{\rtf1\ansi\ansicpg1252\cocoartf1561
2+
\cocoascreenfonts1{\fonttbl\f0\fnil\fcharset0 HelveticaNeue;}
3+
{\colortbl;\red255\green255\blue255;}
4+
{\*\expandedcolortbl;;}
5+
{\*\listtable{\list\listtemplateid1\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{hyphen\}}{\leveltext\leveltemplateid1\'01\uc0\u8259 ;}{\levelnumbers;}\fi-360\li720\lin720 }{\listname ;}\listid1}
6+
{\list\listtemplateid2\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{disc\}}{\leveltext\leveltemplateid101\'01\uc0\u8226 ;}{\levelnumbers;}\fi-360\li720\lin720 }{\listname ;}\listid2}
7+
{\list\listtemplateid3\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{disc\}}{\leveltext\leveltemplateid201\'01\uc0\u8226 ;}{\levelnumbers;}\fi-360\li720\lin720 }{\listname ;}\listid3}
8+
{\list\listtemplateid4\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{disc\}}{\leveltext\leveltemplateid301\'01\uc0\u8226 ;}{\levelnumbers;}\fi-360\li720\lin720 }{\listname ;}\listid4}}
9+
{\*\listoverridetable{\listoverride\listid1\listoverridecount0\ls1}{\listoverride\listid2\listoverridecount0\ls2}{\listoverride\listid3\listoverridecount0\ls3}{\listoverride\listid4\listoverridecount0\ls4}}
10+
\vieww18200\viewh20200\viewkind0
11+
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\partightenfactor0
12+
13+
\f0\b\fs26 \cf0 Welcome to the Syphon SDK
14+
\b0 \
15+
\
16+
This is a software development kit for application and plugin developers.\
17+
\
18+
If you are a user, there is nothing to install to use Syphon - it is bundled as part of applications which support it.\
19+
\
20+
Please find enclosed:\
21+
\
22+
\pard\tx220\tx720\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\li720\fi-720\pardirnatural\partightenfactor0
23+
\ls1\ilvl0\cf0 {\listtext \uc0\u8259 }Syphon.framework\
24+
{\listtext \uc0\u8259 }A pair of example projects\
25+
{\listtext \uc0\u8259 }The Syphon icon for use in your application, if required\
26+
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\partightenfactor0
27+
\cf0 \
28+
The documentation is available online at {\field{\*\fldinst{HYPERLINK "http://syphon.v002.info/FrameworkDocumentationCoreProfile/"}}{\fldrslt http://syphon.v002.info/FrameworkDocumentationCoreProfile/}}.
29+
\b \
30+
\
31+
Core Profile OpenGL\
32+
\
33+
34+
\b0 This is a trial release with support for Core Profile OpenGL. Legacy OpenGL is also supported. Please discuss issues with us on {\field{\*\fldinst{HYPERLINK "https://github.com/Syphon/Syphon-Framework/issues"}}{\fldrslt GitHub}}, or contact us directly via {\field{\*\fldinst{HYPERLINK "mailto:contact@v002.info"}}{\fldrslt contact@v002.info}}. We are particularly interested to hear of any usability or performance issues you run into.\
35+
36+
\b \
37+
38+
\b0 There were API changes to SyphonClient and SyphonServerDirectory in the previous release. Please read the changes notice carefully.\
39+
\
40+
41+
\b Changes to Syphon.framework in release 4
42+
\b0 \
43+
\
44+
\pard\tx220\tx720\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\li720\fi-720\pardirnatural\partightenfactor0
45+
\ls2\ilvl0\cf0 {\listtext \uc0\u8226 }Support for Core Profile OpenGL\
46+
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\partightenfactor0
47+
48+
\b \cf0 \
49+
Changes to Syphon.framework in release 3\
50+
\
51+
\pard\tx220\tx720\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\li720\fi-720\pardirnatural\partightenfactor0
52+
\ls3\ilvl0
53+
\b0 \cf0 {\listtext \uc0\u8226 }Servers can optionally use MSAA and have depth and stencil buffers\
54+
{\listtext \uc0\u8226 }Fix so servers are properly named in command-line applications\
55+
{\listtext \uc0\u8226 }AppNap is suspended for the lifetime of a SyphonServer\
56+
{\listtext \uc0\u8226 }Fix to properly honor publishing a sub-region of a texture\
57+
{\listtext \uc0\u8226 }SyphonClient is now associated with a single CGL context on initialization\
58+
{\listtext \uc0\u8226 }SyphonServerDirectory is better at noticing the disappearance of improperly ended servers\
59+
{\listtext \uc0\u8226 }SyphonServerDirectory\'92s notifications now set the SyphonServerDirectory instance as the notification object, and the dictionary as the associated user info object\
60+
{\listtext \uc0\u8226 }Remove support for deprecated Objective C garbage-collection
61+
\b \
62+
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\partightenfactor0
63+
\cf0 \
64+
Changes to Syphon.framework in Public Beta 2\
65+
\
66+
\pard\tx220\tx720\pardeftab720\li720\fi-720\sa60\partightenfactor0
67+
\ls4\ilvl0
68+
\b0 \cf0 {\listtext \uc0\u8226 }Improve removal of servers if a remote application with servers hangs or crashes\
69+
{\listtext \uc0\u8226 }Fix a potential lock conflict when stopping clients\
70+
{\listtext \uc0\u8226 }Add - newFrameImage method to SyphonServer\
71+
{\listtext \uc0\u8226 }Fix issue where one frame of garbage was sometimes sent to its first client if a server used - hasClients to conditionally draw\
72+
{\listtext \uc0\u8226 }Fix issue which affected publishing a GL_TEXTURE_2D texture with no mipmaps\
73+
{\listtext \uc0\u8226 }Make the Syphon icon available for use by applications\
74+
{\listtext \uc0\u8226 }Fix issue which delayed server discovery in some versions of MacOS X\
75+
{\listtext \uc0\u8226 }If an application fails to stop servers programmatically, they are stopped by the framework when the application quits\
76+
\pard\tx560\pardeftab720\sa60\partightenfactor0
77+
78+
\b \cf0 \
79+
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\partightenfactor0
80+
\cf0 Changes to Syphon.framework in Public Beta 1\
81+
82+
\b0 \
83+
\pard\tx220\tx720\pardeftab720\li720\fi-720\sa60\partightenfactor0
84+
\cf0 \'95 Servers and clients can no longer degrade each other's performance: subsequently calls to SyphonServer and SyphonClient return much faster.\
85+
\'95 SyphonClient provides valid output from newFrameForContext: if you pass multiple non-shared CGLContexts to the same client.\
86+
\'95 Improved documentation.\
87+
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\partightenfactor0
88+
89+
\b \cf0 \
90+
Known Issues\
91+
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\partightenfactor0
92+
93+
\i\b0 \cf0 \
94+
Please check the Syphon Framework Issues at {\field{\*\fldinst{HYPERLINK "https://github.com/Syphon/Syphon-Framework/issues"}}{\fldrslt https://github.com/Syphon/Syphon-Framework/issues}}
95+
\i0\b \
96+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Extending Syphon
2+
3+
## Overview
4+
5+
Syphon can be extended for any IOSurface-based technology using the Syphon Base classes without modifying the framework at all.
6+
7+
Import `<Syphon/SyphonSubclassing.h>` in your implementation files to gain access to essential methods for subclasses to use.
8+
9+
### Images
10+
11+
If your new format is not an Objective C class, implement a new image class by subclassing ``SyphonImageBase`` to expose the surface in your new format. This class should be a minimal wrapper to the contained type.
12+
13+
### Servers
14+
15+
Implement a server by subclassing ``SyphonServerBase``. Add methods to your subclass to publish frames. When needed, call ``SyphonServerBase/newSurfaceForWidth:height:options:`` to obtain an `IOSurfaceRef`. When you have updated the surface, call ``SyphonServerBase/publish``. Add a method named `-newFrameImage` which returns an instance of your ``SyphonImageBase`` subclass (or the new type directly).
16+
17+
### Clients
18+
19+
Implement a client by subclassing ``SyphonClientBase``. Add a method named `-newFrameImage` which returns an instance of your ``SyphonImageBase`` subclass. Implement the ``SyphonClientBase/invalidateFrame`` method, noting this may be called on a background thread.
20+
21+
### Other Considerations
22+
23+
If you override other Syphon Base class methods, be sure to pass them on to the superclass (eg if you override ``SyphonServerBase/stop``, call `[super stop]` from your implementation of ``SyphonServerBase/stop``).
24+
25+
If your changes are for a well-used API, please consider making a pull-request or otherwise reaching out to us so we can add them to the project.
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# Getting Started
2+
3+
4+
## Overview
5+
6+
Syphon is simple to integrate, allowing you to start using it with very few lines of code.
7+
8+
### Servers
9+
10+
Class documentation: ``SyphonMetalServer``, ``SyphonOpenGLServer``
11+
12+
Create a server:
13+
14+
```objc
15+
SyphonMetalServer *server = [[SyphonMetalServer alloc] initWithName:@"My Output"
16+
device:device
17+
options:nil];
18+
```
19+
20+
and then publish new frames:
21+
22+
```objc
23+
[server publishFrameTexture:myTex
24+
onCommandBuffer:commandBuffer
25+
imageRegion:NSMakeRect(0, 0, width, height)
26+
flipped:NO];
27+
```
28+
29+
The OpenGL server has a similar method, plus methods to bind and unbind the server to the OpenGL context, so you can draw into it directly.
30+
You can publish new frames as often as you like, but if you only publish when you have a frame different from the previous one, then clients can do less work.
31+
You must stop the server when you are finished with it:
32+
33+
```objc
34+
[server stop];
35+
```
36+
37+
### Finding Servers
38+
39+
Class documentation: ``SyphonServerDirectory``
40+
41+
``SyphonServerDirectory`` handles server discovery for you. You can get an array of dictionaries describing available servers:
42+
43+
```objc
44+
NSArray *available = [[SyphonServerDirectory sharedDirectory] servers];
45+
```
46+
47+
The servers property can be observed for changes, or you can register to receive the notifications posted by ``SyphonServerDirectory``.
48+
49+
Server description dictionaries are used by Syphon when you create a client, and also contain information you can use to describe available servers in your UI:
50+
51+
```objc
52+
[menuItem setTitle:[description objectForKey:SyphonServerDescriptionNameKey]];
53+
```
54+
55+
### Clients
56+
57+
Class documentation: ``SyphonMetalClient``, ``SyphonOpenGLClient``, ``SyphonOpenGLImage``
58+
59+
Usually you create a client with a server description dictionary you obtained from ``SyphonServerDirectory``:
60+
61+
62+
```objc
63+
SyphonMetalClient *client = [[SyphonMetalClient alloc] initWithServerDescription:description
64+
device:device
65+
options:nil
66+
newFrameHandler:^(SyphonMetalClient *client) {
67+
// you could get the new frame here and update your view
68+
}];
69+
```
70+
71+
The new-frame handler is optional: you can pass in nil.
72+
73+
When you are ready to draw:
74+
75+
76+
```objc
77+
id<MTLTexture> *frame = [client newFrameImage];
78+
if (frame)
79+
{
80+
// YOUR METAL DRAWING CODE HERE
81+
82+
[frame release]; // (if not using ARC)
83+
}
84+
```
85+
86+
As with servers, you must stop the client when you are finished with it:
87+
88+
```objc
89+
[client stop];
90+
```
91+
92+
### More examples
93+
94+
Example projects implementing a server and client are included with the Syphon SDK. You can also examine the source to some Syphon implementations on [GitHub](https://github.com/Syphon).
95+
96+
Good luck!

0 commit comments

Comments
 (0)