Pending editor changes. fixes for autoplug of elementary MPEG1 video streams make sure mp3 types get compiled videosi...

Original commit message from CVS:
Pending editor changes.
fixes for autoplug of elementary MPEG1 video streams
make sure mp3 types get compiled
videosink changes for xml loading
This commit is contained in:
Wim Taymans 2000-12-28 02:51:07 +00:00
parent 41aa51ba45
commit f4a635c8dc
17 changed files with 457 additions and 151 deletions

View file

@ -14,6 +14,7 @@ libgsteditor_la_SOURCES = \
gsteditorbin.c \ gsteditorbin.c \
gsteditorcanvas.c \ gsteditorcanvas.c \
gsteditorpad.c \ gsteditorpad.c \
gsteditorpadtemplate.c \
gsteditorconnection.c \ gsteditorconnection.c \
gsteditorimage.c \ gsteditorimage.c \
gsteditorpalette.c \ gsteditorpalette.c \

View file

@ -52,7 +52,9 @@ main (int argc, char *argv[])
gst_editor_project_view_new(project); gst_editor_project_view_new(project);
gdk_threads_enter ();
gtk_main(); gtk_main();
gdk_threads_leave ();
return(0); return(0);
} }

View file

@ -35,6 +35,8 @@ typedef struct _GstEditorCanvas GstEditorCanvas;
typedef struct _GstEditorCanvasClass GstEditorCanvasClass; typedef struct _GstEditorCanvasClass GstEditorCanvasClass;
typedef struct _GstEditorPad GstEditorPad; typedef struct _GstEditorPad GstEditorPad;
typedef struct _GstEditorPadClass GstEditorPadClass; typedef struct _GstEditorPadClass GstEditorPadClass;
typedef struct _GstEditorPadTemplate GstEditorPadTemplate;
typedef struct _GstEditorPadTemplateClass GstEditorPadTemplateClass;
typedef struct _GstEditorConnection GstEditorConnection; typedef struct _GstEditorConnection GstEditorConnection;
typedef struct _GstEditorConnectionClass GstEditorConnectionClass; typedef struct _GstEditorConnectionClass GstEditorConnectionClass;
@ -142,6 +144,9 @@ struct _GstEditorElement {
GList *srcpads,*sinkpads; GList *srcpads,*sinkpads;
gboolean padlistchange; gboolean padlistchange;
/* list of padtemplates */
GList *srcpadtemps,*sinkpadtemps;
/* interaction state */ /* interaction state */
gboolean dragging,resizing,moved,hesitating; gboolean dragging,resizing,moved,hesitating;
gdouble offx,offy,dragx,dragy; gdouble offx,offy,dragx,dragy;
@ -168,8 +173,6 @@ void gst_editor_element_construct(GstEditorElement *element,
const gchar *first_arg_name, const gchar *first_arg_name,
va_list args); va_list args);
void gst_editor_element_repack(GstEditorElement *element); 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, void gst_editor_element_set_name(GstEditorElement *element,
const gchar *name); const gchar *name);
const gchar *gst_editor_element_get_name(GstEditorElement *element); const gchar *gst_editor_element_get_name(GstEditorElement *element);
@ -314,6 +317,75 @@ void gst_editor_pad_repack(GstEditorPad *pad);
#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 \ #define GST_TYPE_EDITOR_CONNECTION \
(gst_editor_connection_get_type()) (gst_editor_connection_get_type())
#define GST_EDITOR_CONNECTION(obj) \ #define GST_EDITOR_CONNECTION(obj) \

View file

@ -353,6 +353,7 @@ gst_editor_bin_object_added (GstEditorBin *editorbin, GstObject *bin, GstObject
g_print ("gsteditorbin: object added\n"); g_print ("gsteditorbin: object added\n");
} }
void void
gst_editor_bin_add (GstEditorBin *bin, GstEditorElement *element) gst_editor_bin_add (GstEditorBin *bin, GstEditorElement *element)
{ {

View file

@ -50,19 +50,22 @@ static gint gst_editor_element_state_event (GnomeCanvasItem *item,
GdkEvent *event, GdkEvent *event,
gpointer data); gpointer data);
/* external events (from GstElement) */
static void gst_editor_element_state_change (GstElement *element,
gint state,
GstEditorElement *editorelement);
/* utility functions */ /* utility functions */
static void gst_editor_element_resize (GstEditorElement *element); static void gst_editor_element_resize (GstEditorElement *element);
static void gst_editor_element_set_state (GstEditorElement *element, static void gst_editor_element_set_state (GstEditorElement *element,
gint id,gboolean set); 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 (GstEditorElement *element);
static void gst_editor_element_sync_state_wrapper (GstEditorElement *element);
static void gst_editor_element_move (GstEditorElement *element, static void gst_editor_element_move (GstEditorElement *element,
gdouble dx,gdouble dy); 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" }; static gchar *_gst_editor_element_states[] = { "S","R","P","F" };
@ -367,7 +370,6 @@ gst_editor_element_realize (GstEditorElement *element)
gint i; gint i;
gdouble x1,y1,x2,y2; gdouble x1,y1,x2,y2;
GList *pads; GList *pads;
GstPad *pad;
// g_print("realizing editor element %p\n",element); // g_print("realizing editor element %p\n",element);
@ -375,9 +377,17 @@ gst_editor_element_realize (GstEditorElement *element)
g_return_if_fail(element->parent != NULL); g_return_if_fail(element->parent != NULL);
// set the state signal of the actual element // set the state signal of the actual element
gtk_signal_connect(GTK_OBJECT(element->element),"state_change", gtk_signal_connect_object (GTK_OBJECT(element->element),"state_change",
GTK_SIGNAL_FUNC(gst_editor_element_state_change), GTK_SIGNAL_FUNC(gst_editor_element_sync_state_wrapper),
element); 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 // create the bounds if we haven't had them set
// g_print("centering element at %.2fx%.2f (%.2fx%.2f)\n", // g_print("centering element at %.2fx%.2f (%.2fx%.2f)\n",
@ -454,10 +464,22 @@ gst_editor_element_realize (GstEditorElement *element)
GTK_SIGNAL_FUNC(gst_editor_element_state_event), GTK_SIGNAL_FUNC(gst_editor_element_state_event),
GINT_TO_POINTER(i)); 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 // get all the pads
pads = gst_element_get_pad_list(element->element); pads = gst_element_get_pad_list(element->element);
while (pads) { while (pads) {
pad = GST_PAD(pads->data); GstPad *pad = GST_PAD(pads->data);
gst_editor_element_add_pad(element,pad); gst_editor_element_add_pad(element,pad);
pads = g_list_next(pads); pads = g_list_next(pads);
@ -489,6 +511,7 @@ gst_editor_element_resize (GstEditorElement *element)
gdouble groupwidth,groupheight; gdouble groupwidth,groupheight;
GList *pads; GList *pads;
GstEditorPad *editorpad; GstEditorPad *editorpad;
GstEditorPadTemplate *editorpadtemplate;
gint i; gint i;
if (element->resize != TRUE) return; if (element->resize != TRUE) return;
@ -552,12 +575,28 @@ gst_editor_element_resize (GstEditorElement *element)
element->srcs++; element->srcs++;
pads = g_list_next(pads); 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 // add in the needed space
element->minheight += MAX((element->sinkheight*element->sinks), element->minheight += MAX((element->sinkheight*element->sinks),
(element->srcheight*element->srcs)) + 4.0; (element->srcheight*element->srcs)) + 4.0;
element->minwidth = MAX(element->minwidth, element->minwidth = MAX(element->minwidth,
((element->sinkwidth*element->sinks) + ((element->sinkwidth) +
(element->srcwidth*element->srcs) + 4.0)); (element->srcwidth) + 4.0));
// g_print("have %d sinks (%.2fx%.2f) and %d srcs (%.2fx%.2f)\n", // g_print("have %d sinks (%.2fx%.2f) and %d srcs (%.2fx%.2f)\n",
// element->sinks,element->sinkwidth,element->sinkheight, // element->sinks,element->sinkwidth,element->sinkheight,
// element->srcs,element->srcwidth,element->srcheight); // element->srcs,element->srcwidth,element->srcheight);
@ -569,6 +608,8 @@ gst_editor_element_resize (GstEditorElement *element)
element->width = MAX(element->width,element->minwidth); element->width = MAX(element->width,element->minwidth);
element->height = MAX(element->height,element->minheight); element->height = MAX(element->height,element->minheight);
// g_print("is now %.2fx%.2f\n",element->width,element->height); // 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 void
@ -576,6 +617,7 @@ gst_editor_element_repack (GstEditorElement *element)
{ {
GList *pads; GList *pads;
GstEditorPad *editorpad; GstEditorPad *editorpad;
GstEditorPadTemplate *editorpadtemplate;
gint sinks; gint sinks;
gint srcs; gint srcs;
gdouble x1,y1,x2,y2; gdouble x1,y1,x2,y2;
@ -642,13 +684,25 @@ gst_editor_element_repack (GstEditorElement *element)
sinks--; sinks--;
pads = g_list_next(pads); 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; srcs = element->srcs;
pads = element->srcpads; pads = element->srcpads;
while (pads) { while (pads) {
editorpad = GST_EDITOR_PAD(pads->data); editorpad = GST_EDITOR_PAD(pads->data);
gtk_object_set(GTK_OBJECT(editorpad), gtk_object_set(GTK_OBJECT(editorpad),
"x",x2 - element->srcwidth, "x",x2 - editorpad->width,
"y",y2 - 2.0 - element->stateheight - "y",y2 - 2.0 - element->stateheight -
(element->srcheight * srcs), (element->srcheight * srcs),
NULL); NULL);
@ -656,13 +710,36 @@ gst_editor_element_repack (GstEditorElement *element)
srcs--; srcs--;
pads = g_list_next(pads); 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"); // 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* static void
gst_editor_element_add_pad (GstEditorElement *element, gst_editor_element_add_pad_func (GstEditorElement *element,
GstPad *pad) GstPad *pad)
{ {
GstEditorPad *editorpad; GstEditorPad *editorpad;
@ -681,9 +758,69 @@ gst_editor_element_add_pad (GstEditorElement *element,
g_print("HUH?!? Don't know which direction this pad is...\n"); g_print("HUH?!? Don't know which direction this pad is...\n");
gst_editor_element_repack(element); 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 static gint
gst_editor_element_group_event (GnomeCanvasItem *item, gst_editor_element_group_event (GnomeCanvasItem *item,
@ -717,12 +854,8 @@ gst_editor_element_event(GnomeCanvasItem *item,
switch(event->type) { switch(event->type) {
case GDK_ENTER_NOTIFY: case GDK_ENTER_NOTIFY:
gnome_canvas_item_set(GNOME_CANVAS_ITEM(element->border),
"fill_color_rgba", 0xeeeeee80, NULL);
return TRUE; return TRUE;
case GDK_LEAVE_NOTIFY: case GDK_LEAVE_NOTIFY:
gnome_canvas_item_set(GNOME_CANVAS_ITEM(element->border),
"fill_color", "white", NULL);
return TRUE; return TRUE;
case GDK_BUTTON_PRESS: case GDK_BUTTON_PRESS:
{ {
@ -893,7 +1026,9 @@ gst_editor_element_state_event(GnomeCanvasItem *item,
return FALSE; return FALSE;
if (id < 4) { if (id < 4) {
gdk_threads_leave ();
gst_editor_element_set_state(element,id,TRUE); gst_editor_element_set_state(element,id,TRUE);
gdk_threads_enter ();
} else } else
g_warning("Uh, shouldn't have gotten here, unknown state\n"); g_warning("Uh, shouldn't have gotten here, unknown state\n");
//g_print("in element statebox_event, setting inchild"); //g_print("in element statebox_event, setting inchild");
@ -919,14 +1054,11 @@ gst_editor_element_set_state(GstEditorElement *element,
static void static void
gst_editor_element_state_change(GstElement *element, gst_editor_element_sync_state_wrapper (GstEditorElement *element)
gint state,
GstEditorElement *editorelement)
{ {
g_return_if_fail(editorelement != NULL); gdk_threads_enter ();
gst_editor_element_sync_state (element);
//g_print("gst_editor_element_state_change got state 0x%08x\n",state); gdk_threads_leave ();
gst_editor_element_sync_state(editorelement);
} }
static void static void
@ -951,35 +1083,21 @@ gst_editor_element_sync_state (GstEditorElement *element)
} }
} }
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 static void
gst_editor_element_move(GstEditorElement *element, gst_editor_element_move(GstEditorElement *element,
gdouble dx,gdouble dy) gdouble dx,gdouble dy)
{ {
GList *pads;
GstEditorPad *pad;
// this is a 'little' trick to keep from repacking the whole thing... // this is a 'little' trick to keep from repacking the whole thing...
element->x += dx;element->y += dy; element->x += dx;element->y += dy;
gnome_canvas_item_move(GNOME_CANVAS_ITEM(element->group),dx,dy); gnome_canvas_item_move(GNOME_CANVAS_ITEM(element->group),dx,dy);
pads = element->srcpads; gtk_signal_emit(GTK_OBJECT(element),gst_editor_element_signals[POSITION_CHANGED], element);
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);
}
} }

View file

@ -30,6 +30,8 @@ static void gst_editor_pad_set_arg(GtkObject *object,GtkArg *arg,guint id);
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);
static void gst_editor_pad_realize(GstEditorPad *pad); static void gst_editor_pad_realize(GstEditorPad *pad);
static void gst_editor_pad_position_changed(GstEditorPad *pad, GstEditorElement *element);
/* class implementation functions */ /* class implementation functions */
//static void gst_editor_pad_update(GnomeCanvasItem *item,double *affine, //static void gst_editor_pad_update(GnomeCanvasItem *item,double *affine,
// ArtSVP *clip_path,int flags); // ArtSVP *clip_path,int flags);
@ -60,7 +62,9 @@ enum {
static GtkObjectClass *parent_class; static GtkObjectClass *parent_class;
//static guint gst_editor_pad_signals[LAST_SIGNAL] = { 0 }; //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; static GtkType pad_type = 0;
if (!pad_type) { if (!pad_type) {
@ -79,7 +83,9 @@ GtkType gst_editor_pad_get_type() {
return 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; GtkObjectClass *object_class;
object_class = (GtkObjectClass*)klass; object_class = (GtkObjectClass*)klass;
@ -103,7 +109,9 @@ static void gst_editor_pad_class_init(GstEditorPadClass *klass) {
object_class->get_arg = gst_editor_pad_get_arg; 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* GstEditorPad*
@ -142,12 +150,17 @@ gst_editor_pad_new(GstEditorElement *parent,GstPad *pad,
} }
} }
gtk_signal_connect_object (GTK_OBJECT (parent), "position_changed",
gst_editor_pad_position_changed, editorpad);
return editorpad; return editorpad;
} }
void gst_editor_pad_construct(GstEditorPad *pad, void
gst_editor_pad_construct(GstEditorPad *pad,
GstEditorElement *parent, GstEditorElement *parent,
const gchar *first_arg_name,va_list args) { const gchar *first_arg_name,va_list args)
{
GtkObject *obj = GTK_OBJECT(pad); GtkObject *obj = GTK_OBJECT(pad);
GSList *arg_list = NULL, *info_list = NULL; GSList *arg_list = NULL, *info_list = NULL;
gchar *error; gchar *error;
@ -175,7 +188,9 @@ void gst_editor_pad_construct(GstEditorPad *pad,
(padclass->realize)(pad); (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; GstEditorPad *pad;
/* get the major types of this object */ /* get the major types of this object */
@ -206,7 +221,9 @@ static void gst_editor_pad_set_arg(GtkObject *object,GtkArg *arg,guint id) {
} }
} }
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; GstEditorPad *pad;
/* get the major types of this object */ /* get the major types of this object */
@ -231,7 +248,9 @@ 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_realize (GstEditorPad *pad)
{
// g_print("realizing editor pad %p\n",pad); // g_print("realizing editor pad %p\n",pad);
/* we must be attached to an element */ /* we must be attached to an element */
@ -283,7 +302,9 @@ static void gst_editor_pad_realize(GstEditorPad *pad) {
} }
static void gst_editor_pad_resize(GstEditorPad *pad) { static void
gst_editor_pad_resize (GstEditorPad *pad)
{
gdouble minwidth,minheight; gdouble minwidth,minheight;
// g_print("resizing pad\n"); // g_print("resizing pad\n");
@ -311,7 +332,9 @@ static void gst_editor_pad_resize(GstEditorPad *pad) {
gst_editor_connection_resize(pad->connection); 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; gdouble x1,y1,x2,y2;
if (!pad->realized) return; if (!pad->realized) return;
@ -387,9 +410,11 @@ static gint gst_editor_pad_event(GnomeCanvasItem *item,GdkEvent *event) {
*/ */
/* FIXME FIXME FIXME */ /* FIXME FIXME FIXME */
static gint gst_editor_pad_padbox_event(GnomeCanvasItem *item, static gint
gst_editor_pad_padbox_event(GnomeCanvasItem *item,
GdkEvent *event, GdkEvent *event,
GstEditorPad *pad) { GstEditorPad *pad)
{
GstEditorElement *element; GstEditorElement *element;
GstEditorBin *bin; GstEditorBin *bin;
@ -403,14 +428,10 @@ static gint gst_editor_pad_padbox_event(GnomeCanvasItem *item,
case GDK_ENTER_NOTIFY: case GDK_ENTER_NOTIFY:
gtk_object_set(GTK_OBJECT(pad->border), gtk_object_set(GTK_OBJECT(pad->border),
"fill_color_rgba", 0xBBDDBB00, NULL); "fill_color_rgba", 0xBBDDBB00, NULL);
// g_print("entered pad '%s'\n",
// gst_pad_get_name(pad->pad));
break; break;
case GDK_LEAVE_NOTIFY: case GDK_LEAVE_NOTIFY:
gtk_object_set(GTK_OBJECT(pad->border), gtk_object_set(GTK_OBJECT(pad->border),
"fill_color_rgba", 0xCCFFCC00, NULL); "fill_color_rgba", 0xCCFFCC00, NULL);
// g_print("left pad '%s'\n",
// gst_pad_get_name(pad->pad));
break; break;
case GDK_BUTTON_PRESS: case GDK_BUTTON_PRESS:
// g_print("have button press in pad '%s'\n", // g_print("have button press in pad '%s'\n",
@ -426,3 +447,16 @@ static gint gst_editor_pad_padbox_event(GnomeCanvasItem *item,
} }
return FALSE; 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);
}
}

View file

@ -35,14 +35,15 @@ static void gst_editor_palette_make(GstEditorPalette *palette);
struct _palette_entry { struct _palette_entry {
gchar *tooltip; gchar *tooltip;
GtkType (*type) (void); GtkType (*type) (void);
gchar *factoryname;
}; };
#define CORE_ELEMENT_SIZE 4 #define CORE_ELEMENT_SIZE 4
struct _palette_entry _palette_contents_core[CORE_ELEMENT_SIZE] = { struct _palette_entry _palette_contents_core[CORE_ELEMENT_SIZE] = {
{"Bin", gst_bin_get_type }, {"Bin", gst_bin_get_type, "bin" },
{"Thread", gst_thread_get_type }, {"Thread", gst_thread_get_type, "thread" },
{"Pipeline", gst_pipeline_get_type }, {"Pipeline", gst_pipeline_get_type, "pipeline" },
{"Tee", gst_tee_get_type }, {"Tee", gst_tee_get_type, "tee" },
}; };
enum { enum {
@ -58,7 +59,9 @@ enum {
static GtkObjectClass *parent_class; static GtkObjectClass *parent_class;
static guint gst_editor_palette_signals[LAST_SIGNAL] = { 0 }; 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; static GtkType palette_type = 0;
if (!palette_type) { if (!palette_type) {
@ -77,7 +80,9 @@ GtkType gst_editor_palette_get_type() {
return 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; GtkObjectClass *object_class;
object_class = (GtkObjectClass*)klass; object_class = (GtkObjectClass*)klass;
@ -102,7 +107,9 @@ static void gst_editor_palette_class_init(GstEditorPaletteClass *klass) {
object_class->get_arg = gst_editor_palette_get_arg; 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(); palette->tooltips = gtk_tooltips_new();
} }
@ -112,7 +119,8 @@ typedef struct {
} connect_struct; } connect_struct;
/* we need more control here so... */ /* we need more control here so... */
static void gst_editor_palette_connect_func (const gchar *handler_name, static void
gst_editor_palette_connect_func (const gchar *handler_name,
GtkObject *object, GtkObject *object,
const gchar *signal_name, const gchar *signal_name,
const gchar *signal_data, const gchar *signal_data,
@ -133,7 +141,9 @@ static void gst_editor_palette_connect_func (const gchar *handler_name,
} }
} }
GstEditorPalette *gst_editor_palette_new() { GstEditorPalette*
gst_editor_palette_new()
{
GstEditorPalette *palette; GstEditorPalette *palette;
GtkWidget *palette_window; GtkWidget *palette_window;
connect_struct data; connect_struct data;
@ -164,11 +174,19 @@ typedef struct {
struct _palette_entry *entry; struct _palette_entry *entry;
} _signal_data; } _signal_data;
static void gst_editor_palette_element_clicked(GtkButton *button, _signal_data *data) { static void
gtk_signal_emit(GTK_OBJECT(data->palette),gst_editor_palette_signals[SIGNAL_ELEMENT_SELECTED], data->entry->type()); 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; GtkWidget *button;
GstEditorImage *editimage; GstEditorImage *editimage;
GtkWidget *image; GtkWidget *image;
@ -212,7 +230,9 @@ static void gst_editor_palette_make(GstEditorPalette *palette) {
} }
} }
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; GstEditorPalette *palette;
/* get the major types of this object */ /* get the major types of this object */
@ -225,7 +245,9 @@ static void gst_editor_palette_set_arg(GtkObject *object,GtkArg *arg,guint id) {
} }
} }
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; GstEditorPalette *palette;
/* get the major types of this object */ /* get the major types of this object */

View file

@ -51,7 +51,7 @@ struct _GstEditorPaletteClass {
GtkObjectClass parent_class; GtkObjectClass parent_class;
void (*element_selected) (GstEditorPalette *palette, void (*element_selected) (GstEditorPalette *palette,
GstEditorElement *element); GstElementFactory *factory);
void (*in_selection_mode) (GstEditorPalette *palette, void (*in_selection_mode) (GstEditorPalette *palette,
GstEditorElement *element); GstEditorElement *element);
}; };

View file

@ -114,11 +114,11 @@ gst_editor_project_connect_func (const gchar *handler_name,
static void static void
gst_editor_project_element_selected (GstEditorProjectView *view, gst_editor_project_element_selected (GstEditorProjectView *view,
GtkType type, GstEditorPalette *palette) GstElementFactory *factory, GstEditorPalette *palette)
{ {
GstElement *element; GstElement *element;
element = gtk_type_new(type); element = gst_elementfactory_create (factory, "new_element");
g_return_if_fail(element != NULL); g_return_if_fail(element != NULL);
g_return_if_fail(GST_IS_ELEMENT(element)); g_return_if_fail(GST_IS_ELEMENT(element));

View file

@ -255,49 +255,16 @@ gst_editor_props_show_func (GstPropsEntry *entry)
return g_strdup ("unknown"); return g_strdup ("unknown");
} }
static GtkWidget* static void
gst_editor_pads_create (GstEditorProperty *property, GstEditorElement *element) gst_editor_add_caps_to_tree (GstCaps *caps, GtkWidget *tree, GtkCTreeNode *padnode)
{ {
GstElement *realelement = element->element;
GList *pads;
GtkWidget *tree;
gchar *columns[2];
pads = gst_element_get_pad_list(realelement);
columns[0] = "name";
columns[1] = "info";
tree = gtk_ctree_new_with_titles (2, 0, columns);
gtk_clist_set_column_width (GTK_CLIST (tree), 0, 150);
gtk_clist_freeze (GTK_CLIST (tree));
while (pads) {
GstPad *pad = (GstPad *)pads->data;
GstCaps *caps = gst_pad_get_caps (pad);
gchar *mime;
gchar *data[2];
GtkCTreeNode *padnode;
if (caps) {
GstType *type;
type = gst_type_find_by_id (caps->id);
mime = type->mime;
}
else {
mime = "unknown/unknown";
}
data[0] = g_strdup (gst_pad_get_name (pad));
data[1] = mime;
padnode = gtk_ctree_insert_node (GTK_CTREE (tree), NULL, NULL, data, 0,
NULL, NULL, NULL, NULL, FALSE, TRUE);
if (caps) { if (caps) {
GstProps *props = gst_caps_get_props (caps); GstProps *props = gst_caps_get_props (caps);
if (props) { if (props) {
GSList *propslist = props->properties; GSList *propslist = props->properties;
while (propslist) { while (propslist) {
gchar *data[2];
GstPropsEntry *entry = (GstPropsEntry *)propslist->data; GstPropsEntry *entry = (GstPropsEntry *)propslist->data;
data[0] = g_quark_to_string (entry->propid); data[0] = g_quark_to_string (entry->propid);
@ -329,8 +296,79 @@ gst_editor_pads_create (GstEditorProperty *property, GstEditorElement *element)
} }
} }
} }
}
static GtkWidget*
gst_editor_pads_create (GstEditorProperty *property, GstEditorElement *element)
{
GstElement *realelement = element->element;
GList *pads;
GtkWidget *tree;
gchar *columns[2];
columns[0] = "name";
columns[1] = "info";
tree = gtk_ctree_new_with_titles (2, 0, columns);
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);
gchar *mime;
gchar *data[2];
GtkCTreeNode *padnode;
if (caps) {
GstType *type;
type = gst_type_find_by_id (caps->id);
mime = type->mime;
}
else {
mime = "unknown/unknown";
}
data[0] = g_strdup (gst_pad_get_name (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 = 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) {
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_clist_thaw (GTK_CLIST (tree));
gtk_widget_show(tree); gtk_widget_show(tree);
@ -471,7 +509,18 @@ widget_bool_toggled (GtkToggleButton *button, arg_data *arg)
toggled = gtk_toggle_button_get_active(button); toggled = gtk_toggle_button_get_active(button);
gtk_object_set (GTK_OBJECT (button), "label", (toggled? _("Yes"):_("No")), NULL); 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); 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 static void
@ -518,11 +567,16 @@ create_property_entry (GtkArg *arg, GstElement *element)
{ {
gint value; gint value;
GtkAdjustment *spinner_adj; GtkAdjustment *spinner_adj;
arg_data *data = g_new0(arg_data, 1);
data->element = element;
data->arg = arg;
value = GTK_VALUE_INT(*arg); value = GTK_VALUE_INT(*arg);
spinner_adj = (GtkAdjustment *) gtk_adjustment_new(50.0, 0.0, 10000000.0, 1.0, 5.0, 5.0); 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); entry = gtk_spin_button_new(spinner_adj, 1.0, 0);
gtk_spin_button_set_value(GTK_SPIN_BUTTON(entry), (gfloat) value); 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; break;
} }
case GTK_TYPE_FLOAT: case GTK_TYPE_FLOAT:

View file

@ -206,7 +206,7 @@ gst_queue_chain (GstPad *pad, GstBuffer *buf)
/* put the buffer on the tail of the list */ /* put the buffer on the tail of the list */
queue->queue = g_slist_append (queue->queue, buf); queue->queue = g_slist_append (queue->queue, buf);
// STATUS("%s: +\n"); // 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 */ /* if we were empty, but aren't any more, signal a condition */
tosignal = (queue->level_buffers >= 0); tosignal = (queue->level_buffers >= 0);
@ -266,7 +266,7 @@ gst_queue_get (GstPad *pad)
queue->level_buffers--; queue->level_buffers--;
// STATUS("%s: -\n"); // 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; tosignal = queue->level_buffers < queue->max_buffers;
GST_UNLOCK(queue); GST_UNLOCK(queue);

View file

@ -17,7 +17,7 @@
* Boston, MA 02111-1307, USA. * Boston, MA 02111-1307, USA.
*/ */
//#define GST_DEBUG_ENABLED #define GST_DEBUG_ENABLED
#include "gstbin.h" #include "gstbin.h"
#include "gstdebug.h" #include "gstdebug.h"

View file

@ -368,7 +368,7 @@ gst_pipeline_autoplug (GstPipeline *pipeline)
// check to other paths for mathing elements (factories) // check to other paths for mathing elements (factories)
for (i=1; i<numsinks; i++) { for (i=1; i<numsinks; i++) {
if (factory != (GstElementFactory *)(factories[i]->data)) { if (!factories[i] || (factory != (GstElementFactory *)(factories[i]->data))) {
goto differ; goto differ;
} }
factories[i] = g_list_next(factories[i]); factories[i] = g_list_next(factories[i]);

View file

@ -17,7 +17,7 @@
* Boston, MA 02111-1307, USA. * Boston, MA 02111-1307, USA.
*/ */
//#define GST_DEBUG_ENABLED #define GST_DEBUG_ENABLED
#include "gstscheduler.h" #include "gstscheduler.h"
#include "gstdebug.h" #include "gstdebug.h"
@ -393,6 +393,7 @@ void gst_bin_schedule_func(GstBin *bin) {
pads = g_list_next (pads); pads = g_list_next (pads);
DEBUG("have pad %s:%s\n",GST_DEBUG_PAD_NAME(pad)); 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 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 // only add it if it's in the list of un-visited elements still
if ((g_list_find (elements, pad->peer->parent) != NULL) || if ((g_list_find (elements, pad->peer->parent) != NULL) ||

View file

@ -206,7 +206,7 @@ gst_queue_chain (GstPad *pad, GstBuffer *buf)
/* put the buffer on the tail of the list */ /* put the buffer on the tail of the list */
queue->queue = g_slist_append (queue->queue, buf); queue->queue = g_slist_append (queue->queue, buf);
// STATUS("%s: +\n"); // 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 */ /* if we were empty, but aren't any more, signal a condition */
tosignal = (queue->level_buffers >= 0); tosignal = (queue->level_buffers >= 0);
@ -266,7 +266,7 @@ gst_queue_get (GstPad *pad)
queue->level_buffers--; queue->level_buffers--;
// STATUS("%s: -\n"); // 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; tosignal = queue->level_buffers < queue->max_buffers;
GST_UNLOCK(queue); GST_UNLOCK(queue);

View file

@ -32,6 +32,7 @@ int main(int argc,char *argv[]) {
g_return_val_if_fail(encodefactory != NULL, -1); g_return_val_if_fail(encodefactory != NULL, -1);
sinkfactory = gst_elementfactory_find("fdsink"); sinkfactory = gst_elementfactory_find("fdsink");
g_return_val_if_fail(sinkfactory != NULL, -1); g_return_val_if_fail(sinkfactory != NULL, -1);
sink = gst_elementfactory_create(sinkfactory,"sink");
src = gst_elementfactory_create(srcfactory,"src"); src = gst_elementfactory_create(srcfactory,"src");
g_return_val_if_fail(src != NULL, -1); g_return_val_if_fail(src != NULL, -1);

View file

@ -24,7 +24,7 @@ dump_factories (void)
while (factories) { while (factories) {
GstElementFactory *factory = (GstElementFactory *)factories->data; 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); factories = g_list_next (factories);
} }
@ -80,8 +80,8 @@ load_something (gchar *name)
GstElementFactory *factory; GstElementFactory *factory;
GstElement *element; GstElement *element;
factory = gst_elementfactory_find ("foo"); //factory = gst_elementfactory_find ("foo");
g_print ("factory \"foo\" %s\n", (factory?"found":"not found")); //g_print ("factory \"foo\" %s\n", (factory?"found":"not found"));
factory = gst_elementfactory_find (name); factory = gst_elementfactory_find (name);
g_print ("factory \"%s\" %s\n", name, (factory?"found":"not found")); g_print ("factory \"%s\" %s\n", name, (factory?"found":"not found"));
@ -129,13 +129,13 @@ int main(int argc,char *argv[])
gst_init(&argc,&argv); gst_init(&argc,&argv);
dump_plugins (); //dump_plugins ();
dump_factories (); //dump_factories ();
dump_types (); //dump_types ();
print_some_providers ("audio/mp3"); //print_some_providers ("audio/mp3");
load_something ("mpg123"); load_something ("fdsink");
print_some_providers ("audio/mp3"); print_some_providers ("audio/mp3");