1 <chapter id="chapter-programs">
2 <title>Programs</title>
6 <sect1 id="section-programs-gst-register">
7 <title><command>gst-register</command></title>
9 <command>gst-register</command> is used to rebuild the database of plugins.
10 It is used after a new plugin has been added to the system. The plugin database
11 can be found, by default, in <filename>/etc/gstreamer/reg.xml</filename>.
15 <sect1 id="section-programs-gst-launch">
16 <title><command>gst-launch</command></title>
18 This is a tool that will construct pipelines based on a command-line
22 A simple commandline looks like:
25 gst-launch filesrc location=hello.mp3 ! mad ! osssink
28 A more complex pipeline looks like:
31 gst-launch filesrc location=redpill.vob ! mpegdemux name=demux \
32 demux.audio_00! { ac3parse ! a52dec ! osssink } \
33 demux.video_00! { mpeg2dec ! xvideosink }
38 You can also use the parser in you own
39 code. <application>GStreamer</application> provides a function
40 gst_parse_launch () that you can use to construct a pipeline.
41 The following program lets you create an MP3 pipeline using the
42 gst_parse_launch () function:
45 #include <gst/gst.h>
48 main (int argc, char *argv[])
54 gst_init (&argc, &argv);
57 g_print ("usage: %s <filename>\n", argv[0]);
61 pipeline = gst_parse_launch ("filesrc name=my_filesrc ! mad ! osssink", &error);
63 g_print ("Parse error: %s\n", error->message);
67 filesrc = gst_bin_get_by_name (GST_BIN (pipeline), "my_filesrc");
68 g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL);
70 gst_element_set_state (pipeline, GST_STATE_PLAYING);
72 while (gst_bin_iterate (GST_BIN (pipeline)));
74 gst_element_set_state (pipeline, GST_STATE_NULL);
80 Note how we can retrieve the filesrc element from the constructed bin using the
84 <title>Grammar Reference</title>
86 The <command>gst-launch</command> syntax is processed by a flex/bison parser. This section
87 is intended to provide a full specification of the grammar; any deviations from this
88 specification is considered a bug.
91 <title>Elements</title>
96 A bare identifier (a string beginning with a letter and containing
97 only letters, numbers, dashes, underscores, percent signs, or colons)
98 will create an element from a given element factory. In this example,
99 an instance of the "mad" MP3 decoding plugin will be created.
108 An exclamation point, optionally having a qualified pad name (an the name of the pad,
109 optionally preceded by the name of the element) on both sides, will link two pads. If
110 the source pad is not specified, a source pad from the immediately preceding element
111 will be automatically chosen. If the sink pad is not specified, a sink pad from the next
112 element to be constructed will be chosen. An attempt will be made to find compatible
113 pads. Pad names may be preceded by an element name, as in
114 <computeroutput>my_element_name.sink_pad</computeroutput>.
118 <title>Properties</title>
120 ... location="http://gstreamer.net" ...
123 The name of a property, optionally qualified with an element name, and a value,
124 separated by an equals sign, will set a property on an element. If the element is not
125 specified, the previous element is assumed. Strings can optionally be enclosed in
126 quotation marks. Characters in strings may be escaped with the backtick
127 (<literal>\</literal>). If the right-hand side is all digits, it is considered to be an
128 integer. If it is all digits and a decimal point, it is a double. If it is "true",
129 "false", "TRUE", or "FALSE" it is considered to be boolean. Otherwise, it is parsed as a
130 string. The type of the property is determined later on in the parsing, and the value is
131 converted to the target type. This conversion is not guaranteed to work, it relies on
132 the g_value_convert routines. No error message will be displayed on an invalid
133 conversion, due to limitations in the value convert API.
137 <title>Bins, Threads, and Pipelines</title>
142 A pipeline description between parentheses is placed into a bin. The open paren may be
143 preceded by a type name, as in <computeroutput>jackbin.( ... )</computeroutput> to make
144 a bin of a specified type. Square brackets make pipelines, and curly braces make
145 threads. The default toplevel bin type is a pipeline, although putting the whole
146 description within parentheses or braces can override this default.
152 <sect1 id="section-programs-gst-inspect">
153 <title><command>gst-inspect</command></title>
155 This is a tool to query a plugin or an element about its properties.
158 To query the information about the element mad, you would specify:
166 Below is the output of a query for the osssink element:
171 Long name: Audio Sink (OSS)
173 Description: Output to a sound card via OSS
175 Author(s): Erik Walthinsen <omega@cse.ogi.edu>, Wim Taymans <wim.taymans@chello.be>
184 SINK template: 'sink'
188 MIME type: 'audio/raw':
190 endianness: Integer: 1234
197 channels: Integer range: 1 - 2
202 rate: Integer range: 1000 - 48000
206 GST_ELEMENT_THREADSUGGESTED
208 Element Implementation:
209 No loopfunc(), must be chain-based or not configured yet
210 Has change_state() function: gst_osssink_change_state
211 Has custom save_thyself() function: gst_element_save_thyself
212 Has custom restore_thyself() function: gst_element_restore_thyself
214 Clocking Interaction:
215 element requires a clock
216 element provides a clock: GstOssClock
221 Has chainfunc(): 0x40056fc0
225 name : String (Default "element")
226 device : String (Default "/dev/dsp")
227 mute : Boolean (Default false)
228 format : Integer (Default 16)
229 channels : Enum "GstAudiosinkChannels" (default 1)
233 frequency : Integer (Default 11025)
234 fragment : Integer (Default 6)
235 buffer-size : Integer (Default 4096)
238 "handoff" : void user_function (GstOssSink* object,
243 To query the information about a plugin, you would do:
247 gst-inspect gstelements