houxiao
2016-12-28 4ef430e946e717d72e923c4708a9120f94d55dbd
RtspFace/main.cpp
@@ -5,6 +5,7 @@
#include "PL_H264Encoder.h"
#include "PL_AVFrameYUV420.h"
#include "PL_AVFrameBGRA.h"
#include "PL_Queue.h"
#include <iostream>
using namespace std;
@@ -18,33 +19,61 @@
   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);
   
   PL_RTSPClient* rtspClient = (PL_RTSPClient*)pipeLine.push_elem("PL_RTSPClient");
   RTSPConfig rtspConfig;
   rtspConfig.progName = argv[0];
   rtspConfig.rtspURL = argv[1];
   rtspConfig.aux = false; // ffmpeg need aux
   rtspConfig.verbosityLevel = 1;
   rtspConfig.tunnelOverHTTPPortNum = 0;
   rtspConfig.args = nullptr;
   bool ret = rtspClient->init(&rtspConfig);
   if (!ret)
   {
      cout << "rtspClient.init error" << endl;
      exit(EXIT_FAILURE);
      PL_RTSPClient* rtspClient = (PL_RTSPClient*)pipeLine.push_elem("PL_RTSPClient");
      RTSPConfig 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)
      {
         cout << "rtspClient.init error" << endl;
         exit(EXIT_FAILURE);
      }
   }
   
   //PL_H264Decoder* h264Decoder = (PL_H264Decoder*)pipeLine.push_elem("PL_H264Decoder");
   //h264Decoder->init(nullptr);
   //{
   //   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_AVFrameYUV420* avFrameYUV420 = (PL_AVFrameYUV420*)pipeLine.push_elem("PL_AVFrameYUV420");
   //avFrameYUV420->init(nullptr);
   {
      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_H264Encoder* h264Encoder = (PL_H264Encoder*)pipeLine.push_elem("PL_H264Encoder");
      h264Encoder->init(nullptr);
   }
   
   //PL_H264Encoder* h264Encoder = (PL_H264Encoder*)pipeLine.push_elem("PL_H264Encoder");
   //h264Encoder->init(nullptr);
   PL_RTSPServer* rtspServer = (PL_RTSPServer*)pipeLine.push_elem("PL_RTSPServer");
   rtspServer->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);
   //   }
   //}
   
   while(true)
   {