windows+mobile++摄像头捕捉+例子+directshow
来源:互联网 发布:python datetime now 编辑:程序博客网 时间:2024/06/10 11:38
//创建graph图表
IGraphBuilder *pFilterGraph;
ICaptureGraphBuilder2 *pCaptureGraphBuilder;
HRESULT hr = CoCreateInstance(CLSID_FilterGraph,0,CLSCTX_INPROC,IID_IGraphBuilder,(void**)&pFilterGraph);
hr = CoCreateInstance(CLSID_CaptureGraphBuilder,0,CLSCTX_INPROC,IID_ICaptureGraphBuilder2,(void**)&pCaptureGraphBuilder);
pCaptureGraphBuilder->SetFiltergraph(pFilterGraph);
//创建捕捉filter
IBaseFilter *pVideoCaptureFilter;
hr = CoCreateInstance(CLSID_VideoCapture,0,CLSCTX_INPROC,IID_IBaseFilter,(void**)&pVideoCaptureFilter);
IPersistPropertyBag *pPropertyBag;
pVideoCaptureFilter->QueryInterface(&pPropertyBag);
DEVMGR_DEVICE_INFORMATION devInfo;
CComVariant CamName;
IPropertyBag *propbag; //这里 别人说是 CPropertyBag 去实现IPropertyBag
GUID guidCamera = {}; //这里是camera 注册在系统里的GUID值
devInfo.dwSize = sizeof(devInfo);
//查找camera device
FindFirstDevice(DeviceSearchByGuid,&guidCamera,&devInfo);
CamName = devInfo.szLegacyName;
propbag->Write(L"VcapName",&CamName);
pPropertyBag->Load(propbag,NULL);
//添加捕捉filter
pFilterGraph->AddFilter(pVideoCaptureFilter,L"MyCapture");
pPropertyBag->Release();
propbag->Release();
//创建解码filter
IBaseFilter *pVideoEncode;
IDMOWrapperFilter *pWrapperFilter; //接口
hr = CoCreateInstance(CLSID_DMOWrapperFilter,0,CLSCTX_INPROC,IID_IBaseFilter,(void**)&pVideoEncode);
pVideoEncode->QueryInterface(&pWrapperFilter);
pWrapperFilter->Init(CLSID_CWMV9EncMediaObject,DMOCATEGORY_VIDEO_ENCODER);
//添加解码filter
pFilterGraph->AddFilter(pVideoEncode,L"video encode");
//建立asf流生成filter和file write filter
IBaseFilter *pAsfMultiplexer;
IFileSinkFilter *pFileSinkFilter; //接口
pCaptureGraphBuilder->SetOutputFileName(&MEDIASUBTYPE_Asf,L"C:\\test.asf",&pAsfMultiplexer,&pFileSinkFilter);
//连接所有的filter
pCaptureGraphBuilder->RenderStream(&PIN_CATEGORY_CAPTURE,&MEDIATYPE_Video,pVideoCaptureFilter,pVideoEncode,pAsfMultiplexer);
//启动Graph
IMediaControl *pMC;
pFilterGraph->QueryInterface(IID_IMediaControl,(void**)&pMC);
pMC->Run();
MSDN
ICaptureGraphBuilder2::RenderStream
HRESULT RenderStream( const GUID* pCategory, const GUID* pType, IUnknown* pSource, IBaseFilter* pIntermediate, IBaseFilter* pSink);
pCategory
[in] A pointer to a pin category from the AMPROPERTY_PIN_CATEGORY property set (seePin Property Set). Use NULL to match any category. The following list shows typical categories.
- PIN_CATEGORY_CAPTURE //捕捉
- PIN_CATEGORY_PREVIEW //预览
- PIN_CATEGORY_CC
- pType
[in] Pointer to a major-type GUID that specifies the media type of the output pin; or NULL to use any pin, regardless of media type. For a list of possible values, seeMedia Types and Sub Types.
- pSource
[in] Specifies a pointer to the starting filter for the connection, or to an output pin.
- pIntermediate
[in] Pointer to the IBaseFilter Interface of an intermediate filter, such as a compression filter. Can be NULL.
- pSink
[in] Pointer to the IBaseFilter interface of a sink filter, such asa renderer or mux filter. If the value is NULL, the method uses a default renderer (see Remarks).
想预览的话自己加个videoRender filter 使用Preview Pin 预览画面
- windows+mobile++摄像头捕捉+例子+directshow
- windows mobile中使用DirectShow开发视频流之从摄像头流中捕捉一张图片
- 在Windows Mobile 5中使用DirectShow控制摄像头
- 在Windows Mobile 5中使用DirectShow控制摄像头
- 在Windows Mobile 5中使用DirectShow控制摄像头-转
- 在Windows Mobile 5中使用DirectShow控制摄像头
- 在Windows Mobile 5中使用DirectShow控制摄像头
- DirectShow编程实现摄像头视频捕捉
- DirectShow编程实现摄像头视频捕捉
- DirectShow编程实现摄像头视频捕捉
- DirectShow编程实现摄像头视频捕捉
- DirectShow编程实现摄像头视频捕捉
- windows下视频捕捉VFW和DirectShow
- windows下视频捕捉VFW和DirectShow
- windows下视频捕捉VFW和DirectShow
- Directshow捕捉摄像头视频的类CameraCapture(SDK)
- DirectShow VS2013 控制台下捕捉摄像头并且显示
- 单个摄像头视频流捕捉的例子
- Linux Filesystem Hierarchy 之 The Root Directory
- JQuery Chapter3 JQuery中对DOM对象的操作
- linux下C语言多线程编程实例
- 常用数据库驱动和JDBC+URL
- 如何使用VC++调试程序 VC调试快捷键 Debug版本与Release版本
- windows+mobile++摄像头捕捉+例子+directshow
- 1012
- java类加载
- 文件过滤驱动中的重入处理
- 排列与组合
- 正则表达式
- SQL面试题之行列转换
- Java+Threads+多线程参考手册
- 一些牛人博客,值得收藏和学习