2013-03-12 112 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在風景模式下)。