houxiao
2016-12-22 fe007cee79c88a084bef01333f86f5da5f3c143f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include "PipeLine.h"
#include "PL_RTSPClient.h"
#include "PL_H264Decoder.h"
#include "PL_AVFrameYUV420.h"
 
#include <iostream>
using namespace std;
 
int main(int argc, char** argv)
{
    PipeLine pipeLine;
    
    pipeLine.register_elem_creator("PL_RTSPClient", create_PL_RTSPClient);
    pipeLine.register_elem_creator("PL_H264Decoder", create_PL_H264Decoder);
    pipeLine.register_elem_creator("PL_AVFrameYUV420", create_PL_AVFrameYUV420);
    
    PL_RTSPClient* rtspClient = (PL_RTSPClient*)pipeLine.push_elem("PL_RTSPClient");
    RTSPConfig rtspConfig;
    rtspConfig.progName = argv[0];
    rtspConfig.rtspURL = argv[1];
    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_AVFrameYUV420* avFrameYUV420 = (PL_AVFrameYUV420*)pipeLine.push_elem("PL_AVFrameYUV420");
    avFrameYUV420->init(nullptr);
    
    while(true)
    {
        //cout << "begin pipe" << endl;
        pipeLine.pipe();
        //cout << "end pipe" << endl;
    }
}