2000-08-22 21:18:18 +00:00
|
|
|
<chapter id="cha-programs">
|
|
|
|
<title>Programs</title>
|
|
|
|
<para>
|
|
|
|
</para>
|
|
|
|
|
2000-09-09 16:36:10 +00:00
|
|
|
<sect1>
|
2002-04-07 23:32:16 +00:00
|
|
|
<title><command>gst-register</command></title>
|
2000-09-09 16:36:10 +00:00
|
|
|
<para>
|
2002-04-07 23:32:16 +00:00
|
|
|
<command>gst-register</command> is used to rebuild the database of plugins.
|
2000-09-09 16:36:10 +00:00
|
|
|
It is used after a new plugin has been added to the system. The plugin database
|
2002-04-07 23:32:16 +00:00
|
|
|
can be found, by default, in <filename>/etc/gstreamer/reg.xml</filename>.
|
2000-09-09 16:36:10 +00:00
|
|
|
</para>
|
|
|
|
</sect1>
|
|
|
|
|
|
|
|
<sect1>
|
2002-04-07 23:32:16 +00:00
|
|
|
<title><command>gst-launch</command></title>
|
2000-09-09 16:36:10 +00:00
|
|
|
<para>
|
|
|
|
This is a tool that will construct pipelines based on a command-line
|
2002-04-07 23:32:16 +00:00
|
|
|
syntax. FIXME: need a more extensive grammar reference
|
2000-09-09 16:36:10 +00:00
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
A simple commandline looks like:
|
|
|
|
|
|
|
|
<screen>
|
2002-04-07 23:32:16 +00:00
|
|
|
gst-launch filesrc location=hello.mp3 ! mad ! osssink
|
2000-09-09 16:36:10 +00:00
|
|
|
</screen>
|
|
|
|
|
|
|
|
A more complex pipeline looks like:
|
|
|
|
|
|
|
|
<screen>
|
2002-04-07 23:32:16 +00:00
|
|
|
gst-launch filesrc location=redpill.vob ! mpegdemux name=demux \
|
|
|
|
demux.audio_00! { ac3parse ! a52dec ! osssink } \
|
|
|
|
demux.video_00! { mpeg2dec ! xvideosink }
|
2000-09-09 16:36:10 +00:00
|
|
|
</screen>
|
|
|
|
|
2001-01-16 23:35:22 +00:00
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
You can also use the the parser in you own code. <application>GStreamer</application>
|
2001-07-07 14:17:22 +00:00
|
|
|
provides a function gst_parse_launch () that you can use to construt a pipeline.
|
|
|
|
The following programs lets you create an mp3 pipeline using the gst_parse_launch ()
|
|
|
|
function:
|
2001-01-16 23:35:22 +00:00
|
|
|
</para>
|
|
|
|
<programlisting>
|
|
|
|
#include <gst/gst.h>
|
|
|
|
|
2001-07-07 14:17:22 +00:00
|
|
|
int
|
|
|
|
main (int argc, char *argv[])
|
2001-01-16 23:35:22 +00:00
|
|
|
{
|
|
|
|
GstElement *pipeline;
|
2002-01-06 04:26:37 +00:00
|
|
|
GstElement *filesrc;
|
2002-04-07 23:32:16 +00:00
|
|
|
GError *error = NULL;
|
2001-01-16 23:35:22 +00:00
|
|
|
|
2001-07-07 11:34:54 +00:00
|
|
|
gst_init (&argc, &argv);
|
2001-01-16 23:35:22 +00:00
|
|
|
|
2001-07-07 14:17:22 +00:00
|
|
|
if (argc != 2) {
|
2002-07-09 18:43:13 +00:00
|
|
|
g_print ("usage: %s <filename>\n", argv[0]);
|
2001-07-07 14:17:22 +00:00
|
|
|
return -1;
|
|
|
|
}
|
2001-01-16 23:35:22 +00:00
|
|
|
|
2002-04-07 23:32:16 +00:00
|
|
|
pipeline = gst_parse_launch ("filesrc name=my_filesrc ! mad ! osssink", &error);
|
|
|
|
if (!pipeline) {
|
2002-07-09 18:43:13 +00:00
|
|
|
g_print ("Parse error: %s\n", error->message);
|
2002-04-07 23:32:16 +00:00
|
|
|
exit (1);
|
|
|
|
}
|
|
|
|
|
2002-01-06 04:26:37 +00:00
|
|
|
filesrc = gst_bin_get_by_name (GST_BIN (pipeline), "my_filesrc");
|
|
|
|
g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL);
|
2001-01-16 23:35:22 +00:00
|
|
|
|
2001-07-07 11:34:54 +00:00
|
|
|
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
2001-01-16 23:35:22 +00:00
|
|
|
|
2001-07-07 14:17:22 +00:00
|
|
|
while (gst_bin_iterate (GST_BIN (pipeline)));
|
|
|
|
|
|
|
|
gst_element_set_state (pipeline, GST_STATE_NULL);
|
2001-01-16 23:35:22 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
</programlisting>
|
2001-07-07 14:17:22 +00:00
|
|
|
<para>
|
2002-01-06 04:26:37 +00:00
|
|
|
Note how we can retrieve the filesrc element from the constructed bin using the
|
2001-07-07 14:17:22 +00:00
|
|
|
element name.
|
|
|
|
</para>
|
2000-09-09 16:36:10 +00:00
|
|
|
</sect1>
|
|
|
|
|
2001-01-05 18:50:41 +00:00
|
|
|
<sect1>
|
2002-04-07 23:32:16 +00:00
|
|
|
<title><command>gst-inspect</command></title>
|
2001-01-05 18:50:41 +00:00
|
|
|
<para>
|
|
|
|
This is a tool to query a plugin or an element about its properties.
|
|
|
|
</para>
|
|
|
|
<para>
|
2002-04-07 23:32:16 +00:00
|
|
|
To query the information about the element mad, you would specify:
|
2001-01-05 18:50:41 +00:00
|
|
|
</para>
|
|
|
|
|
|
|
|
<screen>
|
2002-04-07 23:32:16 +00:00
|
|
|
gst-inspect mad
|
2001-01-05 18:50:41 +00:00
|
|
|
</screen>
|
|
|
|
|
|
|
|
<para>
|
2002-04-07 23:32:16 +00:00
|
|
|
Below is the output of a query for the osssink element:
|
2001-01-05 18:50:41 +00:00
|
|
|
</para>
|
|
|
|
|
|
|
|
<screen>
|
|
|
|
Factory Details:
|
|
|
|
Long name: Audio Sink (OSS)
|
|
|
|
Class: Sink/Audio
|
|
|
|
Description: Output to a sound card via OSS
|
2002-04-07 23:32:16 +00:00
|
|
|
Version: 0.3.3.1
|
|
|
|
Author(s): Erik Walthinsen <omega@cse.ogi.edu>, Wim Taymans <wim.taymans@chello.be>
|
2001-01-05 18:50:41 +00:00
|
|
|
Copyright: (C) 1999
|
|
|
|
|
2002-04-07 23:32:16 +00:00
|
|
|
GObject
|
|
|
|
+----GstObject
|
|
|
|
+----GstElement
|
|
|
|
+----GstOssSink
|
|
|
|
|
2001-01-05 18:50:41 +00:00
|
|
|
Pad Templates:
|
|
|
|
SINK template: 'sink'
|
2002-04-07 23:32:16 +00:00
|
|
|
Availability: Always
|
2001-01-05 18:50:41 +00:00
|
|
|
Capabilities:
|
2002-04-07 23:32:16 +00:00
|
|
|
'osssink_sink':
|
2001-01-05 18:50:41 +00:00
|
|
|
MIME type: 'audio/raw':
|
2002-04-07 23:32:16 +00:00
|
|
|
format: String: int
|
|
|
|
endianness: Integer: 1234
|
|
|
|
width: List:
|
|
|
|
Integer: 8
|
|
|
|
Integer: 16
|
2001-01-05 18:50:41 +00:00
|
|
|
depth: List:
|
|
|
|
Integer: 8
|
|
|
|
Integer: 16
|
|
|
|
channels: Integer range: 1 - 2
|
2002-04-07 23:32:16 +00:00
|
|
|
law: Integer: 0
|
|
|
|
signed: List:
|
|
|
|
Boolean: FALSE
|
|
|
|
Boolean: TRUE
|
|
|
|
rate: Integer range: 1000 - 48000
|
|
|
|
|
2001-01-05 18:50:41 +00:00
|
|
|
|
|
|
|
Element Flags:
|
|
|
|
GST_ELEMENT_THREADSUGGESTED
|
|
|
|
|
|
|
|
Element Implementation:
|
|
|
|
No loopfunc(), must be chain-based or not configured yet
|
2002-04-07 23:32:16 +00:00
|
|
|
Has change_state() function: gst_osssink_change_state
|
|
|
|
Has custom save_thyself() function: gst_element_save_thyself
|
|
|
|
Has custom restore_thyself() function: gst_element_restore_thyself
|
|
|
|
|
|
|
|
Clocking Interaction:
|
|
|
|
element requires a clock
|
|
|
|
element provides a clock: GstOssClock
|
2001-01-05 18:50:41 +00:00
|
|
|
|
|
|
|
Pads:
|
|
|
|
SINK: 'sink'
|
|
|
|
Implementation:
|
2002-04-07 23:32:16 +00:00
|
|
|
Has chainfunc(): 0x40056fc0
|
2001-01-05 18:50:41 +00:00
|
|
|
Pad Template: 'sink'
|
|
|
|
|
|
|
|
Element Arguments:
|
2002-04-07 23:32:16 +00:00
|
|
|
name : String (Default "element")
|
|
|
|
device : String (Default "/dev/dsp")
|
|
|
|
mute : Boolean (Default false)
|
|
|
|
format : Integer (Default 16)
|
|
|
|
channels : Enum "GstAudiosinkChannels" (default 1)
|
|
|
|
(0): Silence
|
2001-01-05 18:50:41 +00:00
|
|
|
(1): Mono
|
|
|
|
(2): Stereo
|
2002-04-07 23:32:16 +00:00
|
|
|
frequency : Integer (Default 11025)
|
|
|
|
fragment : Integer (Default 6)
|
|
|
|
buffer-size : Integer (Default 4096)
|
|
|
|
|
|
|
|
Element Signals:
|
|
|
|
"handoff" : void user_function (GstOssSink* object,
|
|
|
|
gpointer user_data);
|
2001-01-05 18:50:41 +00:00
|
|
|
</screen>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
To query the information about a plugin, you would do:
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<screen>
|
2002-04-07 23:32:16 +00:00
|
|
|
gst-inspect gstelements
|
2001-01-05 18:50:41 +00:00
|
|
|
</screen>
|
|
|
|
</sect1>
|
2000-11-11 15:13:50 +00:00
|
|
|
<sect1>
|
2002-04-07 23:32:16 +00:00
|
|
|
<title><command>gst-play</command></title>
|
2000-11-11 15:13:50 +00:00
|
|
|
<para>
|
|
|
|
A sample media player.
|
|
|
|
</para>
|
|
|
|
</sect1>
|
|
|
|
|
2000-08-22 21:18:18 +00:00
|
|
|
</chapter>
|