Developing Microsoft® DirectShow® applications with FlyCapture®
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
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 Teledyne FLIR. |
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:
- Click on the Tools entry on the menu bar and select Options.
- Select Projects and Solutions > VC++ directories from the tree list menu.
- Ensure that the Platform currently active is Win32.
- Change the Show Directories for: combo box so that Include Files is shown.
- Enter the following entries (see Figure 1):
a. C:\Program Files\Microsoft DirectX SDK (December 2006)\Include
b. 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):
a. C:\Program Files\Microsoft DirectX SDK (December 2006)\Lib\x86
b. 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:
- Navigate to the System Properties page by right clicking on My Computer and then selecting Properties.
- Click on the Advanced tab, and click the Environment Variables button.
- Click the New button under System Variables.
- 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\.
- Click Ok to save the variable.
- 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.
- Open the PlayCap solution file, located in
C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Samples\Multimedia\DirectShow\Capture\PlayCap.
- Right click the PlayCap project and select Properties to enter the property pages for the project.
- Under Linker ->General ->Additional Library Dependencies, ensure that the following entry is present:
"$(BASECLASSES)"\Release; (or "$(BASECLASSES)"\Debug; for debug builds)
- 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