图像处理1--VC6.0下directshow配置
2011-10-08 13:51
288 查看
注:网上转载,测试通过
DirectShow开发环境配置及测试例程
开发环境
SDK:DirectX9.0b (Summer 2003)
Visual C++ 6.0
参考文档:SDK文档
1) DirectShow->Getting Started->Setting Up the Build Environment
2) DirectShow->DirectShow Reference->DirectShow Base Classes->Using the DirectShow Base Classes
3) DirectShow->Getting Started->How To Play a File
测试例子:SDK文档
DirectShow->Getting Started->How To Play a File
配置说明:
1. Tools->Options->Directories
Include - 添加<SDK root>\Include
Lib - 添加<SDK root>\Lib
- 添加<SDK root>\SAMPLES\C++\DirectShow\BASECLASSES\DEBUG // [注1]
2. Build BaseClasses
打开<SDK root>\Samples\C++\DirectShow\BaseClasses\baseclasses.dsp,编译debug得到Strmbasd.lib。 // [注2]
3. Project->Setting->Link
添加Strmbasd.lib
4. 添加头文件
#include <Dshow.h> // 所有DirectShow应用程序必备
#include <Streams.h> // 使用DirectShow基类
源代码如下,代码分析见参考文档3)
#include <Dshow.h>
#include <Streams.h>
#include <stdio.h>
void main(void)
{
IGraphBuilder *pGraph = NULL;
IMediaControl *pControl = NULL;
IMediaEvent *pEvent = NULL;
// Initialize the COM library.
HRESULT hr = CoInitialize(NULL);
if (FAILED(hr))
{
printf("ERROR - Could not initialize COM library");
return;
}
// Create the filter graph manager and query for interfaces.
hr = CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER,
IID_IGraphBuilder, (void **)&pGraph);
if (FAILED(hr))
{
printf("ERROR - Could not create the Filter Graph Manager.");
return;
}
hr = pGraph->QueryInterface(IID_IMediaControl, (void **)&pControl);
hr = pGraph->QueryInterface(IID_IMediaEvent, (void **)&pEvent);
// Build the graph. IMPORTANT: Change this string to a file on your system.
// hr = pGraph->RenderFile(L"C:\\Example.avi", NULL);
hr = pGraph->RenderFile(L"E:\\DX90SDK\\Samples\\Media\\chicken.wmv", NULL);
if (SUCCEEDED(hr))
{
// Run the graph.
hr = pControl->Run();
if (SUCCEEDED(hr))
{
// Wait for completion.
long evCode;
pEvent->WaitForCompletion(INFINITE, &evCode);
// Note: Do not use INFINITE in a real application, because it
// can block indefinitely.
}
}
pControl->Release();
pEvent->Release();
pGraph->Release();
CoUninitialize();
}
注1:该处可根据需要添加不同版本,如RELEASE/Debug_Unicode/Release_Unicode。
注2:debug - strmbasd.lib;release - strmbase.lib;另外还有对应的Unicode版本。
注3:步骤3缺,将导致
error LNK2001: unresolved external symbol _IID_IMediaEvent
error LNK2001: unresolved external symbol _IID_IMediaControl
error LNK2001: unresolved external symbol _CLSID_FilterGraph
error LNK2001: unresolved external symbol _IID_IGraphBuilder
Debug/Howtoplayafile.exe : fatal error LNK1120: 4 unresolved externals
Error executing link.exe.
DirectShow开发环境配置及测试例程
开发环境
SDK:DirectX9.0b (Summer 2003)
Visual C++ 6.0
参考文档:SDK文档
1) DirectShow->Getting Started->Setting Up the Build Environment
2) DirectShow->DirectShow Reference->DirectShow Base Classes->Using the DirectShow Base Classes
3) DirectShow->Getting Started->How To Play a File
测试例子:SDK文档
DirectShow->Getting Started->How To Play a File
配置说明:
1. Tools->Options->Directories
Include - 添加<SDK root>\Include
Lib - 添加<SDK root>\Lib
- 添加<SDK root>\SAMPLES\C++\DirectShow\BASECLASSES\DEBUG // [注1]
2. Build BaseClasses
打开<SDK root>\Samples\C++\DirectShow\BaseClasses\baseclasses.dsp,编译debug得到Strmbasd.lib。 // [注2]
3. Project->Setting->Link
添加Strmbasd.lib
4. 添加头文件
#include <Dshow.h> // 所有DirectShow应用程序必备
#include <Streams.h> // 使用DirectShow基类
源代码如下,代码分析见参考文档3)
#include <Dshow.h>
#include <Streams.h>
#include <stdio.h>
void main(void)
{
IGraphBuilder *pGraph = NULL;
IMediaControl *pControl = NULL;
IMediaEvent *pEvent = NULL;
// Initialize the COM library.
HRESULT hr = CoInitialize(NULL);
if (FAILED(hr))
{
printf("ERROR - Could not initialize COM library");
return;
}
// Create the filter graph manager and query for interfaces.
hr = CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER,
IID_IGraphBuilder, (void **)&pGraph);
if (FAILED(hr))
{
printf("ERROR - Could not create the Filter Graph Manager.");
return;
}
hr = pGraph->QueryInterface(IID_IMediaControl, (void **)&pControl);
hr = pGraph->QueryInterface(IID_IMediaEvent, (void **)&pEvent);
// Build the graph. IMPORTANT: Change this string to a file on your system.
// hr = pGraph->RenderFile(L"C:\\Example.avi", NULL);
hr = pGraph->RenderFile(L"E:\\DX90SDK\\Samples\\Media\\chicken.wmv", NULL);
if (SUCCEEDED(hr))
{
// Run the graph.
hr = pControl->Run();
if (SUCCEEDED(hr))
{
// Wait for completion.
long evCode;
pEvent->WaitForCompletion(INFINITE, &evCode);
// Note: Do not use INFINITE in a real application, because it
// can block indefinitely.
}
}
pControl->Release();
pEvent->Release();
pGraph->Release();
CoUninitialize();
}
注1:该处可根据需要添加不同版本,如RELEASE/Debug_Unicode/Release_Unicode。
注2:debug - strmbasd.lib;release - strmbase.lib;另外还有对应的Unicode版本。
注3:步骤3缺,将导致
error LNK2001: unresolved external symbol _IID_IMediaEvent
error LNK2001: unresolved external symbol _IID_IMediaControl
error LNK2001: unresolved external symbol _CLSID_FilterGraph
error LNK2001: unresolved external symbol _IID_IGraphBuilder
Debug/Howtoplayafile.exe : fatal error LNK1120: 4 unresolved externals
Error executing link.exe.
相关文章推荐
- 图像处理1--VC6.0下directshow配置
- 使用OpenCV 实现多摄像头图像处理笔记(1):DirectShow的配置过程可能出现的问题
- Opencv中并行图像处理环境的搭建和配置
- VC6.0图像处理1--浏览图片
- deepin linux系统 图像处理及机器学习开发环境配置方法
- VC6.0图形处理6--图像增强
- VC环境下使用HALCON图像处理库的配置与基本操作
- DICOM医学图像处理:DCMTK在VS2012中的配置
- 基于Emgu CV的图像处理 第一章 环境配置
- VC6.0图像处理1--浏览图片
- DICOM医学图像处理:DCMTK在VS2012中的配置
- ImageMagic图像处理软件及扩展模块,如何在php配置中添加扩展的模块
- VC6.0图像处理0--bmp文件分析
- 图像:VC+DirectShow对视频进行图片处理
- VC6.0图像处理0--bmp文件分析
- VC6.0图像处理2--图像的反色
- 【OpenCV图像处理入门学习教程一】OpenCV2 + 3的安装教程与VS2013的开发环境配置 + JPEG压缩源码分析与取反运算修改
- 图像处理0--directshow9.0b下载地址
- VC6.0图像处理2--图像的反色
- 数字图像处理之配置opencv中遇到的问题