From 22fe3eb94f8e65ebad5d55b12c371a0b69bfc04a Mon Sep 17 00:00:00 2001 From: houxiao <houxiao@454eff88-639b-444f-9e54-f578c98de674> Date: 星期五, 12 五月 2017 10:18:12 +0800 Subject: [PATCH] add release --- VisitFace/RtspNativeCodec/app/src/main/cpp/native-codec-jni.cpp | 76 +++++++++++++++++++++++--------------- 1 files changed, 46 insertions(+), 30 deletions(-) diff --git a/VisitFace/RtspNativeCodec/app/src/main/cpp/native-codec-jni.cpp b/VisitFace/RtspNativeCodec/app/src/main/cpp/native-codec-jni.cpp index 971fc03..91764dc 100644 --- a/VisitFace/RtspNativeCodec/app/src/main/cpp/native-codec-jni.cpp +++ b/VisitFace/RtspNativeCodec/app/src/main/cpp/native-codec-jni.cpp @@ -51,7 +51,7 @@ #define LOGV(...) __android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, __VA_ARGS__) #define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__) -// for native window JNI +// for native windowRender JNI #include <android/native_window_jni.h> #include <android/asset_manager.h> #include <android/asset_manager_jni.h> @@ -307,7 +307,6 @@ live_daemon_running = false; } - extern "C" { jboolean Java_com_example_nativecodec_NativeCodec_createStreamingMediaPlayer_rtsp(JNIEnv* env, @@ -442,24 +441,54 @@ } // set the playing state for the streaming media player -void Java_com_example_nativecodec_NativeCodec_setPlayingStreamingMediaPlayer(JNIEnv* env, - jclass clazz, jboolean isPlaying) +//void Java_com_example_nativecodec_NativeCodec_setPlayingStreamingMediaPlayer(JNIEnv* env, +// jclass clazz, jboolean isPlaying) +//{ +// LOGV("@@@ playpause: %d", isPlaying); +// if (mlooper) { +// if (isPlaying) { +// mlooper->post(kMsgResume, &data); +// } else { +// mlooper->post(kMsgPause, &data); +// } +// } +//} + + +// rewind the streaming media player +//void Java_RtspNativeCodec_rewindStreamingMediaPlayer(JNIEnv *env, jclass clazz) +//{ +// LOGV("@@@ rewind"); +// if (mlooper) { +// mlooper->post(kMsgSeek, &data); +// } +//} + +// set the surface +void Java_RtspNativeCodec_setSurface(JNIEnv *env, jclass clazz, jint cameraIdx, jobject surface) { - LOGV("@@@ playpause: %d", isPlaying); - if (mlooper) { - if (isPlaying) { - mlooper->post(kMsgResume, &data); - } else { - mlooper->post(kMsgPause, &data); - } + LOGV("@@@ Java_RtspNativeCodec_setSurface"); + + // obtain a native windowRender from a Java surface + if (data.window) { + ANativeWindow_release(data.window); + data.window = NULL; } + data.window = ANativeWindow_fromSurface(env, surface); + LOGV("@@@ setsurface %p", data.window); } +jboolean Java_RtspNativeCodec_createPlayer(JNIEnv* env, jclass clazz, jobject assetMgr, jint cameraIdx, jstring uri) +{ + LOGV("@@@ Java_RtspNativeCodec_createPlayer"); + + return JNI_TRUE; +} // shut down the native media system -void Java_com_example_nativecodec_NativeCodec_shutdown(JNIEnv* env, jclass clazz) +void Java_RtspNativeCodec_shutdown(JNIEnv* env, jclass clazz, jint cameraIdx) { - LOGV("@@@ shutdown"); + LOGV("@@@ Java_RtspNativeCodec_shutdown"); if (mlooper) { mlooper->post(kMsgDecodeDone, &data, true /* flush */); mlooper->quit(); @@ -472,27 +501,14 @@ } } - -// set the surface -void Java_com_example_nativecodec_NativeCodec_setSurface(JNIEnv *env, jclass clazz, jobject surface) +jboolean Java_RtspNativeCodec_setFaceCallback(JNIEnv* env, jclass clazz, jobject assetMgr, jint cameraIdx, jstring func) { - // obtain a native window from a Java surface - if (data.window) { - ANativeWindow_release(data.window); - data.window = NULL; - } - data.window = ANativeWindow_fromSurface(env, surface); - LOGV("@@@ setsurface %p", data.window); + return JNI_TRUE; } - -// rewind the streaming media player -void Java_com_example_nativecodec_NativeCodec_rewindStreamingMediaPlayer(JNIEnv *env, jclass clazz) +jboolean Java_RtspNativeCodec_getFaceList(JNIEnv* env, jclass clazz, jobject assetMgr, jint cameraIdx, jobjectRefType faceList) { - LOGV("@@@ rewind"); - if (mlooper) { - mlooper->post(kMsgSeek, &data); - } + return JNI_TRUE; } } -- Gitblit v1.8.0