Don't assume all properties are writeable in any case

This commit is contained in:
Sebastian Dröge 2009-05-28 12:32:25 +02:00
parent 60bce938cb
commit 5404a9565a
13 changed files with 34 additions and 29 deletions

View file

@ -223,7 +223,6 @@ print_element_properties (GstElement * element, gint pfx)
GParamSpec **property_specs; GParamSpec **property_specs;
guint num_properties; guint num_properties;
gint i; gint i;
gboolean readable;
property_specs = g_object_class_list_properties property_specs = g_object_class_list_properties
(G_OBJECT_GET_CLASS (element), &num_properties); (G_OBJECT_GET_CLASS (element), &num_properties);
@ -233,8 +232,9 @@ print_element_properties (GstElement * element, gint pfx)
for (i = 0; i < num_properties; i++) { for (i = 0; i < num_properties; i++) {
GValue value = { 0, }; GValue value = { 0, };
GParamSpec *param = property_specs[i]; GParamSpec *param = property_specs[i];
gboolean readable, writeable;
readable = FALSE; readable = writeable = FALSE;
g_value_init (&value, param->value_type); g_value_init (&value, param->value_type);
if (param->flags & G_PARAM_READABLE) { if (param->flags & G_PARAM_READABLE) {
@ -242,6 +242,9 @@ print_element_properties (GstElement * element, gint pfx)
readable = TRUE; readable = TRUE;
} }
if (param->flags & G_PARAM_WRITABLE)
writeable = TRUE;
/* Ignore GstObject, GstElement, GstBin, GstPipeline properties */ /* Ignore GstObject, GstElement, GstBin, GstPipeline properties */
if (param->owner_type == GST_TYPE_OBJECT || if (param->owner_type == GST_TYPE_OBJECT ||
param->owner_type == GST_TYPE_ELEMENT || param->owner_type == GST_TYPE_ELEMENT ||
@ -254,9 +257,11 @@ print_element_properties (GstElement * element, gint pfx)
PUT_ESCAPED (pfx + 2, "type", g_type_name (param->value_type)); PUT_ESCAPED (pfx + 2, "type", g_type_name (param->value_type));
PUT_ESCAPED (pfx + 2, "nick", g_param_spec_get_nick (param)); PUT_ESCAPED (pfx + 2, "nick", g_param_spec_get_nick (param));
PUT_ESCAPED (pfx + 2, "blurb", g_param_spec_get_blurb (param)); PUT_ESCAPED (pfx + 2, "blurb", g_param_spec_get_blurb (param));
if (readable) { if (readable && writeable) {
PUT_ESCAPED (pfx + 2, "flags", "RW"); PUT_ESCAPED (pfx + 2, "flags", "RW");
} else { } else if (readable) {
PUT_ESCAPED (pfx + 2, "flags", "R");
} else if (writeable) {
PUT_ESCAPED (pfx + 2, "flags", "W"); PUT_ESCAPED (pfx + 2, "flags", "W");
} }

View file

@ -89,7 +89,7 @@
<type>gint</type> <type>gint</type>
<nick>NStreams</nick> <nick>NStreams</nick>
<blurb>number of streams</blurb> <blurb>number of streams</blurb>
<flags>RW</flags> <flags>R</flags>
<range min="0" max="2147483647"/> <range min="0" max="2147483647"/>
<default>0</default> <default>0</default>
</element-property> </element-property>
@ -98,21 +98,21 @@
<type>gpointer</type> <type>gpointer</type>
<nick>Stream info</nick> <nick>Stream info</nick>
<blurb>List of streaminfo</blurb> <blurb>List of streaminfo</blurb>
<flags>RW</flags> <flags>R</flags>
</element-property> </element-property>
<element-property> <element-property>
<name>stream-info-value-array</name> <name>stream-info-value-array</name>
<type>GValueArray</type> <type>GValueArray</type>
<nick>StreamInfo GValueArray</nick> <nick>StreamInfo GValueArray</nick>
<blurb>value array of streaminfo</blurb> <blurb>value array of streaminfo</blurb>
<flags>RW</flags> <flags>R</flags>
</element-property> </element-property>
<element-property> <element-property>
<name>source</name> <name>source</name>
<type>GstElement</type> <type>GstElement</type>
<nick>Source</nick> <nick>Source</nick>
<blurb>Source element</blurb> <blurb>Source element</blurb>
<flags>RW</flags> <flags>R</flags>
<object-type>GstElement</object-type> <object-type>GstElement</object-type>
</element-property> </element-property>
<element-property> <element-property>
@ -197,7 +197,7 @@
<type>GstBuffer</type> <type>GstBuffer</type>
<nick>Frame</nick> <nick>Frame</nick>
<blurb>The last frame (NULL = no video available)</blurb> <blurb>The last frame (NULL = no video available)</blurb>
<flags>RW</flags> <flags>R</flags>
</element-property> </element-property>
<element-property> <element-property>
<name>subtitle-font-desc</name> <name>subtitle-font-desc</name>

View file

@ -60,7 +60,7 @@
<type>GstElement</type> <type>GstElement</type>
<nick>Source</nick> <nick>Source</nick>
<blurb>Source element</blurb> <blurb>Source element</blurb>
<flags>RW</flags> <flags>R</flags>
<object-type>GstElement</object-type> <object-type>GstElement</object-type>
</element-property> </element-property>
<element-property> <element-property>
@ -85,7 +85,7 @@
<type>gint</type> <type>gint</type>
<nick>Number Video</nick> <nick>Number Video</nick>
<blurb>Total number of video streams</blurb> <blurb>Total number of video streams</blurb>
<flags>RW</flags> <flags>R</flags>
<range min="0" max="2147483647"/> <range min="0" max="2147483647"/>
<default>0</default> <default>0</default>
</element-property> </element-property>
@ -103,7 +103,7 @@
<type>gint</type> <type>gint</type>
<nick>Number Audio</nick> <nick>Number Audio</nick>
<blurb>Total number of audio streams</blurb> <blurb>Total number of audio streams</blurb>
<flags>RW</flags> <flags>R</flags>
<range min="0" max="2147483647"/> <range min="0" max="2147483647"/>
<default>0</default> <default>0</default>
</element-property> </element-property>
@ -121,7 +121,7 @@
<type>gint</type> <type>gint</type>
<nick>Number Text</nick> <nick>Number Text</nick>
<blurb>Total number of text streams</blurb> <blurb>Total number of text streams</blurb>
<flags>RW</flags> <flags>R</flags>
<range min="0" max="2147483647"/> <range min="0" max="2147483647"/>
<default>0</default> <default>0</default>
</element-property> </element-property>
@ -204,7 +204,7 @@
<type>GstBuffer</type> <type>GstBuffer</type>
<nick>Frame</nick> <nick>Frame</nick>
<blurb>The last frame (NULL = no video available)</blurb> <blurb>The last frame (NULL = no video available)</blurb>
<flags>RW</flags> <flags>R</flags>
</element-property> </element-property>
<element-property> <element-property>
<name>subtitle-font-desc</name> <name>subtitle-font-desc</name>

View file

@ -111,7 +111,7 @@
<type>GstBuffer</type> <type>GstBuffer</type>
<nick>Last Buffer</nick> <nick>Last Buffer</nick>
<blurb>The last buffer received in the sink</blurb> <blurb>The last buffer received in the sink</blurb>
<flags>RW</flags> <flags>R</flags>
</element-property> </element-property>
<element-property> <element-property>
<name>blocksize</name> <name>blocksize</name>
@ -220,7 +220,7 @@
<type>gchararray</type> <type>gchararray</type>
<nick>Adaptor name</nick> <nick>Adaptor name</nick>
<blurb>The name of the video adaptor</blurb> <blurb>The name of the video adaptor</blurb>
<flags>RW</flags> <flags>R</flags>
<default>NULL</default> <default>NULL</default>
</element-property> </element-property>
<element-property> <element-property>

View file

@ -104,7 +104,7 @@
<type>GstBuffer</type> <type>GstBuffer</type>
<nick>Last Buffer</nick> <nick>Last Buffer</nick>
<blurb>The last buffer received in the sink</blurb> <blurb>The last buffer received in the sink</blurb>
<flags>RW</flags> <flags>R</flags>
</element-property> </element-property>
<element-property> <element-property>
<name>blocksize</name> <name>blocksize</name>
@ -170,7 +170,7 @@
<type>gchararray</type> <type>gchararray</type>
<nick>Last Message</nick> <nick>Last Message</nick>
<blurb>The message describing current status</blurb> <blurb>The message describing current status</blurb>
<flags>RW</flags> <flags>R</flags>
<default>NULL</default> <default>NULL</default>
</element-property> </element-property>
<element-property> <element-property>

View file

@ -203,7 +203,7 @@
<type>gchararray</type> <type>gchararray</type>
<nick>last-message</nick> <nick>last-message</nick>
<blurb>The last status message</blurb> <blurb>The last status message</blurb>
<flags>RW</flags> <flags>R</flags>
<default>NULL</default> <default>NULL</default>
</element-property> </element-property>
<element-property> <element-property>

View file

@ -106,7 +106,7 @@
<type>GstBuffer</type> <type>GstBuffer</type>
<nick>Last Buffer</nick> <nick>Last Buffer</nick>
<blurb>The last buffer received in the sink</blurb> <blurb>The last buffer received in the sink</blurb>
<flags>RW</flags> <flags>R</flags>
</element-property> </element-property>
<element-property> <element-property>
<name>blocksize</name> <name>blocksize</name>

View file

@ -106,7 +106,7 @@
<type>GstBuffer</type> <type>GstBuffer</type>
<nick>Last Buffer</nick> <nick>Last Buffer</nick>
<blurb>The last buffer received in the sink</blurb> <blurb>The last buffer received in the sink</blurb>
<flags>RW</flags> <flags>R</flags>
</element-property> </element-property>
<element-property> <element-property>
<name>blocksize</name> <name>blocksize</name>

View file

@ -96,7 +96,7 @@
<type>gint</type> <type>gint</type>
<nick>File-descriptor</nick> <nick>File-descriptor</nick>
<blurb>File-descriptor for the file being mmap()d</blurb> <blurb>File-descriptor for the file being mmap()d</blurb>
<flags>RW</flags> <flags>R</flags>
<range min="0" max="2147483647"/> <range min="0" max="2147483647"/>
<default>0</default> <default>0</default>
</element-property> </element-property>

View file

@ -128,7 +128,7 @@
<type>gchararray</type> <type>gchararray</type>
<nick>last-message</nick> <nick>last-message</nick>
<blurb>last-message</blurb> <blurb>last-message</blurb>
<flags>RW</flags> <flags>R</flags>
<default>NULL</default> <default>NULL</default>
</element-property> </element-property>
<element-property> <element-property>

View file

@ -66,7 +66,7 @@
<type>guint</type> <type>guint</type>
<nick>Current level (buffers)</nick> <nick>Current level (buffers)</nick>
<blurb>Current number of buffers in the queue</blurb> <blurb>Current number of buffers in the queue</blurb>
<flags>RW</flags> <flags>R</flags>
<range min="0" max="4294967295"/> <range min="0" max="4294967295"/>
<default>0</default> <default>0</default>
</element-property> </element-property>
@ -75,7 +75,7 @@
<type>guint</type> <type>guint</type>
<nick>Current level (kB)</nick> <nick>Current level (kB)</nick>
<blurb>Current amount of data in the queue (bytes)</blurb> <blurb>Current amount of data in the queue (bytes)</blurb>
<flags>RW</flags> <flags>R</flags>
<range min="0" max="4294967295"/> <range min="0" max="4294967295"/>
<default>0</default> <default>0</default>
</element-property> </element-property>
@ -84,7 +84,7 @@
<type>guint64</type> <type>guint64</type>
<nick>Current level (ns)</nick> <nick>Current level (ns)</nick>
<blurb>Current amount of data in the queue (in ns)</blurb> <blurb>Current amount of data in the queue (in ns)</blurb>
<flags>RW</flags> <flags>R</flags>
<range min="0" max="18446744073709551615"/> <range min="0" max="18446744073709551615"/>
<default>0</default> <default>0</default>
</element-property> </element-property>

View file

@ -57,7 +57,7 @@
<type>gint</type> <type>gint</type>
<nick>Num Src Pads</nick> <nick>Num Src Pads</nick>
<blurb>The number of source pads</blurb> <blurb>The number of source pads</blurb>
<flags>RW</flags> <flags>R</flags>
<range min="0" max="2147483647"/> <range min="0" max="2147483647"/>
<default>0</default> <default>0</default>
</element-property> </element-property>
@ -90,7 +90,7 @@
<type>gchararray</type> <type>gchararray</type>
<nick>Last Message</nick> <nick>Last Message</nick>
<blurb>The message describing current status</blurb> <blurb>The message describing current status</blurb>
<flags>RW</flags> <flags>R</flags>
<default>NULL</default> <default>NULL</default>
</element-property> </element-property>
<element-property> <element-property>

View file

@ -66,7 +66,7 @@
<type>GstCaps</type> <type>GstCaps</type>
<nick>caps</nick> <nick>caps</nick>
<blurb>detected capabilities in stream</blurb> <blurb>detected capabilities in stream</blurb>
<flags>RW</flags> <flags>R</flags>
<default>NULL</default> <default>NULL</default>
</element-property> </element-property>
<element-property> <element-property>