1

フロントカメラからライブビデオストリームをキャプチャしてリモートエンドに送信するアプリケーションに取り組んでいます (RTP を使用)。基本的にデータ フローは次のとおりです。 AVCaptureSession -> AVCaptureVideoDataOutput -> コールバック -> RTP -> リモート エンドでの表示

ランドスケープ モードを使用すると、リモート エンドの画像が上下逆になります。縦向きモードでは、左に回転します。

リモート エンドの画像が正しい向きになるように、次のコールバックでピクセル バッファを回転するにはどうすればよいですか? ポインタに感謝します。

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

1 に答える 1

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;
    }
}

willAnimateRotation 関数を上書きしましたが、これは Landscape-Orientations に対してのみ適切に機能します (ViewController を Landscape-Mode で設計しました)。

于 2013-03-19T15:46:32.157 に答える