VCL模拟服务器并打开播放该视频文件:
- 
准备好一个mp4文件,打开vlc软件
 - 
选择"媒体"=》"流"
 - 
添加一个mp4文件
 - 
点击下方按钮选择"串流"
 - 
下一步目标选择rtsp 点击"添加"
 - 
端口默认8554
 - 
路径设置 /test
 - 
用另一个vlc打开串流播放
 - 
rtsp://127.0.0.1:8554/test
 
在VCL播放的同时用代码解封装该rtsp文件:
在上一篇的主函数中:
            
            
              cpp
              
              
            
          
          #include <iostream>
#include <thread>
#include "xtools.h"
#include "xdemux_task.h"
using namespace std;
//class TestThread :public XThread
//{
//public:
//    void Main()
//    {
//        LOGDEBUG("TestThread Main begin");
//        while (!is_exit_)
//        {
//            this_thread::sleep_for(1ms);
//        }
//        LOGDEBUG("TestThread Main end");
//    }
//};
#define CAM1 \
"rtsp://admin:admin@192.168.2.108/cam/realmonitor?channel=1&subtype=0"
#define MP4 "v1080.mp4"
#define CAM2 \
"rtsp://127.0.0.1:8554/test"
int main(int argc, char* argv[])
{
    XDemuxTask det;
    for (;;)//保证第一次连接就失败的情况
    {
        if (det.Open(CAM2))
        {
            break;
        }
        MSleep(100);
        continue;
    }
    det.Start();
    //TestThread tt;
    //tt.Start();
    //this_thread::sleep_for(3s);
    //tt.Stop();
    getchar();
    return 0;
}
        运行结果 :

一个VCL模拟服务器,一个VCL播放该流,用代码进行解封装成功