2013-03-12 122 views
1

我正在研究一个应用程序,该应用程序从前置摄像头捕获实时视频流并将其发送到远端(使用RTP)。 本质上,数据流是:AVCaptureSession - > AVCaptureVideoDataOutput - >回调 - > RTP - >在远端显示旋转iphone视频数据

当我使用横向模式时,远端的图像是颠倒的。在肖像模式下,它向左旋转。

如何在以下回调中旋转像素缓冲区,以便远程端的图像具有正确的方向?欣赏任何指针。

void)captureOutput:(AVCaptureOutput *)captureOutput 
didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer 
     fromConnection:(AVCaptureConnection *)connection 
+0

我面对完全相同的问题,你还没有找到解决方案吗? – thomketler 2013-03-14 13:32:43

+0

没有。尚无解决方案。 – 2013-03-15 09:42:33

回答

0

那么到现在,我能得到一半的溶液:

- (void) willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation) toInterfaceOrientation duration:(NSTimeInterval)duration 
{ 

    switch (toInterfaceOrientation) 
    { 
     case UIInterfaceOrientationLandscapeRight: 
      [[[self imageView] layer] setAffineTransform:CGAffineTransformMakeRotation(0)]; 
      break; 
     case UIInterfaceOrientationLandscapeLeft: 
      [[[self imageView] layer] setAffineTransform:CGAffineTransformMakeRotation(M_PI)]; 
      break; 
//  case UIInterfaceOrientationPortrait: 
//   [[[self imageView] layer] setAffineTransform:CGAffineTransformMakeRotation(M_PI/2)]; 
//   break; 
//  case UIInterfaceOrientationPortraitUpsideDown: 
//   [[[self imageView] layer] setAffineTransform:CGAffineTransformMakeRotation(-M_PI/2)]; 
//   break; 
    } 
} 

我改写了willAnimitateRotation功能,但这只是为景观-取向工作正常(我设计的ViewController在风景模式下)。