Skip to content

Commit

Permalink
Merge pull request #1407 from shogo4405/feature/remove-old-screen-cap…
Browse files Browse the repository at this point in the history
…ture-api

Removed the ScreenCapture-related APIs.
  • Loading branch information
shogo4405 authored Apr 6, 2024
2 parents 8d5d887 + 44c3335 commit 7416c28
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 269 deletions.
8 changes: 0 additions & 8 deletions HaishinKit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@
BC1DC50E2A039E1900E928ED /* FLVVideoPacketType.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC1DC50D2A039E1900E928ED /* FLVVideoPacketType.swift */; };
BC1DC5122A04E46E00E928ED /* HEVCDecoderConfigurationRecordTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC1DC5112A04E46E00E928ED /* HEVCDecoderConfigurationRecordTests.swift */; };
BC1DC5142A05428800E928ED /* HEVCNALUnit.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC1DC5132A05428800E928ED /* HEVCNALUnit.swift */; };
BC20DF38250377A3007BC608 /* IOUIScreenCaptureUnit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 299B131C1D35272D00A1E8F5 /* IOUIScreenCaptureUnit.swift */; };
BC22EEEE2AAF50F200E3406D /* Codec.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC22EEED2AAF50F200E3406D /* Codec.swift */; };
BC22EEF22AAF5D6300E3406D /* AVAudioPCMBuffer+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC22EEF12AAF5D6300E3406D /* AVAudioPCMBuffer+Extension.swift */; };
BC2828AD2AA3225100741013 /* AVCaptureDevice.Format+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC2828AC2AA3225100741013 /* AVCaptureDevice.Format+Extension.swift */; };
Expand Down Expand Up @@ -228,7 +227,6 @@
BC959F1229717EDB0067BA97 /* PreferenceViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC959F1129717EDB0067BA97 /* PreferenceViewController.swift */; };
BC9CFA9323BDE8B700917EEF /* IOStreamView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC9CFA9223BDE8B700917EEF /* IOStreamView.swift */; };
BC9F9C7826F8C16600B01ED0 /* Choreographer.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC9F9C7726F8C16600B01ED0 /* Choreographer.swift */; };
BCA2252C293CC5B600DD7CB2 /* IOScreenCaptureUnit.swift in Sources */ = {isa = PBXBuildFile; fileRef = BCA2252B293CC5B600DD7CB2 /* IOScreenCaptureUnit.swift */; };
BCA7C24F2A91AA0500882D85 /* IORecorderTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BCA7C24E2A91AA0500882D85 /* IORecorderTests.swift */; };
BCAD0C18263ED67F00ADFB80 /* SampleVideo_360x240_5mb@m4v.m3u8 in Resources */ = {isa = PBXBuildFile; fileRef = BCAD0C16263ED67F00ADFB80 /* SampleVideo_360x240_5mb@m4v.m3u8 */; };
BCAD0C19263ED67F00ADFB80 /* SampleVideo_360x240_5mb@m4v in Resources */ = {isa = PBXBuildFile; fileRef = BCAD0C17263ED67F00ADFB80 /* SampleVideo_360x240_5mb@m4v */; };
Expand Down Expand Up @@ -508,7 +506,6 @@
298BCF321DD4C44A007FF86A /* AnyUtil.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AnyUtil.swift; sourceTree = "<group>"; };
2997BDD31D50D31B000AF900 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
2999C3742071138F00892E55 /* MTHKView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MTHKView.swift; sourceTree = "<group>"; };
299B131C1D35272D00A1E8F5 /* IOUIScreenCaptureUnit.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IOUIScreenCaptureUnit.swift; sourceTree = "<group>"; };
299F7E3A1CD71A97001E7272 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
299F7E3B1CD71A97001E7272 /* HaishinKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HaishinKit.h; sourceTree = "<group>"; };
29A39C881D85BF30007C27E9 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
Expand Down Expand Up @@ -650,7 +647,6 @@
BC959F1129717EDB0067BA97 /* PreferenceViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PreferenceViewController.swift; sourceTree = "<group>"; };
BC9CFA9223BDE8B700917EEF /* IOStreamView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IOStreamView.swift; sourceTree = "<group>"; };
BC9F9C7726F8C16600B01ED0 /* Choreographer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Choreographer.swift; sourceTree = "<group>"; };
BCA2252B293CC5B600DD7CB2 /* IOScreenCaptureUnit.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IOScreenCaptureUnit.swift; sourceTree = "<group>"; };
BCA7C24E2A91AA0500882D85 /* IORecorderTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IORecorderTests.swift; sourceTree = "<group>"; };
BCAD0C16263ED67F00ADFB80 /* SampleVideo_360x240_5mb@m4v.m3u8 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "SampleVideo_360x240_5mb@m4v.m3u8"; sourceTree = "<group>"; };
BCAD0C17263ED67F00ADFB80 /* SampleVideo_360x240_5mb@m4v */ = {isa = PBXFileReference; lastKnownFileType = folder; path = "SampleVideo_360x240_5mb@m4v"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1097,13 +1093,11 @@
BC0F1FD92ACC4CC100C326FF /* IOCaptureVideoPreview.swift */,
29B8768B1CD70AFE00FC07DA /* IOMixer.swift */,
BC4078C32AD5CC7E00BBB4FA /* IOMuxer.swift */,
BCA2252B293CC5B600DD7CB2 /* IOScreenCaptureUnit.swift */,
29AF3FCE1D7C744C00E41212 /* IOStream.swift */,
BC6692F22AC2F717009EC058 /* IOStreamBitRateStrategyConvertible.swift */,
2976A47D1D48C5C700B53EF2 /* IOStreamRecorder.swift */,
BC9CFA9223BDE8B700917EEF /* IOStreamView.swift */,
BCC4F4142AD6FC1100954EF5 /* IOTellyUnit.swift */,
299B131C1D35272D00A1E8F5 /* IOUIScreenCaptureUnit.swift */,
BC570B4728E9ACC10098A12C /* IOUnit.swift */,
BC3802112AB5E770001AE399 /* IOVideoCaptureUnit.swift */,
BC3483692AC56F3A002926F1 /* IOVideoMixer.swift */,
Expand Down Expand Up @@ -1787,7 +1781,6 @@
2958910E1EEB8D3C00CE51E1 /* FLVVideoCodec.swift in Sources */,
B3D687822B80302B00E6A28E /* IOAudioMixer.swift in Sources */,
BC1DC5142A05428800E928ED /* HEVCNALUnit.swift in Sources */,
BC20DF38250377A3007BC608 /* IOUIScreenCaptureUnit.swift in Sources */,
29B876AF1CD70B2800FC07DA /* RTMPChunk.swift in Sources */,
29B876841CD70AE800FC07DA /* AVCDecoderConfigurationRecord.swift in Sources */,
296242621D8DB86500C451A3 /* TSWriter.swift in Sources */,
Expand Down Expand Up @@ -1826,7 +1819,6 @@
BC22EEF22AAF5D6300E3406D /* AVAudioPCMBuffer+Extension.swift in Sources */,
BCCBCE9729A90D880095B51C /* AVCNALUnit.swift in Sources */,
29B876BD1CD70B3900FC07DA /* CRC32.swift in Sources */,
BCA2252C293CC5B600DD7CB2 /* IOScreenCaptureUnit.swift in Sources */,
BC4914A628DDD367009E2DF6 /* VTSessionOption.swift in Sources */,
BC0F1FDA2ACC4CC100C326FF /* IOCaptureVideoPreview.swift in Sources */,
BC4914B228DDFE31009E2DF6 /* VTSessionOptionKey.swift in Sources */,
Expand Down
16 changes: 0 additions & 16 deletions Sources/IO/IOScreenCaptureUnit.swift

This file was deleted.

45 changes: 0 additions & 45 deletions Sources/IO/IOStream.swift
Original file line number Diff line number Diff line change
Expand Up @@ -349,15 +349,6 @@ open class IOStream: NSObject {
}
#endif

#if os(macOS)
/// Attaches the screen input object.
public func attachScreen(_ input: AVCaptureScreenInput?, channel: UInt8 = 0) {
lockQueue.async {
self.mixer.videoIO.attachScreen(input, channel: channel)
}
}
#endif

/// Append a CMSampleBuffer.
/// - Warning: This method can't use attachCamera or attachAudio method at the same time.
public func append(_ sampleBuffer: CMSampleBuffer, channel: UInt8 = 0) {
Expand Down Expand Up @@ -519,39 +510,3 @@ extension IOStream: IOTellyUnitDelegate {
})
}
}

extension IOStream: IOScreenCaptureUnitDelegate {
// MARK: IOScreenCaptureUnitDelegate
public func session(_ session: any IOScreenCaptureUnit, didOutput pixelBuffer: CVPixelBuffer, presentationTime: CMTime) {
var timingInfo = CMSampleTimingInfo(
duration: .invalid,
presentationTimeStamp: presentationTime,
decodeTimeStamp: .invalid
)
var videoFormatDescription: CMVideoFormatDescription?
var status = CMVideoFormatDescriptionCreateForImageBuffer(
allocator: kCFAllocatorDefault,
imageBuffer: pixelBuffer,
formatDescriptionOut: &videoFormatDescription
)
guard status == noErr else {
return
}
var sampleBuffer: CMSampleBuffer?
status = CMSampleBufferCreateForImageBuffer(
allocator: kCFAllocatorDefault,
imageBuffer: pixelBuffer,
dataReady: true,
makeDataReadyCallback: nil,
refcon: nil,
formatDescription: videoFormatDescription!,
sampleTiming: &timingInfo,
sampleBufferOut: &sampleBuffer
)
guard let sampleBuffer, status == noErr else {
return
}
append(sampleBuffer)
}
}

175 changes: 0 additions & 175 deletions Sources/IO/IOUIScreenCaptureUnit.swift

This file was deleted.

13 changes: 0 additions & 13 deletions Sources/IO/IOVideoCaptureUnit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -129,19 +129,6 @@ public final class IOVideoCaptureUnit: IOCaptureUnit {
setSampleBufferDelegate(videoUnit)
}

#if os(macOS)
func attachScreen(_ screen: AVCaptureScreenInput?, videoUnit: IOVideoUnit) {
setSampleBufferDelegate(nil)
videoUnit.mixer?.session.detachCapture(self)
device = nil
input = screen
output = AVCaptureVideoDataOutput()
connection = nil
videoUnit.mixer?.session.attachCapture(self)
setSampleBufferDelegate(videoUnit)
}
#endif

func setFrameRate(_ frameRate: Float64) {
guard let device else {
return
Expand Down
12 changes: 0 additions & 12 deletions Sources/IO/IOVideoUnit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -241,18 +241,6 @@ final class IOVideoUnit: NSObject, IOUnit {
}
}
}

#if os(macOS)
func attachScreen(_ input: AVCaptureScreenInput?, channel: UInt8) {
mixer?.session.configuration { _ in
let capture = capture(for: channel)
for capture in captures.values where capture.input == input {
capture.attachScreen(nil, videoUnit: self)
}
capture?.attachScreen(input, videoUnit: self)
}
}
#endif
}

extension IOVideoUnit: Running {
Expand Down

0 comments on commit 7416c28

Please sign in to comment.