houxiao
2017-04-18 fa4bbbf0b448dad155a05f0d3cc27fb118ba6053
VisitFace/RtspNativeCodec/app/src/main/java/com/example/nativecodec/NativeCodec.java
@@ -17,7 +17,7 @@
package com.example.nativecodec;
import android.app.Activity;
import android.content.res.AssetManager;
import android.graphics.PixelFormat;
import android.graphics.SurfaceTexture;
import android.os.Bundle;
import android.util.Log;
@@ -33,9 +33,7 @@
import android.widget.RadioButton;
import android.widget.Spinner;
import com.bsk.zhangbo.demoforbsk.util.RtspFaceNative;
import java.io.IOException;
import cn.com.basic.face.util.RtspFaceNative;
public class NativeCodec extends Activity {
    static final String TAG = "NativeCodec";
@@ -54,6 +52,8 @@
    boolean mCreated = false;
    boolean mIsPlaying = false;
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle icicle) {
@@ -61,6 +61,7 @@
        setContentView(R.layout.main);
        RtspFaceNative.init();
        RtspFaceNative.setLocalIP("192.168.1.10");
        mGLView1 = (MyGLSurfaceView) findViewById(R.id.glsurfaceview1);
@@ -193,12 +194,15 @@
                        //mCreated = createStreamingMediaPlayer(getResources().getAssets(), mSourceString);
                        //#todo ok
                        mCreated = RtspFaceNative.createPlayer(1, "rtsp://admin:admin12345@192.168.1.70:554/h264/ch1/main/av_stream");
                        mCreated = RtspFaceNative.createPlayer(2, "rtsp://admin:admin12345@192.168.1.70:554/h264/ch1/main/av_stream");
                        //mCreated = RtspFaceNative.createPlayer(2, "rtsp://admin:admin12345@192.168.1.70:554/h264/ch1/sub/av_stream");
                        //mCreated = createPlayer(1, "rtsp://192.168.1.56:8554");
                        byte[] arr = new byte[5];
                        arr[0] = 3; arr[1] = 4; arr[2] = 5;
                        RtspFaceNative.getFaceList(1, arr);
                        RtspFaceNative.setFaceCallback(1, "cn/com/basic/face/util/RtspFaceNative", "faceCallBack");
                        //RtspFaceNative.setFaceCallback(2, "cn/com/basic/face/util/RtspFaceNative", "faceCallBack");
                        //byte[] arr = new byte[5];
                        //arr[0] = 3; arr[1] = 4; arr[2] = 5;
                        //RtspFaceNative.getFaceList(1, arr);
                    }
                }
@@ -307,6 +311,7 @@
    /** Load jni .so on initialization */
    static {
        System.loadLibrary("rtspface");
        System.loadLibrary("opencv_java3");
    }
    // VideoSink abstracts out the difference between Surface and SurfaceTexture
@@ -335,6 +340,7 @@
        void useAsSinkForNative() {
            Surface s = mSurfaceHolder.getSurface();
            Log.i("@@@", "setting surface " + s);
            //mSurfaceHolder1.setFormat(PixelFormat.RGBA_8888);
            RtspFaceNative.setSurface(1, s);
        }
@@ -356,6 +362,7 @@
        void useAsSinkForNative() {
            SurfaceTexture st = mMyGLSurfaceView.getSurfaceTexture();
            Surface s = new Surface(st);
            //setEGLConfigChooser(8, 8, 8, 8, 0, 0);
            RtspFaceNative.setSurface(2, s);
            s.release();
        }