Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Swift VTCompressionSession的输出回调未运行_Swift_Compression_H.264_Video Toolbox - Fatal编程技术网

Swift VTCompressionSession的输出回调未运行

Swift VTCompressionSession的输出回调未运行,swift,compression,h.264,video-toolbox,Swift,Compression,H.264,Video Toolbox,我一直在使用VideoToolBox对视频数据进行编码,但我无法获得运行我正在运行的VTCompressionSession的回调 下面是我如何声明VTCompressionSession VTCompressionSessionCreate(allocator: nil, width: 1080, height: 1920, codecType: kCMVideoCodecType_H264, encoderSpecification: nil, imageBufferAttributes:

我一直在使用VideoToolBox对视频数据进行编码,但我无法获得运行我正在运行的
VTCompressionSession
的回调

下面是我如何声明
VTCompressionSession

VTCompressionSessionCreate(allocator: nil,
width: 1080, height: 1920,
codecType: kCMVideoCodecType_H264,
encoderSpecification: nil, imageBufferAttributes: nil,
compressedDataAllocator: nil,
outputCallback: compressionOutputCallback as? VTCompressionOutputCallback, refcon: nil,
compressionSessionOut: sessionOut)
这是我的输出回调

func compressionOutputCallback(
        outputCallbackRefCon:UnsafeMutableRawPointer?,
        sourceFrameRefCon:UnsafeMutableRawPointer?,
        status:OSStatus,
        infoFlags:VTEncodeInfoFlags,
        sampleBuffer:CMSampleBuffer) {

        //Do stuff with CMSampleBuffer


        if status != noErr{
            NSLog("SBC: Error encoding video", status)

            print("SBC: Error encoding video", status)

            return

        }

        print("SBC: compressionOutputCallback dataBuffer", status)

    }
但是日志显示回调没有运行,即使我为
VTCompressionSession
指定了回调

我对Swift一般来说是新手,特别是对VideoToolBox,所以非常感谢大家在这方面的帮助