获取相机回调数据
@Override
public void onPreviewFrame(byte[] data, Camera camera) {
}
将视频数据转化为bitmap
public Bitmap nv21ToBitmap(byte[] nv21, int width, int height){
if (yuvType == null){
yuvType = new Type.Builder(renderScript, Element.U8(renderScript)).setX(nv21.length);
in = Allocation.createTyped(renderScript, yuvType.create(), Allocation.USAGE_SCRIPT);
rgbaType = new Type.Builder(renderScript, Element.RGBA_8888(renderScript)).setX(width).setY(height);
out = Allocation.createTyped(renderScript, rgbaType.create(), Allocation.USAGE_SCRIPT);
}
in.copyFrom(nv21);
yuvToRgbIntrinsic.setInput(in);
yuvToRgbIntrinsic.