I am working on H263 decompression with VideoToolBox.but when decoding 4CIF video stream, the output pixel data are all 0 value, and there is no error info.
I don't know why this happened, as video stream with CIF resolution is decompressed correctly.
Is any one has the same problem?
this is a piece of my code:
CMFormatDescriptionRef newFmtDesc = nil;
OSStatus status = CMVideoFormatDescriptionCreate(kCFAllocatorDefault,
kCMVideoCodecType_H263,
width,
height,
NULL,
&_videoFormatDescription);
if (status)
{
return -1;
}
CFMutableDictionaryRef dpba = CFDictionaryCreateMutable(kCFAllocatorDefault,
2,
&kCFTypeDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks);
CFDictionarySetValue(dpba,
kCVPixelBufferOpenGLCompatibilityKey,
kCFBooleanFalse);
VTDictionarySetInt32(dpba,
kCVPixelBufferPixelFormatTypeKey,
kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange); // use NV12
VTDictionarySetInt32(dpba,
kCVPixelBufferWidthKey,
dimension.width);
VTDictionarySetInt32(dpba,
kCVPixelBufferHeightKey,
dimension.height);
VTDictionarySetInt32(dpba,
kCVPixelBufferBytesPerRowAlignmentKey,
dimension.width);// setup decoder callback record
VTDecompressionOutputCallbackRecord decoderCallbackRecord;
decoderCallbackRecord.decompressionOutputCallback = onDecodeCallback;
decoderCallbackRecord.decompressionOutputRefCon = this;// create decompression session
status = VTDecompressionSessionCreate(kCFAllocatorDefault,
_videoFormatDescription,
nil,
dpba,
&decoderCallbackRecord,
&_session);
// Do Decode
CMSampleBufferRef sampleBuffer;
sampleBuffer = VTSampleBufferCreate(_videoFormatDescription, (void*)data_start, data_len, ts);
VTDecodeFrameFlags flags = 0;
VTDecodeInfoFlags flagOut = 0;
OSStatus decodeStatus = VTDecompressionSessionDecodeFrame(_session,
sampleBuffer,
flags,
nil,
&flagOut);
I tried compressing H263 with VideoToolBox, I int the session with resolution of 4CIF, and push 4CIF NV12 image to the compression session, but the output of H263 stream is in CIF resolution!
Is VideoToolBox can't support 4CIF H263 Video on both compression and decompression?