From c2b8daff3a7187c6cf294e454380c65b39cd360c Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 13 Mar 2000 22:13:11 +0000 Subject: [PATCH] Various cleanups. Moved the overlay code to a specialized widget. Original commit message from CVS: Various cleanups. Moved the overlay code to a specialized widget. One error I cannot seem to fix: switching desktops does not disable the overlay. --- configure.in | 2 ++ gst/gst.c | 1 - gst/gstbuffer.h | 2 ++ gst/gstelementfactory.c | 4 ++-- gst/gstmeta.c | 2 +- gst/gstplugin.h | 2 +- gst/gstthread.c | 2 +- gst/gsttype.h | 2 +- gst/meta/videoraw.h | 5 ++++- gst/types/gsttypes.c | 8 +++++--- test/Makefile.am | 5 ++++- test/videotest.c | 39 +++++++++++++++++++++------------------ 12 files changed, 44 insertions(+), 30 deletions(-) diff --git a/configure.in b/configure.in index b31bd503fb..44d220e5f7 100644 --- a/configure.in +++ b/configure.in @@ -297,6 +297,8 @@ gst/xml/Makefile plugins/Makefile plugins/au/Makefile plugins/wav/Makefile +plugins/riff/Makefile +plugins/riff/avi/Makefile plugins/mp3decode/Makefile plugins/mp3decode/xa/Makefile plugins/mp3decode/xing/Makefile diff --git a/gst/gst.c b/gst/gst.c index f12f6aa181..7c2da8a0c7 100644 --- a/gst/gst.c +++ b/gst/gst.c @@ -31,7 +31,6 @@ extern gint _gst_trace_on; */ void gst_init(int *argc,char **argv[]) { GstTrace *gst_trace; - GstElementFactory *factory; gtk_init(argc,argv); diff --git a/gst/gstbuffer.h b/gst/gstbuffer.h index bd412b4e09..0bc62f7a5c 100644 --- a/gst/gstbuffer.h +++ b/gst/gstbuffer.h @@ -99,6 +99,8 @@ struct _GstBuffer { GstBuffer *parent; }; +/* initialisation */ +void _gst_buffer_initialize(); /* creating a new buffer from scratch */ GstBuffer *gst_buffer_new(); diff --git a/gst/gstelementfactory.c b/gst/gstelementfactory.c index c6f185f1c9..51f65d8b78 100644 --- a/gst/gstelementfactory.c +++ b/gst/gstelementfactory.c @@ -110,8 +110,8 @@ GstElement *gst_elementfactory_create(GstElementFactory *factory, GstElement *element; GstElementClass *oclass; - g_return_if_fail(factory != NULL); - g_return_if_fail(factory->type != 0); + g_return_val_if_fail(factory != NULL, NULL); + g_return_val_if_fail(factory->type != 0, NULL); // create an instance of the element element = GST_ELEMENT(gtk_type_new(factory->type)); diff --git a/gst/gstmeta.c b/gst/gstmeta.c index 2af356c5c0..4b9665fda3 100644 --- a/gst/gstmeta.c +++ b/gst/gstmeta.c @@ -25,7 +25,7 @@ GstMeta *gst_meta_new_size(gint size) { GstMeta *meta; - meta = g_malloc(size); + meta = g_malloc0(size); gst_meta_ref(meta); return meta; diff --git a/gst/gstplugin.h b/gst/gstplugin.h index 164ca85b69..eb57c130c8 100644 --- a/gst/gstplugin.h +++ b/gst/gstplugin.h @@ -49,7 +49,7 @@ typedef GstPlugin * (*GstPluginInitFunc) (GModule *module); GstPlugin *gst_plugin_new(gchar *name); void gst_plugin_set_longname(GstPlugin *plugin,gchar *longname); -void gst_plugin_init(); +void _gst_plugin_initialize(); void gst_plugin_load_all(); gboolean gst_plugin_load(gchar *name); gboolean gst_plugin_load_absolute(gchar *name); diff --git a/gst/gstthread.c b/gst/gstthread.c index e35d52b68c..0a3c52acf2 100644 --- a/gst/gstthread.c +++ b/gst/gstthread.c @@ -94,7 +94,7 @@ gst_thread_class_init(GstThreadClass *klass) { GTK_ARG_READWRITE, ARG_CREATE_THREAD); gstelement_class->change_state = gst_thread_change_state; -// gstelement_class->save_thyself = gst_thread_save_thyself; + gstelement_class->save_thyself = gst_thread_save_thyself; gtkobject_class->set_arg = gst_thread_set_arg; gtkobject_class->get_arg = gst_thread_get_arg; diff --git a/gst/gsttype.h b/gst/gsttype.h index fa96bf8733..dc48eefcfb 100644 --- a/gst/gsttype.h +++ b/gst/gsttype.h @@ -52,7 +52,7 @@ struct _GstTypeFactory { /* initialize the subsystem */ -void gst_type_initialize(); +void _gst_type_initialize(); /* create a new type, or find/merge an existing one */ guint16 gst_type_register(GstTypeFactory *factory); diff --git a/gst/meta/videoraw.h b/gst/meta/videoraw.h index 8901db4304..321621bdf2 100644 --- a/gst/meta/videoraw.h +++ b/gst/meta/videoraw.h @@ -58,11 +58,14 @@ struct _MetaOverlay { // the position of the window int wx, wy; // a reference to the object sending overlay change events - GstObject *overlay_element; + GtkWidget *overlay_element; // the number of overlay regions int clip_count; // the overlay regions of the display window struct _OverlayClip overlay_clip[32]; + + gint width; + gint height; gboolean did_overlay; gboolean fully_obscured; diff --git a/gst/types/gsttypes.c b/gst/types/gsttypes.c index 907c86ce40..c88f08df14 100644 --- a/gst/types/gsttypes.c +++ b/gst/types/gsttypes.c @@ -20,6 +20,7 @@ #include #include +#include gint mp3_typefind(GstBuffer *buf,gpointer *private); gint wav_typefind(GstBuffer *buf,gpointer *private); @@ -30,7 +31,8 @@ GstTypeFactory _factories[] = { { "audio/wav", ".wav", wav_typefind }, { "audio/ac3", ".ac3", NULL }, { "video/raw", ".raw", NULL }, - { "video/mpeg video/mpeg1", ".mpg", NULL }, + { "video/mpeg video/mpeg1 video/mpeg-system", ".mpg", NULL }, + { "video/x-msvideo video/msvideo video/avi", ".avi", NULL }, { NULL, NULL, NULL }, }; @@ -58,8 +60,8 @@ gboolean mp3_typefind(GstBuffer *buf,gpointer *private) { gboolean wav_typefind(GstBuffer *buf,gpointer *private) { gulong *data = (gulong *)GST_BUFFER_DATA(buf); - if (data[0] != "RIFF") return FALSE; - if (data[2] != "WAVE") return FALSE; + if (strncmp((char *)data[0], "RIFF", 4)) return FALSE; + if (strncmp((char *)data[2], "WAVE", 4)) return FALSE; return TRUE; } diff --git a/test/Makefile.am b/test/Makefile.am index ca58fd40e7..80b9ca0c66 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -1,6 +1,7 @@ #noinst_PROGRAMS = basic m types a r plugin w s args mpg123 mcut push qtest noinst_PROGRAMS = qtest spectrum record wave mp3 teardown buffer mp3parse \ - mpeg2parse mp1parse mp3play ac3parse ac3play dvdcat fake cobin videotest + mpeg2parse mp1parse mp3play ac3parse ac3play dvdcat fake cobin videotest \ + aviparse SUBDIRS = xml cothreads bindings @@ -10,6 +11,8 @@ wave_CFLAGS = $(shell gnome-config --cflags gnomeui) wave_LDFLAGS = $(shell gnome-config --libs gnomeui) videotest_CFLAGS = $(shell gnome-config --cflags gnomeui) videotest_LDFLAGS = $(shell gnome-config --libs gnomeui) +aviparse_CFLAGS = $(shell gnome-config --cflags gnomeui) +aviparse_LDFLAGS = $(shell gnome-config --libs gnomeui) mp1parse_CFLAGS = $(shell gnome-config --cflags gnomeui) mp1parse_LDFLAGS = $(shell gnome-config --libs gnomeui) diff --git a/test/videotest.c b/test/videotest.c index 0c973873bb..ed058e085a 100644 --- a/test/videotest.c +++ b/test/videotest.c @@ -8,23 +8,15 @@ gboolean idle_func(gpointer data); GstElement *videosink; GstElement *src; -void eof(GstSrc *src) { - g_print("have eos, quitting\n"); - exit(0); -} - -void resize(GtkWidget *wid, GtkRequisition *req, gpointer sink) { - g_print("have resize %d %d\n", req->width, req->height); - gtk_object_set(GTK_OBJECT(videosink),"width",req->width,"height",req->height,NULL); -} - - int main(int argc,char *argv[]) { GstElement *bin; GstElementFactory *srcfactory; GstElementFactory *videosinkfactory; GtkWidget *appwindow; + GtkWidget *vbox1; + GtkWidget *button; + GtkWidget *draw; _gst_plugin_spew = TRUE; @@ -51,16 +43,27 @@ int main(int argc,char *argv[]) { gst_pad_connect(gst_element_get_pad(src,"src"), gst_element_get_pad(videosink,"sink")); - gtk_signal_connect(GTK_OBJECT(src),"eos", - GTK_SIGNAL_FUNC(eof),NULL); - appwindow = gnome_app_new("Videotest","Videotest"); - gnome_app_set_contents(GNOME_APP(appwindow), - gst_util_get_widget_arg(GTK_OBJECT(videosink),"widget")); + + vbox1 = gtk_vbox_new (FALSE, 0); + gtk_widget_show (vbox1); + + button = gtk_button_new_with_label(_("test"));//_with_label (_("chup")); + gtk_widget_show (button); + gtk_box_pack_start (GTK_BOX (vbox1), button, FALSE, FALSE, 0); + //gtk_widget_set_usize (button, 50, 50); + //gtk_widget_set_usize (button, 0, 0); + + draw = gst_util_get_widget_arg(GTK_OBJECT(videosink),"widget"), + gtk_box_pack_start (GTK_BOX (vbox1), + draw, + TRUE, TRUE, 0); + gtk_widget_show (draw); + + gnome_app_set_contents(GNOME_APP(appwindow), vbox1); + gtk_object_set(GTK_OBJECT(appwindow),"allow_grow",TRUE,NULL); gtk_object_set(GTK_OBJECT(appwindow),"allow_shrink",TRUE,NULL); -// gtk_signal_connect(GTK_OBJECT(appwindow),"size-request", -// GTK_SIGNAL_FUNC(resize),videosink); gtk_widget_show_all(appwindow);