ios - Buffer size of CMSampleBufferRef -
i trying size of cmsamplebufferref avfoundation call-back
- (void)captureoutput:(avcaptureoutput *)captureoutput didoutputsamplebuffer:(cmsamplebufferref)samplebuffer fromconnection:(avcaptureconnection *)connection
according documentation https://developer.apple.com/library/mac/documentation/coremedia/reference/cmsamplebuffer/index.html#//apple_ref/c/func/cmsamplebuffergetsamplesize
size_t cmsamplebuffergettotalsamplesize ( cmsamplebufferref sbuf );
if understand correctly, should use method buffer size. got 0 return. , said "if there no sample sizes in cmsamplebuffer, size of 0 returned." in case, wonder if avfoundation framework not provide buffer size information or mis-understand document.
a follow question: way, wonder in case if use
cvpixelbufferref pixelbuffer = cmsamplebuffergetimagebuffer(samplebuffer);
from pixelbuffer size of samplebuffer?
how create avcapturesession?
basically cmsamplebuffer can contain multiple information.
- raw image buffer (which can extract using cmsamplebuffergetimagebuffer)
- audio buffer (which have extract using cmsamplebuffergetblockbuffer)
- corevideo encoded image data buffer (also have extract using cmsamplebuffergetblockbuffer)
so should first check if captureoutput
wanted, , if , expect image, should image cvpixelbufferref
check data size on image using cvpixelbuffergetdatasize
Comments
Post a Comment