Fixed a bug in the typeloading.

Original commit message from CVS:
Fixed a bug in the typeloading.
Fixes to various elements so that correct types are returned.
Fixed flag collision with GtkObject.
Elements can now suggest a thread. not sure if this is the right way to
handle automatic thread creation.
Autoplugging now works with multiple sinks and thread setup. No threads
are created for intermediate elements yet, so MPEG may still be choppy.
This commit is contained in:
Wim Taymans 2000-10-08 22:17:11 +00:00
parent fe8a1c5a98
commit 695f761c2b
24 changed files with 313 additions and 127 deletions

View file

@ -413,6 +413,7 @@ plugins/avi/Makefile
plugins/avi/wincodec/Makefile plugins/avi/wincodec/Makefile
plugins/jpeg/Makefile plugins/jpeg/Makefile
plugins/mp3decode/Makefile plugins/mp3decode/Makefile
plugins/mp3decode/types/Makefile
plugins/mp3decode/xa/Makefile plugins/mp3decode/xa/Makefile
plugins/mp3decode/xing/Makefile plugins/mp3decode/xing/Makefile
plugins/mp3decode/mpg123/Makefile plugins/mp3decode/mpg123/Makefile
@ -425,6 +426,7 @@ plugins/mpeg2/video/Makefile
plugins/mpeg2/mpeg2enc/Makefile plugins/mpeg2/mpeg2enc/Makefile
plugins/mpeg2/subtitles/Makefile plugins/mpeg2/subtitles/Makefile
plugins/mpeg1/Makefile plugins/mpeg1/Makefile
plugins/mpeg1/mpegtypes/Makefile
plugins/mpeg1/mpeg_play/Makefile plugins/mpeg1/mpeg_play/Makefile
plugins/mpeg1/mpegaudio/Makefile plugins/mpeg1/mpegaudio/Makefile
plugins/mpeg1/parse/Makefile plugins/mpeg1/parse/Makefile

View file

@ -597,7 +597,7 @@
<class>GtkVBox</class> <class>GtkVBox</class>
<name>vbox3</name> <name>vbox3</name>
<homogeneous>False</homogeneous> <homogeneous>False</homogeneous>
<spacing>0</spacing> <spacing>2</spacing>
<widget> <widget>
<class>GtkScrolledWindow</class> <class>GtkScrolledWindow</class>
@ -696,7 +696,7 @@
<rows>5</rows> <rows>5</rows>
<columns>2</columns> <columns>2</columns>
<homogeneous>False</homogeneous> <homogeneous>False</homogeneous>
<row_spacing>0</row_spacing> <row_spacing>2</row_spacing>
<column_spacing>0</column_spacing> <column_spacing>0</column_spacing>
<child> <child>
<padding>0</padding> <padding>0</padding>

View file

@ -209,7 +209,9 @@ struct _GstEditorBinClass {
GtkType gst_editor_bin_get_type(); GtkType gst_editor_bin_get_type();
GstEditorBin *gst_editor_bin_new(GstEditorBin *parent,GstBin *bin, GstEditorBin *gst_editor_bin_new(GstEditorBin *parent,GstBin *bin,
const gchar *first_arg_name,...); const gchar *first_arg_name,...);
void gst_editor_bin_connection_drag(GstEditorBin *bin,
gdouble wx,gdouble wy);
void gst_editor_bin_start_banding(GstEditorBin *bin,GstEditorPad *pad);
#define GST_TYPE_EDITOR_CANVAS \ #define GST_TYPE_EDITOR_CANVAS \
@ -354,6 +356,9 @@ struct _GstEditorConnectionClass {
}; };
GtkType gst_editor_connection_get_type(); GtkType gst_editor_connection_get_type();
GstEditorConnection *gst_editor_connection_new(GstEditorBin *parent,
GstEditorPad *frompad);
void gst_editor_connection_resize(GstEditorConnection *connection); void gst_editor_connection_resize(GstEditorConnection *connection);
void gst_editor_connection_set_endpoint(GstEditorConnection *connection, void gst_editor_connection_set_endpoint(GstEditorConnection *connection,
gdouble x,gdouble y); gdouble x,gdouble y);

View file

@ -22,6 +22,7 @@
#include <gst/gst.h> #include <gst/gst.h>
#include "gsteditor.h" #include "gsteditor.h"
#include "gsteditorcreate.h"
/* signals and args */ /* signals and args */
enum { enum {
@ -34,8 +35,8 @@ enum {
static void gst_editor_bin_class_init(GstEditorBinClass *klass); static void gst_editor_bin_class_init(GstEditorBinClass *klass);
static void gst_editor_bin_init(GstEditorBin *bin); static void gst_editor_bin_init(GstEditorBin *bin);
static void gst_editor_bin_set_arg(GtkObject *object,GtkArg *arg,guint id); //static void gst_editor_bin_set_arg(GtkObject *object,GtkArg *arg,guint id);
static void gst_editor_bin_get_arg(GtkObject *object,GtkArg *arg,guint id); //static void gst_editor_bin_get_arg(GtkObject *object,GtkArg *arg,guint id);
static gint gst_editor_bin_event(GnomeCanvasItem *item, static gint gst_editor_bin_event(GnomeCanvasItem *item,
GdkEvent *event, GdkEvent *event,
@ -43,6 +44,8 @@ static gint gst_editor_bin_event(GnomeCanvasItem *item,
static gint gst_editor_bin_button_event(GnomeCanvasItem *item, static gint gst_editor_bin_button_event(GnomeCanvasItem *item,
GdkEvent *event, GdkEvent *event,
GstEditorElement *element); GstEditorElement *element);
void gst_editor_bin_connection_drag(GstEditorBin *bin,
gdouble wx,gdouble wy);
static GstEditorElementClass *parent_class = NULL; static GstEditorElementClass *parent_class = NULL;
@ -88,10 +91,10 @@ GstEditorBin *gst_editor_bin_new(GstEditorBin *parent,GstBin *bin,
GstEditorBin *editorbin; GstEditorBin *editorbin;
va_list args; va_list args;
g_return_if_fail(parent != NULL); g_return_val_if_fail(parent != NULL, NULL);
g_return_if_fail(GST_IS_EDITOR_BIN(parent)); g_return_val_if_fail(GST_IS_EDITOR_BIN(parent), NULL);
g_return_if_fail(bin != NULL); g_return_val_if_fail(bin != NULL, NULL);
g_return_if_fail(GST_IS_BIN(bin)); g_return_val_if_fail(GST_IS_BIN(bin), NULL);
editorbin = GST_EDITOR_BIN(gtk_type_new(GST_TYPE_EDITOR_BIN)); editorbin = GST_EDITOR_BIN(gtk_type_new(GST_TYPE_EDITOR_BIN));
GST_EDITOR_ELEMENT(editorbin)->element = GST_ELEMENT(bin); GST_EDITOR_ELEMENT(editorbin)->element = GST_ELEMENT(bin);
@ -150,6 +153,8 @@ static gint gst_editor_bin_event(GnomeCanvasItem *item,
if (GST_EDITOR_ELEMENT_CLASS(parent_class)->event) if (GST_EDITOR_ELEMENT_CLASS(parent_class)->event)
return (*GST_EDITOR_ELEMENT_CLASS(parent_class)->event)(item,event,element); return (*GST_EDITOR_ELEMENT_CLASS(parent_class)->event)(item,event,element);
return TRUE;
} }
@ -202,7 +207,7 @@ void gst_editor_bin_connection_drag(GstEditorBin *bin,
element = GST_EDITOR_ELEMENT(bin); element = GST_EDITOR_ELEMENT(bin);
bx = wx;by = wy; bx = wx;by = wy;
gnome_canvas_item_w2i(GST_EDITOR_ELEMENT(bin)->group,&bx,&by); gnome_canvas_item_w2i(GNOME_CANVAS_ITEM(GST_EDITOR_ELEMENT(bin)->group),&bx,&by);
// first see if we're on top of an interesting pad // first see if we're on top of an interesting pad
underitem = gnome_canvas_get_item_at( underitem = gnome_canvas_get_item_at(

View file

@ -22,6 +22,7 @@
#include <gst/gst.h> #include <gst/gst.h>
#include "gsteditor.h" #include "gsteditor.h"
#include "gsteditorcreate.h"
/* signals and args */ /* signals and args */
enum { enum {
@ -46,6 +47,9 @@ static gint gst_editor_canvas_button_release(GtkWidget *widget,
static gint gst_editor_canvas_event(GnomeCanvasItem *item, static gint gst_editor_canvas_event(GnomeCanvasItem *item,
GdkEvent *event, GdkEvent *event,
GstEditorElement *element); GstEditorElement *element);
static void gst_editor_canvas_set_arg(GtkObject *object,GtkArg *arg,guint id);
static void gst_editor_canvas_get_arg(GtkObject *object,GtkArg *arg,guint id);
//gint gst_editor_canvas_verbose_event(GtkWidget *widget,GdkEvent *event); //gint gst_editor_canvas_verbose_event(GtkWidget *widget,GdkEvent *event);
@ -72,8 +76,11 @@ GtkType gst_editor_canvas_get_type(void) {
} }
static void gst_editor_canvas_class_init(GstEditorCanvasClass *klass) { static void gst_editor_canvas_class_init(GstEditorCanvasClass *klass) {
GtkObjectClass *object_class;
GstEditorElementClass *element_class; GstEditorElementClass *element_class;
object_class = (GtkObjectClass*)klass;
element_class = (GstEditorElementClass*)klass; element_class = (GstEditorElementClass*)klass;
parent_class = gtk_type_class(gst_editor_bin_get_type()); parent_class = gtk_type_class(gst_editor_bin_get_type());
@ -81,6 +88,9 @@ static void gst_editor_canvas_class_init(GstEditorCanvasClass *klass) {
gtk_object_add_arg_type("GstEditorCanvas::canvas",GTK_TYPE_POINTER, gtk_object_add_arg_type("GstEditorCanvas::canvas",GTK_TYPE_POINTER,
GTK_ARG_READABLE,ARG_CANVAS); GTK_ARG_READABLE,ARG_CANVAS);
object_class->set_arg = gst_editor_canvas_set_arg;
object_class->get_arg = gst_editor_canvas_get_arg;
element_class->realize = gst_editor_canvas_realize; element_class->realize = gst_editor_canvas_realize;
} }
@ -90,15 +100,14 @@ static void gst_editor_canvas_init(GstEditorCanvas *editorcanvas) {
GstEditorCanvas *gst_editor_canvas_new(GstBin *bin, GstEditorCanvas *gst_editor_canvas_new(GstBin *bin,
const gchar *first_arg_name,...) { const gchar *first_arg_name,...) {
GstEditorCanvas *editorcanvas; GstEditorCanvas *editorcanvas;
GstEditorBin *bin2;
va_list args; va_list args;
g_return_if_fail(bin != NULL); g_return_val_if_fail(bin != NULL, NULL);
g_return_if_fail(GST_IS_BIN(bin)); g_return_val_if_fail(GST_IS_BIN(bin), NULL);
editorcanvas = GST_EDITOR_CANVAS(gtk_type_new(GST_TYPE_EDITOR_CANVAS)); editorcanvas = GST_EDITOR_CANVAS(gtk_type_new(GST_TYPE_EDITOR_CANVAS));
GST_EDITOR_ELEMENT(editorcanvas)->element = GST_ELEMENT(bin); GST_EDITOR_ELEMENT(editorcanvas)->element = GST_ELEMENT(bin);
GST_EDITOR_ELEMENT(editorcanvas)->parent = editorcanvas; GST_EDITOR_ELEMENT(editorcanvas)->parent = GST_EDITOR_BIN(editorcanvas);
va_start(args,first_arg_name); va_start(args,first_arg_name);
gst_editor_element_construct(GST_EDITOR_ELEMENT(editorcanvas),NULL, gst_editor_element_construct(GST_EDITOR_ELEMENT(editorcanvas),NULL,
@ -165,7 +174,7 @@ GtkWidget *gst_editor_canvas_get_canvas(GstEditorCanvas *canvas) {
static gint gst_editor_canvas_button_release(GtkWidget *widget, static gint gst_editor_canvas_button_release(GtkWidget *widget,
GdkEvent *event, GdkEvent *event,
GstEditorCanvas *canvas) { GstEditorCanvas *canvas) {
GstEditorBin *bin = GST_EDITOR_BIN(canvas); //GstEditorBin *bin = GST_EDITOR_BIN(canvas);
gdouble x,y; gdouble x,y;
GstEditorElement *element; GstEditorElement *element;
@ -188,7 +197,7 @@ static gint gst_editor_canvas_button_release(GtkWidget *widget,
gnome_canvas_window_to_world(GNOME_CANVAS(widget), gnome_canvas_window_to_world(GNOME_CANVAS(widget),
event->button.x,event->button.y,&x,&y); event->button.x,event->button.y,&x,&y);
// g_print("calling gst_editor_create_item()\n"); // g_print("calling gst_editor_create_item()\n");
if (element = gst_editor_create_item(GST_EDITOR_BIN(canvas),x,y)) if ((element = gst_editor_create_item(GST_EDITOR_BIN(canvas),x,y)) != NULL)
return TRUE; return TRUE;
return FALSE; return FALSE;
} }

View file

@ -14,9 +14,9 @@ static void gst_editor_connection_destroy(GtkObject *object);
static void gst_editor_connection_realize(GstEditorConnection *connection); static void gst_editor_connection_realize(GstEditorConnection *connection);
/* events fired by items within self */ /* events fired by items within self */
static gint gst_editor_connection_line_event(GnomeCanvasItem *item, //static gint gst_editor_connection_line_event(GnomeCanvasItem *item,
GdkEvent *event, // GdkEvent *event,
GstEditorConnection *connection); // GstEditorConnection *connection);
/* utility functions */ /* utility functions */
@ -35,7 +35,7 @@ enum {
}; };
static GtkObjectClass *parent_class; static GtkObjectClass *parent_class;
static guint gst_editor_connection_signals[LAST_SIGNAL] = { 0 }; //static guint gst_editor_connection_signals[LAST_SIGNAL] = { 0 };
GtkType gst_editor_connection_get_type() { GtkType gst_editor_connection_get_type() {
static GtkType connection_type = 0; static GtkType connection_type = 0;
@ -89,16 +89,16 @@ GstEditorConnection *gst_editor_connection_new(GstEditorBin *parent,
GstEditorPad *frompad) { GstEditorPad *frompad) {
GstEditorConnection *connection; GstEditorConnection *connection;
g_return_if_fail(parent != NULL); g_return_val_if_fail(parent != NULL, NULL);
g_return_if_fail(GST_IS_EDITOR_BIN(parent)); g_return_val_if_fail(GST_IS_EDITOR_BIN(parent), NULL);
g_return_if_fail(frompad != NULL); g_return_val_if_fail(frompad != NULL, NULL);
g_return_if_fail(GST_IS_EDITOR_PAD(frompad)); g_return_val_if_fail(GST_IS_EDITOR_PAD(frompad), NULL);
connection = GST_EDITOR_CONNECTION(gtk_type_new(GST_TYPE_EDITOR_CONNECTION)); connection = GST_EDITOR_CONNECTION(gtk_type_new(GST_TYPE_EDITOR_CONNECTION));
connection->frompad = frompad; connection->frompad = frompad;
connection->frompad->connection = connection; connection->frompad->connection = connection;
connection->fromsrc = connection->frompad->issrc; connection->fromsrc = connection->frompad->issrc;
connection->parent = parent; connection->parent = GST_EDITOR_ELEMENT(parent);
gst_editor_connection_realize(connection); gst_editor_connection_realize(connection);
@ -212,8 +212,8 @@ void gst_editor_connection_resize(GstEditorConnection *connection) {
x2,y2: item coords relative to the bin's group x2,y2: item coords relative to the bin's group
This means translating the x1,y1 coords into world, then into bin. This means translating the x1,y1 coords into world, then into bin.
*/ */
gnome_canvas_item_i2w(connection->frompad->parent->group,&x1,&y1); gnome_canvas_item_i2w(GNOME_CANVAS_ITEM(connection->frompad->parent->group),&x1,&y1);
gnome_canvas_item_w2i(GST_EDITOR_ELEMENT_GROUP(connection->parent), gnome_canvas_item_w2i(GNOME_CANVAS_ITEM(GST_EDITOR_ELEMENT_GROUP(connection->parent)),
&x1,&y1); &x1,&y1);
} else { } else {
if (connection->fromsrc) { if (connection->fromsrc) {
@ -225,11 +225,11 @@ void gst_editor_connection_resize(GstEditorConnection *connection) {
} }
y1 = connection->frompad->y + (connection->frompad->height / 2); y1 = connection->frompad->y + (connection->frompad->height / 2);
y2 = connection->topad->y + (connection->topad->height / 2); y2 = connection->topad->y + (connection->topad->height / 2);
gnome_canvas_item_i2w(connection->frompad->parent->group,&x1,&y1); gnome_canvas_item_i2w(GNOME_CANVAS_ITEM(connection->frompad->parent->group),&x1,&y1);
gnome_canvas_item_w2i(GST_EDITOR_ELEMENT_GROUP(connection->parent), gnome_canvas_item_w2i(GNOME_CANVAS_ITEM(GST_EDITOR_ELEMENT_GROUP(connection->parent)),
&x1,&y1); &x1,&y1);
gnome_canvas_item_i2w(connection->topad->parent->group,&x2,&y2); gnome_canvas_item_i2w(GNOME_CANVAS_ITEM(connection->topad->parent->group),&x2,&y2);
gnome_canvas_item_w2i(GST_EDITOR_ELEMENT_GROUP(connection->parent), gnome_canvas_item_w2i(GNOME_CANVAS_ITEM(GST_EDITOR_ELEMENT_GROUP(connection->parent)),
&x2,&y2); &x2,&y2);
} }

View file

@ -33,7 +33,7 @@
#define GST_IS_EDITOR_CONNECTION(obj) \ #define GST_IS_EDITOR_CONNECTION(obj) \
(GTK_CHECK_TYPE((obj),GST_TYPE_EDITOR_CONNECTION)) (GTK_CHECK_TYPE((obj),GST_TYPE_EDITOR_CONNECTION))
#define GST_IS_EDITOR_CONNECTION_CLASS(obj) \ #define GST_IS_EDITOR_CONNECTION_CLASS(obj) \
(GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_EDITOR_CONNECTION))) (GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_EDITOR_CONNECTION))
typedef struct _GstEditorConnection GstEditorConnection; typedef struct _GstEditorConnection GstEditorConnection;
typedef struct _GstEditorConnectionClass GstEditorConnectionClass; typedef struct _GstEditorConnectionClass GstEditorConnectionClass;
@ -57,5 +57,8 @@ struct _GstEditorConnectionClass {
}; };
GtkType gst_editor_connection_get_type(); GtkType gst_editor_connection_get_type();
GstEditorConnection *gst_editor_connection_new(GstEditorBin *parent,
GstEditorPad *frompad);
#endif /* __GST_EDITOR_CONNECTION_H__ */ #endif /* __GST_EDITOR_CONNECTION_H__ */

View file

@ -30,7 +30,6 @@ GstEditorElement *gst_editor_create_item(GstEditorBin *bin,
GstElementFactory *factory; GstElementFactory *factory;
GstElement *element; GstElement *element;
GstEditorElement *editorelement; GstEditorElement *editorelement;
GtkType itemtype;
factory = element_select_dialog(); factory = element_select_dialog();
if (factory) { if (factory) {

View file

@ -31,9 +31,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);
/* 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);
static gint gst_editor_pad_event(GnomeCanvasItem *item,GdkEvent *event); //static gint gst_editor_pad_event(GnomeCanvasItem *item,GdkEvent *event);
/* events fired by items within self */ /* events fired by items within self */
static gint gst_editor_pad_padbox_event(GnomeCanvasItem *item, static gint gst_editor_pad_padbox_event(GnomeCanvasItem *item,
@ -58,7 +58,7 @@ 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() {
static GtkType pad_type = 0; static GtkType pad_type = 0;
@ -111,10 +111,10 @@ GstEditorPad *gst_editor_pad_new(GstEditorElement *parent,GstPad *pad,
GstEditorPad *editorpad; GstEditorPad *editorpad;
va_list args; va_list args;
g_return_if_fail(parent != NULL); g_return_val_if_fail(parent != NULL, NULL);
g_return_if_fail(GST_IS_EDITOR_ELEMENT(parent)); g_return_val_if_fail(GST_IS_EDITOR_ELEMENT(parent), NULL);
g_return_if_fail(pad != NULL); g_return_val_if_fail(pad != NULL, NULL);
g_return_if_fail(GST_IS_PAD(pad)); g_return_val_if_fail(GST_IS_PAD(pad), NULL);
editorpad = GST_EDITOR_PAD(gtk_type_new(GST_TYPE_EDITOR_PAD)); editorpad = GST_EDITOR_PAD(gtk_type_new(GST_TYPE_EDITOR_PAD));
editorpad->pad = pad; editorpad->pad = pad;
@ -213,8 +213,6 @@ 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) {
gint i;
// 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 */
@ -376,7 +374,7 @@ static gint gst_editor_pad_padbox_event(GnomeCanvasItem *item,
GstEditorBin *bin; GstEditorBin *bin;
// g_print("padbox has event %d\n",event->type); // g_print("padbox has event %d\n",event->type);
g_return_if_fail(GST_IS_EDITOR_PAD(pad)); g_return_val_if_fail(GST_IS_EDITOR_PAD(pad), FALSE);
element = pad->parent; element = pad->parent;
bin = element->parent; bin = element->parent;

View file

@ -18,6 +18,7 @@
*/ */
#include <ctype.h>
#include <gnome.h> #include <gnome.h>
#include <gst/gst.h> #include <gst/gst.h>
@ -30,6 +31,8 @@ static void gst_editor_property_init(GstEditorProperty *property);
static void gst_editor_property_set_arg(GtkObject *object,GtkArg *arg,guint id); static void gst_editor_property_set_arg(GtkObject *object,GtkArg *arg,guint id);
static void gst_editor_property_get_arg(GtkObject *object,GtkArg *arg,guint id); static void gst_editor_property_get_arg(GtkObject *object,GtkArg *arg,guint id);
static GtkWidget *create_property_entry(GtkArg *arg);
enum { enum {
ARG_0, ARG_0,
}; };
@ -189,10 +192,10 @@ static gchar *make_readable_name(gchar *name) {
colon = strstr(name, "::"); colon = strstr(name, "::");
if (colon) if (!colon)
new = g_strdup(&colon[2]);
else
new = g_strdup(name); new = g_strdup(name);
else
new = g_strdup(&colon[2]);
new = g_strdelimit(new, G_STR_DELIMITERS, ' '); new = g_strdelimit(new, G_STR_DELIMITERS, ' ');
@ -230,13 +233,13 @@ void gst_editor_property_show(GstEditorProperty *property, GstEditorElement *ele
else { else {
GtkArg *args; GtkArg *args;
guint32 *flags; guint32 *flags;
guint num_args, i; guint num_args, i, count;
gchar *text;
table = gtk_table_new(1, 2, TRUE); table = gtk_table_new(1, 2, TRUE);
gtk_table_set_row_spacings(GTK_TABLE(table), 2);
gtk_widget_show(table); gtk_widget_show(table);
label = gtk_label_new("Name:"); label = gtk_label_new(_("Name:"));
gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.0); gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.0);
gtk_widget_show(label); gtk_widget_show(label);
entry = gtk_entry_new(); entry = gtk_entry_new();
@ -248,23 +251,23 @@ void gst_editor_property_show(GstEditorProperty *property, GstEditorElement *ele
gtk_signal_connect(GTK_OBJECT(entry), "changed", on_name_changed, element); gtk_signal_connect(GTK_OBJECT(entry), "changed", on_name_changed, element);
args = gtk_object_query_args(type, &flags, &num_args); args = gtk_object_query_args(type, &flags, &num_args);
count = 1;
for (i=0; i<num_args; i++) { for (i=0; i<num_args; i++) {
if (flags && GTK_ARG_READABLE) { if (flags[i] & GTK_ARG_READABLE) {
gtk_object_getv(GTK_OBJECT(element->element), 1, &args[i]); gtk_object_getv(GTK_OBJECT(element->element), 1, &args[i]);
entry = create_property_entry(&args[i]);
if (entry) {
label = gtk_label_new(g_strconcat(make_readable_name(args[i].name), ":", NULL)); label = gtk_label_new(g_strconcat(make_readable_name(args[i].name), ":", NULL));
gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.0); gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.0);
gtk_widget_show(label); gtk_widget_show(label);
entry = gtk_entry_new();
if (args[i].type == GTK_TYPE_STRING) {
text = GTK_VALUE_STRING(args[i]);
if (text)
gtk_entry_set_text(GTK_ENTRY(entry), GTK_VALUE_STRING(args[i]));
}
gtk_widget_show(entry);
gtk_table_attach(GTK_TABLE(table), label, 0, 1, i+1, i+2, GTK_FILL, 0, 0, 0); gtk_table_attach(GTK_TABLE(table), label, 0, 1, count, count+1, GTK_FILL, 0, 0, 0);
gtk_table_attach(GTK_TABLE(table), entry, 1, 2, i+1, i+2, GTK_FILL|GTK_EXPAND, 0, 0, 0); gtk_table_attach(GTK_TABLE(table), entry, 1, 2, count, count+1, GTK_FILL|GTK_EXPAND, 0, 0, 0);
count++;
}
} }
} }
gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, TRUE, 0);
@ -275,7 +278,79 @@ void gst_editor_property_show(GstEditorProperty *property, GstEditorElement *ele
} }
} }
static void widget_show_toggled(GtkToggleButton *button, GtkArg *arg) {
GtkWidget *window;
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(GTK_VALUE_OBJECT(*arg)));
gtk_widget_show(window);
}
static GtkWidget *create_property_entry(GtkArg *arg) {
GtkWidget *entry = NULL;
switch (arg->type) {
case GTK_TYPE_STRING:
{
gchar *text;
entry = gtk_entry_new();
text = GTK_VALUE_STRING(*arg);
if (text)
gtk_entry_set_text(GTK_ENTRY(entry), text);
break;
}
case GTK_TYPE_BOOL:
{
gboolean toggle;
toggle = GTK_VALUE_BOOL(*arg);
entry = gtk_toggle_button_new_with_label((toggle? _("Yes"):_("No")));
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(entry), toggle);
break;
}
case GTK_TYPE_ULONG:
case GTK_TYPE_LONG:
case GTK_TYPE_UINT:
case GTK_TYPE_INT:
{
gint value;
GtkAdjustment *spinner_adj;
value = GTK_VALUE_INT(*arg);
spinner_adj = (GtkAdjustment *) gtk_adjustment_new(50.0, 0.0, 100.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);
break;
}
case GTK_TYPE_FLOAT:
case GTK_TYPE_DOUBLE:
{
gdouble value;
GtkAdjustment *spinner_adj;
value = GTK_VALUE_DOUBLE(*arg);
spinner_adj = (GtkAdjustment *) gtk_adjustment_new(50.0, 0.0, 100.0, 0.1, 5.0, 5.0);
entry = gtk_spin_button_new(spinner_adj, 1.0, 3);
gtk_spin_button_set_value(GTK_SPIN_BUTTON(entry), (gfloat) value);
break;
}
default:
g_print("unknown type: %d\n", arg->type);
break;
}
if (!entry) {
if (arg->type == GTK_TYPE_WIDGET)
{
entry = gtk_toggle_button_new_with_label(_("Show..."));
gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(entry), FALSE);
gtk_signal_connect(GTK_OBJECT(entry), "toggled", widget_show_toggled, arg);
}
}
gtk_widget_show(entry);
return entry;
}

View file

@ -115,10 +115,9 @@ GstElementFactory *element_select_dialog() {
GList *elements; GList *elements;
GstElementFactory *element; GstElementFactory *element;
gchar **classes, **class; gchar **classes, **class;
GSList *classlist;
GSList *classtree, *treewalk; GSList *classtree, *treewalk;
GSList **curlist; GSList **curlist;
struct element_select_classlist *branch; struct element_select_classlist *branch = NULL;
struct element_select_details details; struct element_select_details details;
/* first create the dialog and associated stuff */ /* first create the dialog and associated stuff */

View file

@ -145,6 +145,7 @@ static void gst_audiosink_init(GstAudioSink *audiosink) {
gst_clock_register(audiosink->clock, GST_OBJECT(audiosink)); gst_clock_register(audiosink->clock, GST_OBJECT(audiosink));
//audiosink->clocktime = 0LL; //audiosink->clocktime = 0LL;
GST_FLAG_SET(audiosink, GST_ELEMENT_THREAD_SUGGESTED);
} }
void gst_audiosink_sync_parms(GstAudioSink *audiosink) { void gst_audiosink_sync_parms(GstAudioSink *audiosink) {

View file

@ -339,7 +339,7 @@ GstElement *gst_bin_get_by_name(GstBin *bin,gchar *name) {
g_return_val_if_fail(GST_IS_BIN(bin), NULL); g_return_val_if_fail(GST_IS_BIN(bin), NULL);
g_return_val_if_fail(name != NULL, NULL); g_return_val_if_fail(name != NULL, NULL);
g_print("gstbin: lookup element \"%s\" in \"%s\"\n", name, gst_element_get_name(bin)); g_print("gstbin: lookup element \"%s\" in \"%s\"\n", name, gst_element_get_name(GST_ELEMENT(bin)));
children = bin->children; children = bin->children;
while (children) { while (children) {
child = GST_ELEMENT(children->data); child = GST_ELEMENT(children->data);

View file

@ -76,10 +76,12 @@ static inline char *_gst_print_statename(int state) {
(GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_ELEMENT)) (GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_ELEMENT))
typedef enum { typedef enum {
GST_ELEMENT_MULTI_IN = (1 << 0), GST_ELEMENT_MULTI_IN = (1 << 4),
GST_ELEMENT_THREAD_SUGGESTED = (1 << 5),
} GstElementFlags; } GstElementFlags;
#define GST_ELEMENT_IS_MULTI_IN(obj) (GST_FLAGS(obj) & GST_ELEMENT_MULTI_IN) #define GST_ELEMENT_IS_MULTI_IN(obj) (GST_FLAGS(obj) & GST_ELEMENT_MULTI_IN)
#define GST_ELEMENT_IS_THREAD_SUGGESTED(obj) (GST_FLAGS(obj) & GST_ELEMENT_THREAD_SUGGESTED)
typedef struct _GstElement GstElement; typedef struct _GstElement GstElement;

View file

@ -211,7 +211,7 @@ void gst_elementfactory_add_sink(GstElementFactory *elementfactory, guint16 id)
*/ */
xmlNodePtr gst_elementfactory_save_thyself(GstElementFactory *factory, xmlNodePtr parent) { xmlNodePtr gst_elementfactory_save_thyself(GstElementFactory *factory, xmlNodePtr parent) {
GList *types; GList *types;
xmlNodePtr subtree; xmlNodePtr subtree, subsubtree;
xmlNewChild(parent,NULL,"name",factory->name); xmlNewChild(parent,NULL,"name",factory->name);
xmlNewChild(parent,NULL,"longname", factory->details->longname); xmlNewChild(parent,NULL,"longname", factory->details->longname);
@ -228,7 +228,8 @@ xmlNodePtr gst_elementfactory_save_thyself(GstElementFactory *factory, xmlNodePt
guint16 typeid = GPOINTER_TO_UINT(types->data); guint16 typeid = GPOINTER_TO_UINT(types->data);
GstType *type = gst_type_find_by_id(typeid); GstType *type = gst_type_find_by_id(typeid);
gst_type_save_thyself(type, subtree); subsubtree = xmlNewChild(subtree,NULL,"type",NULL);
gst_type_save_thyself(type, subsubtree);
types = g_list_next(types); types = g_list_next(types);
} }
@ -240,7 +241,8 @@ xmlNodePtr gst_elementfactory_save_thyself(GstElementFactory *factory, xmlNodePt
guint16 typeid = GPOINTER_TO_UINT(types->data); guint16 typeid = GPOINTER_TO_UINT(types->data);
GstType *type = gst_type_find_by_id(typeid); GstType *type = gst_type_find_by_id(typeid);
gst_type_save_thyself(type, subtree); subsubtree = xmlNewChild(subtree,NULL,"type",NULL);
gst_type_save_thyself(type, subsubtree);
types = g_list_next(types); types = g_list_next(types);
} }
@ -287,15 +289,27 @@ GstElementFactory *gst_elementfactory_load_thyself(xmlNodePtr parent) {
factory->details->copyright = g_strdup(xmlNodeGetContent(children)); factory->details->copyright = g_strdup(xmlNodeGetContent(children));
} }
if (!strcmp(children->name, "sources")) { if (!strcmp(children->name, "sources")) {
guint16 typeid = gst_type_load_thyself(children); xmlNodePtr field = children->childs;
while (field) {
if (!strcmp(field->name, "type")) {
guint16 typeid = gst_type_load_thyself(field);
gst_type_add_src(typeid, factory); gst_type_add_src(typeid, factory);
} }
field = field->next;
}
}
if (!strcmp(children->name, "sinks")) { if (!strcmp(children->name, "sinks")) {
guint16 typeid = gst_type_load_thyself(children); xmlNodePtr field = children->childs;
while (field) {
if (!strcmp(field->name, "type")) {
guint16 typeid = gst_type_load_thyself(field);
gst_type_add_sink(typeid, factory); gst_type_add_sink(typeid, factory);
} }
field = field->next;
}
}
children = children->next; children = children->next;
} }

View file

@ -37,7 +37,7 @@ static void gst_filter_init(GstFilter *filter);
static GstElementClass *parent_class = NULL; static GstElementClass *parent_class = NULL;
static guint gst_filter_signals[LAST_SIGNAL] = { 0 }; //static guint gst_filter_signals[LAST_SIGNAL] = { 0 };
GtkType GtkType
gst_filter_get_type(void) { gst_filter_get_type(void) {

View file

@ -438,8 +438,8 @@ static void gst_pad_real_destroy(GtkObject *object) {
*/ */
void gst_pad_load_and_connect(xmlNodePtr parent, GstObject *element, GHashTable *elements) { void gst_pad_load_and_connect(xmlNodePtr parent, GstObject *element, GHashTable *elements) {
xmlNodePtr field = parent->childs; xmlNodePtr field = parent->childs;
GstPad *pad, *targetpad; GstPad *pad = NULL, *targetpad;
guchar *peer; guchar *peer = NULL;
gchar **split; gchar **split;
GstElement *target; GstElement *target;

View file

@ -18,6 +18,7 @@
*/ */
#include <gst/gstpipeline.h> #include <gst/gstpipeline.h>
#include <gst/gstthread.h>
#include <gst/gstsink.h> #include <gst/gstsink.h>
#include <gst/gstutils.h> #include <gst/gstutils.h>
#include <gst/gsttype.h> #include <gst/gsttype.h>
@ -172,7 +173,8 @@ static void gst_pipeline_pads_autoplug_func(GstElement *src, GstPad *pad, GstEle
GstPad *sinkpad; GstPad *sinkpad;
gboolean connected = FALSE; gboolean connected = FALSE;
g_print("gstpipeline: autoplug pad connect function type %d\n", pad->type); g_print("gstpipeline: autoplug pad connect function type %d for \"%s\" to \"%s\"\n", pad->type,
gst_element_get_name(src), gst_element_get_name(sink));
sinkpads = gst_element_get_pad_list(sink); sinkpads = gst_element_get_pad_list(sink);
while (sinkpads) { while (sinkpads) {
@ -284,7 +286,7 @@ void gst_pipeline_add_sink(GstPipeline *pipeline, GstElement *sink)
g_return_if_fail(GST_IS_ELEMENT(sink)); g_return_if_fail(GST_IS_ELEMENT(sink));
pipeline->sinks = g_list_prepend(pipeline->sinks, sink); pipeline->sinks = g_list_prepend(pipeline->sinks, sink);
gst_bin_add(GST_BIN(pipeline), sink); //gst_bin_add(GST_BIN(pipeline), sink);
} }
/** /**
@ -299,11 +301,11 @@ void gst_pipeline_add_sink(GstPipeline *pipeline, GstElement *sink)
gboolean gst_pipeline_autoplug(GstPipeline *pipeline) { gboolean gst_pipeline_autoplug(GstPipeline *pipeline) {
GList *elements; GList *elements;
GstElement *element, *srcelement = NULL, *sinkelement= NULL; GstElement *element, *srcelement = NULL, *sinkelement= NULL;
GList *factories; GList **factories;
GstElementFactory *factory; GstElementFactory *factory;
GList *src_types; GList *src_types;
guint16 src_type = 0, sink_type = 0; guint16 src_type = 0, sink_type = 0;
gboolean complete = FALSE; guint i, numsinks;
g_return_val_if_fail(pipeline != NULL, FALSE); g_return_val_if_fail(pipeline != NULL, FALSE);
g_return_val_if_fail(GST_IS_PIPELINE(pipeline), FALSE); g_return_val_if_fail(GST_IS_PIPELINE(pipeline), FALSE);
@ -348,6 +350,10 @@ gboolean gst_pipeline_autoplug(GstPipeline *pipeline) {
elements = pipeline->sinks; elements = pipeline->sinks;
numsinks = g_list_length(elements);
factories = g_new0(GList *, numsinks);
i = 0;
// fase 2, loop over all the sinks.. // fase 2, loop over all the sinks..
while (elements) { while (elements) {
GList *pads; GList *pads;
@ -362,23 +368,32 @@ gboolean gst_pipeline_autoplug(GstPipeline *pipeline) {
if (pad->direction == GST_PAD_SINK) { if (pad->direction == GST_PAD_SINK) {
sink_type = gst_pad_get_type_id(pad); sink_type = gst_pad_get_type_id(pad);
sinkelement = element;
break; break;
} }
pads = g_list_next(pads); pads = g_list_next(pads);
} }
factories[i] = gst_type_get_sink_to_src(src_type, sink_type);
//factories[i] = g_list_append(factories[i], element);
i++;
elements = g_list_next(elements); elements = g_list_next(elements);
} }
factories = gst_type_get_sink_to_src(src_type, sink_type); while (factories[0]) {
// fase 3: add common elements
factory = (GstElementFactory *)(factories[0]->data);
while (factories) { // check to other paths for mathing elements (factories)
// fase 3: find elements to form a pad for (i=1; i<numsinks; i++) {
if (factory != (GstElementFactory *)(factories[i]->data))
goto differ;
factories[i] = g_list_next(factories[i]);
}
factory = (GstElementFactory *)(factories[0]->data);
factory = (GstElementFactory *)(factories->data); g_print("GstPipeline: common factory \"%s\"\n", factory->name);
g_print("GstPipeline: factory \"%s\"\n", factory->name);
element = gst_elementfactory_create(factory, factory->name); element = gst_elementfactory_create(factory, factory->name);
gst_bin_add(GST_BIN(pipeline), element); gst_bin_add(GST_BIN(pipeline), element);
@ -387,15 +402,88 @@ gboolean gst_pipeline_autoplug(GstPipeline *pipeline) {
srcelement = element; srcelement = element;
factories = g_list_next(factories); factories[0] = g_list_next(factories[0]);
complete = TRUE;
} }
if (complete) { differ:
gst_pipeline_pads_autoplug(srcelement, sinkelement); // loop over all the sink elements
elements = pipeline->sinks;
i = 0;
while (elements) {
GstElement *thesrcelement = srcelement;
GstElement *thebin = GST_ELEMENT(pipeline);
sinkelement = (GstElement *)elements->data;
while (factories[i] || sinkelement) {
// fase 4: add other elements...
if (factories[i]) {
factory = (GstElementFactory *)(factories[i]->data);
g_print("GstPipeline: factory \"%s\"\n", factory->name);
element = gst_elementfactory_create(factory, factory->name);
factories[i] = g_list_next(factories[i]);
}
// we have arived to the final sink element
else {
element = sinkelement;
sinkelement = NULL;
}
// this element suggests the use of a thread, so we set one up...
if (GST_ELEMENT_IS_THREAD_SUGGESTED(element)) {
GstElement *queue;
GList *sinkpads;
GstPad *srcpad, *sinkpad;
g_print("GstPipeline: sugest new thread for \"%s\" %08x\n", element->name, GST_FLAGS(element));
// create a new queue and add to the previous bin
queue = gst_elementfactory_make("queue", g_strconcat("queue_", gst_element_get_name(element), NULL));
gst_bin_add(GST_BIN(pipeline), queue);
// this will be the new bin for all following elements
thebin = gst_thread_new("thread");
srcpad = gst_element_get_pad(queue, "src");
sinkpads = gst_element_get_pad_list(element);
while (sinkpads) {
sinkpad = (GstPad *)sinkpads->data;
// FIXME connect matching pads, not just the first one...
if (sinkpad->direction == GST_PAD_SINK &&
!GST_PAD_CONNECTED(sinkpad)) {
// the queue has the types of the element it connects
srcpad->type = sinkpad->type;
gst_element_get_pad(queue, "sink")->type = sinkpad->type;
gst_pad_connect(srcpad, sinkpad);
g_print("gstpipeline: autoconnect pad \"%s\" (%d) in element %s <-> ",
srcpad->name, srcpad->type, gst_element_get_name(queue));
g_print("pad \"%s\" (%d) in element %s\n", sinkpad->name,
sinkpad->type, gst_element_get_name(element));
break;
}
sinkpads = g_list_next(sinkpads);
}
gst_bin_add(GST_BIN(thebin), element);
gst_bin_add(GST_BIN(pipeline), thebin);
element = queue;
}
// no thread needed, easy case
else {
gst_bin_add(GST_BIN(thebin), element);
}
gst_pipeline_pads_autoplug(thesrcelement, element);
// this element is now the new source element
thesrcelement = element;
}
elements = g_list_next(elements);
i++;
}
return TRUE; return TRUE;
}
g_print("GstPipeline: unable to autoplug pipeline \"%s\"\n", g_print("GstPipeline: unable to autoplug pipeline \"%s\"\n",
gst_element_get_name(GST_ELEMENT(pipeline))); gst_element_get_name(GST_ELEMENT(pipeline)));

View file

@ -517,10 +517,7 @@ void gst_plugin_load_thyself(xmlNodePtr parent) {
} }
else if (!strcmp(field->name, "type")) { else if (!strcmp(field->name, "type")) {
GstTypeFactory *factory = gst_typefactory_load_thyself(field); GstTypeFactory *factory = gst_typefactory_load_thyself(field);
guint16 typeid = gst_type_find_by_mime(factory->mime); gst_type_register(factory);
if (!typeid) {
typeid = gst_type_register(factory);
}
plugin->types = g_list_prepend(plugin->types, factory); plugin->types = g_list_prepend(plugin->types, factory);
typecount++; typecount++;
} }

View file

@ -38,7 +38,7 @@ static void gst_sink_init(GstSink *sink);
static GstElementClass *parent_class = NULL; static GstElementClass *parent_class = NULL;
static guint gst_sink_signals[LAST_SIGNAL] = { 0 }; //static guint gst_sink_signals[LAST_SIGNAL] = { 0 };
GtkType GtkType
gst_sink_get_type(void) { gst_sink_get_type(void) {

View file

@ -54,7 +54,6 @@ static GstElementStateReturn gst_thread_change_state(GstElement *element);
static xmlNodePtr gst_thread_save_thyself(GstElement *element,xmlNodePtr parent); static xmlNodePtr gst_thread_save_thyself(GstElement *element,xmlNodePtr parent);
static void gst_thread_restore_thyself(GstElement *element,xmlNodePtr parent, GHashTable *elements); static void gst_thread_restore_thyself(GstElement *element,xmlNodePtr parent, GHashTable *elements);
static void gst_thread_prepare(GstThread *thread);
static void gst_thread_signal_thread(GstThread *thread); static void gst_thread_signal_thread(GstThread *thread);
static void gst_thread_create_plan_dummy(GstBin *bin); static void gst_thread_create_plan_dummy(GstBin *bin);

View file

@ -73,6 +73,7 @@ guint16 gst_type_register(GstTypeFactory *factory) {
g_return_val_if_fail(factory != NULL, 0); g_return_val_if_fail(factory != NULL, 0);
g_print("gsttype: type register %s\n", factory->mime);
id = gst_type_find_by_mime(factory->mime); id = gst_type_find_by_mime(factory->mime);
if (!id) { if (!id) {
type = g_new0(GstType, 1); type = g_new0(GstType, 1);
@ -396,22 +397,16 @@ GList *gst_type_get_list() {
} }
xmlNodePtr gst_type_save_thyself(GstType *type, xmlNodePtr parent) { xmlNodePtr gst_type_save_thyself(GstType *type, xmlNodePtr parent) {
xmlNodePtr tree;
tree = xmlNewChild(parent, NULL, "type", NULL); xmlNewChild(parent, NULL, "mime", type->mime);
xmlNewChild(tree, NULL, "mime", type->mime); return parent;
return tree;
} }
guint16 gst_type_load_thyself(xmlNodePtr parent) { guint16 gst_type_load_thyself(xmlNodePtr parent) {
xmlNodePtr children = parent->childs; xmlNodePtr field = parent->childs;
guint16 typeid = 0; guint16 typeid = 0;
while (children) {
if (!strcmp(children->name, "type")) {
xmlNodePtr field = children->childs;
while (field) { while (field) {
if (!strcmp(field->name, "mime")) { if (!strcmp(field->name, "mime")) {
typeid = gst_type_find_by_mime(xmlNodeGetContent(field)); typeid = gst_type_find_by_mime(xmlNodeGetContent(field));
@ -425,9 +420,6 @@ guint16 gst_type_load_thyself(xmlNodePtr parent) {
} }
field = field->next; field = field->next;
} }
}
children = children->next;
}
return typeid; return typeid;
} }

View file

@ -31,10 +31,7 @@ GstTypeFactory _factories[] = {
GstPlugin *plugin_init(GModule *module) { GstPlugin *plugin_init(GModule *module) {
GstPlugin *plugin; GstPlugin *plugin;
int i = 0; gint i = 0;
if (gst_plugin_find("gsttypes") != NULL)
return NULL;
plugin = gst_plugin_new("gsttypes"); plugin = gst_plugin_new("gsttypes");
g_return_val_if_fail(plugin != NULL,NULL); g_return_val_if_fail(plugin != NULL,NULL);

View file

@ -145,6 +145,7 @@ static void gst_audiosink_init(GstAudioSink *audiosink) {
gst_clock_register(audiosink->clock, GST_OBJECT(audiosink)); gst_clock_register(audiosink->clock, GST_OBJECT(audiosink));
//audiosink->clocktime = 0LL; //audiosink->clocktime = 0LL;
GST_FLAG_SET(audiosink, GST_ELEMENT_THREAD_SUGGESTED);
} }
void gst_audiosink_sync_parms(GstAudioSink *audiosink) { void gst_audiosink_sync_parms(GstAudioSink *audiosink) {