Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright (C) 2013-2015 RoboVM AB
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bugvm.apple.corevideo;
/**/
import java.io.*;
import java.nio.*;
import java.util.*;
import com.bugvm.objc.*;
import com.bugvm.objc.annotation.*;
import com.bugvm.objc.block.*;
import com.bugvm.rt.*;
import com.bugvm.rt.annotation.*;
import com.bugvm.rt.bro.*;
import com.bugvm.rt.bro.annotation.*;
import com.bugvm.rt.bro.ptr.*;
import com.bugvm.apple.foundation.*;
import com.bugvm.apple.corefoundation.*;
import com.bugvm.apple.coregraphics.*;
import com.bugvm.apple.opengles.*;
import com.bugvm.apple.metal.*;
/**/
/**/
/**/
/**/@Library("CoreVideo")/**/
/**/public/**/ class /**/CVPixelBuffer/**/
extends /**/CVImageBuffer/**/
/**//**/ {
/**/public static class CVPixelBufferPtr extends Ptr {}/**/
public interface ReleaseBytesCallback {
void release(VoidPtr baseAddress);
}
public interface ReleasePlanarBytesCallback {
void release(VoidPtr dataPtr, @MachineSizedUInt long dataSize, @MachineSizedUInt long numberOfPlanes, VoidPtr planeAddresses);
}
private static java.util.concurrent.atomic.AtomicLong refconId = new java.util.concurrent.atomic.AtomicLong();
private long localRefconId;
private static LongMap releaseBytesCallbacks = new LongMap<>();
private static LongMap releasePlanarBytesCallbacks = new LongMap<>();
private static final java.lang.reflect.Method cbReleaseBytes;
private static final java.lang.reflect.Method cbReleasePlanarBytes;
static {
try {
cbReleaseBytes = CVPixelBuffer.class.getDeclaredMethod("cbReleaseBytes", long.class, VoidPtr.class);
cbReleasePlanarBytes = CVPixelBuffer.class.getDeclaredMethod("cbReleasePlanarBytes", long.class, VoidPtr.class, long.class, long.class, VoidPtr.class);
} catch (Throwable e) {
throw new Error(e);
}
}
/**/static { Bro.bind(CVPixelBuffer.class); }/**/
/**//**/
/**//**/
/**//**/
/**//**/
@Callback
private static void cbReleaseBytes(long refcon, VoidPtr baseAddress) {
ReleaseBytesCallback callback = null;
synchronized (releaseBytesCallbacks) {
callback = releaseBytesCallbacks.get(refcon);
}
callback.release(baseAddress);
}
@Callback
private static void cbReleasePlanarBytes(long refcon, VoidPtr dataPtr, @MachineSizedUInt long dataSize, @MachineSizedUInt long numberOfPlanes, VoidPtr planeAddresses) {
ReleasePlanarBytesCallback callback = null;
synchronized (releasePlanarBytesCallbacks) {
callback = releasePlanarBytesCallbacks.get(refcon);
}
callback.release(dataPtr, dataSize, numberOfPlanes, planeAddresses);
}
public static CVPixelBufferAttributes createResolvedAttributesDictionary(List attributes) {
return createResolvedAttributesDictionary(null, attributes);
}
public static CVPixelBufferAttributes createResolvedAttributesDictionary(CFAllocator allocator, List attributes) {
CFDictionary.CFDictionaryPtr ptr = new CFDictionary.CFDictionaryPtr();
createResolvedAttributesDictionary(allocator, attributes, ptr);
return new CVPixelBufferAttributes(ptr.get());
}
public static CVPixelBuffer create(long width, long height, CVPixelFormatType pixelFormatType, CVPixelBufferAttributes pixelBufferAttributes) {
return create(null, width, height, pixelFormatType, pixelBufferAttributes);
}
public static CVPixelBuffer create(CFAllocator allocator, long width, long height, CVPixelFormatType pixelFormatType, CVPixelBufferAttributes pixelBufferAttributes) {
long refconId = CVPixelBuffer.refconId.getAndIncrement();
CVPixelBufferPtr ptr = new CVPixelBufferPtr();
CVReturn err = create(allocator, width, height, pixelFormatType, pixelBufferAttributes, ptr);
if (err == CVReturn.Success) {
CVPixelBuffer buffer = ptr.get();
buffer.localRefconId = refconId;
return buffer;
}
return null;
}
public static CVPixelBuffer create(long width, long height, CVPixelFormatType pixelFormatType, VoidPtr baseAddress, long bytesPerRow, ReleaseBytesCallback releaseCallback, CVPixelBufferAttributes pixelBufferAttributes) {
return create(null, width, height, pixelFormatType, baseAddress, bytesPerRow, releaseCallback, pixelBufferAttributes);
}
public static CVPixelBuffer create(CFAllocator allocator, long width, long height, CVPixelFormatType pixelFormatType, VoidPtr baseAddress, long bytesPerRow, ReleaseBytesCallback releaseCallback, CVPixelBufferAttributes pixelBufferAttributes) {
long refconId = CVPixelBuffer.refconId.getAndIncrement();
CVPixelBufferPtr ptr = new CVPixelBufferPtr();
CVReturn err = create(allocator, width, height, pixelFormatType, baseAddress, bytesPerRow, new FunctionPtr(cbReleaseBytes), refconId, pixelBufferAttributes, ptr);
if (err == CVReturn.Success) {
CVPixelBuffer buffer = ptr.get();
buffer.localRefconId = refconId;
synchronized (releaseBytesCallbacks) {
releaseBytesCallbacks.put(refconId, releaseCallback);
}
return buffer;
}
return null;
}
public long[] getExtendedPixels() {
MachineSizedUIntPtr left = new MachineSizedUIntPtr();
MachineSizedUIntPtr right = new MachineSizedUIntPtr();
MachineSizedUIntPtr top = new MachineSizedUIntPtr();
MachineSizedUIntPtr bottom = new MachineSizedUIntPtr();
getExtendedPixels(left, right, top, bottom);
return new long[] {left.get(), right.get(), top.get(), bottom.get()};
}
/**/
/**
* @since Available in iOS 4.0 and later.
*/
@Bridge(symbol="CVPixelBufferGetTypeID", optional=true)
public static native @MachineSizedUInt long getClassTypeID();
/**
* @since Available in iOS 4.0 and later.
*/
@Bridge(symbol="CVPixelBufferCreateResolvedAttributesDictionary", optional=true)
private static native CVReturn createResolvedAttributesDictionary(CFAllocator allocator, @com.bugvm.rt.bro.annotation.Marshaler(CVPixelBufferAttributes.AsListMarshaler.class) List attributes, CFDictionary.CFDictionaryPtr resolvedDictionaryOut);
/**
* @since Available in iOS 4.0 and later.
*/
@Bridge(symbol="CVPixelBufferCreate", optional=true)
protected static native CVReturn create(CFAllocator allocator, @MachineSizedUInt long width, @MachineSizedUInt long height, CVPixelFormatType pixelFormatType, CVPixelBufferAttributes pixelBufferAttributes, CVPixelBuffer.CVPixelBufferPtr pixelBufferOut);
/**
* @since Available in iOS 4.0 and later.
*/
@Bridge(symbol="CVPixelBufferCreateWithBytes", optional=true)
protected static native CVReturn create(CFAllocator allocator, @MachineSizedUInt long width, @MachineSizedUInt long height, CVPixelFormatType pixelFormatType, VoidPtr baseAddress, @MachineSizedUInt long bytesPerRow, FunctionPtr releaseCallback, @Pointer long releaseRefCon, CVPixelBufferAttributes pixelBufferAttributes, CVPixelBuffer.CVPixelBufferPtr pixelBufferOut);
/**
* @since Available in iOS 4.0 and later.
*/
@Bridge(symbol="CVPixelBufferCreateWithPlanarBytes", optional=true)
protected static native CVReturn create(CFAllocator allocator, @MachineSizedUInt long width, @MachineSizedUInt long height, CVPixelFormatType pixelFormatType, VoidPtr dataPtr, @MachineSizedUInt long dataSize, @MachineSizedUInt long numberOfPlanes, VoidPtr.VoidPtrPtr planeBaseAddress, MachineSizedUIntPtr planeWidth, MachineSizedUIntPtr planeHeight, MachineSizedUIntPtr planeBytesPerRow, FunctionPtr releaseCallback, VoidPtr releaseRefCon, CVPixelBufferAttributes pixelBufferAttributes, CVPixelBuffer.CVPixelBufferPtr pixelBufferOut);
/**
* @since Available in iOS 4.0 and later.
*/
@Bridge(symbol="CVPixelBufferLockBaseAddress", optional=true)
public native CVReturn lockBaseAddress(CVPixelBufferLockFlags lockFlags);
/**
* @since Available in iOS 4.0 and later.
*/
@Bridge(symbol="CVPixelBufferUnlockBaseAddress", optional=true)
public native CVReturn unlockBaseAddress(CVPixelBufferLockFlags unlockFlags);
/**
* @since Available in iOS 4.0 and later.
*/
@Bridge(symbol="CVPixelBufferGetWidth", optional=true)
public native @MachineSizedUInt long getWidth();
/**
* @since Available in iOS 4.0 and later.
*/
@Bridge(symbol="CVPixelBufferGetHeight", optional=true)
public native @MachineSizedUInt long getHeight();
/**
* @since Available in iOS 4.0 and later.
*/
@Bridge(symbol="CVPixelBufferGetPixelFormatType", optional=true)
public native CVPixelFormatType getPixelFormatType();
/**
* @since Available in iOS 4.0 and later.
*/
@Bridge(symbol="CVPixelBufferGetBaseAddress", optional=true)
public native VoidPtr getBaseAddress();
/**
* @since Available in iOS 4.0 and later.
*/
@Bridge(symbol="CVPixelBufferGetBytesPerRow", optional=true)
public native @MachineSizedUInt long getBytesPerRow();
/**
* @since Available in iOS 4.0 and later.
*/
@Bridge(symbol="CVPixelBufferGetDataSize", optional=true)
public native @MachineSizedUInt long getDataSize();
/**
* @since Available in iOS 4.0 and later.
*/
@Bridge(symbol="CVPixelBufferIsPlanar", optional=true)
public native boolean isPlanar();
/**
* @since Available in iOS 4.0 and later.
*/
@Bridge(symbol="CVPixelBufferGetPlaneCount", optional=true)
public native @MachineSizedUInt long getPlaneCount();
/**
* @since Available in iOS 4.0 and later.
*/
@Bridge(symbol="CVPixelBufferGetWidthOfPlane", optional=true)
public native @MachineSizedUInt long getWidthOfPlane(@MachineSizedUInt long planeIndex);
/**
* @since Available in iOS 4.0 and later.
*/
@Bridge(symbol="CVPixelBufferGetHeightOfPlane", optional=true)
public native @MachineSizedUInt long getHeightOfPlane(@MachineSizedUInt long planeIndex);
/**
* @since Available in iOS 4.0 and later.
*/
@Bridge(symbol="CVPixelBufferGetBaseAddressOfPlane", optional=true)
public native VoidPtr getBaseAddressOfPlane(@MachineSizedUInt long planeIndex);
/**
* @since Available in iOS 4.0 and later.
*/
@Bridge(symbol="CVPixelBufferGetBytesPerRowOfPlane", optional=true)
public native @MachineSizedUInt long getBytesPerRowOfPlane(@MachineSizedUInt long planeIndex);
/**
* @since Available in iOS 4.0 and later.
*/
@Bridge(symbol="CVPixelBufferGetExtendedPixels", optional=true)
protected native void getExtendedPixels(MachineSizedUIntPtr extraColumnsOnLeft, MachineSizedUIntPtr extraColumnsOnRight, MachineSizedUIntPtr extraRowsOnTop, MachineSizedUIntPtr extraRowsOnBottom);
/**
* @since Available in iOS 4.0 and later.
*/
@Bridge(symbol="CVPixelBufferFillExtendedPixels", optional=true)
public native CVReturn fillExtendedPixels();
/**/
}