-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from 100mslive/0.3.1Release
0.3.1 Release
- Loading branch information
Showing
28 changed files
with
1,109 additions
and
157 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
96 changes: 96 additions & 0 deletions
96
Example/HMSSDKExample.xcodeproj/xcshareddata/xcschemes/HMSScreenShare.xcscheme
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<Scheme | ||
LastUpgradeVersion = "1330" | ||
wasCreatedForAppExtension = "YES" | ||
version = "2.0"> | ||
<BuildAction | ||
parallelizeBuildables = "YES" | ||
buildImplicitDependencies = "YES"> | ||
<BuildActionEntries> | ||
<BuildActionEntry | ||
buildForTesting = "YES" | ||
buildForRunning = "YES" | ||
buildForProfiling = "YES" | ||
buildForArchiving = "YES" | ||
buildForAnalyzing = "YES"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "87606EB028112CFD002BAB14" | ||
BuildableName = "HMSScreenShare.appex" | ||
BlueprintName = "HMSScreenShare" | ||
ReferencedContainer = "container:HMSSDKExample.xcodeproj"> | ||
</BuildableReference> | ||
</BuildActionEntry> | ||
<BuildActionEntry | ||
buildForTesting = "YES" | ||
buildForRunning = "YES" | ||
buildForProfiling = "YES" | ||
buildForArchiving = "YES" | ||
buildForAnalyzing = "YES"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "607FACCF1AFB9204008FA782" | ||
BuildableName = "HMSSDKExample.app" | ||
BlueprintName = "HMSSDKExample" | ||
ReferencedContainer = "container:HMSSDKExample.xcodeproj"> | ||
</BuildableReference> | ||
</BuildActionEntry> | ||
</BuildActionEntries> | ||
</BuildAction> | ||
<TestAction | ||
buildConfiguration = "Debug" | ||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
shouldUseLaunchSchemeArgsEnv = "YES"> | ||
<Testables> | ||
</Testables> | ||
</TestAction> | ||
<LaunchAction | ||
buildConfiguration = "Debug" | ||
selectedDebuggerIdentifier = "" | ||
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn" | ||
launchStyle = "1" | ||
askForAppToLaunch = "Yes" | ||
useCustomWorkingDirectory = "NO" | ||
ignoresPersistentStateOnLaunch = "NO" | ||
debugDocumentVersioning = "YES" | ||
debugServiceExtension = "internal" | ||
allowLocationSimulation = "YES" | ||
launchAutomaticallySubstyle = "2"> | ||
<MacroExpansion> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "607FACCF1AFB9204008FA782" | ||
BuildableName = "HMSSDKExample.app" | ||
BlueprintName = "HMSSDKExample" | ||
ReferencedContainer = "container:HMSSDKExample.xcodeproj"> | ||
</BuildableReference> | ||
</MacroExpansion> | ||
</LaunchAction> | ||
<ProfileAction | ||
buildConfiguration = "Release" | ||
shouldUseLaunchSchemeArgsEnv = "YES" | ||
savedToolIdentifier = "" | ||
useCustomWorkingDirectory = "NO" | ||
debugDocumentVersioning = "YES" | ||
askForAppToLaunch = "Yes" | ||
launchAutomaticallySubstyle = "2"> | ||
<BuildableProductRunnable | ||
runnableDebuggingMode = "0"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "607FACCF1AFB9204008FA782" | ||
BuildableName = "HMSSDKExample.app" | ||
BlueprintName = "HMSSDKExample" | ||
ReferencedContainer = "container:HMSSDKExample.xcodeproj"> | ||
</BuildableReference> | ||
</BuildableProductRunnable> | ||
</ProfileAction> | ||
<AnalyzeAction | ||
buildConfiguration = "Debug"> | ||
</AnalyzeAction> | ||
<ArchiveAction | ||
buildConfiguration = "Release" | ||
revealArchiveInOrganizer = "YES"> | ||
</ArchiveAction> | ||
</Scheme> |
97 changes: 97 additions & 0 deletions
97
Example/HMSSDKExample.xcodeproj/xcshareddata/xcschemes/HMSScreenShareSetupUI.xcscheme
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<Scheme | ||
LastUpgradeVersion = "1330" | ||
wasCreatedForAppExtension = "YES" | ||
version = "2.0"> | ||
<BuildAction | ||
parallelizeBuildables = "YES" | ||
buildImplicitDependencies = "YES"> | ||
<BuildActionEntries> | ||
<BuildActionEntry | ||
buildForTesting = "YES" | ||
buildForRunning = "YES" | ||
buildForProfiling = "YES" | ||
buildForArchiving = "YES" | ||
buildForAnalyzing = "YES"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "87606EBB28112CFE002BAB14" | ||
BuildableName = "HMSScreenShareSetupUI.appex" | ||
BlueprintName = "HMSScreenShareSetupUI" | ||
ReferencedContainer = "container:HMSSDKExample.xcodeproj"> | ||
</BuildableReference> | ||
</BuildActionEntry> | ||
<BuildActionEntry | ||
buildForTesting = "YES" | ||
buildForRunning = "YES" | ||
buildForProfiling = "YES" | ||
buildForArchiving = "YES" | ||
buildForAnalyzing = "YES"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "607FACCF1AFB9204008FA782" | ||
BuildableName = "HMSSDKExample.app" | ||
BlueprintName = "HMSSDKExample" | ||
ReferencedContainer = "container:HMSSDKExample.xcodeproj"> | ||
</BuildableReference> | ||
</BuildActionEntry> | ||
</BuildActionEntries> | ||
</BuildAction> | ||
<TestAction | ||
buildConfiguration = "Debug" | ||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
shouldUseLaunchSchemeArgsEnv = "YES"> | ||
<Testables> | ||
</Testables> | ||
</TestAction> | ||
<LaunchAction | ||
buildConfiguration = "Debug" | ||
selectedDebuggerIdentifier = "" | ||
selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn" | ||
launchStyle = "0" | ||
askForAppToLaunch = "Yes" | ||
useCustomWorkingDirectory = "NO" | ||
ignoresPersistentStateOnLaunch = "NO" | ||
debugDocumentVersioning = "YES" | ||
debugServiceExtension = "internal" | ||
allowLocationSimulation = "YES" | ||
launchAutomaticallySubstyle = "2"> | ||
<BuildableProductRunnable | ||
runnableDebuggingMode = "0"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "607FACCF1AFB9204008FA782" | ||
BuildableName = "HMSSDKExample.app" | ||
BlueprintName = "HMSSDKExample" | ||
ReferencedContainer = "container:HMSSDKExample.xcodeproj"> | ||
</BuildableReference> | ||
</BuildableProductRunnable> | ||
</LaunchAction> | ||
<ProfileAction | ||
buildConfiguration = "Release" | ||
shouldUseLaunchSchemeArgsEnv = "YES" | ||
savedToolIdentifier = "" | ||
useCustomWorkingDirectory = "NO" | ||
debugDocumentVersioning = "YES" | ||
askForAppToLaunch = "Yes" | ||
launchAutomaticallySubstyle = "2"> | ||
<BuildableProductRunnable | ||
runnableDebuggingMode = "0"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "607FACCF1AFB9204008FA782" | ||
BuildableName = "HMSSDKExample.app" | ||
BlueprintName = "HMSSDKExample" | ||
ReferencedContainer = "container:HMSSDKExample.xcodeproj"> | ||
</BuildableReference> | ||
</BuildableProductRunnable> | ||
</ProfileAction> | ||
<AnalyzeAction | ||
buildConfiguration = "Debug"> | ||
</AnalyzeAction> | ||
<ArchiveAction | ||
buildConfiguration = "Release" | ||
revealArchiveInOrganizer = "YES"> | ||
</ArchiveAction> | ||
</Scheme> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
// | ||
// GrayscaleVideoPlugin.swift | ||
// HMSSDKExample | ||
// | ||
// Created by Pawan Dixit on 16/04/22. | ||
// Copyright © 2022 100ms. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
import HMSSDK | ||
|
||
class GrayscaleVideoPlugin: HMSVideoPlugin { | ||
|
||
static let defaultAttributes: [NSString: NSObject] = [ | ||
kCVPixelBufferPixelFormatTypeKey: NSNumber(value: kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange), | ||
kCVPixelBufferIOSurfacePropertiesKey : [:] as NSDictionary | ||
] | ||
|
||
private var attributes: [NSString: NSObject] { | ||
var attributes: [NSString: NSObject] = Self.defaultAttributes | ||
attributes[kCVPixelBufferWidthKey] = NSNumber(value: Int(extent.width)) | ||
attributes[kCVPixelBufferHeightKey] = NSNumber(value: Int(extent.height)) | ||
return attributes | ||
} | ||
|
||
private var _pixelBufferPool: CVPixelBufferPool? | ||
private var pixelBufferPool: CVPixelBufferPool! { | ||
get { | ||
if _pixelBufferPool == nil { | ||
var pixelBufferPool: CVPixelBufferPool? | ||
CVPixelBufferPoolCreate(nil, nil, attributes as CFDictionary?, &pixelBufferPool) | ||
_pixelBufferPool = pixelBufferPool | ||
} | ||
return _pixelBufferPool! | ||
} | ||
set { | ||
_pixelBufferPool = newValue | ||
} | ||
} | ||
|
||
private var extent = CGRect.zero { | ||
didSet { | ||
guard extent != oldValue else { return } | ||
pixelBufferPool = nil | ||
} | ||
} | ||
|
||
let ciContext = CIContext(options: nil) | ||
|
||
override func process(_ frame: CVPixelBuffer) -> CVPixelBuffer { | ||
let inputImage = CIImage(cvPixelBuffer: frame) | ||
|
||
guard let outputImage = inputImage.grayscale else { return frame } | ||
|
||
var outputBuffer: CVImageBuffer? | ||
|
||
extent = outputImage.extent | ||
|
||
CVPixelBufferPoolCreatePixelBuffer(nil, pixelBufferPool, &outputBuffer) | ||
|
||
if let outputBuffer = outputBuffer { | ||
ciContext.render(outputImage, to: outputBuffer) | ||
} | ||
return outputBuffer ?? frame | ||
} | ||
} | ||
|
||
extension CIImage { | ||
var grayscale: CIImage? { | ||
let context = CIContext(options: nil) | ||
guard let currentFilter = CIFilter(name: "CIPhotoEffectNoir") else { return nil } | ||
currentFilter.setValue(self, forKey: kCIInputImageKey) | ||
if let output = currentFilter.outputImage, | ||
let cgImage = context.createCGImage(output, from: output.extent) { | ||
return CIImage(cgImage: cgImage) | ||
} | ||
return nil | ||
} | ||
} |
Oops, something went wrong.