GStreamer 是 GNOME 桌面环境下用来构建流媒体应用的编程框架(framework),其目标是要简化音/视频应用程序的开发,目前已经能够被用来处理像 MP3、Ogg、MPEG1、MPEG2、AVI、Quicktime 等多种格式的多媒体数据。
GStreamer 作为 GNOME 桌面环境推荐的流媒体应用框架,采用了基于插件(plugin)和管道(pipeline)的体系结构,框架中的所有的功能模块都被实现成可以插拔的组件(component),并且在需要的时候能够很方便地安装到任意一个管道上,由于所有插件都通过管道机制进行统一的数据交换,因此很容易利用已有的各种插件“组装”出一个功能完善的多媒体应用程序。
对于需要应用 GStreamer 框架的程序员来讲,GstElement 是一个必须理解的概念,因为它是组成管道的基本构件,也是框架中所有可用组件的基础,这也难怪 GStreamer 框架中的大部分函数都会涉及到对 GstElement 对象的操作。从 GStreamer 自身的观点来看,GstElement 可以描述为一个具有特定属性的黑盒子,它通过连接点(link point)与外界进行交互,向框架中的其余部分表征自己的特性或者功能。
按照各自功能上的差异,GStreamer 又将 GstElement 细分成如下几类:
- Source Element 数据源元件 只有输出端,它仅能用来产生供管道消费的数据,而不能对数据做任何处理。一个典型的数据源元件的例子是音频捕获单元,它负责从声卡读取原始的音频数据,然后作为数据源提供给其它模块使用。
- Filter Element 过滤器元件 既有输入端又有输出端,它从输入端获得相应的数据,并在经过特殊处理之后传递给输出端。一个典型的过滤器元件的例子是音频编码单元,它首先从外界获得音频数据,然后根据特定的压缩算法对其进行编码,最后再将编码后的结果提供给其它模块使用。
- Sink Element 接收器元件 只有输入端,它仅具有消费数据的能力,是整条媒体管道的终端。一个典型的接收器元件的例子是音频回放单元,它负责将接收到的数据写到声卡上,通常这也是音频处理过程中的最后一个环节。
http://www.ibm.com/developerworks/cn/linux/l-gstreamer/
Introducing GStreamer
http://www.cin.ufpe.br/~cinlug/wiki/index.php/Introducing_GStreamer
Conclusion
I hope this have worth the read and that you understand the idea behind GStreamer and how he can make a solid basis for multimedia application development. And now you can convert and play your media files.
For more of gst-launch possibilities, see:
- gst-launch man page
- http://gstreamer.freedesktop.org/data/doc/gstreamer/head/faq/html/chapter-using.html
The official site is one of the best sources of information about GStreamer, from where I highlight:
-
GStreamer Application Development Manual
- http://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/index.html GStreamer Plugin Writer's Guide
- http://gstreamer.freedesktop.org/data/doc/gstreamer/head/pwg/html/
In The Land of Monolithic Media Players
So, let's see the media players. The next picture shows a diagram of three video players very well known: Xine, MPlayer e VLC.
What we see here is clear, and not promising for multimedia in Linux, each one implements the same functionalities in his own manner, efforts are duplicated, there is no cooperation, and the "cool features for the user" can only be implemented when all the infrastructure starts to work. And to make things worse, with each one using his own plugin infrastructure, codecs ported to one will not work with other. Not without weeping and gnashing of teeth. And this examples deal only with video players, if we include audio players, video and audio editors, the hopes of Linux as an attractive platform to both home users and multimedia professionals, goes down the toilet, passing through the arena of the portable devices - where the competition with M$ and other proprietary software companies its more fierce. Not that the mentioned application aren't good, contrary to this, they are excelent, some of them have libraries to creation of other apps. But these libraries are very specific to decode media, and if I want to create an editor? We will need to use another API: more time, more duplicated efforts, and this way it goes on. doing
GStreamer
Repeating: GStreamer is a framework for development of multimedia streaming application. We'll talk about the "multimedia stream" in another moment, for now look at the next picture presents a view that, even superficial, will give us an initial idea of where GStreamer is positioned in the great scheme of the things.
GStreamer provides an abstraction layer over components to manipulate any kind of format to which exists an installed plugin. The applications don't need to worry in implementing decoders, mixers, sync nor codecs, they can concentrate only in the "cool features for the user", what means better apps and happier people. :)
GStreamer is also multiplatform, and was seen in x86 Linux, PPC, ARM, x86 Solaris and SPARC, MacOSX, Microsoft Windows and IBM OS/400.
See a complete list of features in: http://gstreamer.freedesktop.org/features