Establish a gstreamer Development Environment on Windows

Source: Internet
Author: User
Tags gtk gstreamer

 

From: http://blog.sina.com.cn/s/blog_48f93b530100c4sq.html

 

Gstreamer is a cross-platform multimedia development framework (http://gstreamer.freedesktop.org/), but because of the mature DirectShow on the Windows platform, it is more sought after on the Linux platform, the position of DirectShow in Linux is also equal to that in windows. Many concepts in gstreamer are similar to those in DirectShow. Many designs also use DirectShow. It seems that the reason for applying it on Windows platforms is not found. However, after careful consideration, we will still find that the following benefits apply:

1. gstreamer is cross-platform. To develop more common applications, it is undoubtedly the most efficient framework at present;

2. The gstreamer framework is based on plug-ins. Development, expansion, and maintenance are all very convenient. Compared with the DirectShow COM framework, the plug-in is smaller and more flexible, more universal, and less restrictive;

3. gstreamer is pure C code development. It adopts the gobject programming mode and is attached to the glib2.0 object model. The compilation file is small and runs fast, and the rtii feature is added to the framework;

4. Many special designs: plug-ins and pipeline information can be stored in XML standard format, debugging and testing in the form of command lines, binding APIs in multiple languages, many special plug-ins, and gnonlin, special modules such as GST-Editor and GST-recorder;

5. Many excellent open-source projects built on the gstreamer framework provide us with excellent application examples. You may be able to develop one by yourself someday :)

Of course, gstreamer is also insufficient for DirectShow, and we need to continue to improve it.

Unfortunately, gstreamer Application and Development on the Windows platform is not very easy at present, especially for friends who do not know much about GNU development. If you only want to install the application, you can directly use the installation program provided by gstreamer, but the installation program is not updated with the code in a timely manner (there is a project called gstreamer winbuilds dedicated to doing this, I tried it as though it was not very useful). If you want to develop gstreamer, it is a very troublesome task. This article will discuss this issue.

To establish a gstreamer Development Environment on Windows, you need to configure the corresponding. DLL binary file ,. h header file and. lib library file, set system environment variables, and specify the path of the compilation link file for the development environment. Binary running files can be directly installed or compiled by yourself. The two commonly used compilers in the development environment are GCC and msvc. If GCC is used as the compiler, msys/mingw environment needs to be created on Windows. However, most Windows platform developers are familiar with msvc, which is described in this article.

1. Use oabuild to compile gstreamer (http://people.collabora.co.uk /~ Oleavr/oabuild /)
This method is recommended by the gstreamer Development Team. It can easily and quickly compile gstreamer, GTK +, D-bus, telepathy and other modules without installing the mingw/cygwin environment. Oabuild is a tool designed for Windows platform developers to develop open-source projects. It provides many GNU libraries with the binding of the. NTE environment in windows and can be compiled directly. After you install oabuild online using the bzr tool, run the bootstrap script to automatically call CVs or SVN to download the source code of the corresponding version of the library, and run the script through Python or Perl to complete the entire project.. Net project and environment configuration. After compilation, you can open oabuild. sln to obtain the required. h file,. Lib file, and. dll file. The oabuild project has two versions: V1
It is no longer maintained. It is used in msvs2005 and v2 in msvs2008. Currently, oabuild has been replaced by the OAH project. since my machine only has 05, I only tried V1, And the download of code from several libraries failed.

2. Use the installation file provided by gstreamer for installation and manually configure the Development Kit
Gstreamer provides the Win32 installation package. The procedure is as follows.
1. Download The GTK + 2.0 bundle package, which includes the third-party libraries on which GTK runs in windows, and the GTK + runtime files and Development kits. : Http://www.gtk.org/download-windows.html then decompress the file to a path and add the bin path to the path environment variable. Run the PKG-config -- cflags GTK +-2.0 command in shell, and then run the GTK-demo command. A test program is displayed to check whether the program can run normally. Create a file ETC/gtk-2.0/gtkrc and write GTK-theme-name
= "MS-Windows", save it.
2. Download the installation packages and Development Kits for each gstreamer module. : Http://gstreamer.freedesktop.org/pkg/windows/releases. The three necessary modules for gstreamer to run are gstreamer, GST-plugins-base, and GST-plugins-good. The installation package can be installed directly in sequence and automatically installed to C:/program files/common
Files/gstreamer, and set the bin path to the path environment variable. decompress the files in the include and Lib folders of all development kits to a unified path, it is used to set the path for loading the compilation link file for the compilation environment.
3. Download the libxml2 package. libxml2 is the XML operation toolkit developed for the gnome project. We want to download the Windows platform version. : Http://www.zlatkovic.com/pub/libxml. Copy the files in the bin directory to the bin folder in the gstreamer path, and decompress the files in the include and Lib folders to the include and Lib paths corresponding to the gstreamer.
4. Download The win_iconv package, which is used to complete character encoding conversion. : Http://www.gtk.org/download-windows.html. The Copy location of an object is the same as that of the object.
5. Download The libpng13.dll file. The version called in the latest gstreamer is different from that in the GTK package. You need to update it. : Http://www.zhaodll.com/dll/l/200607/321.html. Put it in the bin folder of the gstreamer path.

After completing the above work, all the files required for gstreamer development are available. The following is a simple example to illustrate the configuration of the msvc environment and the simple steps for gstreamer development.
1. In msvc2005, create a Win32 console project named ststest;
2. In the project properties, add the header file paths of gstreamer and GTK, and add the library file paths of gstreamer and GTK;
3. Add the header file paths of glib and glibconfig in the project properties, which are in the glib-2.0 folder under the include directory of GTK, and the/lib/glib-2.0/include folder under the GTK directory;
4. In the project properties, set the referenced gstreamer library file libgstreamer-xxx.lib, where XXX is the library version number, my is the libgstreamer-0.10.lib;
5. In the ststest. cpp file, add the statement # include <GST/GST. h> to access the gstreamer library function. The following is the main function code:
Int _ tmain (INT argc, _ tchar * argv [])
{
Const gchar * nano_str;
Guint major, minor, micro, nano;

Gst_init (& argc, & argv );

Ststst_version (& major, & minor, & micro, & nano );

If (nano = 1)
Nano_str = "(CVS )";
Else if (nano = 2)
Nano_str = "(prerelease )";
Else
Nano_str = "";

Printf ("this program is linked against gstreamer % d. % d. % d % s/n ",
Major, minor, micro, nano_str );

Return 0;
}
Running to get the running result
"This program is linked against gstreamer 0.10.14 (CVS )"

The above is the step to establish a gstreamer development environment on the Windows platform. I hope you can discuss gstreamer and make progress together!

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.