objective c - AVCaptureSession w/o Decompression -
environment
- os-x
- yosemite
- objective-c
- compressed video input ( avcapturedeviceformat == 'muxx'/'isr ' )
use-case
compressed video stream exposed os hal capture device ( avcapturedevice ) supporting 'muxx/isr ' payload format, able directly access raw bytes of compressed payload w/o decompressing.
implementation
- find device using "+ (avcapturedevice *)devicewithuniqueid:(nsstring *)deviceuniqueid"
- create 'avcapturedeviceinput'
- create 'avcapturevideodataoutput'
- associate 'avcapturedevice' 'avcapturedeviceinput'
- setsamplebufferdelegate on 'avcapturevideodataoutput'
- create avcapturesession
- configure session adding inputs , outputs ( no preset selected )
- start session calling [session startrunning]
- upon 'avcapturevideodataoutputsamplebufferdelegate' invocation call 'cmsamplebuffergetdatabuffer(samplebuffer);' reference raw buffer
problem description
while delegate invoked system buffers refer decoded yuy2 image rather compressed buffer ( before de-muxed , de-coded ), , thus, 'cmsamplebuffergetdatabuffer' returns nil pointer.
how can raw payload sent avcapturedevice w/o decompressing?
the solution use c++ coremediaio framework, sample provided @ link, main problem coremediaio is not used , has minimal documentation, sample code provided apple old , req quite tinkering before can compile recent sdks, however, in end, works, this blog entry has nice example.
Comments
Post a Comment