Bug 16169 - [CoreMedia] CMBlockBuffer missing Methods
Summary: [CoreMedia] CMBlockBuffer missing Methods
Status: RESOLVED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: 7.0.4.x
Hardware: PC Mac OS
: --- enhancement
Target Milestone: Untriaged
Assignee: Alex Soto [MSFT]
URL:
Depends on:
Blocks:
 
Reported: 2013-11-12 21:19 UTC by Valentin Polushkin
Modified: 2015-04-28 23:14 UTC (History)
6 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Valentin Polushkin 2013-11-12 21:19:49 UTC
Reference: https://developer.apple.com/library/Mac/DOCUMENTATION/CoreMedia/Reference/CMBlockBuffer/Reference/reference.html

Methods missing:
CMBlockBufferFillDataBytes
CMBlockBufferCreateWithMemoryBlock

Customer's email:

"I am trying to create a CMBlockBuffer from some raw audio bytes which I then want to use to make a CMSampleBuffer using
CMSampleBuffer.CreateWithPacketDescriptions(...)

In the Apple iOS docs I can find the functions 'CMBufferFillDataBytes' and 'CMBlockBufferCreateWithMemoryBlock'

Either of which I think should work for what I am trying to do - create a CMBuffer from some audio bytes."
Comment 1 Rolf Bjarne Kvinge [MSFT] 2015-04-16 04:49:25 UTC
Alex, can you have a look at this? It looks pretty self-contained, and apparently it's useful for the VideoToolbox bindings: https://forums.xamarin.com/discussion/comment/116804/#Comment_116804

Note that there seem to be a bunch of CMBlockBuffer API missing, not just the two reported here [1]:

CMBlockBufferAccessDataBytes
CMBlockBufferAppendBufferReference
CMBlockBufferAppendMemoryBlock
CMBlockBufferAssureBlockMemory
CMBlockBufferCreateContiguous
CMBlockBufferCreateWithBufferReference
CMBlockBufferCreateWithMemoryBlock
CMBlockBufferFillDataBytes
CMBlockBufferGetDataLength
CMBlockBufferGetDataPointer
CMBlockBufferGetTypeID
CMBlockBufferIsEmpty
CMBlockBufferIsRangeContiguous
CMBlockBufferReplaceDataBytes

so it might make sense to go through the whole class and bind what makes sense (there are probably methods in that list that we shouldn't bind too).

[1] https://developer.apple.com/library/prerelease/ios/documentation/CoreMedia/Reference/CMBlockBuffer/index.html#//apple_ref/c/func/CMBlockBufferAccessDataBytes
Comment 2 RogerH 2015-04-16 05:54:02 UTC
To add to the bug report, the ability to create a CMBlockBuffer is needed when using AVSampleBufferDisplayLayer too.

This API needs a CMSampleBuffer which in turn needs a CMBlockBuffer.


There is an overview of where CMBlockBuffer come in to H264 decompression here
http://stackoverflow.com.80bola.com/questions/26601776/error-code-8969-12909-while-decoding-h264-in-ios-8-with-video-tool-box





For General Info...
Over on Xamarin.Android I use the MediaCodec class with a SurfaceView to do hardware decompression when I have my own byte[] of NALs
I've got a XamarinForms Custom Render class which wraps it all into a nice XF application.
Comment 4 Alex Soto [MSFT] 2015-04-27 23:59:03 UTC
Fixed in maccore/master 3a22d3455004799bfe9ea367c4ac73e06d4becbf 
@QA: added tests in the same commit
Comment 5 Wes Reid 2015-04-28 21:08:39 UTC
Thanks for this Alex! 
Just to clarify - when is this expected to be in any release (alpha or otherwise)?

I'm on the latest alpha channel update and do not see any of these methods:
CMBlockBufferAccessDataBytes
CMBlockBufferAppendBufferReference
CMBlockBufferAppendMemoryBlock
CMBlockBufferAssureBlockMemory
CMBlockBufferCreateContiguous
CMBlockBufferCreateWithBufferReference
CMBlockBufferCreateWithMemoryBlock
CMBlockBufferFillDataBytes
CMBlockBufferGetDataLength
CMBlockBufferGetDataPointer
CMBlockBufferGetTypeID
CMBlockBufferIsEmpty
CMBlockBufferIsRangeContiguous
CMBlockBufferReplaceDataBytes
Comment 6 Alex Soto [MSFT] 2015-04-28 23:14:03 UTC
Hello

This should be included in Xamarin.iOS 8.12, I do not have a hard date on when this is going to hit alpha or stable but it should happen soon.

Alex