| | |
| | | package cn.com.basic.face.fragment; |
| | | |
| | | import android.os.Build; |
| | | import android.os.Bundle; |
| | | import android.view.SurfaceView; |
| | | import android.view.View; |
| | |
| | | |
| | | static boolean useNative = true; |
| | | |
| | | public static boolean isEmulator() { |
| | | return Build.FINGERPRINT.startsWith("generic") |
| | | || Build.FINGERPRINT.startsWith("unknown") |
| | | || Build.MODEL.contains("google_sdk") |
| | | || Build.MODEL.contains("Emulator") |
| | | || Build.MODEL.contains("Android SDK built for x86") |
| | | || Build.MANUFACTURER.contains("Genymotion") |
| | | || (Build.BRAND.startsWith("generic") && Build.DEVICE.startsWith("generic")) |
| | | || "google_sdk".equals(Build.PRODUCT); |
| | | } |
| | | |
| | | static { |
| | | if (isEmulator()) { |
| | | useNative = false; |
| | | } else { |
| | | useNative = true; |
| | | } |
| | | if (useNative) { |
| | | System.loadLibrary("cvface_api"); |
| | | System.loadLibrary("opencv_java3"); |
| | |
| | | System.loadLibrary("protoc"); |
| | | System.loadLibrary("rtspface"); |
| | | RtspFaceNative.init(); |
| | | RtspFaceNative.setLocalIP("192.168.1.10"); |
| | | // RtspFaceNative.setLocalIP("192.168.1.10"); |
| | | RtspFaceNative.setLocalIP("192.168.1.106");//自己手机ip |
| | | } |
| | | } |
| | | |
| | |
| | | if (useNative) { |
| | | MainActivity.getInstance().runOnUiThread(new Runnable() { |
| | | public void run() { |
| | | RtspFaceNative.setSurface(1, fragment_supervisory_enter_camera.getHolder().getSurface()); |
| | | // RtspFaceNative.setSurface(1, fragment_supervisory_enter_camera.getHolder().getSurface()); |
| | | RtspFaceNative.setSurface(2, fragment_supervisory_exit_camera.getHolder().getSurface()); |
| | | RtspFaceNative.createPlayer(1, "rtsp://admin:admin12345@192.168.1.70:554/h264/ch1/sub/av_stream"); |
| | | // RtspFaceNative.createPlayer(1, "rtsp://admin:admin12345@192.168.1.70:554/h264/ch1/sub/av_stream"); |
| | | RtspFaceNative.createPlayer(2, "rtsp://admin:a1234567@192.168.1.68:554/h264/ch1/sub/av_stream"); |
| | | RtspFaceNative.setFaceCallback(1, "cn/com/basic/face/util/RtspFaceNative", "faceCallBack"); |
| | | // RtspFaceNative.setFaceCallback(1, "cn/com/basic/face/util/RtspFaceNative", "faceCallBack"); |
| | | RtspFaceNative.setFaceCallback(2, "cn/com/basic/face/util/RtspFaceNative", "faceCallBack"); |
| | | } |
| | | }); |