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 | 56 +++++++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 45 insertions(+), 11 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 8b3a744..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,9 +11,11 @@ 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; +import android.widget.RelativeLayout; import android.widget.TextView; import com.bsk.zhangbo.demoforbsk.R; @@ -64,6 +66,13 @@ private TextView fragment_surveillance_enter_timer; @ViewInject(R.id.fragment_surveillance_exit_timer) private TextView fragment_surveillance_exit_timer; + @ViewInject(R.id.fragment_supervisory_exit_camera_relative_layout) + 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; @@ -84,7 +93,13 @@ } else { useNative = true; } + if (CommonVariables.FACE_SERVER) { + useNative = false; + } //useNative = false; + if (CommonVariables.EMULATOR) { + useNative = false; + } if (useNative) { System.loadLibrary("cvface_api"); System.loadLibrary("opencv_java3"); @@ -124,11 +139,17 @@ //outputStream.writeBytes("exit\n"); //outputStream.flush(); //su.waitFor(); + /* + busybox ifconfig wlan0 hw ether AC:83:F3:42:19:CE + + + */ }catch(Exception e){ e.printStackTrace(); } // outputStream.writeBytes("busybox ifconfig wlan0 hw ether 00:e0:2c:31:1a:ba\n"); RtspFaceNative.setLocalIP(ipAddress); + System.out.println("ipaddr="+ipAddress); } } @@ -153,13 +174,19 @@ @Override protected void initViews(View view, Bundle savedInstanceState) { + 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) {} @@ -169,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