diff --git a/demo/KSYLiveDemo/Info.plist b/demo/KSYLiveDemo/Info.plist index 46f3cba..8899bf1 100644 --- a/demo/KSYLiveDemo/Info.plist +++ b/demo/KSYLiveDemo/Info.plist @@ -15,11 +15,11 @@ CFBundlePackageType APPL CFBundleShortVersionString - 2.6.0 + 2.6.1 CFBundleSignature ???? CFBundleVersion - 2.6.0.0 + 2.6.1.2 LSRequiresIPhoneOS NSAppTransportSecurity diff --git a/demo/KSYLiveDemo/KSYDemoUI/KSYAudioCtrlView.h b/demo/KSYLiveDemo/KSYDemoUI/KSYAudioCtrlView.h index 9c80653..8382a7b 100644 --- a/demo/KSYLiveDemo/KSYDemoUI/KSYAudioCtrlView.h +++ b/demo/KSYLiveDemo/KSYDemoUI/KSYAudioCtrlView.h @@ -58,4 +58,8 @@ @property UISegmentedControl * noiseSuppressSeg; @property (atomic, readonly) KSYAudioNoiseSuppress noiseSuppress; +/// 音频通路数据类型选择 +@property UISegmentedControl * audioDataTypeSeg; +@property (atomic, readonly) KSYAudioDataType audioDataType; + @end diff --git a/demo/KSYLiveDemo/KSYDemoUI/KSYAudioCtrlView.m b/demo/KSYLiveDemo/KSYDemoUI/KSYAudioCtrlView.m index 1ed734d..2850220 100644 --- a/demo/KSYLiveDemo/KSYDemoUI/KSYAudioCtrlView.m +++ b/demo/KSYLiveDemo/KSYDemoUI/KSYAudioCtrlView.m @@ -49,6 +49,7 @@ - (id)init{ _effectType = [self addSegCtrlWithItems:@[@"关闭变声",@"大叔", @"萝莉", @"庄严", @"机器人"]]; _noiseSuppressSeg = [self addSegCtrlWithItems:@[@"关闭去噪",@"低", @"中", @"高", @"很高"]]; _noiseSuppressSeg.selectedSegmentIndex = 3; + _audioDataTypeSeg = [self addSegCtrlWithItems:@[@"CMSampleBufer",@"RawPcm"]]; return self; } - (void)layoutUI{ @@ -66,8 +67,9 @@ - (void)layoutUI{ nu,_lblPlayCapture,_swPlayCapture] ]; [self putRow1:_playCapVol]; [self putRow1:_effectType]; - [self putRowFit:@[_lblStereo, _stereoStream]]; + [self putRowFit:@[_lblStereo, _stereoStream, _audioDataTypeSeg]]; [self putRow1:_noiseSuppressSeg]; + } - (void) initMicInput { BOOL bHS = [AVAudioSession isHeadsetInputAvaible]; @@ -134,4 +136,8 @@ - (KSYAudioEffectType) audioEffect { - (KSYAudioNoiseSuppress) noiseSuppress { return _noiseSuppressSeg.selectedSegmentIndex - 1; // off is -1 } +@synthesize audioDataType = _audioDataType; +- (KSYAudioDataType) audioDataType { + return _audioDataTypeSeg.selectedSegmentIndex; +} @end diff --git a/demo/KSYLiveDemo/KSYDemoUI/KSYBrushStreamerVC.m b/demo/KSYLiveDemo/KSYDemoUI/KSYBrushStreamerVC.m index 0932578..5e5a3b1 100644 --- a/demo/KSYLiveDemo/KSYDemoUI/KSYBrushStreamerVC.m +++ b/demo/KSYLiveDemo/KSYDemoUI/KSYBrushStreamerVC.m @@ -101,19 +101,10 @@ - (void)onTimer:(NSTimer *)theTimer{ [self updateDrawView]; } -#pragma mark - utils --(UIImage *)imageFromUIView:(UIView *)v { - CGSize s = v.frame.size; - UIGraphicsBeginImageContextWithOptions(s, NO, 0.0); - [v.layer renderInContext:UIGraphicsGetCurrentContext()]; - UIImage*image = UIGraphicsGetImageFromCurrentImageContext(); - UIGraphicsEndImageContext(); - return image; -} +//刷新画笔view - (void) updateDrawView{ if(_drawRefresh){ - UIImage * img = [self imageFromUIView:_drawView]; - [_brushKit addDrawLayer:img]; + _brushKit.drawPic = [[GPUImageUIElement alloc] initWithView:_drawView]; } } diff --git a/demo/KSYLiveDemo/KSYDemoUI/KSYHorScreenStreamerVC.m b/demo/KSYLiveDemo/KSYDemoUI/KSYHorScreenStreamerVC.m index e2ba452..84b21a7 100644 --- a/demo/KSYLiveDemo/KSYDemoUI/KSYHorScreenStreamerVC.m +++ b/demo/KSYLiveDemo/KSYDemoUI/KSYHorScreenStreamerVC.m @@ -11,7 +11,7 @@ @interface KSYHorScreenStreamerVC () @property UILabel *text; -@property KSYGPUView *preView; +@property UIView *preView; @end @implementation KSYHorScreenStreamerVC @@ -26,7 +26,7 @@ - (void)setupUI{ _text.hidden = YES; CGFloat wdt = self.view.frame.size.width; - _preView = [[KSYGPUView alloc] initWithFrame:CGRectMake(0, 75, wdt, wdt * 9 / 16)]; + _preView = [[UIView alloc] initWithFrame:CGRectMake(0, 75, wdt, wdt * 9 / 16)]; [self.view addSubview:_preView]; _preView.hidden = YES; self.profilePicker.hidden = YES; diff --git a/demo/KSYLiveDemo/KSYDemoUI/KSYStreamerVC.m b/demo/KSYLiveDemo/KSYDemoUI/KSYStreamerVC.m index e11774c..8a8caff 100644 --- a/demo/KSYLiveDemo/KSYDemoUI/KSYStreamerVC.m +++ b/demo/KSYLiveDemo/KSYDemoUI/KSYStreamerVC.m @@ -16,14 +16,20 @@ #import "KSYNameSlider.h" #import "KSYQRCode.h" #import - +#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 #import #import +#endif // 为防止将手机存储写满,限制录像时长为30s #define REC_MAX_TIME 30 //录制视频的最大时间,单位s -@interface KSYStreamerVC () { +@interface KSYStreamerVC () = __IPHONE_10_0 +,CXCallObserverDelegate +#endif +>{ UISwipeGestureRecognizer *_swipeGest; NSDateFormatter * _dateFormatter; int _strSeconds; // 推流持续的时间 , 单位s @@ -35,14 +41,16 @@ @interface KSYStreamerVC () = __IPHONE_10_0 CXCallObserver *_callObserver; - +#endif YYImageDecoder * _animateDecoder; int _animateIdx; CADisplayLink *_displayLink; NSTimeInterval _dlTime; NSLock *_dlLock; GPUImagePicture *_logoPicure; + UIImageOrientation _logoOrientation; } @end @@ -202,9 +210,10 @@ - (void) initObservers{ SEL_VALUE(onNetStateEvent:) , KSYNetStateEventNotification, SEL_VALUE(onBgmPlayerStateChange:) ,KSYAudioStateDidChangeNotification, nil]; - +#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 _callObserver = [[CXCallObserver alloc] init]; [_callObserver setDelegate:self queue:nil]; +#endif } - (void) addObservers { @@ -223,7 +232,9 @@ - (void) addObservers { - (void) rmObservers { [super rmObservers]; [[NSNotificationCenter defaultCenter] removeObserver:self]; +#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 _callObserver = nil; +#endif } - (void) layoutUI { @@ -257,6 +268,8 @@ - (void) setupLogo{ UIImage * logoImg = [UIImage imageNamed:@"ksvc"]; _logoPicure = [[GPUImagePicture alloc] initWithImage:logoImg]; _kit.logoPic = _logoPicure; + _logoOrientation = logoImg.imageOrientation; + [_kit setLogoOrientaion: _logoOrientation]; _kit.logoRect = CGRectMake(0.05, yPos, 0, hgt); _kit.logoAlpha= 0.5; yPos += hgt; @@ -283,7 +296,8 @@ - (void) updateLogoText { - (void) setupAnimateLogo:(NSString*)path { NSData *data = [NSData dataWithContentsOfFile:path]; [_dlLock lock]; - _animateDecoder = [YYImageDecoder decoderWithData:data scale:2.0]; + _animateDecoder = [YYImageDecoder decoderWithData:data scale: [[UIScreen mainScreen] scale]]; + [_kit setLogoOrientaion:UIImageOrientationUp]; [_dlLock unlock]; _animateIdx = 0; _dlTime = 0; @@ -344,6 +358,7 @@ - (void) setCaptureCfg { _kit.cameraPosition = [self.presetCfgView cameraPos]; _kit.gpuOutputPixelFormat = [self.presetCfgView gpuOutputPixelFmt]; _kit.capturePixelFormat = [self.presetCfgView gpuOutputPixelFmt]; + _kit.aCapDev.noiseSuppressionLevel = self.audioView.noiseSuppress; _kit.videoProcessingCallback = ^(CMSampleBufferRef buf){ // 在此处添加自定义图像处理, 直接修改buf中的图像数据会传递到观众端 // 或复制图像数据之后再做其他处理, 则观众端仍然看到处理前的图像 @@ -352,6 +367,10 @@ - (void) setCaptureCfg { // 在此处添加自定义音频处理, 直接修改buf中的pcm数据会传递到观众端 // 或复制音频数据之后再做其他处理, 则观众端仍然听到原始声音 }; + _kit.pcmProcessingCallback = ^(uint8_t** pData, int len, const AudioStreamBasicDescription* fmt, CMTime timeInfo){ + // 在此处添加自定义音频处理, 直接修改pcm数据会传递到观众端 + // 或复制音频数据之后再做其他处理, 则观众端仍然听到原始声音 + }; _kit.interruptCallback = ^(BOOL bInterrupt){ // 在此处添加自定义图像采集被打断的处理 (比如接听电话等) }; @@ -452,9 +471,11 @@ - (void) onCaptureStateChange:(NSNotification *)notification{ } if (_kit.captureState == KSYCaptureStateIdle) { self.ctrlView.btnCapture.backgroundColor = [UIColor darkGrayColor]; + self.audioView.audioDataTypeSeg.enabled = YES; } else if(_kit.captureState == KSYCaptureStateCapturing) { self.ctrlView.btnCapture.backgroundColor = [UIColor lightGrayColor]; + self.audioView.audioDataTypeSeg.enabled = NO; } } @@ -728,6 +749,7 @@ - (void) onCameraToggle{ // see kit or block } - (void) onCapture{ if (!_kit.vCapDev.isRunning){ + _kit.audioDataType = self.audioView.audioDataType; _kit.videoOrientation = [[UIApplication sharedApplication] statusBarOrientation]; // 重新开启预览是需要重新根据方向setupLogo [self setupLogo]; @@ -902,6 +924,7 @@ - (void)onMiscBtns:(id)sender { [_dlLock lock]; _animateDecoder = nil; _kit.logoPic = _logoPicure; + [_kit setLogoOrientaion:_logoOrientation]; [_dlLock unlock]; } } @@ -994,12 +1017,10 @@ -(void)imagePickerController:(UIImagePickerController *)picker _logoPicure = [[GPUImagePicture alloc] initWithImage:image smoothlyScaleOutput:YES]; _kit.logoPic = _logoPicure; + _logoOrientation = image.imageOrientation; + [_kit setLogoOrientaion: _logoOrientation]; [picker dismissViewControllerAnimated:YES completion:nil]; if (picker.sourceType == UIImagePickerControllerSourceTypeCamera) { - [_kit.vPreviewMixer setPicRotation:kGPUImageRotateRight - ofLayer:_kit.logoPicLayer]; - [_kit.vStreamMixer setPicRotation:kGPUImageRotateRight - ofLayer:_kit.logoPicLayer]; [self restartVideoCapSession]; } } @@ -1178,6 +1199,7 @@ - (void)pinchDetected:(UIPinchGestureRecognizer *)recognizer{ [_kit setPinchZoomFactor:zoomFactor]; } +#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 #pragma mark - CXCallObserverDelegate method - (void)callObserver:(CXCallObserver *)callObserver callChanged:(CXCall *)call { //处理来电事件 @@ -1203,6 +1225,7 @@ - (void)callObserver:(CXCallObserver *)callObserver callChanged:(CXCall *)call { if(needSendMsg == YES) [_kit processMessageData:message]; } +#endif #pragma mark - Decal 相关 - (void)genDecalViewWithImgName:(NSString *)imgName{ diff --git a/demo/KSYLiveDemo/KSYPlayerDemo/KSYRecordVC.m b/demo/KSYLiveDemo/KSYPlayerDemo/KSYRecordVC.m index e23db14..c4f5ad6 100644 --- a/demo/KSYLiveDemo/KSYPlayerDemo/KSYRecordVC.m +++ b/demo/KSYLiveDemo/KSYPlayerDemo/KSYRecordVC.m @@ -595,13 +595,14 @@ - (void)setupTimer { //调用截图方法 displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(captureScreen:)]; - if(SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"10.0")) +#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 //如果系统版本大于等于10.0 //设定回调速率 displayLink.preferredFramesPerSecond = 15; - else +#else //设置间隔多少帧调用一次selector 方法 displayLink.frameInterval = 4; +#endif [displayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSRunLoopCommonModes]; } } diff --git a/demo/KSYLiveDemo/KSYUIUtils/KSYUIVC.h b/demo/KSYLiveDemo/KSYUIUtils/KSYUIVC.h index 51e73ed..fd36a4e 100644 --- a/demo/KSYLiveDemo/KSYUIUtils/KSYUIVC.h +++ b/demo/KSYLiveDemo/KSYUIUtils/KSYUIVC.h @@ -15,6 +15,10 @@ */ #define SYSTEM_VERSION_GE_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending) +#ifndef __IPHONE_10_0 +#define __IPHONE_10_0 100000 +#endif + @class KSYUIView; @interface KSYUIVC : UIViewController diff --git a/demo/KSYLiveDemo_Swift/KSYPlayerDemo_Swift/KSYNetTrackerVC.swift b/demo/KSYLiveDemo_Swift/KSYPlayerDemo_Swift/KSYNetTrackerVC.swift index 6bc7032..40dd5f9 100644 --- a/demo/KSYLiveDemo_Swift/KSYPlayerDemo_Swift/KSYNetTrackerVC.swift +++ b/demo/KSYLiveDemo_Swift/KSYPlayerDemo_Swift/KSYNetTrackerVC.swift @@ -234,8 +234,8 @@ class KSYNetTrackerVC: UIViewController { if rtt < 0.00000001 { displayStr = displayStr?.appending("Request timeout for icmp_seq \(count)") }else{ - let pingRet = tracker?.routerInfo.firstObject as! KSYNetRouterInfo - displayStr = displayStr?.appending(String(format: "ping \(pingRet.ips.firstObject ?? "") icmp_seq \(count) time=%0.3f ms", rtt)) + let pingRet = tracker?.routerInfo?.firstObject as! KSYNetRouterInfo + displayStr = displayStr?.appending(String(format: "ping \(pingRet.ips?.firstObject ?? "") icmp_seq \(count) time=%0.3f ms", rtt)) } }else { getRouterInfo() @@ -279,7 +279,7 @@ class KSYNetTrackerVC: UIViewController { func getPingRetStr() -> String { var pingRetStr: String = "" - let pingRet = tracker?.routerInfo[0] as! KSYNetRouterInfo + let pingRet = tracker?.routerInfo?[0] as! KSYNetRouterInfo pingRetStr = pingRetStr.appending("\n ------ping statics-----\n") pingRetStr = pingRetStr.appendingFormat("%d packets transmitted, %d packets received, %0.3f packet loss\n", pingRet.number, Int(Float(pingRet.number) * (1 - pingRet.loss)), pingRet.loss) @@ -309,13 +309,13 @@ class KSYNetTrackerVC: UIViewController { return } - tracker!.routerInfo.enumerateObjects( { (netInfo, idx, _) in + tracker!.routerInfo?.enumerateObjects( { (netInfo, idx, _) in if let info: KSYNetRouterInfo = (netInfo as! KSYNetRouterInfo) { if let _ = info.ips { j = 0; - for ip in info.ips { + for ip in info.ips! { if let ip: String = (ip as! String) { if j == 0 { infoLog = infoLog.appendingFormat("%-3d", i) diff --git a/doc/docset-installed.txt b/doc/docset-installed.txt index 700a85e..52276d3 100644 --- a/doc/docset-installed.txt +++ b/doc/docset-installed.txt @@ -1,4 +1,4 @@ Documentation set was installed to Xcode! Path: /Users/ksyci/Library/Developer/Shared/Documentation/DocSets/com.ksyun.KSYLive_iOS.docset -Time: 2017-08-28 05:49:03 +0000 \ No newline at end of file +Time: 2017-09-01 10:01:56 +0000 \ No newline at end of file diff --git a/doc/docset/Contents/Resources/Documents/Classes/KSYAUAudioCapture.html b/doc/docset/Contents/Resources/Documents/Classes/KSYAUAudioCapture.html index dd6c566..c1003e7 100644 --- a/doc/docset/Contents/Resources/Documents/Classes/KSYAUAudioCapture.html +++ b/doc/docset/Contents/Resources/Documents/Classes/KSYAUAudioCapture.html @@ -76,6 +76,8 @@

+ + @@ -540,7 +542,7 @@

 
-

噪声抑制处理的等级(默认为KSYAudioNoiseSuppress_HIGH)

+

噪声抑制处理的等级(默认为KSYAudioNoiseSuppress_OFF)

@@ -837,7 +839,53 @@

&nb + + + + + + + +
+

Declared In

+

KSYAUAudioCapture.h

+
+ + + + +
+ +

  pcmProcessingCallback +

+ +
+
+ +
+ + +
+

采集数据输出回调函数

+
+ + + +
@property (nonatomic, copy) void ( ^ ) ( uint8_t **pData , int len , const AudioStreamBasicDescription *fmt , CMTime timeInfo ) pcmProcessingCallback
+ + + + + + + + + +
+

Discussion

+

pData 和 len 为采集数据和长度 (目前只支持单声道, 只有pData[0]为有效数据指针 )

与audioProcessingCallback两者只能二选一, 设置 pcmProcessingCallback 会清空audioProcessingCallback

diff --git a/doc/docset/Contents/Resources/Documents/Classes/KSYAudioMixer.html b/doc/docset/Contents/Resources/Documents/Classes/KSYAudioMixer.html index 52fb6f8..4da9c32 100644 --- a/doc/docset/Contents/Resources/Documents/Classes/KSYAudioMixer.html +++ b/doc/docset/Contents/Resources/Documents/Classes/KSYAudioMixer.html @@ -66,6 +66,8 @@

+ + @@ -590,12 +592,12 @@

Parameters

pData -

原始数据

+

原始数据指针数组,单通道仅pData[0]有效 当输入为多通道且非交织时, pData[i]分别表示各个通道的数据

len -

数据的长度,单位为字节

+

数据的长度,单位为sample (bytes / sizeof(sample))

@@ -675,7 +677,53 @@

&nb + + + + + + + +
+

Declared In

+

KSYAudioMixer.h

+
+ + +

+
+
+ +

  pcmProcessingCallback +

+ +
+
+ +
+ + +
+

音频处理回调接口

+
+ + + +
@property (nonatomic, copy) void ( ^ ) ( uint8_t **pData , int nbSample , CMTime pts ) pcmProcessingCallback
+ + + + + + + + + +
+

Discussion

+

pData 为数据指针 (双通道时, 数据为交织格式), 仅pData[0] 有效

nbSample 为数据长度, 单位为sample (bytes / sizeof(sample)/channels)

请注意本函数的执行时间,如果太长可能导致不可预知的问题

与audioProcessingCallback两者只能二选一, 设置 pcmProcessingCallback 会清空audioProcessingCallback

@@ -767,7 +815,7 @@

  bStereo

Discussion

-

如果输入数据都不是双声道则输出数据左右耳内容一样

+

如果输入数据都不是双声道则输出数据左右耳内容一样

输出立体声的数据格式一定是交织的

@@ -893,11 +941,6 @@

  outFm -
-

Discussion

-

暂时为固定一种格式 (44.1KHz, S16)

-
- diff --git a/doc/docset/Contents/Resources/Documents/Classes/KSYGPUBrushStreamerKit.html b/doc/docset/Contents/Resources/Documents/Classes/KSYGPUBrushStreamerKit.html index cfbdbea..fc0946b 100644 --- a/doc/docset/Contents/Resources/Documents/Classes/KSYGPUBrushStreamerKit.html +++ b/doc/docset/Contents/Resources/Documents/Classes/KSYGPUBrushStreamerKit.html @@ -68,8 +68,6 @@

- - @@ -217,7 +215,7 @@

  drawPic -
@property (nonatomic, readwrite) GPUImagePicture *drawPic
+
@property (nonatomic, readwrite) GPUImageUIElement *drawPic
@@ -238,47 +236,6 @@

Discussion

-
-

Declared In

-

KSYGPUBrushStreamerKit.h

-
- - -

-
-
- -

– addDrawLayer: -

- -
-
- -
- - -
-

添加画笔图层

-
- - - -
- (void)addDrawLayer:(UIImage *)img
- - - - - - - - - - - - - - -

Declared In

KSYGPUBrushStreamerKit.h

diff --git a/doc/docset/Contents/Resources/Documents/Classes/KSYGPUStreamerKit.html b/doc/docset/Contents/Resources/Documents/Classes/KSYGPUStreamerKit.html index 1908345..93cd0ea 100644 --- a/doc/docset/Contents/Resources/Documents/Classes/KSYGPUStreamerKit.html +++ b/doc/docset/Contents/Resources/Documents/Classes/KSYGPUStreamerKit.html @@ -66,6 +66,8 @@

+ + @@ -112,6 +114,8 @@

+ + @@ -192,6 +196,8 @@

+ + @@ -2600,7 +2606,117 @@

&nb + + + + + +
+

See Also

+ +
+ + + +
+

Declared In

+

KSYGPUStreamerKit.h

+
+ + +

+
+
+ +

  pcmProcessingCallback +

+ +
+
+ +
+ + +
+

音频处理回调接口

+
+ + + +
@property (nonatomic, copy) void ( ^ ) ( uint8_t **pData , int len , const AudioStreamBasicDescription *fmt , CMTime timeInfo ) pcmProcessingCallback
+ + + + + + + + + +
+

Discussion

+

pData len为原始采集到的音频数据

audioDataType 为KSYAudioData_RawPCM时才会被触发回调

请注意本函数的执行时间,如果太长可能导致不可预知的问题

+
+ + + + + +
+

See Also

+ +
+ + + +
+

Declared In

+

KSYGPUStreamerKit.h

+
+ + +
+
+
+ +

  audioDataType +

+ +
+
+ +
+ + +
+

音频处理通路数据类型 (默认为 KSYAudioData_CMSampleBuffer)

+
+ + + +
@property (nonatomic, assign) KSYAudioDataType audioDataType
+ + + + + + + + + +
+

Discussion

+

音频数据转为 CMSampleBuffer时有格式开销, 使用RawPCM资源消耗会少一些

内部组件对KSYAudioData_RawPCM可能不完善, 目前仅保证基本通路能工作

@@ -3073,6 +3189,59 @@

Discussion

+
+

Declared In

+

KSYGPUStreamerKit.h

+
+ + +
+
+
+ +

– setLogoOrientaion: +

+ +
+
+ +
+ + +
+

设置水印图片的朝向

+
+ + + +
- (void)setLogoOrientaion:(UIImageOrientation)orien
+ + + +
+

Parameters

+ + + + + + + +
orien

图片的朝向

+
+ + + + + + + + + + + + +

Declared In

KSYGPUStreamerKit.h

diff --git a/doc/docset/Contents/Resources/Documents/Classes/KSYStreamerBase.html b/doc/docset/Contents/Resources/Documents/Classes/KSYStreamerBase.html index 810480f..43f6ea1 100644 --- a/doc/docset/Contents/Resources/Documents/Classes/KSYStreamerBase.html +++ b/doc/docset/Contents/Resources/Documents/Classes/KSYStreamerBase.html @@ -94,6 +94,8 @@

+ + @@ -182,6 +184,8 @@

+ + @@ -2302,7 +2306,69 @@

Parameters

Discussion

-

应当在开始推流前定期调用此接口,与processVideoSampleBuffer 交错进行

Warning: 目前只支持 单通道 S16 格式的PCM数据

+

应当在开始推流前定期调用此接口,与processVideoSampleBuffer 交错进行

Warning: 目前只支持 S16 格式的PCM数据

+
+ + + + + + + +
+

Declared In

+

KSYStreamerBase.h

+
+ + +
+
+
+ +

– processAudioData:nbSample:withFormat:timeinfo: +

+ +
+
+ +
+ + +
+

处理一段音频数据

+
+ + + +
- (void)processAudioData:(uint8_t **)pData nbSample:(int)len withFormat:(const AudioStreamBasicDescription *)fmt timeinfo:(CMTime *)pts
+ + + +
+

Parameters

+ + + + + + + + + + + + + + + + + + + + + + +
pData

原始数据指针数组

len

数据的长度,单位为字节

fmt

原始数据的格式 (必须保证一次推流过程中数据格式不变)

pts

原始数据的时间戳

@@ -2311,6 +2377,12 @@

Discussion

+ + + + + +

Declared In

KSYStreamerBase.h

@@ -2412,6 +2484,53 @@

  client +
+

Declared In

+

KSYStreamerBase.h

+
+ + +

+
+
+ +

  expireDate +

+ +
+
+ +
+ + +
+

获取当前SDK过期时间

+
+ + + +
@property (nonatomic, assign) NSDate *expireDate
+ + + + + + + + + +
+

Discussion

+

为nil时,可以永久使用不会过期 +@warnning sdk自行解析得到, 外部赋值无效

+
+ + + + + + +

Declared In

KSYStreamerBase.h

diff --git a/doc/docset/Contents/Resources/Tokens2.xml b/doc/docset/Contents/Resources/Tokens2.xml index 30af696..db54d2e 100644 --- a/doc/docset/Contents/Resources/Tokens2.xml +++ b/doc/docset/Contents/Resources/Tokens2.xml @@ -163,7 +163,7 @@ //apple_ref/occ/instm/KSYAUAudioCapture/setNoiseSuppressionLevel: - 噪声抑制处理的等级(默认为KSYAudioNoiseSuppress_HIGH) + 噪声抑制处理的等级(默认为KSYAudioNoiseSuppress_OFF) KSYAUAudioCapture.h @property (nonatomic, assign) KSYAudioNoiseSuppress noiseSuppressionLevel @@ -175,7 +175,7 @@ //apple_ref/occ/instm/KSYAUAudioCapture/noiseSuppressionLevel - 噪声抑制处理的等级(默认为KSYAudioNoiseSuppress_HIGH) + 噪声抑制处理的等级(默认为KSYAudioNoiseSuppress_OFF) KSYAUAudioCapture.h @property (nonatomic, assign) KSYAudioNoiseSuppress noiseSuppressionLevel @@ -187,7 +187,7 @@ //apple_ref/occ/instp/KSYAUAudioCapture/noiseSuppressionLevel - 噪声抑制处理的等级(默认为KSYAudioNoiseSuppress_HIGH) + 噪声抑制处理的等级(默认为KSYAudioNoiseSuppress_OFF) KSYAUAudioCapture.h @property (nonatomic, assign) KSYAudioNoiseSuppress noiseSuppressionLevel @@ -413,6 +413,42 @@ + + //apple_ref/occ/instm/KSYAUAudioCapture/setPcmProcessingCallback: + 采集数据输出回调函数 + KSYAUAudioCapture.h + + @property (nonatomic, copy) void ( ^ ) ( uint8_t **pData , int len , const AudioStreamBasicDescription *fmt , CMTime timeInfo ) pcmProcessingCallback + + + //api/name/pcmProcessingCallback + + + + + //apple_ref/occ/instm/KSYAUAudioCapture/pcmProcessingCallback + 采集数据输出回调函数 + KSYAUAudioCapture.h + + @property (nonatomic, copy) void ( ^ ) ( uint8_t **pData , int len , const AudioStreamBasicDescription *fmt , CMTime timeInfo ) pcmProcessingCallback + + + //api/name/pcmProcessingCallback + + + + + //apple_ref/occ/instp/KSYAUAudioCapture/pcmProcessingCallback + 采集数据输出回调函数 + KSYAUAudioCapture.h + + @property (nonatomic, copy) void ( ^ ) ( uint8_t **pData , int len , const AudioStreamBasicDescription *fmt , CMTime timeInfo ) pcmProcessingCallback + + + //api/name/pcmProcessingCallback + + + //apple_ref/occ/instm/KSYAUAudioCapture/setCustomPlayCallback: 用户可以自定义播放的内容,直接把数据填入ioData diff --git a/doc/docset/Contents/Resources/Tokens21.xml b/doc/docset/Contents/Resources/Tokens21.xml index 19e2ce8..5bcfd30 100644 --- a/doc/docset/Contents/Resources/Tokens21.xml +++ b/doc/docset/Contents/Resources/Tokens21.xml @@ -89,7 +89,7 @@ 绘制的图片 KSYGPUBrushStreamerKit.h - @property (nonatomic, readwrite) GPUImagePicture *drawPic + @property (nonatomic, readwrite) GPUImageUIElement *drawPic //api/name/drawPic @@ -101,7 +101,7 @@ 绘制的图片 KSYGPUBrushStreamerKit.h - @property (nonatomic, readwrite) GPUImagePicture *drawPic + @property (nonatomic, readwrite) GPUImageUIElement *drawPic //api/name/drawPic @@ -113,25 +113,13 @@ 绘制的图片 KSYGPUBrushStreamerKit.h - @property (nonatomic, readwrite) GPUImagePicture *drawPic + @property (nonatomic, readwrite) GPUImageUIElement *drawPic //api/name/drawPic - - //apple_ref/occ/instm/KSYGPUBrushStreamerKit/addDrawLayer: - 添加画笔图层 - KSYGPUBrushStreamerKit.h - - - (void)addDrawLayer:(UIImage *)img - - - //api/name/addDrawLayer: - - - //apple_ref/occ/instm/KSYGPUBrushStreamerKit/removeDrawLayer 去掉画笔图层 diff --git a/doc/docset/Contents/Resources/Tokens29.xml b/doc/docset/Contents/Resources/Tokens29.xml index b80043d..887516d 100644 --- a/doc/docset/Contents/Resources/Tokens29.xml +++ b/doc/docset/Contents/Resources/Tokens29.xml @@ -1423,6 +1423,11 @@ 音频处理回调接口 KSYGPUStreamerKit.h + + //apple_ref/occ/instp/KSYGPUStreamerKit/audioDataType + + + @property (nonatomic, copy) void ( ^ ) ( CMSampleBufferRef sampleBuffer ) audioProcessingCallback @@ -1435,6 +1440,11 @@ 音频处理回调接口 KSYGPUStreamerKit.h + + //apple_ref/occ/instp/KSYGPUStreamerKit/audioDataType + + + @property (nonatomic, copy) void ( ^ ) ( CMSampleBufferRef sampleBuffer ) audioProcessingCallback @@ -1447,6 +1457,11 @@ 音频处理回调接口 KSYGPUStreamerKit.h + + //apple_ref/occ/instp/KSYGPUStreamerKit/audioDataType + + + @property (nonatomic, copy) void ( ^ ) ( CMSampleBufferRef sampleBuffer ) audioProcessingCallback @@ -1454,6 +1469,93 @@ + + //apple_ref/occ/instm/KSYGPUStreamerKit/setPcmProcessingCallback: + 音频处理回调接口 + KSYGPUStreamerKit.h + + + //apple_ref/occ/instp/KSYGPUStreamerKit/audioDataType + + + + @property (nonatomic, copy) void ( ^ ) ( uint8_t **pData , int len , const AudioStreamBasicDescription *fmt , CMTime timeInfo ) pcmProcessingCallback + + + //api/name/pcmProcessingCallback + + + + + //apple_ref/occ/instm/KSYGPUStreamerKit/pcmProcessingCallback + 音频处理回调接口 + KSYGPUStreamerKit.h + + + //apple_ref/occ/instp/KSYGPUStreamerKit/audioDataType + + + + @property (nonatomic, copy) void ( ^ ) ( uint8_t **pData , int len , const AudioStreamBasicDescription *fmt , CMTime timeInfo ) pcmProcessingCallback + + + //api/name/pcmProcessingCallback + + + + + //apple_ref/occ/instp/KSYGPUStreamerKit/pcmProcessingCallback + 音频处理回调接口 + KSYGPUStreamerKit.h + + + //apple_ref/occ/instp/KSYGPUStreamerKit/audioDataType + + + + @property (nonatomic, copy) void ( ^ ) ( uint8_t **pData , int len , const AudioStreamBasicDescription *fmt , CMTime timeInfo ) pcmProcessingCallback + + + //api/name/pcmProcessingCallback + + + + + //apple_ref/occ/instm/KSYGPUStreamerKit/setAudioDataType: + 音频处理通路数据类型 (默认为 KSYAudioData_CMSampleBuffer) + KSYGPUStreamerKit.h + + @property (nonatomic, assign) KSYAudioDataType audioDataType + + + //api/name/audioDataType + + + + + //apple_ref/occ/instm/KSYGPUStreamerKit/audioDataType + 音频处理通路数据类型 (默认为 KSYAudioData_CMSampleBuffer) + KSYGPUStreamerKit.h + + @property (nonatomic, assign) KSYAudioDataType audioDataType + + + //api/name/audioDataType + + + + + //apple_ref/occ/instp/KSYGPUStreamerKit/audioDataType + 音频处理通路数据类型 (默认为 KSYAudioData_CMSampleBuffer) + KSYGPUStreamerKit.h + + @property (nonatomic, assign) KSYAudioDataType audioDataType + + + //api/name/audioDataType + + + //apple_ref/occ/instm/KSYGPUStreamerKit/setInterruptCallback: 摄像头采集被打断的消息通知 @@ -1752,6 +1854,23 @@ + + //apple_ref/occ/instm/KSYGPUStreamerKit/setLogoOrientaion: + 设置水印图片的朝向 + KSYGPUStreamerKit.h + + - (void)setLogoOrientaion:(UIImageOrientation)orien + + + orien + 图片的朝向 + + + + //api/name/setLogoOrientaion: + + + //apple_ref/occ/instm/KSYGPUStreamerKit/setTextPic: 文字内容的图片 diff --git a/doc/docset/Contents/Resources/Tokens42.xml b/doc/docset/Contents/Resources/Tokens42.xml index a136d7c..29c4de1 100644 --- a/doc/docset/Contents/Resources/Tokens42.xml +++ b/doc/docset/Contents/Resources/Tokens42.xml @@ -1304,6 +1304,32 @@ + + //apple_ref/occ/instm/KSYStreamerBase/processAudioData:nbSample:withFormat:timeinfo: + 处理一段音频数据 + KSYStreamerBase.h + + - (void)processAudioData:(uint8_t **)pData nbSample:(int)len withFormat:(const AudioStreamBasicDescription *)fmt timeinfo:(CMTime *)pts + + + pData + 原始数据指针数组 + + len + 数据的长度,单位为字节 + + fmt + 原始数据的格式 (必须保证一次推流过程中数据格式不变) + + pts + 原始数据的时间戳 + + + + //api/name/processAudioData:nbSample:withFormat:timeinfo: + + + //apple_ref/occ/instm/KSYStreamerBase/processMessageData: 处理一个消息 @@ -1360,6 +1386,42 @@ + + //apple_ref/occ/instm/KSYStreamerBase/setExpireDate: + 获取当前SDK过期时间 + KSYStreamerBase.h + + @property (nonatomic, assign) NSDate *expireDate + + + //api/name/expireDate + + + + + //apple_ref/occ/instm/KSYStreamerBase/expireDate + 获取当前SDK过期时间 + KSYStreamerBase.h + + @property (nonatomic, assign) NSDate *expireDate + + + //api/name/expireDate + + + + + //apple_ref/occ/instp/KSYStreamerBase/expireDate + 获取当前SDK过期时间 + KSYStreamerBase.h + + @property (nonatomic, assign) NSDate *expireDate + + + //api/name/expireDate + + + //apple_ref/occ/instm/KSYStreamerBase/setStreamID: 查询当前推流的事件ID diff --git a/doc/docset/Contents/Resources/Tokens8.xml b/doc/docset/Contents/Resources/Tokens8.xml index 26137b3..88c11d1 100644 --- a/doc/docset/Contents/Resources/Tokens8.xml +++ b/doc/docset/Contents/Resources/Tokens8.xml @@ -151,10 +151,10 @@ pData - 原始数据 + 原始数据指针数组,单通道仅pData[0]有效 当输入为多通道且非交织时, pData[i]分别表示各个通道的数据 len - 数据的长度,单位为字节 + 数据的长度,单位为sample (bytes / sizeof(sample)) fmt 原始数据的格式 @@ -207,6 +207,42 @@ + + //apple_ref/occ/instm/KSYAudioMixer/setPcmProcessingCallback: + 音频处理回调接口 + KSYAudioMixer.h + + @property (nonatomic, copy) void ( ^ ) ( uint8_t **pData , int nbSample , CMTime pts ) pcmProcessingCallback + + + //api/name/pcmProcessingCallback + + + + + //apple_ref/occ/instm/KSYAudioMixer/pcmProcessingCallback + 音频处理回调接口 + KSYAudioMixer.h + + @property (nonatomic, copy) void ( ^ ) ( uint8_t **pData , int nbSample , CMTime pts ) pcmProcessingCallback + + + //api/name/pcmProcessingCallback + + + + + //apple_ref/occ/instp/KSYAudioMixer/pcmProcessingCallback + 音频处理回调接口 + KSYAudioMixer.h + + @property (nonatomic, copy) void ( ^ ) ( uint8_t **pData , int nbSample , CMTime pts ) pcmProcessingCallback + + + //api/name/pcmProcessingCallback + + + //apple_ref/occ/instm/KSYAudioMixer/setMainTrack: 主轨的trackId (默认为0) diff --git a/doc/docset/Contents/Resources/docSet.dsidx b/doc/docset/Contents/Resources/docSet.dsidx index df4ccff..48af3a7 100644 Binary files a/doc/docset/Contents/Resources/docSet.dsidx and b/doc/docset/Contents/Resources/docSet.dsidx differ diff --git a/doc/docset/Contents/Resources/docSet.dsidx-shm b/doc/docset/Contents/Resources/docSet.dsidx-shm index 651627a..508ff17 100644 Binary files a/doc/docset/Contents/Resources/docSet.dsidx-shm and b/doc/docset/Contents/Resources/docSet.dsidx-shm differ diff --git a/doc/docset/Contents/Resources/docSet.dsidx-wal b/doc/docset/Contents/Resources/docSet.dsidx-wal index b214650..982c213 100644 Binary files a/doc/docset/Contents/Resources/docSet.dsidx-wal and b/doc/docset/Contents/Resources/docSet.dsidx-wal differ diff --git a/doc/docset/Contents/Resources/docSet.skidx b/doc/docset/Contents/Resources/docSet.skidx index 7950441..4455e95 100644 Binary files a/doc/docset/Contents/Resources/docSet.skidx and b/doc/docset/Contents/Resources/docSet.skidx differ diff --git a/doc/docset/Contents/Resources/docSet.toc b/doc/docset/Contents/Resources/docSet.toc index 1317ae2..8aafb7b 100644 Binary files a/doc/docset/Contents/Resources/docSet.toc and b/doc/docset/Contents/Resources/docSet.toc differ diff --git a/doc/docset/Contents/Resources/docSet.tokencache b/doc/docset/Contents/Resources/docSet.tokencache index 24c81d0..33c7289 100644 Binary files a/doc/docset/Contents/Resources/docSet.tokencache and b/doc/docset/Contents/Resources/docSet.tokencache differ diff --git a/doc/html/Classes/KSYAUAudioCapture.html b/doc/html/Classes/KSYAUAudioCapture.html index dd6c566..c1003e7 100644 --- a/doc/html/Classes/KSYAUAudioCapture.html +++ b/doc/html/Classes/KSYAUAudioCapture.html @@ -76,6 +76,8 @@

+ + @@ -540,7 +542,7 @@

 
-

噪声抑制处理的等级(默认为KSYAudioNoiseSuppress_HIGH)

+

噪声抑制处理的等级(默认为KSYAudioNoiseSuppress_OFF)

@@ -837,7 +839,53 @@

&nb + + + + + + + +
+

Declared In

+

KSYAUAudioCapture.h

+
+ + +

+
+
+ +

  pcmProcessingCallback +

+ +
+
+ +
+ + +
+

采集数据输出回调函数

+
+ + + +
@property (nonatomic, copy) void ( ^ ) ( uint8_t **pData , int len , const AudioStreamBasicDescription *fmt , CMTime timeInfo ) pcmProcessingCallback
+ + + + + + + + + +
+

Discussion

+

pData 和 len 为采集数据和长度 (目前只支持单声道, 只有pData[0]为有效数据指针 )

与audioProcessingCallback两者只能二选一, 设置 pcmProcessingCallback 会清空audioProcessingCallback

diff --git a/doc/html/Classes/KSYAudioMixer.html b/doc/html/Classes/KSYAudioMixer.html index 52fb6f8..4da9c32 100644 --- a/doc/html/Classes/KSYAudioMixer.html +++ b/doc/html/Classes/KSYAudioMixer.html @@ -66,6 +66,8 @@

+ + @@ -590,12 +592,12 @@

Parameters

pData -

原始数据

+

原始数据指针数组,单通道仅pData[0]有效 当输入为多通道且非交织时, pData[i]分别表示各个通道的数据

len -

数据的长度,单位为字节

+

数据的长度,单位为sample (bytes / sizeof(sample))

@@ -675,7 +677,53 @@

&nb + + + + + + + +
+

Declared In

+

KSYAudioMixer.h

+
+ + +

+
+
- -

– addDrawLayer: -

- -
-
- -
- - -
-

添加画笔图层

-
- - - -
- (void)addDrawLayer:(UIImage *)img
- - - - - - - - - - - - - - -

Declared In

KSYGPUBrushStreamerKit.h

diff --git a/doc/html/Classes/KSYGPUStreamerKit.html b/doc/html/Classes/KSYGPUStreamerKit.html index 1908345..93cd0ea 100644 --- a/doc/html/Classes/KSYGPUStreamerKit.html +++ b/doc/html/Classes/KSYGPUStreamerKit.html @@ -66,6 +66,8 @@

+ + @@ -112,6 +114,8 @@

+ + @@ -192,6 +196,8 @@

+ + @@ -2600,7 +2606,117 @@

&nb + + + + + +
+

See Also

+ +
+ + + +
+

Declared In

+

KSYGPUStreamerKit.h

+
+ + +

+
+
+ +

  pcmProcessingCallback +

+ +
+
+ +
+ + +
+

音频处理回调接口

+
+ + + +
@property (nonatomic, copy) void ( ^ ) ( uint8_t **pData , int len , const AudioStreamBasicDescription *fmt , CMTime timeInfo ) pcmProcessingCallback
+ + + + + + + + + +
+

Discussion

+

pData len为原始采集到的音频数据

audioDataType 为KSYAudioData_RawPCM时才会被触发回调

请注意本函数的执行时间,如果太长可能导致不可预知的问题

+
+ + + + + +
+

See Also

+ +
+ + + +
+

Declared In

+

KSYGPUStreamerKit.h

+
+ + +
+
+
+ +

  audioDataType +

+ +
+
+ +
+ + +
+

音频处理通路数据类型 (默认为 KSYAudioData_CMSampleBuffer)

+
+ + + +
@property (nonatomic, assign) KSYAudioDataType audioDataType
+ + + + + + + + + +
+

Discussion

+

音频数据转为 CMSampleBuffer时有格式开销, 使用RawPCM资源消耗会少一些

内部组件对KSYAudioData_RawPCM可能不完善, 目前仅保证基本通路能工作

@@ -3073,6 +3189,59 @@

Discussion

+
+

Declared In

+

KSYGPUStreamerKit.h

+
+ + +
+
+
+ +

– setLogoOrientaion: +

+ +
+
+ +
+ + +
+

设置水印图片的朝向

+
+ + + +
- (void)setLogoOrientaion:(UIImageOrientation)orien
+ + + +
+

Parameters

+ + + + + + + +
orien

图片的朝向

+
+ + + + + + + + + + + + +

Declared In

KSYGPUStreamerKit.h

diff --git a/doc/html/Classes/KSYStreamerBase.html b/doc/html/Classes/KSYStreamerBase.html index 810480f..43f6ea1 100644 --- a/doc/html/Classes/KSYStreamerBase.html +++ b/doc/html/Classes/KSYStreamerBase.html @@ -94,6 +94,8 @@

+ + @@ -182,6 +184,8 @@

+ + @@ -2302,7 +2306,69 @@

Parameters

Discussion

-

应当在开始推流前定期调用此接口,与processVideoSampleBuffer 交错进行

Warning: 目前只支持 单通道 S16 格式的PCM数据

+

应当在开始推流前定期调用此接口,与processVideoSampleBuffer 交错进行

Warning: 目前只支持 S16 格式的PCM数据

+
+ + + + + + + +
+

Declared In

+

KSYStreamerBase.h

+
+ + +
+
+
+ +

– processAudioData:nbSample:withFormat:timeinfo: +

+ +
+
+ +
+ + +
+

处理一段音频数据

+
+ + + +
- (void)processAudioData:(uint8_t **)pData nbSample:(int)len withFormat:(const AudioStreamBasicDescription *)fmt timeinfo:(CMTime *)pts
+ + + +
+

Parameters

+ + + + + + + + + + + + + + + + + + + + + + +
pData

原始数据指针数组

len

数据的长度,单位为字节

fmt

原始数据的格式 (必须保证一次推流过程中数据格式不变)

pts

原始数据的时间戳

@@ -2311,6 +2377,12 @@

Discussion

+ + + + + +

Declared In

KSYStreamerBase.h

@@ -2412,6 +2484,53 @@

  client +
+

Declared In

+

KSYStreamerBase.h

+
+ + +

+
+
+ +

  expireDate +

+ +
+
+ +
+ + +
+

获取当前SDK过期时间

+
+ + + +
@property (nonatomic, assign) NSDate *expireDate
+ + + + + + + + + +
+

Discussion

+

为nil时,可以永久使用不会过期 +@warnning sdk自行解析得到, 外部赋值无效

+
+ + + + + + +

Declared In

KSYStreamerBase.h

diff --git a/libksygpulive.podspec b/libksygpulive.podspec index 2cd6c17..77342e5 100644 --- a/libksygpulive.podspec +++ b/libksygpulive.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'libksygpulive' - s.version = '2.6.0' + s.version = '2.6.1' s.license = { :type => 'Proprietary', :text => <<-LICENSE diff --git a/prebuilt/include/KSYPlayer/KSYNetTracker.h b/prebuilt/include/KSYPlayer/KSYNetTracker.h index a53d03b..fe8fbf5 100644 --- a/prebuilt/include/KSYPlayer/KSYNetTracker.h +++ b/prebuilt/include/KSYPlayer/KSYNetTracker.h @@ -8,9 +8,9 @@ #import -FOUNDATION_EXPORT NSString * const KSYNetTrackerOnceDoneNotification; -FOUNDATION_EXPORT NSString * const KSYNetTrackerFinishedNotification; -FOUNDATION_EXPORT NSString * const KSYNetTrackerErrorNotification; +FOUNDATION_EXPORT NSString * _Nonnull const KSYNetTrackerOnceDoneNotification; +FOUNDATION_EXPORT NSString * _Nonnull const KSYNetTrackerFinishedNotification; +FOUNDATION_EXPORT NSString * _Nonnull const KSYNetTrackerErrorNotification; /** * 探测方式 @@ -31,7 +31,7 @@ typedef NS_ENUM(NSInteger, KSY_NETTRACKER_ACTION){ @abstract 链路上每个节点的ip地址 @discussion 如果每个探测报文对应的路径不同,则每一跳上会存在多个不同ip */ -@property (nonatomic, readonly) NSMutableArray *ips; +@property (nonatomic, readonly) NSMutableArray * _Nullable ips; /** @abstract 所有探测报文的rtt最大值 @@ -122,6 +122,6 @@ typedef NS_ENUM(NSInteger, KSY_NETTRACKER_ACTION){ /** @abstract 链路状况 */ -@property (nonatomic, readonly) NSMutableArray *routerInfo; +@property (nonatomic, readonly) NSMutableArray * _Nullable routerInfo; @end diff --git a/prebuilt/include/KSYStreamer/KSYAUAudioCapture.h b/prebuilt/include/KSYStreamer/KSYAUAudioCapture.h index b20050f..44a24fe 100644 --- a/prebuilt/include/KSYStreamer/KSYAUAudioCapture.h +++ b/prebuilt/include/KSYStreamer/KSYAUAudioCapture.h @@ -98,7 +98,7 @@ typedef NS_ENUM(NSInteger, KSYAudioNoiseSuppress){ @property(nonatomic, assign) BOOL enableVoiceProcess; /** - @abstract 噪声抑制处理的等级(默认为KSYAudioNoiseSuppress_HIGH) + @abstract 噪声抑制处理的等级(默认为KSYAudioNoiseSuppress_OFF) @discussion 当启用噪声抑制处理后, 内部会进行输出音频数据的 */ @property(nonatomic, assign) KSYAudioNoiseSuppress noiseSuppressionLevel; @@ -140,9 +140,17 @@ typedef NS_ENUM(NSInteger, KSYAudioNoiseSuppress){ /** @abstract 采集数据输出回调函数 @discussion sampleBuffer 为采集到的音频数据 + @discussion 与pcmProcessingCallback两者只能二选一, 设置 audioProcessingCallback 会清空pcmProcessingCallback */ @property(nonatomic, copy) void(^audioProcessingCallback)(CMSampleBufferRef sampleBuffer); +/** + @abstract 采集数据输出回调函数 + @discussion pData 和 len 为采集数据和长度 (目前只支持单声道, 只有pData[0]为有效数据指针 ) + @discussion 与audioProcessingCallback两者只能二选一, 设置 pcmProcessingCallback 会清空audioProcessingCallback + */ +@property(nonatomic, copy) void(^pcmProcessingCallback)(uint8_t** pData, int len, const AudioStreamBasicDescription* fmt, CMTime timeInfo); + /** @abstract 用户可以自定义播放的内容,直接把数据填入ioData @discussion ioData 目前只支持int16 的单声道数据 diff --git a/prebuilt/include/KSYStreamer/KSYAudioMixer.h b/prebuilt/include/KSYStreamer/KSYAudioMixer.h index b5faba4..754b3ee 100644 --- a/prebuilt/include/KSYStreamer/KSYAudioMixer.h +++ b/prebuilt/include/KSYStreamer/KSYAudioMixer.h @@ -79,8 +79,8 @@ /** @abstract 输入音频PCM - @param pData 原始数据 - @param len 数据的长度,单位为字节 + @param pData 原始数据指针数组,单通道仅pData[0]有效 当输入为多通道且非交织时, pData[i]分别表示各个通道的数据 + @param len 数据的长度,单位为sample (bytes / sizeof(sample)) @param fmt 原始数据的格式 @param pts 原始数据的时间戳 @param trackId 设置对应track的 @@ -98,8 +98,17 @@ @discussion sampleBuffer 混音后的音频数据 @discussion 请注意本函数的执行时间,如果太长可能导致不可预知的问题 @discussion 请参考 CMSampleBufferRef + @discussion 与pcmProcessingCallback两者只能二选一, 设置 audioProcessingCallback 会清空 pcmProcessingCallback */ @property(nonatomic, copy) void(^audioProcessingCallback)(CMSampleBufferRef sampleBuffer); +/** + @abstract 音频处理回调接口 + @discussion pData 为数据指针 (双通道时, 数据为交织格式), 仅pData[0] 有效 + @discussion nbSample 为数据长度, 单位为sample (bytes / sizeof(sample)/channels) + @discussion 请注意本函数的执行时间,如果太长可能导致不可预知的问题 + @discussion 与audioProcessingCallback两者只能二选一, 设置 pcmProcessingCallback 会清空audioProcessingCallback + */ +@property(nonatomic, copy) void(^pcmProcessingCallback)(uint8_t** pData, int nbSample, CMTime pts); /** @abstract 主轨的trackId (默认为0) @@ -110,6 +119,7 @@ /** @abstract 输出音频是否为双声道立体声 (默认为NO) @discussion 如果输入数据都不是双声道则输出数据左右耳内容一样 + @discussion 输出立体声的数据格式一定是交织的 */ @property(nonatomic, assign) BOOL bStereo; @@ -124,7 +134,6 @@ @property (nonatomic, assign) int sampleRate; /** @abstract 混音后输出PCM的格式 - @discussion 暂时为固定一种格式 (44.1KHz, S16) */ @property (nonatomic, readonly) AudioStreamBasicDescription* outFmtDes; diff --git a/prebuilt/include/KSYStreamer/KSYStreamerBase.h b/prebuilt/include/KSYStreamer/KSYStreamerBase.h index fb3fa99..9d139f1 100644 --- a/prebuilt/include/KSYStreamer/KSYStreamerBase.h +++ b/prebuilt/include/KSYStreamer/KSYStreamerBase.h @@ -323,15 +323,26 @@ FOUNDATION_EXPORT NSString *const KSYNetStateEventNotification NS_AVAILABLE_IOS( timeInfo:(CMTime)timeStamp onComplete:(void (^)(BOOL))completion; - /** @abstract 处理一段音频数据 @param sampleBuffer Buffer to process @discussion 应当在开始推流前定期调用此接口,与processVideoSampleBuffer 交错进行 - @warning 目前只支持 单通道 S16 格式的PCM数据 + @warning 目前只支持 S16 格式的PCM数据 */ - (void)processAudioSampleBuffer:(CMSampleBufferRef)sampleBuffer; +/** + @abstract 处理一段音频数据 + @param pData 原始数据指针数组 + @param len 数据的长度,单位为字节 + @param fmt 原始数据的格式 (必须保证一次推流过程中数据格式不变) + @param pts 原始数据的时间戳 + */ +- (void)processAudioData:(uint8_t**)pData + nbSample:(int)len + withFormat:(const AudioStreamBasicDescription*)fmt + timeinfo:(CMTime*)pts; + /** @abstract 处理一个消息 @param message message to process @@ -347,6 +358,13 @@ FOUNDATION_EXPORT NSString *const KSYNetStateEventNotification NS_AVAILABLE_IOS( */ @property (nonatomic, assign) NSString *clientAk; +/** + @abstract 获取当前SDK过期时间 + @discussion 为nil时,可以永久使用不会过期 + @warnning sdk自行解析得到, 外部赋值无效 + */ +@property (nonatomic, assign) NSDate *expireDate; + /** @abstract 查询当前推流的事件ID @discussion md5(hostURL+timestamp) 对本次推流活动的标识 diff --git a/prebuilt/include/KSYStreamer/libksystreamerbase.h b/prebuilt/include/KSYStreamer/libksystreamerbase.h index e818d5d..0d81bfd 100644 --- a/prebuilt/include/KSYStreamer/libksystreamerbase.h +++ b/prebuilt/include/KSYStreamer/libksystreamerbase.h @@ -14,5 +14,5 @@ #import "KSYMessage.h" #import "KSYTranscoder.h" -#define KSYSTREAMERBASE_VER 2.6.0 -#define KSYSTREAMERBASE_ID 19b2aea7b764ca6fbdcea013d5db0a34c84774aa +#define KSYSTREAMERBASE_VER 2.6.1 +#define KSYSTREAMERBASE_ID a51488cc47fe3c1c43db96eb4912d5f3d2a3a340 diff --git a/releaseFramework/release-libKSYLive.sh b/releaseFramework/release-libKSYLive.sh index 304a4f5..7fce9bf 100755 --- a/releaseFramework/release-libKSYLive.sh +++ b/releaseFramework/release-libKSYLive.sh @@ -86,7 +86,7 @@ function xDownload() { ZIP_FILE=${DST_DIR}/${SUB_DIR}${FILE_NAME}.zip if [ ! -d "${DST_DIR}/${FILE_NAME}.framework" ]; then - echo "download ${FILE_NAME}.framework to ${DST_DIR}" + echo "download ${FILE_NAME}.framework(${IOS_URL}) to ${DST_DIR}" curl ${IOS_URL} -o ${ZIP_FILE} unzip -q ${ZIP_FILE} -d ${DST_DIR}/ rm ${ZIP_FILE} diff --git a/resource/KSYGPUResource.bundle/0_hongrun2.png b/resource/KSYGPUResource.bundle/0_hongrun2.png index 68b4b49..2441467 100644 Binary files a/resource/KSYGPUResource.bundle/0_hongrun2.png and b/resource/KSYGPUResource.bundle/0_hongrun2.png differ diff --git a/resource/KSYGPUResource.bundle/0_pink.png b/resource/KSYGPUResource.bundle/0_pink.png index 0646038..6514e86 100644 Binary files a/resource/KSYGPUResource.bundle/0_pink.png and b/resource/KSYGPUResource.bundle/0_pink.png differ diff --git a/resource/KSYGPUResource.bundle/13_ziran.png b/resource/KSYGPUResource.bundle/13_ziran.png index f6c01ad..a8d1b44 100644 Binary files a/resource/KSYGPUResource.bundle/13_ziran.png and b/resource/KSYGPUResource.bundle/13_ziran.png differ diff --git a/source/KSYGPUBrushStreamerKit.h b/source/KSYGPUBrushStreamerKit.h index 7a9bb3f..4b95591 100644 --- a/source/KSYGPUBrushStreamerKit.h +++ b/source/KSYGPUBrushStreamerKit.h @@ -1,8 +1,8 @@ // -// KSYGPUPipStreamerKit.h +// KSYGPUBrushStreamerKit.h // KSYStreamer // -// Created by jaingdong on 28/12/16. +// Created by jiangdong on 28/12/16. // Copyright © 2016 ksyun. All rights reserved. // #import @@ -28,12 +28,7 @@ @abstract 绘制的图片 @discussion 设置为nil为清除内容图片 */ -@property (nonatomic, readwrite) GPUImagePicture *drawPic; - -/** - @abstract 添加画笔图层 - */ -- (void) addDrawLayer:(UIImage*)img; +@property (nonatomic, readwrite) GPUImageUIElement *drawPic; /** @abstract 去掉画笔图层 diff --git a/source/KSYGPUBrushStreamerKit.m b/source/KSYGPUBrushStreamerKit.m index 6ddf19b..6622018 100644 --- a/source/KSYGPUBrushStreamerKit.m +++ b/source/KSYGPUBrushStreamerKit.m @@ -1,8 +1,8 @@ // -// KSYGPUPipStreamerKit.m +// KSYGPUBrushStreamerKit.m // KSYStreamer // -// Created by jaingdong on 28/12/16. +// Created by jiangdong on 28/12/16. // Copyright © 2016 ksyun. All rights reserved. // #import "KSYGPUBrushStreamerKit.h" @@ -28,14 +28,15 @@ - (void) setDrawPicRect:(CGRect)drawPicRect{ ofLayer:_drawLayer]; } -// 添加图层到 vMixer 中 -- (void) addDrawPic:(GPUImageOutput*)pic ToMixerAt: (NSInteger)idx{ - if (pic == nil){ +@synthesize drawPic = _drawPic; +-(void) setDrawPic:(GPUImageUIElement *)drawPic{ + _drawPic = drawPic; + if (_drawPic == nil){ + [self.vStreamMixer clearPicOfLayer:_drawLayer]; return; } - [pic removeAllTargets]; - [self.vStreamMixer clearPicOfLayer:idx]; - [pic addTarget:self.vStreamMixer atTextureLocation:idx]; + [_drawPic removeAllTargets]; + [_drawPic addTarget:self.vStreamMixer atTextureLocation:_drawLayer]; } - (void)dealloc { @@ -47,13 +48,4 @@ - (void)removeDrawLayer{ [self.vStreamMixer clearPicOfLayer:_drawLayer]; } -/** - @abstract 添加画笔图层 - */ -- (void) addDrawLayer:(UIImage*)img{ - _drawPic = [[GPUImagePicture alloc] initWithImage:img]; - [self addDrawPic:_drawPic ToMixerAt:_drawLayer]; - [_drawPic processImage]; -} - @end diff --git a/source/KSYGPUPipStreamerKit.m b/source/KSYGPUPipStreamerKit.m index 8a6dc87..ca71849 100644 --- a/source/KSYGPUPipStreamerKit.m +++ b/source/KSYGPUPipStreamerKit.m @@ -71,12 +71,13 @@ -(void) setLayerRect{ -(void)startPipWithPlayerUrl:( NSURL* _Nullable )playerUrl bgPic:( NSURL* _Nullable )bgUrl { + if (_player) { + [self stopPip]; + } + if(playerUrl) { [self.aMixer setTrack:_pipTrack enable:YES]; [self.aMixer setMixVolume:1 of:_pipTrack]; - if (_player) { - [self stopPip]; - } BOOL shouldUseHWCodec = YES; BOOL shouldAutoplay = YES; BOOL shouldMute = NO; diff --git a/source/KSYGPUStreamerKit.h b/source/KSYGPUStreamerKit.h index 53e1c16..bcbd882 100644 --- a/source/KSYGPUStreamerKit.h +++ b/source/KSYGPUStreamerKit.h @@ -403,10 +403,36 @@ FOUNDATION_EXPORT NSString *const KSYCaptureStateDidChangeNotification NS_AVAILA @discussion sampleBuffer 原始采集到的音频数据 @discussion 对sampleBuffer内的pcm数据的修改将传递到观众端 @discussion 请注意本函数的执行时间,如果太长可能导致不可预知的问题 + @discussion 当audioDataType 为KSYAudioData_CMSampleBuffer时才会被触发回调 @discussion 请参考 CMSampleBufferRef + @see audioDataType */ @property(nonatomic, copy) void(^audioProcessingCallback)(CMSampleBufferRef sampleBuffer); +/** + @abstract 音频处理回调接口 + @discussion pData len为原始采集到的音频数据 + @discussion 当audioDataType 为KSYAudioData_RawPCM时才会被触发回调 + @discussion 请注意本函数的执行时间,如果太长可能导致不可预知的问题 + @see audioDataType + */ +@property(nonatomic, copy) void(^pcmProcessingCallback)(uint8_t** pData, int len, const AudioStreamBasicDescription* fmt, CMTime timeInfo); + +/** 音频通路数据类型 */ +typedef NS_ENUM(NSInteger, KSYAudioDataType){ + /// 音频数据采用CMSampleBuffer传递 + KSYAudioData_CMSampleBuffer, + /// 音频数据直接使用原始的PCM数据指针传递 + KSYAudioData_RawPCM, +}; + +/** + @abstract 音频处理通路数据类型 (默认为 KSYAudioData_CMSampleBuffer) + @discussion 音频数据转为 CMSampleBuffer时有格式开销, 使用RawPCM资源消耗会少一些 + @discussion 内部组件对KSYAudioData_RawPCM可能不完善, 目前仅保证基本通路能工作 + */ +@property (nonatomic, assign) KSYAudioDataType audioDataType; + /** @abstract 摄像头采集被打断的消息通知 @discussion bInterrupt 为YES, 表明被打断, 摄像头采集暂停 @@ -466,6 +492,13 @@ FOUNDATION_EXPORT NSString *const KSYCaptureStateDidChangeNotification NS_AVAILA */ @property (nonatomic, readwrite) GPUImagePicture *logoPic; +/** + 设置水印图片的朝向 + + @param orien 图片的朝向 + */ +- (void) setLogoOrientaion:(UIImageOrientation) orien; + /** @abstract 文字内容的图片 @discussion 设置为nil为清除内容图片 diff --git a/source/KSYGPUStreamerKit.m b/source/KSYGPUStreamerKit.m index ddedbc2..854b35a 100644 --- a/source/KSYGPUStreamerKit.m +++ b/source/KSYGPUStreamerKit.m @@ -80,6 +80,7 @@ - (instancetype) initInterrupt:(BOOL) bInter { _interruptCallback = nil; _gpuOutputPixelFormat = kCVPixelFormatType_32BGRA; _capturePixelFormat = kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange; + _audioDataType = KSYAudioData_CMSampleBuffer; _autoRetryCnt = 0; _maxAutoRetry = 0; @@ -342,12 +343,25 @@ - (void) mixAudio:(CMSampleBufferRef)buf to:(int)idx{ - (void) setupAudioPath { weakObj(self); //1. 音频采集, 语音数据送入混音器 - _aCapDev.audioProcessingCallback = ^(CMSampleBufferRef buf){ - if ( selfWeak.audioProcessingCallback ){ - selfWeak.audioProcessingCallback(buf); - } - [selfWeak mixAudio:buf to:selfWeak.micTrack]; - }; + if (_audioDataType == KSYAudioData_CMSampleBuffer) { + _aCapDev.audioProcessingCallback = ^(CMSampleBufferRef buf){ + if ( selfWeak.audioProcessingCallback ){ + selfWeak.audioProcessingCallback(buf); + } + [selfWeak mixAudio:buf to:selfWeak.micTrack]; + }; + } + else { + _aCapDev.pcmProcessingCallback = ^(uint8_t **pData, int len, const AudioStreamBasicDescription *fmt, CMTime timeInfo) { + if ( selfWeak.pcmProcessingCallback ){ + selfWeak.pcmProcessingCallback(pData, len, fmt, timeInfo); + } + if (![selfWeak.streamerBase isStreaming]){ + return; + } + [selfWeak.aMixer processAudioData:pData nbSample:len withFormat:fmt timeinfo:timeInfo of:selfWeak.micTrack]; + }; + } //2. 背景音乐播放,音乐数据送入混音器 _bgmPlayer.audioDataBlock = ^ BOOL(uint8_t** pData, int len, const AudioStreamBasicDescription* fmt, CMTime pts){ if ([selfWeak.streamerBase isStreaming]) { @@ -360,12 +374,25 @@ - (void) setupAudioPath { return YES; }; // 混音结果送入streamer - _aMixer.audioProcessingCallback = ^(CMSampleBufferRef buf){ - if (![selfWeak.streamerBase isStreaming]){ - return; - } - [selfWeak.streamerBase processAudioSampleBuffer:buf]; - }; + if (_audioDataType == KSYAudioData_CMSampleBuffer) { + _aMixer.audioProcessingCallback = ^(CMSampleBufferRef buf){ + if (![selfWeak.streamerBase isStreaming]){ + return; + } + [selfWeak.streamerBase processAudioSampleBuffer:buf]; + }; + } + else { + _aMixer.pcmProcessingCallback = ^(uint8_t **pData, int nbSample, CMTime pts) { + if (![selfWeak.streamerBase isStreaming]){ + return; + } + [selfWeak.streamerBase processAudioData:pData + nbSample:nbSample + withFormat:selfWeak.aMixer.outFmtDes + timeinfo:&pts]; + }; + } // mixer 的主通道为麦克风,时间戳以main通道为准 _aMixer.mainTrack = _micTrack; [_aMixer setTrack:_micTrack enable:YES]; @@ -886,6 +913,22 @@ -(void) setLogoPic:(GPUImagePicture *)pic{ _logoPic = pic; [self addPic:_logoPic ToMixerAt:_logoPicLayer]; } +static GPUImageRotationMode KSYImage2GPURotate[] = { + kGPUImageNoRotation,// UIImageOrientationUp, // default orientation + kGPUImageRotate180,//UIImageOrientationDown, // 180 deg rotation + kGPUImageRotateLeft, //UIImageOrientationLeft, // 90 deg CCW + kGPUImageRotateRight,//UIImageOrientationRight, // 90 deg CW + kGPUImageFlipHorizonal,//UIImageOrientationUpMirrored, // as above but image mirrored along other axis. horizontal flip + kGPUImageFlipHorizonal,//UIImageOrientationDownMirrored, // horizontal flip + kGPUImageFlipVertical,//UIImageOrientationLeftMirrored, // vertical flip + kGPUImageRotateRightFlipVertical//UIImageOrientationRightMirrored, // vertical flip +}; +- (void) setLogoOrientaion:(UIImageOrientation) orien{ + [_vPreviewMixer setPicRotation:KSYImage2GPURotate[orien] + ofLayer:_logoPicLayer]; + [_vStreamMixer setPicRotation:KSYImage2GPURotate[orien] + ofLayer:_logoPicLayer]; +} @synthesize aePic = _aePic; -(void) setAePic:(GPUImageUIElement *)aePic{ _aePic = aePic; @@ -968,12 +1011,12 @@ - (void)setGpuOutputPixelFormat: (OSType) fmt { if ([_streamerBase isStreaming]){ return; } - if( fmt != kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange || + if( fmt != kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange && fmt != kCVPixelFormatType_420YpCbCr8Planar ){ fmt = kCVPixelFormatType_32BGRA; } _gpuOutputPixelFormat = fmt; - _gpuToStr =[[KSYGPUPicOutput alloc] initWithOutFmt:_gpuOutputPixelFormat]; + _gpuToStr =[[KSYGPUPicOutput alloc] initWithOutFmt:fmt]; [self setupVideoPath]; [self updateStrDimension:self.videoOrientation]; } @@ -1073,7 +1116,7 @@ -(void)internalRotatePreviewTo: (UIInterfaceOrientation) orie { _previewOrientation = orie; UIView* view = [_preview superview]; - if (UIInterfaceOrientationPortrait == orie || view == nil) { + if (_videoOrientation == orie || view == nil) { for (UIView *v in _vPreviewMixer.targets) { v.transform = CGAffineTransformIdentity; }