GStreamer应用开发手册
Foreword 前言
安装GStreamer
在linux系统上安装
教程
基础教程
基础教程 1:世界你好!
基础教程 2:GStreamer 概念
基础教程 3:动态管道
Plugin 写作指南
导言
序言
基础
编写插件
构建模板
-
+
首页
序言
# What is GStreamer? # 什么是 GStreamer? 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, 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 最明显的用途之一就是用来制作媒体播放器。GStreamer 已经包含了构建媒体播放器的组件,可以支持多种格式,包括 MP3、Ogg/Vorbis、MPEG-1/2、AVI、Quicktime、mod 等。然而,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 的核心功能是为插件、数据流、同步和媒体类型处理/协商提供一个框架。它还提供了一个应用程序接口,以便使用各种插件编写应用程序。 # Who Should Read This Guide? # 谁应该阅读本指南? 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. 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. 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 的现有功能,或者只想使用一个使用 GStreamer 的应用程序,那么本指南与你无关。如果你只对使用现有插件编写新程序感兴趣--现在已经有很多插件了--你可能需要查阅《GStreamer 应用程序开发手册》。如果你只是想获得 GStreamer 应用程序的帮助,那么你应该查看该应用程序的用户手册。 # Preliminary Reading # 初步阅读 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 遵循 GObjectprogramming 模型,本指南也假定您了解 GObjectprogramming 的基础知识。您可能还想看看 Eric Harlow 的《使用 GTK+ 和 GDK 开发 Linux 应用程序》(Developing Linux Applications with GTK+ and GDK)一书。 # Structure of This Guide # 本指南的结构 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 插件开发有关的特定广泛主题。本指南各部分的顺序如下: * Building a Plugin - Introduction to the structure of a plugin, using an example audio filter for illustration. * 构建插件 - 介绍插件的结构,以音频过滤器为例进行说明。 > This part covers all the basic steps you generally need to perform to build a plugin, such as registering the element with GStreamer and setting up the basics so it can receive data from and send data to neighbour elements. The discussion begins by giving examples of generating the basic structures and registering an element in Constructing the Boilerplate. Then, you will learn how to write the code to get a basic filter plugin working in Specifying the pads, The chain function and What are states?. > 本部分涵盖了构建插件通常需要执行的所有基本步骤,例如向 GStreamer 注册元素和设置基本结构,以便从相邻元素接收数据和向相邻元素发送数据。讨论开始时,我们将举例说明如何在 "构建模板"(Constructing the Boilerplate)中生成基本结构和注册元素。然后,您将学习如何编写代码,以便在指定垫、链功能和什么是状态中使用基本的过滤器插件。 > After that, we will show some of the GObject concepts on how to make an element configurable for applications and how to do application-element interaction in Adding Properties and Signals. Next, you will learn to build a quick test application to test all that you've just learned in Building a Test Application. We will just touch upon basics here. For full-blown application development, you should look at the Application Development Manual. > 之后,我们将在 "添加属性和信号"(AddingProperties and Signals)中展示一些 GObject 概念,包括如何为应用程序配置元素,以及如何进行应用程序与元素之间的交互。接下来,您将学习如何构建一个快速测试应用程序,以测试您在 "构建测试应用程序 "中学到的所有知识。在这里,我们将只介绍基础知识。如需全面了解应用程序的开发,请参阅《应用程序开发手册》。 * Advanced Filter Concepts - Information on advanced features of GStreamer plugin development. * 高级过滤器概念 - 有关 GStreamer 插件开发高级功能的信息。 > After learning about the basic steps, you should be able to create a functional audio or video filter plugin with some nice features. However, GStreamer offers more for plugin writers. This part of the guide includes chapters on more advanced topics, such as scheduling, media type definitions in GStreamer, clocks, interfaces and tagging. Since these features are purpose-specific, you can read them in any order, most of them don't require knowledge from other sections. > 在学习了基本步骤之后,你应该能够创建一个具有一些不错功能的音频或视频过滤插件。然而,GStreamer 为插件编写者提供了更多。这部分指南包含了更多高级主题的章节,如 GStreamer 中的调度、媒体类型定义、时钟、接口和标记。 > The first chapter, named Different scheduling modes, will explain some of the basics of element scheduling. It is not very in-depth, but is mostly some sort of an introduction on why other things work as they do. Read this chapter if you're interested in GStreamer internals. Next, we will apply this knowledge and discuss another type of data transmission than what you learned in The chain function: Different scheduling modes. Loop-based elements will give you more control over input rate. This is useful when writing, for example, muxers or demuxers. > 第一章名为 "不同的调度模式",将解释元素调度的一些基础知识。这一章的内容并不深入,主要是介绍其他事物的工作原理。如果你对 GStreamer 的内部结构感兴趣,可以阅读这一章。接下来,我们将运用这些知识,讨论比在《链式函数》中学到的知识更多的另一种数据传输类型:差分调度模式。基于循环的元素可以让你更多地控制输入速率。这在编写多路复用器或解多路复用器时非常有用。 > Next, we will discuss media identification in GStreamer in Media Types and Properties. You will learn how to define new media types and get to know a list of standard media types defined in GStreamer. > 接下来,我们将在媒体类型和属性中讨论 GStreamer 中的媒体识别。你将学会如何定义新的媒体类型,并了解 GStreamer 中定义的标准媒体类型列表。 > In the next chapter, you will learn the concept of request- and sometimes-pads, which are pads that are created dynamically, either because the application asked for it (request) or because the media stream requires it (sometimes). This will be in Request and Sometimes pads. > 在下一章中,你将学习 "请求 "和 "有时 "焊盘的概念,它们是动态创建的焊盘,要么是因为应用程序要求(请求),要么是因为媒体流需要(有时)。这将在 "请求和有时垫 "中介绍。 > The next chapter, Clocking, will explain the concept of clocks in GStreamer. You need this information when you want to know how elements should achieve audio/video synchronization. > 下一章 "时钟 "将解释 GStreamer 中时钟的概念。当你想知道元素应如何实现音频/视频同步时,就需要这些信息。 > The next few chapters will discuss advanced ways of doing application-element interaction. Previously, we learned on the GObject-ways of doing this in Adding Properties and Signals. We will discuss dynamic parameters, which are a way of defining element behaviour over time in advance, in Supporting Dynamic Parameters. Next, you will learn about interfaces in Interfaces. Interfaces are very target- specific ways of application-element interaction, based on GObject's GInterface. Lastly, you will learn about how metadata is handled in GStreamer in Tagging (Metadata and Streaminfo). > 接下来的几章将讨论应用程序与元素交互的高级方法。在此之前,我们已在《添加属性和信号》一书中学习了如何使用 GObject 进行交互。我们将在《支持动态参数》中讨论动态参数,这是一种提前定义元素行为的方法。接下来,您将在《接口》中了解接口的相关知识。最后,您将在《标记(元数据和流信息)》中了解 GStreamer 如何处理元数据。 > The last chapter, Events: Seeking, Navigation and More, will discuss the concept of events in GStreamer. Events are another way of doing application-element interaction. They take care of seeking, for example. They are also yet another way in which elements interact with each other, such as letting each other know about media stream discontinuities, forwarding tags inside a pipeline and so on. > 最后一章是事件:寻找、导航和其他》将讨论 GStreamer 中的事件概念。事件是应用程序与元素交互的另一种方式。例如,事件可以处理寻路问题。它们也是元素之间进行交互的另一种方式,例如让对方了解媒体流的不连续性、在管道内转发标签等等。 * Creating special element types - Explanation of writing other plugin types. * 创建特殊元素类型 - 其他插件类型的编写说明。 > Because the first two parts of the guide use an audio filter as an example, the concepts introduced apply to filter plugins. But many of the concepts apply equally to other plugin types, including sources, sinks, and autopluggers. This part of the guide presents the issues that arise when working on these more specialized plugin types. The chapter starts with a special focus on elements that can be written using a base-class (Pre-made base classes), and later also goes into writing special types of elements in Writing a Demuxer or Parser, Writing a N-to-1 Element or Muxer and Writing a Manager. > 本指南的前两部分以音频滤波器为例,介绍了适用于滤波器插件的概念。但许多概念同样适用于其他插件类型,包括源、汇和自动插件。本指南的这一部分介绍了在处理这些更专业的插件类型时出现的问题。本章首先特别关注可以使用基类(预制基类)编写的元素,随后还将介绍编写解复用器或解析器、编写 N 对 1 元素或复用器以及编写管理器等特殊类型的元素。 * Appendices - Further information for plugin developers. * 附录 - 为插件开发人员提供的更多信息。 > The appendices contain some information that stubbornly refuses to fit cleanly in other sections of the guide. Most of this section is not yet finished. > 附录中包含一些信息,这些信息顽固地拒绝与指南中的其他部分完全匹配。本部分的大部分内容尚未完成。 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 插件开发所涉及的基本概念,包括元素和插件、Pads、GstMiniObject、缓冲区和事件以及媒体类型和属性。如果你已经熟悉了这些信息,你可以使用这个简短的概述来恢复记忆,也可以跳到构建插件部分。 As you can see, there's a lot to learn, so let's get started! 正如您所看到的,要学的东西很多,让我们开始吧! * Creating compound and complex elements by extending from a GstBin. This will allow you to create plugins that have other plugins embedded in them. * 通过从 GstBin 扩展,创建复合和复杂元素。这将使您能够创建内嵌其他插件的插件。 * Adding new media types to the registry along with typedetect functions. This will allow your plugin to operate on a completely new media type. * 将新媒体类型与 typedetectfunctions 一起添加到注册表中。这样,您的插件就可以在全新的媒体类型上运行。
admin
2024年5月1日 19:26
转发文档
收藏文档
上一篇
下一篇
手机扫码
复制链接
手机扫一扫转发分享
复制链接
Markdown文件
分享
链接
类型
密码
更新密码