some editor changes= loading of save pipelines (not working) added include in gstdebug.h for getpid property loading ...

Original commit message from CVS:
some editor changes= loading of save pipelines (not working)
added include in gstdebug.h for getpid
property loading implemented
GstXML can now be queried for the toplevel elements.
This commit is contained in:
Wim Taymans 2000-12-16 17:12:28 +00:00
parent da03fde054
commit c6ac8a0f6b
18 changed files with 475 additions and 60 deletions

View file

@ -27,7 +27,9 @@
extern gboolean _gst_plugin_spew;
int main(int argc,char *argv[]) {
int
main (int argc, char *argv[])
{
GstEditorProject *project;
bindtextdomain (PACKAGE, PACKAGE_LOCALE_DIR);
@ -35,14 +37,19 @@ int main(int argc,char *argv[]) {
_gst_plugin_spew = TRUE;
gst_init(&argc,&argv);
gst_plugin_load_all();
gst_plugin_load("gstelements");
gnome_init("GST Graph Editor",VERSION,argc,argv);
glade_init();
glade_gnome_init();
if (argc > 1) {
project = gst_editor_project_new_from_file(argv[1]);
}
else
project = gst_editor_project_new();
g_assert (project != NULL);
gst_editor_project_view_new(project);
gtk_main();

View file

@ -593,6 +593,77 @@
<ypad>0</ypad>
</widget>
<widget>
<class>GtkVBox</class>
<name>vbox4</name>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<widget>
<class>GtkScrolledWindow</class>
<name>scrolledwindow6</name>
<hscrollbar_policy>GTK_POLICY_ALWAYS</hscrollbar_policy>
<vscrollbar_policy>GTK_POLICY_ALWAYS</vscrollbar_policy>
<hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
<vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkCTree</class>
<name>ctree2</name>
<can_focus>True</can_focus>
<columns>2</columns>
<column_widths>187,80</column_widths>
<selection_mode>GTK_SELECTION_SINGLE</selection_mode>
<show_titles>True</show_titles>
<shadow_type>GTK_SHADOW_IN</shadow_type>
<widget>
<class>GtkLabel</class>
<child_name>CTree:title</child_name>
<name>label20</name>
<label>Pad</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
</widget>
<widget>
<class>GtkLabel</class>
<child_name>CTree:title</child_name>
<name>label21</name>
<label>Value</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
</widget>
</widget>
</widget>
</widget>
<widget>
<class>GtkLabel</class>
<child_name>Notebook:tab</child_name>
<name>label19</name>
<label>Pads</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
</widget>
<widget>
<class>GtkVBox</class>
<name>vbox3</name>

View file

@ -23,6 +23,9 @@ gchar *s = N_("Standard Elements");
gchar *s = N_("Tree select...");
gchar *s = N_("Properties");
gchar *s = N_("Element");
gchar *s = N_("Pad");
gchar *s = N_("Value");
gchar *s = N_("Pads");
gchar *s = N_("Signal");
gchar *s = N_("Handler");
gchar *s = N_("Data");

View file

@ -99,7 +99,9 @@ static void on_name_changed(GstEditorElement *element, gpointer data) {
*
* Returns: Freshly created GstEditor widget.
*/
GstEditor *gst_editor_new(GstElement *element) {
GstEditor*
gst_editor_new (GstElement *element)
{
GstEditor *editor;
g_return_val_if_fail(element != NULL, NULL);
@ -117,10 +119,6 @@ GstEditor *gst_editor_new(GstElement *element) {
/* get the canvas widget */
editor->canvaswidget = gst_editor_canvas_get_canvas(editor->canvas);
/* add the canvas to the scrolled window */
/*gtk_container_add(GTK_CONTAINER(editor->scrollwindow),
editor->canvaswidget);
*/
gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(editor->scrollwindow),
editor->canvaswidget);
@ -129,6 +127,28 @@ GstEditor *gst_editor_new(GstElement *element) {
gtk_widget_set_usize(GTK_WIDGET(editor),400,400);
if (GST_IS_BIN (element)) {
GList *elements;
elements = gst_bin_get_list (GST_BIN(element));
while (elements) {
GstElement *child = (GstElement *)elements->data;
if (GST_IS_BIN (child)) {
g_print ("new bin \n");
gst_editor_bin_new (GST_EDITOR_BIN(editor->canvas),GST_BIN(child),
"x",10.0,"y",10.0,"width",50.0,"height",20.0,NULL);
}
else {
g_print ("new element \n");
gst_editor_element_new (GST_EDITOR_BIN(editor->canvas),child,
"x",10.0,"y",10.0,"width",50.0,"height",20.0,NULL);
}
elements = g_list_next (elements);
}
}
gtk_widget_show_all(GTK_WIDGET(editor));
return editor;

View file

@ -104,6 +104,8 @@ GstEditorBin *gst_editor_bin_new(GstEditorBin *parent,GstBin *bin,
first_arg_name,args);
va_end(args);
return editorbin;
}
@ -267,5 +269,7 @@ void gst_editor_bin_add(GstEditorBin *bin,GstEditorElement *element) {
bin->elements = g_list_prepend(bin->elements,element);
/* add the real element to the real bin */
if (!gst_object_get_parent (GST_OBJECT (element->element))) {
gst_bin_add(GST_BIN(GST_EDITOR_ELEMENT(bin)->element),element->element);
}
}

View file

@ -196,10 +196,12 @@ const gchar *gst_editor_element_get_name(GstEditorElement *element) {
return gst_element_get_name(element->element);
}
void gst_editor_element_construct(GstEditorElement *element,
void
gst_editor_element_construct(GstEditorElement *element,
GstEditorBin *parent,
const gchar *first_arg_name,
va_list args) {
va_list args)
{
GtkObject *obj = GTK_OBJECT(element);
GSList *arg_list = NULL, *info_list = NULL;
gchar *error;

View file

@ -30,6 +30,7 @@
/* class functions */
static void gst_editor_project_class_init (GstEditorProjectClass *klass);
static void gst_editor_project_init (GstEditorProject *project);
static void gst_editor_project_set_arg (GtkObject *object,GtkArg *arg,guint id);
static void gst_editor_project_get_arg (GtkObject *object,GtkArg *arg,guint id);
@ -47,7 +48,8 @@ enum {
static GtkObjectClass *parent_class;
static guint gst_editor_project_signals[LAST_SIGNAL] = { 0 };
GtkType gst_editor_project_get_type() {
GtkType gst_editor_project_get_type (void)
{
static GtkType project_type = 0;
if (!project_type) {
@ -66,7 +68,9 @@ GtkType gst_editor_project_get_type() {
return project_type;
}
static void gst_editor_project_class_init(GstEditorProjectClass *klass) {
static void
gst_editor_project_class_init (GstEditorProjectClass *klass)
{
GtkObjectClass *object_class;
object_class = (GtkObjectClass*)klass;
@ -97,11 +101,15 @@ static void gst_editor_project_class_init(GstEditorProjectClass *klass) {
object_class->get_arg = gst_editor_project_get_arg;
}
static void gst_editor_project_init(GstEditorProject *project) {
static void
gst_editor_project_init (GstEditorProject *project)
{
project->toplevelelements = NULL;
}
GstEditorProject *gst_editor_project_new() {
GstEditorProject*
gst_editor_project_new (void)
{
GstEditorProject *editorproject;
editorproject = GST_EDITOR_PROJECT(gtk_type_new(GST_TYPE_EDITOR_PROJECT));
@ -109,16 +117,54 @@ GstEditorProject *gst_editor_project_new() {
return editorproject;
}
GstEditorProject *gst_editor_project_new_from_file(const guchar *fname) {
GstEditorProject *
gst_editor_project_new_from_file (const guchar *fname)
{
GstEditorProject *editorproject;
GstXML *xml;
GList *elements;
g_return_if_fail (fname != NULL);
editorproject = gst_editor_project_new();
xml = gst_xml_new (fname, NULL);
elements = gst_xml_get_topelements(xml);
while (elements) {
GstElement *element = (GstElement *) elements->data;
gst_editor_project_add_toplevel_element (editorproject, element);
elements = g_list_next (elements);
}
return editorproject;
}
void gst_editor_project_add_toplevel_element(GstEditorProject *project, GstElement *element) {
void
gst_editor_project_save_as (GstEditorProject *project, const guchar *fname)
{
GList *elements;
g_return_if_fail (fname != NULL);
g_return_if_fail (project != NULL);
elements = project->toplevelelements;
while (elements) {
GstElement *element = (GstElement *) elements->data;
xmlSaveFile (fname, gst_xml_write (element));
elements = g_list_next (elements);
}
}
void
gst_editor_project_add_toplevel_element (GstEditorProject *project, GstElement *element)
{
g_return_if_fail(project != NULL);
g_return_if_fail(GST_IS_EDITOR_PROJECT(project));
g_return_if_fail(element != NULL);
@ -131,7 +177,9 @@ void gst_editor_project_add_toplevel_element(GstEditorProject *project, GstEleme
gtk_signal_emit(GTK_OBJECT(project),gst_editor_project_signals[ELEMENT_ADDED], element);
}
static void gst_editor_project_set_arg(GtkObject *object,GtkArg *arg,guint id) {
static void
gst_editor_project_set_arg (GtkObject *object, GtkArg *arg, guint id)
{
GstEditorProject *project;
/* get the major types of this object */
@ -144,7 +192,9 @@ static void gst_editor_project_set_arg(GtkObject *object,GtkArg *arg,guint id) {
}
}
static void gst_editor_project_get_arg(GtkObject *object,GtkArg *arg,guint id) {
static void
gst_editor_project_get_arg (GtkObject *object, GtkArg *arg, guint id)
{
GstEditorProject *project;
/* get the major types of this object */

View file

@ -56,11 +56,16 @@ struct _GstEditorProjectClass {
GstEditorElement *element);
};
GtkType gst_editor_project_get_type();
GstEditorProject *gst_editor_project_new();
GstEditorProject *gst_editor_project_new_from_file(const guchar *fname);
void gst_editor_project_add_toplevel_element(GstEditorProject *project, GstElement *element);
GtkType gst_editor_project_get_type (void);
GstEditorProject* gst_editor_project_new (void);
GstEditorProject* gst_editor_project_new_from_file (const guchar *fname);
void gst_editor_project_save (GstEditorProject *project);
void gst_editor_project_save_as (GstEditorProject *project,
const guchar *fname);
void gst_editor_project_add_toplevel_element (GstEditorProject *project,
GstElement *element);
#define GST_TYPE_EDITOR_PROJECT_VIEW \
(gst_editor_project_view_get_type())
@ -88,7 +93,8 @@ struct _GstEditorProjectViewClass {
GtkObjectClass parent_class;
};
GtkType gst_editor_project_view_get_type();
GtkType gst_editor_project_view_get_type (void);
GstEditorProjectView* gst_editor_project_view_new (GstEditorProject *project);
#endif /* __GST_EDITOR_PROJECT_H__ */

View file

@ -30,6 +30,7 @@
/* class functions */
static void gst_editor_project_view_class_init (GstEditorProjectViewClass *klass);
static void gst_editor_project_view_init (GstEditorProjectView *project_view);
static void gst_editor_project_view_set_arg (GtkObject *object, GtkArg *arg, guint id);
static void gst_editor_project_view_get_arg (GtkObject *object, GtkArg *arg, guint id);
@ -44,7 +45,9 @@ enum {
static GtkObjectClass *parent_class;
//static guint gst_editor_project_view_signals[LAST_SIGNAL] = { 0 };
GtkType gst_editor_project_view_get_type() {
GtkType
gst_editor_project_view_get_type(void)
{
static GtkType project_view_type = 0;
if (!project_view_type) {
@ -63,7 +66,9 @@ GtkType gst_editor_project_view_get_type() {
return project_view_type;
}
static void gst_editor_project_view_class_init(GstEditorProjectViewClass *klass) {
static void
gst_editor_project_view_class_init (GstEditorProjectViewClass *klass)
{
GtkObjectClass *object_class;
object_class = (GtkObjectClass*)klass;
@ -74,16 +79,19 @@ static void gst_editor_project_view_class_init(GstEditorProjectViewClass *klass)
object_class->get_arg = gst_editor_project_view_get_arg;
}
static void gst_editor_project_view_init(GstEditorProjectView *project) {
static void
gst_editor_project_view_init (GstEditorProjectView *project)
{
}
typedef struct {
GstEditorProject *project;
GstEditorProjectView *view;
GModule *symbols;
} connect_struct;
/* we need more control here so... */
static void gst_editor_project_connect_func (const gchar *handler_name,
static void
gst_editor_project_connect_func (const gchar *handler_name,
GtkObject *object,
const gchar *signal_name,
const gchar *signal_data,
@ -98,13 +106,16 @@ static void gst_editor_project_connect_func (const gchar *handler_name,
g_warning("GstEditorProject: could not find signal handler '%s'.", handler_name);
else {
if (after)
gtk_signal_connect_after(object, signal_name, func, (gpointer) data->project);
gtk_signal_connect_after(object, signal_name, func, (gpointer) data->view);
else
gtk_signal_connect(object, signal_name, func, (gpointer) data->project);
gtk_signal_connect(object, signal_name, func, (gpointer) data->view);
}
}
static void gst_editor_project_element_selected(GstEditorProjectView *view, GtkType type, GstEditorPalette *palette) {
static void
gst_editor_project_element_selected (GstEditorProjectView *view,
GtkType type, GstEditorPalette *palette)
{
GstElement *element;
element = gtk_type_new(type);
@ -115,7 +126,10 @@ static void gst_editor_project_element_selected(GstEditorProjectView *view, GtkT
gst_editor_project_add_toplevel_element(view->project, element);
}
static void on_name_change(GstEditorProjectView *view, GstEditorElement *element, GstEditor *editor) {
static void
on_name_change (GstEditorProjectView *view,
GstEditorElement *element, GstEditor *editor)
{
gint row;
gchar *text;
guint8 spacing;
@ -129,7 +143,9 @@ static void on_name_change(GstEditorProjectView *view, GstEditorElement *element
spacing, pixmap, mask);
}
static void view_on_element_added(GstEditorProjectView *view, GstElement *element) {
static void
view_on_element_added (GstEditorProjectView *view, GstElement *element)
{
gchar *name;
gint row;
GstEditorImage *image;
@ -145,12 +161,102 @@ static void view_on_element_added(GstEditorProjectView *view, GstElement *elemen
gtk_clist_set_pixtext(GTK_CLIST(view->list), row, 0, name, 3, image->pixmap, image->bitmap);
}
GstEditorProjectView *gst_editor_project_view_new(GstEditorProject *project) {
typedef struct {
GtkWidget *selection;
GstEditorProjectView *view;
} file_select;
static void
on_save_as_file_selected (GtkWidget *button,
file_select *data)
{
GtkWidget *selector = data->selection;
GstEditorProjectView *view = data->view;
gchar *file_name = gtk_file_selection_get_filename (GTK_FILE_SELECTION(selector));
gst_editor_project_save_as (view->project, file_name);
g_free (data);
}
void
on_save_as1_activate (GtkWidget *widget,
GstEditorProjectView *view)
{
GtkWidget *file_selector;
file_select *file_data = g_new0 (file_select, 1);
file_selector = gtk_file_selection_new("Please select a file for saving.");
file_data->selection = file_selector;
file_data->view = view;
gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION(file_selector)->ok_button),
"clicked", GTK_SIGNAL_FUNC (on_save_as_file_selected),
file_data);
/* Ensure that the dialog box is destroyed when the user clicks a button. */
gtk_signal_connect_object (GTK_OBJECT (GTK_FILE_SELECTION(file_selector)->ok_button),
"clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy),
(gpointer) file_selector);
gtk_signal_connect_object (GTK_OBJECT (GTK_FILE_SELECTION(file_selector)->cancel_button),
"clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy),
(gpointer) file_selector);
/* Display that dialog */
gtk_widget_show (file_selector);
}
static void
on_load_file_selected (GtkWidget *button,
file_select *data)
{
GtkWidget *selector = data->selection;
GstEditorProjectView *view = data->view;
gchar *file_name = gtk_file_selection_get_filename (GTK_FILE_SELECTION(selector));
//gst_editor_project_load (view->project, file_name);
g_free (data);
}
void
on_open1_activate (GtkWidget *widget,
GstEditorProjectView *view)
{
GtkWidget *file_selector;
file_select *file_data = g_new0 (file_select, 1);
file_selector = gtk_file_selection_new("Please select a file to load.");
file_data->selection = file_selector;
file_data->view = view;
gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION(file_selector)->ok_button),
"clicked", GTK_SIGNAL_FUNC (on_load_file_selected),
file_data);
/* Ensure that the dialog box is destroyed when the user clicks a button. */
gtk_signal_connect_object (GTK_OBJECT (GTK_FILE_SELECTION(file_selector)->ok_button),
"clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy),
(gpointer) file_selector);
gtk_signal_connect_object (GTK_OBJECT (GTK_FILE_SELECTION(file_selector)->cancel_button),
"clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy),
(gpointer) file_selector);
/* Display that dialog */
gtk_widget_show (file_selector);
}
GstEditorProjectView*
gst_editor_project_view_new (GstEditorProject *project)
{
GstEditorProjectView *view;
GtkWidget *main_window;
connect_struct data;
GModule *symbols;
GstEditorPalette *palette;
GList *elements;
view = GST_EDITOR_PROJECT_VIEW(gtk_type_new(GST_TYPE_EDITOR_PROJECT_VIEW));
@ -158,14 +264,12 @@ GstEditorProjectView *gst_editor_project_view_new(GstEditorProject *project) {
symbols = g_module_open(NULL, 0);
data.project = project;
data.view = view;
data.symbols = symbols;
view->xml = glade_xml_new("editor.glade", "main_project_window");
glade_xml_signal_autoconnect_full (view->xml, gst_editor_project_connect_func, &data);
gtk_signal_connect_object(GTK_OBJECT(project), "element_added", view_on_element_added, GTK_OBJECT(view));
main_window = glade_xml_get_widget(view->xml, "main_project_window");
gtk_widget_show(main_window);
@ -177,10 +281,25 @@ GstEditorProjectView *gst_editor_project_view_new(GstEditorProject *project) {
gst_editor_property_get();
elements = project->toplevelelements;
while (elements) {
GstElement *element = (GstElement *)elements->data;
g_print ("add\n");
view_on_element_added (view, element);
elements = g_list_next (elements);
}
gtk_signal_connect_object(GTK_OBJECT(project), "element_added", view_on_element_added, GTK_OBJECT(view));
return view;
}
static void gst_editor_project_view_set_arg(GtkObject *object,GtkArg *arg,guint id) {
static void
gst_editor_project_view_set_arg (GtkObject *object,GtkArg *arg,guint id)
{
GstEditorProjectView *project_view;
/* get the major types of this object */
@ -193,7 +312,9 @@ static void gst_editor_project_view_set_arg(GtkObject *object,GtkArg *arg,guint
}
}
static void gst_editor_project_view_get_arg(GtkObject *object,GtkArg *arg,guint id) {
static void
gst_editor_project_view_get_arg (GtkObject *object,GtkArg *arg,guint id)
{
GstEditorProjectView *project_view;
/* get the major types of this object */

View file

@ -592,6 +592,7 @@ gst_bin_src_wrapper (int argc,char *argv[])
return 0;
}
/*
static void
gst_bin_pullfunc_proxy (GstPad *pad)
{

View file

@ -29,6 +29,7 @@
#include <asm/atomic.h>
#endif
#include <gst/gstobject.h>
#include <gst/gstmeta.h>
#ifdef __cplusplus

View file

@ -26,6 +26,8 @@
#endif
#include <gmodule.h>
#include <unistd.h>
#include <gst/gsttrace.h>
/* for include files that make too much noise normally */

View file

@ -829,7 +829,8 @@ gst_pad_load_and_connect (xmlNodePtr parent,
field = field->next;
}
g_return_if_fail(pad != NULL);
g_return_if_fail(peer != NULL);
if (peer == NULL) return;
split = g_strsplit(peer, ".", 2);

View file

@ -362,6 +362,7 @@ gst_props_save_thyself (GstProps *props, xmlNodePtr parent)
switch (entry->propstype) {
case GST_PROPS_LIST_ID_NUM:
subtree = xmlNewChild (parent, NULL, "list", NULL);
xmlNewProp (subtree, "name", g_quark_to_string (entry->propid));
g_list_foreach (entry->data.list_data.entries, (GFunc) gst_props_save_thyself_func, subtree);
default:
gst_props_save_thyself_func (entry, parent);
@ -373,9 +374,74 @@ gst_props_save_thyself (GstProps *props, xmlNodePtr parent)
return parent;
}
static GstPropsEntry*
gst_props_load_thyself_func (xmlNodePtr field)
{
GstPropsEntry *entry;
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);
}
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);
}
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;
else entry->data.bool_data = 1;
}
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);
}
return entry;
}
GstProps*
gst_props_load_thyself (xmlNodePtr parent)
{
return NULL;
GstProps *props = g_new0 (GstProps, 1);
xmlNodePtr field = parent->childs;
while (field) {
if (!strcmp (field->name, "list")) {
GstPropsEntry *entry;
xmlNodePtr subfield = field->childs;
entry = g_new0 (GstPropsEntry, 1);
entry->propstype = GST_PROPS_LIST_ID_NUM;
entry->propid = g_quark_from_string (xmlGetProp(field, "name"));
while (subfield) {
GstPropsEntry *subentry = gst_props_load_thyself_func (subfield);
entry->data.list_data.entries = g_list_prepend (entry->data.list_data.entries, subentry);
subfield = subfield->next;
}
entry->data.list_data.entries = g_list_reverse (entry->data.list_data.entries);
props->properties = g_slist_insert_sorted (props->properties, entry, props_compare_func);
}
else {
GstPropsEntry *entry;
entry = gst_props_load_thyself_func (field);
props->properties = g_slist_insert_sorted (props->properties, entry, props_compare_func);
}
field = field->next;
}
return props;
}

View file

@ -167,7 +167,6 @@ gst_thread_get_arg (GtkObject *object,
switch (id) {
case ARG_CREATE_THREAD:
g_print("gstthread: query thread %d\n", GST_FLAG_IS_SET (object, GST_THREAD_CREATE));
GTK_VALUE_BOOL (*arg) = GST_FLAG_IS_SET (object, GST_THREAD_CREATE);
break;
default:

View file

@ -85,7 +85,9 @@ xmlDocPtr gst_xml_write(GstElement *element) {
*
* Returns: a pointer to a new GstElement
*/
GstXML *gst_xml_new(const guchar *fname, const guchar *root) {
GstXML*
gst_xml_new (const guchar *fname, const guchar *root)
{
xmlDocPtr doc;
xmlNodePtr field;
GstXML *xml;
@ -106,19 +108,42 @@ GstXML *gst_xml_new(const guchar *fname, const guchar *root) {
xml = GST_XML(gtk_type_new(GST_TYPE_XML));
xml->elements = g_hash_table_new(g_str_hash, g_str_equal);
xml->topelements = NULL;
field = doc->root->childs;
while (field) {
if (!strcmp(field->name, "element")) {
gst_element_load_thyself(field, xml->elements);
GstElement *element;
element = gst_element_load_thyself(field, xml->elements);
xml->topelements = g_list_prepend (xml->topelements, element);
}
field = field->next;
}
xml->topelements = g_list_reverse (xml->topelements);
return xml;
}
/**
* gst_xml_get_topelements:
* @xml: The GstXML to get the elements from
*
* retrive a list of toplevel elements
*
* Returns: a GList of elements
*/
GList*
gst_xml_get_topelements (GstXML *xml)
{
g_return_val_if_fail (xml != NULL, NULL);
return xml->topelements;
}
/**
* gst_xml_get_element:
* @xml: The GstXML to get the element from
@ -130,7 +155,9 @@ GstXML *gst_xml_new(const guchar *fname, const guchar *root) {
*
* Returns: a pointer to a new GstElement
*/
GstElement *gst_xml_get_element(GstXML *xml, const guchar *name) {
GstElement*
gst_xml_get_element (GstXML *xml, const guchar *name)
{
GstElement *element;
g_return_val_if_fail(xml != NULL, NULL);

View file

@ -46,6 +46,7 @@ struct _GstXML {
GtkObject object;
GHashTable *elements;
GList *topelements;
};
struct _GstXMLClass {
@ -61,6 +62,7 @@ xmlDocPtr gst_xml_write (GstElement *element);
GstXML* gst_xml_new (const guchar *fname, const guchar *root);
GstElement* gst_xml_get_element (GstXML *xml, const guchar *name);
GList* gst_xml_get_topelements (GstXML *xml);
#ifdef __cplusplus
}

View file

@ -30,6 +30,35 @@ dump_factories (void)
}
}
static void
dump_factory (gchar *name)
{
GstElementFactory *factory;
factory = gst_elementfactory_find (name);
if (factory) {
GList *padtemplates = factory->padtemplates;
xmlDocPtr doc;
doc = xmlNewDoc ("1.0");
doc->root = xmlNewDocNode (doc, NULL, "templates", NULL);
while (padtemplates) {
xmlNodePtr parent;
GstPadTemplate *template = (GstPadTemplate *) padtemplates->data;
parent = xmlNewChild (doc->root, NULL, "template", NULL);
gst_padtemplate_save_thyself (template, parent);
padtemplates = g_list_next (padtemplates);
}
xmlDocDump(stdout, doc);
}
}
static void
dump_types (void)
{
@ -117,4 +146,7 @@ int main(int argc,char *argv[])
dump_types ();
gst_type_dump ();
dump_factory ("lame");
dump_factory ("mpeg_play");
}