GStreamer Daemon - Response Format

From RidgeRun Developer Wiki



Previous: Low-level Implementation for Applications Index Next: API Reference




What is JSON?

JSON which means "JavaScript Object Notation" is a lightweight data-interchange format that uses human-readable text to transmit data objects consisting of attribute–value pairs and array data types. More information in json

Forms:

  • Object: is an unordered set of name/value pairs that begins with "{" and ends with "}".
  • Each name is followed by a colon ":" (colon).
  • Names or values pairs: are separated by a comma "," .

Gstd Response Format

Gstd receives the commands, arguments, events, and retrieve an answer in raw JSON. That answer consists of three parts:

  • code: number value, without the textual description that indicates the status.
  • description: Description of the status code.
  • response: Body of the command executed.

Example

The JSON raw output:

{
  "code" : 0,
  "description" : "Success",
  "response" : {
    "properties" : [
        {
            "name" : "name",
            "value" : "\"p\"",
            "param_spec" : {
                "blurb" : "The name of the current Gstd session",
                "type" : "gchararray",
                "access" : "((GstdParamFlags) READ | 234)",
                "construct" : false
            }
        },
        {
            "name" : "description",
            "value" : "\"videotestsrc is-live=true pattern=ball ! x264enc ! mp4mux ! filesink location=/tmp/video.mp4\"",
            "param_spec" : {
                "blurb" : "The gst-launch like pipeline description",
                "type" : "gchararray",
                "access" : "((GstdParamFlags) READ | 234)",
                "construct" : false
            }
        },
        {
            "name" : "elements",
            "value" : "((GstdList*) 0x7f2954046d90)",
            "param_spec" : {
                "blurb" : "The elements in the pipeline",
                "type" : "GstdList",
                "access" : "((GstdParamFlags) READ | 224)",
                "construct" : false
            }
        },
       {
            "name" : "bus",
            "value" : "((GstdPipelineBus*) 0x7f2958003200)",
            "param_spec" : {
                "blurb" : "The bus callback for this element",
                "type" : "GstdPipelineBus",
                "access" : "((GstdParamFlags) READ | 224)",
                "construct" : false
            }
        },
        {
            "name" : "state",
            "value" : "((GstdState*) 0x7f2958003120)",
            "param_spec" : {
                "blurb" : "The state of the pipeline",
                "type" : "GstdState",
                "access" : "((GstdParamFlags) READ | UPDATE | 226)",
                "construct" : false
            }
        },
        {
            "name" : "event",
            "value" : "((GstdEventHandler*) 0x7f2954003700)",
            "param_spec" : {
                "blurb" : "The event handler of the pipeline",
                "type" : "GstdEventHandler",
                "access" : "((GstdParamFlags) READ | 224)",
                "construct" : false
            }
        }
    ]
}
} 

In this case, the JSON is the response of the pipeline_create command


Previous: Low-level Implementation for Applications Index Next: API Reference