houxiao
2017-07-04 ad80ce23000b88857d0c012ec7809b1303f47e5c
VisitFace/RtspNativeCodec/app/src/main/cpp/RtspNativeCodecJNI.cpp
@@ -1,5 +1,6 @@
#include "RtspNativeCodecJNI.h"
#include "CameraWrapper.h"
#include "CaptureCamera.h"
#include <logger.h>
#include <Logger/src/logger.hpp>
@@ -27,6 +28,8 @@
static std::string g_stface_license_str;
CameraWrapper g_CameraWrappers[CAMERA_COUNT];
CaptureCamera g_CaptureCamera;
extern "C"
{
@@ -242,7 +245,7 @@
        }
        else if (cameraWrapper.rtspConfig.rtspURL.find("/h264_2") != std::string::npos)
        {
            w=640;h=480;
            w=800;h=600;
        }
        else if (cameraWrapper.rtspConfig.rtspURL.find("/h264") != std::string::npos)
        {
@@ -446,7 +449,7 @@
    evpHeader->size = sizeof(EVPHeader) + sizeof(FDP_FaceDetectPB) + buffSize;
    buffSize = evpHeader->size;
    FDP_FaceDetectPB* fdpFaceDetectPB = new (buffer + sizeof(EVPHeader)) FDP_FaceDetectPB(dbId);
    FDP_FaceDetectPB* fdpFaceDetectPB = new (buffer + sizeof(EVPHeader)) FDP_FaceDetectPB(dbId, cameraIdx + 1);
    evpHeader->hton();
    fdpFaceDetectPB->hton();
@@ -649,4 +652,42 @@
    //LOG_ERROR << g_stface_license_str << LOG_ERROR;
}
void Java_cn_com_basic_face_util_RtspFaceNative_setCaptureSurface(JNIEnv *env, jclass clazz, jobject surfaceCapture)
{
    if (g_CaptureCamera.windowRender != nullptr)
    {
        ANativeWindow_release((ANativeWindow*)(g_CaptureCamera.windowRender));
        g_CaptureCamera.windowRender = NULL;
    }
    g_CaptureCamera.windowRender = ANativeWindow_fromSurface(env, surfaceCapture);
}
bool Java_cn_com_basic_face_util_RtspFaceNative_startCapturePlayer(JNIEnv *env, jclass clazz, jstring uri)
{
    std::string _uri;
    {
        const char *utfFunc = env->GetStringUTFChars(uri, NULL);
        _uri = utfFunc;
        env->ReleaseStringUTFChars(uri, utfFunc);
    }
    if (_uri.empty())
        return false;
    if (g_CaptureCamera.windowRender == nullptr)
        return false;
    g_CaptureCamera.cameraUri = _uri;
    return g_CaptureCamera.start();
}
void Java_cn_com_basic_face_util_RtspFaceNative_stopCapturePlayer(JNIEnv *env, jclass clazz)
{
}
jobject Java_cn_com_basic_face_util_RtspFaceNative_getCaptureImages(JNIEnv* env, jclass clazz)
{
}
}