| | |
| | | #include <PL_ColorConv.h>
|
| | | #include <PL_AndroidMediaCodecEncoder.h>
|
| | | #include <PL_RTSPServer2.h>
|
| | | #include <iostream>
|
| | |
|
| | | CameraWrapper::~CameraWrapper()
|
| | | {
|
| | | stop();
|
| | |
| | | // return false;
|
| | | //}
|
| | |
|
| | | // PL_Paint_Config plPaintCfg;
|
| | | // plPaintCfg.fontPath = fontPath;
|
| | | // plPaintCfg.plplCtx = &plplContext;
|
| | | // PL_Paint* plPaint = (PL_Paint*)pipeLineRender->push_elem("PL_Paint");
|
| | | // ret = plPaint->init(&plPaintCfg);
|
| | | // if (!ret)
|
| | | // {
|
| | | // LOG_ERROR << "pipeLineRender.plPaint init error" << LOG_ENDL;
|
| | | // return false;
|
| | | // }
|
| | | PL_Paint_Config plPaintCfg;
|
| | | plPaintCfg.fontPath = fontPath;
|
| | | plPaintCfg.plplCtx = &plplContext;
|
| | | PL_Paint* plPaint = (PL_Paint*)pipeLineRender->push_elem("PL_Paint");
|
| | | ret = plPaint->init(&plPaintCfg);
|
| | | if (!ret)
|
| | | {
|
| | | LOG_ERROR << "pipeLineRender.plPaint init error" << LOG_ENDL;
|
| | | return false;
|
| | | }
|
| | |
|
| | | //PL_AndroidSurfaceViewRender* asvRender = (PL_AndroidSurfaceViewRender*)pipeLineRender->push_elem("PL_AndroidSurfaceViewRender");
|
| | | //ret = asvRender->init(&asvrConfig);
|
| | |
| | | //}
|
| | |
|
| | | PL_AndroidMediaCodecEncoder_Config amceCfg;
|
| | | amceCfg.ak_bit_rate = 5000000; // 512KB
|
| | | amceCfg.ak_bit_rate = 512 * 1024 * 8; // 512KB
|
| | | amceCfg.ak_color_format = 21; // COLOR_FormatYUV420SemiPlanar;
|
| | | amceCfg.ak_frame_rate = 20;
|
| | | amceCfg.ak_frame_rate = 40;
|
| | | amceCfg.ak_height = 480;
|
| | | amceCfg.ak_i_frame_interval = 10;
|
| | | amceCfg.ak_i_frame_interval = 1;
|
| | | amceCfg.ak_mime = "video/avc";
|
| | | amceCfg.ak_width = 640;
|
| | | amceCfg.codecProfileLevel.profile = Android_CodecProfileLevel::AVCProfileBaseline;
|
| | | amceCfg.codecProfileLevel.level = Android_CodecProfileLevel::AVCLevel1;
|
| | | PL_AndroidMediaCodecEncoder* plAMCE = (PL_AndroidMediaCodecEncoder*)pipeLineRender->push_elem("PL_AndroidMediaCodecEncoder");
|
| | | ret = plAMCE->init(&amceCfg);
|
| | | if (!ret)
|
| | |
| | |
|
| | | PL_RTSPServer2* plRtspServer = (PL_RTSPServer2*)pipeLineRender->push_elem("PL_RTSPServer2");
|
| | | RTSPServer2Config rtspServerConfig;
|
| | | //rtspServerConfig.syncDeliverFrame = false;
|
| | | //rtspServerConfig.payBlockFullQueue = true;
|
| | | ret = plRtspServer->init(&rtspServerConfig);
|
| | | if (!ret)
|
| | | {
|
| | |
| | |
|
| | | bool cw_pm_breaker_ptr_face(const PipeMaterial* pm, void* args)
|
| | | {
|
| | | CameraWrapper& cameraWrapper = *(CameraWrapper*)args;
|
| | | if (cameraWrapper.faceCacheLocked)
|
| | | return false;
|
| | |
|
| | | int faceCount = cameraWrapper.faceCache.getFaceCount(*pm);
|
| | | if (faceCount <= 0 || cameraWrapper.faceCallbackFunc == 0)
|
| | | return false;
|
| | | cameraWrapper.faceCache.cachePm(*pm);
|
| | | //remote call start, 为了保证通用性,未将以下步骤封入RtspFaceDetectClient
|
| | | //#todo 优化封装
|
| | | try
|
| | | {
|
| | | LOG_INFO <<"try start"<< LOG_ENDL;
|
| | |
|
| | | // RtspFaceDetect::Client* rClient = getRtspFaceDetectClient()->getClient();
|
| | | // auto& waitScope = getRtspFaceDetectClient()->getWaitScope();
|
| | |
|
| | | RtspFaceDetectClient* client = getRtspFaceDetectClient();
|
| | | RtspFaceDetect::Client rClient = client->getEzRpcClient()->getMain<RtspFaceDetect>();
|
| | | auto& waitScope = client->getWaitScope();
|
| | |
|
| | | auto request = rClient.fireFaceCountListenerRequest();
|
| | | request.setCameraIndex(cameraWrapper.cameraIdx);
|
| | | request.setFaceCount(cameraWrapper.faceCache.getFaceCount(*pm));
|
| | | LOG_INFO <<cameraWrapper.cameraIdx << "+" << cameraWrapper.faceCache.getFaceCount(*pm)<< LOG_ENDL;
|
| | | LOG_INFO <<"call client : i have face!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"<< LOG_ENDL;
|
| | | auto sendAct = request.send();
|
| | | sendAct.ignoreResult().wait(waitScope);
|
| | | }
|
| | | catch (const kj::Exception& e)
|
| | | {
|
| | | LOG_INFO <<"catch!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"<< LOG_ENDL;
|
| | | LOG_ERROR << "catch!!!" <<e.getDescription().cStr() << LOG_ENDL;
|
| | | std::cout << e.getDescription().cStr() << std::endl;
|
| | | return false;
|
| | | }
|
| | | catch (std::exception e){
|
| | | LOG_ERROR << "catch!!!" <<e.what() << LOG_ENDL;
|
| | | }
|
| | | //remote call end
|
| | | return true;
|
| | | }
|
| | |
|
| | | void test_paint(CameraWrapper& cameraWrapper)
|