macos related changes

This commit is contained in:
Mikhail Filimonov 2024-03-01 11:20:21 +04:00
parent 471bebc907
commit d8332b0d83
2 changed files with 21 additions and 2 deletions

View File

@ -392,7 +392,7 @@ public final class OngoingGroupCallContext {
public let mirrorHorizontally: Bool
public let mirrorVertically: Bool
init(frameData: CallVideoFrameData) {
public init(frameData: CallVideoFrameData) {
if let nativeBuffer = frameData.buffer as? CallVideoFrameNativePixelBuffer {
if CVPixelBufferGetPixelFormatType(nativeBuffer.pixelBuffer) == kCVPixelFormatType_32ARGB {
self.buffer = .argb(NativeBuffer(pixelBuffer: nativeBuffer.pixelBuffer))

View File

@ -8,7 +8,7 @@
import Foundation
import Cocoa
import TgVoipWebrtc
import SwiftSignalKit
public enum OngoingCallVideoOrientation {
@ -79,6 +79,25 @@ public final class OngoingCallVideoCapturer {
self.impl = OngoingCallThreadLocalContextVideoCapturer(deviceId: deviceId, keepLandscape: keepLandscape)
}
public func video() -> Signal<OngoingGroupCallContext.VideoFrameData, NoError> {
return Signal { [weak self] subscriber in
let disposable = MetaDisposable()
guard let strongSelf = self else {
return disposable
}
let innerDisposable = strongSelf.impl.addVideoOutput({ videoFrameData in
subscriber.putNext(OngoingGroupCallContext.VideoFrameData(frameData: videoFrameData))
})
disposable.set(ActionDisposable {
innerDisposable.dispose()
})
return disposable
}
}
public func makeOutgoingVideoView(completion: @escaping (OngoingCallContextPresentationCallVideoView?) -> Void) {
self.impl.makeOutgoingVideoView(false, completion: { view, _ in
if let view = view {