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
161@property (nonatomic) JCMediaDeviceAudioAGCType agcMode;
162
163@end
164
168@protocol JCAudioFrameCallback <NSObject>
169
181- (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;
182
191- (void)onAudioOutputFrame:(NSString *_Nonnull)outputId sampleRateHz:(int)sampleRateHz channels:(int)channels buf:(unsigned char *_Nonnull)buf;
192
193@end
194
198@protocol JCVideoFrameCallback <NSObject>
199
213- (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;
214
236- (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;
237
238@end
239
244@interface JCMediaDevice : NSObject
245
251@property (nonatomic, readonly) bool cameraOpen;
252
258@property (nonatomic, readonly) bool videoFileOpen;
259
263@property (nonatomic, strong, readonly) JCMediaDeviceCamera* __nullable camera;
264
268@property (nonatomic, readonly) NSArray<JCMediaDeviceCamera*> * __nonnull cameras;
269
273@property (nonatomic, strong) JCMediaDeviceCamera* __nullable defaultCamera;
274
280@property (nonatomic, strong) JCMediaDeviceAudioParam * _Nonnull audioParam;
281
285@property (nonatomic, strong, readonly) NSString* __nonnull videoFileId;
286
290@property (nonatomic, strong, readonly, nullable) NSString* screenCaptureVideoFileId;
291
295@property (nonatomic, strong) NSString* __nullable currentScreenCaptureId;
296
300@property (nonatomic, readonly) bool audioInterrupt;
301
311@property (nonatomic) JCMediaDeviceVideoAngel videoAngle;
312
325@property (nonatomic) bool useInternalAudioDeviceLogic;
326
335@property (nonatomic, readonly) bool audioStart;
336
337#if TARGET_OS_OSX
341@property (nonatomic, readonly) NSArray<JCMediaDeviceAudio*>* __nonnull audioInputs;
342
346@property (nonatomic, strong) JCMediaDeviceAudio* __nullable audioInput;
347
351@property (nonatomic, readonly) NSArray<JCMediaDeviceAudio*>* __nonnull audioOutputs;
352
356@property (nonatomic, strong) JCMediaDeviceAudio* __nullable audioOutput;
357
361@property (nonatomic, readonly) NSArray<JCMediaDeviceWindow*>* __nonnull desktops;
362
366@property (nonatomic, readonly) NSArray<JCMediaDeviceWindow*>* __nonnull windows;
367
371@property (nonatomic, strong) JCMediaDeviceWindow* __nullable screenshareWindow;
372#endif
373
388+(JCMediaDevice* __nullable)create:(JCClient* __nonnull)client callback:(id<JCMediaDeviceCallback> __nonnull)callback;
389
397+(void)destroy;
398
416-(JCMediaDeviceVideoCanvas* __nullable)startCameraVideo:(JCMediaDeviceRender)type;
417
436-(JCMediaDeviceVideoCanvas* __nullable)startCameraVideo:(JCMediaDeviceRender)type view:(JCView* __nonnull)view;
437
454-(JCMediaDeviceVideoCanvas* __nullable)startVideo:(NSString* __nonnull)videoSource renderType:(JCMediaDeviceRender)type;
455
471-(JCMediaDeviceVideoCanvas* __nullable)startVideo:(NSString* __nonnull)videoSource renderType:(JCMediaDeviceRender)type view:(JCView* __nonnull)view;
472
480-(void)stopVideo:(JCMediaDeviceVideoCanvas* __nonnull)canvas;
481
491-(bool)startAudio;
492
502-(bool)stopAudio;
503
515-(bool)startCamera;
516
526-(bool)stopCamera;
527
541-(bool)switchCamera;
542
555-(bool)switchCamera:(JCMediaDeviceCamera* __nonnull)camera;
556
566- (void)setCameraProperty:(int)width height:(int)height framerate:(int)framerate;
567
577- (void)setScreenCaptureProperty:(int)width height:(int)height framerate:(int)framerate;
578
592-(bool)startVideoFile;
593
609-(void)setVideoFileFrame:(NSData* __nonnull)srcFrame format:(JCMediaDeviceVideoPixelFormat)format width:(int)width height:(int)height;
610
625-(void)setVideoFileFrame:(CVPixelBufferRef __nonnull)srcFrame angle:(int)angle mirror:(int)mirror;
626
636-(bool)stopVideoFile;
637
643-(int)getMinExposureCompensation;
644
650-(int)getMaxExposureCompensation;
651
657-(float)getExposureCompensationStep;
658
665-(int)setExposureCompensation:(float)exposureValue;
666
667
674-(int)setCameraZoom:(float)zoom;
675
681-(bool)isCameraFlashSupported;
682
688-(bool)enableFlash:(bool)enable;
689
690
691#pragma mark - 音频数据管理
692
701- (void)registerAudioFrameCallback:(id<JCAudioFrameCallback> __nullable)callback;
702
715- (void)registerVideoFrameCallback:(id<JCVideoFrameCallback> __nullable)callback;
716
733- (bool)inputCustomAudioData:(NSData *_Nonnull)data sampleRateHz:(int)sampleRateHz channels:(int)channels playDelayMS:(int)playDelayMS recDelayMS:(int)recDelayMS clockDrift:(int)clockDrift;
734
750- (bool)getAudioOutputData:(unsigned char*_Nonnull)buf length:(int)length sampleRateHz:(int)sampleRateHz channels:(int)channels;
751
752
753#if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
754
760@property (nonatomic) bool defaultSpeakerOn;
761
771-(void)enableSpeaker:(bool)enable;
772
777-(NSString* __nullable)getAudioOutputType;
778
784-(bool)isSpeakerOn;
785
798- (bool)enableScreenCapture:(bool)enable appGroupId:(NSString *)appGroupId preferredExtension:(NSString *)preferredExtension;
799
805- (int)getOutputVolume;
806
812- (int)getInputVolume;
813
814
815#endif
816@end
817
JCMediaDeviceRender
Definition JCMediaDeviceConstants.h:31
JCMediaDeviceMirror
Definition JCMediaDeviceConstants.h:121
JCMediaDeviceCameraType
Definition JCMediaDeviceConstants.h:95
JCMediaDeviceAudioAECType
Definition JCMediaDeviceConstants.h:136
JCMediaDeviceAudioAGCType
Definition JCMediaDeviceConstants.h:145
JCMediaDeviceVideoSource
Definition JCMediaDeviceConstants.h:109
JCMediaDeviceVideoPixelFormat
Definition JCMediaDeviceConstants.h:43
JCMediaDeviceVideoAngel
Definition JCMediaDeviceConstants.h:79
Definition JCClient.h:124
Definition JCMediaDevice.h:51
Definition JCMediaDevice.h:90
Definition JCMediaDevice.h:25
NSString *__nonnull cameraName
Definition JCMediaDevice.h:34
JCMediaDeviceCameraType cameraType
Definition JCMediaDevice.h:43
NSString *__nonnull cameraId
Definition JCMediaDevice.h:29
Definition JCMediaDevice.h:245
Definition JCMediaDeviceVideoCanvas.h:28
Definition JCMediaDevice.h:73
最后更新时间: 2024/8/12 13:50:38