GStreamer Daemon - Response Format: Difference between revisions

From RidgeRun Developer Wiki
(Created page with " { "code" : 0, "description" : "Success", "response" : { "properties" : [ { "name" : "name", "value" : "\"p\"",...")
 
mNo edit summary
 
(23 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{GStreamer Daemon/Head | previous=Low-level Implementation for Applications | 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 [http://www.json.org/ 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:


  {
  {
Line 11: Line 30:
                 "blurb" : "The name of the current Gstd session",
                 "blurb" : "The name of the current Gstd session",
                 "type" : "gchararray",
                 "type" : "gchararray",
                 "access" : "((GstdParamFlags) READ | 234)",
                 "access" : "((GstdParamFlags) READ | 234)",
                 "construct" : false
                 "construct" : false
             }
             }
Line 17: Line 36:
         {
         {
             "name" : "description",
             "name" : "description",
             "value" : "\"videotestsrc is-live=true pattern=ball ! x264enc ! mp4mux ! filesink location=/tmp/video.mp4\"",
             "value" : "\"videotestsrc is-live=true pattern=ball ! x264enc ! mp4mux ! filesink location=/tmp/video.mp4\"",
             "param_spec" : {
             "param_spec" : {
                 "blurb" : "The gst-launch like pipeline description",
                 "blurb" : "The gst-launch like pipeline description",
                 "type" : "gchararray",
                 "type" : "gchararray",
                 "access" : "((GstdParamFlags) READ | 234)",
                 "access" : "((GstdParamFlags) READ | 234)",
                 "construct" : false
                 "construct" : false
             }
             }
Line 31: Line 50:
                 "blurb" : "The elements in the pipeline",
                 "blurb" : "The elements in the pipeline",
                 "type" : "GstdList",
                 "type" : "GstdList",
                 "access" : "((GstdParamFlags) READ | 224)",
                 "access" : "((GstdParamFlags) READ | 224)",
                 "construct" : false
                 "construct" : false
             }
             }
         },
         },
        {
        {
             "name" : "bus",
             "name" : "bus",
             "value" : "((GstdPipelineBus*) 0x7f2958003200)",
             "value" : "((GstdPipelineBus*) 0x7f2958003200)",
Line 41: Line 60:
                 "blurb" : "The bus callback for this element",
                 "blurb" : "The bus callback for this element",
                 "type" : "GstdPipelineBus",
                 "type" : "GstdPipelineBus",
                 "access" : "((GstdParamFlags) READ | 224)",
                 "access" : "((GstdParamFlags) READ | 224)",
                 "construct" : false
                 "construct" : false
             }
             }
Line 51: Line 70:
                 "blurb" : "The state of the pipeline",
                 "blurb" : "The state of the pipeline",
                 "type" : "GstdState",
                 "type" : "GstdState",
                 "access" : "((GstdParamFlags) READ | UPDATE | 226)",
                 "access" : "((GstdParamFlags) READ | UPDATE | 226)",
                 "construct" : false
                 "construct" : false
             }
             }
Line 61: Line 80:
                 "blurb" : "The event handler of the pipeline",
                 "blurb" : "The event handler of the pipeline",
                 "type" : "GstdEventHandler",
                 "type" : "GstdEventHandler",
                 "access" : "((GstdParamFlags) READ | 224)",
                 "access" : "((GstdParamFlags) READ | 224)",
                 "construct" : false
                 "construct" : false
             }
             }
Line 67: Line 86:
     ]
     ]
  }
  }
  }
  }
 
In this case, the JSON is the response of the pipeline_create command
 
{{GStreamer Daemon/Foot | previous=Low-level Implementation for Applications | next=API Reference}}

Latest revision as of 20:34, 31 August 2020



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