summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@gmail.com>2003-02-21 19:41:02 +0000
committerWim Taymans <wim.taymans@gmail.com>2003-02-21 19:41:02 +0000
commitf5ef4dec93d6316d57b2fddcbbf483b715c2ffec (patch)
tree1db0452ae023bf1719ca4e511805e815a0105e31 /tools
parent2923f6f8c8613a8d92b493dbfc4e7ac940388642 (diff)
- indentation fixes
Original commit message from CVS: - indentation fixes - dynamic properties fixes - object hierarchy fixes - float ranges and property fixes
Diffstat (limited to 'tools')
-rw-r--r--tools/gst-xmlinspect.c46
-rw-r--r--tools/xml2text.xsl95
2 files changed, 104 insertions, 37 deletions
diff --git a/tools/gst-xmlinspect.c b/tools/gst-xmlinspect.c
index 5ed04d2ab..77db842c5 100644
--- a/tools/gst-xmlinspect.c
+++ b/tools/gst-xmlinspect.c
@@ -363,7 +363,7 @@ print_element_properties (GstElement *element, gint pfx)
case G_TYPE_FLOAT:
{
GParamSpecFloat *pfloat = G_PARAM_SPEC_FLOAT (param);
- PUT_STRING (pfx + 2, "<range min=\"%g\" max=\"%g\"/>",
+ PUT_STRING (pfx + 2, "<range min=\"%f\" max=\"%f\"/>",
pfloat->minimum, pfloat->maximum);
PUT_ESCAPED (pfx + 2, "default", g_strdup_value_contents (&value));
break;
@@ -448,39 +448,48 @@ print_element_dynparamaters (GstElement *element, gint pfx)
GParamSpec** specs;
gint x;
+ PUT_START_TAG (pfx, "dyn-params");
+
if((dpman = gst_dpman_get_manager (element))) {
- PUT_START_TAG (pfx, "dyn-params");
specs = gst_dpman_list_dparam_specs (dpman);
for (x = 0; specs[x] != NULL; x++) {
- g_print (" %-20.20s: ", g_param_spec_get_name (specs[x]));
+ PUT_START_TAG (pfx + 1, "dyn-param");
+
+ PUT_ESCAPED (pfx + 2, "name", g_param_spec_get_name (specs[x]));
+ PUT_ESCAPED (pfx + 2, "type", g_type_name (specs[x]->value_type));
+ PUT_ESCAPED (pfx + 2, "nick", g_param_spec_get_nick (specs[x]));
+ PUT_ESCAPED (pfx + 2, "blurb", g_param_spec_get_blurb (specs[x]));
switch (G_PARAM_SPEC_VALUE_TYPE (specs[x])) {
case G_TYPE_INT64:
- g_print ("64 Bit Integer (Default %" G_GINT64_FORMAT ", Range %" G_GINT64_FORMAT " -> %" G_GINT64_FORMAT ")",
- ((GParamSpecInt64 *) specs[x])->default_value,
- ((GParamSpecInt64 *) specs[x])->minimum,
- ((GParamSpecInt64 *) specs[x])->maximum);
+ PUT_STRING (pfx + 2, "<range min=\"%"G_GINT64_FORMAT"\" max=\"%"G_GINT64_FORMAT"\"/>",
+ ((GParamSpecInt64 *) specs[x])->minimum,
+ ((GParamSpecInt64 *) specs[x])->maximum);
+ PUT_STRING (pfx + 2, "<default>%"G_GINT64_FORMAT"</default>",
+ ((GParamSpecInt64 *) specs[x])->default_value);
break;
case G_TYPE_INT:
- g_print ("Integer (Default %d, Range %d -> %d)",
- ((GParamSpecInt *) specs[x])->default_value,
- ((GParamSpecInt *) specs[x])->minimum,
- ((GParamSpecInt *) specs[x])->maximum);
+ PUT_STRING (pfx + 2, "<range min=\"%d\" max=\"%d\"/>",
+ ((GParamSpecInt *) specs[x])->minimum,
+ ((GParamSpecInt *) specs[x])->maximum);
+ PUT_STRING (pfx + 2, "<default>%d</default>",
+ ((GParamSpecInt *) specs[x])->default_value);
break;
case G_TYPE_FLOAT:
- g_print ("Float. Default: %-8.8s %15.7g\n", "",
- ((GParamSpecFloat *) specs[x])->default_value);
- g_print ("%-23.23s Range: %15.7g - %15.7g", "",
+ PUT_STRING (pfx + 2, "<range min=\"%f\" max=\"%f\"/>",
((GParamSpecFloat *) specs[x])->minimum,
((GParamSpecFloat *) specs[x])->maximum);
+ PUT_STRING (pfx + 2, "<default>%f</default>",
+ ((GParamSpecFloat *) specs[x])->default_value);
break;
default:
- g_print ("unknown %ld", G_PARAM_SPEC_VALUE_TYPE (specs[x]));
+ break;
}
- PUT_END_TAG (pfx, "dyn-params");
+ PUT_END_TAG (pfx + 1, "dyn-param");
}
g_free (specs);
}
+ PUT_END_TAG (pfx, "dyn-params");
}
static void
@@ -524,8 +533,6 @@ print_element_signals (GstElement *element, gint pfx)
for (j = 0; j < n_params; j++) {
PUT_ESCAPED (pfx + 3, "type", g_type_name (param_types[j]));
}
- if (k == 0)
- PUT_ESCAPED (pfx + 3, "type", "gpointer");
PUT_END_TAG (pfx + 2, "params");
@@ -754,8 +761,7 @@ print_element_info (GstElementFactory *factory)
PUT_END_TAG (3, "implementation");
if (realpad->caps) {
- g_print (" Capabilities:\n");
- print_caps (realpad->caps, 8);
+ print_caps (realpad->caps, 3);
}
PUT_END_TAG (2, "pad");
}
diff --git a/tools/xml2text.xsl b/tools/xml2text.xsl
index 448432c13..6797ee598 100644
--- a/tools/xml2text.xsl
+++ b/tools/xml2text.xsl
@@ -1,6 +1,7 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
-<xsl:output method="text" encoding="us-ascii" omit-xml-declaration="yes" indent="no"/>
+ <xsl:output method="text" encoding="us-ascii" omit-xml-declaration="yes" indent="no"/>
+ <xsl:variable name="padding" select="string(' ')"/>
<xsl:template match="/element">
<xsl:apply-templates select="name"/>
@@ -11,9 +12,9 @@
<xsl:apply-templates select="element-implementation"/>
<xsl:apply-templates select="clocking-interaction"/>
<xsl:apply-templates select="indexing-capabilities"/>
- <xsl:apply-templates select="dyn-params"/>
<xsl:apply-templates select="pads"/>
<xsl:apply-templates select="element-properties"/>
+ <xsl:apply-templates select="dyn-params"/>
<xsl:apply-templates select="element-signals"/>
<xsl:apply-templates select="element-actions"/>
</xsl:template>
@@ -35,7 +36,27 @@
<xsl:text>&#10;</xsl:text>
</xsl:template>
+ <xsl:template name="object">
+ <xsl:param name="i"/>
+ <xsl:param name="j"/>
+ <xsl:if test="count($i/*) &gt; 0">
+ <xsl:call-template name="object">
+ <xsl:with-param name="i" select="$i/object"/>
+ <xsl:with-param name="j" select="$j - 1"/>
+ </xsl:call-template>
+ <xsl:value-of select="substring ($padding, 1, $j * 6)"/>
+ <xsl:text> +----</xsl:text>
+ </xsl:if>
+ <xsl:value-of select="$i/@name"/>
+ <xsl:text>&#10;</xsl:text>
+ </xsl:template>
+
<xsl:template match="object">
+ <xsl:call-template name="object">
+ <xsl:with-param name="i" select="."/>
+ <xsl:with-param name="j" select="count(.//object[(*)])"/>
+ </xsl:call-template>
+ <xsl:text>&#10;</xsl:text>
</xsl:template>
<xsl:template match="pad-templates">
@@ -105,10 +126,22 @@
<xsl:text>&#10;</xsl:text>
</xsl:template>
+ <xsl:template match="float" mode="list">
+ <xsl:text> Float: </xsl:text>
+ <xsl:value-of select="@value"/>
+ <xsl:text>&#10;</xsl:text>
+ </xsl:template>
+
+ <xsl:template match="floatrange" mode="list">
+ <xsl:text> Float range: </xsl:text>
+ <xsl:value-of select="concat(@min, ' - ', @max)"/>
+ <xsl:text>&#10;</xsl:text>
+ </xsl:template>
+
<!-- propety entries in normal mode -->
<xsl:template match="string">
<xsl:text> </xsl:text>
- <xsl:value-of select="@name"/>
+ <xsl:value-of select="substring (concat (@name, $padding), 1, 15)"/>
<xsl:text> : String: '</xsl:text>
<xsl:value-of select="@value"/>
<xsl:text>'&#10;</xsl:text>
@@ -116,7 +149,7 @@
<xsl:template match="fourcc">
<xsl:text> </xsl:text>
- <xsl:value-of select="@name"/>
+ <xsl:value-of select="substring (concat (@name, $padding), 1, 15)"/>
<xsl:text> : FourCC: '</xsl:text>
<xsl:value-of select="@hexvalue"/>
<xsl:text>'&#10;</xsl:text>
@@ -124,7 +157,7 @@
<xsl:template match="int">
<xsl:text> </xsl:text>
- <xsl:value-of select="@name"/>
+ <xsl:value-of select="substring (concat (@name, $padding), 1, 15)"/>
<xsl:text> : Integer: </xsl:text>
<xsl:value-of select="@value"/>
<xsl:text>&#10;</xsl:text>
@@ -132,12 +165,28 @@
<xsl:template match="range">
<xsl:text> </xsl:text>
- <xsl:value-of select="@name"/>
+ <xsl:value-of select="substring (concat (@name, $padding), 1, 15)"/>
<xsl:text> : Integer range: </xsl:text>
<xsl:value-of select="concat(@min, ' - ', @max)"/>
<xsl:text>&#10;</xsl:text>
</xsl:template>
+ <xsl:template match="float">
+ <xsl:text> </xsl:text>
+ <xsl:value-of select="substring (concat (@name, $padding), 1, 15)"/>
+ <xsl:text> : Float: </xsl:text>
+ <xsl:value-of select="@value"/>
+ <xsl:text>&#10;</xsl:text>
+ </xsl:template>
+
+ <xsl:template match="floatrange">
+ <xsl:text> </xsl:text>
+ <xsl:value-of select="substring (concat (@name, $padding), 1, 15)"/>
+ <xsl:text> : Float range: </xsl:text>
+ <xsl:value-of select="concat(@min, ' - ', @max)"/>
+ <xsl:text>&#10;</xsl:text>
+ </xsl:template>
+
<xsl:template match="flag">
<xsl:text> </xsl:text>
<xsl:value-of select="."/>
@@ -202,12 +251,13 @@
</xsl:template>
<xsl:template match="dyn-params">
- <xsl:text> Dynamic Parameters:&#10;</xsl:text>
+ <xsl:text>Dynamic Parameters:&#10;</xsl:text>
<xsl:choose>
<xsl:when test="count(*) = 0">
<xsl:text> none&#10;</xsl:text>
</xsl:when>
<xsl:otherwise>
+ <xsl:apply-templates select="dyn-param"/>
</xsl:otherwise>
</xsl:choose>
<xsl:text>&#10;</xsl:text>
@@ -327,23 +377,33 @@
<xsl:text>. (Default </xsl:text>
<xsl:value-of select="."/>
<xsl:text>)</xsl:text>
+ <xsl:text>&#10;</xsl:text>
+ </xsl:template>
+
+ <xsl:template match="range" mode="params">
+ <xsl:value-of select="substring ($padding, 1, 25)"/>
+ <xsl:text>Range : </xsl:text>
+ <xsl:value-of select="concat(@min, ' - ', @max)"/>
+ <xsl:text>&#10;</xsl:text>
</xsl:template>
- <xsl:template match="element-property">
+ <xsl:template match="element-property|dyn-param">
<xsl:text> </xsl:text>
- <xsl:value-of select="name"/>
- <xsl:text>:&#9; </xsl:text>
+ <xsl:value-of select="substring (concat(name, $padding), 1, 20)"/>
+ <xsl:text> : </xsl:text>
<xsl:value-of select="blurb"/>
<xsl:text>&#10;</xsl:text>
- <xsl:text> </xsl:text>
+ <xsl:value-of select="substring ($padding, 1, 25)"/>
<xsl:value-of select="type"/>
<xsl:apply-templates select="default"/>
- <xsl:text>&#10;</xsl:text>
+ <xsl:apply-templates select="range" mode="params"/>
</xsl:template>
<xsl:template match="params">
<xsl:for-each select="type">
- <xsl:text>,&#10; </xsl:text>
+ <xsl:text>,&#10;</xsl:text>
+ <xsl:value-of select="substring ($padding, 1, 25)"/>
+ <xsl:value-of select="substring ($padding, 1, 20)"/>
<xsl:value-of select="."/>
<xsl:text> arg</xsl:text>
<xsl:value-of select="position()"/>
@@ -351,9 +411,7 @@
</xsl:template>
<xsl:template match="signal">
- <xsl:text> &quot;</xsl:text>
- <xsl:value-of select="name"/>
- <xsl:text>&quot; :</xsl:text>
+ <xsl:value-of select="substring (concat('&quot;', name, '&quot;', $padding), 1, 25)"/>
<xsl:value-of select="return-type"/>
<xsl:text> user_function </xsl:text>
<xsl:value-of select="concat ('(', object-type, '* object')"/>
@@ -369,7 +427,10 @@
<xsl:otherwise>
<xsl:for-each select="signal">
<xsl:apply-templates select="."/>
- <xsl:text>,&#10; gpointer user_data);&#10;</xsl:text>
+ <xsl:text>,&#10;</xsl:text>
+ <xsl:value-of select="substring ($padding, 1, 25)"/>
+ <xsl:value-of select="substring ($padding, 1, 20)"/>
+ <xsl:text>gpointer user_data);&#10;</xsl:text>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>