GstParse

GstParse — Parses commandline syntax into a pipeline.

Synopsis


#include <gst/gst.h>


enum        GstParseError;
#define     GST_PARSE_ERROR
GQuark      gst_parse_error_quark           (void);
GstElement* gst_parse_launch                (const gchar *pipeline_description,
                                             GError **error);
GstElement* gst_parse_launchv               (const gchar **argv,
                                             GError **error);

Description

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 {}.

Details

enum GstParseError

typedef enum
{
  GST_PARSE_ERROR_SYNTAX,
  GST_PARSE_ERROR_NO_SUCH_ELEMENT,
  GST_PARSE_ERROR_NO_SUCH_PROPERTY,
  GST_PARSE_ERROR_LINK,
  GST_PARSE_ERROR_COULD_NOT_SET_PROPERTY,
  GST_PARSE_ERROR_EMPTY_BIN,
  GST_PARSE_ERROR_EMPTY
} GstParseError;

The parsing errors.

GST_PARSE_ERROR_SYNTAXA syntax error was detected
GST_PARSE_ERROR_NO_SUCH_ELEMENTThe pipeline description contains a non existing element
GST_PARSE_ERROR_NO_SUCH_PROPERTYThe pipeline description contains a non existing element property
GST_PARSE_ERROR_LINKA pad link could not be made
GST_PARSE_ERROR_COULD_NOT_SET_PROPERTY
GST_PARSE_ERROR_EMPTY_BIN
GST_PARSE_ERROR_EMPTY

GST_PARSE_ERROR

#define GST_PARSE_ERROR gst_parse_error_quark ()

The error quark


gst_parse_error_quark ()

GQuark      gst_parse_error_quark           (void);

Get the error quark passed in the GError messages.

Returns :The parse error quark

gst_parse_launch ()

GstElement* gst_parse_launch                (const gchar *pipeline_description,
                                             GError **error);

Create a new pipeline based on command line syntax. Please note that you might get a return value that is not NULL even though the error is set. In this case there was a recoverable parsing error and you can try to play the pipeline.

pipeline_description : the command line describing the pipeline
error : the error message in case of an erroneous pipeline.
Returns : a new element on success, NULL on failure. If more than one toplevel element is specified by the pipeline_description, all elements are put into a GstPipeline ant that is returned.

gst_parse_launchv ()

GstElement* gst_parse_launchv               (const gchar **argv,
                                             GError **error);

Create a new element based on command line syntax. error will contain an error message if an erroneuos pipeline is specified. An error does not mean that the pipeline could not be constructed.

argv : null-terminated array of arguments
error : pointer to a GError
Returns : a new element on success and NULL on failure.