首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用FireWire的QTCaptureDecompressedVideoOutput

使用FireWire的QTCaptureDecompressedVideoOutput
EN

Stack Overflow用户
提问于 2011-11-17 12:09:50
回答 1查看 413关注 0票数 0

我正在尝试为Quartz Composer创建一个从FireWire输入捕获的自定义补丁。我可以打开设备并成功添加输入。我甚至根据QTKit文档禁用了音频输入。我怀疑我的问题要么是添加输出(尽管它添加时没有错误)。每次框架运行时,当imageBuffer显示为空时,它就会崩溃。它没有尺寸或任何东西。我使用的是文档中的标准captureOutput:didOutputVideoFrame:withSampleBuffer:fromConnection。

代码语言:javascript
复制
   [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 (多路复用)输入。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-11-19 23:02:52

通过从mCaptureDecompressedVideoOutput中删除kCVPixelBufferOpenGLCompatibilityKey,我设法让这个补丁同时支持视频和多路复用输入。虽然这使得补丁可以在Quartz Composer中完美地工作,但我的目的是在CamTwist内部使用的组合中运行这个补丁,它似乎不需要OpenGL支持。现在,它只显示一个黑屏,带有wither或Muxed输入,就像它以前使用视频输入一样。因此,我要将我的CVImageBufferRef转换为OpenGL纹理,看看是否可以使用它

代码语言:javascript
复制
outputImageProviderFromTextureWithPixelFormat:pixelsWide:pixelsHigh:name:flipped:releaseCallback:releaseContext:colorSpace:shouldColorMatch
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/8162003

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档