資源簡介
運用視頻編解碼、RTP、線程等技術(shù)做的,可以實時傳輸多路視頻。
代碼片段和文件信息
#include?“stdafx.h“
#include?“baseThread.h“
using?namespace?MobileVideoServer;
CbaseThread::CbaseThread()?:
_thread_handle(NULL)
_parent_ptr(NULL)
_joined(false)
{
//...
}
CbaseThread::~CbaseThread()
{
//...
}
void?CbaseThread::initialize()
{
//...
}
void?CbaseThread::start(void*?parent)
{
unsigned?int?id(0);
_parent_ptr?=?parent;//看文件CThreadTestDlg.cpp中start()的參數(shù)this
on_start();??//on_start要在最開始調(diào)用
_thread_handle?=?(HANDLE)_beginthreadex(?
NULL??//安全屬性,NULL為默認(rèn)安全屬性
???0??//指定線程堆棧的大小。如果為0,則線程堆棧大小和創(chuàng)建它的線程的相同。一般用0
??_entry??//第3個參數(shù):指定線程函數(shù)的地址,也就是線程調(diào)用執(zhí)行的函數(shù)地址(用函數(shù)名稱即可,函數(shù)名稱就表示地址)
?(void*)this??//傳遞給線程的參數(shù)的指針,可以通過傳入對象的指針,在線程函數(shù)中再轉(zhuǎn)化為對應(yīng)類的指針
???0??//線程初始狀態(tài),0:立即運行;CREATE_SUSPEND:suspended(懸掛)
?&id???//用于記錄線程ID的地址
?);
SuspendThread(_thread_handle);//暫停(掛起)線程?
SetThreadPriority(_thread_handle?THREAD_PRIORITY_HIGHEST);//設(shè)置線程優(yōu)先級
ResumeThread(_thread_handle);//恢復(fù)線程運行
_joined?=?false;
}
void?CbaseThread::shutdown()
{
_joined?=?true;
join();
on_close();??//on_close要在最終調(diào)用
}
void?CbaseThread::join()
{
????DWORD?theErr?=?::WaitForSingleobject(_thread_handle?INFINITE);//等待,直到函數(shù)有返回值,即等待關(guān)閉線程
}
unsigned?int?WINAPI?CbaseThread::_entry(LPVOID?inThread)
{
????CbaseThread*?theThread?=?(CbaseThread*)inThread;
if(NULL?==?theThread)
return?-1;
while(false?==?theThread->_joined)
{
theThread->entry();
}
????return?0;
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????3691580??2013-01-11?11:51??C++多路視頻傳輸\lib\ffmpeg.lib
?????文件????4229288??2013-01-08?15:53??C++多路視頻傳輸\lib\jrtplib.lib
?????文件??????54444??2013-01-08?15:53??C++多路視頻傳輸\lib\jthread.lib
?????文件???????8652??2013-01-11?10:57??C++多路視頻傳輸\lib\Packetfr
?????文件????3373542??2012-12-29?11:15??C++多路視頻傳輸\lib\x264.lib
?????文件???????1078??2012-12-13?11:10??C++多路視頻傳輸\res\Send.ico
?????文件????????396??2012-12-13?11:10??C++多路視頻傳輸\res\Send.rc2
?????文件???11404800??2012-08-31?19:10??C++多路視頻傳輸\akiyo_qcif.yuv
?????文件???????1714??2013-03-05?11:50??C++多路視頻傳輸\ba
?????文件????????996??2013-02-25?20:22??C++多路視頻傳輸\ba
?????文件???????1237??2013-01-18?11:30??C++多路視頻傳輸\h264decode.h
?????文件????????413??2012-12-30?20:25??C++多路視頻傳輸\h264encode.h
?????文件???????1576??2012-09-19?14:54??C++多路視頻傳輸\h264packfr
?????文件???????4367??2013-01-08?15:53??C++多路視頻傳輸\Jrtplib.h
?????文件???11404800??2012-08-31?19:10??C++多路視頻傳輸\news_qcif.yuv
?????文件???????3543??2012-12-13?11:10??C++多路視頻傳輸\ReadMe.txt
?????文件???????1366??2013-02-20?10:44??C++多路視頻傳輸\Resource.h
?????文件??????22732??2013-02-26?16:24??C++多路視頻傳輸\Send.aps
?????文件???????1191??2012-12-17?11:19??C++多路視頻傳輸\Send.clw
?????文件???????2035??2012-12-13?11:10??C++多路視頻傳輸\Send.cpp
?????文件???????4123??2012-12-13?11:10??C++多路視頻傳輸\Send.dsp
?????文件????????516??2012-12-13?11:25??C++多路視頻傳輸\Send.dsw
?????文件???????1302??2012-12-13?11:10??C++多路視頻傳輸\Send.h
?????文件???????1453??2013-01-15?19:17??C++多路視頻傳輸\Send.idc
?????文件???10193920??2013-03-05?11:50??C++多路視頻傳輸\Send.ncb
?????文件??????48640??2012-12-17?11:19??C++多路視頻傳輸\Send.opt
?????文件????????518??2012-12-17?11:19??C++多路視頻傳輸\Send.plg
?????文件???????5960??2013-02-20?17:03??C++多路視頻傳輸\Send.rc
?????文件????????872??2012-12-20?10:13??C++多路視頻傳輸\Send.sln
?????文件???????7992??2013-01-25?09:47??C++多路視頻傳輸\Send.vcproj
............此處省略15個文件信息
評論
共有 條評論