GStreamer is an extremely powerful and versatile framework for creating streaming media applications. Many of the virtues of the GStreamer framework come from its modularity: GStreamer can seamlessly incorporate new plugin modules. But because modularity and power often come at a cost of greater complexity (consider, for example, CORBA), writing new plugins is not always easy.
GStreamer是一个非常强大和通用的框架,用于创建流媒体应用程序。GStreamer框架的许多优点来自于它的模块化:GStreamer可以无缝地合并新的插件模块。但是,由于模块化和强大的功能通常以更大的复杂性为代价(例如,考虑CORBA),编写新插件并不容易。
This guide is intended to help you understand the GStreamer framework so you can develop new plugins to extend the existing functionality. The guide addresses most issues by following the development of an example plugin - an audio filter plugin - written in C. However, the later parts of the guide also present some issues involved in writing other types of plugins, and the end of the guide describes some of the Python bindings for GStreamer.
本指南旨在帮助您理解GStreamer框架,以便您可以开发新的插件来扩展现有的功能。本指南通过一个C语言编写的音频过滤器插件,来阐述与之相关的很多问题。当然,指南后续涉及到其他类型的插件编写的时候,也还存在一些问题。最后,指南描述了一些关于在GStreamer 进行Python绑定的内容。
GStreamer is a framework for creating streaming media applications. The fundamental design comes from the video pipeline at Oregon Graduate Institute, as well as some ideas from DirectShow.
GStreamer是一个用于创建流媒体应用程序的框架。基本设计源自俄勒冈研究生院的视频管道的思路,以及DirectShow的一些构想。
GStreamer’s development framework makes it possible to write any type of streaming multimedia application. The GStreamer framework is designed to make it easy to write applications that handle audio or video or both. It isn’t restricted to audio and video, and can process any kind of data flow. The pipeline design is made to have little overhead above what the applied filters induce. This makes GStreamer a good framework for designing even high-end audio applications which put high demands on latency or performance.
GStreamer的开发框架,能够编写任何类型的流媒体应用程序。GStreamer框架旨在很容易地编写处理音频或视频,或两者都处理的应用程序。它不局限于音频和视频,可以处理任何其它类型的数据流。管道设计的开销要比应用过滤器产生的开销小,这使得GStreamer成为针对延迟或性能有很高要求的、高端音频应用程序的框架。
One of the most obvious uses of GStreamer is using it to build a media player. GStreamer already includes components for building a media player that can support a very wide variety of formats, including MP3, Ogg/Vorbis, MPEG-1/2, AVI, Quicktime, mod, and more.
GStreamer最明显的用法之一是使用它来构建媒体播放器。GStreamer已经包含了用于构建媒体播放器的组件,它可以支持非常广泛的格式,包括MP3、Ogg/Vorbis、MPEG-1/2、AVI、Quicktime、mod等。
GStreamer, however, is much more than just another media player. Its main advantages are that the pluggable components can be mixed and matched into arbitrary pipelines so that it’s possible to write a full-fledged video or audio editing application.
当然,GStreamer不仅仅是一款媒体播放器。它的主要优点是可以将插件化的部件,混合并匹配到任意管道中,这样就可以编写一个完整的视频或音频编辑应用程序。
The framework is based on plugins that will provide the various codec and other functionality. The plugins can be linked and arranged in a pipeline. This pipeline defines the flow of the data.
该框架基于提供各种编解码器和其他功能的插件。这些插件可以在管道中排列并链接到一起,管道定义了数据流向。
The GStreamer core function is to provide a framework for plugins, data flow, synchronization and media type handling/negotiation. It also provides an API to write applications using the various plugins.
GStreamer的核心功能是为插件、数据流、同步和媒体类型处理/协商等,提供一个框架。它还提供了使用各种插件编写应用程序的API。
This guide explains how to write new modules for GStreamer. The guide is relevant to several groups of people:
本指南解释了如何为GStreamer编写新模块。该指南适用于以下几类人群:
Anyone who wants to add support for new ways of processing data in GStreamer. For example, a person in this group might want to create a new data format converter, a new visualization tool, or a new decoder or encoder.
想要在GStreamer中添加新的数据处理方式的人。例如,该组中的人员可能希望创建新的数据格式转换器、新的可视化工具或新的解码器或编码器。
Anyone who wants to add support for new input and output devices. For example, people in this group might want to add the ability to write to a new video output system or read data from a digital camera or special microphone.
想要添加新的输入和输出设备的人。例如,在视频输出系统添加写入的能力,或想从数码相机或特殊麦克风添加数据读取功能等。
Anyone who wants to extend GStreamer in any way. You need to have an understanding of how the plugin system works before you can understand the constraints that the plugin system places on the rest of the code. Also, you might be surprised after reading this at how much can be done with plugins.
想以任何方式扩展GStreamer的人。在理解插件系统对其余代码的约束之前,您需要先了解插件系统是如何工作的。此外,你可能会在阅读这篇文章后,对插件可以做多少事情感到惊讶。
This guide is not relevant to you if you only want to use the existing functionality of GStreamer, or if you just want to use an application that uses GStreamer.
如果您只想使用GStreamer的现有功能,或者只想使用GStreamer的应用程序,那么你没有必要阅读这份文档。
If you are only interested in using existing plugins to write a new application - and there are quite a lot of plugins already - you might want to check the GStreamer Application Development Manual. 如果您只对使用现有的插件来编写新的应用程序感兴趣——本来已经有相当多的插件了——您应该去看《GStreamer应用程序开发手册》。
If you are just trying to get help with a GStreamer application, then you should check with the user manual for that particular application.如果您只是想获得关于某特定的GStreamer应用程序的帮助,那么您应该查看该特定应用程序的用户手册。
This guide assumes that you are somewhat familiar with the basic workings of GStreamer. For a gentle introduction to programming concepts in GStreamer, you may wish to read the GStreamer Application Development Manual first. Also check out the other documentation available on the GStreamer web site.
在阅读本指南之前,您需要先对GStreamer的基本工作原理有所熟悉。建议您先阅读《GStreamer应用程序开发手册》,以及GStreamer网站上提供的其他文档,了解GStreamer编程的相关基础概念。
In order to understand this manual, you will need to have a basic understanding of the C language. Since GStreamer adheres to the GObject programming model, this guide also assumes that you understand the basics of GObject programming. You may also want to have a look at Eric Harlow’s book Developing Linux Applications with GTK+ and GDK.为了理解本手册,您需要对C语言有一个基本的了解。由于GStreamer遵循GObject编程模型,因此本指南还假设您理解GObject编程的基础知识。您还可以看看Eric Harlow的书《用GTK+和GDK开发Linux应用程序》。
To help you navigate through this guide, it is divided into several large parts. Each part addresses a particular broad topic concerning GStreamer plugin development. The parts of this guide are laid out in the following order:
为了帮助您浏览本指南,本文分为几个大的部分。每一部分都涉及一个GStreamer插件开发的特定主题。各部分的排列顺序如下:
The remainder of this introductory part of the guide presents a short overview of the basic concepts involved in GStreamer plugin development. Topics covered include Elements and Plugins, Pads, GstMiniObject, Buffers and Events and Media types and Properties. If you are already familiar with this information, you can use this short overview to refresh your memory, or you can skip to Building a Plugin.
本指南的导论部分简要概述了GStreamer插件开发中涉及的基本概念。主题包括元素Elements 和插件Plugins,衬垫Pads, GstMiniObject,缓冲区Buffers,Events ,媒体类型Media types和属性Properties。如果你已经对这些概念比较熟悉了,你可以简短的复习一下,或者跳过这部分直接开始开发插件。
As you can see, there’s a lot to learn, so let’s get started!
你看,学的东西还蛮多,我们开始吧!