0

FireWire 入力からキャプチャする Quartz Composer 用のカスタム パッチを作成しようとしています。デバイスを開いて、入力を正常に追加できます。QTKitのドキュメントに従って、オーディオ入力も無効にします。私の問題は、出力を追加していることだと思います(ただし、エラーなしで追加されます)。フレームが実行されるたびに、imageBuffer が空のように見えるとクラッシュします。寸法も何もありません。ドキュメントの標準の captureOutput:didOutputVideoFrame:withSampleBuffer:fromConnection を使用しています。

   [mCaptureDecompressedVideoOutput release];
    mCaptureDecompressedVideoOutput = [[QTCaptureDecompressedVideoOutput alloc] init];
    NSLog(@"allocated mCaptureDecompressedVideoOutput");
    [mCaptureDecompressedVideoOutput setPixelBufferAttributes:
     [NSDictionary dictionaryWithObjectsAndKeys:
      [NSNumber numberWithBool:YES], kCVPixelBufferOpenGLCompatibilityKey,
      [NSNumber numberWithLong:k32ARGBPixelFormat], kCVPixelBufferPixelFormatTypeKey, nil]];


    [mCaptureDecompressedVideoOutput setDelegate:self];
    success = [mCaptureSession addOutput:mCaptureDecompressedVideoOutput error:&error];

    if (!success) {
        NSLog(@"Failed to add output");
            self.outputImage = nil; 
        if (mCaptureSession) {
            [mCaptureSession release];
            mCaptureSession= nil;
        }
        if (mCaptureDeviceInput) {
            [mCaptureDeviceInput release];
            mCaptureDeviceInput= nil;
        }
        if (mCaptureDecompressedVideoOutput) {
            [mCaptureDecompressedVideoOutput release];
            mCaptureDecompressedVideoOutput= nil;
        }
        return YES;
    }

    [mCaptureSession startRunning]; 
        _currentDevice= self.inputDevice;
    }

    CVImageBufferRef imageBuffer = CVBufferRetain(mCurrentImageBuffer);

if (imageBuffer) {
    CVPixelBufferLockBaseAddress(imageBuffer, 0);
    NSLog(@"ColorSpace: %@", CVImageBufferGetColorSpace(imageBuffer));

    id provider= [context outputImageProviderFromBufferWithPixelFormat:QCPlugInPixelFormatARGB8           
                                                            pixelsWide:CVPixelBufferGetWidth(imageBuffer)
                                                            pixelsHigh:CVPixelBufferGetHeight(imageBuffer)
                                                           baseAddress:CVPixelBufferGetBaseAddress(imageBuffer)
                                                           bytesPerRow:CVPixelBufferGetBytesPerRow(imageBuffer)
                                                       releaseCallback:_BufferReleaseCallback
                                                        releaseContext:imageBuffer
                                                            colorSpace:CVImageBufferGetColorSpace(imageBuffer)
                                                      shouldColorMatch:YES];

私は何が間違っているのでしょうか?このコードは、ビデオのみの入力には適していますが、FireWire (多重化) 入力には適していません。

4

1 に答える 1

0

mCaptureDecompressedVideoOutput から kCVPixelBufferOpenGLCompatibilityKey を削除することで、このパッチを Video 入力と Muxed 入力の両方で動作させることができました。これにより、パッチは Quartz Composer 内で完全に機能しますが、OpenGL サポートを必要としないように見える CamTwist 内で使用されるコンポジションでこのパッチを実行することを意図しています。現在、以前はビデオ入力で動作していたところに、ウィザー ビデオまたは多重化された入力で黒い画面が表示されるだけです。そこで、CVImageBufferRef を OpenGL テクスチャに変換して、それが機能するかどうかを確認します。

outputImageProviderFromTextureWithPixelFormat:pixelsWide:pixelsHigh:name:flipped:releaseCallback:releaseContext:colorSpace:shouldColorMatch
于 2011-11-19T15:02:52.027 に答える