注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

gmd20的个人空间

// 编程和生活

 
 
 

日志

 
 

Directshow学习系列:如何编译direcshowt程序  

2008-10-08 14:23:20|  分类: 程序设计 |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

首先去微软主页下载Directshow SDK。 我下载的时候是在platform SDK 里面的。
安装完之后,可以在安装目录下找到一个名字为BaseClasses 的基类的目录,编译自己的程序之前先编译出这个基类的类库,并在工程属性里面头文件包含目录那里把这个目录添加过去就行了。
=======================
启动“Visual Studio 2008 命令提示行窗口,
切换到BaseClasses 目录,然后执行 namke命令,就可以编译生成strmbase.lib 库文件
但可以看到生成的哭的系统的版本是不对的,查看BaseClasses 目录下的makefile文件可以看到是在
#----- Include the PSDK's WIN32.MAK to pick up defines-------------------
!include <win32.mak>

这个文件里面定义的,通过nmake /? 查看nmake的帮助可以知道nmake /G 命令可以看到使用到 win32.mak文件到位置。

--------------
C:\Documents and Settings\widebright\桌面\directshow语音聊天学习2008-09-25\chat\
BaseClasses>nmake /G

Microsoft (R) 程序维护实用工具 9.00.21022.08 版
版权所有 (C) Microsoft Corporation。保留所有权利。

Included: C:\Program Files\\Microsoft SDKs\Windows\v6.0A\include\win32.mak
-------------------

打开这个win32.mak 文件可以看到关于定义系统版本和调试非调试的定义方法说明。
修改makefile文件为:
#----- Include the PSDK's WIN32.MAK to pick up defines-------------------
APPVER = 5.01

!include <win32.mak>
-------------------------------
在!include <win32.mak> 到前面加上APPVER = 5.01,事先定义系统版本为windows xp,然后再执行nmake 就可以生成调试版本的库strmbasd.lib,nmake nodebug=1 就可以生成release版本的库strmbase.lib。

再把这两个库放到工程目录,vc就可以找到了。

上面步骤作完,应该就不会有什么问题了,注意调试和发布版本时要分别链接正确的库。

===============================下面是directshow SDK的环境配置说明

Microsoft DirectShow 9.0

Setting Up the Build Environment

This article describes how to build Microsoft® DirectShow® applications. You can build a project from the command line, or from within the Microsoft® Visual Studio® environment that comes with Microsoft® Visual C++®:

Header Files

All DirectShow applications use the header file shown in the following table.

Header File Required For
Dshow.h All DirectShow applications.

Some DirectShow interfaces require additional header files. These requirements are noted in the interface reference.

Library Files

DirectShow uses the library files shown in the following table.

Library File Description
Strmiids.lib Exports class identifiers (CLSIDs) and interface identifiers (IIDs). All DirectShow applications require this library.
Quartz.lib Exports the AMGetErrorText function. If you do not call this function, this library is not required.

In your build environment, place the DirectX SDK Include and Lib directories first in the Visual Studio search path. This ensures that you are using the most recent versions of these files.

See Also



© 2005 Microsoft Corporation. All rights reserved.

Microsoft DirectShow 9.0

Building DirectShow Filters

The DirectShow base classes are recommended for implementing DirectShow filters. To build with the base classes, perform the following steps, in addition those listed in Setting Up the Build Environment:

  • Build the base class library, located in the directory Samples\Multimedia\DirectShow\BaseClasses, under the SDK root directory. There are two versions of the library: a retail version (Strmbase.lib) and a debug version (Strmbasd.lib).
  • Include the header file Streams.h.
  • Use the __stdcall calling convention.
  • Use the multithreaded C run-time library (debug or retail, as appropriate).
  • Include a definition (.def) file that exports the DLL functions. The following is an example of a definition file. It assumes that the output file is named MyFilter.dll.
    de<LIBRARY MYFILTER.DLLEXPORTS     DllMain             PRIVATE    DllGetClassObject   PRIVATE    DllCanUnloadNow     PRIVATE    DllRegisterServer   PRIVATE    DllUnregisterServer PRIVATEde<
  • Link to the following lib files.
    Debug Build Strmbasd.lib, Msvcrtd.lib, Winmm.lib
    Retail Build Strmbase.lib, Msvcrt.lib, Winmm.lib
  • Choose the "ignore default libraries" option in the linker settings.
  • Declare the DLL entry point in your source code, as follows:
    de<extern "C" BOOL WINAPI DllEntryPoint(HINSTANCE, ULONG, LPVOID);BOOL APIENTRY DllMain(HANDLE hModule, DWORD dwReason, LPVOID lpReserved){    return DllEntryPoint((HINSTANCE)(hModule), dwReason, lpReserved);}de<

Previous Versions

For versions of the base class library before DirectShow 9.0, you must also do the following:

  • For debug builds, define the preprocessor flag DEBUG.

This step is not required for the version of the base class library that is available in DirectShow 9.0 and later.

See Also



© 2005 Microsoft Corporation. All rights reserved.

  评论这张
 
阅读(661)| 评论(0)
推荐 转载

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017