#include "PipeLine.h"
|
#include "PL_RTSPClient.h"
|
#include "PL_RTSPServer.h"
|
#include "PL_H264Decoder.h"
|
#include "PL_H264Encoder.h"
|
#include "PL_AVFrameYUV420.h"
|
#include "PL_AVFrameBGRA.h"
|
#include "PL_Queue.h"
|
|
#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);
|
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_SensetimeFaceDetect", create_PL_SensetimeFaceDetect);
|
|
{
|
PL_RTSPClient* rtspClient = (PL_RTSPClient*)pipeLine.push_elem("PL_RTSPClient");
|
PL_RTSPClient_Config rtspConfig;
|
rtspConfig.progName = argv[0];
|
rtspConfig.rtspURL = argv[1];
|
rtspConfig.aux = true; // ffmpeg need aux, but live555 not
|
rtspConfig.verbosityLevel = 1;
|
rtspConfig.tunnelOverHTTPPortNum = 0;
|
rtspConfig.args = nullptr;
|
bool ret = rtspClient->init(&rtspConfig);
|
if (!ret)
|
{
|
LOG_ERROR << "rtspClient.init error";
|
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);
|
}
|
|
{
|
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);
|
// }
|
//}
|
|
{
|
PL_H264Encoder* h264Encoder = (PL_H264Encoder*)pipeLine.push_elem("PL_H264Encoder");
|
h264Encoder->init(nullptr);
|
}
|
|
{
|
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)
|
{
|
//LOG_ERROR << "begin pipe";
|
pipeLine.pipe();
|
//LOG_ERROR << "end pipe";
|
}
|
}
|