Skip to content

Commit 9ae6984

Browse files
committed
Add Metal-backed live view rendering pipeline
1 parent 8668b6a commit 9ae6984

18 files changed

+1636
-1
lines changed

README.md

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
11
## CascableCoreSwift
22

3-
CascableCoreSwift is a Swift package that provides better, more "Swift-y" APIs for [CascableCore](https://github.com/cascable/cascablecore-distribution/) — an SDK for working with over 200 models of WiFi-enabled DSLR and mirrorless cameras. This package is additive in that it adds to the existing CascableCore APIs rather than replacing it.
3+
CascableCoreSwift is a Swift package that provides better, more "Swift-y" APIs for [CascableCore](https://github.com/cascable/cascablecore-distribution/) — an SDK for working with over 200 models of DSLR and mirrorless cameras. This package is additive in that it adds to the existing CascableCore APIs rather than replacing it.
44

55
- For more information on the CascableCore product, including getting a trial license, see the [Cascable Developer Portal](https://developer.cascable.se/).
66

77
- The best starting point for working with the SDK is by seeing CascableCore in action by checking out the [CascableCore Demo Projects](https://github.com/Cascable/cascablecore-demo) repository. You'll need a trial license for it to do anything useful!
88

99
- Next, our [Getting Started With CascableCore](https://github.com/Cascable/cascablecore-demo/blob/master/Getting%20Started%20With%20CascableCore.md) document contains discussion about the CascableCore APIs and concepts in the order in which you're likely to encounter them. These APIs and concepts are equally important for both Objective-C and Swift developers.
1010

11+
### Contents
12+
13+
- [Strongly-Typed Property API](#strongly-typed-property-api)
14+
- [Combine Publishers](#combine-publishers)
15+
- [Basic Usage](#basic-usage)
16+
- [Live View](#live-view)
17+
- [Metal-Backed Live View Rendering View Controller](#metal-backed-live-view-rendering-view-controller)
18+
- [Manual Camera Discovery](#strongly-typed-property-api)
19+
1120

1221
### Strongly-Typed Property API
1322

@@ -141,6 +150,33 @@ camera.liveViewPublisher(options: [.skipImageDecoding: true])
141150
```
142151

143152

153+
### Metal-Backed Live View Rendering View Controller
154+
155+
Some cameras deliver high-framerate, high-quality live view streams that're a challenge to handle efficiently. For our app [Cascable Studio](https://cascable.se/studio/) we developed a rendering pipeline that uses Metal to keep live view rendering entirely on the GPU, significantly reducing resource usage and increasing performance compared to using solutions like `UIImageView`.
156+
157+
With CascableCore 16, we're excited to be able to open-source this for everyone to use!
158+
159+
Included is an easy-to-use Metal-backed `UIViewController` that you can use to display live view in your app. Simply create the view controller and place it into your UI as you would any other, then connect it to a camera's live view feed:
160+
161+
```swift
162+
// Make sure you pass .skipImageDecoding since CascableCore's internal
163+
// decoding is CPU-based and resource-intensive.
164+
165+
camera.liveViewPublisher(options: [.skipImageDecoding: true])
166+
.receive(on: DispatchQueue.main)
167+
.sinkWithReadyHandler { completion in
168+
print("Live view ended with completion reason: \(completion)" )
169+
} receiveValue: { frame, readyForNextFrame in
170+
liveViewRendererView.render(frame: frame, completionHandler: { orientation, size in
171+
// Sync the rest of your UI with the orientation etc.
172+
readyForNextFrame()
173+
})
174+
}
175+
```
176+
177+
The underlying Metal rendering pipeline works on all platforms, while the view controller is currently only for UIKit-based platforms (i.e., everything except for AppKit-based macOS apps, including Mac Catalyst). If you have need for an AppKit view controller, please get in touch.
178+
179+
144180
### Manual Camera Discovery
145181

146182
This package adds a nicer API for manual camera discovery, allowing quick creation of descriptors and a `Result<Camera, Error>`

Sources/CascableCoreSwift/CascableCore+CameraCore.swift renamed to Sources/CascableCoreSwift/SDK Extensions/CascableCore+CameraCore.swift

File renamed without changes.

Sources/CascableCoreSwift/CascableCore+Combine.swift renamed to Sources/CascableCoreSwift/SDK Extensions/CascableCore+Combine.swift

File renamed without changes.

Sources/CascableCoreSwift/CascableCore+Concurrency.swift renamed to Sources/CascableCoreSwift/SDK Extensions/CascableCore+Concurrency.swift

File renamed without changes.

Sources/CascableCoreSwift/CascableCore+Errors.swift renamed to Sources/CascableCoreSwift/SDK Extensions/CascableCore+Errors.swift

File renamed without changes.

Sources/CascableCoreSwift/CascableCore+LiveView.swift renamed to Sources/CascableCoreSwift/SDK Extensions/CascableCore+LiveView.swift

File renamed without changes.

Sources/CascableCoreSwift/CascableCore+SwiftAPITypes.swift renamed to Sources/CascableCoreSwift/SDK Extensions/CascableCore+SwiftAPITypes.swift

File renamed without changes.

Sources/CascableCoreSwift/CascableCore+Video.swift renamed to Sources/CascableCoreSwift/SDK Extensions/CascableCore+Video.swift

File renamed without changes.

Sources/CascableCoreSwift/CascableCoreDiscovery+Swift.swift renamed to Sources/CascableCoreSwift/SDK Extensions/CascableCoreDiscovery+Swift.swift

File renamed without changes.

Sources/CascableCoreSwift/CascableCoreProperties+Swift.swift renamed to Sources/CascableCoreSwift/SDK Extensions/CascableCoreProperties+Swift.swift

File renamed without changes.

0 commit comments

Comments
 (0)