I am trying to create movie from images and I am using the code from the
following post
http://monotouch.2284126.n4.nabble.com/Create-Video-from-image-sequences-IOS-td3801785.html
When I run it, the following code
adaptor.AppendPixelBufferWithPresentationTime returns false
CVPixelBuffer buffer=pixelBufferFromCGImage(img.CGImage,size);
bool b =adaptor.AppendPixelBufferWithPresentationTime(buffer,lastTime);
and pxbuffer,ColorSpace return exception whan I call pixelBufferFromCGImage
is it a Monotouch bug or am I missing something?
static CVPixelBuffer pixelBufferFromCGImage(CGImage image,SizeF size)
{
NSObject[] keys = new NSObject[]{
CVPixelBuffer.CGImageCompatibilityKey,
CVPixelBuffer.CGBitmapContextCompatibilityKey
};
NSObject[] objects = new NSObject[]{
new NSNumber(true)
,new NSNumber(true)
};
NSDictionary
options=NSDictionary.FromObjectsAndKeys(objects,keys);
CVPixelBuffer pxbuffer=new
CVPixelBuffer((int)size.Width,(int)size.Height,CVPixelFormatType.CV32ARGB,options);
if(pxbuffer!=null)
{
pxbuffer.Lock (0);
IntPtr pxdata=pxbuffer.BaseAddress;
if(pxdata!=IntPtr.Zero)
{
//var rgbColorSpace =
CGColorSpace.CreateDeviceRGB ();
using(var rgbColorSpace =
CGColorSpace.CreateDeviceRGB())
{
using(CGBitmapContext context=
new
CGBitmapContext(pxdata,(int)size.Width,(int)size.Height,8,4*(int)size.Width,
rgbColorSpace,CGImageAlphaInfo.PremultipliedFirst)){
//rgbColorSpace,CGImageAlphaInfo.NoneSkipFirst)){
if(context != null)
{
context.DrawImage(new
RectangleF(0,0,image.Width,image.Height),image);
UIImage
Image=UIImage.FromImage(context.ToImage());
}
}
}
}
pxbuffer.Unlock(0);
}
return pxbuffer;
}
You could download the monotouch and objectiveC code from following URL.
ObjectiveC version works.
http://dl.dropbox.com/u/8088793/moviemaker.zip
--
View this message in context:
http://monotouch.2284126.n4.nabble.com/Create-a-movie-from-images-tp4658551.html
Sent from the MonoTouch mailing list archive at Nabble.com.
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch