-
Notifications
You must be signed in to change notification settings - Fork 203
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support Presenter Overlay on macOS 14.2 and above; improved blacklist…
… selector, fix some issue
- Loading branch information
lihaoyun6
committed
Apr 28, 2024
1 parent
d598381
commit 9c26358
Showing
20 changed files
with
656 additions
and
363 deletions.
There are no files selected for viewing
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,41 @@ | ||
// | ||
// AVContext.swift | ||
// QuickRecorder | ||
// | ||
// Created by apple on 2024/4/27. | ||
// | ||
|
||
import Foundation | ||
import AVFoundation | ||
|
||
extension AppDelegate { | ||
func recordingCamera(withName: String) { | ||
SCContext.captureSession = AVCaptureSession() | ||
|
||
let discoverySession = AVCaptureDevice.DiscoverySession(deviceTypes: [.builtInWideAngleCamera, .externalUnknown], mediaType: .video, position: .unspecified) | ||
guard let camera = discoverySession.devices.first(where: { $0.localizedName == withName }), | ||
let input = try? AVCaptureDeviceInput(device: camera), | ||
SCContext.captureSession.canAddInput(input) else { | ||
print("Failed to set up camera") | ||
return | ||
} | ||
SCContext.captureSession.addInput(input) | ||
|
||
let videoOutput = AVCaptureVideoDataOutput() | ||
videoOutput.setSampleBufferDelegate(self, queue: .global()) | ||
|
||
if SCContext.captureSession.canAddOutput(videoOutput) { | ||
SCContext.captureSession.addOutput(videoOutput) | ||
} | ||
|
||
SCContext.captureSession.startRunning() | ||
} | ||
|
||
func captureOutput(_ output: AVCaptureOutput, didOutput sampleBuffer: CMSampleBuffer, from connection: AVCaptureConnection) { | ||
if !SCContext.isPaused && UserDefaults.standard.string(forKey: "recordCam") != "Disabled".local { | ||
//if sampleBuffer.isValid { SCContext.isCameraReady = true } | ||
//if sampleBuffer.imageBuffer != nil { SCContext.frameCache = sampleBuffer } | ||
} | ||
} | ||
} | ||
|
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
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
Oops, something went wrong.