houxiao
2017-01-06 d4109b2cef809daba0f95f244029456613383f01
RtspFace/main.cpp
@@ -7,6 +7,7 @@
#include "PL_AVFrameBGRA.h"
#include "PL_Queue.h"
#include "PL_Scale.h"
#include "PL_Fork.h"
#include "PL_SensetimeFaceTrack.h"
@@ -20,13 +21,14 @@
   PipeLine pipeLine;
   
   pipeLine.register_elem_creator("PL_RTSPClient", create_PL_RTSPClient);
   pipeLine.register_elem_creator("PL_RTSPServer", create_PL_RTSPServer);
   pipeLine.register_elem_creator("PL_H264Decoder", create_PL_H264Decoder);
   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_Scale", create_PL_Scale);
   PipeLine::register_global_elem_creator("PL_RTSPClient", create_PL_RTSPClient);
   PipeLine::register_global_elem_creator("PL_RTSPServer", create_PL_RTSPServer);
   PipeLine::register_global_elem_creator("PL_H264Decoder", create_PL_H264Decoder);
   PipeLine::register_global_elem_creator("PL_AVFrameYUV420", create_PL_AVFrameYUV420);
   PipeLine::register_global_elem_creator("PL_H264Encoder", create_PL_H264Encoder);
   PipeLine::register_global_elem_creator("PL_Queue", create_PL_Queue);
   PipeLine::register_global_elem_creator("PL_Scale", create_PL_Scale);
   PipeLine::register_global_elem_creator("PL_Fork", create_PL_Scale);
   
   pipeLine.register_elem_creator("PL_SensetimeFaceTrack", create_PL_SensetimeFaceTrack);
   
@@ -73,8 +75,8 @@
      PL_Scale_Config config;
      config.toWidth = 800;
      config.toHeight = 600;
      PL_Scale* pl = (PL_Scale*)pipeLine.push_elem("PL_Scale");
      bool ret = pl->init(&config);
      PL_Scale* ple = (PL_Scale*)pipeLine.push_elem("PL_Scale");
      bool ret = ple->init(&config);
      if (!ret)
      {
         LOG_ERROR << "PL_Scale.init error";
@@ -82,19 +84,34 @@
      }
   }
   {
      SensetimeFaceTrackConfig config;
      //config.generate_face_feature = true;
      PL_SensetimeFaceTrack* ple = (PL_SensetimeFaceTrack*)pipeLine.push_elem("PL_SensetimeFaceTrack");
      ple->init(&config);
   }
   //PipeLine pipeLine2;
   //{
   //   SensetimeFaceTrackConfig config;
   //   PL_SensetimeFaceTrack* pl = (PL_SensetimeFaceTrack*)pipeLine.push_elem("PL_SensetimeFaceTrack");
   //   pl->init(&config);
   //   PL_Fork_Config config;
   //   config.forkBy = PL_Fork::FB_MB_TYPE;
   //   config.forkSync = PL_Fork::FS_PARALLEL;
   //   PL_Fork* ple = (PL_Fork*)pipeLine.push_elem("PL_Fork");
   //   ple->init(&config);
   //   ple->attach_pipe_line(&pipeLine2);
   //
   //   {
   //      //pipeLine2.push_elem();
   //   }
   //}
   
   {
      PL_DlibFaceTrack_Config config;
      config.pyramid_down_layers = 2;
      config.pyramid_down_n = 1;
      PL_DlibFaceTrack* pl = (PL_DlibFaceTrack*)pipeLine.push_elem("PL_DlibFaceTrack");
      pl->init(&config);
   }
   //{
   //   PL_DlibFaceTrack_Config config;
   //   config.pyramid_down_layers = 2;
   //   config.pyramid_down_n = 1;
   //   PL_DlibFaceTrack* ple = (PL_DlibFaceTrack*)pipeLine.push_elem("PL_DlibFaceTrack");
   //   ple->init(&config);
   //}
   //{//#todo queue should support deep copy
   //   PL_Queue_Config config;
@@ -108,8 +125,9 @@
   //}
   {
      PL_H264Encoder_Config config;
      PL_H264Encoder* h264Encoder = (PL_H264Encoder*)pipeLine.push_elem("PL_H264Encoder");
      bool ret = h264Encoder->init(nullptr);
      bool ret = h264Encoder->init(&config);
      if (!ret)
      {
         LOG_ERROR << "PL_H264Encoder.init error";