From ec544e9cc330ce40aeb78e96aa362e245feecd4d Mon Sep 17 00:00:00 2001
From: xuxiuxi <xuxiuxi@454eff88-639b-444f-9e54-f578c98de674>
Date: 星期五, 21 七月 2017 15:03:34 +0800
Subject: [PATCH] 

---
 VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/fragment/SurveillanceFragment.java |   40 ++++++++++++++++++++++++++++------------
 1 files changed, 28 insertions(+), 12 deletions(-)

diff --git a/VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/fragment/SurveillanceFragment.java b/VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/fragment/SurveillanceFragment.java
index 7fb2382..3c5a531 100644
--- a/VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/fragment/SurveillanceFragment.java
+++ b/VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/fragment/SurveillanceFragment.java
@@ -11,6 +11,7 @@
 import android.view.SurfaceHolder;
 import android.view.SurfaceView;
 import android.view.View;
+import android.widget.LinearLayout;
 import android.widget.ProgressBar;
 import android.widget.RadioButton;
 import android.widget.RadioGroup;
@@ -69,6 +70,9 @@
     private RelativeLayout fragment_supervisory_exit_camera_relative_layout;
     @ViewInject(R.id.fragment_supervisory_enter_camera_relative_layout)
     private RelativeLayout fragment_supervisory_enter_camera_relative_layout;
+    @ViewInject(R.id.fragment_surveillance_bottom_linear_layout)
+    private LinearLayout fragment_surveillance_bottom_linear_layout;
+
 
     static boolean useNative = false;
 
@@ -93,6 +97,9 @@
             useNative = false;
         }
         //useNative = false;
+        if (CommonVariables.EMULATOR) {
+            useNative = false;
+        }
         if (useNative) {
             System.loadLibrary("cvface_api");
             System.loadLibrary("opencv_java3");
@@ -142,6 +149,7 @@
             }
 //            outputStream.writeBytes("busybox ifconfig wlan0 hw ether  00:e0:2c:31:1a:ba\n");
             RtspFaceNative.setLocalIP(ipAddress);
+            System.out.println("ipaddr="+ipAddress);
         }
     }
 
@@ -169,15 +177,16 @@
         if (CommonVariables.FACE_SERVER) {
             fragment_supervisory_enter_camera_relative_layout.addView(MainActivity.getInstance().mPreview);
             fragment_supervisory_enter_camera_relative_layout.addView(MainActivity.getInstance().mDraw);
-
+            //fragment_supervisory_exit_camera_relative_layout.setVisibility(View.GONE);
+            //fragment_surveillance_bottom_linear_layout.setVisibility(View.GONE);
         }
         fragment_supervisory_enter_camera.getHolder().addCallback(new SurfaceHolder.Callback() {
             public void surfaceCreated(SurfaceHolder holder) {
-                if (useNative) {
-                    RtspFaceNative.setSurface(Integer.parseInt(CommonVariables.Camera.IN), fragment_supervisory_enter_camera.getHolder().getSurface());
-                    RtspFaceNative.createPlayer(Integer.parseInt(CommonVariables.Camera.IN), DeviceMng.getInstance().getCamera1Address());
-                    RtspFaceNative.setFaceCallback(Integer.parseInt(CommonVariables.Camera.IN), "cn/com/basic/face/util/RtspFaceNative", "faceCallBack");
-                }
+//                if (useNative) {
+//                    RtspFaceNative.setSurface(Integer.parseInt(CommonVariables.Camera.IN), fragment_supervisory_enter_camera.getHolder().getSurface());
+//                    RtspFaceNative.createPlayer(Integer.parseInt(CommonVariables.Camera.IN), DeviceMng.getInstance().getCamera1Address());
+//                    RtspFaceNative.setFaceCallback(Integer.parseInt(CommonVariables.Camera.IN), "cn/com/basic/face/util/RtspFaceNative", "faceCallBack");
+//                }
             }
 
             public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {}
@@ -187,14 +196,21 @@
         });
         fragment_supervisory_exit_camera.getHolder().addCallback(new SurfaceHolder.Callback() {
             public void surfaceCreated(SurfaceHolder holder) {
-                if (useNative) {
-                    RtspFaceNative.setSurface(Integer.parseInt(CommonVariables.Camera.OUT), fragment_supervisory_exit_camera.getHolder().getSurface());
-                    RtspFaceNative.createPlayer(Integer.parseInt(CommonVariables.Camera.OUT), DeviceMng.getInstance().getCamera2Address());
-                    RtspFaceNative.setFaceCallback(Integer.parseInt(CommonVariables.Camera.OUT), "cn/com/basic/face/util/RtspFaceNative", "faceCallBack");
-                }
+//                if (useNative) {
+//                    RtspFaceNative.setSurface(Integer.parseInt(CommonVariables.Camera.OUT), fragment_supervisory_exit_camera.getHolder().getSurface());
+//                    RtspFaceNative.createPlayer(Integer.parseInt(CommonVariables.Camera.OUT), DeviceMng.getInstance().getCamera2Address());
+//                    RtspFaceNative.setFaceCallback(Integer.parseInt(CommonVariables.Camera.OUT), "cn/com/basic/face/util/RtspFaceNative", "faceCallBack");
+//                }
             }
 
-            public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {}
+            public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
+                System.out.print("width="+width+",height="+height);
+                if (useNative) {
+                    RtspFaceNative.setSurface(Integer.parseInt(CommonVariables.Camera.IN), fragment_supervisory_enter_camera.getHolder().getSurface());
+                    RtspFaceNative.createPlayer(Integer.parseInt(CommonVariables.Camera.IN), DeviceMng.getInstance().getCamera1Address());
+                    RtspFaceNative.setFaceCallback(Integer.parseInt(CommonVariables.Camera.IN), "cn/com/basic/face/util/RtspFaceNative", "faceCallBack");
+                }
+            }
             public void surfaceDestroyed(SurfaceHolder holder) {
                 System.out.println("surfaceDestroyed");
             }

--
Gitblit v1.8.0