From 633e76c1d533c3d9c257b92df7ebdfd36c9fd8a0 Mon Sep 17 00:00:00 2001 From: houxiao <houxiao@454eff88-639b-444f-9e54-f578c98de674> Date: 星期四, 29 十二月 2016 18:42:50 +0800 Subject: [PATCH] unify log --- RtspFace/main.cpp | 71 ++++++++++++++++++++--------------- 1 files changed, 41 insertions(+), 30 deletions(-) diff --git a/RtspFace/main.cpp b/RtspFace/main.cpp index ef672a1..2e9ae59 100644 --- a/RtspFace/main.cpp +++ b/RtspFace/main.cpp @@ -7,11 +7,14 @@ #include "PL_AVFrameBGRA.h" #include "PL_Queue.h" -#include <iostream> -using namespace std; +#include "PL_SensetimeFaceDetect.h" + +#include "logger.h" int main(int argc, char** argv) { + initLogger(2); + PipeLine pipeLine; pipeLine.register_elem_creator("PL_RTSPClient", create_PL_RTSPClient); @@ -20,6 +23,8 @@ pipeLine.register_elem_creator("PL_AVFrameYUV420", create_PL_AVFrameYUV420); pipeLine.register_elem_creator("PL_H264Encoder", create_PL_H264Encoder); pipeLine.register_elem_creator("PL_Queue", create_PL_Queue); + + pipeLine.register_elem_creator("PL_SensetimeFaceDetect", create_PL_SensetimeFaceDetect); { PL_RTSPClient* rtspClient = (PL_RTSPClient*)pipeLine.push_elem("PL_RTSPClient"); @@ -33,30 +38,36 @@ bool ret = rtspClient->init(&rtspConfig); if (!ret) { - cout << "rtspClient.init error" << endl; + LOG(ERROR) << "rtspClient.init error"; exit(EXIT_FAILURE); } } - - //{ - // PL_Queue_Config config; - // PL_Queue* queue1 = (PL_Queue*)pipeLine.push_elem("PL_Queue"); - // bool ret = queue1->init(&config); - // if (!ret) - // { - // cout << "queue1.init error" << endl; - // exit(EXIT_FAILURE); - // } - //} - + { PL_H264Decoder* h264Decoder = (PL_H264Decoder*)pipeLine.push_elem("PL_H264Decoder"); h264Decoder->init(nullptr); } - //{ - // PL_AVFrameYUV420* avFrameYUV420 = (PL_AVFrameYUV420*)pipeLine.push_elem("PL_AVFrameYUV420"); - // avFrameYUV420->init(nullptr); + { + PL_AVFrameYUV420* avFrameYUV420 = (PL_AVFrameYUV420*)pipeLine.push_elem("PL_AVFrameYUV420"); + avFrameYUV420->init(nullptr); + } + + { + SensetimeFaceDetectConfig config; + PL_SensetimeFaceDetect* stFaceDetect = (PL_SensetimeFaceDetect*)pipeLine.push_elem("PL_SensetimeFaceDetect"); + stFaceDetect->init(&config); + } + + //{//#todo queue should support deep copy + // PL_Queue_Config config; + // PL_Queue* queue1 = (PL_Queue*)pipeLine.push_elem("PL_Queue"); + // bool ret = queue1->init(&config); + // if (!ret) + // { + // LOG(ERROR) << "queue1.init error"; + // exit(EXIT_FAILURE); + // } //} { @@ -64,21 +75,21 @@ h264Encoder->init(nullptr); } - //{ - // RTSPServerConfig config; - // PL_RTSPServer* rtspServer = (PL_RTSPServer*)pipeLine.push_elem("PL_RTSPServer"); - // bool ret = rtspServer->init(&config); - // if (!ret) - // { - // cout << "rtspServer.init error" << endl; - // exit(EXIT_FAILURE); - // } - //} + { + RTSPServerConfig config; + PL_RTSPServer* rtspServer = (PL_RTSPServer*)pipeLine.push_elem("PL_RTSPServer"); + bool ret = rtspServer->init(&config); + if (!ret) + { + LOG(ERROR) << "rtspServer.init error"; + exit(EXIT_FAILURE); + } + } while(true) { - //cout << "begin pipe" << endl; + //LOG(ERROR) << "begin pipe"; pipeLine.pipe(); - //cout << "end pipe" << endl; + //LOG(ERROR) << "end pipe"; } } -- Gitblit v1.8.0