diff --git a/editor/editor.c b/editor/editor.c
index 487a9c26fc..8fa6ee45cf 100644
--- a/editor/editor.c
+++ b/editor/editor.c
@@ -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();
- project = gst_editor_project_new();
+ 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();
diff --git a/editor/editor.glade b/editor/editor.glade
index ae42425383..fa6e225105 100644
--- a/editor/editor.glade
+++ b/editor/editor.glade
@@ -593,6 +593,77 @@
0
+
+ GtkVBox
+ vbox4
+ False
+ 0
+
+
+ GtkScrolledWindow
+ scrolledwindow6
+ GTK_POLICY_ALWAYS
+ GTK_POLICY_ALWAYS
+ GTK_UPDATE_CONTINUOUS
+ GTK_UPDATE_CONTINUOUS
+
+ 0
+ True
+ True
+
+
+
+ GtkCTree
+ ctree2
+ True
+ 2
+ 187,80
+ GTK_SELECTION_SINGLE
+ True
+ GTK_SHADOW_IN
+
+
+ GtkLabel
+ CTree:title
+ label20
+
+ GTK_JUSTIFY_CENTER
+ False
+ 0.5
+ 0.5
+ 0
+ 0
+
+
+
+ GtkLabel
+ CTree:title
+ label21
+
+ GTK_JUSTIFY_CENTER
+ False
+ 0.5
+ 0.5
+ 0
+ 0
+
+
+
+
+
+
+ GtkLabel
+ Notebook:tab
+ label19
+
+ GTK_JUSTIFY_CENTER
+ False
+ 0.5
+ 0.5
+ 0
+ 0
+
+
GtkVBox
vbox3
diff --git a/editor/editor.ts b/editor/editor.ts
index 00bb898389..6e0775b298 100644
--- a/editor/editor.ts
+++ b/editor/editor.ts
@@ -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");
diff --git a/editor/gsteditor.c b/editor/gsteditor.c
index da77ac7388..e5eca3ad64 100644
--- a/editor/gsteditor.c
+++ b/editor/gsteditor.c
@@ -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;
diff --git a/editor/gsteditorbin.c b/editor/gsteditorbin.c
index b2226728fb..3d80373a97 100644
--- a/editor/gsteditorbin.c
+++ b/editor/gsteditorbin.c
@@ -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 */
- gst_bin_add(GST_BIN(GST_EDITOR_ELEMENT(bin)->element),element->element);
+ if (!gst_object_get_parent (GST_OBJECT (element->element))) {
+ gst_bin_add(GST_BIN(GST_EDITOR_ELEMENT(bin)->element),element->element);
+ }
}
diff --git a/editor/gsteditorelement.c b/editor/gsteditorelement.c
index cf1d5399a6..1d84ea6276 100644
--- a/editor/gsteditorelement.c
+++ b/editor/gsteditorelement.c
@@ -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,
- GstEditorBin *parent,
- const gchar *first_arg_name,
- va_list args) {
+void
+gst_editor_element_construct(GstEditorElement *element,
+ GstEditorBin *parent,
+ const gchar *first_arg_name,
+ va_list args)
+{
GtkObject *obj = GTK_OBJECT(element);
GSList *arg_list = NULL, *info_list = NULL;
gchar *error;
diff --git a/editor/gsteditorproject.c b/editor/gsteditorproject.c
index c687ec0b78..55dbe4291a 100644
--- a/editor/gsteditorproject.c
+++ b/editor/gsteditorproject.c
@@ -28,10 +28,11 @@
#include "gsteditorimage.h"
/* 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);
+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);
enum {
ARG_0,
@@ -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 */
diff --git a/editor/gsteditorproject.h b/editor/gsteditorproject.h
index ed6623bd79..d15e610a18 100644
--- a/editor/gsteditorproject.h
+++ b/editor/gsteditorproject.h
@@ -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();
-GstEditorProjectView *gst_editor_project_view_new(GstEditorProject *project);
+GtkType gst_editor_project_view_get_type (void);
+
+GstEditorProjectView* gst_editor_project_view_new (GstEditorProject *project);
#endif /* __GST_EDITOR_PROJECT_H__ */
diff --git a/editor/gsteditorprojectview.c b/editor/gsteditorprojectview.c
index af052ed2dd..39dfda838f 100644
--- a/editor/gsteditorprojectview.c
+++ b/editor/gsteditorprojectview.c
@@ -28,10 +28,11 @@
#include "gsteditorimage.h"
/* 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);
+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);
enum {
ARG_0,
@@ -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 */
diff --git a/gst/gstbin.c b/gst/gstbin.c
index 0f25a6507e..b21237d241 100644
--- a/gst/gstbin.c
+++ b/gst/gstbin.c
@@ -592,6 +592,7 @@ gst_bin_src_wrapper (int argc,char *argv[])
return 0;
}
+/*
static void
gst_bin_pullfunc_proxy (GstPad *pad)
{
diff --git a/gst/gstbuffer.h b/gst/gstbuffer.h
index 5b0b2a9e8e..b09d25f646 100644
--- a/gst/gstbuffer.h
+++ b/gst/gstbuffer.h
@@ -29,6 +29,7 @@
#include
#endif
+#include
#include
#ifdef __cplusplus
diff --git a/gst/gstdebug.h b/gst/gstdebug.h
index 82d261b657..2b81bcfcc1 100644
--- a/gst/gstdebug.h
+++ b/gst/gstdebug.h
@@ -26,6 +26,8 @@
#endif
#include
+#include
+
#include
/* for include files that make too much noise normally */
diff --git a/gst/gstpad.c b/gst/gstpad.c
index b7d478d61e..975f87bf8d 100644
--- a/gst/gstpad.c
+++ b/gst/gstpad.c
@@ -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);
diff --git a/gst/gstprops.c b/gst/gstprops.c
index ddf3ef1779..88ac9d8922 100644
--- a/gst/gstprops.c
+++ b/gst/gstprops.c
@@ -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;
}
diff --git a/gst/gstthread.c b/gst/gstthread.c
index df29b8c175..8b3d933875 100644
--- a/gst/gstthread.c
+++ b/gst/gstthread.c
@@ -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:
diff --git a/gst/gstxml.c b/gst/gstxml.c
index ef7269a237..ac426f4722 100644
--- a/gst/gstxml.c
+++ b/gst/gstxml.c
@@ -19,8 +19,8 @@
#include "gstxml.h"
-static void gst_xml_class_init(GstXMLClass *klass);
-static void gst_xml_init(GstXML *xml);
+static void gst_xml_class_init (GstXMLClass *klass);
+static void gst_xml_init (GstXML *xml);
static GstObjectClass *parent_class = NULL;
@@ -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);
diff --git a/gst/gstxml.h b/gst/gstxml.h
index 1f9db892df..3c5714be8b 100644
--- a/gst/gstxml.h
+++ b/gst/gstxml.h
@@ -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
}
diff --git a/tests/registry.c b/tests/registry.c
index 6416e4369c..3dc02196b2 100644
--- a/tests/registry.c
+++ b/tests/registry.c
@@ -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");
}