資源簡介
基于jrtplib實現了RTP發送和接收功能,支持發送H264、PS、TS等文件流,接收端讀取發送端發來的數據后,取Payload數據,通過FFmpeg分離、解碼出視頻,將RGB格式的視頻在窗口中顯示。
了解更多內容請參閱我博客上的相關文章:https://blog.csdn.net/zhoubotong2012/article/category/7467116
代碼片段和文件信息
//?VideoDrawer.cpp:?implementation?of?the?CDDrawData?class.
//
//////////////////////////////////////////////////////////////////////
#include?“DDrawData.h“
//////////////////////////////////////////////////////////////////////
//?Construction/Destruction
//////////////////////////////////////////////////////////////////////
#define?SAFE_RELEASE(p)?{?if?(?(p)?)?{?(p)->Release();?(p)?=?0;?}?}
CDDrawData::CDDrawData()
{
????m_pDD????????????????=?NULL;
????m_pddsFrontBuffer????=?NULL;
????m_pddsBackBuffer?????=?NULL;
????m_dwWidth?=?0;
????m_dwHeight?=?0;
}
CDDrawData::~CDDrawData()
{
????Destroyobjects();
}
HRESULT?CDDrawData::Init(HWND?hWndRECT?rect)
{
????HRESULT?hr;
????//?Cleanup?anything?from?a?previous?call
????Destroyobjects();
????//?DDraw?stuff?begins?here
????if(?FAILED(?hr?=?DirectDrawCreateEx(?NULL?(VOID**)&m_pDD
?????????????????????????????????????????IID_IDirectDraw7?NULL?)?)?)
????????return?E_FAIL;
????//?Set?cooperative?level
????hr?=?m_pDD->SetCooperativeLevel(?hWnd?DDSCL_NORMAL?);
????if(?FAILED(hr)?)
????????return?E_FAIL;
????
????DWORD?dwWidthdwHeight;
????dwWidth?=?rect.right-rect.left;
????dwHeight?=?rect.bottom?-?rect.top;
?/*???RECT??rcWork;
????RECT??rc;
????DWORD?dwstyle;
????//?If?we?are?still?a?WS_POPUP?window?we?should?convert?to?a?normal?app
????//?window?so?we?look?like?a?windows?app.
????dwstyle??=?GetWindowstyle(?hWnd?);
????dwstyle?&=?~WS_POPUP;
????dwstyle?|=?WS_OVERLAPPED?|?WS_CAPTION?|?WS_THICKframe?|?WS_MINIMIZEBOX;
????SetWindowLong(?hWnd?GWL_style?dwstyle?);
????//?Aet?window?size
????SetRect(?&rc?0?0?dwWidth?dwHeight?);
????AdjustWindowRectEx(?&rc?GetWindowstyle(hWnd)?GetMenu(hWnd)?!=?NULL
????????????????????????GetWindowExstyle(hWnd)?);
????SetWindowPos(?hWnd?NULL?0?0?rc.right-rc.left?rc.bottom-rc.top
??????????????????SWP_NOMOVE?|?SWP_NOZORDER?|?SWP_NOACTIVATE?);
????SetWindowPos(?hWnd?HWND_NOTOPMOST?0?0?0?0
??????????????????SWP_NOSIZE?|?SWP_NOMOVE?|?SWP_NOACTIVATE?);
????//??Make?sure?our?window?does?not?hang?outside?of?the?work?area
????SystemParametersInfo(?SPI_GETWORKAREA?0?&rcWork?0?);
????GetWindowRect(?hWnd?&rc?);
????if(?rc.left?????if(?rc.top??????SetWindowPos(?hWnd?NULL?rc.left?rc.top?0?0
??????????????????SWP_NOSIZE?|?SWP_NOZORDER?|?SWP_NOACTIVATE?);
*/
????GetWindowRect(?hWnd?&m_rcWindow?);
????LPDIRECTDRAWCLIPPER?pcClipper;
????
????//?Create?the?primary?surface
????DDSURFACEDESC2?ddsd;
????ZeroMemory(?&ddsd?sizeof(?ddsd?)?);
????ddsd.dwSize?????????=?sizeof(?ddsd?);
????ddsd.dwFlags????????=?DDSD_CAPS;
????ddsd.ddsCaps.dwCaps?=?DDSCAPS_PRIMARYSURFACE;
????if(?FAILED(?m_pDD->CreateSurface(?&ddsd?&m_pddsFrontBuffer?NULL?)?)?)
????????return?E_FAIL;
?????if(?FAILED(?hr?=?m_pDD->CreateClipper(?0?&pcClipper?NULL?)?)?)
????????return?E_FAIL;
????if(?FAILED(?
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2016-06-14?16:37??class\
?????目錄???????????0??2016-06-14?16:37??class\DirectDraw\
?????文件???????13969??2014-03-10?15:46??class\DirectDraw\DDrawData.cpp
?????文件????????2169??2014-03-10?15:46??class\DirectDraw\DDrawData.h
?????文件???????10757??2014-10-21?09:52??class\DirectDraw\Dec.rar
?????文件????????6431??2014-10-21?09:49??class\DirectDraw\DecoderRtp.cpp
?????文件????????1073??2014-10-21?09:49??class\DirectDraw\DecoderRtp.h
?????文件??????????39??2014-03-10?15:46??class\DirectDraw\directdraw.h
?????文件????????7959??2014-03-10?15:46??class\DirectDraw\DirectDraw.rar
?????文件????????8016??2016-05-05?13:01??class\DirectDraw\yuvdisplay.cpp
?????文件?????????865??2014-10-21?10:05??class\DirectDraw\yuvdisplay.h
?????目錄???????????0??2016-06-14?16:37??class\thread\
?????文件????????1397??2014-03-10?15:46??class\thread\Thread.cpp
?????文件????????1172??2014-03-10?15:46??class\thread\Thread.h
?????文件????????5155??2014-03-10?15:46??class\thread\TThread.h
?????目錄???????????0??2018-11-29?16:20??Debug\
?????文件????18936320??2015-07-15?16:19??Debug\avcodec-55.dll
?????文件?????1340928??2015-07-15?16:19??Debug\avdevice-55.dll
?????文件?????2034688??2015-07-15?16:19??Debug\avfilter-4.dll
?????文件?????5342720??2015-07-15?16:19??Debug\avformat-55.dll
?????文件??????418304??2015-07-15?16:19??Debug\avutil-52.dll
?????文件??????832512??2018-11-29?16:18??Debug\PlayStream.exe
?????文件??????121344??2015-07-15?16:19??Debug\postproc-52.dll
?????文件?????1007104??2015-07-15?16:19??Debug\SDL2.dll
?????文件??????275968??2015-07-15?16:19??Debug\swresample-0.dll
?????文件??????434176??2015-07-15?16:19??Debug\swscale-2.dll
?????目錄???????????0??2018-11-11?19:51??jrtplib\
?????目錄???????????0??2018-11-11?19:52??jrtplib\jrtplib\
?????文件?????????757??2017-03-29?00:59??jrtplib\jrtplib\reformaterrors.py
?????文件????????2697??2017-03-29?00:59??jrtplib\jrtplib\rtcpapppacket.cpp
?????文件????????3703??2017-03-29?00:59??jrtplib\jrtplib\rtcpapppacket.h
............此處省略302個文件信息
評論
共有 條評論