资源简介
ffmpeg实现dxva2硬件加速全工程代码。VS2013平台。
代码片段和文件信息
#include “stdafx.h“
#include “D3DVidRender.h“
#pragma comment(lib “d3d9.lib“)
#pragma comment(lib “d3dx9.lib“)
// 使用stdio.h和strsafe.h,可实现类似TRACE的功能
/*void LogTrace(LPCTSTR pszFormat ...)
{
va_list pArgs;
char szMessageBuffer[16380]={0};
va_start( pArgs pszFormat );
_vsntprintf( szMessageBuffer 16380 pszFormat pArgs );
va_end( pArgs );
OutputDebugString(szMessageBuffer);
}*/
CD3DVidRender::CD3DVidRender(void)
{
m_pDirect3D9 = NULL;
m_pDirect3DDevice = NULL;
m_pDirect3DSurfaceRender = NULL;
m_pBackBuffer = NULL;
}
CD3DVidRender::~CD3DVidRender(void)
{
}
void CD3DVidRender::Cleanup()
{
if (m_pBackBuffer)
{
m_pBackBuffer->Release();
m_pBackBuffer = NULL;
}
if(m_pDirect3DSurfaceRender)
{
m_pDirect3DSurfaceRender->Release();
m_pDirect3DSurfaceRender = NULL;
}
if(m_pDirect3DDevice)
{
m_pDirect3DDevice->Release();
m_pDirect3DDevice = NULL;
}
if(m_pDirect3D9)
{
m_pDirect3D9->Release();
m_pDirect3D9 = NULL;
}
if (m_pD3DXFont)
{
m_pD3DXFont->Release() ;
m_pD3DXFont = NULL ;
}
}
BOOL CD3DVidRender::InitD3D_RGB32(HWND hwnd int img_width int img_height)
{
HRESULT lRet;
if (m_pDirect3D9)
{
m_pDirect3D9->Release();
m_pDirect3D9 = NULL;
}
m_pDirect3D9 = Direct3DCreate9(D3D_SDK_VERSION);
if(m_pDirect3D9 == NULL)
{
return FALSE;
}
ZeroMemory(&d3dpp sizeof(d3dpp));
d3dpp.Windowed = TRUE;
d3dpp.hDeviceWindow = hwnd;
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
d3dpp.BackBufferFormat = D3DFMT_UNKNOWN;
d3dpp.EnableAutoDepthStencil = FALSE;
d3dpp.Flags = D3DPRESENTFLAG_VIDEO;
d3dpp.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT;
d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
D3DCAPS9 caps;
DWORD BehaviorFlags = D3DCREATE_SOFTWARE_VERTEXPROCESSING | D3DCREATE_MULTITHREADED;
HRESULT hr = m_pDirect3D9->GetDeviceCaps ( D3DADAPTER_DEFAULT D3DDEVTYPE_HAL &caps ) ;
if ( SUCCEEDED(hr) )
{
if ( caps.DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT )
{
BehaviorFlags = D3DCREATE_HARDWARE_VERTEXPROCESSING | D3DCREATE_MULTITHREADED | D3DCREATE_FPU_PRESERVE;
}
else
{
BehaviorFlags = D3DCREATE_SOFTWARE_VERTEXPROCESSING | D3DCREATE_MULTITHREADED | D3DCREATE_FPU_PRESERVE;
}
}
if (m_pDirect3DDevice)
{
m_pDirect3DDevice->Release();
m_pDirect3DDevice = NULL;
}
lRet = m_pDirect3D9->CreateDevice(D3DADAPTER_DEFAULT D3DDEVTYPE_HAL hwnd BehaviorFlags &d3dpp &m_pDirect3DDevice);
if(FAILED(lRet))
{
return FALSE;
}
if (m_pDirect3DSurfaceRender)
{
m_pDirect3DSurfaceRender->Release();
m_pDirect3DSurfaceRender = NULL;
}
lRet = m_pDirect3DDevice->CreateOffscreenPlainSurface(img_width img_height D3DFMT_X8R8G8B8 D3DPOOL_DEFAULT
&m_pDirect3DSurfaceRender NULL);
if(FAILED(lRet))
{
return FALSE;
}
//// create the font
//ZeroMemory(&m_font_desc sizeof(m_font_desc));
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2016-11-30 10:15 Win32Project1_ffmpeg_dxva2\
目录 0 2016-11-29 15:58 Win32Project1_ffmpeg_dxva2\Debug\
文件 100352 2016-11-30 22:10 Win32Project1_ffmpeg_dxva2\Debug\Win32Project1.exe
文件 480232 2016-11-30 22:10 Win32Project1_ffmpeg_dxva2\Debug\Win32Project1.ilk
文件 2378752 2016-11-30 22:10 Win32Project1_ffmpeg_dxva2\Debug\Win32Project1.pdb
文件 24556032 2016-07-13 23:14 Win32Project1_ffmpeg_dxva2\Debug\avcodec-57.dll
文件 1310208 2016-07-13 23:14 Win32Project1_ffmpeg_dxva2\Debug\avdevice-57.dll
文件 3849216 2016-07-13 23:14 Win32Project1_ffmpeg_dxva2\Debug\avfilter-6.dll
文件 4941312 2016-07-13 23:14 Win32Project1_ffmpeg_dxva2\Debug\avformat-57.dll
文件 563200 2016-07-13 23:14 Win32Project1_ffmpeg_dxva2\Debug\avutil-55.dll
文件 0 2016-11-23 15:13 Win32Project1_ffmpeg_dxva2\Debug\output.yuv
文件 110592 2016-07-13 23:14 Win32Project1_ffmpeg_dxva2\Debug\postproc-54.dll
文件 289792 2016-07-13 23:14 Win32Project1_ffmpeg_dxva2\Debug\swresample-2.dll
文件 509440 2016-07-13 23:14 Win32Project1_ffmpeg_dxva2\Debug\swscale-4.dll
目录 0 2016-11-29 16:12 Win32Project1_ffmpeg_dxva2\Win32Project1\
文件 4645 2016-09-29 10:36 Win32Project1_ffmpeg_dxva2\Win32Project1\ConsoleAdapter.h
目录 0 2016-11-22 17:38 Win32Project1_ffmpeg_dxva2\Win32Project1\D3D\
目录 0 2016-11-22 17:38 Win32Project1_ffmpeg_dxva2\Win32Project1\D3D\include\
文件 243136 2015-12-10 10:26 Win32Project1_ffmpeg_dxva2\Win32Project1\D3D\include\D2D1.h
文件 25655 2015-12-10 10:26 Win32Project1_ffmpeg_dxva2\Win32Project1\D3D\include\D2D1Helper.h
文件 3171 2015-12-10 10:26 Win32Project1_ffmpeg_dxva2\Win32Project1\D3D\include\D2Dba
文件 5555 2015-12-10 10:26 Win32Project1_ffmpeg_dxva2\Win32Project1\D3D\include\D2Derr.h
文件 233001 2015-12-10 10:26 Win32Project1_ffmpeg_dxva2\Win32Project1\D3D\include\D3D10.h
文件 72228 2015-12-10 10:26 Win32Project1_ffmpeg_dxva2\Win32Project1\D3D\include\D3D10_1.h
文件 12052 2015-12-10 10:26 Win32Project1_ffmpeg_dxva2\Win32Project1\D3D\include\D3D10_1shader.h
文件 71712 2015-12-10 10:26 Win32Project1_ffmpeg_dxva2\Win32Project1\D3D\include\D3D10effect.h
文件 31418 2015-12-10 10:26 Win32Project1_ffmpeg_dxva2\Win32Project1\D3D\include\D3D10shader.h
文件 373484 2015-12-10 10:26 Win32Project1_ffmpeg_dxva2\Win32Project1\D3D\include\D3D11.h
文件 121600 2015-12-10 10:26 Win32Project1_ffmpeg_dxva2\Win32Project1\D3D\include\D3D11SDKla
文件 16294 2015-12-10 10:26 Win32Project1_ffmpeg_dxva2\Win32Project1\D3D\include\D3D11Shader.h
文件 15443 2015-12-10 10:26 Win32Project1_ffmpeg_dxva2\Win32Project1\D3D\include\D3DCSX.h
............此处省略389个文件信息
相关资源
- nginx-rtmp-win32-master.rar
- FFMEPG实现h264解码
- ffmpegh265rtmp.zip
- ffserver(windows下编译32位)
- qt_ffmpeg_mp4_export_and_import.zip
- 最简单的基于FFmpeg的推流器 1.2
- 简单的ffmpeg推流demo
- FFmpeg和SDL,读内存中的视频流,进行
- ffmpeg之pcm转AAC
- ffmpeg-2.8.14.tar.gz
- 利用ffmpeg的filter混音
- vs2010 ffmpeg实时解码h264码流
- ffmpeg 音视频转码代码
- windows上自己编译的最新的ffmpeg库
- Qt基于FFmpeg播放本地 H.264H264文件
- 从ffmpeg中抽取的h264解码器,可用于
- ffplay源代码
- 最简单的基于FFmpeg的推流器以推送R
- DVD文件VOB的生成代码
- FFmpeg 采集摄像头输出rtmp直播流媒体,
- 基于ffmpeg将avi视频转换为mp4视频
- (补充)修改output-example,将H.264AAC帧
- ffmpeg-win64位库
- X264实时编码,FFmpeg实时解码
- FFmpeg API读取视音频文件信息的一个工
- 使用FFmpeg采集摄像头图像和麦克风音
- opencv_ffmpeg249.dll
- FFmpeg-3.1 windows vs2013编译动态库静态库
- D3D烟花粒子
- 基于FFmpeg4.0.2的AAC编码器
评论
共有 条评论