static gboolean plugin_loader_load (GstPluginLoader * loader,
const gchar * filename, off_t file_size, time_t file_mtime);
+/* functions used in GstRegistry scanning */
const GstPluginLoaderFuncs _priv_gst_plugin_loader_funcs = {
plugin_loader_new, plugin_loader_free, plugin_loader_load
};
typedef struct _PendingPluginEntry
{
+ /* sequence number */
guint32 tag;
gchar *filename;
off_t file_size;
guint tx_buf_write;
guint tx_buf_read;
+ /* next sequence number (for PendingPluginEntry) */
guint32 next_tag;
guint8 *rx_buf;
static GstPluginLoader *
plugin_loader_new (GstRegistry * registry)
{
- GstPluginLoader *l = g_new0 (GstPluginLoader, 1);
+ GstPluginLoader *l = g_slice_new0 (GstPluginLoader);
if (registry)
l->registry = gst_object_ref (registry);
while (cur) {
PendingPluginEntry *entry = (PendingPluginEntry *) (cur->data);
g_free (entry->filename);
- g_free (entry);
+ g_slice_free (PendingPluginEntry, entry);
cur = g_list_delete_link (cur, cur);
}
- g_free (loader);
+ g_slice_free (GstPluginLoader, loader);
return got_plugin_details;
}
GST_LOG_OBJECT (loader->registry,
"Sending file %s to child. tag %u", filename, loader->next_tag);
- entry = g_new (PendingPluginEntry, 1);
+ entry = g_slice_new (PendingPluginEntry);
entry->tag = loader->next_tag++;
entry->filename = g_strdup (filename);
entry->file_size = file_size;
l->got_plugin_details = TRUE;
/* Now remove this crashy plugin from the head of the list */
l->pending_plugins = g_list_delete_link (cur, cur);
+ g_free (entry->filename);
+ g_slice_free (PendingPluginEntry, entry);
if (l->pending_plugins == NULL)
l->pending_plugins_tail = NULL;
if (!gst_plugin_loader_spawn (l))
plugin->basename = g_path_get_basename (plugin->filename);
plugin->desc.name = g_intern_string (plugin->basename);
- plugin->desc.description = g_strdup_printf ("Plugin for blacklisted file");
- plugin->desc.version = g_intern_string ("0.0.0");
- plugin->desc.license = g_intern_string ("BLACKLIST");
+ plugin->desc.description = "Plugin for blacklisted file";
+ plugin->desc.version = "0.0.0";
+ plugin->desc.license = "BLACKLIST";
plugin->desc.source = plugin->desc.license;
plugin->desc.package = plugin->desc.license;
plugin->desc.origin = plugin->desc.license;
static gboolean
gst_plugin_loader_try_helper (GstPluginLoader * loader, gchar * location)
{
- char *argv[] = { location, "-l", NULL };
+#ifdef __APPLE__
+#if defined(__x86_64__)
+ char *argv[] = { (char *) "/usr/bin/arch", (char *) "-x86_64",
+ location, (char *) "-l", NULL
+ };
+#elif defined(__i386__)
+ char *argv[] = { (char *) "/usr/bin/arch", (char *) "-i386",
+ location, (char *) "-l", NULL
+ };
+#elif defined(__ppc__)
+ char *argv[] = { (char *) "/usr/bin/arch", (char *) "-ppc",
+ location, (char *) "-l", NULL
+ };
+#elif defined(__ppc64__)
+ char *argv[] = { (char *) "/usr/bin/arch", (char *) "-ppc64",
+ location, (char *) "-l", NULL
+ };
+#endif
+#else /* ! __APPLE__ */
+ char *argv[] = { location, (char *) "-l", NULL };
+#endif
+
+#ifdef __APPLE__
+ GST_LOG ("Trying to spawn gst-plugin-scanner helper at %s with arch %s",
+ location, argv[1]);
+#else
GST_LOG ("Trying to spawn gst-plugin-scanner helper at %s", location);
+#endif
+
if (!g_spawn_async_with_pipes (NULL, argv, NULL,
G_SPAWN_DO_NOT_REAP_CHILD /* | G_SPAWN_STDERR_TO_DEV_NULL */ ,
NULL, NULL, &loader->child_pid, &loader->fd_w.fd, &loader->fd_r.fd,
}
gboolean
-_gst_plugin_loader_client_run ()
+_gst_plugin_loader_client_run (void)
{
GstPluginLoader *l;
GstPlugin *newplugin;
GList *chunks = NULL;
- GST_DEBUG ("Plugin scanner loading file %s. tag %u\n", filename, tag);
+ GST_DEBUG ("Plugin scanner loading file %s. tag %u", filename, tag);
#if 0 /* Test code - crash based on filename */
if (strstr (filename, "coreelements") == NULL) {
GstRegistryChunk *cur = walk->data;
put_chunk (l, cur, &offset);
- if (!(cur->flags & GST_REGISTRY_CHUNK_FLAG_CONST))
- g_free (cur->data);
- g_free (cur);
+ _priv_gst_registry_chunk_free (cur);
}
g_list_free (chunks);
for (walk = chunks; walk; walk = g_list_next (walk)) {
GstRegistryChunk *cur = walk->data;
- if (!(cur->flags & GST_REGISTRY_CHUNK_FLAG_CONST))
- g_free (cur->data);
- g_free (cur);
+ _priv_gst_registry_chunk_free (cur);
}
g_list_free (chunks);
case PACKET_EXIT:
gst_poll_fd_ctl_read (l->fdset, &l->fd_r, FALSE);
if (l->is_child) {
- /* Respond, then we keep looping until the parent closes the fd */
+ /* Respond */
put_packet (l, PACKET_EXIT, 0, NULL, 0);
- } else {
- l->rx_done = TRUE; /* All done reading from child */
}
+ l->rx_done = TRUE;
return TRUE;
case PACKET_LOAD_PLUGIN:{
if (!l->is_child)
} else {
cur = g_list_delete_link (cur, cur);
g_free (e->filename);
- g_free (e);
+ g_slice_free (PendingPluginEntry, e);
}
}
if (entry != NULL) {
g_free (entry->filename);
- g_free (entry);
+ g_slice_free (PendingPluginEntry, entry);
}
/* Remove the plugin entry we just loaded */