typeid = gst_type_find_by_mime (mime);
if (typeid == 0) {
- GstTypeFactory *factory = g_new0 (GstTypeFactory, 1);
+ GstTypeFactory factory; // = g_new0 (GstTypeFactory, 1);
- factory->mime = g_strdup (mime);
- factory->exts = NULL;
- factory->typefindfunc = NULL;
+ factory.mime = g_strdup (mime);
+ factory.exts = NULL;
+ factory.typefindfunc = NULL;
- typeid = gst_type_register (factory);
+ typeid = gst_type_register (&factory);
}
return typeid;
}
{
GstCaps *caps = g_new0 (GstCaps, 1);
xmlNodePtr field = parent->childs;
+ gchar *content;
while (field) {
if (!strcmp (field->name, "name")) {
- caps->name = g_strdup (xmlNodeGetContent (field));
+ caps->name = xmlNodeGetContent (field);
}
if (!strcmp (field->name, "type")) {
- caps->id = get_type_for_mime (xmlNodeGetContent (field));
+ content = xmlNodeGetContent (field);
+ caps->id = get_type_for_mime (content);
+ g_free (content);
}
else if (!strcmp (field->name, "properties")) {
caps->properties = gst_props_load_thyself (field);
}
GST_INFO (GST_CAT_GST_INIT, "CPU features: %s",featurelist);
+ g_free(featurelist);
}
GstCPUFlags
while (children) {
if (!strcmp(children->name, "name")) {
- factory->name = g_strdup(xmlNodeGetContent(children));
+ factory->name = xmlNodeGetContent(children);
}
if (!strcmp(children->name, "longname")) {
- factory->details->longname = g_strdup(xmlNodeGetContent(children));
+ factory->details->longname = xmlNodeGetContent(children);
}
if (!strcmp(children->name, "class")) {
- factory->details->klass = g_strdup(xmlNodeGetContent(children));
+ factory->details->klass = xmlNodeGetContent(children);
}
if (!strcmp(children->name, "description")) {
- factory->details->description = g_strdup(xmlNodeGetContent(children));
+ factory->details->description = xmlNodeGetContent(children);
}
if (!strcmp(children->name, "version")) {
- factory->details->version = g_strdup(xmlNodeGetContent(children));
+ factory->details->version = xmlNodeGetContent(children);
}
if (!strcmp(children->name, "author")) {
- factory->details->author = g_strdup(xmlNodeGetContent(children));
+ factory->details->author = xmlNodeGetContent(children);
}
if (!strcmp(children->name, "copyright")) {
- factory->details->copyright = g_strdup(xmlNodeGetContent(children));
+ factory->details->copyright = xmlNodeGetContent(children);
}
if (!strcmp(children->name, "padtemplate")) {
GstPadTemplate *template;
while (field) {
if (!strcmp(field->name, "nametemplate")) {
- factory->name_template = g_strdup(xmlNodeGetContent(field));
+ factory->name_template = xmlNodeGetContent(field);
}
if (!strcmp(field->name, "direction")) {
gchar *value = xmlNodeGetContent(field);
else if (!strcmp(value, "src")) {
factory->direction = GST_PAD_SRC;
}
+ g_free (value);
}
if (!strcmp(field->name, "presence")) {
gchar *value = xmlNodeGetContent(field);
else if (!strcmp(value, "sometimes")) {
factory->presence = GST_PAD_SOMETIMES;
}
+ g_free (value);
}
else if (!strcmp(field->name, "caps")) {
factory->caps = g_list_append(factory->caps, gst_caps_load_thyself (field));
GList *pads;
gint elementcount = 0;
gint retval = 0;
-
+
priv->binlevel++;
if (GST_IS_PIPELINE(parent)) { closingchar = '\0';DEBUG("in pipeline "); }
} else {
// we have an element
DEBUG("attempting to create element '%s'\n",arg);
- element = gst_elementfactory_make(arg,gst_parse_unique_name(arg,priv));
+ ptr = gst_parse_unique_name(arg,priv);
+ element = gst_elementfactory_make(arg,ptr);
+ g_free(ptr);
if (!element) {
fprintf(stderr,"Couldn't create a '%s', no such element or need to run gstraemer-register?\n",arg);
// exit(-1);
return;
}
gst_plugin_load_thyself (doc->root);
+
+ xmlFreeDoc (doc);
}
static time_t
DIR *dir;
struct dirent *dirent;
gboolean loaded = FALSE;
+ gchar *dirname;
//g_print("recursive load of '%s' in '%s'\n", name, directory);
dir = opendir(directory);
while ((dirent = readdir(dir))) {
/* don't want to recurse in place or backwards */
if (strcmp(dirent->d_name,".") && strcmp(dirent->d_name,"..")) {
- loaded = gst_plugin_load_recurse(g_strjoin("/",directory,dirent->d_name,
- NULL),name);
- if (loaded && name) return TRUE;
+ dirname = g_strjoin("/",directory,dirent->d_name,NULL);
+ loaded = gst_plugin_load_recurse(dirname,name);
+ g_free(dirname);
+ if (loaded && name) {
+ closedir(dir);
+ return TRUE;
+ }
}
}
closedir(dir);
GList *path;
gchar *libspath;
GstPlugin *plugin;
+ gchar *pluginname;
//g_print("attempting to load plugin '%s'\n",name);
path = _gst_plugin_paths;
while (path != NULL) {
- if (gst_plugin_load_absolute(g_module_build_path(path->data,name)))
+ pluginname = g_module_build_path(path->data,name);
+ if (gst_plugin_load_absolute(pluginname)) {
+ g_free(pluginname);
return TRUE;
+ }
+ g_free(pluginname);
libspath = g_strconcat(path->data,"/.libs",NULL);
//g_print("trying to load '%s'\n",g_module_build_path(libspath,name));
- if (gst_plugin_load_absolute(g_module_build_path(libspath,name))) {
- g_free(libspath);
+ pluginname = g_module_build_path(libspath,name);
+ g_free(libspath);
+ if (gst_plugin_load_absolute(pluginname)) {
+ g_free(pluginname);
return TRUE;
}
- g_free(libspath);
+ g_free(pluginname);
//g_print("trying to load '%s' from '%s'\n",name,path->data);
- if (gst_plugin_load_recurse(path->data,g_module_build_path("",name))) {
+ pluginname = g_module_build_path("",name);
+ if (gst_plugin_load_recurse(path->data,pluginname)) {
+ g_free(pluginname);
return TRUE;
}
+ g_free(pluginname);
path = g_list_next(path);
}
return FALSE;
xmlNodePtr kinderen;
gint elementcount = 0;
gint typecount = 0;
+ gchar *pluginname;
kinderen = parent->childs; // Dutch invasion :-)
while (kinderen) {
while (field) {
if (!strcmp(field->name, "name")) {
- if (gst_plugin_find(xmlNodeGetContent(field))) {
+ pluginname = xmlNodeGetContent(field);
+ if (gst_plugin_find(pluginname)) {
+ g_free(pluginname);
g_free(plugin);
plugin = NULL;
break;
- }
- else {
- plugin->name = g_strdup(xmlNodeGetContent(field));
+ } else {
+ plugin->name = pluginname;
}
}
else if (!strcmp(field->name, "longname")) {
- plugin->longname = g_strdup(xmlNodeGetContent(field));
+ plugin->longname = xmlNodeGetContent(field);
}
else if (!strcmp(field->name, "filename")) {
- plugin->filename = g_strdup(xmlNodeGetContent(field));
+ plugin->filename = xmlNodeGetContent(field);
}
else if (!strcmp(field->name, "element")) {
GstElementFactory *factory = gst_elementfactory_load_thyself(field);
gst_props_save_thyself_func (GstPropsEntry *entry, xmlNodePtr parent)
{
xmlNodePtr subtree;
+ gchar *str;
switch (entry->propstype) {
case GST_PROPS_INT_ID_NUM:
subtree = xmlNewChild (parent, NULL, "int", NULL);
xmlNewProp (subtree, "name", g_quark_to_string (entry->propid));
- xmlNewProp (subtree, "value", g_strdup_printf ("%d", entry->data.int_data));
+ str = g_strdup_printf ("%d", entry->data.int_data);
+ xmlNewProp (subtree, "value", str);
+ g_free(str);
break;
case GST_PROPS_INT_RANGE_ID_NUM:
subtree = xmlNewChild (parent, NULL, "range", NULL);
xmlNewProp (subtree, "name", g_quark_to_string (entry->propid));
- xmlNewProp (subtree, "min", g_strdup_printf ("%d", entry->data.int_range_data.min));
- xmlNewProp (subtree, "max", g_strdup_printf ("%d", entry->data.int_range_data.max));
+ str = g_strdup_printf ("%d", entry->data.int_range_data.min);
+ xmlNewProp (subtree, "min", str);
+ g_free(str);
+ str = g_strdup_printf ("%d", entry->data.int_range_data.max);
+ xmlNewProp (subtree, "max", str);
+ g_free(str);
break;
case GST_PROPS_FOURCC_ID_NUM:
- xmlAddChild (parent, xmlNewComment (g_strdup_printf ("%4.4s", (gchar *)&entry->data.fourcc_data)));
+ str = g_strdup_printf ("%4.4s", (gchar *)&entry->data.fourcc_data);
+ xmlAddChild (parent, xmlNewComment (str));
+ g_free(str);
subtree = xmlNewChild (parent, NULL, "fourcc", NULL);
xmlNewProp (subtree, "name", g_quark_to_string (entry->propid));
- xmlNewProp (subtree, "hexvalue", g_strdup_printf ("%08x", entry->data.fourcc_data));
+ str = g_strdup_printf ("%08x", entry->data.fourcc_data);
+ xmlNewProp (subtree, "hexvalue", str);
+ g_free(str);
break;
case GST_PROPS_BOOL_ID_NUM:
subtree = xmlNewChild (parent, NULL, "boolean", NULL);
gst_props_load_thyself_func (xmlNodePtr field)
{
GstPropsEntry *entry;
+ gchar *prop;
entry = g_new0 (GstPropsEntry, 1);
if (!strcmp(field->name, "int")) {
entry->propstype = GST_PROPS_INT_ID_NUM;
- entry->propid = g_quark_from_string (xmlGetProp(field, "name"));
- sscanf (xmlGetProp(field, "value"), "%d", &entry->data.int_data);
+ prop = xmlGetProp(field, "name");
+ entry->propid = g_quark_from_string (prop);
+ g_free (prop);
+ prop = xmlGetProp(field, "value");
+ sscanf (prop, "%d", &entry->data.int_data);
+ g_free (prop);
}
else if (!strcmp(field->name, "range")) {
entry->propstype = GST_PROPS_INT_RANGE_ID_NUM;
- entry->propid = g_quark_from_string (xmlGetProp(field, "name"));
- sscanf (xmlGetProp(field, "min"), "%d", &entry->data.int_range_data.min);
- sscanf (xmlGetProp(field, "max"), "%d", &entry->data.int_range_data.max);
+ prop = xmlGetProp(field, "name");
+ entry->propid = g_quark_from_string (prop);
+ g_free (prop);
+ prop = xmlGetProp (field, "min");
+ sscanf (prop, "%d", &entry->data.int_range_data.min);
+ g_free (prop);
+ prop = xmlGetProp (field, "min");
+ sscanf (prop, "%d", &entry->data.int_range_data.max);
+ g_free (prop);
}
else if (!strcmp(field->name, "boolean")) {
entry->propstype = GST_PROPS_BOOL_ID_NUM;
- entry->propid = g_quark_from_string (xmlGetProp(field, "name"));
- if (!strcmp (xmlGetProp(field, "value"), "false")) entry->data.bool_data = 0;
+ prop = xmlGetProp(field, "name");
+ entry->propid = g_quark_from_string (prop);
+ g_free (prop);
+ prop = xmlGetProp (field, "value");
+ if (!strcmp (prop, "false")) entry->data.bool_data = 0;
else entry->data.bool_data = 1;
+ g_free (prop);
}
else if (!strcmp(field->name, "fourcc")) {
entry->propstype = GST_PROPS_FOURCC_ID_NUM;
- entry->propid = g_quark_from_string (xmlGetProp(field, "name"));
- sscanf (xmlGetProp(field, "hexvalue"), "%08x", &entry->data.fourcc_data);
+ prop = xmlGetProp(field, "name");
+ entry->propid = g_quark_from_string (prop);
+ g_free (prop);
+ prop = xmlGetProp (field, "hexvalue");
+ sscanf (prop, "%08x", &entry->data.fourcc_data);
+ g_free (prop);
}
return entry;
{
GstProps *props = g_new0 (GstProps, 1);
xmlNodePtr field = parent->childs;
+ gchar *prop;
while (field) {
if (!strcmp (field->name, "list")) {
entry = g_new0 (GstPropsEntry, 1);
entry->propstype = GST_PROPS_LIST_ID_NUM;
- entry->propid = g_quark_from_string (xmlGetProp(field, "name"));
+ prop = xmlGetProp (field, "name");
+ entry->propid = g_quark_from_string (prop);
+ g_free (prop);
while (subfield) {
GstPropsEntry *subentry = gst_props_load_thyself_func (subfield);
while (field) {
if (!strcmp (field->name, "mime")) {
- factory->mime = g_strdup (xmlNodeGetContent (field));
+ factory->mime = xmlNodeGetContent (field);
}
else if (!strcmp (field->name, "extensions")) {
- factory->exts = g_strdup (xmlNodeGetContent (field));
+ factory->exts = xmlNodeGetContent (field);
}
else if (!strcmp (field->name, "typefind")) {
factory->typefindfunc = gst_type_typefind_dummy;