GStreamer Daemon - Modifying Element Properties

From RidgeRun Developer Wiki



Previous: Interacting with Pipelines Index Next: Sending Events




This wiki describes the basics of how to interact with GStreamer element properties. Specifically, how to read and update them. You'll find that the family of commands used to interact with pipelines are prefixed with element_<action>.

Read Property

In order to read a property from an element use the following command:

 element_get pipeline element property
     Reads the value of property of element in pipeline.

For example:
Gstd Commands:

pipeline_create p fakesrc ! fakesink name=fs
element_get p fs sync

will:

  1. Create a pipeline named p with a fakesink named fs
  2. Read the sync property of the fakesink

The answer in raw JSON will be:

{
  "code" : 0,
  "response" : {
    "name" : "sync",
    "value" : "false",
    "param_spec" : {
        "blurb" : "Sync on the clock",
        "type" : "gboolean",
        "access" : "((GstdParamFlags) READ | 226)",
        "construct" : false
    }
  }
}

where it can be seen that the value of the sync property is set to false.

The element_get command may fail for one of the following:

  • The specified pipeline doesn't exist
  • The specified element doesn't exist in the given pipeline
  • The specified property doesn't exist in the given element
  • The requested property is not readable

Alternatively, a property can be queried using the low level CRUD syntax:
Gstd Commands:

read /pipelines/<pipeline>/elements/<element>/properties/<property>

Set Property

In order to update the value of a property in an element use the following command:

 element_set pipeline element property value
     Ses the value of property of element in pipeline to value.

For example:
Gstd Commands:

pipeline_create p videotestsrc ! capsfilter name=cf ! fakesink
element_set p cf caps video/x-raw,width=640,height=480

will:

  1. Create a pipeline named p with a capsfilter named cf
  2. Update the caps property of the caps filter to a given caps description

The answer in raw JSON will be:

{
  "code" : 0,
  "response" : {
    "name" : "caps",
    '''"value" : "\"video/x-raw\\,\\ width\\=\\(int\\)640\\,\\ height\\=\\(int\\)480\"",'''
    "param_spec" : {
        "blurb" : "Restrict the possible allowed capabilities (NULL means ANY). Setting this property takes a reference to the supplied GstCaps object.",
        "type" : "GstCaps",
        "access" : "((GstdParamFlags) READ | 4322)",
        "construct" : false
    }
  }
}

where it has been acknowledged that the caps have been updated.

The element_set command may fail for one of the following:

  • The specified pipeline doesn't exist
  • The specified element doesn't exist in the given pipeline
  • The specified property doesn't exist in the given element
  • The requested property is not writable

Alternatively, a property can be set using the low level CRUD syntax:
Gstd Commands:

update /pipelines/<pipeline>/elements/<element>/properties/<property> <value>

List Properties

In order to list the existing properties of an element use the following command:

 list_properties pipeline element
     List the properties of element in pipeline

For example:
Gstd Commands:

pipeline_create p fakesrc ! fakesink name=fs
list_properties p fs

would list the properties in the fakesink element

Alternatively, the list of properties can be found by using the low level CRUD syntax:
Gstd Commands:

read /pipelines/<pipeline>/elements/<element>/properties

API Summary

High Level Command Low Level CRUD Description
element_get <pipeline> <element> <property> read /pipelines/<pipeline>/elements/<element>/properties/<property> Reads the value of a property of an element in a pipeline.
element_set <pipeline> <element> <property> <value> update /pipelines/<pipeline>/elements/<element>/properties/<property> <value> Updates the value of a property of an element in a pipeline to value.
list_properties <pipeline> <element> read /pipelines/<pipeline>/elements/<element>/properties List the properties of an element in a pipeline.



Previous: Interacting with Pipelines Index Next: Sending Events