Technical Application Notes
Click an item to read from the list below.

Technical Application Notes


 

 

Developing Microsoft® DirectShow® applications with FlyCapture®

Technical Application Note TAN2007003

Revised May 15, 2015

Subject

Developing Microsoft DirectShow Applications with FlyCapture

10411

Applicable Product(s)

This TAN applies to all Point Grey products that are supported by the Point Grey FlyCapture driver, which supports Microsoft DirectShow.

 

Application Note Description

The purpose of this Technical Application Note is to show developers how to set up their build environment in order to effectively use the FlyCapture library for developing DirectShow-based applications. This TAN will explain how to prepare the build environment so that sample image capture applications included in the SDK, such as AMCap and PlayCap, can be built successfully. Once this is completed, the environment will be ready for use with custom applications.

The main steps are:

  1. Install the Point Grey FlyCapture SDK
  2. Install the Microsoft DirectX® SDK
  3. Install the Microsoft Windows Server 2003 R2 Platform SDK
  4. Build the DirectShow base classes
  5. Use the DirectShow base classes

 

Installing the FlyCapture SDK

The latest version of the FlyCapture SDK can be found on the downloads page. Run FlyCapture2_x86.exe or FlyCapture2_x64.exe and follow the installation wizard instructions to install the library.

The DirectShow components for FlyCapture2 consist of two DirectShow filters:

  • PGRDirectShowDecoder.ax
  • PGRDirectShowSource.ax
These components can be registered by entering the following command at a command prompt:
 
regsvr32 PGRDirectShowDecoder.ax PGRDirectShowSource.ax

In addition, the FlyCapture2 DLLs must be present on the system in a location that can be found during registration. This can be achieved by placing the required DLLs in the same directory as the .ax filter files.

 

Installing the DirectX® SDK

The DirectX SDK contains a header file (ddraw.h) that is required to build the DirectShow Base Classes. Obtain the latest version of the SDK from either a current MSDN subscription (if available) or by downloading it from Microsoft.

The DirectX installer extracts the files to a temporary location before performing the installation. Installing with the default options is sufficient.

 

Installing the Platform SDK

Obtain the source code for the DirectShow SDK by installing the Microsoft Windows Server 2003 R2 Platform SDK from a current MSDN subscription (if available) or by downloading it from Microsoft.

Run the Setup.exe program and follow the instructions in the installer. Make sure that the Microsoft DirectShow SDK is selected for install.

Building the DirectShow Base Classes

Downloading the Visual Studio Project Files

When the DirectShow SDK is moved from the DirectX SDK to the Platform SDK, the Visual Studio project files for building the Base Classes or any of the sample applications are removed. Download the v0.2 project files from https://msdn.microsoft.com/en-us/library/windows/desktop/dd407279(v=vs.85).aspx, which contain the proper project files for the R2 version of the Platform SDK.

Extract the project files into the installation directory of the Platform SDK. For example, if the default installation directory is used, then they should be extracted to C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Samples\Multimedia\DirectShow.

Adding DirectX and Platform SDK paths to Visual Studio 2005

 

The steps outlined in the following section require Microsoft Visual Studio 2005. Support for Visual Studio 6.0 was removed in the October 2004 edition of the DirectX SDK. It may be possible to use the free Visual Studio Express Edition from Microsoft; however, this has not been tested by Point Grey.

In order for Visual Studio 2005 to find the correct header files, the path to both SDKs must be entered into the IDE. Follow these steps to set the path:

  1. Click on the Tools entry on the menu bar and select Options.
  2. Select Projects and Solutions > VC++ directories from the tree list menu.
  3. Ensure that the Platform currently active is Win32.
  4. Change the Show Directories for: combo box so that Include Files is shown.
  5. Enter the following entries (see Figure 1):
    1. C:\Program Files\Microsoft DirectX SDK (December 2006)\Include
    2. C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include
  6. Change the Show Directories for: combo box so that Library files is shown.
  7. Enter the following entries (see Figure 2):
    1. C:\Program Files\Microsoft DirectX SDK (December 2006)\Lib\x86
    2. C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Lib


Figure 1: Visual Studio “Include files” directories for DirectX


Figure 2: Visual Studio "Library files" directories for DirectX

Building the Base Classes

Load the solution file baseclasses.sln, which should be located in C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Samples\Multimedia\DirectShow\BaseClasses. If the IDE used to load the solution is Visual Studio 2005, a prompt should appear asking if it should proceed with converting the solution. Answer Yes to convert the solution.

The project builds two versions of the library: the retail (strmbase.lib) and debug (strmbasd.lib) versions. Unicode versions are also available if localization is required.

 

Using the DirectShow Base Classes

Setting Environment Variables

In order to build the sample DirectShow applications, the $BASECLASSES environment variable must be set.

Follow these steps to set the variable:

  1. Navigate to the System Properties page by right clicking on My Computer and then selecting Properties.
  2. Click on the Advanced tab, and click the Environment Variables button.
  3. Click the New button under System Variables.
  4. In the dialog box that appears, enter BASECLASSES as the variable name, and the path to the Base Classes as the value. This should typically be C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Samples\Multimedia\DirectShow\BaseClasses\.
  5. Click Ok to save the variable.
  6. Reboot the PC so that the environment variable can be loaded.

Configuring Project Settings

Load a solution file containing a sample application. The PlayCap sample capture application will be used for this example.

  1. Open the PlayCap solution file, located in
    C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Samples\Multimedia\DirectShow\Capture\PlayCap.
  1. Right click the PlayCap project and select Properties to enter the property pages for the project.
  1. Under Linker ->General ->Additional Library Dependencies, ensure that the following entry is present:
    "$(BASECLASSES)"\Release; (or "$(BASECLASSES)"\Debug; for debug builds)
  1. Under Linker -> Input -> Additional Dependencies, ensure that the following entries are present:

StrmBase.lib (or StrmBasd.lib, depending on the build type)
quartz.lib
odbc32.lib
odbccp32.lib

With these settings in place, the sample application should build successfully.

Building Custom DirectShow Applications

When building custom DirectShow applications, the following header files should be included:

  • Streams.h
  • Dshow.h

Some DirectShow interfaces may require additional header files; these will be listed in the interface reference.

The following libraries should be included:

  • strmbase.lib (or strmbasd.lib)
  • quartz.lib