1 //
2 // JCMediaDevice.h
3 // JCSDK-OC
4 //
5 // Created by maikireton on 2017/8/11.
6 // Copyright © 2017年 juphoon. All rights reserved.
7 //
8 
9 #import <Foundation/Foundation.h>
10 #import "JCClient.h"
11 #import "JCMediaDeviceVideoCanvas.h"
12 #import "JCMediaDeviceCallback.h"
13 #import "JCMediaDeviceConstants.h"
14 
24 @interface JCMediaDeviceCamera : NSObject
25 
29 @property (nonatomic, readonly) NSString* __nonnull cameraId;
30 
34 @property (nonatomic, readonly) NSString* __nonnull cameraName;
35 
43 @property (nonatomic, readonly) JCMediaDeviceCameraType cameraType;
44 
45 @end
46 
50 @interface JCMediaDeviceAudio : NSObject
51 
55 @property (nonatomic, readonly) NSString* __nonnull audioId;
56 
60 @property (nonatomic, readonly) NSString* __nonnull audioName;
61 
65 @property (nonatomic, readonly) bool input;
66 
67 @end
68 
72 @interface JCMediaDeviceWindow : NSObject
73 
77 @property (nonatomic, readonly) NSString* __nonnull windowId;
78 
82 @property (nonatomic, readonly) NSString* __nonnull windowName;
83 
84 @end
85 
89 @interface JCMediaDeviceAudioParam : NSObject
90 
98 @property (nonatomic) int audioInputSamplingRate;
99 
107 @property (nonatomic) int audioOutputSamplingRate;
108 
114 @property (nonatomic) int audioInputChannelNumber;
115 
121 @property (nonatomic) int audioOutputChannelNumber;
122 
131 @property (nonatomic) bool autoStartAudioOutputDevice;
132 
141 @property (nonatomic) bool autoStartAudioInputDevice;
142 
153 @property (nonatomic) JCMediaDeviceAudioAECType aecType;
154 
155 @end
156 
160 @protocol JCAudioFrameCallback <NSObject>
161 
173 - (void)onAudioInputFrame:(NSString *_Nonnull)inputId sampleRateHz:(int)sampleRateHz channels:(int)channels buf:(unsigned char *_Nonnull)buf playDelayMS:(int)playDelayMS recDelayMS:(int)recDelayMS clockDrift:(int)clockDrift;
174 
183 - (void)onAudioOutputFrame:(NSString *_Nonnull)outputId sampleRateHz:(int)sampleRateHz channels:(int)channels buf:(unsigned char *_Nonnull)buf;
184 
185 @end
186 
190 @protocol JCVideoFrameCallback <NSObject>
191 
205 - (void)onVideoCaptureFrame:(NSString *_Nonnull)captureId face:(JCMediaDeviceCameraType)face imageAngle:(int)imageAngle captureOrient:(int)captureOrient width:(int*_Nonnull)width height:(int*_Nonnull)height buf:(unsigned char *_Nonnull)buf;
206 
228 - (void)onVideoRenderFrame:(NSString *_Nonnull)renderId sourceType:(JCMediaDeviceVideoSource)sourceType angle:(int)angle mirror:(JCMediaDeviceMirror)mirror width:(int*_Nonnull)width height:(int*_Nonnull)height buf:(unsigned char *_Nonnull)buf timeStamp:(unsigned long)timeStamp;
229 
230 @end
231 
236 @interface JCMediaDevice : NSObject
237 
243 @property (nonatomic, readonly) bool cameraOpen;
244 
250 @property (nonatomic, readonly) bool videoFileOpen;
251 
255 @property (nonatomic, strong, readonly) JCMediaDeviceCamera* __nullable camera;
256 
260 @property (nonatomic, readonly) NSArray<JCMediaDeviceCamera*> * __nonnull cameras;
261 
265 @property (nonatomic, strong) JCMediaDeviceCamera* __nullable defaultCamera;
266 
272 @property (nonatomic, strong) JCMediaDeviceAudioParam * _Nonnull audioParam;
273 
277 @property (nonatomic, strong, readonly) NSString* __nonnull videoFileId;
278 
282 @property (nonatomic, readonly) bool audioInterrupt;
283 
293 @property (nonatomic) JCMediaDeviceVideoAngel videoAngle;
294 
307 @property (nonatomic) bool useInternalAudioDeviceLogic;
308 
317 @property (nonatomic, readonly) bool audioStart;
318 
319 #if TARGET_OS_OSX
320 
323 @property (nonatomic, readonly) NSArray<JCMediaDeviceAudio*>* __nonnull audioInputs;
324 
328 @property (nonatomic, strong) JCMediaDeviceAudio* __nullable audioInput;
329 
333 @property (nonatomic, readonly) NSArray<JCMediaDeviceAudio*>* __nonnull audioOutputs;
334 
338 @property (nonatomic, strong) JCMediaDeviceAudio* __nullable audioOutput;
339 
343 @property (nonatomic, readonly) NSArray<JCMediaDeviceWindow*>* __nonnull desktops;
344 
348 @property (nonatomic, readonly) NSArray<JCMediaDeviceWindow*>* __nonnull windows;
349 
353 @property (nonatomic, strong) JCMediaDeviceWindow* __nullable screenshareWindow;
354 #endif
355 
370 +(JCMediaDevice* __nullable)create:(JCClient* __nonnull)client callback:(id<JCMediaDeviceCallback> __nonnull)callback;
371 
379 +(void)destroy;
380 
398 -(JCMediaDeviceVideoCanvas* __nullable)startCameraVideo:(JCMediaDeviceRender)type;
399 
418 -(JCMediaDeviceVideoCanvas* __nullable)startCameraVideo:(JCMediaDeviceRender)type view:(JCView* __nonnull)view;
419 
436 -(JCMediaDeviceVideoCanvas* __nullable)startVideo:(NSString* __nonnull)videoSource renderType:(JCMediaDeviceRender)type;
437 
453 -(JCMediaDeviceVideoCanvas* __nullable)startVideo:(NSString* __nonnull)videoSource renderType:(JCMediaDeviceRender)type view:(JCView* __nonnull)view;
454 
462 -(void)stopVideo:(JCMediaDeviceVideoCanvas* __nonnull)canvas;
463 
473 -(bool)startAudio;
474 
484 -(bool)stopAudio;
485 
497 -(bool)startCamera;
498 
508 -(bool)stopCamera;
509 
523 -(bool)switchCamera;
524 
537 -(bool)switchCamera:(JCMediaDeviceCamera* __nonnull)camera;
538 
548 - (void)setCameraProperty:(int)width height:(int)height framerate:(int)framerate;
549 
559 - (void)setScreenCaptureProperty:(int)width height:(int)height framerate:(int)framerate;
560 
574 -(bool)startVideoFile;
575 
591 -(void)setVideoFileFrame:(NSData* __nonnull)srcFrame format:(JCMediaDeviceVideoPixelFormat)format width:(int)width height:(int)height;
592 
607 -(void)setVideoFileFrame:(CVPixelBufferRef __nonnull)srcFrame angle:(int)angle mirror:(int)mirror;
608 
618 -(bool)stopVideoFile;
619 
620 #pragma mark - 音频数据管理
621 
630 - (void)registerAudioFrameCallback:(id<JCAudioFrameCallback> __nullable)callback;
631 
644 - (void)registerVideoFrameCallback:(id<JCVideoFrameCallback> __nullable)callback;
645 
662 - (bool)inputCustomAudioData:(NSData *_Nonnull)data sampleRateHz:(int)sampleRateHz channels:(int)channels playDelayMS:(int)playDelayMS recDelayMS:(int)recDelayMS clockDrift:(int)clockDrift;
663 
679 - (bool)getAudioOutputData:(unsigned char*_Nonnull)buf length:(int)length sampleRateHz:(int)sampleRateHz channels:(int)channels;
680 
681 
682 #if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
683 
689 @property (nonatomic) bool defaultSpeakerOn;
690 
700 -(void)enableSpeaker:(bool)enable;
701 
706 -(NSString* __nullable)getAudioOutputType;
707 
713 -(bool)isSpeakerOn;
714 
715 #endif
716 @end
717 
最后更新时间: 11/9/2021, 5:34:32 PM