2000-12-30 15:36:24 +00:00
|
|
|
<!DOCTYPE book PUBLIC "-//GNOME//DTD DocBook PNG Variant V1.0//EN" "" [
|
2001-01-07 00:12:46 +00:00
|
|
|
<!ENTITY TITLEPAGE SYSTEM "titlepage.sgml">
|
|
|
|
|
2000-12-30 15:36:24 +00:00
|
|
|
<!ENTITY INTRO SYSTEM "intro.sgml">
|
2001-01-07 02:23:40 +00:00
|
|
|
|
|
|
|
<!ENTITY CONCEPTS SYSTEM "concepts.sgml">
|
2001-01-08 01:21:18 +00:00
|
|
|
|
2001-01-08 23:55:27 +00:00
|
|
|
<!ENTITY FIRSTPLUGIN SYSTEM "firstplugin.sgml">
|
2001-01-08 01:21:18 +00:00
|
|
|
|
|
|
|
<!ENTITY TESTAPP SYSTEM ".sgml">
|
|
|
|
|
|
|
|
<!ENTITY LOOPBASED SYSTEM ".sgml">
|
|
|
|
|
|
|
|
<!ENTITY TYPESNPROPS SYSTEM ".sgml">
|
|
|
|
|
|
|
|
<!ENTITY BUFFERS SYSTEM ".sgml">
|
|
|
|
|
|
|
|
<!ENTITY SRCNSINK SYSTEM ".sgml">
|
|
|
|
|
|
|
|
<!ENTITY STATEMANAGE SYSTEM ".sgml">
|
|
|
|
|
|
|
|
<!ENTITY CHECKLIST SYSTEM ".sgml">
|
2000-12-30 15:36:24 +00:00
|
|
|
]>
|
|
|
|
|
|
|
|
<book id="index">
|
2001-01-07 00:12:46 +00:00
|
|
|
&TITLEPAGE;
|
2000-12-30 15:36:24 +00:00
|
|
|
|
2001-01-08 01:21:18 +00:00
|
|
|
<!-- ############# part ############### -->
|
2000-12-30 15:36:24 +00:00
|
|
|
|
2001-01-07 02:23:40 +00:00
|
|
|
<part id="introduction"><title>Introduction</title>
|
2000-12-30 15:36:24 +00:00
|
|
|
<partintro>
|
2001-01-07 00:12:46 +00:00
|
|
|
<para>
|
2001-01-07 02:23:40 +00:00
|
|
|
<application>GStreamer</application> is a framework for creating
|
|
|
|
streaming media applications. It is extremely powerful and versatile,
|
|
|
|
and this versatility stems in part from its modularity, and its ability
|
|
|
|
to incorporate new modules seamlessly into its framework.
|
2001-01-07 00:12:46 +00:00
|
|
|
This document describes how to extend the capabilities of
|
|
|
|
<application>GStreamer</application> by creating new plugins.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
It first describes the concepts required and the ways in which
|
|
|
|
<application>GStreamer</application> can be extended. It then goes
|
|
|
|
through a worked example of how to write a simple filter (for data
|
|
|
|
processing), and how to test and debug it. More advanced concepts are
|
|
|
|
then introduced, with worked examples of each. Next, writing source
|
|
|
|
and sink elements (for performing input and output) is discussed.
|
|
|
|
Finally, checklists of things to be sure to do when extending
|
|
|
|
<application>GStreamer</application> are presented.
|
2000-12-30 15:36:24 +00:00
|
|
|
</para>
|
|
|
|
</partintro>
|
|
|
|
|
|
|
|
&INTRO;
|
|
|
|
</part>
|
|
|
|
|
2001-01-08 01:21:18 +00:00
|
|
|
<!-- ############ part ############# -->
|
2000-12-30 15:36:24 +00:00
|
|
|
|
|
|
|
<part id="basic-concepts"><title>Basic concepts</title>
|
|
|
|
<partintro>
|
2001-01-07 00:12:46 +00:00
|
|
|
<para>
|
|
|
|
|
2001-01-07 02:23:40 +00:00
|
|
|
This section introduces the basic concepts required to understand the
|
|
|
|
issues involved in extending <application>GStreamer</application>
|
|
|
|
|
2000-12-30 15:36:24 +00:00
|
|
|
</para>
|
|
|
|
</partintro>
|
|
|
|
|
2001-01-07 02:23:40 +00:00
|
|
|
&CONCEPTS;
|
2001-01-07 00:12:46 +00:00
|
|
|
|
2000-12-30 15:36:24 +00:00
|
|
|
</part>
|
|
|
|
|
2001-01-08 01:21:18 +00:00
|
|
|
<!-- ############ part ############# -->
|
2001-01-07 00:12:46 +00:00
|
|
|
|
2001-01-08 01:21:18 +00:00
|
|
|
<part id="first-plugin"><title>Building our first plugin</title>
|
|
|
|
<partintro>
|
|
|
|
<para>
|
|
|
|
We are now have the neccessary concepts to build our first plugin.
|
|
|
|
We are going to build an element which has a single input pad and
|
|
|
|
a single output pad, and simply passes anything it reads on
|
2001-01-08 23:55:27 +00:00
|
|
|
the input pad through and out on the output pad. We will also
|
|
|
|
see where we could add code to convert this plugin into something
|
|
|
|
more useful.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
The example code used in this section can be found in
|
|
|
|
<filename>examples/plugins/</filename>
|
2001-01-08 01:21:18 +00:00
|
|
|
</para>
|
|
|
|
</partintro>
|
2001-01-07 00:12:46 +00:00
|
|
|
|
2001-01-08 01:21:18 +00:00
|
|
|
&FIRSTPLUGIN;
|
2001-01-07 00:12:46 +00:00
|
|
|
|
2001-01-08 01:21:18 +00:00
|
|
|
</part>
|
|
|
|
|
|
|
|
<!-- ############ part ############# -->
|
|
|
|
|
|
|
|
<part id="test-app"><title>Building a simple test application</title>
|
|
|
|
<partintro>
|
|
|
|
<para>
|
|
|
|
</para>
|
|
|
|
</partintro>
|
|
|
|
|
|
|
|
&TESTAPP;
|
2001-01-07 00:12:46 +00:00
|
|
|
Initialization
|
|
|
|
Instantiating the plugins
|
|
|
|
(NOTE: we really should have a debugging Sink)
|
|
|
|
Connecting them
|
|
|
|
Running the pipeline
|
2001-01-08 01:21:18 +00:00
|
|
|
</part>
|
|
|
|
|
|
|
|
<!-- ############ part ############# -->
|
|
|
|
|
|
|
|
<part id="loopbased"><title>Loop-based Elements</title>
|
|
|
|
<partintro>
|
|
|
|
<para>
|
|
|
|
</para>
|
|
|
|
</partintro>
|
|
|
|
|
|
|
|
&LOOPBASED;
|
2001-01-07 00:12:46 +00:00
|
|
|
How scheduling works, aka pushing and pulling
|
|
|
|
How a loopfunc works, aka pulling and pushing
|
|
|
|
Adding a second output
|
|
|
|
Identity is now a tee
|
|
|
|
Modifying the test application
|
2001-01-08 01:21:18 +00:00
|
|
|
</part>
|
|
|
|
|
|
|
|
<!-- ############ part ############# -->
|
|
|
|
|
|
|
|
<part id="typesnprops"><title>Types and Properties</title>
|
|
|
|
<partintro>
|
|
|
|
<para>
|
|
|
|
</para>
|
|
|
|
</partintro>
|
|
|
|
|
|
|
|
&TYPESNPROPS;
|
2001-01-07 00:12:46 +00:00
|
|
|
Building a simple format for testing
|
|
|
|
A simple MIME type
|
|
|
|
Type properties
|
2001-01-08 01:21:18 +00:00
|
|
|
Typefind functions and autoplugging
|
|
|
|
</part>
|
|
|
|
|
|
|
|
<!-- ############ part ############# -->
|
|
|
|
|
|
|
|
<part id="buffersnmeta"><title>Buffers and Metadata</title>
|
|
|
|
<partintro>
|
|
|
|
<para>
|
|
|
|
</para>
|
|
|
|
</partintro>
|
|
|
|
|
|
|
|
&BUFFERS;
|
2001-01-07 00:12:46 +00:00
|
|
|
Anatomy of a Buffer
|
|
|
|
Refcounts and mutability
|
|
|
|
Metadata
|
|
|
|
How Properties work efficiently
|
|
|
|
Metadata mutability
|
|
|
|
(FIXME: this is an unsolved problem)
|
2001-01-08 01:21:18 +00:00
|
|
|
</part>
|
|
|
|
|
|
|
|
<!-- ############ part ############# -->
|
|
|
|
|
|
|
|
<part id="srcnsink"><title>Sources and Sinks</title>
|
|
|
|
<partintro>
|
|
|
|
<para>
|
|
|
|
</para>
|
|
|
|
</partintro>
|
|
|
|
|
|
|
|
&SRCNSINK;
|
2001-01-07 00:12:46 +00:00
|
|
|
Writing a source
|
|
|
|
Pull vs loop based
|
|
|
|
Region pulling
|
|
|
|
(NOTE: somewhere explain how filters use this)
|
|
|
|
Writing a sink
|
|
|
|
Gee, that was easy
|
2001-01-08 01:21:18 +00:00
|
|
|
</part>
|
|
|
|
|
|
|
|
<!-- ############ part ############# -->
|
|
|
|
|
|
|
|
<part id="statemanage"><title>State management</title>
|
|
|
|
<partintro>
|
|
|
|
<para>
|
|
|
|
</para>
|
|
|
|
</partintro>
|
|
|
|
|
|
|
|
&STATEMANAGE;
|
2001-01-07 00:12:46 +00:00
|
|
|
What are states?
|
|
|
|
Mangaging filter state
|
2001-01-08 01:21:18 +00:00
|
|
|
</part>
|
|
|
|
|
|
|
|
<!-- ############ part ############# -->
|
|
|
|
|
|
|
|
<part id="checklist"><title>Checklist</title>
|
|
|
|
<partintro>
|
|
|
|
<para>
|
|
|
|
</para>
|
|
|
|
</partintro>
|
|
|
|
|
|
|
|
&CHECKLIST;
|
2001-01-07 00:12:46 +00:00
|
|
|
Things to check when writing a filter
|
|
|
|
Things to check when writing a source or sink
|
2001-01-08 01:21:18 +00:00
|
|
|
</part>
|
|
|
|
|
|
|
|
</book>
|
|
|
|
|
|
|
|
|
2001-01-07 00:12:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
=====
|
|
|
|
|
|
|
|
Omega: a chain-based element has chain functions on each sink pad, the
|
|
|
|
connected source pad may directly call (i.e. on the stack) the chain
|
|
|
|
function
|
|
|
|
Omega: each chain function is responsible for doing something useful,
|
|
|
|
generally processing the buffer and pushing out the other end
|
|
|
|
Omega: a loop-based element has a single function attatched to the element
|
|
|
|
(not tha pads) that spins in a loop calling gst_pad_pull(sinkpad),
|
|
|
|
do stuff, gst_pad_push(srcpad)
|
|
|
|
|