diff options
author | Wim Taymans <wim.taymans@collabora.co.uk> | 2009-09-10 11:41:56 +0200 |
---|---|---|
committer | Wim Taymans <wim.taymans@collabora.co.uk> | 2009-09-10 11:54:01 +0200 |
commit | 06e27c520909d0aaf6e5049b375d85015286c889 (patch) | |
tree | 0cb779bba40e25b75a02822ecec7ee2fc070e6c6 /gst/gstpluginfeature.c | |
parent | a4d38192f1b4ec3112c7a330147abefb90fed87c (diff) |
pluginfeature: improve version check
Also parse the nano of the version and assume that X.Y.Z-1.1 >= X.Y.Z
With this change we can also check development versions against the version of
the upcomming release.
Diffstat (limited to 'gst/gstpluginfeature.c')
-rw-r--r-- | gst/gstpluginfeature.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/gst/gstpluginfeature.c b/gst/gstpluginfeature.c index a38122aec0..3065f53887 100644 --- a/gst/gstpluginfeature.c +++ b/gst/gstpluginfeature.c @@ -290,12 +290,16 @@ gst_plugin_feature_check_version (GstPluginFeature * feature, if (plugin) { const gchar *ver_str; - guint major, minor, micro; + guint major, minor, micro, nano; + gint nscan; ver_str = gst_plugin_get_version (plugin); g_return_val_if_fail (ver_str != NULL, FALSE); - if (sscanf (ver_str, "%u.%u.%u", &major, &minor, µ) == 3) { + nscan = sscanf (ver_str, "%u.%u.%u.%u", &major, &minor, µ, &nano); + GST_DEBUG ("version string '%s' parsed to %d values", ver_str, nscan); + + if (nscan >= 3) { if (major > min_major) ret = TRUE; else if (major < min_major) @@ -306,6 +310,10 @@ gst_plugin_feature_check_version (GstPluginFeature * feature, ret = FALSE; else if (micro > min_micro) ret = TRUE; + /* micro is 1 smaller but we have a nano version, this is the upcomming + * release of the requested version and we're ok then */ + else if (nscan == 4 && nano > 0 && (micro + 1 == min_micro)) + ret = TRUE; else ret = (micro == min_micro); |