From a88698ced8bcd58f0f1918b10380bc66b0bfcbbc Mon Sep 17 00:00:00 2001
From: houxiao <houxiao@454eff88-639b-444f-9e54-f578c98de674>
Date: 星期五, 30 十二月 2016 18:32:15 +0800
Subject: [PATCH] add pl_scale pl_fork

---
 RtspFace/main.cpp |   86 +++++++++++++++++++++++++++++++-----------
 1 files changed, 63 insertions(+), 23 deletions(-)

diff --git a/RtspFace/main.cpp b/RtspFace/main.cpp
index b75f9ea..412c1ac 100644
--- a/RtspFace/main.cpp
+++ b/RtspFace/main.cpp
@@ -6,12 +6,16 @@
 #include "PL_AVFrameYUV420.h"
 #include "PL_AVFrameBGRA.h"
 #include "PL_Queue.h"
+#include "PL_Scale.h"
 
-#include <iostream>
-using namespace std;
+#include "PL_SensetimeFaceTrack.h"
+
+#include "logger.h"
 
 int main(int argc, char** argv)
 {
+	initLogger(LV_DEBUG);
+
 	PipeLine pipeLine;
 	
 	pipeLine.register_elem_creator("PL_RTSPClient", create_PL_RTSPClient);
@@ -20,10 +24,13 @@
 	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_elem_creator("PL_SensetimeFaceTrack", create_PL_SensetimeFaceTrack);
 	
 	{
 		PL_RTSPClient* rtspClient = (PL_RTSPClient*)pipeLine.push_elem("PL_RTSPClient");
-		RTSPConfig rtspConfig;
+		PL_RTSPClient_Config rtspConfig;
 		rtspConfig.progName = argv[0];
 		rtspConfig.rtspURL = argv[1];
 		rtspConfig.aux = true; // ffmpeg need aux, but live555 not
@@ -33,19 +40,48 @@
 		bool ret = rtspClient->init(&rtspConfig);
 		if (!ret)
 		{
-			cout << "rtspClient.init error" << endl;
+			LOG_ERROR << "rtspClient.init error";
 			exit(EXIT_FAILURE);
 		}
 	}
 
 	{
 		PL_H264Decoder* h264Decoder = (PL_H264Decoder*)pipeLine.push_elem("PL_H264Decoder");
-		h264Decoder->init(nullptr);
+		bool ret = h264Decoder->init(nullptr);
+		if (!ret)
+		{
+			LOG_ERROR << "PL_H264Decoder.init error";
+			exit(EXIT_FAILURE);
+		}
 	}
 
 	{
 		PL_AVFrameYUV420* avFrameYUV420 = (PL_AVFrameYUV420*)pipeLine.push_elem("PL_AVFrameYUV420");
-		avFrameYUV420->init(nullptr);
+		bool ret = avFrameYUV420->init(nullptr);
+		if (!ret)
+		{
+			LOG_ERROR << "PL_AVFrameYUV420.init error";
+			exit(EXIT_FAILURE);
+		}
+	}
+	
+	{
+		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);
+		if (!ret)
+		{
+			LOG_ERROR << "PL_Scale.init error";
+			exit(EXIT_FAILURE);
+		}
+	}
+
+	{
+		SensetimeFaceTrackConfig config;
+		PL_SensetimeFaceTrack* pl = (PL_SensetimeFaceTrack*)pipeLine.push_elem("PL_SensetimeFaceTrack");
+		pl->init(&config);
 	}
 
 	//{//#todo queue should support deep copy
@@ -54,31 +90,35 @@
 	//	bool ret = queue1->init(&config);
 	//	if (!ret)
 	//	{
-	//		cout << "queue1.init error" << endl;
+	//		LOG_ERROR << "queue1.init error";
 	//		exit(EXIT_FAILURE);
 	//	}
 	//}
 
-	//{
-	//	PL_H264Encoder* h264Encoder = (PL_H264Encoder*)pipeLine.push_elem("PL_H264Encoder");
-	//	h264Encoder->init(nullptr);
-	//}
+	{
+		PL_H264Encoder* h264Encoder = (PL_H264Encoder*)pipeLine.push_elem("PL_H264Encoder");
+		bool ret = h264Encoder->init(nullptr);
+		if (!ret)
+		{
+			LOG_ERROR << "PL_H264Encoder.init error";
+			exit(EXIT_FAILURE);
+		}
+	}
 	
-	//{
-	//	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);
-	//	}
-	//}
+	{
+		PL_RTSPServer* rtspServer = (PL_RTSPServer*)pipeLine.push_elem("PL_RTSPServer");
+		bool ret = rtspServer->init(nullptr);
+		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