gsteditorbin.c \
gsteditorcanvas.c \
gsteditorpad.c \
+ gsteditorpadtemplate.c \
gsteditorconnection.c \
gsteditorimage.c \
gsteditorpalette.c \
gst_editor_project_view_new(project);
+ gdk_threads_enter ();
gtk_main();
+ gdk_threads_leave ();
return(0);
}
typedef struct _GstEditorCanvasClass GstEditorCanvasClass;
typedef struct _GstEditorPad GstEditorPad;
typedef struct _GstEditorPadClass GstEditorPadClass;
+typedef struct _GstEditorPadTemplate GstEditorPadTemplate;
+typedef struct _GstEditorPadTemplateClass GstEditorPadTemplateClass;
typedef struct _GstEditorConnection GstEditorConnection;
typedef struct _GstEditorConnectionClass GstEditorConnectionClass;
GList *srcpads,*sinkpads;
gboolean padlistchange;
+ /* list of padtemplates */
+ GList *srcpadtemps,*sinkpadtemps;
+
/* interaction state */
gboolean dragging,resizing,moved,hesitating;
gdouble offx,offy,dragx,dragy;
const gchar *first_arg_name,
va_list args);
void gst_editor_element_repack(GstEditorElement *element);
-GstEditorPad *gst_editor_element_add_pad(GstEditorElement *element,
- GstPad *pad);
void gst_editor_element_set_name(GstEditorElement *element,
const gchar *name);
const gchar *gst_editor_element_get_name(GstEditorElement *element);
+#define GST_TYPE_EDITOR_PADTEMPLATE \
+ (gst_editor_padtemplate_get_type())
+#define GST_EDITOR_PADTEMPLATE(obj) \
+ (GTK_CHECK_CAST((obj),GST_TYPE_EDITOR_PADTEMPLATE,GstEditorPadTemplate))
+#define GST_EDITOR_PADTEMPLATE_CLASS(klass) \
+ (GTK_CHECK_CLASS_CAST((klass),GST_TYPE_EDITOR_PADTEMPLATE,GstEditorPadTemplateClass))
+#define GST_IS_EDITOR_PADTEMPLATE(obj) \
+ (GTK_CHECK_TYPE((obj),GST_TYPE_EDITOR_PADTEMPLATE))
+#define GST_IS_EDITOR_PADTEMPLATE_CLASS(obj) \
+ (GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_EDITOR_PADTEMPLATE))
+
+struct _GstEditorPadTemplate {
+ GtkObject object;
+
+ /* parent element */
+ GstEditorElement *parent;
+
+ /* toplevel canvas */
+ GstEditorCanvas *canvas;
+
+ /* the padtemplate we're associated with */
+ GstPadTemplate *padtemplate;
+
+ /* pads created from this template */
+ GList *pads;
+
+ /* if this is a sink (convenience) */
+ gboolean issrc;
+
+ /* whether we've been realized or not */
+ gboolean realized;
+
+ /* connections */
+ GstEditorConnection *connection;
+ GstEditorConnection *ghostconnection;
+
+ /* visual stuff */
+ GnomeCanvasGroup *group;
+ GnomeCanvasItem *border,*title,*padtemplatebox;
+ gboolean sinkpadtemplate; // is this a sink padtemplate?
+ gdouble x,y; // location
+ gdouble width,height; // actual size
+ gdouble boxwidth,boxheight; // size of padtemplate box
+ gboolean resize; // does it need resizing?
+
+ /* interaction state */
+ gboolean dragging,resizing,moved;
+ gdouble dragx,dragy;
+
+ /* connection */
+// GnomeCanvasItem *connection; // can't use
+//GstEditorConnection
+};
+
+struct _GstEditorPadTemplateClass {
+ GtkObjectClass parent_class;
+
+ void (*realize) (GstEditorPadTemplate *padtemplate);
+};
+
+GtkType gst_editor_padtemplate_get_type();
+GstEditorPadTemplate *gst_editor_padtemplate_new(GstEditorElement *parent,GstPadTemplate *padtemplate,
+ const gchar *first_arg_name, ...);
+void gst_editor_padtemplate_construct(GstEditorPadTemplate *element,
+ GstEditorElement *parent,
+ const gchar *first_arg_name,va_list args);
+void gst_editor_padtemplate_repack(GstEditorPadTemplate *padtemplate);
+
+
#define GST_TYPE_EDITOR_CONNECTION \
(gst_editor_connection_get_type())
#define GST_EDITOR_CONNECTION(obj) \
g_print ("gsteditorbin: object added\n");
}
+
void
gst_editor_bin_add (GstEditorBin *bin, GstEditorElement *element)
{
GdkEvent *event,
gpointer data);
-/* external events (from GstElement) */
-static void gst_editor_element_state_change (GstElement *element,
- gint state,
- GstEditorElement *editorelement);
-
/* utility functions */
static void gst_editor_element_resize (GstEditorElement *element);
static void gst_editor_element_set_state (GstEditorElement *element,
gint id,gboolean set);
+static void gst_editor_element_add_pad_wrapper (GstEditorElement *element,
+ GstPad *pad);
+static void gst_editor_element_add_pad (GstEditorElement *element,
+ GstPad *pad);
+GstEditorPadTemplate* gst_editor_element_add_padtemplate (GstEditorElement *element,
+ GstPadTemplate *pad);
static void gst_editor_element_sync_state (GstEditorElement *element);
+static void gst_editor_element_sync_state_wrapper (GstEditorElement *element);
static void gst_editor_element_move (GstEditorElement *element,
gdouble dx,gdouble dy);
-
+static void gst_editor_element_position_changed (GstEditorElement *element,
+ GstEditorElement *parent);
static gchar *_gst_editor_element_states[] = { "S","R","P","F" };
gint i;
gdouble x1,y1,x2,y2;
GList *pads;
- GstPad *pad;
// g_print("realizing editor element %p\n",element);
g_return_if_fail(element->parent != NULL);
// set the state signal of the actual element
- gtk_signal_connect(GTK_OBJECT(element->element),"state_change",
- GTK_SIGNAL_FUNC(gst_editor_element_state_change),
- element);
+ gtk_signal_connect_object (GTK_OBJECT(element->element),"state_change",
+ GTK_SIGNAL_FUNC(gst_editor_element_sync_state_wrapper),
+ GTK_OBJECT (element));
+
+ gtk_signal_connect_object (GTK_OBJECT(element->element),"new_pad",
+ GTK_SIGNAL_FUNC(gst_editor_element_add_pad_wrapper),
+ GTK_OBJECT (element));
+
+ gtk_signal_connect_object (GTK_OBJECT(element->parent),"position_changed",
+ GTK_SIGNAL_FUNC(gst_editor_element_position_changed),
+ GTK_OBJECT (element));
// create the bounds if we haven't had them set
// g_print("centering element at %.2fx%.2f (%.2fx%.2f)\n",
GTK_SIGNAL_FUNC(gst_editor_element_state_event),
GINT_TO_POINTER(i));
}
+
+ // get all the padtemplates
+ pads = gst_element_get_padtemplate_list(element->element);
+ while (pads) {
+ GstPadTemplate *temp = (GstPadTemplate *) pads->data;
+
+ gst_editor_element_add_padtemplate (element,temp);
+
+ pads = g_list_next(pads);
+ }
+
// get all the pads
pads = gst_element_get_pad_list(element->element);
while (pads) {
- pad = GST_PAD(pads->data);
+ GstPad *pad = GST_PAD(pads->data);
+
gst_editor_element_add_pad(element,pad);
pads = g_list_next(pads);
gdouble groupwidth,groupheight;
GList *pads;
GstEditorPad *editorpad;
+ GstEditorPadTemplate *editorpadtemplate;
gint i;
if (element->resize != TRUE) return;
element->srcs++;
pads = g_list_next(pads);
}
+ pads = element->sinkpadtemps;
+ while (pads) {
+ editorpadtemplate = GST_EDITOR_PADTEMPLATE(pads->data);
+ element->sinkwidth = MAX(element->sinkwidth,editorpadtemplate->width);
+ element->sinkheight = MAX(element->sinkheight,editorpadtemplate->height);
+ element->sinks++;
+ pads = g_list_next(pads);
+ }
+ pads = element->srcpadtemps;
+ while (pads) {
+ editorpadtemplate = GST_EDITOR_PADTEMPLATE(pads->data);
+ element->srcwidth = MAX(element->srcwidth,editorpadtemplate->width);
+ element->srcheight = MAX(element->srcheight,editorpadtemplate->height);
+ element->srcs++;
+ pads = g_list_next(pads);
+ }
// add in the needed space
element->minheight += MAX((element->sinkheight*element->sinks),
(element->srcheight*element->srcs)) + 4.0;
element->minwidth = MAX(element->minwidth,
- ((element->sinkwidth*element->sinks) +
- (element->srcwidth*element->srcs) + 4.0));
+ ((element->sinkwidth) +
+ (element->srcwidth) + 4.0));
// g_print("have %d sinks (%.2fx%.2f) and %d srcs (%.2fx%.2f)\n",
// element->sinks,element->sinkwidth,element->sinkheight,
// element->srcs,element->srcwidth,element->srcheight);
element->width = MAX(element->width,element->minwidth);
element->height = MAX(element->height,element->minheight);
// g_print("is now %.2fx%.2f\n",element->width,element->height);
+
+ gtk_signal_emit(GTK_OBJECT(element),gst_editor_element_signals[SIZE_CHANGED], element);
}
void
{
GList *pads;
GstEditorPad *editorpad;
+ GstEditorPadTemplate *editorpadtemplate;
gint sinks;
gint srcs;
gdouble x1,y1,x2,y2;
sinks--;
pads = g_list_next(pads);
}
+ pads = element->sinkpadtemps;
+ while (pads) {
+ editorpadtemplate = GST_EDITOR_PADTEMPLATE(pads->data);
+ gtk_object_set(GTK_OBJECT(editorpadtemplate),
+ "x",x1,
+ "y",y2 - 2.0 - element->stateheight -
+ (element->sinkheight * sinks),
+ NULL);
+ gst_editor_padtemplate_repack(editorpadtemplate);
+ sinks--;
+ pads = g_list_next(pads);
+ }
srcs = element->srcs;
pads = element->srcpads;
while (pads) {
editorpad = GST_EDITOR_PAD(pads->data);
gtk_object_set(GTK_OBJECT(editorpad),
- "x",x2 - element->srcwidth,
+ "x",x2 - editorpad->width,
"y",y2 - 2.0 - element->stateheight -
(element->srcheight * srcs),
NULL);
srcs--;
pads = g_list_next(pads);
}
+ pads = element->srcpadtemps;
+ while (pads) {
+ editorpadtemplate = GST_EDITOR_PADTEMPLATE(pads->data);
+ gtk_object_set(GTK_OBJECT(editorpadtemplate),
+ "x",x2 - editorpadtemplate->width,
+ "y",y2 - 2.0 - element->stateheight -
+ (element->srcheight * srcs),
+ NULL);
+ gst_editor_padtemplate_repack(editorpadtemplate);
+ srcs--;
+ pads = g_list_next(pads);
+ }
+ gtk_signal_emit(GTK_OBJECT(element),gst_editor_element_signals[SIZE_CHANGED], element);
// g_print("done resizing element\n");
}
+static void
+gst_editor_element_add_pad_wrapper (GstEditorElement *element,
+ GstPad *pad)
+{
+ gdk_threads_enter ();
+ gst_editor_element_add_pad (element, pad);
+ element->resize = TRUE;
+ gst_editor_element_repack (element);
+ gdk_threads_leave ();
+}
-GstEditorPad*
-gst_editor_element_add_pad (GstEditorElement *element,
- GstPad *pad)
+static void
+gst_editor_element_add_pad_func (GstEditorElement *element,
+ GstPad *pad)
{
GstEditorPad *editorpad;
g_print("HUH?!? Don't know which direction this pad is...\n");
gst_editor_element_repack(element);
- return editorpad;
}
+static void
+gst_editor_element_add_pad (GstEditorElement *element,
+ GstPad *pad)
+{
+ GstPadTemplate *temp;
+
+ temp = pad->padtemplate;
+ if (!temp) {
+ gst_editor_element_add_pad_func (element,pad);
+ }
+ else {
+ // find the template
+ GList *temppads;
+
+ temppads = element->sinkpadtemps;
+ while (temppads) {
+ GstEditorPadTemplate *editorpadtemp = (GstEditorPadTemplate *) temppads->data;
+
+ if (editorpadtemp->padtemplate == temp) {
+ gst_editor_padtemplate_add_pad (editorpadtemp, pad);
+ break;
+ }
+ temppads = g_list_next (temppads);
+ }
+ temppads = element->srcpadtemps;
+ while (temppads) {
+ GstEditorPadTemplate *editorpadtemp = (GstEditorPadTemplate *) temppads->data;
+
+ if (editorpadtemp->padtemplate == temp) {
+ gst_editor_padtemplate_add_pad (editorpadtemp, pad);
+ break;
+ }
+ temppads = g_list_next (temppads);
+ }
+ }
+}
+
+GstEditorPadTemplate*
+gst_editor_element_add_padtemplate (GstEditorElement *element,
+ GstPadTemplate *pad)
+{
+ GstEditorPadTemplate *editorpad;
+
+ g_print ("gsteditorelement: new padtemplate\n");
+
+ editorpad = gst_editor_padtemplate_new (element, pad, NULL);
+
+ if (pad->direction == GST_PAD_SINK) {
+ element->sinkpadtemps = g_list_prepend(element->sinkpadtemps,editorpad);
+ element->sinks++;
+// g_print("added 'new' pad to sink list\n");
+ } else if (pad->direction == GST_PAD_SRC) {
+// g_print("added 'new' pad to src list\n");
+ element->srcpadtemps = g_list_prepend(element->srcpadtemps,editorpad);
+ element->srcs++;
+ } else
+ g_print("HUH?!? Don't know which direction this pad is...\n");
+
+ gst_editor_element_repack(element);
+ return editorpad;
+}
static gint
gst_editor_element_group_event (GnomeCanvasItem *item,
switch(event->type) {
case GDK_ENTER_NOTIFY:
- gnome_canvas_item_set(GNOME_CANVAS_ITEM(element->border),
- "fill_color_rgba", 0xeeeeee80, NULL);
return TRUE;
case GDK_LEAVE_NOTIFY:
- gnome_canvas_item_set(GNOME_CANVAS_ITEM(element->border),
- "fill_color", "white", NULL);
return TRUE;
case GDK_BUTTON_PRESS:
{
return FALSE;
if (id < 4) {
+ gdk_threads_leave ();
gst_editor_element_set_state(element,id,TRUE);
+ gdk_threads_enter ();
} else
g_warning("Uh, shouldn't have gotten here, unknown state\n");
//g_print("in element statebox_event, setting inchild");
static void
-gst_editor_element_state_change(GstElement *element,
- gint state,
- GstEditorElement *editorelement)
+gst_editor_element_sync_state_wrapper (GstEditorElement *element)
{
- g_return_if_fail(editorelement != NULL);
-
- //g_print("gst_editor_element_state_change got state 0x%08x\n",state);
- gst_editor_element_sync_state(editorelement);
+ gdk_threads_enter ();
+ gst_editor_element_sync_state (element);
+ gdk_threads_leave ();
}
static void
}
static void
+gst_editor_element_position_changed (GstEditorElement *element,
+ GstEditorElement *parent)
+{
+ if (element != parent)
+ gtk_signal_emit(GTK_OBJECT(element),gst_editor_element_signals[POSITION_CHANGED], element);
+}
+
+static void
gst_editor_element_move(GstEditorElement *element,
gdouble dx,gdouble dy)
{
- GList *pads;
- GstEditorPad *pad;
-
// this is a 'little' trick to keep from repacking the whole thing...
element->x += dx;element->y += dy;
gnome_canvas_item_move(GNOME_CANVAS_ITEM(element->group),dx,dy);
- pads = element->srcpads;
- while (pads) {
- pad = GST_EDITOR_PAD(pads->data);
- if (pad->connection) {
-// g_print("updating pad's connection\n");
- pad->connection->resize = TRUE;
- gst_editor_connection_resize(pad->connection);
- }
- pads = g_list_next(pads);
- }
- pads = element->sinkpads;
- while (pads) {
- pad = GST_EDITOR_PAD(pads->data);
- if (pad->connection) {
-// g_print("updating pad's connection\n");
- pad->connection->resize = TRUE;
- gst_editor_connection_resize(pad->connection);
- }
- pads = g_list_next(pads);
- }
+ gtk_signal_emit(GTK_OBJECT(element),gst_editor_element_signals[POSITION_CHANGED], element);
}
static void gst_editor_pad_get_arg(GtkObject *object,GtkArg *arg,guint id);
static void gst_editor_pad_realize(GstEditorPad *pad);
+static void gst_editor_pad_position_changed(GstEditorPad *pad, GstEditorElement *element);
+
/* class implementation functions */
//static void gst_editor_pad_update(GnomeCanvasItem *item,double *affine,
// ArtSVP *clip_path,int flags);
static GtkObjectClass *parent_class;
//static guint gst_editor_pad_signals[LAST_SIGNAL] = { 0 };
-GtkType gst_editor_pad_get_type() {
+GtkType
+gst_editor_pad_get_type (void)
+{
static GtkType pad_type = 0;
if (!pad_type) {
return pad_type;
}
-static void gst_editor_pad_class_init(GstEditorPadClass *klass) {
+static void
+gst_editor_pad_class_init (GstEditorPadClass *klass)
+{
GtkObjectClass *object_class;
object_class = (GtkObjectClass*)klass;
object_class->get_arg = gst_editor_pad_get_arg;
}
-static void gst_editor_pad_init(GstEditorPad *pad) {
+static void
+gst_editor_pad_init(GstEditorPad *pad)
+{
}
GstEditorPad*
}
}
+ gtk_signal_connect_object (GTK_OBJECT (parent), "position_changed",
+ gst_editor_pad_position_changed, editorpad);
+
return editorpad;
}
-void gst_editor_pad_construct(GstEditorPad *pad,
- GstEditorElement *parent,
- const gchar *first_arg_name,va_list args) {
+void
+gst_editor_pad_construct(GstEditorPad *pad,
+ GstEditorElement *parent,
+ const gchar *first_arg_name,va_list args)
+{
GtkObject *obj = GTK_OBJECT(pad);
GSList *arg_list = NULL, *info_list = NULL;
gchar *error;
(padclass->realize)(pad);
}
-static void gst_editor_pad_set_arg(GtkObject *object,GtkArg *arg,guint id) {
+static void
+gst_editor_pad_set_arg (GtkObject *object,GtkArg *arg,guint id)
+{
GstEditorPad *pad;
/* get the major types of this object */
}
}
-static void gst_editor_pad_get_arg(GtkObject *object,GtkArg *arg,guint id) {
+static void
+gst_editor_pad_get_arg (GtkObject *object,GtkArg *arg,guint id)
+{
GstEditorPad *pad;
/* get the major types of this object */
}
}
-static void gst_editor_pad_realize(GstEditorPad *pad) {
+static void
+gst_editor_pad_realize (GstEditorPad *pad)
+{
// g_print("realizing editor pad %p\n",pad);
/* we must be attached to an element */
}
-static void gst_editor_pad_resize(GstEditorPad *pad) {
+static void
+gst_editor_pad_resize (GstEditorPad *pad)
+{
gdouble minwidth,minheight;
// g_print("resizing pad\n");
gst_editor_connection_resize(pad->connection);
}
-void gst_editor_pad_repack(GstEditorPad *pad) {
+void
+gst_editor_pad_repack (GstEditorPad *pad)
+{
gdouble x1,y1,x2,y2;
if (!pad->realized) return;
*/
/* FIXME FIXME FIXME */
-static gint gst_editor_pad_padbox_event(GnomeCanvasItem *item,
- GdkEvent *event,
- GstEditorPad *pad) {
+static gint
+gst_editor_pad_padbox_event(GnomeCanvasItem *item,
+ GdkEvent *event,
+ GstEditorPad *pad)
+{
GstEditorElement *element;
GstEditorBin *bin;
case GDK_ENTER_NOTIFY:
gtk_object_set(GTK_OBJECT(pad->border),
"fill_color_rgba", 0xBBDDBB00, NULL);
-// g_print("entered pad '%s'\n",
-// gst_pad_get_name(pad->pad));
break;
case GDK_LEAVE_NOTIFY:
gtk_object_set(GTK_OBJECT(pad->border),
"fill_color_rgba", 0xCCFFCC00, NULL);
-// g_print("left pad '%s'\n",
-// gst_pad_get_name(pad->pad));
break;
case GDK_BUTTON_PRESS:
// g_print("have button press in pad '%s'\n",
}
return FALSE;
}
+
+static void
+gst_editor_pad_position_changed(GstEditorPad *pad,
+ GstEditorElement *element)
+{
+ GList *pads;
+
+ if (pad->connection) {
+// g_print("updating pad's connection\n");
+ pad->connection->resize = TRUE;
+ gst_editor_connection_resize(pad->connection);
+ }
+}
struct _palette_entry {
gchar *tooltip;
GtkType (*type) (void);
+ gchar *factoryname;
};
#define CORE_ELEMENT_SIZE 4
struct _palette_entry _palette_contents_core[CORE_ELEMENT_SIZE] = {
- {"Bin", gst_bin_get_type },
- {"Thread", gst_thread_get_type },
- {"Pipeline", gst_pipeline_get_type },
- {"Tee", gst_tee_get_type },
+ {"Bin", gst_bin_get_type, "bin" },
+ {"Thread", gst_thread_get_type, "thread" },
+ {"Pipeline", gst_pipeline_get_type, "pipeline" },
+ {"Tee", gst_tee_get_type, "tee" },
};
enum {
static GtkObjectClass *parent_class;
static guint gst_editor_palette_signals[LAST_SIGNAL] = { 0 };
-GtkType gst_editor_palette_get_type() {
+GtkType
+gst_editor_palette_get_type (void)
+{
static GtkType palette_type = 0;
if (!palette_type) {
return palette_type;
}
-static void gst_editor_palette_class_init(GstEditorPaletteClass *klass) {
+static void
+gst_editor_palette_class_init (GstEditorPaletteClass *klass)
+{
GtkObjectClass *object_class;
object_class = (GtkObjectClass*)klass;
object_class->get_arg = gst_editor_palette_get_arg;
}
-static void gst_editor_palette_init(GstEditorPalette *palette) {
+static void
+gst_editor_palette_init (GstEditorPalette *palette)
+{
palette->tooltips = gtk_tooltips_new();
}
} connect_struct;
/* we need more control here so... */
-static void gst_editor_palette_connect_func (const gchar *handler_name,
- GtkObject *object,
- const gchar *signal_name,
- const gchar *signal_data,
- GtkObject *connect_object,
- gboolean after,
- gpointer user_data)
+static void
+gst_editor_palette_connect_func (const gchar *handler_name,
+ GtkObject *object,
+ const gchar *signal_name,
+ const gchar *signal_data,
+ GtkObject *connect_object,
+ gboolean after,
+ gpointer user_data)
{
GtkSignalFunc func;
connect_struct *data = (connect_struct *)user_data;
}
}
-GstEditorPalette *gst_editor_palette_new() {
+GstEditorPalette*
+gst_editor_palette_new()
+{
GstEditorPalette *palette;
GtkWidget *palette_window;
connect_struct data;
struct _palette_entry *entry;
} _signal_data;
-static void gst_editor_palette_element_clicked(GtkButton *button, _signal_data *data) {
- gtk_signal_emit(GTK_OBJECT(data->palette),gst_editor_palette_signals[SIGNAL_ELEMENT_SELECTED], data->entry->type());
+static void
+gst_editor_palette_element_clicked(GtkButton *button, _signal_data *data)
+{
+ GstElementFactory *factory;
+
+ factory = gst_elementfactory_find (data->entry->factoryname);
+
+ gtk_signal_emit(GTK_OBJECT(data->palette),gst_editor_palette_signals[SIGNAL_ELEMENT_SELECTED], factory);
}
-static void gst_editor_palette_make(GstEditorPalette *palette) {
+static void
+gst_editor_palette_make (GstEditorPalette *palette)
+{
GtkWidget *button;
GstEditorImage *editimage;
GtkWidget *image;
}
}
-static void gst_editor_palette_set_arg(GtkObject *object,GtkArg *arg,guint id) {
+static void
+gst_editor_palette_set_arg (GtkObject *object,GtkArg *arg,guint id)
+{
GstEditorPalette *palette;
/* get the major types of this object */
}
}
-static void gst_editor_palette_get_arg(GtkObject *object,GtkArg *arg,guint id) {
+static void
+gst_editor_palette_get_arg (GtkObject *object,GtkArg *arg,guint id)
+{
GstEditorPalette *palette;
/* get the major types of this object */
GtkObjectClass parent_class;
void (*element_selected) (GstEditorPalette *palette,
- GstEditorElement *element);
+ GstElementFactory *factory);
void (*in_selection_mode) (GstEditorPalette *palette,
GstEditorElement *element);
};
static void
gst_editor_project_element_selected (GstEditorProjectView *view,
- GtkType type, GstEditorPalette *palette)
+ GstElementFactory *factory, GstEditorPalette *palette)
{
GstElement *element;
- element = gtk_type_new(type);
+ element = gst_elementfactory_create (factory, "new_element");
g_return_if_fail(element != NULL);
g_return_if_fail(GST_IS_ELEMENT(element));
len = strlen(new);
inupper = TRUE;
for (i=0; i<len; i++) {
- if (inupper) new[i] = toupper(new[i]);
- inupper = FALSE;
- if (new[i] == ' ')
- inupper = TRUE;
+ if (inupper) new[i] = toupper(new[i]);
+ inupper = FALSE;
+ if (new[i] == ' ')
+ inupper = TRUE;
}
return new;
return g_strdup ("unknown");
}
+static void
+gst_editor_add_caps_to_tree (GstCaps *caps, GtkWidget *tree, GtkCTreeNode *padnode)
+{
+ if (caps) {
+ GstProps *props = gst_caps_get_props (caps);
+ if (props) {
+ GSList *propslist = props->properties;
+
+ while (propslist) {
+ gchar *data[2];
+ GstPropsEntry *entry = (GstPropsEntry *)propslist->data;
+
+ data[0] = g_quark_to_string (entry->propid);
+
+ switch (entry->propstype) {
+ case GST_PROPS_LIST_ID_NUM:
+ {
+ GList *list;
+ guint count = 0;
+ data[1] = "";
+
+ list = entry->data.list_data.entries;
+
+ while (list) {
+ data[1] = g_strconcat (data[1], (count++?", ":""),
+ gst_editor_props_show_func ((GstPropsEntry *)list->data), NULL);
+ list = g_list_next (list);
+ }
+ break;
+ }
+ default:
+ data[1] = gst_editor_props_show_func (entry);
+ break;
+ }
+ gtk_ctree_insert_node (GTK_CTREE (tree), padnode, NULL, data, 0,
+ NULL, NULL, NULL, NULL, TRUE, TRUE);
+
+ propslist = g_slist_next (propslist);
+ }
+ }
+ }
+}
+
static GtkWidget*
gst_editor_pads_create (GstEditorProperty *property, GstEditorElement *element)
{
GtkWidget *tree;
gchar *columns[2];
- pads = gst_element_get_pad_list(realelement);
-
columns[0] = "name";
columns[1] = "info";
gtk_clist_set_column_width (GTK_CLIST (tree), 0, 150);
gtk_clist_freeze (GTK_CLIST (tree));
+
+ pads = gst_element_get_pad_list(realelement);
+
while (pads) {
GstPad *pad = (GstPad *)pads->data;
GstCaps *caps = gst_pad_get_caps (pad);
data[1] = mime;
padnode = gtk_ctree_insert_node (GTK_CTREE (tree), NULL, NULL, data, 0,
NULL, NULL, NULL, NULL, FALSE, TRUE);
+
+ gst_editor_add_caps_to_tree (caps, tree, padnode);
+
+ pads = g_list_next (pads);
+ }
+
+ pads = gst_element_get_padtemplate_list(realelement);
+ while (pads) {
+ GstPadTemplate *templ = (GstPadTemplate *)pads->data;
+ GstCaps *caps = templ->caps;
+ gchar *mime;
+ gchar *data[2];
+ GtkCTreeNode *padnode;
+
if (caps) {
- GstProps *props = gst_caps_get_props (caps);
- if (props) {
- GSList *propslist = props->properties;
-
- while (propslist) {
- GstPropsEntry *entry = (GstPropsEntry *)propslist->data;
-
- data[0] = g_quark_to_string (entry->propid);
-
- switch (entry->propstype) {
- case GST_PROPS_LIST_ID_NUM:
- {
- GList *list;
- guint count = 0;
- data[1] = "";
-
- list = entry->data.list_data.entries;
-
- while (list) {
- data[1] = g_strconcat (data[1], (count++?", ":""),
- gst_editor_props_show_func ((GstPropsEntry *)list->data), NULL);
- list = g_list_next (list);
- }
- break;
- }
- default:
- data[1] = gst_editor_props_show_func (entry);
- break;
- }
- gtk_ctree_insert_node (GTK_CTREE (tree), padnode, NULL, data, 0,
- NULL, NULL, NULL, NULL, TRUE, TRUE);
-
- propslist = g_slist_next (propslist);
- }
- }
+ GstType *type;
+ type = gst_type_find_by_id (caps->id);
+ mime = type->mime;
}
+ else {
+ mime = "unknown/unknown";
+ }
+
+ data[0] = g_strdup (templ->name_template);
+ data[1] = mime;
+ padnode = gtk_ctree_insert_node (GTK_CTREE (tree), NULL, NULL, data, 0,
+ NULL, NULL, NULL, NULL, FALSE, TRUE);
+
+ gst_editor_add_caps_to_tree (caps, tree, padnode);
+
pads = g_list_next (pads);
}
+
gtk_clist_thaw (GTK_CLIST (tree));
gtk_widget_show(tree);
toggled = gtk_toggle_button_get_active(button);
gtk_object_set (GTK_OBJECT (button), "label", (toggled? _("Yes"):_("No")), NULL);
+ gdk_threads_leave ();
gtk_object_set (GTK_OBJECT (arg->element), arg->arg->name, toggled, NULL);
+ gdk_threads_enter ();
}
static void
+widget_adjustment_value_changed (GtkAdjustment *adjustment,
+ arg_data *arg)
+{
+ gdk_threads_leave ();
+ gtk_object_set (GTK_OBJECT (arg->element), arg->arg->name, (gint) adjustment->value, NULL);
+ gdk_threads_enter ();
+}
+
+static void
on_file_selected (GtkEditable *entry, arg_data *fs)
{
gtk_object_set(GTK_OBJECT(fs->element), fs->arg->name,
{
gint value;
GtkAdjustment *spinner_adj;
+ arg_data *data = g_new0(arg_data, 1);
+
+ data->element = element;
+ data->arg = arg;
value = GTK_VALUE_INT(*arg);
spinner_adj = (GtkAdjustment *) gtk_adjustment_new(50.0, 0.0, 10000000.0, 1.0, 5.0, 5.0);
entry = gtk_spin_button_new(spinner_adj, 1.0, 0);
gtk_spin_button_set_value(GTK_SPIN_BUTTON(entry), (gfloat) value);
+ gtk_signal_connect(GTK_OBJECT(spinner_adj), "value_changed", widget_adjustment_value_changed, data);
break;
}
case GTK_TYPE_FLOAT:
/* put the buffer on the tail of the list */
queue->queue = g_slist_append (queue->queue, buf);
// STATUS("%s: +\n");
- g_print("(%s:%s)+ ",GST_DEBUG_PAD_NAME(pad));
+ DEBUG("(%s:%s)+ ",GST_DEBUG_PAD_NAME(pad));
/* if we were empty, but aren't any more, signal a condition */
tosignal = (queue->level_buffers >= 0);
queue->level_buffers--;
// STATUS("%s: -\n");
- g_print("(%s:%s)- ",GST_DEBUG_PAD_NAME(pad));
+ DEBUG("(%s:%s)- ",GST_DEBUG_PAD_NAME(pad));
tosignal = queue->level_buffers < queue->max_buffers;
GST_UNLOCK(queue);
* Boston, MA 02111-1307, USA.
*/
-//#define GST_DEBUG_ENABLED
+#define GST_DEBUG_ENABLED
#include "gstbin.h"
#include "gstdebug.h"
// check to other paths for mathing elements (factories)
for (i=1; i<numsinks; i++) {
- if (factory != (GstElementFactory *)(factories[i]->data)) {
+ if (!factories[i] || (factory != (GstElementFactory *)(factories[i]->data))) {
goto differ;
}
factories[i] = g_list_next(factories[i]);
* Boston, MA 02111-1307, USA.
*/
-//#define GST_DEBUG_ENABLED
+#define GST_DEBUG_ENABLED
#include "gstscheduler.h"
#include "gstdebug.h"
pads = g_list_next (pads);
DEBUG("have pad %s:%s\n",GST_DEBUG_PAD_NAME(pad));
+ DEBUG("peer pad %p\n", pad->peer);
// only bother with if the pad's peer's parent is this bin or it's DECOUPLED
// only add it if it's in the list of un-visited elements still
if ((g_list_find (elements, pad->peer->parent) != NULL) ||
/* put the buffer on the tail of the list */
queue->queue = g_slist_append (queue->queue, buf);
// STATUS("%s: +\n");
- g_print("(%s:%s)+ ",GST_DEBUG_PAD_NAME(pad));
+ DEBUG("(%s:%s)+ ",GST_DEBUG_PAD_NAME(pad));
/* if we were empty, but aren't any more, signal a condition */
tosignal = (queue->level_buffers >= 0);
queue->level_buffers--;
// STATUS("%s: -\n");
- g_print("(%s:%s)- ",GST_DEBUG_PAD_NAME(pad));
+ DEBUG("(%s:%s)- ",GST_DEBUG_PAD_NAME(pad));
tosignal = queue->level_buffers < queue->max_buffers;
GST_UNLOCK(queue);
g_return_val_if_fail(encodefactory != NULL, -1);
sinkfactory = gst_elementfactory_find("fdsink");
g_return_val_if_fail(sinkfactory != NULL, -1);
+ sink = gst_elementfactory_create(sinkfactory,"sink");
src = gst_elementfactory_create(srcfactory,"src");
g_return_val_if_fail(src != NULL, -1);
while (factories) {
GstElementFactory *factory = (GstElementFactory *)factories->data;
- g_print ("factory: %s\n", factory->name);
+ g_print ("factory: %s %d\n", factory->name, factory->type);
factories = g_list_next (factories);
}
GstElementFactory *factory;
GstElement *element;
- factory = gst_elementfactory_find ("foo");
- g_print ("factory \"foo\" %s\n", (factory?"found":"not found"));
+ //factory = gst_elementfactory_find ("foo");
+ //g_print ("factory \"foo\" %s\n", (factory?"found":"not found"));
factory = gst_elementfactory_find (name);
g_print ("factory \"%s\" %s\n", name, (factory?"found":"not found"));
gst_init(&argc,&argv);
- dump_plugins ();
- dump_factories ();
- dump_types ();
+ //dump_plugins ();
+ //dump_factories ();
+ //dump_types ();
- print_some_providers ("audio/mp3");
+ //print_some_providers ("audio/mp3");
- load_something ("mpg123");
+ load_something ("fdsink");
print_some_providers ("audio/mp3");