const gchar * package, const gchar * origin)
{
GstPluginDesc desc = { major_version, minor_version, name, description,
- init_func, version, license, source, package, origin,
+ init_func, version, license, source, package, origin, NULL,
};
GstPlugin *plugin;
gboolean res = FALSE;
{
GstPluginDesc desc = { major_version, minor_version, name, description,
(GstPluginInitFunc) init_full_func, version, license, source, package,
- origin,
+ origin, NULL,
};
GstPlugin *plugin;
gboolean res = FALSE;
}
#endif /* HAVE_SIGACTION */
+/* g_time_val_from_iso8601() doesn't do quite what we want */
+static gboolean
+check_release_datetime (const gchar * date_time)
+{
+ guint64 val;
+
+ /* we require YYYY-MM-DD or YYYY-MM-DDTHH:MMZ format */
+ if (!g_ascii_isdigit (*date_time))
+ return FALSE;
+
+ val = g_ascii_strtoull (date_time, (gchar **) & date_time, 10);
+ if (val < 2000 || val > 2100 || *date_time != '-')
+ return FALSE;
+
+ val = g_ascii_strtoull (date_time + 1, (gchar **) & date_time, 10);
+ if (val == 0 || val > 12 || *date_time != '-')
+ return FALSE;
+
+ val = g_ascii_strtoull (date_time + 1, (gchar **) & date_time, 10);
+ if (val == 0 || val > 32)
+ return FALSE;
+
+ /* end of string or date/time separator + HH:MMZ */
+ if (*date_time == 'T' || *date_time == ' ') {
+ val = g_ascii_strtoull (date_time + 1, (gchar **) & date_time, 10);
+ if (val > 24 || *date_time != ':')
+ return FALSE;
+
+ val = g_ascii_strtoull (date_time + 1, (gchar **) & date_time, 10);
+ if (val > 59 || *date_time != 'Z')
+ return FALSE;
+
+ ++date_time;
+ }
+
+ return (*date_time == '\0');
+}
+
static GStaticMutex gst_plugin_loading_mutex = G_STATIC_MUTEX_INIT;
#define CHECK_PLUGIN_DESC_FIELD(desc,field,fn) \
CHECK_PLUGIN_DESC_FIELD (plugin->orig_desc, source, filename);
CHECK_PLUGIN_DESC_FIELD (plugin->orig_desc, package, filename);
CHECK_PLUGIN_DESC_FIELD (plugin->orig_desc, origin, filename);
+
+ if (plugin->orig_desc->release_datetime != NULL &&
+ !check_release_datetime (plugin->orig_desc->release_datetime)) {
+ GST_ERROR ("GstPluginDesc for '%s' has invalid datetime '%s'",
+ filename, plugin->orig_desc->release_datetime);
+ plugin->orig_desc->release_datetime = NULL;
+ }
}
GST_LOG ("Plugin %p for file \"%s\" prepared, calling entry function...",
dest->source = g_intern_string (src->source);
dest->package = g_intern_string (src->package);
dest->origin = g_intern_string (src->origin);
+ dest->release_datetime = g_intern_string (src->release_datetime);
}
/**
* @source: source module plugin belongs to
* @package: shipped package plugin belongs to
* @origin: URL to provider of plugin
- * @_gst_reserved: private, for later expansion
+ * @release_datetime: date time string in ISO 8601 format (or rather, a
+ * subset thereof), or NULL. Allowed are the following formats:
+ * "YYYY-MM-DD" and "YYY-MM-DDTHH:MMZ" (with 'T' a separator and 'Z'
+ * indicating UTC/Zulu time). This field should be set via the
+ * GST_PACKAGE_RELEASE_DATETIME preprocessor macro (Since: 0.10.31)
*
* A plugin should export a variable of this type called plugin_desc. The plugin
* loader will use the data provided there to initialize the plugin.
const gchar *source;
const gchar *package;
const gchar *origin;
-
- gpointer _gst_reserved[GST_PADDING];
+ const gchar *release_datetime;
+ /*< private >*/
+ gpointer _gst_reserved[GST_PADDING - 1];
};
gpointer _gst_reserved[GST_PADDING];
};
+#ifdef GST_PACKAGE_RELEASE_DATETIME
+#define __GST_PACKAGE_RELEASE_DATETIME GST_PACKAGE_RELEASE_DATETIME
+#else
+#define __GST_PACKAGE_RELEASE_DATETIME NULL
+#endif
+
/**
* GST_PLUGIN_DEFINE:
* @major: major version number of the gstreamer-core that plugin was compiled for
* by other applications.
*
* The macro uses a define named PACKAGE for the #GstPluginDesc,source field.
+ * When using autoconf, this is usually set automatically via the AC_INIT
+ * macro, and set in config.h. If you are not using autoconf, you will need to
+ * define PACKAGE yourself and set it to a short mnemonic string identifying
+ * your application/package, e.g. 'someapp' or 'my-plugins-foo.
+ *
+ * If defined, the GST_PACKAGE_RELEASE_DATETIME will also be used for the
+ * #GstPluginDesc,release_datetime field.
*/
#define GST_PLUGIN_DEFINE(major,minor,name,description,init,version,license,package,origin) \
G_BEGIN_DECLS \
PACKAGE, \
package, \
origin, \
+ __GST_PACKAGE_RELEASE_DATETIME, \
GST_PADDING_INIT \
}; \
G_END_DECLS
PACKAGE, \
package, \
origin, \
+ NULL, \
GST_PADDING_INIT \
}; \
_gst_plugin_register_static (&plugin_desc_); \