To develop applications using the GStreamer SDK for Windows you will need Windows XP or later.
The GStreamer SDK includes C headers (.h) and library files (.lib) valid for any version of Microsoft Visual Studio. For convenience, property pages (.props) are also included which extremely simplify creating new projects. These property pages, though, only work with Microsoft Visual Studio 2010 (including the free Visual C++ Express edition).
Installing the SDK for 32-bits platforms requires approximately 286MB of free disk space for the runtime and 207MB for the development files.
Installing the SDK for 64-bits platforms requires approximately 340MB of free disk space for the runtime and 216MB for the development files.
Download and install the SDK
There are 3 sets of files in the SDK:
- The runtime files are needed to run GStreamer applications. You probably want to distribute these files with your application (or the installer below).
- The development files are additional files you need to create GStreamer applications.
- The Merge Modules files are additional files you can use to deploy the GStreamer SDK alongside your application (see Windows deployment).
Get the Runtime and Development files installers appropriate for your architecture from here:
Due to the size of these files, usage of a Download Manager is highly recommended. Take a look at this list if you do not have one installed. If, after downloading, the installer reports itself as corrupt, chances are that the connection ended before the file was complete. A Download Manager will typically re-start the process and fetch the missing parts.
Execute the installers and choose an installation folder. The suggested default is usually OK.
If you plan to use Visual Studio, close it before installing the GStreamer SDK. The installer will define new environment variables which will not be picked up by Visual Studio if it is open.
Configure your development environment
Building the tutorials
The tutorial's code, along with project files and a solution file for Visual Studio 2010 are all included in the SDK, in the
%GSTREAMER_SDK_ROOT_X86% is an environment variable that the installer defined for you, and points to the installation folder of the SDK.
In order to prevent accidental modification of the original code, and to make sure Visual Studio has the necessary permissions to write the output files, copy the entire
tutorials folder to a place of your liking, and work from there.
Make sure you select the Solution Configuration that matches the GStreamer SDK that you have installed:
You can fire up Visual Studio 2010 and load your copy of the
tutorials.sln solution file (Click on the screen shots to enlarge them).
Hit F7, press the Build Solution button or go to Build → Build Solution. All projects should build without problems.
Running the tutorials
It is the application's responsibility to ensure that, at runtime, GStreamer can access its libraries and plugins. It can be done by adding
bin to the
PATH environment variable, or running from this same folder.
In order to run the tutorials, we will set the current working directory to
bin in the Debugging section of the project properties. This property is not stored in the project files, so you will need to manually add it to every tutorial you want to run from within Visual Studio. Right click on a project in the Solution Explorer, Properties → Debugging → Working Directory, and type
$(...) notation is required to access environment variables from within Visual Studio. You use the
%...% notation from Windows Explorer)
You should now be able to run the tutorials.
Creating new projects manually
If you want to create 64-bit applications, remember also to create x64 Solution and Project configurations as explained here.
Include the necessary SDK Property Sheet
The included property sheets make creating new projects extremely easy. In Visual Studio 2010 create a new project (Normally a
Win32 Console or
Win32 Application). Then go to the Property Manager (View→Property Manager), right-click on your project and select “Add Existing Property Sheet...”. Navigate to
share\vs\2010\libs and load
This property sheet contains the directories where the headers and libraries are located, and the necessary options for the compiler and linker, so you do not need to change anything else in your project.
If you cannot find the Property Manager, you might need to enable Expert Settings. Go to Tools → Settings → Expert Settings. Upon first installation of Visual Studio, Expert Settings are disabled by default.
Depending on the GStreamer libraries you need to use, you will have to add more property pages, besides
The tutorial's project files already contain all necessary property pages. When developing your own applications, the GStreamer documentation will tell you what library a function belongs to, and therefore, what property pages you need to add.
Remove the dependency with the Visual Studio runtime
At this point, you have a working environment, which you can test by running the tutorials. However, there is a last step remaining.
Applications built with Visual C++ 2010 depend on the Visual C++ 2010 Runtime, which is a DLL that gets installed when you install Visual Studio. If you were to distribute your application, you would need to distribute this DLL with it (What is known as the Visual C++ 2010 Redistributable Package). This happens with every version of Visual Studio, and the Runtime DLL is different for every version of Visual Studio.
Furthermore, GStreamer itself is built using a “basic” C runtime which comes in every Windows system since Windows XP, and is named
MSVCRT.DLL. If your application and GStreamer do not use the same C Runtime, problems are bound to crop out.
In order to avoid these issues you must instruct your application to use the system's C Runtime. First install the Windows Device Driver Kit Version 7.1.0 (DDK). When the installer asks about the features, select only “Build Environments”. Accept the suggested location for the installation, which is usually
C:\WinDDK\7600.16385.1. This download is an ISO file, you can either burn a DVD with it (as recommended in the Microsoft site. You will need DVD burning software), mount the file in a virtual DVD device (you will need DVD virtualization software) or unpack the file as if it was a regular compressed file (you will need decompression software that understands the ISO format).
Then, add the
x86_64.props (for 32 or 64 bits) property sheet found in
share\vs\2010\msvc to your project. This will make your application use the ubiquitous
MSVCRT.DLL saving you some troubles in the future.
If you did not install the WinDDK to the standard path
That's it. Accept the changes, right click on the
Creating new projects using the wizard
The GStreamer SDK for Windows contains a Visual Studio Wizard that helps creating new projects that use the SDK. However, due to development time constraints, the SDK Installer does not deploy the files to the Visual Studio folder. If you want to use the Wizard, you will need to install these files manually.
1. The three files in the
2. The entire
To clarify: you must end up with three additional files in the
Use the right path for your Visual Studio folder.
Go to File → New → Project… and you should find a template named GStreamer SDK Project. It takes no parameters, and sets all necessary project settings, both for 32 and 64 bits architectures.
The generated project file includes the two required Property Sheets described in the previous section, so, in order to link to the correct
MSVCRT.DLL, you still need to install the Windows Device Driver Kit.