2023-10-08 05:56:23 +00:00
|
|
|
|
// Project_ServerVedioPush.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
|
|
|
|
|
|
//
|
2024-07-31 00:45:23 +00:00
|
|
|
|
#include <Windows.h>
|
2023-10-08 05:56:23 +00:00
|
|
|
|
#include <iostream>
|
|
|
|
|
|
#include <thread>
|
|
|
|
|
|
#include <mutex>
|
|
|
|
|
|
|
|
|
|
|
|
#include "Task_Ffmpeg/TaskFfmpeg.h"
|
|
|
|
|
|
#include "Task_PingMoniotor/TaskPingMoniotor.h"
|
|
|
|
|
|
#include "Task_NetMonitor/TaskNetMonitor.h"
|
|
|
|
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
|
|
|
|
int main()
|
|
|
|
|
|
{
|
|
|
|
|
|
int ret;
|
|
|
|
|
|
thread threadFfmpegPushVedio;
|
|
|
|
|
|
thread threadPing;
|
2024-07-31 00:45:23 +00:00
|
|
|
|
printf("Strat Initing \r\n");
|
|
|
|
|
|
Sleep(3000);
|
2023-10-08 05:56:23 +00:00
|
|
|
|
/* 初始化 */
|
|
|
|
|
|
ret = Task_FfmpegInit();
|
|
|
|
|
|
if (ret < 0) {
|
|
|
|
|
|
system("pause");
|
|
|
|
|
|
exit(0);
|
|
|
|
|
|
}
|
|
|
|
|
|
ret = PingMoniotorInit();
|
|
|
|
|
|
if (ret < 0) {
|
|
|
|
|
|
system("pause");
|
|
|
|
|
|
exit(0);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* 创建一个FFMPEG推流转码的线程 */
|
|
|
|
|
|
threadFfmpegPushVedio = thread(Task_FfmpegPushVedio);
|
|
|
|
|
|
/* 创建一个本地的ping线程,用于判断对方是否已经上线 */
|
|
|
|
|
|
threadPing = thread(Task_PingMoniotor);
|
|
|
|
|
|
/* 等待推流线程结束 */
|
|
|
|
|
|
threadFfmpegPushVedio.join();
|
|
|
|
|
|
/* 等待本地的ping线程结束 */
|
|
|
|
|
|
threadPing.join();
|
|
|
|
|
|
system("pause");
|
|
|
|
|
|
exit(0);
|
|
|
|
|
|
}
|