| | |
| | | package cn.com.basic.face.util;
|
| | |
|
| | | import android.graphics.Canvas;
|
| | | import android.graphics.drawable.Drawable;
|
| | | import android.util.Log;
|
| | | import android.view.Surface;
|
| | | import android.view.SurfaceHolder;
|
| | | import android.widget.ImageButton;
|
| | | import android.graphics.Bitmap;
|
| | | import android.widget.ImageView;
|
| | |
|
| | | import com.example.nativecodec.NativeCodec;
|
| | |
|
| | | import java.nio.ByteBuffer;
|
| | |
|
| | | import java.util.ArrayList;
|
| | |
|
| | | /**
|
| | |
| | | public byte[][] arr2;
|
| | | }
|
| | |
|
| | | class NativeImg
|
| | | {
|
| | | public int size;
|
| | | public int type;
|
| | | public int width;
|
| | | public int height;
|
| | | public byte[] image;
|
| | | }
|
| | |
|
| | |
|
| | | public class RtspFaceNative {
|
| | |
|
| | |
| | |
|
| | | public static native void init();
|
| | | public static native void setLocalIP(String ipaddr);
|
| | | public static native void setSurface(int cameraIdx, Surface surface);
|
| | | public static native void setSurface(int cameraIdx, Surface surfaceRender);
|
| | | public static native boolean createPlayer(int cameraIdx, String uri);
|
| | | public static native void shutdown(int cameraIdx);
|
| | | // typedef void (* Java_com_example_nativecodec_NativeCodec_FaceCallback_func)(int cameraIdx, int count);
|
| | | public static native boolean setFaceCallback(int cameraIdx, String className, String funcName);
|
| | | public static native void lockFace(int cameraIdx);
|
| | | public static native void releaseFace(int cameraIdx);
|
| | | public static native int getFaceList(int cameraIdx, RefByteArray faceListPb);
|
| | | public static native int getFaceList(int cameraIdx, int dbId, RefByteArray faceListPb);
|
| | | //public static native ArrayList<NativeImgIdx> getFaceImages(int cameraIdx, RefByteArray faceImages);
|
| | | public static native ArrayList<NativeImg> getFaceImages(int cameraIdx);
|
| | |
|
| | | public static native void dbgFaceAdd(NativeImg faceImage);
|
| | | public static native String dbgGetLog();
|
| | | public static native void dbgSetStfaceLicense(String lic);
|
| | |
|
| | | //public static native void dbgReadTexture();
|
| | |
|
| | | public static native void setCaptureSurface(Surface surfaceCapture);
|
| | | public static native void startCapturePlayer(String uri);
|
| | | public static native void stopCapturePlayer();
|
| | | public static native ArrayList<NativeImg> getCaptureImages();
|
| | |
|
| | | public static int COMPANY_ID = 1001;
|
| | |
|
| | | public static void faceCallBack(int cameraIdx, int count)
|
| | | {
|
| | |
| | | lockFace(cameraIdx);
|
| | |
|
| | | RefByteArray faceListPb = new RefByteArray();
|
| | | int s = getFaceList(cameraIdx, faceListPb);
|
| | | int s = getFaceList(cameraIdx, COMPANY_ID, faceListPb);
|
| | | Log.i("@@@", "RtspFaceNative.faceCallBack, getFaceList, cameraIdx=" + cameraIdx + ", size=" + s);
|
| | |
|
| | | //RefByteArray faceImages = new RefByteArray();
|
| | |
| | | ", h=" + faceImages.get(i).height +
|
| | | ", image[0]=" + faceImages.get(i).image[0] +
|
| | | ", image[1]=" + faceImages.get(i).image[1]);
|
| | |
|
| | | if (i == 0)
|
| | | {
|
| | | //Bitmap bitmap = Bitmap.createBitmap(faceImages.get(i).width, faceImages.get(i).height, Bitmap.Config.RGB_565);
|
| | | //ByteBuffer byteBuffer = ByteBuffer.wrap(faceImages.get(i).image, 0, faceImages.get(i).size);
|
| | | //bitmap.copyPixelsFromBuffer(byteBuffer);
|
| | | //NativeCodec.setFaceDrawable(bitmap);
|
| | |
|
| | | NativeCodec.setFaceDrawable(faceImages.get(i));
|
| | | }
|
| | | }
|
| | |
|
| | | releaseFace(cameraIdx);
|