| GStreamer Core Reference Manual |
|---|
GstParse — Parses commandline syntax into a pipeline.
#include <gst/gst.h> enum GstParseError; #define GST_PARSE_ERRORGQuark gst_parse_error_quark (void); GstBin* gst_parse_launch (constgchar *pipeline_description,GError **error); GstBin* gst_parse_launchv (constgchar **argv,GError **error);
This method allows you to create a pipeline from a command line syntax description. The following example creates a simple mp3 player.
GstElement *pipeline;
/* create a pipeline to hold our elements */
pipeline = gst_pipeline_new ("launch");
/* build a pipeline in the pipeline */
gst_parse_launch ("filesrc location=some.mp3 ! mad ! osssink", GST_BIN (pipeline));
/* play the thing */
gst_element_set_state (pipeline, GST_STATE_PLAYING);
while (gst_bin_iterate (GST_BIN (pipeline)));
gst_element_set_state (pipeline, GST_STATE_NULL);
Elements are separated with a !, properties are set with property=value, specific pads of an element are selected by replacing the ! with padname!.
Elements can be added to a bin by embracing them with (). Threads can be made with {}.
typedef enum
{
GST_PARSE_ERROR_SYNTAX,
GST_PARSE_ERROR_NO_SUCH_ELEMENT,
GST_PARSE_ERROR_NO_SUCH_PROPERTY,
GST_PARSE_ERROR_LINK
} GstParseError;
The parsing errors.
| GST_PARSE_ERROR_SYNTAX | A syntax error was detected |
| GST_PARSE_ERROR_NO_SUCH_ELEMENT | The pipeline description contains a non existing element |
| GST_PARSE_ERROR_NO_SUCH_PROPERTY | The pipeline description contains a non existing element property |
| GST_PARSE_ERROR_LINK | A pad link could not be made |
GQuark gst_parse_error_quark (void);
Get the error quark passed in the GError messages.
| Returns : | The parse error quark |
GstBin* gst_parse_launch (constgchar *pipeline_description,GError **error);
Create a new pipeline based on command line syntax.
| pipeline_description : | the command line describing the pipeline |
| error : | the error message in case of a failure |
| Returns : | a new bin on success, NULL on failure. By default the bin is a GstPipeline, but it depends on the pipeline_description. |
GstBin* gst_parse_launchv (constgchar **argv,GError **error);
Create a new pipeline based on command line syntax.
| argv : | null-terminated array of arguments |
| error : | pointer to GError |
| Returns : | a new pipeline on success, NULL on failure and error will contain the error message. |
| << GstPadTemplate | GstPipeline >> |